InFact
Interpreter and factory for easily creating C++ objects at run-time
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
infact::VarMap< T > Class Template Reference

A container to hold the mapping between named variables of a specific type and their values. More...

#include <environment.h>

Inheritance diagram for infact::VarMap< T >:
infact::VarMapImpl< T, VarMap< T > > infact::VarMapBase

Public Types

typedef VarMapImpl< T, VarMap
< T > > 
Base
 

Public Member Functions

 VarMap (const string &name, Environment *env, bool is_primitive=true)
 Constructs a mapping from variables of a particular type to their values. More...
 
virtual ~VarMap ()
 
virtual void ReadAndSet (const string &varname, StreamTokenizer &st)
 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...
 
- Public Member Functions inherited from infact::VarMapImpl< T, VarMap< T > >
 VarMapImpl (const string &name, Environment *env, bool is_primitive=true)
 
virtual ~VarMapImpl ()
 
bool Get (const string &varname, T *value) const
 Assigns the value of the specified variable to the object pointed to by the value parameter. More...
 
virtual bool Defined (const string &varname) const
 
void Set (const string &varname, T value)
 Sets the specified variable to the specified value. More...
 
virtual void Print (ostream &os) const
 
virtual VarMapBaseCopy (Environment *env) const
 
- Public Member Functions inherited from infact::VarMapBase
 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...
 

Additional Inherited Members

- Protected Member Functions inherited from infact::VarMapImpl< T, VarMap< T > >
bool ReadAndSetFromExistingVariable (const string &varname, StreamTokenizer &st)
 Checks if the next token is an identifier and is a variable in the environment, and, if so, sets varname to the variable’s value. More...
 
Environmentenv ()
 A protected method to access the environment contained by this VarMapBase instance, for the two concrete VarMap implementations, below. More...
 
- Protected Member Functions inherited from infact::VarMapBase
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 inherited from infact::VarMapBase
string name_
 The type name of this VarMap. More...
 
Environmentenv_
 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...
 

Detailed Description

template<typename T>
class infact::VarMap< T >

A container to hold the mapping between named variables of a specific type and their values.

Template Parameters
Tthe type of variables held by this variable map

Definition at line 384 of file environment.h.

Member Typedef Documentation

template<typename T>
typedef VarMapImpl<T, VarMap<T> > infact::VarMap< T >::Base

Definition at line 386 of file environment.h.

Constructor & Destructor Documentation

template<typename T>
infact::VarMap< T >::VarMap ( const string &  name,
Environment env,
bool  is_primitive = true 
)
inline

Constructs a mapping from variables of a particular type to their values.

Parameters
namethe type name of the variables in this instance
envthe Environment that contains this VarMap instance
is_primitivewhether this instance contains primitive or primitive vector variables

Definition at line 395 of file environment.h.

template<typename T>
virtual infact::VarMap< T >::~VarMap ( )
inlinevirtual

Definition at line 398 of file environment.h.

Member Function Documentation

template<typename T>
virtual void infact::VarMap< T >::ReadAndSet ( const string &  varname,
StreamTokenizer st 
)
inlinevirtual

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.

Implements infact::VarMapBase.

Definition at line 401 of file environment.h.


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