Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

NodeTraversal Class Template Reference
[NodeTraversal]

Base class for Traversal classes, that walks through a tree and returns a container with all visited nodes. More...

#include <nodetraversal.h>

Inheritance diagram for NodeTraversal:

Inheritance graph
[legend]
Collaboration diagram for NodeTraversal:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual ~NodeTraversal ()
_Container & operator() (_Node *)
 start function


Protected Methods

virtual void walk (_Node *)=0

Protected Attributes

_Container m_traversal

Detailed Description

template<class _Node, class _Container = std::vector<_Node*>>
class treecomp::NodeTraversal< _Node, _Container >

Base class for Traversal classes, that walks through a tree and returns a container with all visited nodes.

Author:
Eva Brucherseifer

Parameters:
_Node:  nodes type that are traversed
_Container:  container type that is used to collect the nodes. Default is vector<_Node*>. The container class must support the function push_back(node) and must be assignable.
Usage:
    vector<Node<string> > traversal = PreNodeTraversal()(pointer_to_tree);
or
    PreNodeTraversal pretraversal;
    vector<Node<string> > nodevector = pretraversal(pointer_to_tree);
To create a new traversal type, reimplement the protected walk() method.

Definition at line 52 of file nodetraversal.h.


Constructor & Destructor Documentation

virtual ~NodeTraversal   [inline, virtual]
 

Definition at line 55 of file nodetraversal.h.


Member Function Documentation

_Container & operator() _Node *   
 

start function

Definition at line 133 of file nodetraversal.h.

References NodeTraversal::m_traversal, and NodeTraversal::walk().

virtual void walk _Node *    [protected, pure virtual]
 

Implemented in IterNodeTraversal, PreOrderNodeTraversal, and PostOrderNodeTraversal.

Referenced by NodeTraversal::operator()().


Member Data Documentation

_Container m_traversal [protected]
 

Definition at line 63 of file nodetraversal.h.

Referenced by NodeTraversal::operator()(), PreOrderNodeTraversal::walk(), PostOrderNodeTraversal::walk(), and IterNodeTraversal::walk().


The documentation for this class was generated from the following file:
Generated on Mon Jan 6 12:02:23 2003 for TreeComp by doxygen1.2.17