SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SLNet::VariableListDeltaTracker Class Reference

`#include <slikenet/VariableListDeltaTracker.h>`

## Classes

struct | VariableLastValueNode

## Public Member Functions

| VariableListDeltaTracker ()
| ~VariableListDeltaTracker ()
void | StartWrite (void)
bool | IsPastEndOfList (void) const
template<class VarType >
bool | WriteVar (const VarType &varData)
template<class VarType >
bool | WriteVarToBitstream (const VarType &varData, SLNet::BitStream *bitStream)
| Calls WriteVar. If the variable has changed, writes true, and writes the variable. Otherwise writes false.
template<class VarType >
bool | WriteVarToBitstream (const VarType &varData, SLNet::BitStream *bitStream, unsigned char *bArray, unsigned short writeOffset)
| Calls WriteVarToBitstream(). Additionally, adds the boolean result of WriteVar() to boolean bit array.
void | FlagDirtyFromBitArray (unsigned char *bArray)

## Static Public Member Functions

template<class VarType >
static bool | ReadVarFromBitstream (VarType &varData, SLNet::BitStream *bitStream)
| Paired with a call to WriteVarToBitstream(), will read a variable if it had changed. Otherwise the values remains the same.

## Protected Attributes

DataStructures::List < VariableLastValueNode > | variableList
unsigned int | nextWriteIndex

## Detailed Description

Class to write a series of variables, copy the contents to memory, and return if the newly written value is different than what was last written Can also encode the reads, writes, and results directly to/from a bitstream

Definition at line 28 of file VariableListDeltaTracker.h.

## Constructor & Destructor Documentation

VariableListDeltaTracker::VariableListDeltaTracker | ( |  | ) |

Definition at line 20 of file VariableListDeltaTracker.cpp.

References nextWriteIndex.

VariableListDeltaTracker::~VariableListDeltaTracker | ( |  | ) |

Definition at line 21 of file VariableListDeltaTracker.cpp.

References _FILE_AND_LINE_, rakFree_Ex, DataStructures::List< list_type >::Size(), and variableList.

## Member Function Documentation

void VariableListDeltaTracker::FlagDirtyFromBitArray | ( | unsigned char * | bArray | ) |

Variables flagged dirty will cause WriteVar() to return true, even if the variable had not otherwise changed This updates all the variables in the list, where in each index varsWritten is true, so will the variable at the corresponding index be flagged dirty

Definition at line 31 of file VariableListDeltaTracker.cpp.

References DataStructures::List< list_type >::Size(), and variableList.

Referenced by SLNet::VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt().

bool SLNet::VariableListDeltaTracker::IsPastEndOfList | ( | void |  | ) | const

inline

Definition at line 37 of file VariableListDeltaTracker.h.

References nextWriteIndex, DataStructures::List< list_type >::Size(), and variableList.

Referenced by SLNet::VariableDeltaSerializer::SerializeVariable().

template<class VarType >

static bool SLNet::VariableListDeltaTracker::ReadVarFromBitstream | ( | VarType & | varData,
|  | SLNet::BitStream * | bitStream
| ) |  |

inlinestatic

Paired with a call to WriteVarToBitstream(), will read a variable if it had changed. Otherwise the values remains the same.

Definition at line 113 of file VariableListDeltaTracker.h.

References SLNet::BitStream::Read().

Referenced by SLNet::VariableDeltaSerializer::DeserializeVariable().

void VariableListDeltaTracker::StartWrite | ( | void |  | ) |

Definition at line 29 of file VariableListDeltaTracker.cpp.

References nextWriteIndex.

Referenced by SLNet::VariableDeltaSerializer::StartVariableHistoryWrite().

template<class VarType >

bool SLNet::VariableListDeltaTracker::WriteVar | ( | const VarType & | varData | ) |

inline

Records the passed value of the variable to memory, and returns true if the value is different from the write before that (or if it is the first write)

Precondition
  Call StartWrite() before doing the first of a series of calls to WriteVar or other functions that call WriteVar

Note
  Variables must be of the same type, written in the same order, each time

Definition at line 43 of file VariableListDeltaTracker.h.

References _FILE_AND_LINE_, SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBytesUsed(), nextWriteIndex, DataStructures::List< list_type >::Push(), rakRealloc_Ex, DataStructures::List< list_type >::Size(), variableList, and SLNet::BitStream::Write().

Referenced by WriteVarToBitstream().

template<class VarType >

bool SLNet::VariableListDeltaTracker::WriteVarToBitstream | ( | const VarType & | varData,
|  | SLNet::BitStream * | bitStream
| ) |  |

inline

Calls WriteVar. If the variable has changed, writes true, and writes the variable. Otherwise writes false.

Definition at line 76 of file VariableListDeltaTracker.h.

References SLNet::BitStream::Write(), and WriteVar().

Referenced by SLNet::VariableDeltaSerializer::SerializeVariable(), and WriteVarToBitstream().

template<class VarType >

bool SLNet::VariableListDeltaTracker::WriteVarToBitstream | ( | const VarType & | varData,
|  | SLNet::BitStream * | bitStream,
|  | unsigned char * | bArray,
|  | unsigned short | writeOffset
| ) |  |

inline

Calls WriteVarToBitstream(). Additionally, adds the boolean result of WriteVar() to boolean bit array.

Definition at line 89 of file VariableListDeltaTracker.h.

References WriteVarToBitstream().

## Member Data Documentation

unsigned int SLNet::VariableListDeltaTracker::nextWriteIndex

protected

Definition at line 145 of file VariableListDeltaTracker.h.

Referenced by IsPastEndOfList(), StartWrite(), VariableListDeltaTracker(), and WriteVar().

DataStructures::List<VariableLastValueNode> SLNet::VariableListDeltaTracker::variableList

protected

Definition at line 143 of file VariableListDeltaTracker.h.

Referenced by FlagDirtyFromBitArray(), IsPastEndOfList(), WriteVar(), and ~VariableListDeltaTracker().

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

- Source/include/slikenet/VariableListDeltaTracker.h
- Source/src/VariableListDeltaTracker.cpp