TipcMsgAppendMsgArray


Name

TipcMsgAppendMsgArray — append a field containing an array of MSG fields to a message

Synopsis

T_BOOL TipcMsgAppendMsgArray(msg, msg_array_data, array_size) 
T_IPC_MSG msg; 
T_IPC_MSG *msg_array_data; 
T_INT4 array_size; 

Arguments

msg — message to append field to

msg_array_data — data for new message field

array_size — number of elements in msg_array_data

Return Values

TRUE if the field was successfully appended to the message, FALSE otherwise.

Diagnostics

If TipcMsgAppendMsgArray fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcMsgAppendMsgArray appends a message array (MSG_ARRAY) field containing msg_array_data to the end of a message’s data. TipcMsgAppendMsgArray makes a copy of the message array data.

Caution

None

See Also

TipcMsgAppendMsgArrayPtr, TipcMsgNextMsgArray

Examples

This example creates a message and appends a MSG_ARRAY field:

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 (!TipcMsgAppendMsgArray(msg, 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