26#ifndef _SB_THREAD_STORAGE_H_
27#define _SB_THREAD_STORAGE_H_
32#include <Inventor/STL/functional>
87 if ( t == NULL && SoInventorBase::checkMultithread() )
88 fprintf( stderr,
"MT ERROR: in ::operator-> , object not initialized for current thread." );
111 operator bool()
const
113 return ((
static_cast<T
>(
getValue())) != NULL);
117 template<
typename Func>
120 s_threadStorageGlobalMutex.lock();
121 SbThreadStorageGlobalList::iterator it_i = s_threadStorageGlobalList.begin();
122 while(it_i != s_threadStorageGlobalList.end())
125 void* value=
get(it_i);
127 std::mem_fn(f)(
static_cast<T
>(value));
130 s_threadStorageGlobalMutex.unlock();
134 template<
typename Func,
typename Param>
137 s_threadStorageGlobalMutex.lock();
138 SbThreadStorageGlobalList::iterator it_i = s_threadStorageGlobalList.begin();
139 while(it_i != s_threadStorageGlobalList.end())
142 void* value=
get(it_i);
144 std::bind(std::mem_fn((Func)(f)), std::placeholders::_1, p)(
static_cast<T
>(value));
147 s_threadStorageGlobalMutex.unlock();
156 virtual void deleteStorage(
void* p)
158 T val = (
static_cast<T
>(p));
165 void*
operator new[] (size_t)
throw() {
return 0; }
166 void operator delete[] (
void*) { }
167 void*
operator new( size_t, char )
throw() {
return 0; }
190 void* pt =
reinterpret_cast<void*
>(
static_cast<uintptr_t
>(t));
201 void *pt =
reinterpret_cast<void*
>(
static_cast<uintptr_t
>(t));
210 operator bool()
const
211 {
return ((
static_cast<bool>(
getValue())) ==
true); }
215 virtual void deleteStorage(
void*)
220 void*
operator new[] (size_t)
throw() {
return 0; }
221 void operator delete[] (
void*) { }
222 void*
operator new( size_t , char )
throw() {
return 0; }
const SbVec3f & get(int index) const
valueRef getValue() const
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Template class f...
T operator*() const
Override operator T*() Destroying objects from delete operator is not allowed.
T operator->() const
Override operator-> Gets value of the storage for current thread.
virtual ~SbThreadStorage()
Storage destructor: Find current storage in the global storage map, Delete thread dependent entry,...
void call(Func f, Param p)
Calls the passed function to all registered threads object.
SbThreadStorage< T > & operator=(T t)
Override operator= Set value of the storage for current thread.
void call(Func f)
Calls the passed function to all registered threads object.