Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::Tree< T > Class Template Reference

#include <Tree.h>

Inheritance diagram for util::Tree< T >:

util::Object List of all members.

Detailed Description

template<class T>
class util::Tree< T >

Tree represents a node in a tree data structure.

A tree may have any number of children and a single parent.


Public Methods

 Tree ()
 Create an empty tree node.

 Tree (const T &d)
 Create a tree node with the given data.

 Tree (const Tree &other)
 Copy a tree node.

Tree & operator= (const Tree &other)
 Copy a tree node.

virtual ~Tree ()
 Destroy a tree and all of its children.

virtual void removeChild (Tree *child)
 Remove a child node from this node.

virtual void addChild (Tree *child)
 Add a child to the end of child node list and update the parent pointer in child.

List< Tree * > getChildren () const
 Get the children of this node in insertion order.

const List< Tree * > & children () const
 Get the children of this node in insertion order.

List< Tree * > & children ()
 Get the children of this node in insertion order.

void setParent (Tree *parent)
 Set the parent node.

Tree * getParent () const
 Get the parent node.


Public Attributes

data
 The data contained in this node.


Protected Attributes

List< Tree * > _plstChildren
 A list of child nodes.

Tree * _pParent
 A pointer to the parent node.


Constructor & Destructor Documentation

template<class T>
util::Tree< T >::Tree const Tree< T > &    other [inline]
 

Copy a tree node.

Only the contents are copied. If you want to perform a deep copy of a tree, you must do it manually.


Member Function Documentation

template<class T>
Tree* util::Tree< T >::getParent   const [inline]
 

Get the parent node.

Returns:
parent node or NULL, if there is no parent

template<class T>
Tree< T > & util::Tree< T >::operator= const Tree< T > &    other
 

Copy a tree node.

Only the contents are copied. If you want to perform a deep copy of a tree, you must do it manually.

template<class T>
virtual void util::Tree< T >::removeChild Tree< T > *    child [inline, virtual]
 

Remove a child node from this node.

The parent of the removed child is set to NULL.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.