dtNetGM::MessagePacket Class Reference

A MessagePacket contains a dtGame::Message to be sent over a Network ot other connected dtGame::GameManager's. More...

#include <messagepacket.h>

List of all members.

Public Types

typedef GNE::SmartPtr
< MessagePacket
sptr
typedef GNE::WeakPtr
< MessagePacket
wptr

Public Member Functions

 MessagePacket ()
 Constructor.
 MessagePacket (const MessagePacket &messagePacket)
 Copy constructor, used by the GNE::PacketParser to send a copy of the MessagePacket across the Network.
 MessagePacket (const dtGame::Message &message)
 Construct a MessagePacket from a dtGame::Message.
virtual ~MessagePacket (void)
 Destructor, public for GNE......
virtual void writePacket (GNE::Buffer &raw) const
 Writes a MessagePacket into a packet stream, used by GNE::PacketParser.
virtual void readPacket (GNE::Buffer &raw)
 Reads a MessagePacket from a packet stream, used by GNE::PacketParser.
virtual int getSize () const
 Gets the size of the MessagePacket, used by GNE::PacketParser.
void BuildFromMessage (const dtGame::Message &message)
 Builds a MessagePacket from a message.
void FillMessage (dtGame::Message &message) const
 Fills the content of the encapsulated Message into a Message, The message should be created using the MessageFactory.
const unsigned short GetMessageId () const
 Gets the MessageType::mID of the Message contained in the MessagePacket This can be used to recreate the message with the Messagefactory.
const dtCore::UniqueId GetDestinatonId () const
 Gets the UniqueId of the Message destination.
const dtCore::UniqueId GetSourceId () const
 Gets the UniqueId of the Message source.
const std::string GetMessageParameters () const
 Gets the message parameters as string.
void OverrideDestination (const dtGame::MachineInfo &destination)
 Overrides the destination of the contained Message.

Static Public Attributes

static const int ID = GNE::PacketParser::MIN_USER_ID
 ID used by GNE to identify the MessagePacket.


Detailed Description

A MessagePacket contains a dtGame::Message to be sent over a Network ot other connected dtGame::GameManager's.

The MessagePacket uses the dtGame::MachineInfo::UniqueId to specify its source and destination dtGame::GameManager Currently it is assumed all messagecontent fits into one packet.

See also:
dtGame::Message

Member Typedef Documentation

typedef GNE::SmartPtr<MessagePacket> dtNetGM::MessagePacket::sptr

typedef GNE::WeakPtr<MessagePacket> dtNetGM::MessagePacket::wptr


Constructor & Destructor Documentation

dtNetGM::MessagePacket::MessagePacket (  ) 

Constructor.

dtNetGM::MessagePacket::MessagePacket ( const MessagePacket messagePacket  ) 

Copy constructor, used by the GNE::PacketParser to send a copy of the MessagePacket across the Network.

Parameters:
messagePacket the MessagePacket to be copied.

dtNetGM::MessagePacket::MessagePacket ( const dtGame::Message message  ) 

Construct a MessagePacket from a dtGame::Message.

Parameters:
message the Message to be contained in the MessagePacket.

dtNetGM::MessagePacket::~MessagePacket ( void   )  [virtual]

Destructor, public for GNE......


Member Function Documentation

void dtNetGM::MessagePacket::writePacket ( GNE::Buffer &  raw  )  const [virtual]

Writes a MessagePacket into a packet stream, used by GNE::PacketParser.

Parameters:
raw The buffer to write the MessagePacket to

void dtNetGM::MessagePacket::readPacket ( GNE::Buffer &  raw  )  [virtual]

Reads a MessagePacket from a packet stream, used by GNE::PacketParser.

Parameters:
raw The buffer to read the MessagePacket from

int dtNetGM::MessagePacket::getSize (  )  const [virtual]

Gets the size of the MessagePacket, used by GNE::PacketParser.

Returns:
The size

void dtNetGM::MessagePacket::BuildFromMessage ( const dtGame::Message message  ) 

Builds a MessagePacket from a message.

Parameters:
the message to be encapsulated by the MessagePacket

void dtNetGM::MessagePacket::FillMessage ( dtGame::Message message  )  const

Fills the content of the encapsulated Message into a Message, The message should be created using the MessageFactory.

Parameters:
The message to write the content to.

const unsigned short dtNetGM::MessagePacket::GetMessageId (  )  const [inline]

Gets the MessageType::mID of the Message contained in the MessagePacket This can be used to recreate the message with the Messagefactory.

Returns:
The id of the MessageType

const dtCore::UniqueId dtNetGM::MessagePacket::GetDestinatonId (  )  const [inline]

Gets the UniqueId of the Message destination.

Returns:
The message destination

const dtCore::UniqueId dtNetGM::MessagePacket::GetSourceId (  )  const [inline]

Gets the UniqueId of the Message source.

Returns:
The message source

const std::string dtNetGM::MessagePacket::GetMessageParameters (  )  const [inline]

Gets the message parameters as string.

Returns:
The message paramters

void dtNetGM::MessagePacket::OverrideDestination ( const dtGame::MachineInfo destination  ) 

Overrides the destination of the contained Message.

Parameters:
The new destination


Member Data Documentation

const int dtNetGM::MessagePacket::ID = GNE::PacketParser::MIN_USER_ID [static]

ID used by GNE to identify the MessagePacket.

The MessagePacket has an ID of GNE::PacketParser::MIN_USER_ID


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