Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
CNetMessage Class Reference

The base class for all network messages exchanged within the game. More...

#include <NetMessage.h>

Inheritance diagram for CNetMessage:
ISerializable CGameSetupMessage CSimulationMessage

Public Member Functions

 CNetMessage ()
 
 CNetMessage (NetMessageType type)
 
virtual ~CNetMessage ()
 
NetMessageType GetType () const
 Retrieves the message type. More...
 
virtual u8Serialize (u8 *pBuffer) const
 Serialize the message into the specified buffer parameter. More...
 
virtual const u8Deserialize (const u8 *pStart, const u8 *pEnd)
 Deserializes the message from the specified buffer. More...
 
virtual size_t GetSerializedLength () const
 Retrieves the size in bytes of the serialized message. More...
 
virtual CStr ToString () const
 Returns a string representation for the message. More...
 
- Public Member Functions inherited from ISerializable
virtual ~ISerializable ()
 

Private Attributes

NetMessageType m_Type
 

Friends

class CNetSession
 

Detailed Description

The base class for all network messages exchanged within the game.

Definition at line 32 of file NetMessage.h.

Constructor & Destructor Documentation

CNetMessage::CNetMessage ( )

Definition at line 30 of file NetMessage.cpp.

CNetMessage::CNetMessage ( NetMessageType  type)

Definition at line 35 of file NetMessage.cpp.

CNetMessage::~CNetMessage ( )
virtual

Definition at line 40 of file NetMessage.cpp.

Member Function Documentation

const u8 * CNetMessage::Deserialize ( const u8 pStart,
const u8 pEnd 
)
virtual

Deserializes the message from the specified buffer.

Parameters
pStartMessage start within the serialized buffer
pEndMessage end within the serialized buffer
Returns
The position in the buffer right after the message or NULL if an error occured

Implements ISerializable.

Reimplemented in CGameSetupMessage, and CSimulationMessage.

Definition at line 53 of file NetMessage.cpp.

size_t CNetMessage::GetSerializedLength ( ) const
virtual

Retrieves the size in bytes of the serialized message.

Before calling Serialize, the memory size for the buffer where to serialize the message object can be found by calling this method.

Returns
The size of serialized message

Implements ISerializable.

Reimplemented in CGameSetupMessage, and CSimulationMessage.

Definition at line 78 of file NetMessage.cpp.

NetMessageType CNetMessage::GetType ( void  ) const
inline

Retrieves the message type.

Returns
Message type

Definition at line 46 of file NetMessage.h.

u8 * CNetMessage::Serialize ( u8 pBuffer) const
virtual

Serialize the message into the specified buffer parameter.

The size required by the buffer parameter can be found by a call to GetSerializedLength method. The information contained within the message must be serialized before the message is sent. By default only the message type and its size are serialized in the buffer parameter.

Parameters
pBufferBuffer where to serialize the message
Returns
The position in the buffer right after the serialized message

Implements ISerializable.

Reimplemented in CGameSetupMessage, and CSimulationMessage.

Definition at line 44 of file NetMessage.cpp.

CStr CNetMessage::ToString ( ) const
virtual

Returns a string representation for the message.

Returns
The message as a string

Reimplemented in CGameSetupMessage, and CSimulationMessage.

Definition at line 84 of file NetMessage.cpp.

Friends And Related Function Documentation

friend class CNetSession
friend

Definition at line 34 of file NetMessage.h.

Member Data Documentation

NetMessageType CNetMessage::m_Type
private

Definition at line 88 of file NetMessage.h.


The documentation for this class was generated from the following files: