casacore
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
casacore::ConstMapIter< key, value > Class Template Reference

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. More...
 
virtual void operator++ ()
 Advance to the next element of the Map. More...
 
virtual void operator++ (int)
 
virtual const key & getKey () const
 Get the key or value for the current position in the Map. More...
 
virtual const valuegetVal () const
 
virtual Bool atEnd () const
 Check to see if the iterator position is at the end or beginning of the Map. More...
 
virtual Bool atStart () const
 
virtual Bool isValid () const
 Check to see if the iterator is in a valid state. More...
 
 ConstMapIter (const Map< key, value > *st)
 Constructs a Map iterator from a Map (with reference semantics). More...
 
 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). More...
 
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). More...
 
 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). More...
 
virtual ConstMapIter< key, value > & operator= (const ConstMapIter< key, value > *other)
 
 ConstMapIter ()
 Default constructor creates an invalid Map iterator. More...
 
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. More...
 
const valueoperator() (const key &ky) const
 Allows mapping functions to be performed with the map on which this iterator operates. More...
 
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. More...
 
uInt ndefined () const
 Returns the number of user defined mappings. More...
 
const Map< key, value > & container () const
 Returns the container on which this iterator is operating. More...
 
virtual ~ConstMapIter ()
 

Protected Member Functions

 ConstMapIter (MapIterRep< key, value > *st)
 Dummy used to initialization by derived classes. More...
 
void SetRep (MapIterRep< key, value > *st)
 Always DELETES Rep if necessary. More...
 

Protected Attributes

MapIterRep< key, value > * Rep
 

Detailed Description

template<class key, class value>
class casacore::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: 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; } 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 441 of file Map.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 554 of file Map.h.

Constructor & Destructor Documentation

◆ ConstMapIter() [1/6]

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

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

◆ ConstMapIter() [2/6]

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

◆ ConstMapIter() [3/6]

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

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

◆ ConstMapIter() [4/6]

template<class key , class value >
casacore::ConstMapIter< key, value >::ConstMapIter ( const ConstMapIter< key, value > &  st)

◆ ConstMapIter() [5/6]

template<class key , class value >
casacore::ConstMapIter< key, value >::ConstMapIter ( )
inline

Default constructor creates an invalid Map iterator.

Definition at line 517 of file Map.h.

◆ ~ConstMapIter()

template<class key , class value >
virtual casacore::ConstMapIter< key, value >::~ConstMapIter ( )
virtual

◆ ConstMapIter() [6/6]

template<class key , class value >
casacore::ConstMapIter< key, value >::ConstMapIter ( MapIterRep< key, value > *  st)
inlineprotected

Dummy used to initialization by derived classes.

Definition at line 562 of file Map.h.

Member Function Documentation

◆ atEnd()

template<class key , class value >
virtual Bool casacore::ConstMapIter< key, value >::atEnd ( ) const
virtual

Check to see if the iterator position is at the end or beginning of the Map.

◆ atStart()

template<class key , class value >
virtual Bool casacore::ConstMapIter< key, value >::atStart ( ) const
virtual

◆ container()

template<class key , class value >
const Map<key,value>& casacore::ConstMapIter< key, value >::container ( ) const

Returns the container on which this iterator is operating.

◆ defaultVal()

template<class key , class value >
const value& casacore::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.

Referenced by casacore::MapIter< key, value >::defaultVal().

◆ getKey()

template<class key , class value >
virtual const key& casacore::ConstMapIter< key, value >::getKey ( ) const
virtual

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

◆ getVal()

template<class key , class value >
virtual const value& casacore::ConstMapIter< key, value >::getVal ( ) const
virtual

◆ isDefined()

template<class key , class value >
const value* casacore::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.

Referenced by casacore::MapIter< key, value >::isDefined().

◆ isValid()

template<class key , class value >
virtual Bool casacore::ConstMapIter< key, value >::isValid ( ) const
virtual

◆ ndefined()

template<class key , class value >
uInt casacore::ConstMapIter< key, value >::ndefined ( ) const

Returns the number of user defined mappings.

◆ operator()()

template<class key , class value >
const value& casacore::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.

Referenced by casacore::MapIter< key, value >::operator()().

◆ operator++() [1/2]

template<class key , class value >
virtual void casacore::ConstMapIter< key, value >::operator++ ( )
virtual

Advance to the next element of the Map.

◆ operator++() [2/2]

template<class key , class value >
virtual void casacore::ConstMapIter< key, value >::operator++ ( int  )
virtual

◆ operator=() [1/4]

template<class key , class value >
virtual ConstMapIter<key,value>& casacore::ConstMapIter< key, value >::operator= ( const ConstMapIter< key, value > &  other)
virtual

Assign one map iterator to another iterator (with reference semantics).

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

◆ operator=() [2/4]

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

◆ operator=() [3/4]

template<class key , class value >
virtual ConstMapIter<key,value>& casacore::ConstMapIter< key, value >::operator= ( const Map< key, value > &  other)
virtual

Assign one map iterator to a map (with reference semantics).

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

◆ operator=() [4/4]

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

◆ SetRep()

template<class key , class value >
void casacore::ConstMapIter< key, value >::SetRep ( MapIterRep< key, value > *  st)
inlineprotected

Always DELETES Rep if necessary.

Definition at line 567 of file Map.h.

References casacore::ConstMapIter< key, value >::Rep.

◆ toStart()

template<class key , class value >
virtual void casacore::ConstMapIter< key, value >::toStart ( )
virtual

Move the iterator to the start of the Map.

Member Data Documentation

◆ Rep

template<class key , class value >
MapIterRep<key,value>* casacore::ConstMapIter< key, value >::Rep
protected

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