ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkThreadedIteratorRangePartitioner_h 00019 #define __itkThreadedIteratorRangePartitioner_h 00020 00021 #include "itkThreadedDomainPartitioner.h" 00022 00023 namespace itk 00024 { 00025 00026 template< class TIterator > 00027 class ThreadedIteratorRangePartitioner; 00028 00036 template< class TIterator > 00037 class ThreadedIteratorRangePartitionerDomain 00038 { 00039 public: 00040 typedef TIterator IteratorType; 00041 typedef ThreadedIteratorRangePartitionerDomain Self; 00042 00043 ThreadedIteratorRangePartitionerDomain() {} 00044 00045 ThreadedIteratorRangePartitionerDomain( const IteratorType & begin, const IteratorType & end ) 00046 { 00047 this->m_Begin = begin; 00048 this->m_End = end; 00049 } 00050 00051 ThreadedIteratorRangePartitionerDomain( const Self & rhs ) 00052 { 00053 this->m_Begin = rhs.m_Begin; 00054 this->m_End = rhs.m_End; 00055 } 00056 00057 void operator=( const Self & rhs ) 00058 { 00059 if ( this == & rhs ) 00060 { 00061 return; 00062 } 00063 this->m_Begin = rhs.m_Begin; 00064 this->m_End = rhs.m_End; 00065 } 00066 00067 const IteratorType & Begin() const 00068 { 00069 return this->m_Begin; 00070 } 00071 const IteratorType & End() const 00072 { 00073 return this->m_End; 00074 } 00075 00076 private: 00077 friend class ThreadedIteratorRangePartitioner< IteratorType >; 00078 IteratorType m_Begin; 00079 IteratorType m_End; 00080 }; 00081 00103 template< class TIterator > 00104 class ITK_EXPORT ThreadedIteratorRangePartitioner 00105 : public ThreadedDomainPartitioner< ThreadedIteratorRangePartitionerDomain< TIterator > > 00106 { 00107 public: 00109 typedef ThreadedIteratorRangePartitioner Self; 00110 typedef ThreadedDomainPartitioner< ThreadedIteratorRangePartitionerDomain< TIterator > > Superclass; 00111 typedef SmartPointer< Self > Pointer; 00112 typedef SmartPointer< const Self > ConstPointer; 00113 00115 itkNewMacro(Self); 00116 00118 itkTypeMacro(ThreadedIteratorRangePartitioner, ThreadedDomainPartitioner); 00119 00121 typedef typename Superclass::DomainType DomainType; 00122 00123 typedef TIterator IteratorType; 00124 00131 virtual 00132 ThreadIdType PartitionDomain(const ThreadIdType i, 00133 const ThreadIdType requestedTotal, 00134 const DomainType& completeDomain, 00135 DomainType& subdomain) const; 00136 protected: 00137 ThreadedIteratorRangePartitioner(); 00138 virtual ~ThreadedIteratorRangePartitioner(); 00140 00141 private: 00142 ThreadedIteratorRangePartitioner(const Self&); //purposely not implemented 00143 void operator=(const Self&); //purposely not implemented 00144 00145 }; 00146 00147 } // end namespace itk 00148 00149 #ifndef ITK_MANUAL_INSTANTIATION 00150 #include "itkThreadedIteratorRangePartitioner.hxx" 00151 #endif 00152 00153 #endif 00154