Tree::AVL::Tree< T, KeyType, Policy, DeleterT > Class Template Reference

#include <Avl.hpp>

List of all members.


Detailed Description

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
class Tree::AVL::Tree< T, KeyType, Policy, DeleterT >

The Tree class with a compare policy.


Public Types

typedef Iterator< T, KeyType,
DeleterT > 
IterT
 Used when searching.

Public Member Functions

bool checkTree (NodeT *node)
bool checkTree ()
 Check this tree correctness.
void Clear ()
 Empty the tree and delete all objects.
bool Delete (const IterT &iter)
 Delete an object from the tree.
bool Delete (KeyType key)
 Delete an object from the tree.
const IterT getFirstIterator () const
 Get iterator on first object.
IterT getFirstIterator ()
 Get iterator on first object.
const IterT getLastIterator () const
 Get iterator on last object.
IterT getLastIterator ()
 Get iterator on last object.
uint32 getSize () const
 Get tree height (or size).
bool insertObject (const T &obj, KeyType key)
 Insert an object in the tree with its key.
bool isEmpty () const
 Check if the tree is empty.
IterT searchExtreme (const bool lowest) const
 Search the extreme node.
IterT searchFor (KeyType key) const
 Search the node with the given key.
 Tree ()
 Default constructor.
virtual ~Tree ()
 Destructor.

Protected Types

enum  { NoRelativeParent = NULL }
 Used for insertion. More...


Member Typedef Documentation

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
typedef Iterator<T, KeyType, DeleterT> Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::IterT

Used when searching.


Member Enumeration Documentation

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
anonymous enum [protected]

Used for insertion.

Enumerator:
NoRelativeParent 


Constructor & Destructor Documentation

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::Tree (  )  [inline]

Default constructor.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
virtual Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::~Tree (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::checkTree ( NodeT node  )  [inline]

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::checkTree (  )  [inline]

Check this tree correctness.

Warning:
This method is recursive, so for (very) large tree, please avoid using it

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
void Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::Clear (  )  [inline]

Empty the tree and delete all objects.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::Delete ( const IterT iter  )  [inline]

Delete an object from the tree.

Data itself is deleted.

Returns:
false if not found

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::Delete ( KeyType  key  )  [inline]

Delete an object from the tree.

Data itself is deleted. Iterators held on this tree are invalidated

Returns:
false if not found

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
const IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::getFirstIterator (  )  const [inline]

Get iterator on first object.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::getFirstIterator (  )  [inline]

Get iterator on first object.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
const IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::getLastIterator (  )  const [inline]

Get iterator on last object.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::getLastIterator (  )  [inline]

Get iterator on last object.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
uint32 Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::getSize (  )  const [inline]

Get tree height (or size).

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::insertObject ( const T &  obj,
KeyType  key 
) [inline]

Insert an object in the tree with its key.

The tree takes ownership of data This method use an iterative algorithm, so it support very large trees

Returns:
true on success, false if already exists

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
bool Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::isEmpty (  )  const [inline]

Check if the tree is empty.

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::searchExtreme ( const bool  lowest  )  const [inline]

Search the extreme node.

Parameters:
lowest If set to true, the lowest node is returned, else it's the highest node that is returned
Returns:
an iterator on the lowest/highest node, that still have to be checked with isValid()

template<typename T, typename KeyType, class Policy = Comparator::DefaultComparator, typename DeleterT = NoDeletion<T, KeyType>>
IterT Tree::AVL::Tree< T, KeyType, Policy, DeleterT >::searchFor ( KeyType  key  )  const [inline]

Search the node with the given key.

The search worst time is O(log getSize()) operation which is very good.

Returns:
an iterator that have to be tested with isValid()


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

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is