ARC SDK
Public Member Functions | Static Public Member Functions | Friends
Arc::ThreadDataItem Class Reference

Base class for per-thread object. More...

#include <arc/Thread.h>

Public Member Functions

 ThreadDataItem (void)
 Dummy constructor which does nothing. More...
 
 ThreadDataItem (std::string &key)
 Creates instance and attaches it to current thread under key. More...
 
 ThreadDataItem (const std::string &key)
 Creates instance and attaches it to current thread under key. More...
 
void Attach (std::string &key)
 Attaches object to current thread under key. More...
 
void Attach (const std::string &key)
 Attaches object to current thread under key. More...
 
virtual void Dup (void)
 Creates copy of object. More...
 

Static Public Member Functions

static ThreadDataItemGet (const std::string &key)
 Retrieves object attached to thread under key. More...
 

Friends

class ThreadData
 

Detailed Description

Base class for per-thread object.

Classes inherited from this one are attached to current thread under specified key and destroyed only when thread ends or object is replaced by another one with same key.

Constructor & Destructor Documentation

Arc::ThreadDataItem::ThreadDataItem ( void  )

Dummy constructor which does nothing.

To make object usable one of the Attach(...) methods must be used.

Arc::ThreadDataItem::ThreadDataItem ( std::string &  key)

Creates instance and attaches it to current thread under key.

If supplied key is empty random one is generated and stored in key variable.

Arc::ThreadDataItem::ThreadDataItem ( const std::string &  key)

Creates instance and attaches it to current thread under key.

Member Function Documentation

void Arc::ThreadDataItem::Attach ( std::string &  key)

Attaches object to current thread under key.

If supplied key is empty random one is generated and stored in key variable. This method must be used only if object was created using dummy constructor.

void Arc::ThreadDataItem::Attach ( const std::string &  key)

Attaches object to current thread under key.

This method must be used only if object was created using dummy constructor.

virtual void Arc::ThreadDataItem::Dup ( void  )
virtual

Creates copy of object.

This method is called when a new thread is created from the current thread. It is called in the new thread, so the new object - if created - gets attached to the new thread. If the object is not meant to be inherited by new threads then this method should do nothing.

static ThreadDataItem* Arc::ThreadDataItem::Get ( const std::string &  key)
static

Retrieves object attached to thread under key.

Returns
NULL if no such obejct.

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