TipcMsgAddNamedMsgArray add a field containing an array of MSG fields to a message using a name
T_BOOL TipcMsgAddNamedMsgArray(msg
,name
,value
,size
) T_IPC_MSGmsg
; T_STRname
; T_MSG *value
; T_INT4size
;
msg
message to add field to
name
name of the field
value
value of the field
size
number of elements in the field
TRUE
if the addition was successful, FALSE
otherwise.
If TipcMsgAddNamedMsgArray fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcMsgAddNamedMsgArray adds a field containing an array of MSG fields to a message, associating that field with a name. If the name already exists in the message, this fails, and the field is not added to the message.
TipcMsgAppendMsgArray, TipcMsgUpdateNamedMsgArray, TipcMsgGetNamedMsgArray
This example creates a message and adds a MSG_ARRAY value to it:
T_IPC_MT mt; T_IPC_MSG msg; #define ARRAY_SIZE 3 T_IPC_MSG msg_array_data[ARRAY_SIZE]; #define USER_MT_CONTAINER 3 mt = TipcMtCreate("container", USER_MT_CONTAINER, "msg_array"); if (mt == NULL) {return
; /* error */
} msg = TipcMsgCreate(mt); if (msg == NULL) {return
; /* error */
}/* An RTclient would typically set the destination of */
/* a message at this point by calling TipcMsgSetDest. */
mt = TipcMtLookupByNum(T_MT_TIME); if (mt == NULL) {return
; /* error */
} msg_array_data[0] = TipcMsgCreate(mt); if (msg_array_data[0] == NULL) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); if (mt == NULL) {return
; /* error */
} msg_array_data[1] = TipcMsgCreate(mt); if (msg_array_data[1] == NULL) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_END_OF_FRAME); if (mt == NULL) {return
; /* error */
} msg_array_data[2] = TipcMsgCreate(mt); if (msg_array_data[2] == NULL) {return
; /* error */
} if (!TipcMsgAppendReal8(msg_array_data[0], TutGetWallTime())) {return
; /* error */
} if (!TipcMsgAppendStrReal8(msg_array_data[1], "speed_limit", 55.0)) {return
; /* error */
} if (!TipcMsgAddNamedMsgArray(msg, "foo", msg_array_data, ARRAY_SIZE)) {return
; /* error */
}/* A process would typically send a message at this point by */
/* calling TipcConnMsgSend or TipcSrvMsgSend. */
/* A process would typically destroy a message at this point by */
/* calling TipcMsgDestroy. */
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |