InFact
Interpreter and factory for easily creating C++ objects at run-time
|
A base class for a mapping from variables of a specific type to their values. More...
#include <environment.h>
Public Member Functions | |
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... | |
virtual bool | Defined (const string &varname) const =0 |
Returns whether the specified variable has a definition in this environment. More... | |
virtual void | ReadAndSet (const string &varname, StreamTokenizer &st)=0 |
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... | |
virtual void | Print (ostream &os) const =0 |
Prints out a human-readable string to the specified output stream containing the variables, their type and, if primitive, their values. More... | |
virtual VarMapBase * | Copy (Environment *env) const =0 |
Returns a newly constructed copy of this VarMap. More... | |
Protected Member Functions | |
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 | |
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 base class for a mapping from variables of a specific type to their values.
Definition at line 66 of file environment.h.
|
inline |
Constructs a base class for a concrete implementation providing 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 wraps this VarMapBase instance |
is_primitive | whether this instance contains primitive or primitive vector variables |
Definition at line 76 of file environment.h.
|
inlinevirtual |
Definition at line 79 of file environment.h.
|
pure virtual |
Returns a newly constructed copy of this VarMap.
Implemented in infact::VarMapImpl< T, Derived >, infact::VarMapImpl< vector< T >, VarMap< vector< T > > >, and infact::VarMapImpl< T, VarMap< T > >.
|
pure virtual |
Returns whether the specified variable has a definition in this environment.
Implemented in infact::VarMapImpl< T, Derived >, infact::VarMapImpl< vector< T >, VarMap< vector< T > > >, and infact::VarMapImpl< T, VarMap< T > >.
|
inlinevirtual |
Returns whether this instance contains primitive or primtive vector variables.
Definition at line 83 of file environment.h.
|
inlinevirtual |
Returns the type name of the variables of this instance.
Definition at line 86 of file environment.h.
|
pure virtual |
Prints out a human-readable string to the specified output stream containing the variables, their type and, if primitive, their values.
Implemented in infact::VarMapImpl< T, Derived >, infact::VarMapImpl< vector< T >, VarMap< vector< T > > >, and infact::VarMapImpl< T, VarMap< T > >.
|
pure virtual |
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.
Implemented in infact::VarMap< vector< T > >, and infact::VarMap< T >.
|
inlineprotected |
To allow proper implementation of Copy in VarMapBase implementation, since we don't get copying of base class' members for free.
Definition at line 109 of file environment.h.
|
protected |
The Environment that holds this VarMap instance.
Definition at line 118 of file environment.h.
|
protected |
Whether this VarMap instance holds variables of primitive type or vector of primitives.
Definition at line 121 of file environment.h.
|
protected |
The type name of this VarMap.
Definition at line 116 of file environment.h.