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

Map with keys ordered. More...

#include <OrderedMap.h>

Inheritance diagram for casa::OrderedMap< key, value >:
casa::Map< key, value >

List of all members.

Public Types

enum  { OrderedMapVersion }
 
   
More...

Public Member Functions

 OrderedMap (const value &dflt, uInt size)
 Creates a map with the specified default value, "value", and the internal block size.
 OrderedMap (const value &dflt)
 Creates a map with the specified default value, "value".
 OrderedMap (const OrderedMap< key, value > &other)
 Creates a map from another one; use copy semantics.
 ~OrderedMap ()
 Does nothing, the destruction is taken care of in the base class, i.e.
OrderedMap< key, value > & operator= (const OrderedMap< key, value > &other)
 Assigns this OrderedMap to another with copy semantics.
uInt nused () const
 Get the number of mappings.
uInt ntot () const
uInt incr () const
 Get or set the Block allocation increment.
uInt incr (uInt nri)

Protected Member Functions

void throwgetKey (uInt) const
void throwgetValue (uInt) const
valuegetVal (uInt inx)
const valuegetVal (uInt inx) const
key & getKey (uInt inx)
const key & getKey (uInt inx) const

Friends

class OrderedMapIterRep< key, value >

Detailed Description

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

Map with keys ordered.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
OrderedMap<key,value> is a template class derived from Map.
It is similar to ListMap, but the keys are kept in order and
they have to be unique.

It uses a Block to store an array of pointers to the keys and
the associated values.
The keys and values themselves are stored on the heap.
The keys are kept in order to allow a binary search through
the keys for rapid access.

This is one (simple) implementation of an ordered map.
It is not suitable for large arrays of keys, since the overhead
of keeping the keys in order would get too big.
For large arrays a red-black tree implementation would be better.

Exceptions are raised when new[] is failing, when the next()
getKey() or getValue() function is failing or when a duplicate key
is defined.

The AipsIO >> and << operators are defined in <aips/OrdMapIO.h>.

Definition at line 209 of file OrderedMap.h.


Member Enumeration Documentation

template<class key, class value>
anonymous enum

   

Enumerator:
OrderedMapVersion 

Definition at line 285 of file OrderedMap.h.


Constructor & Destructor Documentation

template<class key, class value>
casa::OrderedMap< key, value >::OrderedMap ( const value dflt,
uInt  size 
) [inline]

Creates a map with the specified default value, "value", and the internal block size.

Definition at line 245 of file OrderedMap.h.

template<class key, class value>
casa::OrderedMap< key, value >::OrderedMap ( const value dflt) [inline, explicit]

Creates a map with the specified default value, "value".

Definition at line 250 of file OrderedMap.h.

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

Creates a map from another one; use copy semantics.

Definition at line 255 of file OrderedMap.h.

template<class key, class value>
casa::OrderedMap< key, value >::~OrderedMap ( )

Does nothing, the destruction is taken care of in the base class, i.e.

the letter contains the guts.


Member Function Documentation

template<class key, class value>
key& casa::OrderedMap< key, value >::getKey ( uInt  inx) [inline, protected]

Definition at line 228 of file OrderedMap.h.

template<class key, class value>
const key& casa::OrderedMap< key, value >::getKey ( uInt  inx) const [inline, protected]

Definition at line 234 of file OrderedMap.h.

template<class key, class value>
value& casa::OrderedMap< key, value >::getVal ( uInt  inx) [inline, protected]

Definition at line 216 of file OrderedMap.h.

template<class key, class value>
const value& casa::OrderedMap< key, value >::getVal ( uInt  inx) const [inline, protected]

Definition at line 222 of file OrderedMap.h.

template<class key, class value>
uInt casa::OrderedMap< key, value >::incr ( ) const [inline]

Get or set the Block allocation increment.

Definition at line 281 of file OrderedMap.h.

template<class key, class value>
uInt casa::OrderedMap< key, value >::incr ( uInt  nri) [inline]

Definition at line 282 of file OrderedMap.h.

template<class key, class value>
uInt casa::OrderedMap< key, value >::ntot ( ) const [inline]

Definition at line 275 of file OrderedMap.h.

template<class key, class value>
uInt casa::OrderedMap< key, value >::nused ( ) const [inline]

Get the number of mappings.

Definition at line 274 of file OrderedMap.h.

Referenced by casa::OrderedMap< Int, Algorithm * >::getKey(), and casa::OrderedMap< Int, Algorithm * >::getVal().

template<class key, class value>
OrderedMap<key,value>& casa::OrderedMap< key, value >::operator= ( const OrderedMap< key, value > &  other) [inline]

Assigns this OrderedMap to another with copy semantics.

Definition at line 266 of file OrderedMap.h.

template<class key, class value>
void casa::OrderedMap< key, value >::throwgetKey ( uInt  ) const [protected]
template<class key, class value>
void casa::OrderedMap< key, value >::throwgetValue ( uInt  ) const [protected]

Friends And Related Function Documentation

template<class key, class value>
friend class OrderedMapIterRep< key, value > [friend]

Definition at line 210 of file OrderedMap.h.


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