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

Associative array iterator. More...

#include <Map.h>

Public Types

enum  { MapIterVersion }
 
- Public Types inherited from casacore::ConstMapIter< key, value >
enum  { ConstMapIterVersion }
 

Public Member Functions

virtual valuegetVal ()
 Return the value at the current location of the map iterator. More...
 
virtual const valuegetVal () const
 
valuedefine (const key &ky, const value &val)
 These functions allow for the definition and removal of key/value relations. More...
 
void remove (const key &ky)
 
const valuedefaultVal () const
 This returns the default value for the map that this iterator is tracking. More...
 
valuedefaultVal ()
 
void clear ()
 Clear all of the mappings. More...
 
const valueoperator() (const key &ky) const
 Allows mapping functions to be performed with the map on which this iterator operates. More...
 
valueoperator() (const key &ky)
 
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...
 
valueisDefined (const key &ky)
 
 MapIter (Map< key, value > *other)
 This allows a MapIter to be constructed from a Map. More...
 
 MapIter (Map< key, value > &st)
 
 MapIter (const MapIter< key, value > &other)
 This allows a MapIter to be constructed from another MapIter. More...
 
 MapIter (const MapIter< key, value > *other)
 
 MapIter ()
 Default constructor creates an invalid Map iterator. More...
 
virtual MapIter< key, value > & operator= (Map< key, value > &other)
 This assignment operator allows the Map which this MapIter tracks to be changed. More...
 
virtual MapIter< key, value > & operator= (Map< key, value > *other)
 
virtual MapIter< key, value > & operator= (const MapIter< key, value > &other)
 This assignment operator allows the Map which this MapIter tracks to be changed. More...
 
virtual MapIter< key, value > & operator= (const MapIter< key, value > *other)
 
Map< key, value > & container ()
 Returns the container on which this iterator is operating. More...
 
const Map< key, value > & container () const
 
 ~MapIter ()
 
- Public Member Functions inherited from casacore::ConstMapIter< key, value >
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 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)
 
 ConstMapIter (const ConstMapIter< key, value > *st)
 Constructs a Map iterator from another iterator (with reference semantics). More...
 
 ConstMapIter (const ConstMapIter< key, value > &st)
 
 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< key, value > & operator= (const Map< key, value > &)
 Assign one map iterator to a map (with reference semantics). More...
 
ConstMapIter< key, value > & operator= (const Map< key, value > *)
 
ConstMapIter< key, value > & operator= (const ConstMapIter< key, value > &)
 Assign one map iterator to another iterator (with reference semantics). More...
 
ConstMapIter< key, value > & operator= (const ConstMapIter< key, value > *)
 
- Protected Member Functions inherited from casacore::ConstMapIter< key, value >
 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...
 

Additional Inherited Members

- Protected Attributes inherited from casacore::ConstMapIter< key, value >
MapIterRep< key, value > * Rep
 

Detailed Description

template<class key, class value>
class casacore::MapIter< key, value >

Associative array iterator.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

This class implements the mechanism for traversing associative arrays, i.e. "Map"s. It provides the traversal mechanisms of the ConstMapIter, but adds the mechansims to modify the values, and perform other modification functions which the Maps provide, e.g. define().

Definition at line 589 of file Map.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 753 of file Map.h.

Constructor & Destructor Documentation

◆ MapIter() [1/5]

template<class key , class value >
casacore::MapIter< key, value >::MapIter ( Map< key, value > *  other)
inline

This allows a MapIter to be constructed from a Map.

When created the new MapIter maintains a reference to the original Map. If the Map to which this MapIter points is deleted, then the MapIter is marked as invalid.

Definition at line 692 of file Map.h.

◆ MapIter() [2/5]

template<class key , class value >
casacore::MapIter< key, value >::MapIter ( Map< key, value > &  st)
inline

Definition at line 694 of file Map.h.

◆ MapIter() [3/5]

template<class key , class value >
casacore::MapIter< key, value >::MapIter ( const MapIter< key, value > &  other)
inline

This allows a MapIter to be constructed from another MapIter.

When created the new MapIter maintains a reference to the Map which the MapIter parameter tracked. If this Map is deleted, then this MapIter is marked as invalid.

Definition at line 704 of file Map.h.

◆ MapIter() [4/5]

template<class key , class value >
casacore::MapIter< key, value >::MapIter ( const MapIter< key, value > *  other)
inline

Definition at line 707 of file Map.h.

◆ MapIter() [5/5]

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

Default constructor creates an invalid Map iterator.

Definition at line 714 of file Map.h.

◆ ~MapIter()

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

Definition at line 751 of file Map.h.

Member Function Documentation

◆ clear()

template<class key , class value >
void casacore::MapIter< key, value >::clear ( )
inline

◆ container() [1/2]

template<class key , class value >
Map<key,value>& casacore::MapIter< key, value >::container ( )
inline

Returns the container on which this iterator is operating.

Definition at line 745 of file Map.h.

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

◆ container() [2/2]

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

Definition at line 747 of file Map.h.

◆ defaultVal() [1/2]

template<class key , class value >
value& casacore::MapIter< key, value >::defaultVal ( )
inline

◆ defaultVal() [2/2]

template<class key , class value >
const value& casacore::MapIter< key, value >::defaultVal ( ) const
inline

This returns the default value for the map that this iterator is tracking.

With a non-const iterator the default value can be changed.

Definition at line 628 of file Map.h.

References casacore::ConstMapIter< key, value >::defaultVal().

◆ define()

template<class key , class value >
value& casacore::MapIter< key, value >::define ( const key &  ky,
const value val 
)
inline

These functions allow for the definition and removal of key/value relations.

The "define(key &, value &)" function defines a key/value relation, and "remove(key &)" function removes a relation if it has been previously defined.

Definition at line 610 of file Map.h.

References casacore::ConstMapIter< key, value >::isValid(), casacore::ConstMapIter< key, value >::Rep, and casacore::throw_invalid_mapiter_error().

◆ getVal() [1/2]

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

Return the value at the current location of the map iterator.

Should throw an exception if the iterator is "past the end of the Map" or if the iterator is invalid.

◆ getVal() [2/2]

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

◆ isDefined() [1/2]

template<class key , class value >
value* casacore::MapIter< key, value >::isDefined ( const key &  ky)
inline

◆ isDefined() [2/2]

template<class key , class value >
const value* casacore::MapIter< key, value >::isDefined ( const key &  ky) const
inline

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. With a non-const iterator the returned pointer can be used to change the value in the map.

Definition at line 674 of file Map.h.

References casacore::ConstMapIter< key, value >::isDefined().

◆ operator()() [1/2]

template<class key , class value >
value& casacore::MapIter< key, value >::operator() ( const key &  ky)
inline

◆ operator()() [2/2]

template<class key , class value >
const value& casacore::MapIter< key, value >::operator() ( const key &  ky) const
inline

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. With a non-const operator, the value can be changed.

Definition at line 655 of file Map.h.

References casacore::ConstMapIter< key, value >::operator()().

◆ operator=() [1/8]

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

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

Reimplemented from casacore::ConstMapIter< key, value >.

Definition at line 769 of file Map.h.

References casacore::throw_mapiter_init_error().

◆ operator=() [2/8]

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

Reimplemented from casacore::ConstMapIter< key, value >.

Definition at line 772 of file Map.h.

References casacore::throw_mapiter_init_error().

◆ operator=() [3/8]

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

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

Reimplemented from casacore::ConstMapIter< key, value >.

Definition at line 763 of file Map.h.

References casacore::throw_mapiter_init_error().

◆ operator=() [4/8]

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

Reimplemented from casacore::ConstMapIter< key, value >.

Definition at line 766 of file Map.h.

References casacore::throw_mapiter_init_error().

◆ operator=() [5/8]

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

This assignment operator allows the Map which this MapIter tracks to be changed.

After a call to this operator, this MapIter will track the Map which the MapIter parameter trackes, i.e. it will contain a reference to this new Map.

◆ operator=() [6/8]

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

◆ operator=() [7/8]

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

This assignment operator allows the Map which this MapIter tracks to be changed.

After a call to this operator, the MapIter will track the Map parameter.

◆ operator=() [8/8]

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

◆ remove()

template<class key , class value >
void casacore::MapIter< key, value >::remove ( const key &  ky)
inline

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