DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Private Member Functions | Private Attributes | List of all members
OFGlobal< T > Class Template Reference

Template class which allows to declare global objects that are protected by a Read/Write Lock if used in multi-thread applications. More...

## Public Member Functions
| OFGlobal (const T &arg)
| constructor. More...
virtual | ~OFGlobal ()
| destructor.
void | set (const T &arg)
| assigns new value to this object. More...
void | xget (T &arg)
| gets the value of this object. More...
T | get ()
| returns the value of this object. More...

## Private Member Functions
| OFGlobal ()
| unimplemented private default constructor
| OFGlobal (const OFGlobal< T > &arg)
| unimplemented private copy constructor
const OFGlobal< T > & | operator= (const OFGlobal< T > &arg)
| unimplemented private assignment operator

## Private Attributes
T | val
| value of this object
OFReadWriteLock | theRWLock
| if compiled for multi-thread operation, the Read/Write Lock protecting access to the value of this object.

## Detailed Description

### template<class T>
class OFGlobal< T >

Template class which allows to declare global objects that are protected by a Read/Write Lock if used in multi-thread applications.

Must be compiled with -DWITH_THREADS for multi-thread-operation. Template class T must have copy constructor and assignment operator.

## Constructor & Destructor Documentation

## ◆ OFGlobal()

template<class T >

OFGlobal< T >::OFGlobal | ( | const T & | arg | ) |
| inline

constructor.

Parameters

  arg | value to which this object is initialised

## Member Function Documentation

## ◆ get()

template<class T >

T OFGlobal< T >::get | ( |  | ) |
| inline

returns the value of this object.

If compiled for multi-thread operation, access to the value of the object is protected by a Read/Write Lock. The result is returned by value, not by reference.

Returns
  value of this object.

References OFReadWriteLock::rdlock(), OFReadWriteLock::rdunlock(), OFGlobal< T >::theRWLock, and OFGlobal< T >::val.

## ◆ set()

template<class T >

void OFGlobal< T >::set | ( | const T & | arg | ) |
| inline

assigns new value to this object.

If compiled for multi-thread operation, access to the value of the object is protected by a Read/Write Lock.

Parameters

  arg | new value

References OFGlobal< T >::theRWLock, OFGlobal< T >::val, OFReadWriteLock::wrlock(), and OFReadWriteLock::wrunlock().

## ◆ xget()

template<class T >

void OFGlobal< T >::xget | ( | T & | arg | ) |
| inline

gets the value of this object.

If compiled for multi-thread operation, access to the value of the object is protected by a Read/Write Lock.

Parameters

  arg | return value is assigned to this parameter.

References OFReadWriteLock::rdlock(), OFReadWriteLock::rdunlock(), OFGlobal< T >::theRWLock, and OFGlobal< T >::val.

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

- ofstd/include/dcmtk/ofstd/ofglobal.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1