ITK  5.0.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
itk::LevelOrderTreeIterator< TTreeType > Class Template Reference

#include <itkLevelOrderTreeIterator.h>

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

Detailed Description

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

Iterate over a tree in level order.

Examples:
Examples/DataRepresentation/Containers/TreeContainer.cxx.

Definition at line 34 of file itkLevelOrderTreeIterator.h.

Public Types

using NodeType = typename Superclass::NodeType
 
using Self = LevelOrderTreeIterator
 
using Superclass = TreeIteratorBase< TTreeType >
 
using TreeNodeType = typename Superclass::TreeNodeType
 
using TreeType = TTreeType
 
using ValueType = typename TTreeType::ValueType
 
- Public Types inherited from itk::TreeIteratorBase< TTreeType >
using ChildIdentifier = typename TreeNodeType::ChildIdentifier
 
enum  NodeType {
  UNDEFIND = 0,
  PREORDER = 1,
  INORDER = 2,
  POSTORDER = 3,
  LEVELORDER = 4,
  CHILD = 5,
  ROOT = 6,
  LEAF = 7
}
 
using Self = TreeIteratorBase
 
using TreeNodeType = typename TTreeType::TreeNodeType
 
using ValueType = typename TTreeType::ValueType
 

Public Member Functions

TreeIteratorBase< TTreeType > * Clone () override
 
int GetEndLevel () const
 
int GetLevel () const
 
int GetStartLevel () const
 
NodeType GetType () const override
 
 LevelOrderTreeIterator (TreeType *tree, int endLevel=INT_MAX, const TreeNodeType *start=nullptr)
 
 LevelOrderTreeIterator (TreeType *tree, int startLevel, int endLevel, const TreeNodeType *start=nullptr)
 
 ~LevelOrderTreeIterator () override=default
 
const Selfoperator= (const Self &iterator)
 
- Public Member Functions inherited from itk::TreeIteratorBase< TTreeType >
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 ()
 
virtual int Count ()
 
virtual int CountChildren () const
 
virtual bool Disconnect ()
 
virtual const ValueTypeGet () const
 
virtual TreeIteratorBase
< TTreeType > * 
GetChild (int number) const
 
virtual TreeNodeTypeGetNode ()
 
virtual const TreeNodeTypeGetNode () const
 
const TreeNodeTypeGetParent () const
 
TreeNodeTypeGetRoot ()
 
const TreeNodeTypeGetRoot () const
 
virtual TTreeType * GetSubTree () const
 
TTreeType * GetTree () 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 () const
 
bool IsAtEnd () const
 
virtual bool IsLeaf () const
 
virtual bool IsRoot () const
 
void operator++ (int)
 
virtual TreeIteratorBase
< TTreeType > * 
Parents ()
 
bool Remove ()
 
virtual bool RemoveChild (int number)
 
void Set (ValueType element)
 
virtual ~TreeIteratorBase ()=default
 
Selfoperator++ ()
 
Selfoperator= (const Self &iterator)
 

Protected Member Functions

bool HasNext () const override
 
const ValueTypeNext () override
 
- Protected Member Functions inherited from itk::TreeIteratorBase< TTreeType >
 TreeIteratorBase (TTreeType *tree, const TreeNodeType *start)
 
 TreeIteratorBase (const TTreeType *tree, const TreeNodeType *start)
 

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
 

Additional Inherited Members

- Protected Attributes inherited from itk::TreeIteratorBase< TTreeType >
TreeNodeTypem_Begin
 
TreeNodeTypem_End
 
TreeNodeTypem_Position
 
const TreeNodeTypem_Root
 
TTreeType * m_Tree
 

Member Typedef Documentation

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::NodeType = typename Superclass::NodeType

Definition at line 44 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::Self = LevelOrderTreeIterator

Typedefs

Definition at line 39 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::Superclass = TreeIteratorBase< TTreeType >

Definition at line 40 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::TreeNodeType = typename Superclass::TreeNodeType

Definition at line 43 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::TreeType = TTreeType

Definition at line 41 of file itkLevelOrderTreeIterator.h.

template<typename TTreeType >
using itk::LevelOrderTreeIterator< TTreeType >::ValueType = typename 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 = nullptr 
)

Constructor with end level specification

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

Constructor with end level specification

template<typename TTreeType >
itk::LevelOrderTreeIterator< TTreeType >::~LevelOrderTreeIterator ( )
overridedefault

Member Function Documentation

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

Clone function

Implements itk::TreeIteratorBase< TTreeType >.

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

Get the end level

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

Get the current level

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

Get the start level

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

Get the type of the iterator

Implements itk::TreeIteratorBase< TTreeType >.

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

Return true if the next node exists

Implements itk::TreeIteratorBase< TTreeType >.

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

Return the next node

Implements itk::TreeIteratorBase< TTreeType >.

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

Member Data Documentation

template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::m_EndLevel
private
template<typename TTreeType >
std::queue< const TreeNodeType * > itk::LevelOrderTreeIterator< TTreeType >::m_Queue
mutableprivate
template<typename TTreeType >
int itk::LevelOrderTreeIterator< TTreeType >::m_StartLevel
private

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