VTK
|
Thread local storage for VTK objects. More...
#include <vtkSMPThreadLocalObject.h>
Classes | |
class | iterator |
Public Member Functions | |
virtual | ~vtkSMPThreadLocalObject () |
vtkSMPThreadLocalObject () | |
T *& | Local () |
iterator | begin () |
iterator | end () |
Thread local storage for VTK objects.
This class essentially does the same thing as vtkSMPThreadLocal with 2 additional functions:
The destructor calls Delete() on all objects created with Local().
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 82 of file vtkSMPThreadLocalObject.h.
vtkSMPThreadLocalObject< T >::vtkSMPThreadLocalObject | ( | ) | [inline] |
Default constructor.
Definition at line 95 of file vtkSMPThreadLocalObject.h.
virtual vtkSMPThreadLocalObject< T >::~vtkSMPThreadLocalObject | ( | ) | [inline, virtual] |
Definition at line 100 of file vtkSMPThreadLocalObject.h.
T*& vtkSMPThreadLocalObject< T >::Local | ( | ) | [inline] |
Returns an object local to the current thread. This object is allocated with ::New() and will be deleted in the destructor of vtkSMPThreadLocalObject.
Definition at line 117 of file vtkSMPThreadLocalObject.h.
iterator vtkSMPThreadLocalObject< T >::begin | ( | ) | [inline] |
Definition at line 158 of file vtkSMPThreadLocalObject.h.
iterator vtkSMPThreadLocalObject< T >::end | ( | ) | [inline] |
Definition at line 165 of file vtkSMPThreadLocalObject.h.