36 #ifndef vtkSMPThreadLocal_h 37 #define vtkSMPThreadLocal_h 47 typedef std::vector<T> TLS;
48 typedef typename TLS::iterator TLSIter;
62 : NumInitialized(0), Exemplar(exemplar)
77 int tid = this->GetThreadID();
78 if (!this->Initialized[tid])
80 this->Internal[tid] = this->Exemplar;
81 this->Initialized[tid] =
true;
82 ++this->NumInitialized;
84 return this->Internal[tid];
91 return this->NumInitialized;
103 :
public std::iterator<std::forward_iterator_tag, T>
113 while(this->InitIter != this->EndIter)
134 return this->Iter == other.Iter;
139 return this->Iter != other.Iter;
154 std::vector<bool>::iterator InitIter;
155 std::vector<bool>::iterator EndIter;
164 TLSIter iter = this->Internal.begin();
165 std::vector<bool>::iterator iter2 =
166 this->Initialized.begin();
167 std::vector<bool>::iterator enditer =
168 this->Initialized.end();
171 while(iter2 != enditer)
181 retVal.InitIter = iter2;
182 retVal.EndIter = enditer;
193 retVal.InitIter = this->Initialized.end();
194 retVal.EndIter = this->Initialized.end();
195 retVal.Iter = this->Internal.end();
201 std::vector<bool> Initialized;
202 size_t NumInitialized;
207 this->Internal.resize(this->GetNumberOfThreads());
208 this->Initialized.resize(this->GetNumberOfThreads());
209 std::fill(this->Initialized.begin(),
210 this->Initialized.end(),
214 inline int GetNumberOfThreads()
219 inline int GetThreadID()
vtkSMPThreadLocal(const T &exemplar)
bool operator!=(const iterator &other)
bool operator==(const iterator &other)