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

NodeVisitor Class Template Reference
[NodeVisitor]

Visitors are used to extend the Node classes without changing their implementation ('visitor pattern') NodeVisitor is the base class of all visitors. Visitors use an iterator to traverse the tree. So the result depends on the given iteration algorithm. If set to non-recursive they only visit one node. The default value is true, so the visitor works recursively. More...

#include <nodevisitor.h>

Inheritance diagram for NodeVisitor:

Inheritance graph
[legend]
Collaboration diagram for NodeVisitor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef NodeVisitor< _TIter,
_Node, _NormalNode, _RootNode > 
_Self
typedef NodeVisitorBase< _Node,
_NormalNode, _RootNode > 
_Base

Public Methods

 NodeVisitor ()
 NodeVisitor (const _Self &nv)
 no copying allowed, use clone() instead

virtual ~NodeVisitor ()
 Start the output process.

virtual void operator() (_TIter &iter)=0
 Start function.

virtual void operator() (_Node *node)
virtual void visitNormalNode (_NormalNode *node)=0
virtual void visitRootNode (_RootNode *node)=0
virtual void setRecursive (bool recursive)
 'True' the Visitor iterates over children too.

virtual bool isRecursive () const

Protected Methods

virtual void iterate (NodeVisitorBase< _Node, _NormalNode, _RootNode > *self)
 The visit iteration, should be called by start.

virtual void init (_TIter &iter)

Protected Attributes

_Node * m_start
_TIter * m_iter
 local copy


Detailed Description

template<class _TIter, class _Node, class _NormalNode, class _RootNode>
class treecomp::NodeVisitor< _TIter, _Node, _NormalNode, _RootNode >

Visitors are used to extend the Node classes without changing their implementation ('visitor pattern') NodeVisitor is the base class of all visitors. Visitors use an iterator to traverse the tree. So the result depends on the given iteration algorithm. If set to non-recursive they only visit one node. The default value is true, so the visitor works recursively.

Definition at line 95 of file nodevisitor.h.


Member Typedef Documentation

typedef NodeVisitorBase<_Node,_NormalNode,_RootNode> _Base
 

Reimplemented in LayoutVisitor, OutputVisitor, CollectVisitor, and DepthVisitor.

Definition at line 99 of file nodevisitor.h.

typedef NodeVisitor<_TIter,_Node,_NormalNode,_RootNode> _Self
 

Reimplemented from NodeVisitorBase.

Reimplemented in LayoutVisitor, OutputVisitor, CollectVisitor, and DepthVisitor.

Definition at line 98 of file nodevisitor.h.


Constructor & Destructor Documentation

NodeVisitor   [inline, explicit]
 

Definition at line 102 of file nodevisitor.h.

NodeVisitor const _Self   nv [inline, explicit]
 

no copying allowed, use clone() instead

Definition at line 107 of file nodevisitor.h.

~NodeVisitor< _TIter, _Node, _NormalNode, _RootNode >   [virtual]
 

Start the output process.

Parameters:
node  The Node to start with


Member Function Documentation

void init _TIter &    iter [protected, virtual]
 

Definition at line 319 of file nodevisitor.h.

References NodeVisitor::m_iter, and NodeVisitor::m_start.

virtual bool isRecursive   const [inline, virtual]
 

Definition at line 124 of file nodevisitor.h.

void iterate NodeVisitorBase< _Node, _NormalNode, _RootNode > *    self [protected, virtual]
 

The visit iteration, should be called by start.

Definition at line 295 of file nodevisitor.h.

References NodeVisitor::m_iter, and NodeVisitor::m_start.

virtual void operator() _Node *    node [inline, virtual]
 

Reimplemented in OutputVisitor.

Definition at line 117 of file nodevisitor.h.

virtual void operator() _TIter &    iter [pure virtual]
 

Start function.

Derived implementations MUST call the init method!

Implemented in CollectVisitor.

Referenced by NodeVisitor< _TIter, Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > >::operator()().

virtual void setRecursive bool    recursive [inline, virtual]
 

'True' the Visitor iterates over children too.

'False' the Visitor only visits the start node

Definition at line 123 of file nodevisitor.h.

virtual void visitNormalNode _NormalNode *    node [pure virtual]
 

Implements NodeVisitorBase.

Implemented in LayoutVisitor, OutputVisitor, CollectVisitor, and DepthVisitor.

virtual void visitRootNode _RootNode *    node [pure virtual]
 

Implements NodeVisitorBase.

Implemented in LayoutVisitor, OutputVisitor, CollectVisitor, and DepthVisitor.


Member Data Documentation

_TIter* m_iter [protected]
 

local copy

Definition at line 134 of file nodevisitor.h.

Referenced by NodeVisitor::init(), NodeVisitor::iterate(), and NodeVisitor< _TIter, Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > >::NodeVisitor().

_Node* m_start [protected]
 

Definition at line 132 of file nodevisitor.h.

Referenced by NodeVisitor::init(), NodeVisitor::iterate(), and NodeVisitor< _TIter, Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > >::NodeVisitor().


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