Irrlicht Engine: irr::core::map< KeyType, ValueType > Class Template Reference

Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::core::map< KeyType, ValueType > Class Template Reference

map template for associative arrays using a red-black tree More...

`#include <irrMap.h>`

List of all members.

## Classes
class | AccessClass
class | Iterator
| Normal Iterator. More...
class | ParentFirstIterator
| Parent First Iterator. More...
class | ParentLastIterator
| Parent Last Iterator. More...
class | RBTree
| red/black tree for map
## Public Types
typedef RBTree< KeyType, ValueType > | Node
## Public Member Functions
void | clear ()
| Clear the entire tree.
Node * | delink (const KeyType &k)
| Removes a node from the tree and returns it.
bool | empty () const
Node * | find (const KeyType &keyToFind) const
Iterator | getIterator ()
| Returns an iterator.
ParentFirstIterator | getParentFirstIterator ()
ParentLastIterator | getParentLastIterator ()
Node * | getRoot () const
bool | insert (const KeyType &keyNew, const ValueType &v)
| Inserts a new node into the tree.
_IRR_DEPRECATED_ bool | isEmpty () const
| map ()
AccessClass | operator[] (const KeyType &k)
| operator [] for access to elements
bool | remove (const KeyType &k)
| Removes a node from the tree and deletes it.
void | set (const KeyType &k, const ValueType &v)
| Replaces the value if the key already exists, otherwise inserts a new element.
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.
| ~map ()

## Detailed Description

### template<class KeyType, class ValueType>
class irr::core::map< KeyType, ValueType >

map template for associative arrays using a red-black tree

Definition at line 18 of file irrMap.h.

## Member Typedef Documentation

template<class KeyType, class ValueType>

typedef RBTree<KeyType,ValueType> irr::core::map< KeyType, ValueType >::Node

Definition at line 128 of file irrMap.h.

## Constructor & Destructor Documentation

template<class KeyType, class ValueType>

irr::core::map< KeyType, ValueType >::map | ( |  | ) | `[inline]`

Definition at line 525 of file irrMap.h.

template<class KeyType, class ValueType>

irr::core::map< KeyType, ValueType >::~map | ( |  | ) | `[inline]`

Definition at line 528 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::clear().

## Member Function Documentation

template<class KeyType, class ValueType>

void irr::core::map< KeyType, ValueType >::clear | ( |  | ) | `[inline]`

Clear the entire tree.

Definition at line 717 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().

template<class KeyType, class ValueType>

Node* irr::core::map< KeyType, ValueType >::delink | ( | const KeyType & | k | ) | `[inline]`

Removes a node from the tree and returns it.

The returned node must be deleted by the user

Parameters:

  | k | the key to remove

Returns:
  A pointer to the node, or 0 if not found

Definition at line 636 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::find().

template<class KeyType, class ValueType>

bool irr::core::map< KeyType, ValueType >::empty | ( |  | ) | const`[inline]`

Is the tree empty?

Returns:
  Returns true if empty, false if not

Definition at line 734 of file irrMap.h.

References _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX.

Referenced by irr::core::map< KeyType, ValueType >::isEmpty().

template<class KeyType, class ValueType>

Node* irr::core::map< KeyType, ValueType >::find | ( | const KeyType & | keyToFind | ) | const`[inline]`

Search for a node with the specified key.

Parameters:

  | keyToFind,: | The key to find

Returns:
  Returns 0 if node couldn't be found.

Definition at line 749 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().

template<class KeyType, class ValueType>

Iterator irr::core::map< KeyType, ValueType >::getIterator | ( |  | ) | `[inline]`

Returns an iterator.

Definition at line 798 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::getRoot().

template<class KeyType, class ValueType>

ParentFirstIterator irr::core::map< KeyType, ValueType >::getParentFirstIterator | ( |  | ) | `[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 808 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::getRoot().

template<class KeyType, class ValueType>

ParentLastIterator irr::core::map< KeyType, ValueType >::getParentLastIterator | ( |  | ) | `[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 818 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::getRoot().

Referenced by irr::core::map< KeyType, ValueType >::clear().

template<class KeyType, class ValueType>

Node* irr::core::map< KeyType, ValueType >::getRoot | ( |  | ) | const`[inline]`

Gets the root element.

Returns:
  Returns a pointer to the root node, or 0 if the tree is empty.

Definition at line 771 of file irrMap.h.

Referenced by irr::core::map< KeyType, ValueType >::getIterator(), irr::core::map< KeyType, ValueType >::getParentFirstIterator(), and irr::core::map< KeyType, ValueType >::getParentLastIterator().

template<class KeyType, class ValueType>

bool irr::core::map< KeyType, ValueType >::insert | ( | const KeyType & | keyNew,
|  | const ValueType & | v |
| ) |  |  | `[inline]`

Inserts a new node into the tree.

Parameters:

  | keyNew,: | the index for this value
  | v,: | the value to insert

Returns:
  True if successful, false if it fails (already exists)

Definition at line 541 of file irrMap.h.

References _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX.

Referenced by irr::core::map< KeyType, ValueType >::set().

template<class KeyType, class ValueType>

_IRR_DEPRECATED_ bool irr::core::map< KeyType, ValueType >::isEmpty | ( |  | ) | const`[inline]`

Deprecated:
  Use empty() instead.

Definition at line 741 of file irrMap.h.

References irr::core::map< KeyType, ValueType >::empty().

template<class KeyType, class ValueType>

AccessClass irr::core::map< KeyType, ValueType >::operator[] | ( | const KeyType & | k | ) | `[inline]`

operator [] for access to elements

for example myMap["key"]

Definition at line 830 of file irrMap.h.

template<class KeyType, class ValueType>

bool irr::core::map< KeyType, ValueType >::remove | ( | const KeyType & | k | ) | `[inline]`

Removes a node from the tree and deletes it.

Returns:
  True if the node was found and deleted

Definition at line 675 of file irrMap.h.

References _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX, and irr::core::map< KeyType, ValueType >::find().

template<class KeyType, class ValueType>

void irr::core::map< KeyType, ValueType >::set | ( | const KeyType & | k,
|  | const ValueType & | v |
| ) |  |  | `[inline]`

Replaces the value if the key already exists, otherwise inserts a new element.

Parameters:

  | k | The index for this value
  | v | The new value of

Definition at line 623 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=().

template<class KeyType, class ValueType>

u32 irr::core::map< KeyType, ValueType >::size | ( |  | ) | const`[inline]`

Returns the number of nodes in the tree.

Definition at line 777 of file irrMap.h.

template<class KeyType, class ValueType>

void irr::core::map< KeyType, ValueType >::swap | ( | map< KeyType, ValueType > & | other | ) | `[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.

Parameters:

  | other | Swap content with this object

Definition at line 787 of file irrMap.h.

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

- irrMap.h

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:42:03 2010 by Doxygen (1.6.2)