InFact
Interpreter and factory for easily creating C++ objects at run-time
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
infact::Environment Class Referenceabstract

An interface for an environment in which variables of various types are mapped to their values. More...

#include <environment.h>

Inheritance diagram for infact::Environment:
infact::EnvironmentImpl

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 VarMapBaseGetVarMap (const string &varname)=0
 Retrieves the VarMap instance for the specified variable. More...
 
virtual VarMapBaseGetVarMapForType (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 EnvironmentCopy () 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 EnvironmentCreateEmpty ()
 A static factory method to create a new, empty Environment instance. More...
 

Detailed Description

An interface for an environment in which variables of various types are mapped to their values.

Definition at line 126 of file environment.h.

Constructor & Destructor Documentation

virtual infact::Environment::~Environment ( )
inlinevirtual

Definition at line 128 of file environment.h.

Member Function Documentation

virtual Environment* infact::Environment::Copy ( ) const
pure virtual

Returns a copy of this environment.

Implemented in infact::EnvironmentImpl.

Environment * infact::Environment::CreateEmpty ( )
static

A static factory method to create a new, empty Environment instance.

Definition at line 43 of file environment.cc.

virtual bool infact::Environment::Defined ( const string &  varname) const
pure virtual

Returns whether the specified variable has been defined in this environment.

Implemented in infact::EnvironmentImpl.

virtual const string& infact::Environment::GetType ( const string &  varname) const
pure virtual

Retrieves the type name of the specified variable.

Implemented in infact::EnvironmentImpl.

virtual VarMapBase* infact::Environment::GetVarMap ( const string &  varname)
pure virtual

Retrieves the VarMap instance for the specified variable.

Implemented in infact::EnvironmentImpl.

virtual VarMapBase* infact::Environment::GetVarMapForType ( const string &  type)
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.

virtual void infact::Environment::Print ( ostream &  os) const
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.

virtual void infact::Environment::PrintFactories ( ostream &  os) const
pure virtual

Prints out a human-readable string with the names of all abstract base types and their concrete implementations that may be constructed.

See Also
infact::FactoryContainer::Print

Implemented in infact::EnvironmentImpl.

virtual void infact::Environment::ReadAndSet ( const string &  varname,
StreamTokenizer st,
const string  type = "" 
)
pure virtual

Sets the specified variable to the value obtained from the following tokens available from the specified token stream.

Implemented in infact::EnvironmentImpl.


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