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

NodeTraversal

This set of classes traverses a whole tree from a given start node and returns a container which holds pointers to all nodes. More...

Compounds

class  IterNodeTraversal
 Produces a traversal using the given Iterator. More...

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

class  PostOrderNodeTraversal
 Produces a traversal in postorder. Descends first recursively and visits node then. More...

class  PreOrderNodeTraversal
 Produces a traversal in preorder. Visits node first and descends then recursively. More...


Detailed Description

This set of classes traverses a whole tree from a given start node and returns a container which holds pointers to all nodes.

NodeTraversal classes are functors and thus used via the operator() function.

Parameters:
_Node:  nodes type that are traversed
_Container:  container type that is used to collect the nodes. Default is vector<_Node*>
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.
Generated on Mon Jan 6 12:02:16 2003 for TreeComp by doxygen1.2.17