Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ValueGeneratorMap Template Class Reference

This is provided for use with objects which want to maintain a simple database of named ValueGenerator objects. More...

#include <valuegenmap.h>

Inheritance diagram for ValueGeneratorMap

Inheritance graph

[legend]
Collaboration diagram for ValueGeneratorMap:

Collaboration graph

[legend]
List of all members.

Public Types

typedef K key_type
 Key type of our local map. More...

typedef ValueGenerator<T>* data_type
 Data element type of our local map. More...

typedef pair<const key_type,
data_type
value_type
 Element type of our local map. More...

typedef std::map< key_type,
data_type
map_type
 Type of our local map. More...

typedef map_type::iterator iterator
 Map's iterator. More...

typedef map_type::const_iterator const_iterator
 Map's iterator. More...


Public Methods

 ValueGeneratorMap ()
 ValueGeneratorMap (const ValueGeneratorMap& b)
 ~ValueGeneratorMap ()
iterator begin ()
 Underlying map's begin(). More...

const_iterator begin () const
 Underlying map's begin(). More...

iterator end ()
 Underlying map's end(). More...

const_iterator end () const
 Underlying map's end(). More...

pair<iterator,bool> insert (const value_type& x)
 Insert into underlying map. More...

void set (const key_type& k, const data_type d)
 Instead of directly using the map's [], which has a tricky semantics, or find, which is cumbersome, map access is handled through named get and set member functions. More...

void set_default (const key_type& k, const T d)
 Set only if not yet set. More...

get (const key_type& k) const
 Similar to map's [], but returns actual value (not pointer or ValueGenerator), has a default of zero if not found, and never adds a new entry. More...

T* getptr (const key_type& k)
 Similar to [], but adds a new ValueGenerator if the key is not found rather than adding a null pointer. More...

virtual bool next ()
 Advance to the next state (whatever that means for this object). More...

virtual void reset ()
 Reset to the starting state. More...

virtual void relink (const ValueGeneratorMap<T,K>* b)
 Relink all of the ValueGenerators in this map with those in the given map. More...

virtual void merge (const ValueGeneratorMap<T,K>& b)
 Incorporate ValueGenerators from another map. More...

virtual ValueGeneratorMap<
T,K>* 
clone () const
 Construct and return an identical copy of self. More...


Detailed Description

template<class T, class K = string> template class ValueGeneratorMap

This is provided for use with objects which want to maintain a simple database of named ValueGenerator objects.

It uses an STL map to provide get and set operations on parameters, and also provides the ValueGen operations, (making it be a ValueGen itself). In fact, this should really be implemented as a ValueGenMap, since it does not really depend on the object types. Unfortunately, Cray's compiler won't currently support clone() for such a case, and thus currently this is restricted to items of a single arithmetic type.

Definition at line 40 of file valuegenmap.h.


Member Typedef Documentation

template<classT, classK = string>
typedef map_type::const_iterator ValueGeneratorMap<T, K>::const_iterator
 

Map's iterator.

Definition at line 58 of file valuegenmap.h.

template<classT, classK = string>
typedef ValueGenerator<T>* ValueGeneratorMap<T, K>::data_type
 

Data element type of our local map.

Definition at line 46 of file valuegenmap.h.

template<classT, classK = string>
typedef map_type::iterator ValueGeneratorMap<T, K>::iterator
 

Map's iterator.

Definition at line 55 of file valuegenmap.h.

template<classT, classK = string>
typedef K ValueGeneratorMap<T, K>::key_type
 

Key type of our local map.

Definition at line 43 of file valuegenmap.h.

template<classT, classK = string>
typedef std::map< key_type, data_type > ValueGeneratorMap<T, K>::map_type
 

Type of our local map.

Definition at line 52 of file valuegenmap.h.

template<classT, classK = string>
typedef pair<const key_type, data_type> ValueGeneratorMap<T, K>::value_type
 

Element type of our local map.

Definition at line 49 of file valuegenmap.h.


Constructor & Destructor Documentation

template<classT, classK = string>
ValueGeneratorMap<T, K>::ValueGeneratorMap<T, K> ( ) [inline]
 

Definition at line 60 of file valuegenmap.h.

template<classT, classK = string>
ValueGeneratorMap<T, K>::ValueGeneratorMap<T, K> ( const ValueGeneratorMap<T, K> & b )
 

Definition at line 62 of file valuegenmap.h.

template<classT, classK = string>
ValueGeneratorMap<T, K>::~ValueGeneratorMap<T, K> ( ) [inline]
 

Definition at line 68 of file valuegenmap.h.


Member Function Documentation

template<classT, classK = string>
const_iterator ValueGeneratorMap<T, K>::begin ( ) const [inline]
 

Underlying map's begin().

Definition at line 72 of file valuegenmap.h.

template<classT, classK = string>
iterator ValueGeneratorMap<T, K>::begin ( ) [inline]
 

Underlying map's begin().

Definition at line 71 of file valuegenmap.h.

Referenced by merge().

template<classT, classK = string>
ValueGeneratorMap< T,K >* ValueGeneratorMap<T, K>::clone ( ) const [inline, virtual]
 

Construct and return an identical copy of self.

Definition at line 114 of file valuegenmap.h.

Referenced by merge().

template<classT, classK = string>
const_iterator ValueGeneratorMap<T, K>::end ( ) const [inline]
 

Underlying map's end().

Definition at line 74 of file valuegenmap.h.

template<classT, classK = string>
iterator ValueGeneratorMap<T, K>::end ( ) [inline]
 

Underlying map's end().

Definition at line 73 of file valuegenmap.h.

Referenced by get(), getptr(), merge(), relink(), set(), and set_default().

template<classT, classK>
T ValueGeneratorMap< T,K >::get ( const key_type & k ) const
 

Similar to map's [], but returns actual value (not pointer or ValueGenerator), has a default of zero if not found, and never adds a new entry.

See Roldan Pozo's C++ notes, lecture 4, for how to implement this as operator[] in a way that will still work with const references.

Definition at line 147 of file valuegenmap.h.

Referenced by Retinal_Object::get_var().

template<classT, classK>
T * ValueGeneratorMap< T,K >::getptr ( const key_type & k )
 

Similar to [], but adds a new ValueGenerator if the key is not found rather than adding a null pointer.

Unlike get() this returns a pointer to the actual data, and should thus only be used when absolutely necessary.

Definition at line 157 of file valuegenmap.h.

Referenced by Retinal_Object::get_varptr().

template<classT, classK = string>
pair< iterator,bool > ValueGeneratorMap<T, K>::insert ( const value_type & x ) [inline]
 

Insert into underlying map.

Definition at line 76 of file valuegenmap.h.

Referenced by getptr(), set(), and set_default().

template<classT, classK>
void ValueGeneratorMap< T,K >::merge ( const ValueGeneratorMap< T,K >& b ) [virtual]
 

Incorporate ValueGenerators from another map.

Definition at line 205 of file valuegenmap.h.

Referenced by Retinal_Object::VarMap(), and Retinal_Object::merge_vars().

template<classT, classK>
bool ValueGeneratorMap< T,K >::next ( void ) [virtual]
 

Advance to the next state (whatever that means for this object).

Reimplemented from ValueGen.

Definition at line 170 of file valuegenmap.h.

Referenced by Retinal_Object::next().

template<classT, classK>
void ValueGeneratorMap< T,K >::relink ( const ValueGeneratorMap< T,K >* b ) [virtual]
 

Relink all of the ValueGenerators in this map with those in the given map.

Definition at line 192 of file valuegenmap.h.

Referenced by Retinal_Object::relink().

template<classT, classK>
void ValueGeneratorMap< T,K >::reset ( ) [virtual]
 

Reset to the starting state.

Reimplemented from ValueGen.

Definition at line 183 of file valuegenmap.h.

Referenced by Retinal_Object::reset().

template<classT, classK>
void ValueGeneratorMap< T,K >::set ( const key_type & k,
const data_type d )
 

Instead of directly using the map's [], which has a tricky semantics, or find, which is cumbersome, map access is handled through named get and set member functions.

Definition at line 123 of file valuegenmap.h.

Referenced by merge().

template<classT, classK>
void ValueGeneratorMap< T,K >::set_default ( const key_type & k,
const T d )
 

Set only if not yet set.

Definition at line 136 of file valuegenmap.h.

Referenced by Retinal_Object::set_var_default().


The documentation for this class was generated from the following file:
Generated at Mon Aug 21 00:31:29 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000