VTK
9.1.0
|
Thread local storage for VTK objects. More...
#include <vtkSMPThreadLocalObject.h>
Classes | |
class | iterator |
Subset of the standard iterator API. More... | |
Public Member Functions | |
vtkSMPThreadLocalObject () | |
Default constructor. | |
vtkSMPThreadLocalObject (T *const &exemplar) | |
virtual | ~vtkSMPThreadLocalObject () |
size_t | size () const |
Return the number of thread local objects that have been initialized. | |
T *& | Local () |
Returns an object local to the current thread. | |
iterator | begin () |
iterator | end () |
Thread local storage for VTK objects.
This class essentially does the same thing as vtkSMPThreadLocal with 2 additional functions:
* vtkSMPThreadLocal<int> Foo; * vtkSMPThreadLocal<int> Bar; * class AFunctor * { * void Initialize() const * { * int& foo = Foo.Local(); * int& bar = Bar.Local(); * foo = random(); * bar = foo; * } * * @warning * void operator()(vtkIdType, vtkIdType) * {} * void Finalize() * {} * }; * * @warning * AFunctor functor; * vtkSMPTools::For(0, 100000, functor); * * @warning * vtkSMPThreadLocal<int>::iterator itr1 = Foo.begin(); * vtkSMPThreadLocal<int>::iterator itr2 = Bar.begin(); * while (itr1 != Foo.end()) * { * assert(*itr1 == *itr2); * ++itr1; ++itr2; * } *
Definition at line 80 of file vtkSMPThreadLocalObject.h.
|
inline |
Default constructor.
Definition at line 94 of file vtkSMPThreadLocalObject.h.
|
inline |
Definition at line 100 of file vtkSMPThreadLocalObject.h.
|
inlinevirtual |
Definition at line 106 of file vtkSMPThreadLocalObject.h.
|
inline |
Returns an object local to the current thread.
This object is allocated with T::New() and will be deleted in the destructor of vtkSMPThreadLocalObject.
Definition at line 125 of file vtkSMPThreadLocalObject.h.
|
inline |
Return the number of thread local objects that have been initialized.
Definition at line 146 of file vtkSMPThreadLocalObject.h.
|
inline |
Definition at line 186 of file vtkSMPThreadLocalObject.h.
|
inline |
Definition at line 193 of file vtkSMPThreadLocalObject.h.