ITK  5.2.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  * 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 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  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 
89  bool
90  operator!=(const DataObjectConstIterator & iter) const
91  {
92  return !(*this == iter);
93  }
94 
95  void
97  {
99  }
100 
101  bool
102  IsAtEnd() const
103  {
104  return m_Iterator == m_End;
105  }
106 
107 protected:
108  using InternalIteratorType = ProcessObject::DataObjectPointerMap::const_iterator;
112 };
113 } // namespace itk
114 #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:109
itk::DataObjectConstIterator::m_End
InternalIteratorType m_End
Definition: itkDataObjectConstIterator.h:111
itk::DataObjectConstIterator::operator==
bool operator==(const DataObjectConstIterator &iter) const
Definition: itkDataObjectConstIterator.h:84
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:110
itk::DataObject::DataObjectIdentifierType
std::string DataObjectIdentifierType
Definition: itkDataObject.h:304
itk::DataObjectConstIterator::operator!=
bool operator!=(const DataObjectConstIterator &iter) const
Definition: itkDataObjectConstIterator.h:90
itk::DataObjectConstIterator
A forward iterator over the DataObject of a ProcessObject.
Definition: itkDataObjectConstIterator.h:30
itk::DataObjectConstIterator::GoToBegin
void GoToBegin()
Definition: itkDataObjectConstIterator.h:96
itk::DataObjectConstIterator::DataObjectIdentifierType
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Definition: itkDataObjectConstIterator.h:33
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
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:108
itk::DataObjectConstIterator::IsAtEnd
bool IsAtEnd() const
Definition: itkDataObjectConstIterator.h:102
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293