dtGame::Message Class Reference

#include <message.h>

Inheritance diagram for dtGame::Message:

dtGame::ActorDeletedMessage dtGame::ActorPublishedMessage dtGame::ActorUpdateMessage dtGame::GameEventMessage dtGame::LogAvailableLogsMessage dtGame::LogDeleteLogfileMessage dtGame::LogEndLoadKeyframeMessage dtGame::LogGetKeyframeListMessage dtGame::LogGetTagListMessage dtGame::LogInsertTagMessage dtGame::LogSetAutoKeyframeIntervalMessage dtGame::LogSetLogfileMessage dtGame::MapMessage dtGame::NetServerRejectMessage dtGame::RestartMessage dtGame::ServerMessageRejected dtGame::TickMessage dtGame::TimeChangeMessage dtGame::TimerElapsedMessage dtNetGM::MachineInfoMessage

List of all members.

Public Member Functions

 Message ()
virtual void ToString (std::string &toFill) const
 This should write all of the subclass specific data to the string .
virtual void FromString (const std::string &source)
 This should read all of the subclass specific data from the string.
virtual void ToDataStream (dtUtil::DataStream &stream) const
 This should write all of the subclass specific data to the stream.
virtual void FromDataStream (dtUtil::DataStream &stream)
 This should read all of the subclass specific data from the stream.
MessageParameterGetParameter (const std::string &name)
 Non-const version of getter to return a message parameter by name.
const MessageParameterGetParameter (const std::string &name) const
 Const version of getter to return a message parameter by name.
const MessageTypeGetMessageType () const
 This getter, not the class of the object, determines what type the message is.
void SetSendingActorId (const dtCore::UniqueId &newId)
 Assigns the unique id of the actor sending the message.
void SetAboutActorId (const dtCore::UniqueId &newId)
 Assigns the unique id of the actor the message is about or to.
const dtCore::UniqueIdGetSendingActorId () const
 
Returns:
the actor that send the message.

const dtCore::UniqueIdGetAboutActorId () const
 
Note:
Actors can register invokables on themselves for message types.

const MachineInfoGetSource () const
 
Note:
The source is set by the message factory.

const MachineInfoGetDestination () const
 
Note:
This is NOT set by the message factory.

void SetSource (const MachineInfo &mi)
 Reassigns the Source.
void SetDestination (const MachineInfo *mi)
 Reassigns the destination.
virtual void CopyDataTo (Message &msg) const
 Copys the data contents of this message to the passed in message.
void SetCausingMessage (const Message *causingMessage)
 Assigns the message that caused this message.
const MessageGetCausingMessage () const
 This is used for replies, errors, and rejection messages.
bool operator== (const Message &toCompare) const
bool operator!= (const Message &toCompare) const

Protected Member Functions

void AddParameter (MessageParameter *param)
 Adds a parameter to this message.
virtual ~Message ()

Friends

class MessageFactory


Constructor & Destructor Documentation

dtGame::Message::Message (  ) 

virtual dtGame::Message::~Message (  )  [inline, protected, virtual]


Member Function Documentation

void dtGame::Message::ToString ( std::string &  toFill  )  const [virtual]

This should write all of the subclass specific data to the string .

The base class data will be read by the caller before it calls this method.

Parameters:
toFill the string to fill.

void dtGame::Message::FromString ( const std::string &  source  )  [virtual]

This should read all of the subclass specific data from the string.

By default, it reads all of the message parameters. The base class data will be set by the caller when it creates the object.

Parameters:
source the string to pull the data from.

Reimplemented in dtGame::LogGetKeyframeListMessage, and dtGame::LogGetTagListMessage.

void dtGame::Message::ToDataStream ( dtUtil::DataStream stream  )  const [virtual]

This should write all of the subclass specific data to the stream.

The base class data will be read by the caller before it calls this method.

Parameters:
stream the stream to fill.

void dtGame::Message::FromDataStream ( dtUtil::DataStream stream  )  [virtual]

This should read all of the subclass specific data from the stream.

By default, it reads all of the message parameters. The base class data will be set by the caller when it creates the object.

Parameters:
stream the stream to pull the data from.

Reimplemented in dtGame::LogGetKeyframeListMessage, and dtGame::LogGetTagListMessage.

MessageParameter * dtGame::Message::GetParameter ( const std::string &  name  ) 

Non-const version of getter to return a message parameter by name.

Returns:
the parameter specified or NULL of non exists.
Parameters:
name The name of the message parameter to return.

const MessageParameter * dtGame::Message::GetParameter ( const std::string &  name  )  const

Const version of getter to return a message parameter by name.

Returns:
the parameter specified or NULL of non exists.
Parameters:
name The name of the message parameter to return.

const MessageType& dtGame::Message::GetMessageType (  )  const [inline]

This getter, not the class of the object, determines what type the message is.

Returns:
the message type enumeration for this message.

void dtGame::Message::SetSendingActorId ( const dtCore::UniqueId newId  )  [inline]

Assigns the unique id of the actor sending the message.

This should not be set if the message is sent by the GM or a component. It's intended for actor to actor messages.

Parameters:
newId the new id of the sending actor.

void dtGame::Message::SetAboutActorId ( const dtCore::UniqueId newId  )  [inline]

Assigns the unique id of the actor the message is about or to.

This should not be set if the message is not about an specific actor.

Parameters:
newId the new id of the actor this message is about or to.

const dtCore::UniqueId& dtGame::Message::GetSendingActorId (  )  const [inline]

Returns:
the actor that send the message.

This may be an empty unique id, which means there was no sending actor.

const dtCore::UniqueId& dtGame::Message::GetAboutActorId (  )  const [inline]

Note:
Actors can register invokables on themselves for message types.

If they do this, any message of that type with the about actor set to the id of the actor is send to it.

Returns:
the actor this message is about. This may be an empty unique id, which means there is no about actor.

const MachineInfo& dtGame::Message::GetSource (  )  const [inline]

Note:
The source is set by the message factory.

Returns:
the machine infor for this message. This returns a reference because it may NOT be null.

const MachineInfo* dtGame::Message::GetDestination (  )  const [inline]

Note:
This is NOT set by the message factory.

Returns:
the destination machine information. This returns a pointer because it defaults to null.

void dtGame::Message::SetSource ( const MachineInfo mi  )  [inline]

Reassigns the Source.

Parameters:
the machine info to assign as the source. It is a reference so that it may not be NULL.

void dtGame::Message::SetDestination ( const MachineInfo mi  )  [inline]

Reassigns the destination.

Parameters:
the machine info to assign as the destination. It is a pointer so that it may be NULL.

void dtGame::Message::CopyDataTo ( Message msg  )  const [virtual]

Copys the data contents of this message to the passed in message.

The param must be of the same type for this to work properly.

Parameters:
msg the message to copy the contents to.
See also:
MessageFactory::CloneMessage
Exceptions:
dtUtil::Exception with enum Exception::INVALID_PARAMETER if the message passed cannot by copied to.

void dtGame::Message::SetCausingMessage ( const Message causingMessage  )  [inline]

Assigns the message that caused this message.

This is used for replies, errors, and rejection messages.

Parameters:
causingMessage the message that caused this message to be send.

const Message* dtGame::Message::GetCausingMessage (  )  const [inline]

This is used for replies, errors, and rejection messages.

Returns:
the message that caused this message to be send.

bool dtGame::Message::operator== ( const Message toCompare  )  const

bool dtGame::Message::operator!= ( const Message toCompare  )  const [inline]

void dtGame::Message::AddParameter ( MessageParameter param  )  [protected]

Adds a parameter to this message.

This method is protected because only a message class should add parameters to itself.

Parameters:
param the new parameter to add.


Friends And Related Function Documentation

friend class MessageFactory [friend]


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