Get Nested Message
Convenience Method
Declaration
TibrvStatusgetMsg
(
const char* fieldName,
TibrvMsg& subMessage,
tibrv_u16 fieldId=0);
Purpose
Get the value of a field as a Rendezvous message.
Remarks
Since it is not possible to convert any other datatype to a message, the field must already contain a message. Otherwise, the method returns TIBRV_CONVERSION_FAILED.
Pointer data extracted from the field remain valid until the message is destroyed; that is, even removing the field or updating the field’s value does not invalidate pointer data.
After extracting a submessage, a program can detach it. A detached submessage remains valid and unchanged even after the parent message is destroyed. The program must explicitly destroy the detached submessage.
This method produces values that are modifiable snapshots of the field data. Programs may modify the resulting submessage by adding, removing or updating fields. However, these modifications do not change the field in the original parent message; instead, they force Rendezvous software to make a copy of the field (see Rendezvous Protects the Message from Changes to Submessage Snapshots).
Parameter |
Description |
|
Get a field with this name. |
|
The program supplies a variable in this parameter, and the method stores the submessage in that variable. |
|
Get the field with this identifier. Zero is a special value that signifies no field identifier. All non-zero field identifiers must be unique within each message. |