InFact
Interpreter and factory for easily creating C++ objects at run-time
|
Provides a set of named variables and their types, as well as the values for those variables. More...
#include <environment-impl.h>
Public Member Functions | |
EnvironmentImpl (int debug=0) | |
Constructs a new, empty environment. More... | |
virtual | ~EnvironmentImpl () |
Destroys this environment. More... | |
virtual bool | Defined (const string &varname) const |
Returns whether the specified variable has been defined in this environment. More... | |
virtual void | ReadAndSet (const string &varname, StreamTokenizer &st, const string type) |
Sets the specified variable to the value obtained from the following tokens available from the specified token stream. More... | |
virtual const string & | GetType (const string &varname) const |
Retrieves the type name of the specified variable. More... | |
virtual VarMapBase * | GetVarMap (const string &varname) |
Retrieves the VarMap instance for the specified variable. More... | |
virtual VarMapBase * | GetVarMapForType (const string &type) |
Retrieves the VarMap instance for the specified type. More... | |
virtual void | Print (ostream &os) const |
Prints a human-readable string of all the variables in this environment, their types and, if primitive, their values. More... | |
virtual void | PrintFactories (ostream &os) const |
Prints out a human-readable string with the names of all abstract base types and their concrete implementations that may be constructed. More... | |
virtual Environment * | Copy () const |
Returns a copy of this environment. More... | |
template<typename T > | |
bool | Get (const string &varname, T *value) const |
Retrieves the value of the variable with the specified name and puts into into the object pointed to by the value parameter. More... | |
Public Member Functions inherited from infact::Environment | |
virtual | ~Environment () |
Additional Inherited Members | |
Static Public Member Functions inherited from infact::Environment | |
static Environment * | CreateEmpty () |
A static factory method to create a new, empty Environment instance. More... | |
Provides a set of named variables and their types, as well as the values for those variables.
Definition at line 60 of file environment-impl.h.
infact::EnvironmentImpl::EnvironmentImpl | ( | int | debug = 0 | ) |
Constructs a new, empty environment.
debug | the debug level; if greater than 0, various debugging messages will be output to std::cerr |
Definition at line 41 of file environment-impl.cc.
|
inlinevirtual |
Destroys this environment.
Definition at line 69 of file environment-impl.h.
|
inlinevirtual |
Returns a copy of this environment.
Implements infact::Environment.
Definition at line 133 of file environment-impl.h.
|
inlinevirtual |
Returns whether the specified variable has been defined in this environment.
Implements infact::Environment.
Definition at line 78 of file environment-impl.h.
bool infact::EnvironmentImpl::Get | ( | const string & | varname, |
T * | value | ||
) | const |
Retrieves the value of the variable with the specified name and puts into into the object pointed to by the value
parameter.
varname | the name of the variable whose value is to be retrieved | |
[out] | value | a pointer to the object whose value is to be set |
Definition at line 177 of file environment-impl.h.
|
inlinevirtual |
Retrieves the type name of the specified variable.
Implements infact::Environment.
Definition at line 88 of file environment-impl.h.
|
inlinevirtual |
Retrieves the VarMap instance for the specified variable.
Implements infact::Environment.
Definition at line 97 of file environment-impl.h.
|
inlinevirtual |
Retrieves the VarMap instance for the specified type.
Implements infact::Environment.
Definition at line 102 of file environment-impl.h.
|
inlinevirtual |
Prints a human-readable string of all the variables in this environment, their types and, if primitive, their values.
Implements infact::Environment.
Definition at line 121 of file environment-impl.h.
|
virtual |
Prints out a human-readable string with the names of all abstract base types and their concrete implementations that may be constructed.
Implements infact::Environment.
Definition at line 248 of file environment-impl.cc.
|
virtual |
Sets the specified variable to the value obtained from the following tokens available from the specified token stream.
Implements infact::Environment.
Definition at line 109 of file environment-impl.cc.