Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
|
map template for associative arrays using a red-black tree More...
#include <nirtcpp/core/engine/irrMap.hpp>
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 | |
using | Node = RBTree< KeyType, ValueType > |
using | key_type = KeyType |
using | value_type = ValueType |
using | size_type = u32 |
Public Member Functions | |
bool | insert (const KeyType &keyNew, const ValueType &v) |
Inserts a new node into the tree. | |
void | set (const KeyType &k, const ValueType &v) |
Replaces the value if the key already exists, otherwise inserts a new element. | |
Node * | delink (const KeyType &k) |
Removes a node from the tree and returns it. | |
bool | remove (const KeyType &k) |
Removes a node from the tree and deletes it. | |
bool | remove (Node *p) |
Removes a node from the tree and deletes it. | |
void | clear () |
Clear the entire tree. | |
bool | empty () const |
NIRT_DEPRECATED bool | isEmpty () const |
Node * | find (const KeyType &keyToFind) const |
Node * | getRoot () const |
u32 | size () const |
Returns the number of nodes in the tree. | |
void | swap (map< KeyType, ValueType > &other) |
Swap the content of this map container with the content of another map. | |
Iterator | getIterator () const |
Returns an iterator. | |
ConstIterator | getConstIterator () const |
Returns a Constiterator. | |
ParentFirstIterator | getParentFirstIterator () const |
ParentLastIterator | getParentLastIterator () const |
AccessClass | operator[] (const KeyType &k) |
operator [] for access to elements | |
map template for associative arrays using a red-black tree
Removes a node from the tree and returns it.
The returned node must be deleted by the user
k | the key to remove |
|
inline |
Is the tree empty?
Search for a node with the specified key.
keyToFind | The key to find |
|
inline |
Returns a ParentFirstIterator. Traverses the tree from top to bottom. Typical usage is when storing the tree class, because when reading it later (and inserting elements) the tree class will be the same.
|
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.
|
inline |
Gets the root element.
|
inline |
Inserts a new node into the tree.
keyNew | the index for this value |
v | the value to insert |
|
inline |
|
inline |
operator [] for access to elements
for example myMap["key"]
Removes a node from the tree and deletes it.
|
inline |
Removes a node from the tree and deletes it.
Replaces the value if the key already exists, otherwise inserts a new element.
k | The index for this value |
v | The new value of |
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 |