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

DepthVisitor Class Template Reference
[NodeVisitor]

This visitor measures the maximum depth of the tree, which is the distance from the given node to the farest leave. The distance is provided through 'getDepth()'. More...

#include <nodevisitor.h>

Inheritance diagram for DepthVisitor:

Inheritance graph
[legend]
Collaboration diagram for DepthVisitor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef DepthVisitor< _TContent,
_TIter > 
_Self
typedef NodeVisitor< typename
_TIter::const_iterator, const
Node< _TContent >, const NormalNode<
_TContent >, const RootNode<
_TContent > > 
_Base

Public Methods

 DepthVisitor ()
virtual _Selfconstruct () const
virtual _Selfclone () const
virtual void operator() (_TIter &iter)
 Start the measurement process.

virtual void visitNormalNode (const NormalNode< _TContent > *node)
 Take a NormalNode and calculate depth.

virtual void visitRootNode (const RootNode< _TContent > *node)
 Take a RootNode and calculate depth.

virtual int getDepth ()

Protected Methods

 DepthVisitor (const DepthVisitor &cv)
void measure (const Node< _TContent > *node)
 Take a Node and calculate depth.


Protected Attributes

int m_curDepth
int m_maxDepth
const Node< _TContent > * m_curParent
bool m_isLeave

Detailed Description

template<class _TContent, class _TIter>
class treecomp::DepthVisitor< _TContent, _TIter >

This visitor measures the maximum depth of the tree, which is the distance from the given node to the farest leave. The distance is provided through 'getDepth()'.

Definition at line 251 of file nodevisitor.h.


Member Typedef Documentation

typedef NodeVisitor<typename _TIter::const_iterator, const Node<_TContent>,const NormalNode<_TContent>,const RootNode<_TContent> > _Base
 

Reimplemented from NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 259 of file nodevisitor.h.

Referenced by DepthVisitor::DepthVisitor().

typedef DepthVisitor<_TContent,_TIter> _Self
 

Reimplemented from NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 256 of file nodevisitor.h.

Referenced by DepthVisitor::clone(), and DepthVisitor::construct().


Constructor & Destructor Documentation

DepthVisitor   [inline, explicit]
 

Definition at line 262 of file nodevisitor.h.

References DepthVisitor::_Base, DepthVisitor::m_curDepth, DepthVisitor::m_curParent, DepthVisitor::m_isLeave, and DepthVisitor::m_maxDepth.

DepthVisitor const DepthVisitor< _TContent, _TIter > &    cv [inline, explicit, protected]
 

Definition at line 276 of file nodevisitor.h.

References DepthVisitor::_Base.


Member Function Documentation

virtual _Self* clone   const [inline, virtual]
 

Definition at line 267 of file nodevisitor.h.

References DepthVisitor::_Self.

virtual _Self* construct   const [inline, virtual]
 

Definition at line 266 of file nodevisitor.h.

References DepthVisitor::_Self.

virtual int getDepth   [inline, virtual]
 

Definition at line 273 of file nodevisitor.h.

References DepthVisitor::m_maxDepth.

Referenced by Node::getDepth().

void measure const Node< _TContent > *    node [protected]
 

Take a Node and calculate depth.

Parameters:
node  The Node

Definition at line 536 of file nodevisitor.h.

References Node::getNumChildren(), Node::getParent(), DepthVisitor::m_curDepth, DepthVisitor::m_curParent, DepthVisitor::m_isLeave, and DepthVisitor::m_maxDepth.

Referenced by DepthVisitor::visitNormalNode(), and DepthVisitor::visitRootNode().

void operator() _TIter &    iter [virtual]
 

Start the measurement process.

Parameters:
iter  The NodeIterator that iterates over all nodes to visit

Definition at line 500 of file nodevisitor.h.

References NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >::init(), NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >::iterate(), DepthVisitor::m_curDepth, DepthVisitor::m_curParent, DepthVisitor::m_isLeave, and DepthVisitor::m_maxDepth.

void visitNormalNode const NormalNode< _TContent > *    node [virtual]
 

Take a NormalNode and calculate depth.

Parameters:
node  The NormalNode to visit

Implements NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 516 of file nodevisitor.h.

References DepthVisitor::measure().

void visitRootNode const RootNode< _TContent > *    node [virtual]
 

Take a RootNode and calculate depth.

Parameters:
node  The RootNode to visit

Implements NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 526 of file nodevisitor.h.

References DepthVisitor::measure().


Member Data Documentation

int m_curDepth [protected]
 

Definition at line 279 of file nodevisitor.h.

Referenced by DepthVisitor::DepthVisitor(), DepthVisitor::measure(), and DepthVisitor::operator()().

const Node<_TContent>* m_curParent [protected]
 

Definition at line 281 of file nodevisitor.h.

Referenced by DepthVisitor::DepthVisitor(), DepthVisitor::measure(), and DepthVisitor::operator()().

bool m_isLeave [protected]
 

Definition at line 282 of file nodevisitor.h.

Referenced by DepthVisitor::DepthVisitor(), DepthVisitor::measure(), and DepthVisitor::operator()().

int m_maxDepth [protected]
 

Definition at line 280 of file nodevisitor.h.

Referenced by DepthVisitor::DepthVisitor(), DepthVisitor::getDepth(), DepthVisitor::measure(), and DepthVisitor::operator()().


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