Cafu Engine
cf::Network::StateT Class Reference

This class holds the serialized state of another object (typically a game entity). More...

#include "State.hpp"

Public Member Functions

 StateT ()
 Constructor for creating an empty StateT instance. More...
 
 StateT (const StateT &Other, const ArrayT< uint8_t > &DeltaMessage)
 Constructor for creating a state from another StateT instance and a delta message. More...
 
ArrayT< uint8_t > GetDeltaMessage (const StateT &Other, bool Compress=true) const
 Creates a delta message from this state. More...
 

Static Public Member Functions

static bool IsDeltaMessageEmpty (const ArrayT< uint8_t > &DeltaMessage)
 Returns whether a delta message created by GetDeltaMessage() is empty (no change to the state). More...
 

Friends

class InStreamT
 
class OutStreamT
 

Detailed Description

This class holds the serialized state of another object (typically a game entity).

It is used in combination with the OutStreamT and InStreamT classes, which handle the serialization and deserialization. The delta messages created and taken by this class are intended for network transfer, disk storage, etc. Internally, the encapsulated state is kept as an array of raw bytes, and as such it is "opaque" – we don't have any idea of the meaning of the contained data.

Constructor & Destructor Documentation

cf::Network::StateT::StateT ( )
inline

Constructor for creating an empty StateT instance.

The constructed instance is typically used with an OutStreamT, filled indirectly in a call to e.g. BaseEntityT::Serialize(OutStreamT& Stream).

StateT::StateT ( const StateT Other,
const ArrayT< uint8_t > &  DeltaMessage 
)

Constructor for creating a state from another StateT instance and a delta message.

Parameters
OtherThe other state to create this state from.
DeltaMessageThe delta message that expresses how this state is different from Other.

Member Function Documentation

ArrayT< uint8_t > StateT::GetDeltaMessage ( const StateT Other,
bool  Compress = true 
) const

Creates a delta message from this state.

The delta message expresses how this state is different from another.

Parameters
OtherThe other state that the generated delta message is relative to.
CompressWhether the delta message should be RLE-compressed.
bool StateT::IsDeltaMessageEmpty ( const ArrayT< uint8_t > &  DeltaMessage)
static

Returns whether a delta message created by GetDeltaMessage() is empty (no change to the state).


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