Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HTree< T > Class Template Reference
[Abstract Data Types]

#include <HTree.h>

Inheritance diagram for HTree< T >:

HObjNoCopy HObj

Detailed Description

template<class T>
class HTree< T >

The HTree class manages a tree of HTreeNode elements. It stores a Ptr to the root node (if any), as well as a cached count of current nodes in the tree.

Definition at line 714 of file HTree.h.

Public Member Functions

ErrCode Delete (const T &data)
ErrCode DeleteAll (void)
ErrCode Insert (const T &data, const bool bUpdate=false)
virtual HTreeNodePtr Search (const T *pData)
virtual HTreeNodePtr Search (T const &data) const
uint32 GetDepth (void) const
 Returns the depth of the entire tree.
uint32 GetCount () const
 Returns the count of nodes in the entire tree.
HTreeNodePtr GetRoot () const
bool IsEmpty (void) const
bool IsNotEmpty (void) const

Protected Member Functions

ErrCode deleteNode (HTreeNodePtr pn)

Protected Attributes

uint32 m_uNodes
 Count of nodes in the tree.
HTreeNodePtr m_pnRoot
 Ptr to root node (NULL if empty tree).


Member Function Documentation

template<class T>
ErrCode HTree< T >::deleteNode HTreeNodePtr  pn  )  [protected]
 

Deletes a single node from the tree, rebalancing the tree as needed.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pn ptr to node to delete

Definition at line 738 of file HTree.h.

template<class T>
ErrCode HTree< T >::Delete const T &  data  ) 
 

Find a node for the given data and remove it from the tree

Returns:
NO_ERROR on success, error code otherwise
Parameters:
data Data to find and delete

Definition at line 827 of file HTree.h.

template<class T>
ErrCode HTree< T >::DeleteAll void   ) 
 

Delete all the nodes in the current tree.

Returns:
Always NO_ERROR

Definition at line 849 of file HTree.h.

template<class T>
ErrCode HTree< T >::Insert const T &  data,
const bool  bUpdate = false
 

Insert a new value into an existing tree

Returns:
NO_ERROR on success, error code otherwise
Parameters:
data data to be inserted.
bUpdate true to replace existing value, false otherwise

Definition at line 872 of file HTree.h.

template<class T>
virtual HTreeNodePtr HTree< T >::Search const T *  pData  )  [virtual]
 

Search the entire tree for a given data

Returns:
Ptr to node if found, NULL otherwise
Parameters:
pData Ptr to data to find

Definition at line 947 of file HTree.h.

template<class T>
virtual HTreeNodePtr HTree< T >::Search T const &  data  )  const [virtual]
 

Search the entire tree for a given data

Returns:
Ptr to node if found, NULL otherwise
Parameters:
data Ptr to data to find

Definition at line 955 of file HTree.h.

template<class T>
uint32 HTree< T >::GetDepth void   )  const
 

Traverses the tree to compute the depth of the sub-tree from this node downwards. Minimum value will always be 1 (for this node).

Returns:
Depth

Definition at line 966 of file HTree.h.

template<class T>
uint32 HTree< T >::GetCount void   )  const
 

The node count is cached, so this method does not touch the tree nodes at all.

Returns:
Count of nodes

Definition at line 976 of file HTree.h.

template<class T>
HTreeNodePtr HTree< T >::GetRoot void   )  const
 

Returns the root node of the tree.

Returns:
Ptr to root node.

Definition at line 984 of file HTree.h.

template<class T>
bool HTree< T >::IsEmpty void   )  const
 

Evaluates to true if the tree is empty, i.e., there are no nodes in it.

Returns:
True if empty, false otherwise

Definition at line 992 of file HTree.h.

template<class T>
bool HTree< T >::IsNotEmpty void   )  const
 

Evaluates to true if the tree is not empty, i.e., there is at least one node in it.

Returns:
True if not empty, false otherwise

Definition at line 1000 of file HTree.h.


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

2006.01.09-16:37