ITK  5.4.0
Insight Toolkit
itkThreadedIteratorRangePartitioner.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 itkThreadedIteratorRangePartitioner_h
19 #define itkThreadedIteratorRangePartitioner_h
20 
22 #include "itkObjectFactory.h"
23 
24 namespace itk
25 {
26 
27 // Forward reference because of circular dependencies
28 template <typename TIterator>
29 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner;
30 
38 template <typename TIterator>
39 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitionerDomain
40 {
41 public:
42  using IteratorType = TIterator;
44 
46 
48  {
49  this->m_Begin = begin;
50  this->m_End = end;
51  }
52 
54  {
55  this->m_Begin = rhs.m_Begin;
56  this->m_End = rhs.m_End;
57  }
58 
59  void
60  operator=(const Self & rhs)
61  {
62  if (this == &rhs)
63  {
64  return;
65  }
66  this->m_Begin = rhs.m_Begin;
67  this->m_End = rhs.m_End;
68  }
69 
70  const IteratorType &
71  Begin() const
72  {
73  return this->m_Begin;
74  }
75  const IteratorType &
76  End() const
77  {
78  return this->m_End;
79  }
80 
81 private:
85 };
86 
111 template <typename TIterator>
112 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
113  : public ThreadedDomainPartitioner<ThreadedIteratorRangePartitionerDomain<TIterator>>
114 {
115 public:
116  ITK_DISALLOW_COPY_AND_MOVE(ThreadedIteratorRangePartitioner);
117 
123 
125  itkNewMacro(Self);
126 
128  itkOverrideGetNameOfClassMacro(ThreadedIteratorRangePartitioner);
129 
131  using typename Superclass::DomainType;
132 
133  using IteratorType = TIterator;
134 
148  PartitionDomain(const ThreadIdType threadId,
149  const ThreadIdType requestedTotal,
150  const DomainType & completeDomain,
151  DomainType & subDomain) const override;
152 
153 protected:
155  ~ThreadedIteratorRangePartitioner() override = default;
156 };
157 
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 # include "itkThreadedIteratorRangePartitioner.hxx"
162 #endif
163 
164 #endif
itkObjectFactory.h
itk::ThreadedIteratorRangePartitioner
class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
Definition: itkThreadedIteratorRangePartitioner.h:29
itk::ThreadedIteratorRangePartitionerDomain
Domain type for the ThreadedIteratorRangePartitioner.
Definition: itkThreadedIteratorRangePartitioner.h:39
itk::ThreadedIteratorRangePartitioner::IteratorType
TIterator IteratorType
Definition: itkThreadedIteratorRangePartitioner.h:133
itk::ThreadedIteratorRangePartitionerDomain::m_Begin
IteratorType m_Begin
Definition: itkThreadedIteratorRangePartitioner.h:83
itk::SmartPointer< Self >
itkThreadedDomainPartitioner.h
itk::ThreadedIteratorRangePartitionerDomain::ThreadedIteratorRangePartitionerDomain
ThreadedIteratorRangePartitionerDomain(const IteratorType &begin, const IteratorType &end)
Definition: itkThreadedIteratorRangePartitioner.h:47
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ThreadedIteratorRangePartitionerDomain::Begin
const IteratorType & Begin() const
Definition: itkThreadedIteratorRangePartitioner.h:71
itk::ThreadedIteratorRangePartitionerDomain::IteratorType
TIterator IteratorType
Definition: itkThreadedIteratorRangePartitioner.h:42
itk::ThreadedIteratorRangePartitionerDomain::m_End
IteratorType m_End
Definition: itkThreadedIteratorRangePartitioner.h:84
itk::ThreadedIteratorRangePartitionerDomain::operator=
void operator=(const Self &rhs)
Definition: itkThreadedIteratorRangePartitioner.h:60
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ThreadedDomainPartitioner
Virtual base class for partitioning a domain into subsets to be processed per thread when parallel pr...
Definition: itkThreadedDomainPartitioner.h:47
itk::ThreadedIteratorRangePartitionerDomain::End
const IteratorType & End() const
Definition: itkThreadedIteratorRangePartitioner.h:76
itk::ThreadedIteratorRangePartitioner
Partitions an iterator range for threading.
Definition: itkThreadedIteratorRangePartitioner.h:112
itk::ThreadedIteratorRangePartitionerDomain::ThreadedIteratorRangePartitionerDomain
ThreadedIteratorRangePartitionerDomain(const Self &rhs)
Definition: itkThreadedIteratorRangePartitioner.h:53