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

Special message type for simulation commands. More...

#include <NetMessage.h>

Inheritance diagram for CSimulationMessage:
CNetMessage ISerializable

Public Member Functions

 CSimulationMessage (ScriptInterface &scriptInterface)
 
 CSimulationMessage (ScriptInterface &scriptInterface, u32 client, i32 player, u32 turn, jsval data)
 
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 CNetMessage
 CNetMessage ()
 
 CNetMessage (NetMessageType type)
 
virtual ~CNetMessage ()
 
NetMessageType GetType () const
 Retrieves the message type. More...
 
- Public Member Functions inherited from ISerializable
virtual ~ISerializable ()
 

Public Attributes

u32 m_Client
 
i32 m_Player
 
u32 m_Turn
 
CScriptValRooted m_Data
 

Private Attributes

ScriptInterfacem_ScriptInterface
 

Detailed Description

Special message type for simulation commands.

These commands are exposed as arbitrary JS objects, associated with a specific player.

Definition at line 113 of file NetMessage.h.

Constructor & Destructor Documentation

CSimulationMessage::CSimulationMessage ( ScriptInterface scriptInterface)

Definition at line 96 of file NetMessageSim.cpp.

CSimulationMessage::CSimulationMessage ( ScriptInterface scriptInterface,
u32  client,
i32  player,
u32  turn,
jsval  data 
)

Definition at line 101 of file NetMessageSim.cpp.

Member Function Documentation

const u8 * CSimulationMessage::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

Reimplemented from CNetMessage.

Definition at line 121 of file NetMessageSim.cpp.

size_t CSimulationMessage::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

Reimplemented from CNetMessage.

Definition at line 136 of file NetMessageSim.cpp.

u8 * CSimulationMessage::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

Reimplemented from CNetMessage.

Definition at line 107 of file NetMessageSim.cpp.

CStr CSimulationMessage::ToString ( ) const
virtual

Returns a string representation for the message.

Returns
The message as a string

Reimplemented from CNetMessage.

Definition at line 149 of file NetMessageSim.cpp.

Member Data Documentation

u32 CSimulationMessage::m_Client

Definition at line 123 of file NetMessage.h.

CScriptValRooted CSimulationMessage::m_Data

Definition at line 126 of file NetMessage.h.

i32 CSimulationMessage::m_Player

Definition at line 124 of file NetMessage.h.

ScriptInterface* CSimulationMessage::m_ScriptInterface
private

Definition at line 128 of file NetMessage.h.

u32 CSimulationMessage::m_Turn

Definition at line 125 of file NetMessage.h.


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