casa
$Rev:20696$
|
Map with keys ordered. More...
#include <OrderedMap.h>
Public Types | |
enum | { OrderedMapVersion } |
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 |
value & | getVal (uInt inx) |
const value & | getVal (uInt inx) const |
key & | getKey (uInt inx) |
const key & | getKey (uInt inx) const |
Friends | |
class | OrderedMapIterRep< key, value > |
Map with keys ordered.
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.
anonymous enum |
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.
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.
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.
casa::OrderedMap< key, value >::~OrderedMap | ( | ) |
Does nothing, the destruction is taken care of in the base class, i.e.
the letter contains the guts.
key& casa::OrderedMap< key, value >::getKey | ( | uInt | inx | ) | [inline, protected] |
Definition at line 228 of file OrderedMap.h.
const key& casa::OrderedMap< key, value >::getKey | ( | uInt | inx | ) | const [inline, protected] |
Definition at line 234 of file OrderedMap.h.
value& casa::OrderedMap< key, value >::getVal | ( | uInt | inx | ) | [inline, protected] |
Definition at line 216 of file OrderedMap.h.
const value& casa::OrderedMap< key, value >::getVal | ( | uInt | inx | ) | const [inline, protected] |
Definition at line 222 of file OrderedMap.h.
uInt casa::OrderedMap< key, value >::incr | ( | ) | const [inline] |
Get or set the Block allocation increment.
Definition at line 281 of file OrderedMap.h.
uInt casa::OrderedMap< key, value >::incr | ( | uInt | nri | ) | [inline] |
Definition at line 282 of file OrderedMap.h.
uInt casa::OrderedMap< key, value >::ntot | ( | ) | const [inline] |
Definition at line 275 of file OrderedMap.h.
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().
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.
void casa::OrderedMap< key, value >::throwgetKey | ( | uInt | ) | const [protected] |
Referenced by casa::OrderedMap< Int, Algorithm * >::getKey().
void casa::OrderedMap< key, value >::throwgetValue | ( | uInt | ) | const [protected] |
Referenced by casa::OrderedMap< Int, Algorithm * >::getVal().
friend class OrderedMapIterRep< key, value > [friend] |
Definition at line 210 of file OrderedMap.h.