Base class for per-thread object. More...
#include <Thread.h>
Public Member Functions | |
ThreadDataItem (void) | |
ThreadDataItem (std::string &key) | |
ThreadDataItem (const std::string &key) | |
void | Attach (std::string &key) |
void | Attach (const std::string &key) |
virtual void | Dup (void) |
Static Public Member Functions | |
static ThreadDataItem * | Get (const std::string &key) |
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.
Arc::ThreadDataItem::ThreadDataItem | ( | void | ) |
Dummy constructor which does nothing. To make object usable one of 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.
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.
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.
virtual void Arc::ThreadDataItem::Dup | ( | void | ) | [virtual] |
Creates copy of object. This method is called when new thread is created from current thread. It is called in new thread, so new object - if created - gets attached to new thread. If 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.