tBalTree

tBalTree Hierarchy

tBalTree is the abstract base class for balanced binary trees, and contains all of the actual tree-handling logic.

Reference Material

Public Interface

Construction/Destruction

General

GetCount() Returns number of items in tree.

RemoveAll() Removes all items from tree.

Balancing

Performs manual balance.

SetAutoBalance() Set max level of imbalance allowed.

Navigation

GetItem() Find 0-based item in tree.

GetItemIndex() Get 0-based index of item.

First() Move to first item in tree.

Last() Move to last item in tree.

Next() Move to next item in tree.

Prev() Move to previous item in tree.

Debugging/Tuning

DumpStatistics() Dump statistics as TRACE stmts.

DumpStructure() Dump structure of tree as TRACE stmts.

ResetStatistics() Clear all statistics.

Serialization

Load() Load tree contents from stream.

Store() Store tree contents in stream.

Protected Interface

Data

enum relativeKeyValue Result from onCompareKeys().

typedef StrmHdr Stream header for serialization.

long m_bufSize; Max buffer size needed during Load().

m_dataBuf; Data buffer during Load().

m_keyBuf; Key buffer during Load().

Navigation and Data Manipulation

find() Locate specified item in tree.

getData() Return item's data pointer.

getKey() Return item's tree pointer.

remove() Remove item from tree.

set() Set key/data pairing.

setData() Set data of item.

Key Handling for Derived Classes

Perform key comparison.

onDeleteData() Deallocate item's data.

onDeleteKey() Deallocate item's key.

onGetKeyName() Convert key to ASCII for debugging.

onSetData() Set item's data.

onSetKey() Set item's key.

Serialization

onLoad() Input one item from stream.

onStore() Store one item in stream.

storeTree() Serialization helper to navigate tree.