CrystalSpace

Public API Reference

csRedBlackTreeMap< K, T > Class Template Reference
[Containers]

Key-value-map, backed by csRedBlackTree. More...

#include <csutil/redblacktree.h>

Inheritance diagram for csRedBlackTreeMap< K, T >:

List of all members.

Classes

class  ConstIterator
 Const iterator for map. More...
class  ConstReverseIterator
 Const reverse iterator for map. More...
class  Iterator
 Iterator for map. More...
class  ReverseIterator
 Reverse iterator for map. More...

Public Member Functions

bool Delete (const K &key)
 Delete element from map,.
void DeleteAll ()
 Delete all keys.
void Empty ()
 Delete all the keys. (Idiomatic alias for DeleteAll().).
bool IsEmpty () const
 Returns whether this map has no nodes.
T * Put (const K &key, const T &value)
 Add element to map,.

const T * GetElementPointer (const K &key) const
 Get a pointer to the element matching the given key, or 0 if there is none.
T * GetElementPointer (const K &key)
 Get a pointer to the element matching the given key, or 0 if there is none.

const T & Get (const K &key, const T &fallback) const
 Get the element matching the given key, or fallback if there is none.
T & Get (const K &key, T &fallback)
 Get the element matching the given key, or fallback if there is none.

template<typename CB >
void TraverseInOrder (CB &callback) const
 Traverse tree.



class ConstIterator
 Get an iterator for iterating over the entire map.
class Iterator
 Get an iterator for iterating over the entire map.
class ConstReverseIterator
 Get an iterator for iterating over the entire map.
class ReverseIterator
 Get an iterator for iterating over the entire map.
ConstIterator GetIterator () const
 Get an iterator for iterating over the entire map.
Iterator GetIterator ()
 Get an iterator for iterating over the entire map.
ConstReverseIterator GetReverseIterator () const
 Get an iterator for iterating over the entire map.
ReverseIterator GetReverseIterator ()
 Get an iterator for iterating over the entire map.

Detailed Description

template<typename K, typename T>
class csRedBlackTreeMap< K, T >

Key-value-map, backed by csRedBlackTree.

Remarks:
As with csRedBlackTree, every key must be unique.

Definition at line 828 of file redblacktree.h.


Member Function Documentation

template<typename K, typename T>
bool csRedBlackTreeMap< K, T >::Delete ( const K &  key  )  [inline]

Delete element from map,.

Returns:
Whether the deletion was successful. Fails if the key is not in the tree.

Definition at line 860 of file redblacktree.h.

template<typename K, typename T>
void csRedBlackTreeMap< K, T >::DeleteAll (  )  [inline]

Delete all keys.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 903 of file redblacktree.h.

template<typename K, typename T>
void csRedBlackTreeMap< K, T >::Empty (  )  [inline]

Delete all the keys. (Idiomatic alias for DeleteAll().).

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 905 of file redblacktree.h.

template<typename K, typename T>
const T& csRedBlackTreeMap< K, T >::Get ( const K &  key,
const T &  fallback 
) const [inline]

Get the element matching the given key, or fallback if there is none.

Definition at line 889 of file redblacktree.h.

template<typename K, typename T>
T& csRedBlackTreeMap< K, T >::Get ( const K &  key,
T &  fallback 
) [inline]

Get the element matching the given key, or fallback if there is none.

Definition at line 895 of file redblacktree.h.

template<typename K, typename T>
T* csRedBlackTreeMap< K, T >::GetElementPointer ( const K &  key  )  [inline]

Get a pointer to the element matching the given key, or 0 if there is none.

Definition at line 877 of file redblacktree.h.

template<typename K, typename T>
const T* csRedBlackTreeMap< K, T >::GetElementPointer ( const K &  key  )  const [inline]

Get a pointer to the element matching the given key, or 0 if there is none.

Definition at line 871 of file redblacktree.h.

template<typename K, typename T>
Iterator csRedBlackTreeMap< K, T >::GetIterator (  )  [inline]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 1093 of file redblacktree.h.

template<typename K, typename T>
ConstIterator csRedBlackTreeMap< K, T >::GetIterator (  )  const [inline]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 1085 of file redblacktree.h.

template<typename K, typename T>
ConstReverseIterator csRedBlackTreeMap< K, T >::GetReverseIterator (  )  const [inline]

Get an iterator for iterating over the entire map.

Definition at line 1101 of file redblacktree.h.

template<typename K, typename T>
ReverseIterator csRedBlackTreeMap< K, T >::GetReverseIterator (  )  [inline]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 1109 of file redblacktree.h.

template<typename K, typename T>
bool csRedBlackTreeMap< K, T >::IsEmpty (  )  const [inline]

Returns whether this map has no nodes.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 907 of file redblacktree.h.

template<typename K, typename T>
T* csRedBlackTreeMap< K, T >::Put ( const K &  key,
const T &  value 
) [inline]

Add element to map,.

Returns:
A pointer to the copy of the value stored in the tree, or 0 if the key already exists.

Definition at line 849 of file redblacktree.h.

template<typename K, typename T>
template<typename CB >
void csRedBlackTreeMap< K, T >::TraverseInOrder ( CB &  callback  )  const [inline]

Traverse tree.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 912 of file redblacktree.h.


Friends And Related Function Documentation

template<typename K, typename T>
friend class ConstIterator [friend]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 959 of file redblacktree.h.

template<typename K, typename T>
friend class ConstReverseIterator [friend]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 1040 of file redblacktree.h.

template<typename K, typename T>
friend class Iterator [friend]

Get an iterator for iterating over the entire map.

Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T > >.

Definition at line 999 of file redblacktree.h.

template<typename K, typename T>
friend class ReverseIterator [friend]

Get an iterator for iterating over the entire map.

Definition at line 1080 of file redblacktree.h.


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

Generated for Crystal Space 1.4.1 by doxygen 1.7.1