The TipcMt class is a C++ interface to the TipcMt-prefix SmartSockets C API function calls. The TipcMt class contains a pointer to the message type (C type T_IPC_MT).
A TipcMt object is created by specifying one of the standard message types to the TipcMt constructor. This is accomplished in one of four ways: specifying a C type T_IPC_MT variable, specifying a standard message type number, specifying a standard message type name, or specifying another TipcMt object. For example:
T_IPC_MT mt;// Get a C type T_IPC_MT using a C API call.
mt = TipcMtLookup("info");// Create TipcMt objects four different ways
TipcMt mt1(mt); TipcMt mt2("info"); TipcMt mt3(T_MT_INFO); TipcMt mt4(mt1);
In a similar manner, TipcMsg objects are also constructed by using a TipcMt object, message type number, a message type name, or an initialized C type T_IPC_MT variable. Depending on your needs, it is possible to save an additional step by constructing TipcMsg objects directly from a message type number, a message type name, or an initialized C type T_IPC_MT variable rather than from a constructed TipcMt object.
An important use of the TipcMt class is creating user-defined message types when a standard message type does not meet your requirements. A user-defined message type is created by calling the appropriate constructor. The resulting TipcMt object is then used in a TipcMsg constructor to create a message of the user-defined type. For example:
#define XYZ_COORD_DATA 1001
// Create user defined message type.
TipcMt mt("xyz_coord_data", XYZ_COORD_DATA, "int4 int4 int4");
When a TipcMt object goes out of scope, the message type is not destroyed, just the TipcMt object it was managing. A TipcMt object is reconstructed using the user-defined data type. For example:
Like the TipcMsg class, the TipcMt class has vacant and non-vacant objects. A vacant TipcMt object is one that does not refer to a C T_IPC_MT variable. A non-vacant TipcMt object does refer to a C T_IPC_MT variable. A vacant object is constructed this way:
A vacant TipcMt object is useful for creating and looking up global callbacks. See Global Callbacks for more information on how to create a global callback.
The TipcMt::Destroy() member function leaves a TipcMt object vacant after it calls the C API function TipcMtDestroy(). The TipcMt::Create() member function leaves a TipcMt object vacant whenever it fails. The overloaded TipcMt::Lookup() member functions also leave an object vacant whenever a message type look up fails.
The TipcMt::Vacant() member function can be used to determine if a TipcMt object is vacant or non-vacant.
TIBCO SmartSockets™ cxxipc Class Library Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |