Poco::ThreadLocal< C > Class Template Reference

#include <ThreadLocal.h>


Detailed Description

template<class C>
class Poco::ThreadLocal< C >

This template is used to declare type safe thread local variables. It can basically be used like a smart pointer class with the special feature that it references a different object in every thread. The underlying object will be created when it is referenced for the first time. See the NestedDiagnosticContext class for an example how to use this template. Every thread only has access to its own thread local data. There is no way for a thread to access another thread's local data.

Definition at line 159 of file ThreadLocal.h.


Public Member Functions

 ThreadLocal ()
 ~ThreadLocal ()
C * operator-> ()
C & operator* ()
 "Dereferences" the smart pointer and returns a reference to the underlying data object. The reference can be used to modify the object.
C & get ()
 Returns a reference to the underlying data object. The reference can be used to modify the object.

Private Types

typedef TLSSlot< C > Slot

Private Member Functions

 ThreadLocal (const ThreadLocal &)
ThreadLocaloperator= (const ThreadLocal &)

Member Typedef Documentation

template<class C>
typedef TLSSlot<C> Poco::ThreadLocal< C >::Slot [private]

Definition at line 173 of file ThreadLocal.h.


Constructor & Destructor Documentation

template<class C>
Poco::ThreadLocal< C >::ThreadLocal (  )  [inline]

Definition at line 176 of file ThreadLocal.h.

template<class C>
Poco::ThreadLocal< C >::~ThreadLocal (  )  [inline]

Definition at line 180 of file ThreadLocal.h.

template<class C>
Poco::ThreadLocal< C >::ThreadLocal ( const ThreadLocal< C > &   )  [private]


Member Function Documentation

template<class C>
C* Poco::ThreadLocal< C >::operator-> (  )  [inline]

Definition at line 184 of file ThreadLocal.h.

template<class C>
C& Poco::ThreadLocal< C >::operator* (  )  [inline]

"Dereferences" the smart pointer and returns a reference to the underlying data object. The reference can be used to modify the object.

Definition at line 189 of file ThreadLocal.h.

template<class C>
C& Poco::ThreadLocal< C >::get (  )  [inline]

Returns a reference to the underlying data object. The reference can be used to modify the object.

Definition at line 197 of file ThreadLocal.h.

References Poco::ThreadLocalStorage::current(), and Poco::ThreadLocalStorage::get().

template<class C>
ThreadLocal& Poco::ThreadLocal< C >::operator= ( const ThreadLocal< C > &   )  [private]


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

SourceForge.net Logo
Project space on SourceForge.net