casacore
|
Map with keys ordered. More...
#include <OrderedMap.h>
Public Types | |
enum | { OrderedMapVersion } |
Public Types inherited from casacore::Map< key, value > | |
enum | { MapVersion } |
Public Member Functions | |
OrderedMap (const value &dflt, uInt size) | |
Creates a map with the specified default value, "value", and the internal block size. More... | |
OrderedMap (const value &dflt) | |
Creates a map with the specified default value, "value". More... | |
OrderedMap (const OrderedMap< key, value > &other) | |
Creates a map from another one; use copy semantics. More... | |
~OrderedMap () | |
Does nothing, the destruction is taken care of in the base class, i.e. More... | |
OrderedMap< key, value > & | operator= (const OrderedMap< key, value > &other) |
Assigns this OrderedMap to another with copy semantics. More... | |
uInt | nused () const |
Get the number of mappings. More... | |
uInt | ntot () const |
uInt | incr () const |
Get or set the Block allocation increment. More... | |
uInt | incr (uInt nri) |
Public Member Functions inherited from casacore::Map< key, value > | |
value & | operator() (const key &ky) |
This is the mapping function which maps keys to values. More... | |
const value & | operator() (const key &ky) const |
value & | defaultVal () |
Returns the default value for the Map. More... | |
const value & | defaultVal () const |
const value * | isDefined (const key &k) const |
Returns a non-zero value if a mapping is defined for the key parameter. More... | |
value * | isDefined (const key &k) |
uInt | ndefined () const |
Returns the number of user defined mappings. More... | |
value & | define (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 | |
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 |
Protected Member Functions inherited from casacore::Map< key, value > | |
Map (MapRep< key, value > *nRep) | |
Used by derived classes. More... | |
void | SetRep (MapRep< key, value > *st) |
Used the set the representation. More... | |
Friends | |
class | OrderedMapIterRep< key, value > |
Additional Inherited Members | |
Protected Attributes inherited from casacore::Map< key, value > | |
MapRep< key, value > * | Rep |
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 213 of file OrderedMap.h.
anonymous enum |
Enumerator | |
---|---|
OrderedMapVersion |
Definition at line 289 of file OrderedMap.h.
|
inline |
Creates a map with the specified default value, "value", and the internal block size.
Definition at line 249 of file OrderedMap.h.
|
inlineexplicit |
Creates a map with the specified default value, "value".
Definition at line 254 of file OrderedMap.h.
|
inline |
Creates a map from another one; use copy semantics.
Definition at line 259 of file OrderedMap.h.
casacore::OrderedMap< key, value >::~OrderedMap | ( | ) |
Does nothing, the destruction is taken care of in the base class, i.e.
the letter contains the guts.
|
inlineprotected |
Definition at line 232 of file OrderedMap.h.
References casacore::OrderedMap< key, value >::nused(), casacore::Map< key, value >::Rep, and casacore::OrderedMap< key, value >::throwgetKey().
|
inlineprotected |
Definition at line 238 of file OrderedMap.h.
References casacore::OrderedMap< key, value >::nused(), casacore::Map< key, value >::Rep, and casacore::OrderedMap< key, value >::throwgetKey().
|
inlineprotected |
Definition at line 220 of file OrderedMap.h.
References casacore::OrderedMap< key, value >::nused(), casacore::Map< key, value >::Rep, and casacore::OrderedMap< key, value >::throwgetValue().
|
inlineprotected |
Definition at line 226 of file OrderedMap.h.
References casacore::OrderedMap< key, value >::nused(), casacore::Map< key, value >::Rep, and casacore::OrderedMap< key, value >::throwgetValue().
|
inline |
Get or set the Block allocation increment.
Definition at line 285 of file OrderedMap.h.
References casacore::Map< key, value >::Rep.
|
inline |
Definition at line 286 of file OrderedMap.h.
References casacore::Map< key, value >::Rep.
|
inline |
Definition at line 279 of file OrderedMap.h.
References casacore::Map< key, value >::Rep.
|
inline |
Get the number of mappings.
Definition at line 278 of file OrderedMap.h.
References casacore::Map< key, value >::Rep.
Referenced by casacore::OrderedMap< key, value >::getKey(), and casacore::OrderedMap< key, value >::getVal().
|
inline |
Assigns this OrderedMap to another with copy semantics.
Definition at line 270 of file OrderedMap.h.
References casacore::Map< key, value >::Rep, and casacore::Map< key, value >::SetRep().
|
protected |
Referenced by casacore::OrderedMap< key, value >::getKey().
|
protected |
Referenced by casacore::OrderedMap< key, value >::getVal().
|
friend |
Definition at line 183 of file OrderedMap.h.