Orfeo Toolbox  4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
itk::LevelOrderTreeIterator< TTreeType > Class Template Reference

Iterate over a tree in level order. More...

#include <itkLevelOrderTreeIterator.h>

+ Inheritance diagram for itk::LevelOrderTreeIterator< TTreeType >:
+ Collaboration diagram for itk::LevelOrderTreeIterator< TTreeType >:

Public Types

typedef
TreeNodeType::ChildIdentifier 
ChildIdentifier
 
typedef Superclass::NodeType NodeType
 
typedef LevelOrderTreeIterator Self
 
typedef TreeIteratorBase
< TTreeType > 
Superclass
 
typedef Superclass::TreeNodeType TreeNodeType
 
typedef TTreeType TreeType
 
typedef TTreeType::ValueType ValueType
 

Public Member Functions

 LevelOrderTreeIterator (TreeType *tree, int endLevel=INT_MAX, const TreeNodeType *start=NULL)
 
 LevelOrderTreeIterator (TreeType *tree, int startLevel, int endLevel, const TreeNodeType *start=NULL)
 
virtual ~LevelOrderTreeIterator ()
 
virtual bool Add (ValueType element)
 
virtual bool Add (int position, ValueType element)
 
virtual bool Add (TTreeType &subTree)
 
virtual int ChildPosition (ValueType element) const
 
virtual TreeIteratorBase
< TTreeType > * 
Children ()
 
TreeIteratorBase< TTreeType > * Clone ()
 
virtual int Count ()
 
virtual int CountChildren () const
 
virtual bool Disconnect ()
 
virtual const ValueTypeGet () const
 
virtual TreeIteratorBase
< TTreeType > * 
GetChild (int number) const
 
int GetEndLevel () const
 
int GetLevel () const
 
virtual TreeNodeTypeGetNode ()
 
virtual const TreeNodeTypeGetNode () const
 
const TreeNodeTypeGetParent () const
 
TreeNodeTypeGetRoot ()
 
const TreeNodeTypeGetRoot () const
 
int GetStartLevel () const
 
virtual TTreeType * GetSubTree () const
 
TTreeType * GetTree () const
 
NodeType GetType () const
 
void GoToBegin ()
 
virtual bool GoToChild (ChildIdentifier number=0)
 
void GoToEnd ()
 
virtual bool GoToParent ()
 
virtual bool HasChild (int number=0) const
 
virtual bool HasParent () const
 
bool IsAtBegin (void) const
 
bool IsAtEnd (void) const
 
virtual bool IsLeaf () const
 
virtual bool IsRoot () const
 
Selfoperator++ ()
 
void operator++ (int)
 
const Selfoperator= (const Self &iterator)
 
virtual TreeIteratorBase
< TTreeType > * 
Parents ()
 
bool Remove ()
 
virtual bool RemoveChild (int number)
 
void Set (ValueType element)
 

Protected Member Functions

bool HasNext () const
 
const ValueTypeNext ()
 

Protected Attributes

TreeNodeTypem_Begin
 
TreeNodeTypem_End
 
TreeNodeTypem_Position
 
const TreeNodeTypem_Root
 
TTreeType * m_Tree
 

Private Member Functions

const TreeNodeTypeFindNextNode () const
 
const TreeNodeTypeFindNextNodeHelp () const
 
int GetLevel (const TreeNodeType *node) const
 

Private Attributes

int m_EndLevel
 
std::queue< const TreeNodeType * > m_Queue
 
int m_StartLevel
 

Detailed Description

template<typename TTreeType>
class itk::LevelOrderTreeIterator< TTreeType >

Iterate over a tree in level order.

Definition at line 34 of file itkLevelOrderTreeIterator.h.

Member Typedef Documentation

template<typename TTreeType>
typedef TreeNodeType::ChildIdentifier itk::TreeIteratorBase< TTreeType >::ChildIdentifier
inherited

Definition at line 50 of file itkTreeIteratorBase.h.

template<typename TTreeType>
typedef Superclass::NodeType itk::LevelOrderTreeIterator< TTreeType >::NodeType

Definition at line 44 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType>
typedef LevelOrderTreeIterator itk::LevelOrderTreeIterator< TTreeType >::Self

Typedefs

Definition at line 39 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType>
typedef TreeIteratorBase< TTreeType > itk::LevelOrderTreeIterator< TTreeType >::Superclass

Definition at line 40 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType>
typedef Superclass::TreeNodeType itk::LevelOrderTreeIterator< TTreeType >::TreeNodeType

Definition at line 43 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType>
typedef TTreeType itk::LevelOrderTreeIterator< TTreeType >::TreeType

Definition at line 41 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType>
typedef TTreeType::ValueType itk::LevelOrderTreeIterator< TTreeType >::ValueType

Definition at line 42 of file itkLevelOrderTreeIterator.h.

Constructor & Destructor Documentation

template<typename TTreeType >
itk::LevelOrderTreeIterator< TTreeType >::LevelOrderTreeIterator ( TreeType tree,
int  endLevel = INT_MAX,
const TreeNodeType start = NULL 
)

Constructor with end level specification

Definition at line 28 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType >
itk::LevelOrderTreeIterator< TTreeType >::LevelOrderTreeIterator ( TreeType tree,
int  startLevel,
int  endLevel,
const TreeNodeType start = NULL 
)

Constructor with end level specification

Definition at line 52 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType>
virtual itk::LevelOrderTreeIterator< TTreeType >::~LevelOrderTreeIterator ( )
inlinevirtual

Definition at line 52 of file itkLevelOrderTreeIterator.h.

Member Function Documentation

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::Add ( ValueType  element)
virtualinherited

Add an element to the tree

Add a value to the node. This creates a new child node

Definition at line 99 of file itkTreeIteratorBase.hxx.

References itk::TreeIteratorBase< TTreeType >::m_Position, and NULL.

Referenced by itk::TreeContainer< TValueType >::Add().

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::Add ( int  position,
ValueType  element 
)
virtualinherited

Add an element at a given position

Add a new element at a given position

Definition at line 138 of file itkTreeIteratorBase.hxx.

References itk::TreeIteratorBase< TTreeType >::m_Position.

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::Add ( TTreeType &  subTree)
virtualinherited

Add a subtree

Definition at line 187 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType >
int itk::TreeIteratorBase< TTreeType >::ChildPosition ( ValueType  element) const
virtualinherited

Return the current ChildPosition of an element

Return the current position of the child

Definition at line 244 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
TreeIteratorBase< TTreeType > * itk::TreeIteratorBase< TTreeType >::Children ( )
virtualinherited

Return a list of children

Return the children list

Definition at line 341 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
TreeIteratorBase< TTreeType > * itk::LevelOrderTreeIterator< TTreeType >::Clone ( )
virtual

Clone function

Implements itk::TreeIteratorBase< TTreeType >.

Definition at line 221 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType >
int itk::TreeIteratorBase< TTreeType >::Count ( )
virtualinherited

Count the number of nodes

Count the number of nodes from the beginning

Definition at line 431 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
int itk::TreeIteratorBase< TTreeType >::CountChildren ( ) const
virtualinherited

Count the number of children

Definition at line 284 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::Disconnect ( )
virtualinherited

Disconnect the tree

Definition at line 304 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType >
const LevelOrderTreeIterator< TTreeType >::TreeNodeType * itk::LevelOrderTreeIterator< TTreeType >::FindNextNode ( ) const
private

Find the next available node

Definition at line 120 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType >
const LevelOrderTreeIterator< TTreeType >::TreeNodeType * itk::LevelOrderTreeIterator< TTreeType >::FindNextNodeHelp ( ) const
private

Helper function to find the next node

Definition at line 185 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType >
const TreeIteratorBase< TTreeType >::ValueType & itk::TreeIteratorBase< TTreeType >::Get ( void  ) const
virtualinherited
template<typename TTreeType >
TreeIteratorBase< TTreeType > * itk::TreeIteratorBase< TTreeType >::GetChild ( int  number) const
virtualinherited

Return a list of child

Get a child given a number

Definition at line 411 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::GetEndLevel ( ) const

Get the end level

Definition at line 112 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::GetLevel ( ) const

Get the current level

Return the current level

Definition at line 146 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::GetLevel ( const TreeNodeType node) const
private

Return the level given a node

Definition at line 166 of file itkLevelOrderTreeIterator.hxx.

References NULL.

template<typename TTreeType >
TreeIteratorBase< TTreeType >::TreeNodeType * itk::TreeIteratorBase< TTreeType >::GetNode ( )
virtualinherited
template<typename TTreeType >
const TreeIteratorBase< TTreeType >::TreeNodeType * itk::TreeIteratorBase< TTreeType >::GetNode ( ) const
virtualinherited

Get the node pointed by the iterator

Definition at line 458 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
const TreeIteratorBase< TTreeType >::TreeNodeType * itk::TreeIteratorBase< TTreeType >::GetParent ( ) const
inherited

Return the first parent found

Definition at line 352 of file itkTreeIteratorBase.hxx.

References NULL.

Referenced by itk::TreeContainer< TValueType >::PrintSelf().

template<typename TTreeType >
TreeIteratorBase< TTreeType >::TreeNodeType * itk::TreeIteratorBase< TTreeType >::GetRoot ( )
inherited

Get the root

Definition at line 466 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
const TreeIteratorBase< TTreeType >::TreeNodeType * itk::TreeIteratorBase< TTreeType >::GetRoot ( ) const
inherited

Get the root (const)

Definition at line 474 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::GetStartLevel ( ) const

Get the start level

Get the start Level

Definition at line 104 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType >
TTreeType * itk::TreeIteratorBase< TTreeType >::GetSubTree ( ) const
virtualinherited

Get the subtree

Return the subtree

Definition at line 217 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
TTreeType * itk::TreeIteratorBase< TTreeType >::GetTree ( ) const
inherited

Get the tree

Return the tree

Definition at line 526 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
LevelOrderTreeIterator< TTreeType >::NodeType itk::LevelOrderTreeIterator< TTreeType >::GetType ( void  ) const
virtual

Get the type of the iterator

Return the type of iterator

Implements itk::TreeIteratorBase< TTreeType >.

Definition at line 76 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType>
void itk::TreeIteratorBase< TTreeType >::GoToBegin ( void  )
inlineinherited
template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::GoToChild ( ChildIdentifier  number = 0)
virtualinherited

Go to the specified child

Go to a child

Reimplemented in itk::ChildTreeIterator< TTreeType >.

Definition at line 374 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType>
void itk::TreeIteratorBase< TTreeType >::GoToEnd ( void  )
inlineinherited

Move an iterator to the end of the tree.

Definition at line 152 of file itkTreeIteratorBase.h.

References itk::TreeIteratorBase< TTreeType >::m_End, and itk::TreeIteratorBase< TTreeType >::m_Position.

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::GoToParent ( )
virtualinherited

Go to the parent

Go to a parent

Reimplemented in itk::ChildTreeIterator< TTreeType >.

Definition at line 393 of file itkTreeIteratorBase.hxx.

References NULL.

Referenced by otb::VectorData< TPrecision, VDimension, TValuePrecision >::PrintSelf().

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::HasChild ( int  number = 0) const
virtualinherited

Return true if the current node has a child

Return true of the current node has a child

Definition at line 228 of file itkTreeIteratorBase.hxx.

References NULL.

Referenced by itk::LeafTreeIterator< TTreeType >::FindNextNode().

template<typename TTreeType >
bool itk::LevelOrderTreeIterator< TTreeType >::HasNext ( ) const
protectedvirtual

Return true if the next node exists

Return true if the next value exists

Implements itk::TreeIteratorBase< TTreeType >.

Definition at line 84 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::HasParent ( ) const
virtualinherited

Return true if the current node has a parent

Return true of the pointed node has a parent

Definition at line 296 of file itkTreeIteratorBase.hxx.

References NULL.

Referenced by itk::TreeContainer< TValueType >::IsRoot(), and otb::VectorData< TPrecision, VDimension, TValuePrecision >::PrintSelf().

template<typename TTreeType>
bool itk::TreeIteratorBase< TTreeType >::IsAtBegin ( void  ) const
inlineinherited

Is the iterator at the beginning of the tree?

Definition at line 155 of file itkTreeIteratorBase.h.

References itk::TreeIteratorBase< TTreeType >::m_Begin, and itk::TreeIteratorBase< TTreeType >::m_Position.

template<typename TTreeType>
bool itk::TreeIteratorBase< TTreeType >::IsAtEnd ( void  ) const
inlineinherited
template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::IsLeaf ( ) const
virtualinherited

Return true if the current node is a leaf

Return true if the current pointed node is a leaf

Definition at line 162 of file itkTreeIteratorBase.hxx.

Referenced by itk::TreeContainer< TValueType >::IsLeaf().

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::IsRoot ( ) const
virtualinherited

Return true if the current node is a root

Return true if the current pointed node is a root

Definition at line 170 of file itkTreeIteratorBase.hxx.

References NULL.

template<typename TTreeType >
const LevelOrderTreeIterator< TTreeType >::ValueType & itk::LevelOrderTreeIterator< TTreeType >::Next ( )
protectedvirtual

Return the next node

Implements itk::TreeIteratorBase< TTreeType >.

Definition at line 96 of file itkLevelOrderTreeIterator.hxx.

template<typename TTreeType>
Self& itk::TreeIteratorBase< TTreeType >::operator++ ( )
inlineinherited

operator++

Definition at line 166 of file itkTreeIteratorBase.h.

References itk::TreeIteratorBase< TTreeType >::Next().

template<typename TTreeType>
void itk::TreeIteratorBase< TTreeType >::operator++ ( int  )
inlineinherited

operator++

Definition at line 174 of file itkTreeIteratorBase.h.

References itk::TreeIteratorBase< TTreeType >::Next().

template<typename TTreeType>
const Self& itk::LevelOrderTreeIterator< TTreeType >::operator= ( const Self iterator)
inline
template<typename TTreeType >
TreeIteratorBase< TTreeType > * itk::TreeIteratorBase< TTreeType >::Parents ( )
virtualinherited

Return a list of parents

Return the list of parents

Definition at line 364 of file itkTreeIteratorBase.hxx.

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::Remove ( )
inherited

Remove the current node from the tree

Remove a specific node (and its child nodes!)

Definition at line 482 of file itkTreeIteratorBase.hxx.

References NULL.

Referenced by itk::TreeContainer< TValueType >::Clear().

template<typename TTreeType >
bool itk::TreeIteratorBase< TTreeType >::RemoveChild ( int  number)
virtualinherited

Remove a child

Definition at line 256 of file itkTreeIteratorBase.hxx.

References itk::TreeIteratorBase< TTreeType >::m_Position, and NULL.

template<typename TTreeType >
void itk::TreeIteratorBase< TTreeType >::Set ( ValueType  element)
inherited

Set the current value of the node

Definition at line 88 of file itkTreeIteratorBase.hxx.

Member Data Documentation

template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Begin
mutableprotectedinherited
template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_End
mutableprotectedinherited
template<typename TTreeType>
int itk::LevelOrderTreeIterator< TTreeType >::m_EndLevel
private
template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Position
mutableprotectedinherited
template<typename TTreeType>
std::queue< const TreeNodeType * > itk::LevelOrderTreeIterator< TTreeType >::m_Queue
mutableprivate
template<typename TTreeType>
const TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Root
protectedinherited
template<typename TTreeType>
int itk::LevelOrderTreeIterator< TTreeType >::m_StartLevel
private
template<typename TTreeType>
TTreeType* itk::TreeIteratorBase< TTreeType >::m_Tree
protectedinherited

The documentation for this class was generated from the following files:

Generated at Sat Mar 8 2014 17:20:15 for Orfeo Toolbox with doxygen 1.8.3.1