Simple Application Framework
1
|
Ordered associative container. More...
#include <TreeMap.h>
Public Types | |
typedef BaseType::ConstIterator | ConstIterator |
typedef BaseType::Iterator | Iterator |
Public Member Functions | |
TreeMap () | |
Constructor. | |
TreeMap (const MyType &m) | |
Copy constructor. | |
ValType & | At (const KeyType &key) |
Get a reference to the value corresponding to a given key. | |
const ValType & | At (const KeyType &key) const |
Get a reference to the value corresponding to a given key. | |
MyType & | operator= (const MyType &m) |
Assignment operator. | |
ValType & | operator[] (const KeyType &key) |
Operator returning the reference to the value corresponding to a given key. | |
MyType & | Swap (MyType &m) |
Swap the content of two tree maps. | |
Iterator | Update (const KeyType &key, const ValType &val) |
Update the value corresponding to a given key. | |
Protected Types | |
typedef Algo::Struct::RedBlackTree < KeyType, RecType, Algo::Selector::FirstMember < RecType >, CompType > | BaseType |
typedef TreeMap< KeyType, ValType, CompType > | MyType |
typedef Pair< const KeyType, ValType > | RecType |
Ordered associative container.
This class implements an associative container where keys map to values. Internally, the data is stored in a sorted order in a red/black tree enabling insert, erase and look-up of the values in guaranteed logarithmic time.
Iterator category: Bidirectional.
KeyType | Key data type. Each key can appear only once in the map. |
ValType | Data type of the mapped values. |
CompType | A binary comparison predicate inducing a strict weak ordering on KeyType values. |
typedef Algo::Struct::RedBlackTree<KeyType,RecType,Algo::Selector::FirstMember<RecType>,CompType> Saf::Collection::TreeMap< KeyType, ValType, CompType >::BaseType [protected] |
typedef BaseType::ConstIterator Saf::Collection::TreeMap< KeyType, ValType, CompType >::ConstIterator |
typedef BaseType::Iterator Saf::Collection::TreeMap< KeyType, ValType, CompType >::Iterator |
typedef TreeMap<KeyType,ValType,CompType> Saf::Collection::TreeMap< KeyType, ValType, CompType >::MyType [protected] |
typedef Pair<const KeyType,ValType> Saf::Collection::TreeMap< KeyType, ValType, CompType >::RecType [protected] |
Saf::Collection::TreeMap< KeyType, ValType, CompType >::TreeMap | ( | ) | [inline] |
Constructor.
Saf::Collection::TreeMap< KeyType, ValType, CompType >::TreeMap | ( | const MyType & | m | ) | [inline] |
Copy constructor.
ValType& Saf::Collection::TreeMap< KeyType, ValType, CompType >::At | ( | const KeyType & | key | ) | [inline] |
Get a reference to the value corresponding to a given key.
If the key does not exist in the TreeMap then an IndexOutOfRangeException is thrown.
const ValType& Saf::Collection::TreeMap< KeyType, ValType, CompType >::At | ( | const KeyType & | key | ) | const [inline] |
Get a reference to the value corresponding to a given key.
If the key does not exist in the TreeMap then an IndexOutOfRangeException is thrown.
MyType& Saf::Collection::TreeMap< KeyType, ValType, CompType >::operator= | ( | const MyType & | m | ) | [inline] |
Assignment operator.
ValType& Saf::Collection::TreeMap< KeyType, ValType, CompType >::operator[] | ( | const KeyType & | key | ) | [inline] |
Operator returning the reference to the value corresponding to a given key.
If the key does not exist in the TreeMap then it is created and the corresponding value is initialized using a default constructor.
MyType& Saf::Collection::TreeMap< KeyType, ValType, CompType >::Swap | ( | MyType & | m | ) | [inline] |
Swap the content of two tree maps.
Properties:
Iterator Saf::Collection::TreeMap< KeyType, ValType, CompType >::Update | ( | const KeyType & | key, |
const ValType & | val | ||
) | [inline] |