36 #ifndef vtkSMPThreadLocal_h 37 #define vtkSMPThreadLocal_h 46 typedef std::vector<T> TLS;
47 typedef typename TLS::iterator TLSIter;
61 : NumInitialized(0), Exemplar(exemplar)
76 int tid = this->GetThreadID();
77 if (!this->Initialized[tid])
79 this->Internal[tid] = this->Exemplar;
80 this->Initialized[tid] =
true;
81 ++this->NumInitialized;
83 return this->Internal[tid];
90 return this->NumInitialized;
111 while(this->InitIter != this->EndIter)
132 return this->Iter == other.Iter;
137 return this->Iter != other.Iter;
152 std::vector<bool>::iterator InitIter;
153 std::vector<bool>::iterator EndIter;
162 TLSIter iter = this->Internal.begin();
163 std::vector<bool>::iterator iter2 =
164 this->Initialized.begin();
165 std::vector<bool>::iterator enditer =
166 this->Initialized.end();
169 while(iter2 != enditer)
179 retVal.InitIter = iter2;
180 retVal.EndIter = enditer;
191 retVal.InitIter = this->Initialized.end();
192 retVal.EndIter = this->Initialized.end();
193 retVal.Iter = this->Internal.end();
199 std::vector<bool> Initialized;
200 size_t NumInitialized;
205 this->Internal.resize(this->GetNumberOfThreads());
206 this->Initialized.resize(this->GetNumberOfThreads());
207 std::fill(this->Initialized.begin(),
208 this->Initialized.end(),
212 inline int GetNumberOfThreads()
217 inline int GetThreadID()
vtkSMPThreadLocal(const T &exemplar)
bool operator!=(const iterator &other)
bool operator==(const iterator &other)