map template for associative arrays using a red-black tree More...
#include <irrMap.h>
Classes | |
class | AccessClass |
class | ConstIterator |
Const Iterator. More... | |
class | Iterator |
Normal Iterator. More... | |
class | ParentFirstIterator |
Parent First Iterator. More... | |
class | ParentLastIterator |
Parent Last Iterator. More... | |
Public Types | |
typedef KeyType | key_type |
typedef RBTree< KeyType, ValueType > | Node |
typedef u32 | size_type |
typedef ValueType | value_type |
Public Member Functions | |
map () | |
~map () | |
void | clear () |
Clear the entire tree. More... | |
Node * | delink (const KeyType &k) |
Removes a node from the tree and returns it. More... | |
bool | empty () const |
Node * | find (const KeyType &keyToFind) const |
ConstIterator | getConstIterator () const |
Returns a Constiterator. More... | |
Iterator | getIterator () const |
Returns an iterator. More... | |
ParentFirstIterator | getParentFirstIterator () const |
ParentLastIterator | getParentLastIterator () const |
Node * | getRoot () const |
bool | insert (const KeyType &keyNew, const ValueType &v) |
Inserts a new node into the tree. More... | |
_IRR_DEPRECATED_ bool | isEmpty () const |
AccessClass | operator[] (const KeyType &k) |
operator [] for access to elements More... | |
bool | remove (const KeyType &k) |
Removes a node from the tree and deletes it. More... | |
bool | remove (Node *p) |
Removes a node from the tree and deletes it. More... | |
void | set (const KeyType &k, const ValueType &v) |
Replaces the value if the key already exists, otherwise inserts a new element. More... | |
u32 | size () const |
Returns the number of nodes in the tree. More... | |
void | swap (map< KeyType, ValueType > &other) |
Swap the content of this map container with the content of another map. More... | |
map template for associative arrays using a red-black tree
typedef KeyType irr::core::map< KeyType, ValueType >::key_type |
typedef RBTree<KeyType,ValueType> irr::core::map< KeyType, ValueType >::Node |
typedef u32 irr::core::map< KeyType, ValueType >::size_type |
typedef ValueType irr::core::map< KeyType, ValueType >::value_type |
|
inline |
|
inline |
Definition at line 662 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::clear().
|
inline |
Clear the entire tree.
Definition at line 861 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::ParentLastIterator::atEnd(), irr::core::map< KeyType, ValueType >::ParentLastIterator::getNode(), and irr::core::map< KeyType, ValueType >::getParentLastIterator().
Referenced by irr::core::map< KeyType, ValueType >::~map().
|
inline |
Removes a node from the tree and returns it.
The returned node must be deleted by the user
k | the key to remove |
Definition at line 774 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::find().
|
inline |
Is the tree empty?
Definition at line 878 of file irrMap.h.
Referenced by irr::core::map< KeyType, ValueType >::isEmpty().
|
inline |
Search for a node with the specified key.
keyToFind | The key to find |
Definition at line 892 of file irrMap.h.
Referenced by irr::core::map< KeyType, ValueType >::delink(), irr::core::map< KeyType, ValueType >::AccessClass::operator ValueType(), irr::core::map< KeyType, ValueType >::remove(), and irr::core::map< KeyType, ValueType >::set().
|
inline |
Returns a Constiterator.
Definition at line 948 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::getRoot().
|
inline |
Returns an iterator.
Definition at line 941 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::getRoot().
|
inline |
Returns a ParentFirstIterator. Traverses the tree from top to bottom. Typical usage is when storing the tree structure, because when reading it later (and inserting elements) the tree structure will be the same.
Definition at line 959 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::getRoot().
|
inline |
Returns a ParentLastIterator to traverse the tree from bottom to top. Typical usage is when deleting all elements in the tree because you must delete the children before you delete their parent.
Definition at line 970 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::getRoot().
Referenced by irr::core::map< KeyType, ValueType >::clear().
|
inline |
Gets the root element.
Definition at line 914 of file irrMap.h.
Referenced by irr::core::map< KeyType, ValueType >::getConstIterator(), irr::core::map< KeyType, ValueType >::getIterator(), irr::core::map< KeyType, ValueType >::getParentFirstIterator(), and irr::core::map< KeyType, ValueType >::getParentLastIterator().
|
inline |
Inserts a new node into the tree.
keyNew | the index for this value |
v | the value to insert |
Definition at line 680 of file irrMap.h.
Referenced by irr::core::map< KeyType, ValueType >::set().
|
inline |
Definition at line 884 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::empty().
|
inline |
|
inline |
Removes a node from the tree and deletes it.
Definition at line 813 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::find().
|
inline |
|
inline |
Replaces the value if the key already exists, otherwise inserts a new element.
k | The index for this value |
v | The new value of |
Definition at line 761 of file irrMap.h.
References irr::core::map< KeyType, ValueType >::find(), and irr::core::map< KeyType, ValueType >::insert().
Referenced by irr::core::map< KeyType, ValueType >::AccessClass::operator=().
|
inline |
|
inline |
Swap the content of this map container with the content of another map.
Afterwards this object will contain the content of the other object and the other object will contain the content of this object. Iterators will afterwards be valid for the swapped object.
other | Swap content with this object |
Definition at line 930 of file irrMap.h.
References irr::core::swap().