Phoenix
Object-oriented orthogonally persistent operating system
|
Base class for red-black tree implementation. More...
#include <RBTree.h>
Classes | |
class | EntryBase |
Tree node represented by this class. More... | |
Public Member Functions | |
bool | Validate () |
Validate the tree. | |
Protected Member Functions | |
virtual int | Compare (EntryBase *e1, EntryBase *e2)=0 |
This method should be overloaded in derived class. | |
virtual int | Compare (EntryBase *e, void *key)=0 |
This method should be overloaded in derived class. | |
EntryBase * | InsertNode (EntryBase *node) |
Insert node in the tree. | |
EntryBase * | GetNextNode (EntryBase *node=0) |
Get next tree node during the tree traversal. | |
EntryBase * | Lookup (void *key) |
Lookup tree node by key. | |
void | Delete (EntryBase *entry) |
Delete a node from the tree. | |
EntryBase * | Lowest () |
Get the node with the lowest value. | |
EntryBase * | Highest () |
Get the node with the highest value. |
Base class for red-black tree implementation.
This method should be overloaded in derived class.
It must compare two nodes.
e1 | The first node to compare. |
e2 | The second node to compare. |
Implemented in RBTree< T, Comparator, key_t, KeyComparator >, and RBTree< CacheEntry,&CacheEntry::Compare, Addr,&CacheEntry::Compare >.
virtual int RBTreeBase::Compare | ( | EntryBase * | e, |
void * | key | ||
) | [protected, pure virtual] |
This method should be overloaded in derived class.
It must compare a node with a key.
e | Node to compare. |
key | Pointer to a key. |
Implemented in RBTree< T, Comparator, key_t, KeyComparator >, and RBTree< CacheEntry,&CacheEntry::Compare, Addr,&CacheEntry::Compare >.
void RBTreeBase::Delete | ( | EntryBase * | entry | ) | [protected] |
Delete a node from the tree.
entry | Node to delete. |
RBTreeBase::EntryBase * RBTreeBase::GetNextNode | ( | EntryBase * | node = 0 | ) | [protected] |
Get next tree node during the tree traversal.
node | Previously visited node. Can be NULL to get the first node. |
RBTreeBase::EntryBase * RBTreeBase::Highest | ( | ) | [protected] |
Get the node with the highest value.
Reimplemented in RBTree< T, Comparator, key_t, KeyComparator >, and RBTree< CacheEntry,&CacheEntry::Compare, Addr,&CacheEntry::Compare >.
RBTreeBase::EntryBase * RBTreeBase::InsertNode | ( | EntryBase * | node | ) | [protected] |
Insert node in the tree.
This method either inserts the node or finds existing node with the same key.
node | Node to insert. |
RBTreeBase::EntryBase * RBTreeBase::Lookup | ( | void * | key | ) | [protected] |
Lookup tree node by key.
key | Pointer to key. |
RBTreeBase::EntryBase * RBTreeBase::Lowest | ( | ) | [protected] |
Get the node with the lowest value.
Reimplemented in RBTree< T, Comparator, key_t, KeyComparator >, and RBTree< CacheEntry,&CacheEntry::Compare, Addr,&CacheEntry::Compare >.
bool RBTreeBase::Validate | ( | ) |
Validate the tree.
This method is intended for tree implementation troubleshooting and normally is not required to be used.