Cafu Engine
cf::TypeSys::VarBaseT Class Referenceabstract

This is the common base class for the VarT classes. More...

#include "Variables.hpp"

Inheritance diagram for cf::TypeSys::VarBaseT:

Public Member Functions

 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...
 
virtual void Serialize (Network::OutStreamT &Stream) const =0
 Stores the value of this variable in the given Stream. More...
 
virtual void Deserialize (Network::InStreamT &Stream)=0
 Restores the value of this variable from the given Stream. More...
 
virtual void accept (VisitorT &Visitor)=0
 
virtual void accept (VisitorConstT &Visitor) const =0
 

Detailed Description

This is the common base class for the VarT classes.

It allows other code to work with VarTs without having to know their concrete type. For example, VarManT is a container for pointers to VarBaseTs.

See Also
TypeSys Variables Overview

Member Function Documentation

virtual std::string cf::TypeSys::VarBaseT::GetExtraMessage ( ) const
inlinevirtual

Sometimes actions on variables generate extra messages that are relevant to the user.

For example, setting a string that is interpreted as a filename can generate an extra message with details if the related resource could not be opened. This function returns the last extra message for this variable. However, note that a proper logging system would be a better solution to this problem, and we should probably replace this method with logging in the future.

virtual void cf::TypeSys::VarBaseT::Serialize ( Network::OutStreamT Stream) const
pure 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".

Implemented in cf::TypeSys::VarArrayT< T >, cf::TypeSys::VarArrayT< std::string >, cf::TypeSys::VarT< T >, cf::TypeSys::VarT< double >, cf::TypeSys::VarT< std::string >, cf::TypeSys::VarT< float >, cf::TypeSys::VarT< int >, cf::TypeSys::VarT< unsigned int >, cf::TypeSys::VarT< uint8_t >, cf::TypeSys::VarT< Vector2T >, cf::TypeSys::VarT< BoundingBox3T >, cf::TypeSys::VarT< uint16_t >, cf::TypeSys::VarT< bool >, cf::TypeSys::VarT< Vector3T >, cf::TypeSys::VarT< T >, cf::TypeSys::VarT< T >, cf::TypeSys::VarT< T >, and cf::TypeSys::VarT< T >.


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