Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

Message Class Reference

#include <Message.h>

List of all members.


Detailed Description

Encapsulation of messages with commands and data to be passed between spacecraft.

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.

Example:
vector<double> parms;
parms.push_back(4);
parms.push_back(3);
parms.push_back(2);
Message testMsg("TYPHON", "THECLA", "SetWheelSpeeds", parms);
The message is to TYPHON and from THECLA. These values should be stored in a table of hosts. The command, SetWheelSpeeds is the text string of the command, and parms is the vector of double values that are sent with the message.

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


Constructor & Destructor Documentation

Message::Message string  dest,
string  sender,
string  command,
vector< double >  params
[inline]
 

Creates a message with the specified destination, sender, command and parameters.

Definition at line 40 of file Message.h.

Message::Message string  _incomingMsg  )  [inline]
 

Creates a message object from a serialized (string) message.

Definition at line 43 of file Message.h.

virtual Message::~Message  )  [inline, virtual]
 

Definition at line 45 of file Message.h.


Member Function Documentation

string Message::GetCommand  )  const [inline]
 

Returns the current command to be sent with the message.

Definition at line 62 of file Message.h.

string Message::GetDestination  )  const [inline]
 

Returns the current destination of the message.

Definition at line 56 of file Message.h.

double Message::GetParameter int  paramNumber  )  const [inline]
 

Returns a specific parameter value from a message.

Definition at line 65 of file Message.h.

vector<double> Message::GetParameters  )  const [inline]
 

Returns the entire parameter list of the message.

Definition at line 68 of file Message.h.

string Message::GetSender  )  const [inline]
 

Returns the current sender of the message.

Definition at line 59 of file Message.h.

void Message::Parse string  _incomingMsg  ) 
 

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.

string Message::Serialize  )  const
 

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().

void Message::SetCommand const string &  newCommand  )  [inline]
 

Change the command of the message.

Definition at line 75 of file Message.h.

void Message::SetDestination const string &  newDestination  )  [inline]
 

Set a new destination for the message.

Definition at line 72 of file Message.h.


Member Data Documentation

string Message::m_Command [protected]
 

String naming the command in the body of the message.

Definition at line 81 of file Message.h.

Referenced by Parse().

string Message::m_Destination [protected]
 

Message destination referring to the device's name.

Definition at line 79 of file Message.h.

Referenced by Parse().

vector<double> Message::m_Parameters [protected]
 

variable length vector of command parameters

Definition at line 82 of file Message.h.

Referenced by Parse(), and Serialize().

string Message::m_Sender [protected]
 

Message sender referring to the device's name.

Definition at line 80 of file Message.h.

Referenced by Parse().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 12:54:40 2007 for DSACSS Operational Code by  doxygen 1.3.9.1