Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XFuNTree< T > Class Template Reference

Generic N-tree template. More...

#include <XFuNTree.h>

List of all members.

Public Types

typedef XFuNTreeAbstractIterator<
T > 
iterator
typedef XFuNTreeRandomAccessIterator<
T > 
randomAccessIterator
typedef XFuNTreePreOrderIterator<
T > 
preOrderIterator
typedef XFuNTreePostOrderIterator<
T > 
postOrderIterator

Public Member Functions

randomAccessIterator beginRandomAccess () const
 Returns a random iterator pointing to the root of the tree.

preOrderIterator beginPreOrder () const
 Returns a pre-order iterator pointing to the first node in iteration.

postOrderIterator beginPostOrder () const
 Returns a post-order iterator pointing to the first node in iteration.

iterator end () const
 Returns an iterator pointing to an empty node.

UINT32 size () const
 Returns the amount of nodes in the tree.

iterator add (iterator aIterator, T aNewData)
 Adds a new child node to a certain node.

iterator add (iterator aIterator, const UINT32 aIndex, T aNewData)
 Adds a new child node to a certain node as the Nth child node.

INT insert (iterator aIterator, const UINT32 aIndex, T aNewData)
 Inserts new internal data to the Nth child node in a certain node.

INT remove (const T aData)
 Removes a node with the given internal data from the list.

INT remove (iterator &aIterator)
 Removes a node pointed to by an iterator.

 XFuNTree (const UINT32 aChildNodes)
 Creates an empty N-tree.

 ~XFuNTree ()
 Destructor.


Protected Member Functions

void removeNode (XFuNTreeNode< T > *aNode)
 Removes a node from the tree.


Protected Attributes

UINT32 mNodes
 Number of nodes in tree.

UINT32 mChildNodes
 Number of child nodes in each node.

XFuNTreeNode< T > * mRoot
 Pointer to root node in tree.


Detailed Description

template<class T>
class XFuNTree< T >

Generic N-tree template.

Definition at line 23 of file XFuNTree.h.


Member Typedef Documentation

template<class T>
typedef XFuNTreeAbstractIterator<T> XFuNTree< T >::iterator
 

Definition at line 27 of file XFuNTree.h.

Referenced by XFuNTree< T >::add().

template<class T>
typedef XFuNTreePostOrderIterator<T> XFuNTree< T >::postOrderIterator
 

Definition at line 30 of file XFuNTree.h.

Referenced by XFuNTree< T >::beginPostOrder().

template<class T>
typedef XFuNTreePreOrderIterator<T> XFuNTree< T >::preOrderIterator
 

Definition at line 29 of file XFuNTree.h.

Referenced by XFuNTree< T >::beginPreOrder().

template<class T>
typedef XFuNTreeRandomAccessIterator<T> XFuNTree< T >::randomAccessIterator
 

Definition at line 28 of file XFuNTree.h.

Referenced by XFuNTree< T >::beginRandomAccess().


Constructor & Destructor Documentation

template<class T>
XFuNTree< T >::XFuNTree const UINT32    aChildNodes
 

Creates an empty N-tree.

Parameters:
aChildNodes amount of child nodes per each node.

Definition at line 307 of file XFuNTree.h.

References XFuNTree< T >::mChildNodes, XFuNTree< T >::mNodes, and XFuNTree< T >::mRoot.

template<class T>
XFuNTree< T >::~XFuNTree  
 

Destructor.

Definition at line 315 of file XFuNTree.h.

References XFuNTree< T >::mRoot, and XFuNTree< T >::removeNode().


Member Function Documentation

template<class T>
XFuNTree< T >::iterator XFuNTree< T >::add iterator    aIterator,
const UINT32    aIndex,
  aNewData
 

Adds a new child node to a certain node as the Nth child node.

If the tree is empty, the node will be added as the root. If the Nth node is already reserved, the operation fails.

Parameters:
aIterator Iterator pointing to the node where the new node should be added as a child.
aIndex Index to which child node should the new node be created as.
aNewData Internal data of the node.
Returns:
A valid iterator if the addition succeeds, or an invalid iterator if an error occured.

Definition at line 216 of file XFuNTree.h.

References XFuNTreeAbstractIterator< T >::isValid(), XFuNTree< T >::iterator, XFuNTreeNode< T >::mAllocatedChildNodes, XFuNTree< T >::mChildNodes, XFuNTreeNode< T >::mChildren, XFuNTreeNode< T >::mIndexInParent, XFuNTreeAbstractIterator< T >::mNode, XFuNTree< T >::mNodes, and XFuNTreeNode< T >::mParent.

template<class T>
XFuNTree< T >::iterator XFuNTree< T >::add iterator    aIterator,
  aNewData
 

Adds a new child node to a certain node.

If the tree is empty, the node will be added as the root. If all child nodes are already reserved, the operation fails.

Parameters:
aIterator Iterator pointing to the node where the new node should be added as a child.
aNewData Internal data of the node.
Returns:
A valid iterator if the addition succeeds, or an invalid iterator if an error occured.

Definition at line 172 of file XFuNTree.h.

References XFuNTreeAbstractIterator< T >::isValid(), XFuNTree< T >::iterator, XFuNTreeNode< T >::mAllocatedChildNodes, XFuNTreeNode< T >::mChildNodes, XFuNTree< T >::mChildNodes, XFuNTreeNode< T >::mChildren, XFuNTreeNode< T >::mIndexInParent, XFuNTreeAbstractIterator< T >::mNode, XFuNTree< T >::mNodes, XFuNTreeNode< T >::mParent, and XFuNTree< T >::mRoot.

template<class T>
XFuNTree< T >::postOrderIterator XFuNTree< T >::beginPostOrder   const
 

Returns a post-order iterator pointing to the first node in iteration.

Returns:
PostOrder iterator pointing to the first node in iteration

Definition at line 160 of file XFuNTree.h.

References XFuNTree< T >::postOrderIterator.

template<class T>
XFuNTree< T >::preOrderIterator XFuNTree< T >::beginPreOrder   const
 

Returns a pre-order iterator pointing to the first node in iteration.

Definition at line 153 of file XFuNTree.h.

References XFuNTree< T >::preOrderIterator.

template<class T>
XFuNTree< T >::randomAccessIterator XFuNTree< T >::beginRandomAccess   const
 

Returns a random iterator pointing to the root of the tree.

Returns:
Random iterator pointing to the root of the tree

Definition at line 146 of file XFuNTree.h.

References XFuNTree< T >::randomAccessIterator.

template<class T>
iterator XFuNTree< T >::end   const
 

Returns an iterator pointing to an empty node.

template<class T>
INT XFuNTree< T >::insert iterator    aIterator,
const UINT32    aIndex,
  aNewData
 

Inserts new internal data to the Nth child node in a certain node.

Parameters:
aIterator Iterator pointing to the parent node.
aIndex Index to which child node should the new internal data be inserted to.
aNewData Internal data of the node.
Returns:
1 if the insertion succeeds, 0 if an error occured.

Definition at line 244 of file XFuNTree.h.

References XFuNTreeAbstractIterator< T >::isValid(), XFuNTreeNode< T >::mChildren, and XFuNTreeAbstractIterator< T >::mNode.

template<class T>
INT XFuNTree< T >::remove iterator   aIterator
 

Removes a node pointed to by an iterator.

Parameters:
aData Iterator pointing to a node.
Returns:
1 if the removal succeeds, 0 otherwise.

Definition at line 291 of file XFuNTree.h.

References XFuNTreeAbstractIterator< T >::mNode, and XFuNTree< T >::removeNode().

template<class T>
INT XFuNTree< T >::remove const T    aData
 

Removes a node with the given internal data from the list.

Parameters:
aData Internal data of the node which is to be removed.
Returns:
1 if the removal succeeds, 0 otherwise.

Definition at line 267 of file XFuNTree.h.

template<class T>
void XFuNTree< T >::removeNode XFuNTreeNode< T > *    aNode [protected]
 

Removes a node from the tree.

Parameters:
aNode Pointer to the node

Definition at line 123 of file XFuNTree.h.

References XFuNTree< T >::mChildNodes, XFuNTreeNode< T >::mChildren, XFuNTreeNode< T >::mIndexInParent, XFuNTree< T >::mNodes, and XFuNTreeNode< T >::mParent.

Referenced by XFuNTree< T >::remove(), and XFuNTree< T >::~XFuNTree().

template<class T>
UINT32 XFuNTree< T >::size   const
 

Returns the amount of nodes in the tree.

Returns:
Amount of nodes in the tree.

Definition at line 166 of file XFuNTree.h.

References XFuNTree< T >::mNodes.


Member Data Documentation

template<class T>
UINT32 XFuNTree< T >::mChildNodes [protected]
 

Number of child nodes in each node.

Definition at line 111 of file XFuNTree.h.

Referenced by XFuNTree< T >::add(), XFuNTree< T >::removeNode(), and XFuNTree< T >::XFuNTree().

template<class T>
UINT32 XFuNTree< T >::mNodes [protected]
 

Number of nodes in tree.

Definition at line 108 of file XFuNTree.h.

Referenced by XFuNTree< T >::add(), XFuNTree< T >::removeNode(), XFuNTree< T >::size(), and XFuNTree< T >::XFuNTree().

template<class T>
XFuNTreeNode<T>* XFuNTree< T >::mRoot [protected]
 

Pointer to root node in tree.

Definition at line 114 of file XFuNTree.h.

Referenced by XFuNTree< T >::add(), XFuNTree< T >::XFuNTree(), and XFuNTree< T >::~XFuNTree().


The documentation for this class was generated from the following file:
   
X-Forge Documentation
Confidential
Copyright © 2002-2003 Fathammer
   
Documentation generated
with doxygen
by Dimitri van Heesch