ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkThreadedIteratorRangePartitioner.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkThreadedIteratorRangePartitioner_h
19 #define itkThreadedIteratorRangePartitioner_h
20 
22 
23 namespace itk
24 {
25 
26 // Forward reference because of circular dependencies
27 template< typename TIterator >
28 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner;
29 
37 template< typename TIterator >
38 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitionerDomain
39 {
40 public:
41  typedef TIterator IteratorType;
43 
45 
47  {
48  this->m_Begin = begin;
49  this->m_End = end;
50  }
51 
53  {
54  this->m_Begin = rhs.m_Begin;
55  this->m_End = rhs.m_End;
56  }
57 
58  void 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  const IteratorType & Begin() const
69  {
70  return this->m_Begin;
71  }
72  const IteratorType & End() const
73  {
74  return this->m_End;
75  }
76 
77 private:
81 };
82 
107 template< typename TIterator >
108 class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
109  : public ThreadedDomainPartitioner< ThreadedIteratorRangePartitionerDomain< TIterator > >
110 {
111 public:
117 
119  itkNewMacro(Self);
120 
123 
125  typedef typename Superclass::DomainType DomainType;
126 
127  typedef TIterator IteratorType;
128 
140  virtual
141  ThreadIdType PartitionDomain(const ThreadIdType threadId,
142  const ThreadIdType requestedTotal,
143  const DomainType& completeDomain,
144  DomainType& subDomain) const ITK_OVERRIDE;
145 
146 protected:
148  virtual ~ThreadedIteratorRangePartitioner() ITK_OVERRIDE;
149 
150 private:
151  ITK_DISALLOW_COPY_AND_ASSIGN(ThreadedIteratorRangePartitioner);
152 
153 };
154 
155 } // end namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "itkThreadedIteratorRangePartitioner.hxx"
159 #endif
160 
161 #endif
Light weight base class for most itk classes.
class ITK_TEMPLATE_EXPORT ThreadedIteratorRangePartitioner
Virtual base class for partitioning a domain into subsets to be processed per thread when parallel pr...
ThreadedIteratorRangePartitionerDomain(const IteratorType &begin, const IteratorType &end)
ThreadedDomainPartitioner< ThreadedIteratorRangePartitionerDomain< TIterator > > Superclass
Partitions an iterator range for threading.
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Domain type for the ThreadedIteratorRangePartitioner.