libcommonc++  0.7
ThreadLocalBuffer< T > Class Template Reference

Thread-local data buffer. More...

#include <ThreadLocalBuffer.h++>

Inheritance diagram for ThreadLocalBuffer< T >:
Collaboration diagram for ThreadLocalBuffer< T >:

Public Member Functions

 ThreadLocalBuffer (size_t size)
 Construct a new ThreadLocalBuffer with the given size. More...
 
virtual ~ThreadLocalBuffer ()
 Destructor. More...
 
Buffer< T > & operator* ()
 Pointer-dereference operator. More...
 
Buffer< T > * operator-> ()
 Pointer operator. More...
 
void setValue (Buffer< T > *value)
 Set the value of the thread-local object for the calling thread. More...
 
Buffer< T > * getValue ()
 Get the value of the thread-local object for the calling thread. More...
 

Static Public Member Functions

static int getSlotCount ()
 Get the maximum number of thread-local storage slots available on this platform. More...
 

Protected Member Functions

Buffer< T > * initialValue ()
 Provide the intial value of the thread-local object for the calling thread. More...
 

Detailed Description

template<typename T>
class ccxx::ThreadLocalBuffer< T >

Thread-local data buffer.

The buffer exists as a separate instance for each calling thread.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ThreadLocalBuffer()

ThreadLocalBuffer ( size_t  size)
inline

Construct a new ThreadLocalBuffer with the given size.

Parameters
sizeThe size of the buffer, in bytes.

◆ ~ThreadLocalBuffer()

virtual ~ThreadLocalBuffer ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ getSlotCount()

static int getSlotCount ( )
staticinherited

Get the maximum number of thread-local storage slots available on this platform.

A return value of -1 indicates that there is no limit.

◆ getValue()

Buffer< T > * getValue ( )
inherited

Get the value of the thread-local object for the calling thread.

Returns
The current (possibly NULL) value.

◆ initialValue()

Buffer<T>* initialValue ( )
inlineprotectedvirtual

Provide the intial value of the thread-local object for the calling thread.

The default implementation returns NULL.

Returns
The initial value.

Reimplemented from ThreadLocal< Buffer< T > >.

◆ operator*()

Buffer< T > & operator* ( )
inherited

Pointer-dereference operator.

Returns
A reference to the thread-local object.
Exceptions
NullPointerExceptionIf the value of the object was never initialized for the calling thread.

◆ operator->()

Buffer< T > * operator-> ( )
inherited

Pointer operator.

Returns
A pointer to the thread-local object.
Exceptions
NullPointerExceptionIf the value of the object was never initialized for the calling thread.

◆ setValue()

void setValue ( Buffer< T > *  value)
inherited

Set the value of the thread-local object for the calling thread.

Parameters
valueThe new value.

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