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

Abstract base class for associative arrays. More...

#include <Map.h>

Public Types

enum  { MapVersion }
 

Public Member Functions

valueoperator() (const key &ky)
 This is the mapping function which maps keys to values. More...
 
const valueoperator() (const key &ky) const
 
valuedefaultVal ()
 Returns the default value for the Map. More...
 
const valuedefaultVal () const
 
const valueisDefined (const key &k) const
 Returns a non-zero value if a mapping is defined for the key parameter. More...
 
valueisDefined (const key &k)
 
uInt ndefined () const
 Returns the number of user defined mappings. More...
 
valuedefine (const key &k, const value &v)
 These functions allow for the definition and removal of key/value relations. More...
 
void remove (const key &k)
 
void clear ()
 Clear all of the mappings. More...
 
MapIterRep< key, value > * getRep () const
 Returns the iterator rep appropriate for this particular Map. More...
 
 Map (const Map< key, value > &m)
 This copy constructor will, for the moment, be the only way to create a map. More...
 
 Map (const Map< key, value > *m)
 
Map< key, value > & operator= (const Map< key, value > &)
 
Map< key, value > & operator= (const Map< key, value > *)
 
virtual ~Map ()
 
ConstMapIter< key, value > * getIter () const
 

Protected Member Functions

 Map (MapRep< key, value > *nRep)
 Used by derived classes. More...
 
void SetRep (MapRep< key, value > *st)
 Used the set the representation. More...
 

Protected Attributes

MapRep< key, value > * Rep
 

Detailed Description

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

Abstract base class for associative arrays.

Review Status

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

This is the abstract class for all "Map" classes which implement the equivalent of an associative array.

Definition at line 155 of file Map.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 238 of file Map.h.

Constructor & Destructor Documentation

◆ Map() [1/3]

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

This copy constructor will, for the moment, be the only way to create a map.

◆ Map() [2/3]

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

◆ ~Map()

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

◆ Map() [3/3]

template<class key , class value >
casacore::Map< key, value >::Map ( MapRep< key, value > *  nRep)
protected

Used by derived classes.

Member Function Documentation

◆ clear()

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

Clear all of the mappings.

◆ defaultVal() [1/2]

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

Returns the default value for the Map.

◆ defaultVal() [2/2]

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

◆ define()

template<class key , class value >
value& casacore::Map< key, value >::define ( const key &  k,
const value v 
)

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

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

◆ getIter()

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

◆ getRep()

template<class key , class value >
MapIterRep<key,value>* casacore::Map< key, value >::getRep ( ) const

Returns the iterator rep appropriate for this particular Map.

◆ isDefined() [1/2]

template<class key , class value >
value* casacore::Map< key, value >::isDefined ( const key &  k)

◆ isDefined() [2/2]

template<class key , class value >
const value* casacore::Map< key, value >::isDefined ( const key &  k) const

Returns a non-zero value if a mapping is defined for the key parameter.

◆ ndefined()

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

Returns the number of user defined mappings.

◆ operator()() [1/2]

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

This is the mapping function which maps keys to values.

If the map from the key to a value is not defined, a mapping will be defined from the key to the default value (which is set from the constructor. The "isDefined()" member function can be used to check to see if a mapping is defined before using the "operator()()".


Note: With a constant map in the case where the key is not defined, the mapping between key and default value is not created, but rather an exception is thrown;

◆ operator()() [2/2]

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ remove()

template<class key , class value >
void casacore::Map< key, value >::remove ( const key &  k)

◆ SetRep()

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

Used the set the representation.

Always DELETES Rep if necessary.

Definition at line 257 of file Map.h.

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

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

Member Data Documentation

◆ Rep

template<class key , class value >
MapRep<key,value>* casacore::Map< key, value >::Rep
protected

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