Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/avl/GenTree.h>
Classes | |
class | Iterator |
class | Node |
Public Member Functions | |
GenTree (void) | |
GenTree (const GenTree< T > &tree) | |
~GenTree (void) | |
T * | get (const typename K::key_t &key) |
const T * | get (const typename K::key_t &key) const |
int | count (void) const |
bool | contains (const typename K::key_t &item) const |
bool | isEmpty (void) const |
operator bool (void) const | |
template<template< class _ > class Co> | |
bool | containsAll (const Co< T > &coll) const |
void | clear (void) |
void | copy (const GenTree< T, K, C > &tree) |
GenTree< T, K, C > & | operator= (const GenTree< T, K, C > &tree) |
void | add (const T &item) |
void | set (const T &item) |
void | remove (const typename K::key_t &item) |
void | remove (const Iterator &iter) |
template<class CC > | |
void | addAll (const CC &coll) |
template<class CC > | |
void | removeAll (const CC &coll) |
bool | equals (const GenTree< T, K, C > &tree) const |
bool | operator== (const GenTree< T, K, C > &tree) const |
bool | operator!= (const GenTree< T, K, C > &tree) const |
Protected Member Functions | |
Node * | find (const typename K::key_t &key) const |
Protected Member Functions inherited from elm::avl::AbstractTree | |
AbstractTree (void) | |
void | insert (unsigned char da[], int dir, Node *node, Node *q, Node *y, Node *z) |
void | remove (Node *pa[], unsigned char da[], int k, Node *p) |
int | count (void) const |
Additional Inherited Members | |
Protected Attributes inherited from elm::avl::AbstractTree | |
Node * | root |
int | cnt |
This class implements an AVL tree collection based on C++ templates as provided by: Ben Pfaff, "An Introduction to Binary Search Trees and Balanced Trees", Libavl Binary Search Tree Library, Volume 1: Source Code, Version 2.0.2.
T | Type of contained items. |
C | Comparator for T items (default to elm::Comparator<T>). |
elm::avl::GenTree< T, K, C >::GenTree | ( | void | ) |
elm::avl::GenTree< T, K, C >::GenTree | ( | const GenTree< T > & | tree | ) |
elm::avl::GenTree< T, K, C >::~GenTree | ( | void | ) |
void elm::avl::GenTree< T, K, C >::add | ( | const T & | item | ) |
Add an item to the tree. Note that the item is still added even if it is already contained in the tree, leading to duplicates.
item | Item to add. |
Referenced by elm::avl::GenTree< T, IdAdapter< T >, C >::addAll(), and elm::genstruct::AVLMap< K, T, C >::put().
void elm::avl::GenTree< T, K, C >::addAll | ( | const CC & | coll | ) |
Add a collection to this tree.
coll | Collection to add. |
C | Type of the collection. |
void elm::avl::GenTree< T, K, C >::clear | ( | void | ) |
Remove all items from the tree and let it cleared.
Referenced by elm::avl::Map< Pair< K, K >, T, segment_comparator_t >::clear(), elm::avl::GenTree< T, IdAdapter< T >, C >::copy(), and elm::avl::GenTree< T, IdAdapter< T >, C >::~GenTree().
bool elm::avl::GenTree< T, K, C >::contains | ( | const typename K::key_t & | item | ) | const |
Test if the tree contains the given item.
item | Item to look for. |
Referenced by elm::avl::GenTree< T, IdAdapter< T >, C >::containsAll().
bool elm::avl::GenTree< T, K, C >::containsAll | ( | const Co< T > & | coll | ) | const |
Test if the given collection is contained in the current one.
coll | Collection to test. |
C | Type of the collection. |
void elm::avl::GenTree< T, K, C >::copy | ( | const GenTree< T, K, C > & | tree | ) |
int elm::avl::GenTree< T, K, C >::count | ( | void | ) | const |
Get the count of items in the tree.
Referenced by elm::genstruct::AVLMap< K, T, C >::count(), and elm::avl::Map< Pair< K, K >, T, segment_comparator_t >::count().
bool elm::avl::GenTree< T, K, C >::equals | ( | const GenTree< T, K, C > & | tree | ) | const |
|
protected |
T* elm::avl::GenTree< T, K, C >::get | ( | const typename K::key_t & | key | ) |
const T* elm::avl::GenTree< T, K, C >::get | ( | const typename K::key_t & | key | ) | const |
bool elm::avl::GenTree< T, K, C >::isEmpty | ( | void | ) | const |
Test if the tree is empty.
Referenced by elm::avl::Map< Pair< K, K >, T, segment_comparator_t >::isEmpty(), and elm::avl::GenTree< T, IdAdapter< T >, C >::operator bool().
elm::avl::GenTree< T, K, C >::operator bool | ( | void | ) | const |
bool elm::avl::GenTree< T, K, C >::operator!= | ( | const GenTree< T, K, C > & | tree | ) | const |
GenTree<T, K, C>& elm::avl::GenTree< T, K, C >::operator= | ( | const GenTree< T, K, C > & | tree | ) |
bool elm::avl::GenTree< T, K, C >::operator== | ( | const GenTree< T, K, C > & | tree | ) | const |
void elm::avl::GenTree< T, K, C >::remove | ( | const typename K::key_t & | item | ) |
void elm::avl::GenTree< T, K, C >::remove | ( | const Iterator & | iter | ) |
Remove the item pointed by the iterator.
Iterator | pointing to the item to remove. |
void elm::avl::GenTree< T, K, C >::removeAll | ( | const CC & | coll | ) |
Remove a collection from this tree.
coll | Collection to remove. |
C | Type of the collection. |
void elm::avl::GenTree< T, K, C >::set | ( | const T & | item | ) |