#include <tmt.h>
Public Methods | |
TipcMt (T_IPC_MT mt) throw () | |
TipcMt (const char *name) throw (TipcException) | |
TipcMt (int4 num) throw (TipcException) | |
TipcMt (const TipcMt &mt) throw (TipcException) | |
virtual | ~TipcMt () throw () |
operator T_IPC_MT () const throw () | |
void | print (T_OUT_FUNC func=(T_OUT_FUNC)::TutOut) const throw (TipcException) |
const char * | getGrammar () const throw (TipcException) |
const char * | getName () const throw (TipcException) |
int4 | getNum () const throw (TipcException) |
void | setKey (const void *keyValue, int4 size) throw (TipcException) |
void | setEncryptObj (TipcMtEncrypt *encryptObj=NULL) throw (TipcException) |
TipcMtEncrypt * | getDecryptObj () const throw (TipcException) |
void | setDecryptObj (TipcMtEncrypt *decryptObj=NULL) throw (TipcException) |
TipcMtEncrypt * | getEncryptObj () const throw (TipcException) |
int2 | getPriority () const throw (TipcException) |
void | setPriority (int2 priority) throw (TipcException) |
void | setPriorityUnknown () throw (TipcException) |
int4 | getUserProp () const throw (TipcException) |
void | setUserProp (int4 user_prop) throw (TipcException) |
bool | getCompression () const throw (TipcException) |
void | setCompression (bool compression) throw (TipcException) |
T_IPC_DELIVERY_MODE | getDeliveryMode () const throw (TipcException) |
void | setDeliveryMode (T_IPC_DELIVERY_MODE delivery_mode) throw (TipcException) |
T_IPC_LB_MODE | getLbMode () const throw (TipcException) |
void | setLbMode (T_IPC_LB_MODE lb_mode) throw (TipcException) |
real8 | getDeliveryTimeout () const throw (TipcException) |
void | setDeliveryTimeout (real8 delivery_timeout) throw (TipcException) |
bool | getHeaderStrEncode () const throw (TipcException) |
void | setHeaderStrEncode (bool header_encode) throw (TipcException) |
Static Public Methods | |
TipcMt | create (const char *name, int4 num, const char *grammar) throw (TipcException) |
TipcMt | lookup (const char *name) throw (TipcException) |
void | traverse (TipcMtTraverser *travObj) throw (TipcException) |
TipcMt | lookup (int4 num) throw (TipcException) |
void | destroy (TipcMt &mt) throw (TipcException) |
Friends | |
class | TipcConn |
class | TipcSrv |
SmartSockets provides a large number of standard message types that you can use and that are also used internally by SmartSockets. When a standard message type does not satisfy a specific need, you can create a user-defined message type. Both standard and user-defined message types are handled in the same manner. Once the message type is created, messages can be constructed, sent, received, and processed through a variety of methods.
|
Constructor for compatibility with the C API; use this constructor a to create NULL message types used to match all entries in some of the TipcSrv callback registration methods. |
|
Create a TipcMt object by message type name. In order for this constructor to work, the message type must be created using the TipcMt::create() static method.
|
|
Create a TipcMt object by message type number. In order for this constructor to work, the message type must be created using the TipcMt::create() static method.
|
|
Copy constructor. |
|
Destructor. Note that the destructor does not destroy the message type created by calling TipcMt::create(); instead it destroys the object with the wrapper interface. To destroy the message type for the whole process, call TipcMt::destroy(). |
|
Creates a new message type for the process. Message types are stored in a process-wide hash table that is accessible from any thread; create() adds a new entry to this global hash table. A message type is a template for a specific kind of message. Once the message type is created, any number of TipcMsg objects of that type can be created. The new message type is created with an unset priority property, a delivery mode property of T_IPC_DELIVERY_BEST_EFFORT, an unset delivery timeout property, a load balancing mode property of T_IPC_LB_NONE, a header string encode property of FALSE, a user-defined property of 0, and an unset compression property. These properties can be set with the methods TipcMt::setPriority(), TipcMt::setDeliveryMode(), TipcMt::setDeliveryTimeout(), TipcMt::setLbMode(), TipcMt::setHeaderStrEncode(), and TipcMt::setUserProp(), TipcMt::setCompression, respectively.
|
|
Removes an entry matching the parameter mt from the global message type table.
|
|
Accessor method for the compression property of the message. When a message is created its compression property is initialized to the message type compression property. The compression property of an outgoing message can always be set on a per-message basis, but using the message type user-defined property makes it easier to change the default compression property for all outgoing messages of a specific type. The standard SmartSockets message types by default all have a compression property of false, but these may be changed if desired.
|
|
Gets the Encryption object associated with this message type.
|
|
Accessor method for the delivery mode property of the message.
|
|
Accessor method for the delivery mode property of the message. The delivery mode of a message controls what level of guarantee is used when the message is sent through a connection with TipcConn::send(). When a message is created, its delivery mode is initialized to the message type delivery mode. This allows a default value to easily be set for all messages of a certain type. The default message delivery mode is T_IPC_DELIVERY_BEST_EFFORT. In this mode, no special actions are taken to ensure delivery of sent messages. The message is delivered unless network failures or process failures occur. If the message is not delivered, there is no way for the sender to know that delivery failed. When there is a failure, it is possible for some messages to be lost or be delivered in a different order than the order in which they were published. In the case of a network or process failure, a more useful delivery mode is T_IPC_DELIVERY_ORDERED. Messages can still be lost in the event of a failure, but all delivered messages are received in the order in which they were published. Because Java Message Service (JMS) cannot handle messages that come out of order, you must use the T_IPC_DELIVERY_ORDERED delivery mode or one of the GMD delivery modes if you are sending messages to a JMS client. The difference between the other delivery modes and the GMD delivery modes is that in GMD, a copy of the message is kept when the message is sent and acknowledgements are sent when the message is received. No acknowledgements (ACKs) are used in the ordered or best effort delivery modes, and no copy of the message is kept. One of the GMD delivery modes is T_IPC_DELIVERY_SOME. In this mode, the sending process saves a copy of the message in the connection GMD area until the message is successfully delivered, and the sender can also resend the message if necessary. Delivery is considered successful if the sent message is acknowledged by at least one receiving process. The other and most robust GMD delivery mode is T_IPC_DELIVERY_ALL. In this mode, the sending process saves a copy of the message in the connection GMD area until the message is successfully delivered, and the sender can also resend the message if necessary. Delivery is not considered successful until all receiving processes acknowledge the sent message. For two processes communicating through a non-RTclient and non-RTserver T_IPC_CONN connection, T_IPC_DELIVERY_SOME and T_IPC_DELIVERY_ALL are identical because there is only one process receiving the message. For RTclients, the two modes do differ if more than one RTclient is subscribing to the subject in the destination of the message.
|
|
Gets the Decryption object associated with this message type.
|
|
Gets the grammar property of the message type. The grammar property identifies the layout of fields in messages that use this type. The grammar consists of a list of field types. Each field type in the grammar corresponds to one field in the message. For example, the standard message type TIME has a grammar real8, which defines the first and only field as being an eight-byte real number. Comments (delimited by / * * / or (* *)) are also allowed in the grammar.
The main purpose of the grammar is to allow messages to be written to text files in a more compact format (see TipcMsgFile for information on message files). Without a message type grammar, it is difficult to know if the number 45 in a text message file was an INT2, INT4, INT8, REAL4, REAL8, or REAL16 field. Message type grammars also provide some self-documentation for message types. The grammar is not enforced, however, when a message is constructed. A message type with a grammar STR REAL8, for example, does not stop a message from being constructed with ten INT4 fields. Message type grammars do not have any relationship to the data conversion capabilities of connections. SmartSockets messages have strongly-typed fields. The field types, not the grammar, enable connections to perform byte swapping and floating-point conversions. The following fields can be used when defining a message type grammar:
|
|
Accessor method for the Header string encode message property.
|
|
Accessor method for the load balancing mode property of the message.
|
|
Gets the name property of the message type. The name is used as a key to the TipcMt object in the global message type table; it identifies the message type within the process; therefore, each message type name must be unique. Message type names that start with an underscore are reserved for internal SmartSockets message types.
|
|
Gets the number property of the message type. The number is used as a key to the TipcMt object in the global message type table; it identifies the message type within both the process and the RTserver cloud; therefore, each message type number within a project should be unique. Negative message type numbers are reserved for internal SmartSockets message types.
|
|
Accessor method for the priority message property. The priority property identifies the default priority for messages of this type. The message priority property controls where an incoming message is inserted into a connection—s message queue. The message type priority can either be set to a specific value or it can be unknown. When a message is created, its priority is initialized to the message type priority (if set) or to the value of the option Default_Msg_Priority (if the message type priority is unknown). The priority of an outgoing message can always be set on a per-message basis, but using message type priorities makes it easier to raise or lower the default priority for all outgoing messages of a specific type. Note that if set, the message type priority always overrides the value in the option Default_Msg_Priority. The standard SmartSockets message types, by default, all have a priority of unknown, but these can be changed if desired. User-defined message types can use whatever priority you choose.
|
|
Accessor method for the user property of the message. The message user-defined property can be used for any purpose, such as attaching a version number to messages. When a message is created, its user-defined property is initialized to the message type user-defined property. The user-defined property of an outgoing message can always be set on a per-message basis, but using the message type user-defined property makes it easier to change the default user-defined property for all outgoing messages of a specific type. The standard SmartSockets message types by default all have a user-defined property of zero (0), but these may be changed if desired. User-defined message types can also use whatever user-defined property is appropriate.
|
|
Looks up a message type with the desired number. The standard SmartSockets message types use C defines for numbers that are similar to the names. (For example, the message type with name "numeric_data" has a defined number T_MT_NUMERIC_DATA.)
|
|
Looks up a message type with the desired name from the global hash table of message types. The standard SmartSockets message types use C defines for numbers that are similar to the names. (For example, the message type with name "numeric_data" has a defined number T_MT_NUMERIC_DATA.)
|
|
type cast operator used for compatibility with the C API.
|
|
Prints the contents of the message type using the given method.
|
|
Sets the Decryption object, and optionally a decryption method within that object to decrypt the data portion of the message. The Decryption object is invoked when TipcMsg::decrypt() is called on a TipcMsg of this TipcMt type. If the default NULL values are used, the encryption method is cleared and a call to TipcMsg::decrypt() will not do anything to the message.
|
|
Sets the Encryption object, and optionally an encryption method within that object to encrypt the data portion of the message. The Encryption object is invoked when TipcMsg::encrypt() is called on a TipcMsg of this TipcMt type. If the default NULL values are used, the encryption method is cleared and a call to TipcMsg::encrypt() will not do anything to the message.
|
|
Sets the encryption key used by the encrypt and decrypt objects. If the key is null, then the encryption/decryption is turned off for that message type. |
|
Traverses all the elements of the global message type hash table calling the specified Handler method in the specified traverser object.
|