Lunchbox  1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::PerThreadRef< T > Class Template Reference

Thread-specific storage for a RefPtr. More...

#include <perThreadRef.h>

+ Inheritance diagram for lunchbox::PerThreadRef< T >:
+ Collaboration diagram for lunchbox::PerThreadRef< T >:

Public Member Functions

 PerThreadRef ()
 Construct a new per-thread RefPtr. More...
 
 ~PerThreadRef ()
 Destruct a per-thread RefPtr. More...
 
PerThreadRef< T > & operator= (RefPtr< T > data)
 Assign a RefPtr to the thread-local storage. More...
 
PerThreadRef< T > & operator= (const PerThreadRef< T > &rhs)
 Assign a RefPtr to the thread-local storage. More...
 
RefPtr< const T > get () const
 
RefPtr< T > get ()
 
T * getPointer ()
 
T * operator-> ()
 
const T * operator-> () const
 
bool operator== (const PerThreadRef &rhs) const
 
bool operator== (const RefPtr< T > &rhs) const
 
bool operator!= (const RefPtr< T > &rhs) const
 
bool operator! () const
 
bool isValid () const
 

Detailed Description

template<typename T>
class lunchbox::PerThreadRef< T >

Thread-specific storage for a RefPtr.

Definition at line 27 of file perThreadRef.h.

Constructor & Destructor Documentation

template<typename T >
lunchbox::PerThreadRef< T >::PerThreadRef ( )

Construct a new per-thread RefPtr.

Version
1.0

Definition at line 101 of file perThreadRef.h.

template<typename T >
lunchbox::PerThreadRef< T >::~PerThreadRef ( )

Destruct a per-thread RefPtr.

Version
1.0

Definition at line 105 of file perThreadRef.h.

Member Function Documentation

template<typename T >
RefPtr< const T > lunchbox::PerThreadRef< T >::get ( ) const
Returns
the RefPtr from the thread-local storage.
Version
1.0

Definition at line 136 of file perThreadRef.h.

References lunchbox::TLS::get().

Referenced by lunchbox::PerThreadRef< T >::operator=(), and lunchbox::PerThreadRef< T >::operator==().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
RefPtr< T > lunchbox::PerThreadRef< T >::get ( )
Returns
the RefPtr from the thread-local storage.
Version
1.0

Definition at line 141 of file perThreadRef.h.

References lunchbox::TLS::get().

+ Here is the call graph for this function:

template<typename T >
T * lunchbox::PerThreadRef< T >::getPointer ( )
Returns
the C pointer of the RefPtr from the thread-local storage.
Version
1.0

Definition at line 147 of file perThreadRef.h.

References lunchbox::TLS::get().

+ Here is the call graph for this function:

template<typename T >
bool lunchbox::PerThreadRef< T >::isValid ( ) const
Returns
true if the thread-local storage holds a non-0 pointer.
Version
1.0

Definition at line 173 of file perThreadRef.h.

References lunchbox::TLS::get().

Referenced by lunchbox::PerThreadRef< T >::operator!=().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
bool lunchbox::PerThreadRef< T >::operator! ( ) const
Returns
true if the thread-local storage holds a 0 pointer.
Version
1.0

Definition at line 167 of file perThreadRef.h.

References lunchbox::TLS::get().

Referenced by lunchbox::PerThreadRef< T >::operator!=().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
bool lunchbox::PerThreadRef< T >::operator!= ( const RefPtr< T > &  rhs) const
inline
Returns
true if the two objects hold the same C pointer.
Version
1.0

Definition at line 82 of file perThreadRef.h.

References lunchbox::PerThreadRef< T >::isValid(), and lunchbox::PerThreadRef< T >::operator!().

+ Here is the call graph for this function:

template<typename T >
T * lunchbox::PerThreadRef< T >::operator-> ( )
Returns
the object held by the RefPtr in the thread-local storage.
Version
1.0

Definition at line 153 of file perThreadRef.h.

References lunchbox::TLS::get().

+ Here is the call graph for this function:

template<typename T >
const T * lunchbox::PerThreadRef< T >::operator-> ( ) const
Returns
the object held by the RefPtr in the thread-local storage.
Version
1.0

Definition at line 160 of file perThreadRef.h.

References lunchbox::TLS::get().

+ Here is the call graph for this function:

template<typename T >
PerThreadRef< T > & lunchbox::PerThreadRef< T >::operator= ( RefPtr< T >  data)

Assign a RefPtr to the thread-local storage.

Version
1.0

Definition at line 112 of file perThreadRef.h.

References lunchbox::RefPtr< T >::get(), and lunchbox::TLS::set().

+ Here is the call graph for this function:

template<typename T >
PerThreadRef< T > & lunchbox::PerThreadRef< T >::operator= ( const PerThreadRef< T > &  rhs)

Assign a RefPtr to the thread-local storage.

Version
1.0

Definition at line 124 of file perThreadRef.h.

References lunchbox::PerThreadRef< T >::get(), and lunchbox::TLS::set().

+ Here is the call graph for this function:

template<typename T>
bool lunchbox::PerThreadRef< T >::operator== ( const PerThreadRef< T > &  rhs) const
inline
Returns
true if the two objects hold the same C pointer.
Version
1.0

Definition at line 68 of file perThreadRef.h.

References lunchbox::PerThreadRef< T >::get().

+ Here is the call graph for this function:

template<typename T>
bool lunchbox::PerThreadRef< T >::operator== ( const RefPtr< T > &  rhs) const
inline
Returns
true if the two objects hold the same C pointer.
Version
1.0

Definition at line 75 of file perThreadRef.h.


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