#include <xplMsg.h>
Inherits xplRef.
The xplMsg class encapsulates all the parameters that make up an xPL message. It provides a simple interface for creating and manipulating xPL messages, freeing the user from the burden of parsing and formatting the raw message data.
There are two ways to create an xplMsg object, both via static Create methods. The first method creates a message from a buffer containing raw xPL message data as it would be received from another xPL application over the network. This approach will be most commonly used internally by the xplDevice class when it receives a message, but it could also be used to build an xplMsg from a string of data created by sprintf, for example.
The second method creates a skeleton xPL message containing a header and schema but with no name=value pairs in the message body. These values are added individually through subsequent calls to xplMsg::AddValue.
Once created, sending the message is a simple matter of passing it to the xplDevice::SendMessage method
Public Member Functions | |
void | AddValue (string const &_name, string const &_value, char const _delimiter= ',') |
Adds a new name=value pair to the message body. | |
void | AddValue (string const &_name, int32 const _value) |
Adds a new name=value pair to the message body. | |
bool | SetValue (string const &_name, string const &_value, uint32 const _index=0) |
Sets the value of an existing name-value pair in the message body. | |
string const | GetValue (string const &_name, uint32 const _index=0) const |
Gets the value from a name-value pair in the message body. | |
int const | GetIntValue (string const &_name, uint32 const _index=0) const |
Gets the value from a name-value pair in the message body and converts it to an integer. | |
string const | GetCompleteValue (string const &_name, char const _delimiter= ',') const |
Gets the all the values from the name-value pairs with the specified name. | |
uint32 | GetNumMsgItems () const |
Gets the number of xplMsgItems in the message. | |
xplMsgItem const * | GetMsgItem (string const &_name) const |
Gets an xplMsgItem. | |
xplMsgItem const * | GetMsgItem (uint32 const _index) const |
Gets an xplMsgItem. | |
uint32 | GetRawData (int8 **_pBuffer) |
Gets the message in it's raw data form. | |
int32 | GetHop () const |
Gets the hop count of the message. | |
string const & | GetType () const |
Gets the message type. | |
string const & | GetSource () const |
Gets the message source. | |
string const & | GetTarget () const |
Gets the message target. | |
string const & | GetSchemaClass () const |
Gets the schema class. | |
string const & | GetSchemaType () const |
Gets the schema type. | |
bool | SetHop (uint32 _hop) |
Sets the hop count of the message. | |
bool | SetType (string const &_type) |
Sets the message type. | |
bool | SetSource (string const &_source) |
Sets the message source. | |
bool | SetTarget (string const &_target) |
Sets the message target. | |
bool | SetSchemaClass (string const &_schemaClass) |
Sets the schema class. | |
bool | SetSchemaType (string const &_schemaType) |
Sets the schema type. | |
bool | operator== (xplMsg const &_rhs) |
void | AddRef () |
Increases the reference count of the object. | |
void | Release () |
Removes a reference to an object. | |
Static Public Member Functions | |
static xplMsg * | Create (int8 const *_pBuffer) |
Creates an xplMsg. | |
static xplMsg * | Create (string const &_type, string const &_source, string const &_target, string const &_schemaClass, string const &_schemaType) |
Creates an xplMsg. | |
Static Public Attributes | |
static string const | c_xplCmnd |
static string const | c_xplTrig |
static string const | c_xplStat |
static string const | c_xplHop |
static string const | c_xplSource |
static string const | c_xplTarget |
static string const | c_xplOpenBrace |
static string const | c_xplCloseBrace |
static string const | c_xplTargetAll |