Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

GLIBTree< Data, ConfigData > Class Template Reference

A templated balanced tree class. More...

#include <GLIBTree.h>

Inheritance diagram for GLIBTree< Data, ConfigData >:

AGenericTree< Data, ConfigData > List of all members.

Public Member Functions

 GLIBTree (ACompareNodesAlgorithm< Data, ConfigData > *Compare, DeleteTreeDataEnum DeleteTreeData=NO_DELETE_TREE_ITEM, ConfigData *pConfigData=NULL)
 Constructor.
virtual ~GLIBTree ()
 Destructor.
virtual Data * Search (Data *NodeData, bool *NodeInserted)
 Find a data item. If not found, insert it.
virtual Data * Find (Data *NodeData)
 Find a data item. If not found, return NULL.
Data * Delete (Data *NodeData)
 Delete a node from the tree.
void Insert (Data *NodeData)
 Insert a node into the tree.
int GetHeight ()
 Get the height of the tree.
int GetNumberOfNodes ()
 Get the number of nodes in the tree.

Private Attributes

GLIBTreeNode< Data, ConfigData > * m_Root
 Root node of the tree.

Detailed Description

template<class Data, class ConfigData>
class GLIBTree< Data, ConfigData >

This class is based off of the GLIB implementation of a balanced tree written in C

Definition at line 21 of file GLIBTree.h.


Member Function Documentation

template<class Data, class ConfigData>
Data * GLIBTree< Data, ConfigData >::Delete Data *  NodeData  ) 
 

Parameters:
NodeData is the data of the node to be deleted
Returns:
Data of the deleted node. NULL if node isn't found.

Definition at line 95 of file GLIBTree.h.

References AGenericTree< Data, ConfigData >::m_CompareNodes, GLIBTree< Data, ConfigData >::m_Root, and GLIBTreeNode< Data, ConfigData >::Remove().

Referenced by TestGLIBTree().

template<class Data, class ConfigData>
Data * GLIBTree< Data, ConfigData >::Find Data *  NodeData  )  [virtual]
 

Parameters:
NodeData is the value being searched for.
Returns:
A pointer to the data found. NULL if data isn't found.

Implements AGenericTree< Data, ConfigData >.

Definition at line 103 of file GLIBTree.h.

References GLIBTreeNode< Data, ConfigData >::Lookup(), AGenericTree< Data, ConfigData >::m_CompareNodes, and GLIBTree< Data, ConfigData >::m_Root.

template<class Data, class ConfigData>
int GLIBTree< Data, ConfigData >::GetHeight  ) 
 

Returns:
Returns the height of the tree

Definition at line 130 of file GLIBTree.h.

References GLIBTreeNode< Data, ConfigData >::GetHeight(), and GLIBTree< Data, ConfigData >::m_Root.

template<class Data, class ConfigData>
int GLIBTree< Data, ConfigData >::GetNumberOfNodes  ) 
 

Returns:
Returns the number of nodes in the tree

Definition at line 139 of file GLIBTree.h.

References GLIBTreeNode< Data, ConfigData >::GetNodeCount(), and GLIBTree< Data, ConfigData >::m_Root.

template<class Data, class ConfigData>
void GLIBTree< Data, ConfigData >::Insert Data *  NodeData  ) 
 

Parameters:
NodeData is the value to be inserted

Definition at line 86 of file GLIBTree.h.

References GLIBTreeNode< Data, ConfigData >::Insert(), AGenericTree< Data, ConfigData >::m_CompareNodes, and GLIBTree< Data, ConfigData >::m_Root.

Referenced by GLIBTree< Data, ConfigData >::Search().

template<class Data, class ConfigData>
Data * GLIBTree< Data, ConfigData >::Search Data *  NodeData,
bool *  NodeInserted
[virtual]
 

Parameters:
NodeData is the value being searched for.
NodeInserted is a flag to determine if the data was inserted
Returns:
A pointer to the data found. NULL if data is inserted

Implements AGenericTree< Data, ConfigData >.

Definition at line 109 of file GLIBTree.h.

References GLIBTree< Data, ConfigData >::Insert(), AGenericTree< Data, ConfigData >::m_CompareNodes, GLIBTree< Data, ConfigData >::m_Root, and GLIBTreeNode< Data, ConfigData >::Search().

Referenced by TestGLIBTree().


The documentation for this class was generated from the following file:
Generated on Sat Nov 5 11:20:17 2005 for Cpp Freecell Solver by  doxygen 1.4.4