casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
casa::ConstMapIter< key, value > Class Template Reference

Const associative array iterator. More...

#include <Map.h>

Inheritance diagram for casa::ConstMapIter< key, value >:
casa::MapIter< key, value >

List of all members.

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 valuegetVal () 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 valuedefaultVal () 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 valueoperator() (const key &ky) const
 Allows mapping functions to be performed with the map on which this iterator operates.
const valueisDefined (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

Detailed Description

template<class key, class value>
class casa::ConstMapIter< key, value >

Const associative array iterator.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
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.

Definition at line 438 of file Map.h.


Member Enumeration Documentation

template<class key, class value>
anonymous enum
Enumerator:
ConstMapIterVersion 

Definition at line 551 of file Map.h.


Constructor & Destructor Documentation

template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( const Map< key, value > *  st)

Constructs a Map iterator from a Map (with reference semantics).

template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( const Map< key, value > &  st)
template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( const ConstMapIter< key, value > *  st)

Constructs a Map iterator from another iterator (with reference semantics).

template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( const ConstMapIter< key, value > &  st)
template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( ) [inline]

Default constructor creates an invalid Map iterator.

Definition at line 514 of file Map.h.

template<class key, class value>
virtual casa::ConstMapIter< key, value >::~ConstMapIter ( ) [virtual]
template<class key, class value>
casa::ConstMapIter< key, value >::ConstMapIter ( MapIterRep< key, value > *  st) [inline, protected]

Dummy used to initialization by derived classes.

Definition at line 559 of file Map.h.


Member Function Documentation

template<class key, class value>
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.

template<class key, class value>
virtual Bool casa::ConstMapIter< key, value >::atStart ( ) const [virtual]
template<class key, class value>
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 >.

template<class key, class 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 >.

template<class key, class value>
virtual const key& casa::ConstMapIter< key, value >::getKey ( ) const [virtual]

Get the key or value for the current position in the Map.

template<class key, class value>
virtual const value& casa::ConstMapIter< key, value >::getVal ( ) const [virtual]

Reimplemented in casa::MapIter< key, value >.

template<class key, class 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 >.

template<class key, class value>
virtual Bool casa::ConstMapIter< key, value >::isValid ( ) const [virtual]
template<class key, class value>
uInt casa::ConstMapIter< key, value >::ndefined ( ) const

Returns the number of user defined mappings.

template<class key, class value>
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 >.

template<class key, class value>
virtual void casa::ConstMapIter< key, value >::operator++ ( ) [virtual]

Advance to the next element of the Map.

template<class key, class value>
virtual void casa::ConstMapIter< key, value >::operator++ ( int  ) [virtual]
template<class key, class value>
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 >.

template<class key, class value>
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= ( const Map< key, value > *  other) [virtual]

Reimplemented in casa::MapIter< key, value >.

template<class key, class 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 >.

template<class key, class value>
virtual ConstMapIter<key,value>& casa::ConstMapIter< key, value >::operator= ( const ConstMapIter< key, value > *  other) [virtual]

Reimplemented in casa::MapIter< key, value >.

template<class key, class 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.

template<class key, class value>
virtual void casa::ConstMapIter< key, value >::toStart ( ) [virtual]

Move the iterator to the start of the Map.


Member Data Documentation

template<class key, class value>
MapIterRep<key,value>* casa::ConstMapIter< key, value >::Rep [protected]

The documentation for this class was generated from the following file: