Abstract base class for associative arrays. More...
#include <Map.h>
Public Types | |
enum | { MapVersion } |
Public Member Functions | |
value & | operator() (const key &ky) |
This is the mapping function which maps keys to values. | |
const value & | operator() (const key &ky) const |
value & | defaultVal () |
Returns the default value for the Map. | |
const value & | defaultVal () const |
const value * | isDefined (const key &k) const |
Returns a non-zero value if a mapping is defined for the key parameter. | |
value * | isDefined (const key &k) |
uInt | ndefined () const |
Returns the number of user defined mappings. | |
value & | define (const key &k, const value &v) |
These functions allow for the definition and removal of key/value relations. | |
void | remove (const key &k) |
void | clear () |
Clear all of the mappings. | |
MapIterRep< key, value > * | getRep () const |
Returns the iterator rep appropriate for this particular Map. | |
Map (const Map< key, value > &m) | |
This copy constructor will, for the moment, be the only way to create a map. | |
Map (const Map< key, value > *m) | |
Map< key, value > & | operator= (const Map< key, value > &) |
Map< key, value > & | operator= (const Map< key, value > *) |
virtual | ~Map () |
ConstMapIter< key, value > * | getIter () const |
Protected Member Functions | |
Map (MapRep< key, value > *nRep) | |
Used by derived classes. | |
void | SetRep (MapRep< key, value > *st) |
Used the set the representation. | |
Protected Attributes | |
MapRep< key, value > * | Rep |
Abstract base class for associative arrays.
This is the abstract class for all "Map" classes which implement the equivalent of an associative array.
Definition at line 152 of file Map.h.
anonymous enum |
casacore::Map< key, value >::Map | ( | const Map< key, value > & | m | ) |
This copy constructor will, for the moment, be the only way to create a map.
casacore::Map< key, value >::Map | ( | const Map< key, value > * | m | ) |
virtual casacore::Map< key, value >::~Map | ( | ) | [virtual] |
casacore::Map< key, value >::Map | ( | MapRep< key, value > * | nRep | ) | [protected] |
Used by derived classes.
void casacore::Map< key, value >::clear | ( | ) |
Clear all of the mappings.
Referenced by casacore::MSPolnParse::reset().
const value& casacore::Map< key, value >::defaultVal | ( | ) | const |
value& casacore::Map< key, value >::defaultVal | ( | ) |
Returns the default value for the Map.
value& casacore::Map< key, value >::define | ( | const key & | k, | |
const value & | v | |||
) |
These functions allow for the definition and removal of key/value relations.
The "define(key &, value &)" call defines a key/value relation, and "remove(key &)" removes a relation if it has been previously defined.
ConstMapIter<key,value>* casacore::Map< key, value >::getIter | ( | ) | const |
MapIterRep<key,value>* casacore::Map< key, value >::getRep | ( | ) | const |
Returns the iterator rep appropriate for this particular Map.
value* casacore::Map< key, value >::isDefined | ( | const key & | k | ) |
const value* casacore::Map< key, value >::isDefined | ( | const key & | k | ) | const |
Returns a non-zero value if a mapping is defined for the key parameter.
Referenced by casacore::EclecticFunctionFactory< T >::isDefined().
uInt casacore::Map< key, value >::ndefined | ( | ) | const |
Returns the number of user defined mappings.
Referenced by casacore::EclecticFunctionFactory< T >::ndefined().
const value& casacore::Map< key, value >::operator() | ( | const key & | ky | ) | const |
value& casacore::Map< key, value >::operator() | ( | const key & | ky | ) |
This is the mapping function which maps keys to values.
If the map from the key to a value is not defined, a mapping will be defined from the key to the default value (which is set from the constructor. The "isDefined()" member function can be used to check to see if a mapping is defined before using the "operator()()".
Note: With a constant map in the case where the key is not defined, the mapping between key and default value is not created, but rather an exception is thrown;
Map<key,value>& casacore::Map< key, value >::operator= | ( | const Map< key, value > * | ) |
Map<key,value>& casacore::Map< key, value >::operator= | ( | const Map< key, value > & | ) |
Reimplemented in casacore::OrderedMap< key, value >.
void casacore::Map< key, value >::remove | ( | const key & | k | ) |
void casacore::Map< key, value >::SetRep | ( | MapRep< key, value > * | st | ) | [inline, protected] |
Used the set the representation.
Always DELETES Rep if necessary.
Definition at line 254 of file Map.h.
Referenced by casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::operator=().
MapRep<key,value>* casacore::Map< key, value >::Rep [protected] |
Definition at line 243 of file Map.h.
Referenced by casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::getKey(), casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::getVal(), casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::incr(), casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::ntot(), casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::nused(), casacore::OrderedMap< String, OrderedPair< FunctionFactory< T > *, Bool > >::operator=(), and casacore::Map< String, OrderedPair< FunctionFactory< T > *, Bool > >::SetRep().