casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>

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

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 55 of file Map.h.

Member Enumeration Documentation

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

Definition at line 554 of file Map.h.

Constructor & Destructor Documentation

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).

template<class key, class value>
casacore::ConstMapIter< key, value >::ConstMapIter ( const Map< key, value > &  st)
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).

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

template<class key, class value>
virtual casacore::ConstMapIter< key, value >::~ConstMapIter ( )
virtual
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

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.

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

Returns the container on which this iterator is operating.

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().

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.

template<class key, class value>
virtual const value& casacore::ConstMapIter< key, value >::getVal ( ) const
virtual
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().

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

Returns the number of user defined mappings.

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()().

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

Advance to the next element of the Map.

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

template<class key, class value>
virtual ConstMapIter<key,value>& casacore::ConstMapIter< key, value >::operator= ( const Map< key, value > *  other)
virtual
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 >.

template<class key, class value>
virtual ConstMapIter<key,value>& casacore::ConstMapIter< key, value >::operator= ( const ConstMapIter< key, value > *  other)
virtual
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.

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

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: