TibrvMsg()
Constructor
Declaration
TibrvMsg
(tibrv_u32 initialSize=512); // Declare empty msg obj.TibrvMsg
(const TibrvMsg& msg); // Copy constructor.TibrvMsg
(const void* bytes); // Create from bytes.TibrvMsg
(tibrvMsg Cmsg, // Create from C handle.
tibrv_bool detached);
Purpose
Remarks
The first form of this constructor merely declares a C++ variable. It does not allocate storage; it does not create a C message object. (Subsequent operations on the variable automatically allocates storage and create the inner structure.) This form works efficiently with methods such as TibrvTransport::sendRequest(), which requires a variable to receive its reply message and overwrites the contents of that variable.
The other forms of this constructor simultaneously declare a variable, allocate storage, create an object with inner structure, and store the status code in the object. The status code indicates any conditions that might make the message object unusable; if the object is unusable, any subsequent operation on the message will return the same status code.
None of the constructors place address information (for example, the subject) on the new message object.
This class has no destroy()
method; use the destructor instead (see ~TibrvMsg()).
Parameter |
Description |
|
Optional. This form of the constructor declares an empty message variable. When a subsequent operation triggers storage allocation, allocate a storage block of this size (in bytes). |
|
Create an independent copy of this message. |
|
Create a message with fields populated from this byte array. The new message is completely independent of the byte array. For example, programs can create such byte arrays from messages using the method TibrvMsg::getAsBytes(), and store them in files; after reading them from such files, programs can reconstruct a message from its byte array. |
Create a C++ message object that embeds this C message handle. This form of the constructor does not copy the C message. |
|
|
Specify whether the Cmsg is detached—that is, whether the program owns the message.
|
See Also
tibrvMsg in