casa
$Rev:20696$
|
Const associative array iterator. More...
#include <Map.h>
Public Types | |
enum | { ConstMapIterVersion } |
Public Member Functions | |
virtual void | toStart () |
Move the iterator to the start of the Map. | |
virtual void | operator++ () |
Advance to the next element of the Map. | |
virtual void | operator++ (int) |
virtual const key & | getKey () const |
Get the key or value for the current position in the Map. | |
virtual const value & | getVal () const |
virtual Bool | atEnd () const |
Check to see if the iterator position is at the end or beginning of the Map. | |
virtual Bool | atStart () const |
virtual Bool | isValid () const |
Check to see if the iterator is in a valid state. | |
ConstMapIter (const Map< key, value > *st) | |
Constructs a Map iterator from a Map (with reference semantics). | |
ConstMapIter (const Map< key, value > &st) | |
virtual ConstMapIter< key, value > & | operator= (const Map< key, value > &other) |
Assign one map iterator to a map (with reference semantics). | |
virtual ConstMapIter< key, value > & | operator= (const Map< key, value > *other) |
ConstMapIter (const ConstMapIter< key, value > *st) | |
Constructs a Map iterator from another iterator (with reference semantics). | |
ConstMapIter (const ConstMapIter< key, value > &st) | |
virtual ConstMapIter< key, value > & | operator= (const ConstMapIter< key, value > &other) |
Assign one map iterator to another iterator (with reference semantics). | |
virtual ConstMapIter< key, value > & | operator= (const ConstMapIter< key, value > *other) |
ConstMapIter () | |
Default constructor creates an invalid Map iterator. | |
const value & | defaultVal () const |
Returns the default value for the Map on which this iterator is operating if it is a valid iterator, otherwise it throws an exception. | |
const value & | operator() (const key &ky) const |
Allows mapping functions to be performed with the map on which this iterator operates. | |
const value * | isDefined (const key &ky) const |
Allows one to check to see if a given key is defined in the map which this iterator tracks. | |
uInt | ndefined () const |
Returns the number of user defined mappings. | |
const Map< key, value > & | container () const |
Returns the container on which this iterator is operating. | |
virtual | ~ConstMapIter () |
Protected Member Functions | |
ConstMapIter (MapIterRep< key, value > *st) | |
Dummy used to initialization by derived classes. | |
void | SetRep (MapIterRep< key, value > *st) |
Always DELETES Rep if necessary. | |
Protected Attributes | |
MapIterRep< key, value > * | Rep |
Const associative array iterator.
This class implements the mechanism for traversing constant associative arrays, i.e. "Map"s. This allows one to move the cursor to the beginning of the map and serially traverse the map. The key and value elements can be extracted at each position in the Map. For example: <code> template<class key,class value> void print(const Map<key,value> &xx){ ConstMapIter<key,value> x(xx); x.toStart(); while (!x.atEnd()) { cout << "(" << x.getKey() << "," << x.getVal() << ")" << " "; x++; } cout << endl; } </code> This example declares a templated function which accepts a const Map as a parameter, and iterates through the map displaying the key/value pairs at each positon.
anonymous enum |
casa::ConstMapIter< key, value >::ConstMapIter | ( | const Map< key, value > * | st | ) |
casa::ConstMapIter< key, value >::ConstMapIter | ( | const Map< key, value > & | st | ) |
casa::ConstMapIter< key, value >::ConstMapIter | ( | const ConstMapIter< key, value > * | st | ) |
Constructs a Map iterator from another iterator (with reference semantics).
casa::ConstMapIter< key, value >::ConstMapIter | ( | const ConstMapIter< key, value > & | st | ) |
casa::ConstMapIter< key, value >::ConstMapIter | ( | ) | [inline] |
virtual casa::ConstMapIter< key, value >::~ConstMapIter | ( | ) | [virtual] |
casa::ConstMapIter< key, value >::ConstMapIter | ( | MapIterRep< key, value > * | st | ) | [inline, protected] |
virtual Bool casa::ConstMapIter< key, value >::atEnd | ( | ) | const [virtual] |
Check to see if the iterator position is at the end or beginning of the Map.
virtual Bool casa::ConstMapIter< key, value >::atStart | ( | ) | const [virtual] |
const Map<key,value>& casa::ConstMapIter< key, value >::container | ( | ) | const |
Returns the container on which this iterator is operating.
Reimplemented in casa::MapIter< key, value >.
const value& casa::ConstMapIter< key, value >::defaultVal | ( | ) | const |
Returns the default value for the Map on which this iterator is operating if it is a valid iterator, otherwise it throws an exception.
Reimplemented in casa::MapIter< key, value >.
virtual const key& casa::ConstMapIter< key, value >::getKey | ( | ) | const [virtual] |
Get the key or value for the current position in the Map.
virtual const value& casa::ConstMapIter< key, value >::getVal | ( | ) | const [virtual] |
Reimplemented in casa::MapIter< key, value >.
const value* casa::ConstMapIter< key, value >::isDefined | ( | const key & | ky | ) | const |
Allows one to check to see if a given key is defined in the map which this iterator tracks.
If this iterator is invalid, then an exception will be thrown.
Reimplemented in casa::MapIter< key, value >.
virtual Bool casa::ConstMapIter< key, value >::isValid | ( | ) | const [virtual] |
Check to see if the iterator is in a valid state.
Referenced by casa::MapIter< key, value >::clear(), casa::MapIter< key, value >::defaultVal(), casa::MapIter< key, value >::define(), casa::MapIter< key, value >::isDefined(), casa::MapIter< key, value >::operator()(), and casa::MapIter< key, value >::remove().
uInt casa::ConstMapIter< key, value >::ndefined | ( | ) | const |
Returns the number of user defined mappings.
const value& casa::ConstMapIter< key, value >::operator() | ( | const key & | ky | ) | const |
Allows mapping functions to be performed with the map on which this iterator operates.
If this iterator is invalid, then an exception will be thrown.
Reimplemented in casa::MapIter< key, value >.
virtual void casa::ConstMapIter< key, value >::operator++ | ( | ) | [virtual] |
Advance to the next element of the Map.
virtual void casa::ConstMapIter< key, value >::operator++ | ( | int | ) | [virtual] |
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= | ( | const Map< key, value > & | other | ) | [virtual] |
Assign one map iterator to a map (with reference semantics).
Reimplemented in casa::MapIter< key, value >.
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= | ( | const Map< key, value > * | other | ) | [virtual] |
Reimplemented in casa::MapIter< key, value >.
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= | ( | const ConstMapIter< key, value > & | other | ) | [virtual] |
Assign one map iterator to another iterator (with reference semantics).
Reimplemented in casa::MapIter< key, value >.
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= | ( | const ConstMapIter< key, value > * | other | ) | [virtual] |
Reimplemented in casa::MapIter< key, value >.
void casa::ConstMapIter< key, value >::SetRep | ( | MapIterRep< key, value > * | st | ) | [inline, protected] |
Always DELETES Rep if necessary.
Definition at line 564 of file Map.h.
References casa::ConstMapIter< key, value >::Rep.
virtual void casa::ConstMapIter< key, value >::toStart | ( | ) | [virtual] |
Move the iterator to the start of the Map.
MapIterRep<key,value>* casa::ConstMapIter< key, value >::Rep [protected] |
Definition at line 554 of file Map.h.
Referenced by casa::MapIter< key, value >::clear(), casa::MapIter< key, value >::container(), casa::MapIter< key, value >::defaultVal(), casa::MapIter< key, value >::define(), casa::MapIter< key, value >::isDefined(), casa::MapIter< key, value >::operator()(), casa::MapIter< key, value >::remove(), and casa::ConstMapIter< key, value >::SetRep().