dtLMS::LmsMessage Class Reference

This class is used to encapsulate an LMS message that is sent to or received from an LMS. More...

#include <lmsmessage.h>

List of all members.

Public Member Functions

 LmsMessage ()
 Default constructor.
 LmsMessage (const std::string &senderID, const LmsMessageType &type, const std::string &value)
 Constructor used to create status messages, where only the ID, message type, and message value are required (i.e.
 LmsMessage (const std::string &senderID, const LmsMessageType &type, const std::string &value, const std::string &objectiveID)
 Constructor used to create objective messages, where an ID, message type, message value, and objective ID are required (i.e.
 LmsMessage (const std::string &messageString)
 Constructor used to create an lms message from an appropriately delimited string.
virtual ~LmsMessage ()
 Destructor.
void BuildFromString (const std::string &messageString)
 This public method populates this LmsMessage with the values parsed from an appropriately delimited string.
std::string ToString () const
 This public method will create and return an appropriately delimited string suitable for sending the LmsMessage to the LMS via the LmsClientSocket's SendLmsMessage() method.
const std::string & GetSenderID () const
std::string & GetSenderID ()
void SetSenderID (const std::string &senderID)
const std::string & GetValue () const
std::string & GetValue ()
void SetValue (const std::string &value)
const std::string & GetObjectiveID () const
std::string & GetObjectiveID ()
void SetObjectiveID (std::string objectiveID)
const std::string & GetDelimiter () const
std::string & GetDelimiter ()
void SetDelimiter (const std::string &delimiter)
const LmsMessageTypeGetMessageType () const
void SetMessageType (const LmsMessageType &type)


Detailed Description

This class is used to encapsulate an LMS message that is sent to or received from an LMS.

It provides several overloaded constructors to make it easy to create the message along with utility methods that can import or export the message to the delimited string format specified by the LMS messaging protocol.


Constructor & Destructor Documentation

dtLMS::LmsMessage::LmsMessage (  ) 

Default constructor.

dtLMS::LmsMessage::LmsMessage ( const std::string &  senderID,
const LmsMessageType type,
const std::string &  value 
)

Constructor used to create status messages, where only the ID, message type, and message value are required (i.e.

id123:SIMULATION:RUNNING).

Parameters:
senderID The ID value of the component sending the messages. For messages sent by the LmsClientSocket, this can be retrieved via GetClientID().
type The enumerated type of this message (i.e. SIMULATION, LAUNCH_PAGE, (OBJECTIVE_COMPLETION, OBJECTIVE_SCORE)
value The content of the message. In most cases, one should use the LmsMessageValue enumeration's GetName() method; however, in the case of OBJECTIVE_SCORE type messages, this will be the string form of a float value.

dtLMS::LmsMessage::LmsMessage ( const std::string &  senderID,
const LmsMessageType type,
const std::string &  value,
const std::string &  objectiveID 
)

Constructor used to create objective messages, where an ID, message type, message value, and objective ID are required (i.e.

id123:OBJECTIVE_COMPLETION:COMPLETE:ObjID123).

Parameters:
senderID The ID value of the component sending the messages. For messages sent by the LmsClientSocket, this can be retrieved via GetClientID().
type The enumerated type of this message (i.e. SIMULATION, LAUNCH_PAGE, (OBJECTIVE_COMPLETION, OBJECTIVE_SCORE)
value The content of the message. In most cases, one should use the LmsMessageValue enumeration's GetName() method; however, in the case of OBJECTIVE_SCORE type messages, this will be the string form of a float value.
taskID The ID value of the LMS objective being updated. This generally should be the ID value of the TaskActor sending the update message.

dtLMS::LmsMessage::LmsMessage ( const std::string &  messageString  ) 

Constructor used to create an lms message from an appropriately delimited string.

This constructor is generally used to create an LmsMessage object from a string message received from the LMS. @ param messageString The delimited string to create the LmsMessage from. Must be in the proper delimited format per the LMS messaging protocol.

dtLMS::LmsMessage::~LmsMessage (  )  [virtual]

Destructor.


Member Function Documentation

void dtLMS::LmsMessage::BuildFromString ( const std::string &  messageString  ) 

This public method populates this LmsMessage with the values parsed from an appropriately delimited string.

It is called by one of the constructors (see LmsMessage(string messageString), but can also be called externally. @ param messageString The delimited string to create the LmsMessage from. Must be in the proper delimited format per the LMS messaging protocol.

std::string dtLMS::LmsMessage::ToString (  )  const

This public method will create and return an appropriately delimited string suitable for sending the LmsMessage to the LMS via the LmsClientSocket's SendLmsMessage() method.

@ return Returns a delimited string that can be used by the LmsClientSocket's SendLmsMessage() method.

const std::string& dtLMS::LmsMessage::GetSenderID (  )  const [inline]

std::string& dtLMS::LmsMessage::GetSenderID (  )  [inline]

void dtLMS::LmsMessage::SetSenderID ( const std::string &  senderID  )  [inline]

const std::string& dtLMS::LmsMessage::GetValue (  )  const [inline]

std::string& dtLMS::LmsMessage::GetValue (  )  [inline]

void dtLMS::LmsMessage::SetValue ( const std::string &  value  )  [inline]

const std::string& dtLMS::LmsMessage::GetObjectiveID (  )  const [inline]

std::string& dtLMS::LmsMessage::GetObjectiveID (  )  [inline]

void dtLMS::LmsMessage::SetObjectiveID ( std::string  objectiveID  )  [inline]

const std::string& dtLMS::LmsMessage::GetDelimiter (  )  const [inline]

std::string& dtLMS::LmsMessage::GetDelimiter (  )  [inline]

void dtLMS::LmsMessage::SetDelimiter ( const std::string &  delimiter  )  [inline]

const LmsMessageType& dtLMS::LmsMessage::GetMessageType (  )  const [inline]

void dtLMS::LmsMessage::SetMessageType ( const LmsMessageType type  )  [inline]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008