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 | List of all members
infact::EnvironmentImpl Class Reference

Provides a set of named variables and their types, as well as the values for those variables. More...

#include <environment-impl.h>

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

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

Detailed Description

Provides a set of named variables and their types, as well as the values for those variables.

See Also
Interpreter

Definition at line 60 of file environment-impl.h.

Constructor & Destructor Documentation

infact::EnvironmentImpl::EnvironmentImpl ( int  debug = 0)

Constructs a new, empty environment.

Parameters
debugthe debug level; if greater than 0, various debugging messages will be output to std::cerr

Definition at line 41 of file environment-impl.cc.

virtual infact::EnvironmentImpl::~EnvironmentImpl ( )
inlinevirtual

Destroys this environment.

Definition at line 69 of file environment-impl.h.

Member Function Documentation

virtual Environment* infact::EnvironmentImpl::Copy ( ) const
inlinevirtual

Returns a copy of this environment.

Implements infact::Environment.

Definition at line 133 of file environment-impl.h.

virtual bool infact::EnvironmentImpl::Defined ( const string &  varname) const
inlinevirtual

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

Implements infact::Environment.

Definition at line 78 of file environment-impl.h.

template<typename T >
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.

Parameters
varnamethe name of the variable whose value is to be retrieved
[out]valuea pointer to the object whose value is to be set
Returns
whether the specified variable exists and its value was successfully set by this method

Definition at line 177 of file environment-impl.h.

virtual const string& infact::EnvironmentImpl::GetType ( const string &  varname) const
inlinevirtual

Retrieves the type name of the specified variable.

Implements infact::Environment.

Definition at line 88 of file environment-impl.h.

virtual VarMapBase* infact::EnvironmentImpl::GetVarMap ( const string &  varname)
inlinevirtual

Retrieves the VarMap instance for the specified variable.

Implements infact::Environment.

Definition at line 97 of file environment-impl.h.

virtual VarMapBase* infact::EnvironmentImpl::GetVarMapForType ( const string &  type)
inlinevirtual

Retrieves the VarMap instance for the specified type.

Implements infact::Environment.

Definition at line 102 of file environment-impl.h.

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

void infact::EnvironmentImpl::PrintFactories ( ostream &  os) const
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

Implements infact::Environment.

Definition at line 248 of file environment-impl.cc.

void infact::EnvironmentImpl::ReadAndSet ( const string &  varname,
StreamTokenizer st,
const string  type 
)
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.


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