18 #ifndef __itkInOrderTreeIterator_h
19 #define __itkInOrderTreeIterator_h
25 template<
typename TTreeType >
64 template<
typename TTreeType >
70 template<
typename TTreeType >
76 template<
typename TTreeType >
84 template<
typename TTreeType >
87 if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR )
96 template<
typename TTreeType >
100 this->m_Position =
const_cast< TreeNodeType *
>( FindNextNode() );
101 return this->m_Position->Get();
106 template<
typename TTreeType >
110 if ( this->m_Position == ITK_NULLPTR )
115 if ( this->m_Position->HasChildren() )
117 return this->m_Position->GetChild(0);
120 if ( !this->m_Position->HasParent() )
128 int childPosition = parent->ChildPosition(child);
129 int lastChildPosition = parent->CountChildren() - 1;
131 while ( childPosition < lastChildPosition )
133 TreeNodeType *help = parent->GetChild(childPosition + 1);
134 if ( help != ITK_NULLPTR )
141 while ( parent->HasParent() )
144 parent = parent->GetParent();
147 if ( parent->ChildPosition(this->m_Root) >= 0 )
151 childPosition = parent->ChildPosition(child);
152 lastChildPosition = parent->CountChildren() - 1;
154 while ( childPosition < lastChildPosition )
156 TreeNodeType *help = parent->GetChild(childPosition + 1);
157 if ( help != ITK_NULLPTR )
167 template<
typename TTreeType >
TTreeType::TreeNodeType TreeNodeType
TTreeType::ValueType ValueType
Superclass::NodeType NodeType
Superclass::TreeNodeType TreeNodeType
TreeIteratorBase< TTreeType > * Clone()
const TreeNodeType * FindNextNode() const
InOrderTreeIterator(TreeType &start)
This class provides the base implementation for tree iterators.
TreeIteratorBase< TTreeType > Superclass