#include <valuegenmap.h>
Inheritance diagram for ValueGeneratorMap< T, K >:
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 41 of file valuegenmap.h.
Public Types | |
typedef K | key_type |
Key type of our local map. | |
typedef ValueGenerator< T > * | data_type |
Data element type of our local map. | |
typedef std::pair< const key_type, data_type > | value_type |
Element type of our local map. | |
typedef std::map< key_type, data_type > | map_type |
Type of our local map. | |
typedef map_type::iterator | iterator |
Map's iterator. | |
typedef map_type::const_iterator | const_iterator |
Map's iterator. | |
Public Methods | |
ValueGeneratorMap (const ValueGeneratorMap &b) | |
iterator | begin () |
Underlying map's begin(). | |
const_iterator | begin () const |
Underlying map's begin(). | |
iterator | end () |
Underlying map's end(). | |
const_iterator | end () const |
Underlying map's end(). | |
std::pair< iterator, bool > | insert (const value_type &x) |
Insert into underlying map. | |
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. | |
void | set_default (const key_type &k, const T d) |
Set only if not yet set. | |
T | 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. | |
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. | |
const data_type | getvalgenptr (const key_type &k) const |
Deprecated; exposes underlying datatype, e.g. | |
virtual bool | next () |
Advance to the next state (whatever that means for this object). | |
virtual void | reset () |
Reset to the starting state. | |
virtual void | relink (const ValueGeneratorMap< T, K > *b) |
Relink all of the ValueGenerators in this map with those in the given map. | |
virtual void | merge (const ValueGeneratorMap< T, K > &b) |
Incorporate ValueGenerators from another map. | |
virtual ValueGeneratorMap< T, K > * | clone () const |
Construct and return an identical copy of self. |
|
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 152 of file valuegenmap.h. References ValueGeneratorMap< T, K >::const_iterator, and ValueGeneratorMap< T, K >::end(). |
|
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 162 of file valuegenmap.h. References ValueGeneratorMap< T, K >::const_iterator, ValueGeneratorMap< T, K >::end(), ValueGeneratorMap< T, K >::insert(), and ValueGenerator< T >::valueptr(). |
|
Deprecated; exposes underlying datatype, e.g. for debugging Definition at line 175 of file valuegenmap.h. References ValueGeneratorMap< T, K >::const_iterator, and ValueGeneratorMap< T, K >::end(). |