dtLMS::LmsComponent Class Reference

This class is a sub-class of the standard TaskComponent. More...

#include <lmscomponent.h>

Inheritance diagram for dtLMS::LmsComponent:

dtGame::TaskComponent dtGame::GMComponent dtCore::Base

List of all members.

Public Member Functions

 LmsComponent (const std::string &name=DEFAULT_NAME)
 Constructs the LmsComponent.
 LmsComponent (const std::string &host, int port, bool reverseBytes)
 Constructs the LmsComponent.
virtual void ProcessMessage (const dtGame::Message &message)
 Called when a message arrives at the Game Manager.
void ConnectToLms ()
 This attempts to connect to an lms messaging applet running on the specified host over the specified socket.
void DisconnectFromLms ()
 This method disconnects the LmsComponent from the lms messaging applet.
LmsClientSocketGetLmsClientSocket ()
 accessor for mClientSocket
const LmsClientSocketGetLmsClientSocket () const
 const accessor for mClientSocket
void GetMessageVector (std::vector< LmsMessage > &toFill)

Static Public Attributes

static const std::string DEFAULT_NAME = "LmsComponent"

Protected Member Functions

void SetNeedValidSocket (bool need)
bool GetNeedValidSocket () const
virtual ~LmsComponent ()
 Destructs the LmsComponent.
void SendLmsUpdate (dtGame::GameActorProxy &proxy)
 This method will send an update message to the lms messaging applet.
LmsMessage TranslateObjectiveCompleteMessage (const std::string &taskID, bool taskIsComplete)
 This utility method creates an 'OBJECTIVE_COMPLETION' type LmsMessage object that can be sent to the lms via the mClientSocket::SendLmsMessage() method.
LmsMessage TranslateObjectiveScoreMessage (const std::string &taskID, float taskScore)
 This utility method creates an 'OBJECTIVE_SCORE' type LmsMessage object that can be sent to the lms via the mClientSocket::SendLmsMessage() method.


Detailed Description

This class is a sub-class of the standard TaskComponent.

It adds the functionality to forward task update messages to an lms system via an lms messaging applet.


Constructor & Destructor Documentation

dtLMS::LmsComponent::LmsComponent ( const std::string &  name = DEFAULT_NAME  ) 

Constructs the LmsComponent.

dtLMS::LmsComponent::LmsComponent ( const std::string &  host,
int  port,
bool  reverseBytes 
)

Constructs the LmsComponent.

Parameters:
host The host machine that the lms messaging applet is running on.
port The port on the host machine that the lms messaging applet is listening on.
reverseBytes If true, Informs the server that it needs to reverse the byte order for multi-byte messages (big/little endian issue)

dtLMS::LmsComponent::~LmsComponent (  )  [protected, virtual]

Destructs the LmsComponent.


Member Function Documentation

void dtLMS::LmsComponent::ProcessMessage ( const dtGame::Message message  )  [virtual]

Called when a message arrives at the Game Manager.

These messages are trapped anytime an actor create,destroy or update message arrives and are used to update this components list of managed task actors. Overrides a method in TaskComponent.

Parameters:
message The message being propogated by the game manager.

Reimplemented from dtGame::TaskComponent.

void dtLMS::LmsComponent::ConnectToLms (  ) 

This attempts to connect to an lms messaging applet running on the specified host over the specified socket.

If successful, mClientSocket::GetClientState() will be set to LmsConnectionState::CONNECTED.

void dtLMS::LmsComponent::DisconnectFromLms (  ) 

This method disconnects the LmsComponent from the lms messaging applet.

LmsClientSocket* dtLMS::LmsComponent::GetLmsClientSocket (  )  [inline]

accessor for mClientSocket

const LmsClientSocket* dtLMS::LmsComponent::GetLmsClientSocket (  )  const [inline]

const accessor for mClientSocket

void dtLMS::LmsComponent::GetMessageVector ( std::vector< LmsMessage > &  toFill  ) 

void dtLMS::LmsComponent::SetNeedValidSocket ( bool  need  )  [inline, protected]

bool dtLMS::LmsComponent::GetNeedValidSocket (  )  const [inline, protected]

void dtLMS::LmsComponent::SendLmsUpdate ( dtGame::GameActorProxy proxy  )  [protected]

This method will send an update message to the lms messaging applet.

It will check to see which properties of a task have been updated, and send a separate lms message for each one.

Parameters:
proxy The GameActorProxy containing the task that has been updated.

LmsMessage dtLMS::LmsComponent::TranslateObjectiveCompleteMessage ( const std::string &  taskID,
bool  taskIsComplete 
) [protected]

This utility method creates an 'OBJECTIVE_COMPLETION' type LmsMessage object that can be sent to the lms via the mClientSocket::SendLmsMessage() method.

Parameters:
taskID The unique name of the task.
taskIsComplete The completion status of the task.
Returns:
An LmsMessage object that is understood by the mClientSocket::SendLmsMessage() method.

LmsMessage dtLMS::LmsComponent::TranslateObjectiveScoreMessage ( const std::string &  taskID,
float  taskScore 
) [protected]

This utility method creates an 'OBJECTIVE_SCORE' type LmsMessage object that can be sent to the lms via the mClientSocket::SendLmsMessage() method.

Parameters:
taskID The unique name of the task.
taskScore The current raw score of the task.
Returns:
An LmsMessage object that is understood by the mClientSocket::SendLmsMessage() method.


Member Data Documentation

const std::string dtLMS::LmsComponent::DEFAULT_NAME = "LmsComponent" [static]

Reimplemented from dtGame::TaskComponent.


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