Get Nested Message

Convenience Function

Declaration

tibrv_status tibrvMsg_GetMsg(
   tibrvMsg       message,
   const char*    fieldName,
   tibrvMsg*      subMessage);
tibrv_status tibrvMsg_GetMsgEx(
   tibrvMsg       message,
   const char*    fieldName,
   tibrvMsg*      subMessage,
   tibrv_u16      fieldId);

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 function 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 function 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

message

Get the specified field of this message.

fieldName

Get a field with this name.

subMessage

The program supplies a location in this parameter, and the function stores a pointer to the submessage in that location.

fieldId

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.

See Also

Validity of Data Extracted From Messages

Field Names and Field Identifiers

tibrvMsg_Detach()