#include <Message.h>
The message class is used to wrap up message destinations, senders, commands, and parameters. The class facilitates the serialization (converting to a string) and parsing (converting from a string) of messages that are passed over some communications link.
vector<double> parms; parms.push_back(4); parms.push_back(3); parms.push_back(2); Message testMsg("TYPHON", "THECLA", "SetWheelSpeeds", parms);
Definition at line 35 of file Message.h.
Public Member Functions | |
Message (string dest, string sender, string command, vector< double > params) | |
Creates a message with the specified destination, sender, command and parameters. | |
Message (string _incomingMsg) | |
Creates a message object from a serialized (string) message. | |
virtual | ~Message () |
void | Parse (string _incomingMsg) |
Parses a serialized (string) incoming message, and fills out the Message object fields. | |
string | Serialize () const |
Converts the message object into a serialized string of data in ASCII format. | |
string | GetDestination () const |
Returns the current destination of the message. | |
string | GetSender () const |
Returns the current sender of the message. | |
string | GetCommand () const |
Returns the current command to be sent with the message. | |
double | GetParameter (int paramNumber) const |
Returns a specific parameter value from a message. | |
vector< double > | GetParameters () const |
Returns the entire parameter list of the message. | |
void | SetDestination (const string &newDestination) |
Set a new destination for the message. | |
void | SetCommand (const string &newCommand) |
Change the command of the message. | |
Protected Attributes | |
string | m_Destination |
Message destination referring to the device's name. | |
string | m_Sender |
Message sender referring to the device's name. | |
string | m_Command |
String naming the command in the body of the message. | |
vector< double > | m_Parameters |
variable length vector of command parameters |
|
Creates a message with the specified destination, sender, command and parameters.
|
|
Creates a message object from a serialized (string) message.
|
|
|
|
Returns the current command to be sent with the message.
|
|
Returns the current destination of the message.
|
|
Returns a specific parameter value from a message.
|
|
Returns the entire parameter list of the message.
|
|
Returns the current sender of the message.
|
|
Parses a serialized (string) incoming message, and fills out the Message object fields.
Definition at line 37 of file Message.cpp. References m_Command, m_Destination, m_Parameters, and m_Sender. |
|
Converts the message object into a serialized string of data in ASCII format.
Definition at line 16 of file Message.cpp. References m_Parameters. Referenced by CommObject::SendMessage(). |
|
Change the command of the message.
|
|
Set a new destination for the message.
|
|
String naming the command in the body of the message.
Definition at line 81 of file Message.h. Referenced by Parse(). |
|
Message destination referring to the device's name.
Definition at line 79 of file Message.h. Referenced by Parse(). |
|
variable length vector of command parameters
Definition at line 82 of file Message.h. Referenced by Parse(), and Serialize(). |
|
Message sender referring to the device's name.
Definition at line 80 of file Message.h. Referenced by Parse(). |