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

#include <itkTreeIteratorBase.h>

+ Inheritance diagram for itk::TreeIteratorBase< TTreeType >:

Detailed Description

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

This class provides the base implementation for tree iterators.

Events will notify interested observers about tree changes. These events all derive from TreeChangeEvent. They are:

All those events have a member GetChangePosition(), which returns an iterator to the position that has changd. Please note that this iterator may not be fully functional, but you should always be able to use its Get() method to retrieve the thing it points to.

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

Definition at line 42 of file itkTreeIteratorBase.h.

Public Types

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

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 TreeIteratorBase
< TTreeType > * 
Clone ()=0
 
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
 
virtual NodeType GetType () const =0
 
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

virtual bool HasNext () const =0
 
virtual const ValueTypeNext ()=0
 
 TreeIteratorBase (TTreeType *tree, const TreeNodeType *start)
 
 TreeIteratorBase (const TTreeType *tree, const TreeNodeType *start)
 

Protected Attributes

TreeNodeTypem_Begin
 
TreeNodeTypem_End
 
TreeNodeTypem_Position
 
const TreeNodeTypem_Root
 
TTreeType * m_Tree
 

Member Typedef Documentation

template<typename TTreeType>
using itk::TreeIteratorBase< TTreeType >::ChildIdentifier = typename TreeNodeType::ChildIdentifier

Definition at line 50 of file itkTreeIteratorBase.h.

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

Typedefs

Definition at line 47 of file itkTreeIteratorBase.h.

template<typename TTreeType>
using itk::TreeIteratorBase< TTreeType >::TreeNodeType = typename TTreeType::TreeNodeType

Definition at line 49 of file itkTreeIteratorBase.h.

template<typename TTreeType>
using itk::TreeIteratorBase< TTreeType >::ValueType = typename TTreeType::ValueType

Definition at line 48 of file itkTreeIteratorBase.h.

Member Enumeration Documentation

template<typename TTreeType>
enum itk::TreeIteratorBase::NodeType

Enumerations

Enumerator
UNDEFIND 
PREORDER 
INORDER 
POSTORDER 
LEVELORDER 
CHILD 
ROOT 
LEAF 

Definition at line 53 of file itkTreeIteratorBase.h.

Constructor & Destructor Documentation

template<typename TTreeType>
virtual itk::TreeIteratorBase< TTreeType >::~TreeIteratorBase ( )
virtualdefault
template<typename TTreeType>
itk::TreeIteratorBase< TTreeType >::TreeIteratorBase ( TTreeType *  tree,
const TreeNodeType start 
)
protected

Constructors

template<typename TTreeType>
itk::TreeIteratorBase< TTreeType >::TreeIteratorBase ( const TTreeType *  tree,
const TreeNodeType start 
)
protected

Constructors

Member Function Documentation

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

Add an element to the tree

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

Add an element at a given position

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

Add a subtree

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

Return the current ChildPosition of an element

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

Return a list of children

template<typename TTreeType>
virtual TreeIteratorBase< TTreeType >* itk::TreeIteratorBase< TTreeType >::Clone ( )
pure virtual
template<typename TTreeType>
virtual int itk::TreeIteratorBase< TTreeType >::Count ( )
virtual

Count the number of nodes

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

Count the number of children

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

Disconnect the tree

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

Return a list of child

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

Get the current node

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

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

Return the first parent found

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

Get the root

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

Get the subtree

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

Get the tree

template<typename TTreeType>
virtual NodeType itk::TreeIteratorBase< TTreeType >::GetType ( ) const
pure virtual
template<typename TTreeType>
void itk::TreeIteratorBase< TTreeType >::GoToBegin ( )
inline

Move an iterator to the beginning of the tree

Definition at line 149 of file itkTreeIteratorBase.h.

template<typename TTreeType>
virtual bool itk::TreeIteratorBase< TTreeType >::GoToChild ( ChildIdentifier  number = 0)
virtual

Go to the specified child

Reimplemented in itk::ChildTreeIterator< TTreeType >.

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

Move an iterator to the end of the tree.

Definition at line 152 of file itkTreeIteratorBase.h.

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

Go to the parent

Reimplemented in itk::ChildTreeIterator< TTreeType >.

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

Return true if the current node has a child

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

template<typename TTreeType>
virtual bool itk::TreeIteratorBase< TTreeType >::HasNext ( ) const
protectedpure virtual
template<typename TTreeType>
virtual bool itk::TreeIteratorBase< TTreeType >::HasParent ( ) const
virtual

Return true if the current node has a parent

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

Is the iterator at the beginning of the tree?

Definition at line 155 of file itkTreeIteratorBase.h.

template<typename TTreeType>
bool itk::TreeIteratorBase< TTreeType >::IsAtEnd ( ) const
inline

Is the iterator at the end of the tree?. The iterator is at the end if it points to nullptr

Definition at line 159 of file itkTreeIteratorBase.h.

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

template<typename TTreeType>
virtual bool itk::TreeIteratorBase< TTreeType >::IsLeaf ( ) const
virtual

Return true if the current node is a leaf

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

Return true if the current node is a root

template<typename TTreeType>
virtual const ValueType& itk::TreeIteratorBase< TTreeType >::Next ( )
protectedpure virtual
template<typename TTreeType>
Self& itk::TreeIteratorBase< TTreeType >::operator++ ( )
inline

operator++

Definition at line 166 of file itkTreeIteratorBase.h.

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

operator++

Definition at line 175 of file itkTreeIteratorBase.h.

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

Return a list of parents

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

Remove the current node from the tree

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

Remove a child

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

Set the current value of the node

Member Data Documentation

template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Begin
mutableprotected
template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_End
mutableprotected
template<typename TTreeType>
TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Position
mutableprotected
template<typename TTreeType>
const TreeNodeType* itk::TreeIteratorBase< TTreeType >::m_Root
protected
template<typename TTreeType>
TTreeType* itk::TreeIteratorBase< TTreeType >::m_Tree
protected

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