Planeshift
MsgEntry Class Reference

The structure of 1 queue entry (pointer to a message) More...

#include <message.h>

Public Member Functions

void Add (const char *str)
 Add a string to the current psMessageBytes buffer. More...
 
void Add (const float f)
 Add a float to the current psMessageBytes buffer. More...
 
void Add (const uint16_t s)
 Add a double the current psMessageBytes buffer. More...
 
void Add (const int16_t s)
 Add signed 16 bit int to current psMessageBytes buffer. More...
 
void Add (const int32_t i)
 Add unsigned 32Bit Int to current psMessageBytes buffer. More...
 
void Add (const uint32_t i)
 Add unsigned 4byte int to current psMessageBytes buffer. More...
 
void Add (const uint8_t i)
 Add 8bit unsigned int to current psMessageBytes buffer. More...
 
void Add (const int8_t i)
 Add 8 bit signed int to buffer. More...
 
void Add (const bool b)
 Add bool to current psMessageBytes buffer. More...
 
void Add (const csVector2 &v)
 Add an x,y vector to the buffer. More...
 
void Add (const csVector3 &v)
 Add an x,y,z vector to the buffer. More...
 
void Add (const csVector4 &v)
 Add an x,y,z,w vector to the buffer. More...
 
void Add (const iSector *sector, const csStringSet *msgstrings, const csStringHashReversible *msgstringshash=NULL)
 
void Add (const iSector *sector)
 
void Add (const void *datastream, const uint32_t length)
 Add a processed buffer of some kind; should only be used by files and the like. More...
 
void AddPointer (const uintptr_t i)
 Add a pointer to the current psMessageBytes buffer. Pointers must never be sent over the network! More...
 
void ClipToCurrentSize ()
 
bool GetBool ()
 Get a bool from the current psMessageBytes buffer. More...
 
void * GetBufferPointerUnsafe (uint32_t &length)
 
float GetFloat ()
 Get a float from the current psMessageBytes buffer. More...
 
int16_t GetInt16 ()
 Get a signed 16bit Integer from the current psMessageBytes buffer. More...
 
int32_t GetInt32 ()
 Get a signed 32Bit Integer from the current psMessageBytes buffer. More...
 
int8_t GetInt8 ()
 Get a signed 8bit Integer from the current psMessageBytes buffer. More...
 
bool GetPending ()
 
uintptr_t GetPointer ()
 Get a pointer from the current psMessageBytes buffer. Pointers must never be sent over the network! More...
 
iSector * GetSector (const csStringSet *msgstrings, const csStringHashReversible *msgstringshash, iEngine *engine)
 
iSector * GetSector ()
 
int GetSequenceNumber ()
 
size_t GetSize ()
 Return the size of the databuffer. More...
 
const char * GetStr ()
 Get a null-terminated string from the current psMessageBytes buffer. More...
 
uint8_t GetType ()
 
uint16_t GetUInt16 ()
 Get a unsigned 16bit Integer from the curren psMessageBytes buffer. More...
 
uint32_t GetUInt32 ()
 Get an unsigned 4byte int from the current psMessageBytes buffer. More...
 
uint8_t GetUInt8 ()
 Get an unsigned 8Bit Integer from the current psMessageBytes buffer. More...
 
csVector2 GetVector2 ()
 
csVector3 GetVector3 ()
 
csVector4 GetVector4 ()
 
bool HasMore (int howMuchMore=1)
 Check if we have more data in the current psMessageBytes buffer. More...
 
bool IsEmpty ()
 Check if we are at the end of the current psMessageBytes buffer. More...
 
 MsgEntry (size_t datasize=0, uint8_t msgpriority=PRIORITY_HIGH, uint8_t sequence=0)
 
 MsgEntry (const psMessageBytes *msg)
 
 MsgEntry (const MsgEntry *me)
 
void Reset (int pos=0)
 
void SetPending (bool)
 
void SetType (uint8_t type)
 
virtual ~MsgEntry ()
 
- Public Member Functions inherited from csSyncRefCount
 csSyncRefCount ()
 Initialize object and set reference to 1. More...
 
void DecRef ()
 Decrease the number of references to this object. More...
 
int32 GetRefCount ()
 Get the reference count (only for debugging). More...
 
void IncRef ()
 Increase the number of references to this object. More...
 

Public Attributes

psMessageBytesbytes
 The message itself ie one block of memory with the header and data following. More...
 
uint32_t clientnum
 The Number of the client the Message is from/goes to. More...
 
size_t current
 The current position for Pushing and Popping. More...
 
uint32_t msgid
 Unique identifier per machine. More...
 
bool overrun
 Indicates wether a read or write overrun has occured. More...
 
uint8_t priority
 The priority this message should be handled. More...
 

Additional Inherited Members

- Protected Member Functions inherited from csSyncRefCount
virtual ~csSyncRefCount ()
 
- Protected Attributes inherited from csSyncRefCount
int32 ref_count
 

Detailed Description

The structure of 1 queue entry (pointer to a message)

Definition at line 143 of file message.h.

Constructor & Destructor Documentation

MsgEntry::MsgEntry ( size_t  datasize = 0,
uint8_t  msgpriority = PRIORITY_HIGH,
uint8_t  sequence = 0 
)
inline

Definition at line 146 of file message.h.

MsgEntry::MsgEntry ( const psMessageBytes msg)
inline

Definition at line 167 of file message.h.

MsgEntry::MsgEntry ( const MsgEntry me)
inline

Definition at line 187 of file message.h.

virtual MsgEntry::~MsgEntry ( )
inlinevirtual

Definition at line 209 of file message.h.

Member Function Documentation

void MsgEntry::Add ( const char *  str)
inline

Add a string to the current psMessageBytes buffer.

Definition at line 222 of file message.h.

void MsgEntry::Add ( const float  f)
inline

Add a float to the current psMessageBytes buffer.

Definition at line 264 of file message.h.

void MsgEntry::Add ( const uint16_t  s)
inline

Add a double the current psMessageBytes buffer.

Add unsigned 16 bit int to current psMessageBytes buffer

Definition at line 321 of file message.h.

void MsgEntry::Add ( const int16_t  s)
inline

Add signed 16 bit int to current psMessageBytes buffer.

Definition at line 348 of file message.h.

void MsgEntry::Add ( const int32_t  i)
inline

Add unsigned 32Bit Int to current psMessageBytes buffer.

Definition at line 374 of file message.h.

void MsgEntry::Add ( const uint32_t  i)
inline

Add unsigned 4byte int to current psMessageBytes buffer.

Definition at line 402 of file message.h.

void MsgEntry::Add ( const uint8_t  i)
inline

Add 8bit unsigned int to current psMessageBytes buffer.

Definition at line 458 of file message.h.

void MsgEntry::Add ( const int8_t  i)
inline

Add 8 bit signed int to buffer.

Definition at line 485 of file message.h.

void MsgEntry::Add ( const bool  b)
inline

Add bool to current psMessageBytes buffer.

Definition at line 512 of file message.h.

void MsgEntry::Add ( const csVector2 &  v)
inline

Add an x,y vector to the buffer.

Definition at line 538 of file message.h.

void MsgEntry::Add ( const csVector3 &  v)
inline

Add an x,y,z vector to the buffer.

Definition at line 566 of file message.h.

void MsgEntry::Add ( const csVector4 &  v)
inline

Add an x,y,z,w vector to the buffer.

Definition at line 595 of file message.h.

void MsgEntry::Add ( const iSector *  sector,
const csStringSet *  msgstrings,
const csStringHashReversible *  msgstringshash = NULL 
)
inline

TODO: Should not need to call Contains, but as long as the request function

Definition at line 624 of file message.h.

void MsgEntry::Add ( const iSector *  sector)
void MsgEntry::Add ( const void *  datastream,
const uint32_t  length 
)
inline

Add a processed buffer of some kind; should only be used by files and the like.

Definition at line 657 of file message.h.

void MsgEntry::AddPointer ( const uintptr_t  i)
inline

Add a pointer to the current psMessageBytes buffer. Pointers must never be sent over the network!

Definition at line 430 of file message.h.

void MsgEntry::ClipToCurrentSize ( )
inline

Definition at line 214 of file message.h.

bool MsgEntry::GetBool ( )
inline

Get a bool from the current psMessageBytes buffer.

Definition at line 885 of file message.h.

void* MsgEntry::GetBufferPointerUnsafe ( uint32_t &  length)
inline

Definition at line 1001 of file message.h.

float MsgEntry::GetFloat ( )
inline

Get a float from the current psMessageBytes buffer.

Definition at line 737 of file message.h.

int16_t MsgEntry::GetInt16 ( )
inline

Get a signed 16bit Integer from the current psMessageBytes buffer.

Definition at line 755 of file message.h.

int32_t MsgEntry::GetInt32 ( )
inline

Get a signed 32Bit Integer from the current psMessageBytes buffer.

Definition at line 792 of file message.h.

int8_t MsgEntry::GetInt8 ( )
inline

Get a signed 8bit Integer from the current psMessageBytes buffer.

Definition at line 849 of file message.h.

bool MsgEntry::GetPending ( )
inline

Definition at line 1051 of file message.h.

uintptr_t MsgEntry::GetPointer ( )
inline

Get a pointer from the current psMessageBytes buffer. Pointers must never be sent over the network!

Definition at line 830 of file message.h.

iSector* MsgEntry::GetSector ( const csStringSet *  msgstrings,
const csStringHashReversible *  msgstringshash,
iEngine *  engine 
)
inline

Definition at line 967 of file message.h.

iSector* MsgEntry::GetSector ( )
int MsgEntry::GetSequenceNumber ( )
inline

Definition at line 1041 of file message.h.

size_t MsgEntry::GetSize ( )
inline

Return the size of the databuffer.

Definition at line 1055 of file message.h.

const char* MsgEntry::GetStr ( )
inline

Get a null-terminated string from the current psMessageBytes buffer.

Definition at line 702 of file message.h.

uint8_t MsgEntry::GetType ( )
inline

Definition at line 1036 of file message.h.

uint16_t MsgEntry::GetUInt16 ( )
inline

Get a unsigned 16bit Integer from the curren psMessageBytes buffer.

Definition at line 773 of file message.h.

uint32_t MsgEntry::GetUInt32 ( )
inline

Get an unsigned 4byte int from the current psMessageBytes buffer.

Definition at line 811 of file message.h.

uint8_t MsgEntry::GetUInt8 ( )
inline

Get an unsigned 8Bit Integer from the current psMessageBytes buffer.

Definition at line 867 of file message.h.

csVector2 MsgEntry::GetVector2 ( )
inline

Definition at line 901 of file message.h.

csVector3 MsgEntry::GetVector3 ( )
inline

Definition at line 922 of file message.h.

csVector4 MsgEntry::GetVector4 ( )
inline

Definition at line 944 of file message.h.

bool MsgEntry::HasMore ( int  howMuchMore = 1)
inline

Check if we have more data in the current psMessageBytes buffer.

Definition at line 696 of file message.h.

bool MsgEntry::IsEmpty ( )
inline

Check if we are at the end of the current psMessageBytes buffer.

Definition at line 690 of file message.h.

void MsgEntry::Reset ( int  pos = 0)
inline

Definition at line 219 of file message.h.

void MsgEntry::SetPending ( bool  )
inline

Definition at line 1049 of file message.h.

void MsgEntry::SetType ( uint8_t  type)
inline

Definition at line 1032 of file message.h.

Member Data Documentation

psMessageBytes* MsgEntry::bytes

The message itself ie one block of memory with the header and data following.

Definition at line 1079 of file message.h.

uint32_t MsgEntry::clientnum

The Number of the client the Message is from/goes to.

Definition at line 1061 of file message.h.

size_t MsgEntry::current

The current position for Pushing and Popping.

Definition at line 1064 of file message.h.

uint32_t MsgEntry::msgid

Unique identifier per machine.

Definition at line 1070 of file message.h.

bool MsgEntry::overrun

Indicates wether a read or write overrun has occured.

Definition at line 1073 of file message.h.

uint8_t MsgEntry::priority

The priority this message should be handled.

Definition at line 1067 of file message.h.


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