18 #ifndef itkPreOrderTreeIterator_h
19 #define itkPreOrderTreeIterator_h
26 template <
typename TTreeType>
29 template <
typename TTreeType>
71 template <
typename TTreeType>
77 template <
typename TTreeType>
85 template <
typename TTreeType>
89 if (const_cast<TreeNodeType *>(FindNextNode()) !=
nullptr)
98 template <
typename TTreeType>
102 this->m_Position = const_cast<TreeNodeType *>(FindNextNode());
103 if (this->m_Position ==
nullptr)
105 return this->m_Root->Get();
107 return this->m_Position->Get();
112 template <
typename TTreeType>
116 if (this->m_Position ==
nullptr)
120 if (this->m_Position->HasChildren())
122 return dynamic_cast<const TreeNodeType *>(this->m_Position->GetChild(0));
126 if (!this->m_Position->HasParent())
134 while (parent->HasParent())
137 parent = dynamic_cast<TreeNodeType *>(parent->GetParent());
140 if (parent->ChildPosition(this->m_Root) >= 0)
145 int childPosition = parent->ChildPosition(child);
146 int lastChildPosition = parent->CountChildren() - 1;
148 while (childPosition < lastChildPosition)
150 auto * help = dynamic_cast<TreeNodeType *>(parent->GetChild(childPosition + 1));
163 template <
typename TTreeType>