casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Protected Attributes
casa::MapRep< key, value > Class Template Reference

Map representation class. More...

#include <Map.h>

Inheritance diagram for casa::MapRep< key, value >:
casa::OrderedMapRep< key, value >

List of all members.

Public Types

enum  { MapRepVersion }

Public Member Functions

 MapRep (const value &dflt)
 This is the only MapRep constructor.
valueoperator() (const key &ky)
 This is the mapping function which maps keys to values.
const valueoperator() (const key &ky) const
valuedefaultVal ()
 Returns the default value for the Map.
const valuedefaultVal () const
virtual const valueisDefined (const key &) const =0
 Returns a non-zero value if a mapping is defined for the key parameter.
virtual valueisDefined (const key &)=0
virtual uInt ndefined () const =0
 Returns the number of user defined mappings.
virtual valuedefine (const key &, const value &)=0
 These functions allow for the definition and removal of key/value relations.
virtual void remove (const key &)=0
virtual void clear ()=0
 Clear all of the mappings.
virtual MapIterRep< key, value > * getRep (Map< key, value > *) const =0
virtual MapRep< key, value > * Clone () const =0
virtual ~MapRep ()
 Does nothing.

Protected Attributes

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

Detailed Description

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

Map representation class.

Review Status

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

Definition at line 59 of file Map.h.


Member Enumeration Documentation

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

Definition at line 132 of file Map.h.


Constructor & Destructor Documentation

template<class key, class value>
casa::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 66 of file Map.h.

template<class key, class value>
virtual casa::MapRep< key, value >::~MapRep ( ) [virtual]

Does nothing.


Member Function Documentation

template<class key, class value>
virtual void casa::MapRep< key, value >::clear ( ) [pure virtual]

Clear all of the mappings.

Implemented in casa::OrderedMapRep< key, value >.

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

Returns the default value for the Map.

Definition at line 89 of file Map.h.

template<class key, class value>
const value& casa::MapRep< key, value >::defaultVal ( ) const [inline]

Definition at line 90 of file Map.h.

template<class key, class value>
virtual value& casa::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 casa::OrderedMapRep< key, value >.

template<class key, class value>
virtual MapIterRep<key,value>* casa::MapRep< key, value >::getRep ( Map< key, value > *  ) const [pure virtual]
template<class key, class value>
virtual const value* casa::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 casa::OrderedMapRep< key, value >.

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

Returns the number of user defined mappings.

Implemented in casa::OrderedMapRep< key, value >.

template<class key, class value>
value& casa::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& casa::MapRep< key, value >::operator() ( const key &  ky) const
template<class key, class value>
virtual void casa::MapRep< key, value >::remove ( const key &  ) [pure virtual]

Member Data Documentation

template<class key, class value>
value casa::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 138 of file Map.h.

Referenced by casa::MapRep< Int, Algorithm * >::defaultVal().


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