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 | Protected Member Functions | Protected Attributes | List of all members
infact::VarMapBase Class Referenceabstract

A base class for a mapping from variables of a specific type to their values. More...

#include <environment.h>

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

Public Member Functions

 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...
 
virtual bool Defined (const string &varname) const =0
 Returns whether the specified variable has a definition in this environment. More...
 
virtual void ReadAndSet (const string &varname, StreamTokenizer &st)=0
 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...
 
virtual void Print (ostream &os) const =0
 Prints out a human-readable string to the specified output stream containing the variables, their type and, if primitive, their values. More...
 
virtual VarMapBaseCopy (Environment *env) const =0
 Returns a newly constructed copy of this VarMap. More...
 

Protected Member Functions

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

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

A base class for a mapping from variables of a specific type to their values.

Definition at line 66 of file environment.h.

Constructor & Destructor Documentation

infact::VarMapBase::VarMapBase ( const string &  name,
Environment env,
bool  is_primitive 
)
inline

Constructs a base class for a concrete implementation providing a mapping from variables of a particular type to their values.

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

Definition at line 76 of file environment.h.

virtual infact::VarMapBase::~VarMapBase ( )
inlinevirtual

Definition at line 79 of file environment.h.

Member Function Documentation

virtual VarMapBase* infact::VarMapBase::Copy ( Environment env) const
pure virtual
virtual bool infact::VarMapBase::Defined ( const string &  varname) const
pure virtual

Returns whether the specified variable has a definition in this environment.

Implemented in infact::VarMapImpl< T, Derived >, infact::VarMapImpl< vector< T >, VarMap< vector< T > > >, and infact::VarMapImpl< T, VarMap< T > >.

virtual bool infact::VarMapBase::IsPrimitive ( ) const
inlinevirtual

Returns whether this instance contains primitive or primtive vector variables.

Definition at line 83 of file environment.h.

virtual const string& infact::VarMapBase::Name ( ) const
inlinevirtual

Returns the type name of the variables of this instance.

Definition at line 86 of file environment.h.

virtual void infact::VarMapBase::Print ( ostream &  os) const
pure virtual

Prints out a human-readable string to the specified output stream containing the variables, their type and, if primitive, their values.

Implemented in infact::VarMapImpl< T, Derived >, infact::VarMapImpl< vector< T >, VarMap< vector< T > > >, and infact::VarMapImpl< T, VarMap< T > >.

virtual void infact::VarMapBase::ReadAndSet ( const string &  varname,
StreamTokenizer st 
)
pure virtual

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.

Implemented in infact::VarMap< vector< T > >, and infact::VarMap< T >.

void infact::VarMapBase::SetMembers ( const string &  name,
Environment env,
bool  is_primitive 
)
inlineprotected

To allow proper implementation of Copy in VarMapBase implementation, since we don't get copying of base class' members for free.

Definition at line 109 of file environment.h.

Member Data Documentation

Environment* infact::VarMapBase::env_
protected

The Environment that holds this VarMap instance.

Definition at line 118 of file environment.h.

bool infact::VarMapBase::is_primitive_
protected

Whether this VarMap instance holds variables of primitive type or vector of primitives.

Definition at line 121 of file environment.h.

string infact::VarMapBase::name_
protected

The type name of this VarMap.

Definition at line 116 of file environment.h.


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