VTK  9.2.6
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 =========================================================================*/
84 #ifndef vtkSMPThreadLocal_h
85 #define vtkSMPThreadLocal_h
86 
88 
89 template <typename T>
91 {
92 public:
97  : ThreadLocalAPI()
98  {
99  }
100 
106  explicit vtkSMPThreadLocal(const T& exemplar)
107  : ThreadLocalAPI(exemplar)
108  {
109  }
110 
119  T& Local() { return this->ThreadLocalAPI.Local(); }
120 
124  size_t size() { return this->ThreadLocalAPI.size(); }
125 
136 
141  iterator begin() { return this->ThreadLocalAPI.begin(); };
142 
147  iterator end() { return this->ThreadLocalAPI.end(); }
148 
149 private:
151 
152  // disable copying
153  vtkSMPThreadLocal(const vtkSMPThreadLocal&) = delete;
154  void operator=(const vtkSMPThreadLocal&) = delete;
155 };
156 
157 #endif
158 // VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
T & Local()
This needs to be called mainly within a threaded execution path.
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...
vtk::detail::smp::vtkSMPThreadLocalAPI< T >::iterator iterator
Subset of the standard iterator API.
iterator end()
Returns a new iterator pointing to past the end of the local storage container.
Thread local storage for VTK objects.
vtkSMPThreadLocal()
Default constructor.
iterator begin()
Returns a new iterator pointing to the beginning of the local storage container.