This is a "wrapper" around a normal C++ variable specifically of type ArrayT<T>. More...
#include "Variables.hpp"
Public Member Functions | |
VarArrayT (const char *Name, unsigned int InitSize, const T &InitValue, const char *Flags[]=NULL) | |
The constructor. More... | |
const ArrayT< T > & | Get () const |
unsigned int | Size () const |
void | Clear () |
void | Overwrite () |
void | PushBack (const T Element) |
const T & | operator[] (unsigned int i) const |
T & | operator[] (unsigned int i) |
void | Serialize (Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
void | Deserialize (Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
void | accept (VisitorT &Visitor) |
void | accept (VisitorConstT &Visitor) const |
![]() | |
VarBaseT (const char *Name, const char *Flags[]) | |
const char * | GetName () const |
const char ** | GetFlags () const |
bool | HasFlag (const char *Flag) const |
const char * | GetFlag (const char *Flag, unsigned int Nr, const char *Default=NULL) const |
virtual std::string | GetExtraMessage () const |
Sometimes actions on variables generate extra messages that are relevant to the user. More... | |
This is a "wrapper" around a normal C++ variable specifically of type ArrayT<T>.
This class is similar to VarT< ArrayT<T> >, but was invented because working with VarT< ArrayT<T> >s is actually difficult in practice:
Therefore, VarArrayT<T> was made to have an interface that is easier to use and more efficient when working with arrays, and consciously omits the "possible side-effects" feature that VarT::Set() has.
It can be used in place of a normal ArrayT variable whenever the functionality described in TypeSys Variables Overview is desired, for example in the member variables of component classes of game entities and GUI windows.
cf::TypeSys::VarArrayT< T >::VarArrayT | ( | const char * | Name, |
unsigned int | InitSize, | ||
const T & | InitValue, | ||
const char * | Flags[] = NULL |
||
) |
The constructor.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.