ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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 : m_Begin(begin)
49 , m_End(end)
50 {}
51
53 : m_Begin(rhs.m_Begin)
54 , m_End(rhs.m_End)
55 {}
56
57 void
58 operator=(const Self & rhs)
59 {
60 if (this == &rhs)
61 {
62 return;
63 }
64 this->m_Begin = rhs.m_Begin;
65 this->m_End = rhs.m_End;
66 }
67
68 [[nodiscard]] const IteratorType &
69 Begin() const
70 {
71 return this->m_Begin;
72 }
73 [[nodiscard]] const IteratorType &
74 End() const
75 {
76 return this->m_End;
77 }
78
79private:
80 friend class ThreadedIteratorRangePartitioner<IteratorType>;
83};
84
109template <typename TIterator>
110class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
111 : public ThreadedDomainPartitioner<ThreadedIteratorRangePartitionerDomain<TIterator>>
112{
113public:
114 ITK_DISALLOW_COPY_AND_MOVE(ThreadedIteratorRangePartitioner);
115
121
123 itkNewMacro(Self);
124
126 itkOverrideGetNameOfClassMacro(ThreadedIteratorRangePartitioner);
127
129 using typename Superclass::DomainType;
130
131 using IteratorType = TIterator;
132
144
147 const ThreadIdType requestedTotal,
148 const DomainType & completeDomain,
149 DomainType & subDomain) const override;
150
151protected:
154};
155
156} // end namespace itk
157
158#ifndef ITK_MANUAL_INSTANTIATION
159# include "itkThreadedIteratorRangePartitioner.hxx"
160#endif
161
162#endif
Implements transparent reference counting.
ThreadedIteratorRangePartitionerDomain(const IteratorType &begin, const IteratorType &end)
Partitions an iterator range for threading.
ThreadedDomainPartitioner< ThreadedIteratorRangePartitionerDomain< TIterator > > Superclass
~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....
unsigned int ThreadIdType