InFact
Interpreter and factory for easily creating C++ objects at run-time
|
An interface for an environment in which variables of various types are mapped to their values. More...
#include <environment.h>
Public Member Functions | |
virtual | ~Environment () |
virtual bool | Defined (const string &varname) const =0 |
Returns whether the specified variable has been defined in this environment. More... | |
virtual void | ReadAndSet (const string &varname, StreamTokenizer &st, const string type="")=0 |
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 =0 |
Retrieves the type name of the specified variable. More... | |
virtual VarMapBase * | GetVarMap (const string &varname)=0 |
Retrieves the VarMap instance for the specified variable. More... | |
virtual VarMapBase * | GetVarMapForType (const string &type)=0 |
Retrieves the VarMap instance for the specified type, or nullptr if there is no such VarMap. More... | |
virtual void | Print (ostream &os) const =0 |
Prints a human-readable string of all the variables in this environment, their types and, if primitive, their values. More... | |
virtual Environment * | Copy () const =0 |
Returns a copy of this environment. More... | |
virtual void | PrintFactories (ostream &os) const =0 |
Prints out a human-readable string with the names of all abstract base types and their concrete implementations that may be constructed. More... | |
Static Public Member Functions | |
static Environment * | CreateEmpty () |
A static factory method to create a new, empty Environment instance. More... | |
An interface for an environment in which variables of various types are mapped to their values.
Definition at line 126 of file environment.h.
|
inlinevirtual |
Definition at line 128 of file environment.h.
|
pure virtual |
Returns a copy of this environment.
Implemented in infact::EnvironmentImpl.
|
static |
A static factory method to create a new, empty Environment instance.
Definition at line 43 of file environment.cc.
|
pure virtual |
Returns whether the specified variable has been defined in this environment.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Retrieves the type name of the specified variable.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Retrieves the VarMap instance for the specified variable.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Retrieves the VarMap instance for the specified type, or nullptr if there is no such VarMap.
The specified type must either be a primitive type, a primitive vector type, a Factory-constructible type or a vector of Factory-constructible types.
If the specified type is a concrete implementation of a Factory-constructible type, then the pointer to the VarMap for its abstract base type is returned; for example, if the specified type is "RankFeatureExtactor"
then this method will return the VarMap containing "FeatureExtractor"
instances.
TODO(dbikel): Support returning the VarMap for vectors of abstract type when the user specifies a vector of concrete type. E.g., if the specified type is "RankFeatureExtractor[]" then this method should return the VarMap containing "FeatureExtractor[]" instances.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Prints a human-readable string of all the variables in this environment, their types and, if primitive, their values.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Prints out a human-readable string with the names of all abstract base types and their concrete implementations that may be constructed.
Implemented in infact::EnvironmentImpl.
|
pure virtual |
Sets the specified variable to the value obtained from the following tokens available from the specified token stream.
Implemented in infact::EnvironmentImpl.