#include <avl.hxx>
Inheritance diagram for BaseAvlTree:

Public Member Functions | |
| BaseAvlTree (BaseCmpFn_t cmp) | |
| ~BaseAvlTree () | |
Protected Types | |
| typedef int(* | BaseCmpFn_t )(const BaseAvlNode &n1, const BaseAvlNode &n2) |
| typedef int(* | AvlIterFunc )(BaseAvlNode &) |
Protected Member Functions | |
| void | insert (BaseAvlNode *nd) |
| BaseAvlNode * | choose () |
| BaseAvlNode * | least () |
| BaseAvlNode * | greatest () |
| void | remove (BaseAvlNode &node) |
| BaseAvlNode * | lookup (const BaseAvlNode &key) |
| BaseAvlNode * | lookupGLE (const BaseAvlNode &key) |
| void | iterate (AvlIterFunc avlFunc) |
Note that on desctruction all of the internally allocated node structures are deleted. This means that outstanding pointers to them should not be retained.
Definition at line 98 of file avl.hxx.
|
|
Reimplemented in AvlTree< KeyType >, AvlMap< KeyType, ValueType >, AvlMap< MutName, bool >, AvlMap< AvlPtrWrap< DiffToken >, bool >, AvlMap< TrueName, bool >, and AvlMap< KeyType, bool >. |
|
|
|
|
|
|
|
|
|
|
|
Selects an arbitrary node from within the avl tree (if any) and returns it, or NULL if no nodes remain. The returned node remains in the tree. Reimplemented in AvlTree< KeyType >, AvlMap< KeyType, ValueType >, AvlMap< MutName, bool >, AvlMap< AvlPtrWrap< DiffToken >, bool >, AvlMap< TrueName, bool >, and AvlMap< KeyType, bool >. Definition at line 597 of file avl.cxx. Referenced by AvlMap< KeyType, bool >::choose(), iterate(), and ~BaseAvlTree(). |
|
|
Returns the greatest node in the avl tree (if any) or NULL. The returned node remains in the tree. Reimplemented in AvlTree< KeyType >, AvlMap< KeyType, ValueType >, AvlMap< MutName, bool >, AvlMap< AvlPtrWrap< DiffToken >, bool >, AvlMap< TrueName, bool >, and AvlMap< KeyType, bool >. Definition at line 617 of file avl.cxx. References BaseAvlNode::rchild. Referenced by AvlMap< KeyType, bool >::greatest(), and lookupGLE(). |
|
|
Insert a new node into an existing AVL tree. The lchild/rchild fields of the inserted node will be set to NULL prior to insertion. Definition at line 369 of file avl.cxx. References BaseAvlNode::balance, BaseAvlNode::lchild, and BaseAvlNode::rchild. Referenced by AvlMap< KeyType, bool >::insert(), and iterate(). |
|
|
Reimplemented in AvlTree< KeyType >, AvlMap< KeyType, ValueType >, AvlMap< MutName, bool >, AvlMap< AvlPtrWrap< DiffToken >, bool >, AvlMap< TrueName, bool >, and AvlMap< KeyType, bool >. Definition at line 649 of file avl.cxx. References choose(), insert(), and root. Referenced by AvlMap< KeyType, bool >::iterate(), and AvlTree< KeyType >::iterate(). |
|
|
Returns the least node in the avl tree (if any) or NULL. The returned node remains in the tree. Reimplemented in AvlTree< KeyType >, AvlMap< KeyType, ValueType >, AvlMap< MutName, bool >, AvlMap< AvlPtrWrap< DiffToken >, bool >, AvlMap< TrueName, bool >, and AvlMap< KeyType, bool >. Definition at line 603 of file avl.cxx. References BaseAvlNode::lchild. Referenced by AvlMap< KeyType, bool >::least(). |
|
|
Test whether and existing value exists within an AVL tree. It may seem wasteful that the client must supply an BaseAvlNode rather than some more compact AvlKey structure. In our experience with tree structures it is usually the case that the search key structure is stack allocated. Since the only fields that need to be initialized are the ones consulted by the comparator routine, allocating a full BaseAvlNode actually isn't any more expensive -- it just bumps the stack by a few more words. The advantage of reusing the BaseAvlNode structure for this purpose is that it allows the tree itself to remain completely agnostic about key types and value types. Definition at line 550 of file avl.cxx. References BaseAvlNode::lchild, and BaseAvlNode::rchild. Referenced by AvlMap< KeyType, bool >::lookup(), and remove(). |
|
|
Similar to avl_lookup(), but returns the BaseAvlNode whose key is the greatest (according to provided comparator) key less than or equal to the search key. Definition at line 569 of file avl.cxx. References greatest(), and BaseAvlNode::rchild. Referenced by AvlMap< KeyType, bool >::lookupGLE(). |
|
|
Remove a node from an AVL tree. On return, the node structure is no longer referenced by the tree (though it may be referenced by other user data structures). It is the caller's responsibility to deallocate the storage of the Node structure if appropriate. Definition at line 535 of file avl.cxx. References lookup(). Referenced by AvlMap< KeyType, bool >::remove(), and ~BaseAvlTree(). |
1.4.6