Codemesh Runtime v3 C++ API Reference
3.9.205
|
Represents a request communicated between client and server. More...
#include <xmog_request.h>
Public Types | |
enum | { INIT_BLOCK_SIZE = 4096 } |
Public Member Functions | |
xmog_request (xmog::xmog_message_id reqtype, const void *orig=0, bool reply_expected=true) | |
void | dump () |
xmog::xmog_message_id | type (void) const |
ACE_Future< xmog_reply * > & | reply (void) |
ACE_Message_Block * | block (void) const |
const void * | originator (void) const |
void | expires (const ACE_Time_Value &expiration) |
bool | expired (const ACE_Time_Value &now) const |
void | complete (xmog_reply *reply) |
bool | reply_expected (void) const |
int | writeBoolean (bool b) |
Appends a bool to the message. | |
int | writeByte (jbyte b) |
Appends a byte to the message. | |
int | writeChar (jchar c) |
Appends a jchar to the message. | |
int | writeDouble (jdouble d) |
Appends a jdouble to the message. | |
int | writeFloat (jfloat d) |
Appends a jfloat to the message. | |
int | writeInt (jint i) |
Appends a 32bit integer to the message. More... | |
int | writeShort (jshort s) |
Appends a 16bit integer to the message. More... | |
int | writeLong (jlong l) |
Appends a 64-bit integer to the message. More... | |
int | writeDataCode (xmog::xmog_data_code code, int align=4) |
Appends a data code with optional padding. More... | |
int | writeDataBoolean (bool b) |
int | writeDataByte (jbyte b) |
int | writeDataChar (jchar ch) |
int | writeDataDouble (jdouble d) |
int | writeDataFloat (jfloat f) |
int | writeDataInt (jint i) |
int | writeDataLong (jlong l) |
int | writeDataShort (jshort s) |
int | writeDataNull (int align) |
int | writeDataProxy (xmog_base *obj, int align, xmog_localenv *env=NULL) |
int | writeEncodedDataString (xmog_remote_java_value &data) |
Appends an encoded string to the message. | |
int | writeDataStringUtf (const char *str, size_t len=(size_t) -1) |
Appends a UTF-8 encoded string to the message. More... | |
int | writeDataStringUtf16 (const unsigned short *str, size_t len=(size_t) -1) |
Appends a UTF-16 encoded string to the message. More... | |
int | writeString (const char *str, size_t len=(size_t) -1) |
Appends a platform string to the message. More... | |
int | writeString (const XMOG_WCHAR *str, size_t len=(size_t) -1) |
Appends a wide string to the message. More... | |
int | writeUTF (const char *utf, size_t len=(size_t) -1) |
Appends a UTF string to the message. More... | |
int | writeParameter (const xmog_remote_java_value &val, int align, int &cbAdded) |
Writes a parameter to the message. More... | |
Protected Attributes | |
ACE_Message_Block * | block_ |
Represents a request communicated between client and server.
xmog_request allows formation of a request message. Can add information to the message and obtain a ACE_Message_Block pointer for a block containing the formed message for transmission.
|
explicit |
Constructor. Specifies the message request type and the originating party as a pointer that can be matched up with the reply later. Also can specify whether or not the message being formed expects a reply from the peer.
ACE_Message_Block* xmog_request::block | ( | void | ) | const |
Obtain a pointer to an ACE_Message_Block containing the formed message. The caller is responsible for ensuring that the block is released when no longer needed.
ACE_Message_Block | pointer for a block containing the formed message. 0 on failure. |
void xmog_request::complete | ( | xmog_reply * | reply | ) |
Finalize this request with the specified xmog_reply. Sets the enclosed ACE_Future from which the initiator will get the reply.
reply | xmog_reply reference to set the reply from. Any needed content is copied, and the reply can be safely deleted upon return. |
bool xmog_request::expired | ( | const ACE_Time_Value & | now | ) | const |
Check to see if the request has timed out (expired).
now | The current time of day. If this request's expiration is the same or earlier than now, returns true. |
void xmog_request::expires | ( | const ACE_Time_Value & | expiration | ) |
Set the request's expiration time. This is an absolute time in the future. This object does not act on the time value. It can be checked for expiration by calling the expired() method with the current time.
const void* xmog_request::originator | ( | void | ) | const |
Obtain the originating party's pointer.
ACE_Future<xmog_reply*>& xmog_request::reply | ( | void | ) |
Obtain a reference to the ACE_Future that represents this request's completion. Requester can wait on this future or insert it in a ACE_Future_Observer. Since it's a reference to the ACE_Future contained within this request, it's only valid as long as this request object. Note that if this request was created with reply_expected == false, this method will throw xmog_exception_impl.
bool xmog_request::reply_expected | ( | void | ) | const |
Check to see whether or not this xmog_request expects a reply from the peer.
true | if a reply is expected, else false. |
int xmog_request::writeDataCode | ( | xmog::xmog_data_code | code, |
int | align = 4 |
||
) |
Appends a data code with optional padding.
code | a data code. |
align | the alignment for the next data element |
int xmog_request::writeDataStringUtf | ( | const char * | str, |
size_t | len = (size_t) -1 |
||
) |
Appends a UTF-8 encoded string to the message.
This is the UTF-8 encoding message for user strings. See writeUTF() for internal UTF-8 strings.
str | a string in utf8 encoding. |
len | the optional number of characters to encode. The default is -1, which stands for all characters. |
int xmog_request::writeDataStringUtf16 | ( | const unsigned short * | str, |
size_t | len = (size_t) -1 |
||
) |
Appends a UTF-16 encoded string to the message.
This is the UTF-16 encoding message for user strings.
str | a string in utf16 encoding. |
len | the optional number of characters to encode. The default is -1, which stands for all characters. |
int xmog_request::writeInt | ( | jint | i | ) |
Appends a 32bit integer to the message.
This method converts the number from host to network order.
int xmog_request::writeLong | ( | jlong | l | ) |
Appends a 64-bit integer to the message.
This method converts the number from host to network order.
int xmog_request::writeParameter | ( | const xmog_remote_java_value & | val, |
int | align, | ||
int & | cbAdded | ||
) |
Writes a parameter to the message.
This does not update any message fields that track counts and positions; Use the returned cbAdded value to do this in the caller.
int xmog_request::writeShort | ( | jshort | s | ) |
Appends a 16bit integer to the message.
This method converts the number from host to network order.
int xmog_request::writeString | ( | const char * | str, |
size_t | len = (size_t) -1 |
||
) |
Appends a platform string to the message.
This method converts the platform string to UTF before appending it to the message.
str | a string in platform encoding. |
len | the optional number of characters to encode. The default is -1, which stands for all characters. |
int xmog_request::writeString | ( | const XMOG_WCHAR * | str, |
size_t | len = (size_t) -1 |
||
) |
Appends a wide string to the message.
This method converts the wide string to UTF before appending it to the message.
str | a string in platform encoding. |
len | the optional number of characters to encode. The default is -1, which stands for all characters. Notice that the argument is the number of characters, not the number of bytes. |
int xmog_request::writeUTF | ( | const char * | utf, |
size_t | len = (size_t) -1 |
||
) |
Appends a UTF string to the message.
This method is different from writeStringUtf() because it is not meant for user data, but only for internal strings like method names, etc.
str | a string in UTF encoding. In many cases, developers can directly use this method, which is much faster than the corresponding writeString() methods because no conversion has to be performed. |
len | the optional number of characters to encode. The default is -1, which stands for all characters. |