HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ThreadSpecificValue< T, ALIGNMENT > Class Template Reference

#include <UT_ThreadSpecificValue.h>

Classes

class  const_iterator
 
class  iterator
 

Public Types

typedef T value_type
 

Public Member Functions

 UT_ThreadSpecificValue ()
 
 UT_ThreadSpecificValue (const ThisType &src)
 
UT_ThreadSpecificValueoperator= (const ThisType &src)
 Assignment is NOT thread-safe when src is being concurrently modified! More...
 
TgetValueForThread (int thread_index)
 
const TgetValueForThread (int thread_index) const
 
Tget ()
 
Tlocal ()
 
const Tget () const
 
const Tlocal () const
 
const_iterator begin () const
 begin() const iterator More...
 
const_iterator end () const
 end() const iterator More...
 
iterator begin ()
 begin() iterator More...
 
iterator end ()
 end() iterator More...
 
int maxThreadsSeen () const
 
void clear ()
 Clear values for all threads, resetting to the initial state. More...
 
exint getMemoryUsage (bool inclusive) const
 
 UT_ThreadSpecificValue (ThisType &&)=default
 
UT_ThreadSpecificValueoperator= (ThisType &&)=default
 

Friends

class const_iterator
 

Detailed Description

template<typename T, size_t ALIGNMENT = 64>
class UT_ThreadSpecificValue< T, ALIGNMENT >

A class for storing thread local values of type T. By default, the alignment of the type T's will be 64-byte aligned but this can be adjusted by supplying the ALIGNMENT template parameter, or use 0 to disable. For optimal performance, use an ALIGNMENT of 128 bytes but this can waste quite a lot of space.

Definition at line 137 of file UT_ThreadSpecificValue.h.

Member Typedef Documentation

template<typename T, size_t ALIGNMENT = 64>
typedef T UT_ThreadSpecificValue< T, ALIGNMENT >::value_type

Definition at line 147 of file UT_ThreadSpecificValue.h.

Constructor & Destructor Documentation

template<typename T, size_t ALIGNMENT = 64>
UT_ThreadSpecificValue< T, ALIGNMENT >::UT_ThreadSpecificValue ( )
inline

Definition at line 149 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
UT_ThreadSpecificValue< T, ALIGNMENT >::UT_ThreadSpecificValue ( const ThisType src)
inlineexplicit

Mark copy constructor as explicit to disallow accidental passing by value to functions. Assignment is NOT thread-safe when src is being concurrently modified!

Definition at line 169 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
UT_ThreadSpecificValue< T, ALIGNMENT >::UT_ThreadSpecificValue ( ThisType &&  )
default
Note
Moving UT_ThreadSpecificValue is NOT thread-safe

Member Function Documentation

template<typename T, size_t ALIGNMENT = 64>
const_iterator UT_ThreadSpecificValue< T, ALIGNMENT >::begin ( void  ) const
inline

begin() const iterator

Definition at line 383 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
iterator UT_ThreadSpecificValue< T, ALIGNMENT >::begin ( void  )
inline

begin() iterator

Definition at line 390 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
void UT_ThreadSpecificValue< T, ALIGNMENT >::clear ( void  )
inline

Clear values for all threads, resetting to the initial state.

Definition at line 407 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
const_iterator UT_ThreadSpecificValue< T, ALIGNMENT >::end ( void  ) const
inline

end() const iterator

Definition at line 386 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
iterator UT_ThreadSpecificValue< T, ALIGNMENT >::end ( void  )
inline

end() iterator

Definition at line 393 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
T& UT_ThreadSpecificValue< T, ALIGNMENT >::get ( )
inline

Definition at line 245 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
const T& UT_ThreadSpecificValue< T, ALIGNMENT >::get ( ) const
inline

Definition at line 248 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
exint UT_ThreadSpecificValue< T, ALIGNMENT >::getMemoryUsage ( bool  inclusive) const
inline

Definition at line 412 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
T& UT_ThreadSpecificValue< T, ALIGNMENT >::getValueForThread ( int  thread_index)
inline

Access the value for a particular thread index. Note that the threads you care about may not have been assigned sequentially! Always loop up to the maxthreads value and be able to handle zero-initialized empty data.

Definition at line 209 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
const T& UT_ThreadSpecificValue< T, ALIGNMENT >::getValueForThread ( int  thread_index) const
inline

Definition at line 228 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
T& UT_ThreadSpecificValue< T, ALIGNMENT >::local ( )
inline

Definition at line 246 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
const T& UT_ThreadSpecificValue< T, ALIGNMENT >::local ( ) const
inline

Definition at line 249 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
int UT_ThreadSpecificValue< T, ALIGNMENT >::maxThreadsSeen ( ) const
inline

The number of values that require iteration. Don't use this for iteration - use iterators instead.

Definition at line 398 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
UT_ThreadSpecificValue& UT_ThreadSpecificValue< T, ALIGNMENT >::operator= ( const ThisType src)
inline

Assignment is NOT thread-safe when src is being concurrently modified!

Definition at line 176 of file UT_ThreadSpecificValue.h.

template<typename T, size_t ALIGNMENT = 64>
UT_ThreadSpecificValue& UT_ThreadSpecificValue< T, ALIGNMENT >::operator= ( ThisType &&  )
default
Note
Moving UT_ThreadSpecificValue is NOT thread-safe

Friends And Related Function Documentation

template<typename T, size_t ALIGNMENT = 64>
friend class const_iterator
friend

Definition at line 446 of file UT_ThreadSpecificValue.h.


The documentation for this class was generated from the following file: