casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
casacore::MapRep< key, value > Class Template Referenceabstract

Map representation class. More...

#include <Map.h>

Inheritance diagram for casacore::MapRep< key, value >:
casacore::OrderedMapRep< t, v >

Public Types

enum  { MapRepVersion }
 

Public Member Functions

 MapRep (const value &dflt)
 This is the only MapRep constructor. More...
 
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
 
virtual const valueisDefined (const key &) const =0
 Returns a non-zero value if a mapping is defined for the key parameter. More...
 
virtual valueisDefined (const key &)=0
 
virtual uInt ndefined () const =0
 Returns the number of user defined mappings. More...
 
virtual valuedefine (const key &, const value &)=0
 These functions allow for the definition and removal of key/value relations. More...
 
virtual void remove (const key &)=0
 
virtual void clear ()=0
 Clear all of the mappings. More...
 
virtual MapIterRep< key, value > * getRep (Map< key, value > *) const =0
 
virtual MapRep< key, value > * Clone () const =0
 
virtual ~MapRep ()
 Does nothing. More...
 

Protected Attributes

value DefaultVal
 This is the default value which is return when no match is found. More...
 

Detailed Description

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

Map representation class.

Review Status

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

Definition at line 62 of file Map.h.

Member Enumeration Documentation

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

Definition at line 135 of file Map.h.

Constructor & Destructor Documentation

template<class key, class value>
casacore::MapRep< key, value >::MapRep ( const value dflt)
inline

This is the only MapRep constructor.

It takes as a parameter the default value for the map.

Definition at line 69 of file Map.h.

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

Does nothing.

Member Function Documentation

template<class key, class value>
virtual void casacore::MapRep< key, value >::clear ( )
pure virtual

Clear all of the mappings.

Implemented in casacore::OrderedMapRep< t, v >.

template<class key, class value>
virtual MapRep<key,value>* casacore::MapRep< key, value >::Clone ( ) const
pure virtual
template<class key, class value>
value& casacore::MapRep< key, value >::defaultVal ( )
inline

Returns the default value for the Map.

Definition at line 92 of file Map.h.

References casacore::MapRep< key, value >::DefaultVal.

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

Definition at line 93 of file Map.h.

References casacore::MapRep< key, value >::DefaultVal.

template<class key, class value>
virtual value& casacore::MapRep< key, value >::define ( const key &  ,
const value  
)
pure virtual

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.

Implemented in casacore::OrderedMapRep< t, v >.

template<class key, class value>
virtual MapIterRep<key,value>* casacore::MapRep< key, value >::getRep ( Map< key, value > *  ) const
pure virtual
template<class key, class value>
virtual const value* casacore::MapRep< key, value >::isDefined ( const key &  ) const
pure virtual

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

Implemented in casacore::OrderedMapRep< t, v >.

template<class key, class value>
virtual value* casacore::MapRep< key, value >::isDefined ( const key &  )
pure virtual
template<class key, class value>
virtual uInt casacore::MapRep< key, value >::ndefined ( ) const
pure virtual

Returns the number of user defined mappings.

Implemented in casacore::OrderedMapRep< t, v >.

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

template<class key, class value>
const value& casacore::MapRep< key, value >::operator() ( const key &  ky) const
template<class key, class value>
virtual void casacore::MapRep< key, value >::remove ( const key &  )
pure virtual

Member Data Documentation

template<class key, class value>
value casacore::MapRep< key, value >::DefaultVal
protected

This is the default value which is return when no match is found.

This prevents this class from being a PartialMap.

Definition at line 141 of file Map.h.

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


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