InFact
Interpreter and factory for easily creating C++ objects at run-time
|
A container to hold the mapping between named variables of a specific type and their values. More...
#include <environment.h>
Public Types | |
typedef VarMapImpl< T, VarMap < T > > | Base |
Public Member Functions | |
VarMap (const string &name, Environment *env, bool is_primitive=true) | |
Constructs a mapping from variables of a particular type to their values. More... | |
virtual | ~VarMap () |
virtual void | ReadAndSet (const string &varname, StreamTokenizer &st) |
Reads the next value (primitive or spec for constructing a Factory-constructible object) from the specified stream tokenizer and sets the specified variable to that value. More... | |
Public Member Functions inherited from infact::VarMapImpl< T, VarMap< T > > | |
VarMapImpl (const string &name, Environment *env, bool is_primitive=true) | |
virtual | ~VarMapImpl () |
bool | Get (const string &varname, T *value) const |
Assigns the value of the specified variable to the object pointed to by the value parameter. More... | |
virtual bool | Defined (const string &varname) const |
void | Set (const string &varname, T value) |
Sets the specified variable to the specified value. More... | |
virtual void | Print (ostream &os) const |
virtual VarMapBase * | Copy (Environment *env) const |
Public Member Functions inherited from infact::VarMapBase | |
VarMapBase (const string &name, Environment *env, bool is_primitive) | |
Constructs a base class for a concrete implementation providing a mapping from variables of a particular type to their values. More... | |
virtual | ~VarMapBase () |
virtual bool | IsPrimitive () const |
Returns whether this instance contains primitive or primtive vector variables. More... | |
virtual const string & | Name () const |
Returns the type name of the variables of this instance. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from infact::VarMapImpl< T, VarMap< T > > | |
bool | ReadAndSetFromExistingVariable (const string &varname, StreamTokenizer &st) |
Checks if the next token is an identifier and is a variable in the environment, and, if so, sets varname to the variable’s value. More... | |
Environment * | env () |
A protected method to access the environment contained by this VarMapBase instance, for the two concrete VarMap implementations, below. More... | |
Protected Member Functions inherited from infact::VarMapBase | |
void | SetMembers (const string &name, Environment *env, bool is_primitive) |
To allow proper implementation of Copy in VarMapBase implementation, since we don't get copying of base class' members for free. More... | |
Protected Attributes inherited from infact::VarMapBase | |
string | name_ |
The type name of this VarMap. More... | |
Environment * | env_ |
The Environment that holds this VarMap instance. More... | |
bool | is_primitive_ |
Whether this VarMap instance holds variables of primitive type or vector of primitives. More... | |
A container to hold the mapping between named variables of a specific type and their values.
T | the type of variables held by this variable map |
Definition at line 384 of file environment.h.
typedef VarMapImpl<T, VarMap<T> > infact::VarMap< T >::Base |
Definition at line 386 of file environment.h.
|
inline |
Constructs a mapping from variables of a particular type to their values.
name | the type name of the variables in this instance |
env | the Environment that contains this VarMap instance |
is_primitive | whether this instance contains primitive or primitive vector variables |
Definition at line 395 of file environment.h.
|
inlinevirtual |
Definition at line 398 of file environment.h.
|
inlinevirtual |
Reads the next value (primitive or spec for constructing a Factory-constructible object) from the specified stream tokenizer and sets the specified variable to that value.
Implements infact::VarMapBase.
Definition at line 401 of file environment.h.