ITK  5.1.0
Insight Toolkit
itkChildTreeIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkChildTreeIterator_h
19 #define itkChildTreeIterator_h
20 
21 #include "itkTreeIteratorBase.h"
22 
23 namespace itk
24 {
25 template <typename TTreeType>
26 class ITK_TEMPLATE_EXPORT ChildTreeIterator : public TreeIteratorBase<TTreeType>
27 {
28 public:
32  using TreeType = TTreeType;
33  using ValueType = typename TTreeType::ValueType;
35  using ChildIdentifier = typename TreeNodeType::ChildIdentifier;
36  using NodeType = typename Superclass::NodeType;
37 
39  ChildTreeIterator(TreeType * tree, const TreeNodeType * start = nullptr);
40 
43 
45  NodeType
46  GetType() const override;
47 
49  bool
50  GoToChild(ChildIdentifier number = 0) override;
51 
53  bool
54  GoToParent() override;
55 
58  Clone() override;
59 
61  Self &
62  operator=(Superclass & iterator)
63  {
64  if (this != &iterator)
65  {
66  Superclass::operator=(iterator);
67  auto & it = static_cast<ChildTreeIterator<TTreeType> &>(iterator);
68  m_ListPosition = it.m_ListPosition;
69  m_ParentNode = it.m_ParentNode;
70  }
71  return *this;
72  }
74 
75 protected:
77  const ValueType &
78  Next() override;
79 
81  bool
82  HasNext() const override;
83 
84 private:
87 };
88 
89 } // end namespace itk
90 
91 #ifndef ITK_MANUAL_INSTANTIATION
92 # include "itkChildTreeIterator.hxx"
93 #endif
94 
95 #endif
itk::ChildTreeIterator
Definition: itkChildTreeIterator.h:26
itkTreeIteratorBase.h
itk::ChildTreeIterator::ValueType
typename TTreeType::ValueType ValueType
Definition: itkChildTreeIterator.h:33
itk::TreeIteratorBase
This class provides the base implementation for tree iterators.
Definition: itkTreeIteratorBase.h:58
itk::ChildTreeIterator::m_ParentNode
TreeNodeType * m_ParentNode
Definition: itkChildTreeIterator.h:86
itk::ChildTreeIterator::ChildIdentifier
typename TreeNodeType::ChildIdentifier ChildIdentifier
Definition: itkChildTreeIterator.h:35
itk::ChildTreeIterator::TreeNodeType
typename Superclass::TreeNodeType TreeNodeType
Definition: itkChildTreeIterator.h:34
itk::ChildTreeIterator::NodeType
typename Superclass::NodeType NodeType
Definition: itkChildTreeIterator.h:36
itk::ChildTreeIterator::m_ListPosition
ChildIdentifier m_ListPosition
Definition: itkChildTreeIterator.h:85
itk::ChildTreeIterator::operator=
Self & operator=(Superclass &iterator)
Definition: itkChildTreeIterator.h:62
itk::TreeIteratorBaseNodeEnum
TreeIteratorBaseNodeEnum
Definition: itkTreeIteratorBase.h:29
itk::TreeIteratorBase::TreeNodeType
typename TTreeType::TreeNodeType TreeNodeType
Definition: itkTreeIteratorBase.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ChildTreeIterator::TreeType
TTreeType TreeType
Definition: itkChildTreeIterator.h:32