VTK  9.1.0
vtkSMPThreadLocal.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSMPThreadLocal.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
81#ifndef vtkSMPThreadLocal_h
82#define vtkSMPThreadLocal_h
83
85
86template <typename T>
88{
89public:
94 : ThreadLocalAPI()
95 {
96 }
97
103 explicit vtkSMPThreadLocal(const T& exemplar)
104 : ThreadLocalAPI(exemplar)
105 {
106 }
107
116 T& Local() { return this->ThreadLocalAPI.Local(); }
117
121 size_t size() { return this->ThreadLocalAPI.size(); }
122
133
138 iterator begin() { return this->ThreadLocalAPI.begin(); };
139
144 iterator end() { return this->ThreadLocalAPI.end(); }
145
146private:
148
149 // disable copying
150 vtkSMPThreadLocal(const vtkSMPThreadLocal&) = delete;
151 void operator=(const vtkSMPThreadLocal&) = delete;
152};
153
154#endif
155// VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
Thread local storage for VTK objects.
vtkSMPThreadLocal()
Default constructor.
iterator end()
Returns a new iterator pointing to past the end of the local storage container.
iterator begin()
Returns a new iterator pointing to the beginning of the local storage container.
size_t size()
Return the number of thread local objects that have been initialized.
vtkSMPThreadLocal(const T &exemplar)
Constructor that allows the specification of an exemplar object which is used when constructing objec...
T & Local()
This needs to be called mainly within a threaded execution path.
vtk::detail::smp::vtkSMPThreadLocalAPI< T >::iterator iterator
Subset of the standard iterator API.