Logo Search packages:      
Sourcecode: ragel version File versions

AvlTree< AVLMEL_CLASSDEF > Class Template Reference

#include <avltree.h>

Inheritance diagram for AvlTree< AVLMEL_CLASSDEF >:

List of all members.

Detailed Description

class AvlTree< AVLMEL_CLASSDEF >

Basic AVL tree.

AvlTree is the standard by-structure AVL tree. An element and a key type must be given. The element type must have the appropriate AVL element pointers. This can be achieved by inheriting from the AvlTreeEl class.

AvlTree does not assume ownership of elements in the tree. Items must be explicitly de-allocated.

Definition at line 183 of file avlcommon.h.

Public Member Functions

void abandon ()
 Forget all element in the tree.
 AvlTree (const AvlTree &other)
 Perform a shallow copy of the tree.
 AvlTree ()
 Create an empty tree.
void deepCopy (const AvlTree &tree)
 Perform a deep copy of the tree.
Element * detach (Element *element)
 Detach a element from the tree.
Element * detach (const Key &key)
 Find a element, then detach it from the tree.
void empty ()
 Empty the tree and delete all the element.
Element * find (const Key &key) const
 Find a element in the tree with the given key.
IterFirst first ()
 Return first element.
Element * insert (const Key &key, Element **lastFound=0)
 Insert a new element into the tree with given key.
Element * insert (Element *element, Element **lastFound=0)
 Insert an existing element into the tree.
IterLast last ()
 Return last element.
long length () const
 Return the number of elements in the tree.
AvlTreeoperator= (const AvlTree &tree)
 Perform a shallow copy of the tree.
void remove (Element *element)
 Detach and delete a element from the tree.
bool remove (const Key &key)
 Find, detach and delete a element from the tree.
long size () const
 Return the number of elements in the tree.
 ~AvlTree ()
 Abandon all elements in the tree.

Public Attributes

Element * head
Element * root
Element * tail
long treeSize

Protected Member Functions

void attachRebal (Element *element, Element *parentEl, Element *lastLess)
Element * copyBranch (Element *element)
void deleteChildrenOf (Element *n)
Element * findFirstUnbalEl (Element *start)
Element * findFirstUnbalGP (Element *start)
Element * rebalance (Element *start)
void recalcHeights (Element *start)
void removeEl (Element *element, Element *filler)
void replaceEl (Element *element, Element *replacement)


struct  Iter
 Avl Tree Iterator. More...
struct  IterFirst
struct  IterLast
struct  IterNext
struct  IterPrev

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

Generated by  Doxygen 1.6.0   Back to index