TipcMsg user class for constructing, manipulating, and eventually destroying messages
TipcMsg msg; TipcMsg msg(mt_obj
); TipcMsg msg(mt_num
); TipcMsg msg(mt_num
,destination
); TipcMsg msg(mt_num
,destination
,sender
); TipcMsg msg(mt_name
); TipcMsg msg(c_api_msg
); TipcMsg msg(msg_object
);
The TipcMsg class acts as a C++ interface to the SmartSockets TipcMsg* C language API functions. The methods of the TipcMsg class allow you to construct messages and to manipulate the data of a message. See the TIBCO SmartSockets User’s Guide for more information on message composition in SmartSockets applications.
The TipcMsg class has two ways of appending and accessing data fields from a message. The first is designed to provide an interface similar to the C API and consists of several overloaded Append and Next member functions. The Append() and Next() member functions replace the prefixed TipcMsgAppend* and TipcMsgNext* functions of the C API. See Using Append and Next Functions for examples using insertion and extraction operators.
The second method of appending and accessing data fields is designed to provide an interface similar to C++ IOstream classes. Overloaded insertion (operator<<) and extraction (operator>>) operators replace the prefixed TipcMsgAppend* and TipcMsgNext* functions of the C API. Examples using insertion and extraction operators are presented in Using Append and Next Functions.
The TipcMsg class contains a private SmartSockets C API T_IPC_MSG message.
None
Syntax:
|
|
Remarks:
|
Appends a field of the given type with an unknown value.
|
C API:
|
TipcMsgAppendUnknown
|
Syntax:
|
|
Remarks:
|
Get the current field of a message.
|
C API:
|
TipcMsgGetCurrent
|
|
|
Syntax:
|
|
Remarks:
|
Set the current field of a message.
|
C API:
|
TipcMsgSetCurrent
|
Syntax:
|
|
Remarks:
|
Returns
TRUE if the value of the current field is known.
|
C API:
|
TipcMsgCurrentFieldKnown
|
Syntax:
|
|
Remarks:
|
Delete the current field in a message, whether it is named or unnamed.
|
C API:
|
TipcMsgDeleteCurrent
|
Syntax:
|
|
Remarks:
|
Delete the field in a message with the specified name.
|
C API:
|
TipcMsgDeleteNamedField
|
Syntax:
|
|
Remarks:
|
Get the delivery mode of a message.
|
C API:
|
TipcMsgGetDeliveryMode
|
|
|
Syntax:
|
|
Remarks:
|
Set the delivery mode of a message.
|
C API:
|
TipcMsgSetDeliveryMode
|
Syntax:
|
|
Remarks:
|
Get the delivery timeout of a message.
|
C API:
|
TipcMsgGetDeliveryTimeout
|
|
|
Syntax:
|
|
Remarks:
|
Set the delivery timeout of a message.
|
C API:
|
TipcMsgSetDeliveryTimeout
|
Syntax:
|
|
Remarks:
|
Get the destination property of a message.
|
C API:
|
TipcMsgGetDest
|
|
|
Syntax:
|
|
Remarks:
|
Set the destination property of a message.
|
C API:
|
TipcMsgSetDest
|
Syntax:
|
|
Remarks:
|
Destroy a message. This call leaves the object vacant after calling TipcMsgDestroy().
|
C API:
|
TipcMsgDestroy
|
Syntax:
|
|
Remarks:
|
Get the time to live property of a message.
|
C API:
|
TipcMsgGetExpiration
|
|
|
Syntax:
|
|
Remarks:
|
Set the time to live property of a message.
|
C API:
|
TipcMsgSetExpiration
|
Syntax:
|
|
Remarks:
|
Get the header string encoding mode of a message.
|
C API:
|
TipcMsgGetHeaderStrEncode
|
|
|
Syntax:
|
|
Remarks:
|
Set the header string encoding mode of a message.
|
C API:
|
TipcMsgSetHeaderStrEncode
|
Syntax:
|
|
Remarks:
|
Get the load balancing mode of a message.
|
C API:
|
TipcMsgGetLbMode
|
|
|
Syntax:
|
|
Remarks:
|
Set the load balancing mode of a message.
|
C API:
|
TipcMsgSetLbMode
|
Syntax:
|
|
Remarks:
|
Get the number of fields in a message.
|
C API:
|
TipcMsgGetNumFields
|
|
|
Syntax:
|
|
Remarks:
|
Set the number of fields in a message.
|
C API:
|
TipcMsgSetNumFields
|
Syntax:
|
|
Remarks:
|
Get the priority of a message.
|
C API:
|
TipcMsgGetPriority
|
|
|
Syntax:
|
|
Remarks:
|
Set the priority of a message.
|
C API:
|
TipcMsgSetPriority
|
Syntax:
|
|
Remarks:
|
Get the reply to destination property of a message.
|
C API:
|
TipcMsgGetReplyTo
|
|
|
Syntax:
|
|
Remarks:
|
Set the reply to destination property of a message.
|
C API:
|
TipcMsgSetReplyTo
|
Syntax:
|
|
Remarks:
|
Reset the internal problem flag used by insertion and extraction operators to
FALSE . See also the description of the Check manipulator in the Manipulators section on page 151.
|
Syntax:
|
|
Remarks:
|
Get the sender property of a message.
|
C API:
|
TipcMsgGetSender
|
|
|
Syntax:
|
|
Remarks:
|
Set the sender property of a message.
|
C API:
|
TipcMsgSetSender
|
Syntax:
|
|
Remarks:
|
Get the type of a message.
|
C API:
|
TipcMsgGetType
|
|
|
Syntax:
|
|
Remarks:
|
Set the type of a message.
|
C API:
|
TipcMsgSetType
|
Syntax:
|
|
Remarks:
|
Get user-defined property from a message.
|
C API:
|
TipcMsgGetUserProp
|
|
|
Syntax:
|
|
Remarks:
|
Set user-defined property of a message.
|
C API:
|
TipcMsgSetUserProp
|
Syntax:
|
|
Remarks:
|
Convert a TipcMsg object to a C API T_IPC_MSG by returning the internal T_IPC_MSG of the TipcMsg object.
|
Syntax:
|
|
Remarks:
|
This manipulator returns the size of an array or binary data previously extracted using the TipcMsg extraction operator (operator>>). The size is returned in
size_return .
|
Syntax:
|
|
Remarks:
|
This manipulator informs the TipcMsg object of the
size of the next array or binary data to be inserted into the object.
|
This code fragment shows how to construct a NUMERIC_DATA message, set some of its values, and then access this data:
#include <rtworks/cxxipc.hxx> int main() { cout << "Create the message." << endl; TipcMsg msg(T_MT_NUMERIC_DATA); if (!msg) {// error
} cout << "Set the message properties." << endl; msg.Sender("_conan"); if (!msg) {// error
} msg.Dest("thermal"); if (!msg) {// error
} msg.Priority(2); if (!msg) {// error
} cout << "Append fields." << endl; msg << "voltage" << (T_REAL8)33.4534 << "switch_pos" << (T_REAL8)0.0 << Check; if (!msg) {// error
} cout << "Access fields." << endl; msg.Current(0); if (!msg) {// error
} T_STR str_val; msg >> str_val; if (!msg) {// error
} T_REAL8 real8_val; msg >> real8_val; if (!msg) {// error
} cout << str_val << " = " << real8_val << endl; msg >> str_val; if (!msg) {// error
} msg >> real8_val; if (!msg) {// error
} cout << str_val << " = " << real8_val << endl; cout << "Destroy the message." << endl; return T_EXIT_SUCCESS;// all done
// main
TIBCO SmartSockets™ cxxipc Class Library Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |