Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
reranker::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 reranker::VarMap< T >:
reranker::VarMapBase

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 ()
 
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
 Returns whether the specified variable has a definition in this environment. More...
 
void Set (const string &varname, T value)
 Sets the specified variable to the specified value. More...
 
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...
 
virtual void Print (ostream &os) const
 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
 Returns a newly constructed copy of this VarMap. More...
 
- Public Member Functions inherited from reranker::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 reranker::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 reranker::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 reranker::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 256 of file environment.H.

Constructor & Destructor Documentation

template<typename T>
reranker::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 265 of file environment.H.

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

Definition at line 268 of file environment.H.

Member Function Documentation

template<typename T>
virtual VarMapBase* reranker::VarMap< T >::Copy ( Environment env) const
inlinevirtual

Returns a newly constructed copy of this VarMap.

Implements reranker::VarMapBase.

Definition at line 360 of file environment.H.

template<typename T>
virtual bool reranker::VarMap< T >::Defined ( const string &  varname) const
inlinevirtual

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

Implements reranker::VarMapBase.

Definition at line 288 of file environment.H.

template<typename T>
bool reranker::VarMap< T >::Get ( const string &  varname,
T *  value 
) const
inline

Assigns the value of the specified variable to the object pointed to by the value parameter.

Returns
whether the specified variable exists and the assignment was successful

Definition at line 277 of file environment.H.

template<typename T>
virtual void reranker::VarMap< T >::Print ( ostream &  os) const
inlinevirtual

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

Implements reranker::VarMapBase.

Definition at line 345 of file environment.H.

template<typename T>
virtual void reranker::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 reranker::VarMapBase.

Definition at line 298 of file environment.H.

template<typename T>
void reranker::VarMap< T >::Set ( const string &  varname,
value 
)
inline

Sets the specified variable to the specified value.

Definition at line 293 of file environment.H.


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