ITK  6.0.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
24namespace itk
25{
26
27// Forward reference because of circular dependencies
28template <typename TIterator>
29class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner;
30
38template <typename TIterator>
40{
41public:
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
81private:
82 friend class ThreadedIteratorRangePartitioner<IteratorType>;
85};
86
111template <typename TIterator>
112class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
113 : public ThreadedDomainPartitioner<ThreadedIteratorRangePartitionerDomain<TIterator>>
114{
115public:
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
149 const ThreadIdType requestedTotal,
150 const DomainType & completeDomain,
151 DomainType & subDomain) const override;
152
153protected:
156};
157
158} // end namespace itk
159
160#ifndef ITK_MANUAL_INSTANTIATION
161# include "itkThreadedIteratorRangePartitioner.hxx"
162#endif
163
164#endif
Light weight base class for most itk classes.
Virtual base class for partitioning a domain into subsets to be processed per thread when parallel pr...
Domain type for the ThreadedIteratorRangePartitioner.
ThreadedIteratorRangePartitionerDomain(const IteratorType &begin, const IteratorType &end)
Partitions an iterator range for threading.
~ThreadedIteratorRangePartitioner() override=default
ThreadIdType PartitionDomain(const ThreadIdType threadId, const ThreadIdType requestedTotal, const DomainType &completeDomain, DomainType &subDomain) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
unsigned int ThreadIdType
Definition: itkIntTypes.h:102