ITK  6.0.0
Insight Toolkit
itkDataObjectConstIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 itkDataObjectConstIterator_h
19 #define itkDataObjectConstIterator_h
20 
21 #include "itkProcessObject.h"
22 
23 namespace itk
24 {
31 {
32 public:
34 
35  DataObjectConstIterator() = default;
36 
38  {
39  m_Iterator = iter.m_Iterator;
40  m_Begin = iter.m_Begin;
41  m_End = iter.m_End;
42  }
43 
46  {
47  if (this != &iter)
48  {
49  m_Iterator = iter.m_Iterator;
50  m_Begin = iter.m_Begin;
51  m_End = iter.m_End;
52  }
53  return *this;
54  }
55 
56  const DataObject *
57  GetDataObject() const
58  {
59  return m_Iterator->second;
60  }
61 
63  GetName() const
64  {
65  return m_Iterator->first;
66  }
67 
70  {
71  const DataObjectConstIterator tmp = *this;
72  ++(*this);
73  return tmp;
74  }
75 
78  {
79  ++m_Iterator;
80  return *this;
81  }
82 
83  bool
84  operator==(const DataObjectConstIterator & iter) const
85  {
86  return m_Iterator == iter.m_Iterator && m_Begin == iter.m_Begin && m_End == iter.m_End;
87  }
88 
90 
91  void
93  {
95  }
96 
97  bool
98  IsAtEnd() const
99  {
100  return m_Iterator == m_End;
101  }
102 
103 protected:
104  using InternalIteratorType = ProcessObject::DataObjectPointerMap::const_iterator;
108 };
109 } // namespace itk
110 #endif
itk::DataObjectConstIterator::GetDataObject
const DataObject * GetDataObject() const
Definition: itkDataObjectConstIterator.h:57
itk::DataObjectConstIterator::DataObjectConstIterator
DataObjectConstIterator(const DataObjectConstIterator &iter)
Definition: itkDataObjectConstIterator.h:37
itk::DataObjectConstIterator::GetName
const DataObjectIdentifierType & GetName() const
Definition: itkDataObjectConstIterator.h:63
itk::DataObjectConstIterator::m_Iterator
InternalIteratorType m_Iterator
Definition: itkDataObjectConstIterator.h:105
itk::DataObjectConstIterator::m_End
InternalIteratorType m_End
Definition: itkDataObjectConstIterator.h:107
itk::DataObjectConstIterator::operator==
bool operator==(const DataObjectConstIterator &iter) const
Definition: itkDataObjectConstIterator.h:84
itk::DataObjectConstIterator::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(DataObjectConstIterator)
itkProcessObject.h
itk::DataObjectConstIterator::DataObjectConstIterator
DataObjectConstIterator()=default
itk::DataObjectConstIterator::operator++
DataObjectConstIterator operator++(int)
Definition: itkDataObjectConstIterator.h:69
itk::DataObjectConstIterator::m_Begin
InternalIteratorType m_Begin
Definition: itkDataObjectConstIterator.h:106
itk::DataObject::DataObjectIdentifierType
std::string DataObjectIdentifierType
Definition: itkDataObject.h:304
itk::DataObjectConstIterator
A forward iterator over the DataObject of a ProcessObject.
Definition: itkDataObjectConstIterator.h:30
itk::DataObjectConstIterator::GoToBegin
void GoToBegin()
Definition: itkDataObjectConstIterator.h:92
itk::DataObjectConstIterator::DataObjectIdentifierType
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Definition: itkDataObjectConstIterator.h:33
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DataObjectConstIterator::operator=
DataObjectConstIterator & operator=(const DataObjectConstIterator &iter)
Definition: itkDataObjectConstIterator.h:45
itk::DataObjectConstIterator::operator++
DataObjectConstIterator & operator++()
Definition: itkDataObjectConstIterator.h:77
itk::DataObjectConstIterator::InternalIteratorType
ProcessObject::DataObjectPointerMap::const_iterator InternalIteratorType
Definition: itkDataObjectConstIterator.h:104
itk::DataObjectConstIterator::IsAtEnd
bool IsAtEnd() const
Definition: itkDataObjectConstIterator.h:98
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293