csRedBlackTreeMap< K, T, Allocator, Ordering > Class Template Reference
[Containers]
Key-value-map, backed by csRedBlackTree. More...
#include <csutil/redblacktree.h>
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 | |
void | Delete (Iterator &it) |
Delete the 'next' element pointed at by the iterator. | |
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,. | |
| |
class | ConstIterator |
Get the element matching the given key, or fallback if there is none. | |
class | ConstReverseIterator |
Get the element matching the given key, or fallback if there is none. | |
class | Iterator |
Get the element matching the given key, or fallback if there is none. | |
class | ReverseIterator |
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. | |
const T & | Get (const K &key, const T &fallback) const |
Get the element matching the given key, or fallback if there is none. | |
T * | GetElementPointer (const K &key) |
Get the element matching the given key, or fallback if there is none. | |
const T * | GetElementPointer (const K &key) const |
Get a pointer to the element matching the given key, or 0 if there is none. | |
Iterator | GetIterator () |
Get an iterator for iterating over the entire map. | |
ConstIterator | GetIterator () const |
Get an iterator for iterating over the entire map. | |
ReverseIterator | GetReverseIterator () |
Get an iterator for iterating over the entire map. | |
ConstReverseIterator | GetReverseIterator () const |
Get an iterator for iterating over the entire map. | |
template<typename CB > | |
void | TraverseInOrder (CB &callback) const |
Traverse tree. |
Detailed Description
template<typename K, typename T, typename Allocator = csFixedSizeAllocator< sizeof(CS::Container::RedBlackTreeNode< csRedBlackTreePayload<K, T> >)>, template< typename K1, typename K2 > class Ordering = CS::Container::RedBlackTreeOrderingTotal>
class csRedBlackTreeMap< K, T, Allocator, Ordering >
Key-value-map, backed by csRedBlackTree.
- Remarks:
- As with csRedBlackTree, every key must be unique.
Definition at line 1129 of file redblacktree.h.
Member Function Documentation
void csRedBlackTreeMap< K, T, Allocator, Ordering >::Delete | ( | Iterator & | it | ) | [inline] |
Delete the 'next' element pointed at by the iterator.
- Remarks:
- Will repoint the iterator to the following element.
Definition at line 1461 of file redblacktree.h.
bool csRedBlackTreeMap< K, T, Allocator, Ordering >::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 1166 of file redblacktree.h.
void csRedBlackTreeMap< K, T, Allocator, Ordering >::DeleteAll | ( | ) | [inline] |
Delete all keys.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1209 of file redblacktree.h.
void csRedBlackTreeMap< K, T, Allocator, Ordering >::Empty | ( | ) | [inline] |
Delete all the keys. (Idiomatic alias for DeleteAll().).
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1211 of file redblacktree.h.
T& csRedBlackTreeMap< K, T, Allocator, Ordering >::Get | ( | const K & | key, | |
T & | fallback | |||
) | [inline] |
Get the element matching the given key, or fallback
if there is none.
Definition at line 1201 of file redblacktree.h.
const T& csRedBlackTreeMap< K, T, Allocator, Ordering >::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 1195 of file redblacktree.h.
T* csRedBlackTreeMap< K, T, Allocator, Ordering >::GetElementPointer | ( | const K & | key | ) | [inline] |
Get the element matching the given key, or fallback
if there is none.
Definition at line 1183 of file redblacktree.h.
const T* csRedBlackTreeMap< K, T, Allocator, Ordering >::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 1177 of file redblacktree.h.
Iterator csRedBlackTreeMap< K, T, Allocator, Ordering >::GetIterator | ( | ) | [inline] |
Get an iterator for iterating over the entire map.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1435 of file redblacktree.h.
ConstIterator csRedBlackTreeMap< K, T, Allocator, Ordering >::GetIterator | ( | ) | const [inline] |
Get an iterator for iterating over the entire map.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1427 of file redblacktree.h.
ReverseIterator csRedBlackTreeMap< K, T, Allocator, Ordering >::GetReverseIterator | ( | ) | [inline] |
Get an iterator for iterating over the entire map.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1451 of file redblacktree.h.
ConstReverseIterator csRedBlackTreeMap< K, T, Allocator, Ordering >::GetReverseIterator | ( | ) | const [inline] |
Get an iterator for iterating over the entire map.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1443 of file redblacktree.h.
bool csRedBlackTreeMap< K, T, Allocator, Ordering >::IsEmpty | ( | ) | const [inline] |
Returns whether this map has no nodes.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1213 of file redblacktree.h.
T* csRedBlackTreeMap< K, T, Allocator, Ordering >::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 1155 of file redblacktree.h.
void csRedBlackTreeMap< K, T, Allocator, Ordering >::TraverseInOrder | ( | CB & | callback | ) | const [inline] |
Traverse tree.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1218 of file redblacktree.h.
Friends And Related Function Documentation
friend class ConstIterator [friend] |
Get the element matching the given key, or fallback
if there is none.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1274 of file redblacktree.h.
friend class ConstReverseIterator [friend] |
Get the element matching the given key, or fallback
if there is none.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1373 of file redblacktree.h.
friend class Iterator [friend] |
Get the element matching the given key, or fallback
if there is none.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1323 of file redblacktree.h.
friend class ReverseIterator [friend] |
Get the element matching the given key, or fallback
if there is none.
Reimplemented from csRedBlackTree< csRedBlackTreePayload< K, T >, Allocator, Ordering >.
Definition at line 1422 of file redblacktree.h.
The documentation for this class was generated from the following file:
- csutil/redblacktree.h
Generated for Crystal Space 2.0 by doxygen 1.6.1