casa
$Rev:20696$
|
Map representation class. More...
#include <Map.h>
Public Types | |
enum | { MapRepVersion } |
Public Member Functions | |
MapRep (const value &dflt) | |
This is the only MapRep constructor. | |
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 |
virtual const value * | isDefined (const key &) const =0 |
Returns a non-zero value if a mapping is defined for the key parameter. | |
virtual value * | isDefined (const key &)=0 |
virtual uInt | ndefined () const =0 |
Returns the number of user defined mappings. | |
virtual value & | define (const key &, const value &)=0 |
These functions allow for the definition and removal of key/value relations. | |
virtual void | remove (const key &)=0 |
virtual void | clear ()=0 |
Clear all of the mappings. | |
virtual MapIterRep< key, value > * | getRep (Map< key, value > *) const =0 |
virtual MapRep< key, value > * | Clone () const =0 |
virtual | ~MapRep () |
Does nothing. | |
Protected Attributes | |
value | DefaultVal |
This is the default value which is return when no match is found. |
Map representation class.
anonymous enum |
casa::MapRep< key, value >::MapRep | ( | const value & | dflt | ) | [inline] |
virtual casa::MapRep< key, value >::~MapRep | ( | ) | [virtual] |
Does nothing.
virtual void casa::MapRep< key, value >::clear | ( | ) | [pure virtual] |
Clear all of the mappings.
Implemented in casa::OrderedMapRep< key, value >.
virtual MapRep<key,value>* casa::MapRep< key, value >::Clone | ( | ) | const [pure virtual] |
Implemented in casa::OrderedMapRep< key, value >.
value& casa::MapRep< key, value >::defaultVal | ( | ) | [inline] |
const value& casa::MapRep< key, value >::defaultVal | ( | ) | const [inline] |
virtual value& casa::MapRep< key, value >::define | ( | const key & | , |
const value & | |||
) | [pure virtual] |
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.
Implemented in casa::OrderedMapRep< key, value >.
virtual MapIterRep<key,value>* casa::MapRep< key, value >::getRep | ( | Map< key, value > * | ) | const [pure virtual] |
Implemented in casa::OrderedMapRep< key, value >.
virtual const value* casa::MapRep< key, value >::isDefined | ( | const key & | ) | const [pure virtual] |
Returns a non-zero value if a mapping is defined for the key parameter.
Implemented in casa::OrderedMapRep< key, value >.
virtual value* casa::MapRep< key, value >::isDefined | ( | const key & | ) | [pure virtual] |
Implemented in casa::OrderedMapRep< key, value >.
virtual uInt casa::MapRep< key, value >::ndefined | ( | ) | const [pure virtual] |
Returns the number of user defined mappings.
Implemented in casa::OrderedMapRep< key, value >.
value& casa::MapRep< 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;
const value& casa::MapRep< key, value >::operator() | ( | const key & | ky | ) | const |
virtual void casa::MapRep< key, value >::remove | ( | const key & | ) | [pure virtual] |
Implemented in casa::OrderedMapRep< key, value >.
value casa::MapRep< key, value >::DefaultVal [protected] |
This is the default value which is return when no match is found.
This prevents this class from being a PartialMap.
Definition at line 138 of file Map.h.
Referenced by casa::MapRep< Int, Algorithm * >::defaultVal().