DCMTK: OFThreadSpecificData Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
OFThreadSpecificData Class Reference

provides an operating system independent abstraction for thread specific data. More...

## Public Member Functions
| OFThreadSpecificData ()
| default constructor
| ~OFThreadSpecificData ()
| destructor.
OFBool | initialized () const
| checks whether creation of the object was successful.
int | set (void *value)
| sets the thread specific value for this object.
int | get (void *&value)
| retrieves the thread specific value for this object.

## Static Public Member Functions
static void | errorstr (OFString &description, int code)
| converts any of the error codes returned by the methods of this class into a textual description, which is written into the string object.

## Private Member Functions
| OFThreadSpecificData (const OFThreadSpecificData &arg)
| unimplemented private copy constructor
OFThreadSpecificData & | operator= (const OFThreadSpecificData &arg)
| unimplemented private assignment operator

## Private Attributes
volatile void * | theKey
| thread specific data key resource

## Detailed Description

provides an operating system independent abstraction for thread specific data.

An instance of this class manages a key which is global to all threads in the process but locates data specific to each thread. Each thread can set a different value once the object has been created. Upon creation, the value NULL is assigned for all threads. This class does not perform any memory management on the objects pointed to. Threads must ensure on their own that the data pointed to by the thread specific data key is freed upon termination of the thread.

## Constructor & Destructor Documentation

## ◆ ~OFThreadSpecificData()

OFThreadSpecificData::~OFThreadSpecificData | ( |  | ) |

destructor.

Deletes all thread specific key values (pointers), but not the objects pointed to.

## Member Function Documentation

## ◆ errorstr()

static void OFThreadSpecificData::errorstr | ( | OFString & | description,
|  | int | code )
| static

converts any of the error codes returned by the methods of this class into a textual description, which is written into the string object.

Parameters

  description | string object into which the error description is written.
  code | error code

## ◆ get()

int OFThreadSpecificData::get | ( | void *& | value | ) |

retrieves the thread specific value for this object.

If no call to set() has been made for the calling thread before, NULL is returned.

Parameters

  value | new pointer to thread-specific data for this object returned in this parameter.

Returns
  0 if successful, an error code otherwise.

## ◆ initialized()

OFBool OFThreadSpecificData::initialized | ( |  | ) | const

checks whether creation of the object was successful.

Returns
  OFTrue if the object was successfully created, OFFalse otherwise.

## ◆ set()

int OFThreadSpecificData::set | ( | void * | value | ) |

sets the thread specific value for this object.

No attempt is made to automatically delete the object pointed to at the termination of the thread.

Parameters

  value | new pointer to thread-specific data for this object.

Returns
  0 if successful, an error code otherwise.

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

- ofstd/include/dcmtk/ofstd/ofthread.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2