VTK  9.3.0
vtkSMPThreadLocal.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
72 #ifndef vtkSMPThreadLocal_h
73 #define vtkSMPThreadLocal_h
74 
76 
77 VTK_ABI_NAMESPACE_BEGIN
78 template <typename T>
80 {
81 public:
85  vtkSMPThreadLocal() = default;
86 
92  explicit vtkSMPThreadLocal(const T& exemplar)
93  : ThreadLocalAPI(exemplar)
94  {
95  }
96 
105  T& Local() { return this->ThreadLocalAPI.Local(); }
106 
110  size_t size() { return this->ThreadLocalAPI.size(); }
111 
122 
127  iterator begin() { return this->ThreadLocalAPI.begin(); };
128 
133  iterator end() { return this->ThreadLocalAPI.end(); }
134 
135 private:
137 
138  // disable copying
139  vtkSMPThreadLocal(const vtkSMPThreadLocal&) = delete;
140  void operator=(const vtkSMPThreadLocal&) = delete;
141 };
142 
143 VTK_ABI_NAMESPACE_END
144 #endif
145 // VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
Thread local storage for VTK objects.
vtkSMPThreadLocal()=default
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.
T & Local()
This needs to be called mainly within a threaded execution path.
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.