DCMTK: DiObjectCounter Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

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

Class to count number of instances (objects created from a certain class). More...

Inheritance diagram for DiObjectCounter:

## Public Member Functions
void | addReference ()
| add a reference.
void | removeReference ()
| remove a reference.

## Protected Member Functions
| DiObjectCounter ()
| constructor.
virtual | ~DiObjectCounter ()
| destructor

## Private Attributes
unsigned long | Counter
| internal counter
OFMutex | theMutex
| if compiled for multi-thread operation, the Mutex protecting access to the value of this object.

## Detailed Description

Class to count number of instances (objects created from a certain class).

used to manage more than one reference to an object in a secure way.

## Constructor & Destructor Documentation

## ◆ DiObjectCounter()

DiObjectCounter::DiObjectCounter | ( |  | ) |
| inlineprotected

constructor.

Internal counter is initialized with 1.

References Counter, and theMutex.

## Member Function Documentation

## ◆ addReference()

void DiObjectCounter::addReference | ( |  | ) |
| inline

add a reference.

Increase the internal counter by 1.

References Counter, and theMutex.

## ◆ removeReference()

void DiObjectCounter::removeReference | ( |  | ) |
| inline

remove a reference.

Decrease the internal counter by 1 and delete the object only if the counter is zero.

References Counter, and theMutex.

## Member Data Documentation

## ◆ theMutex

OFMutex DiObjectCounter::theMutex
| private

if compiled for multi-thread operation, the Mutex protecting access to the value of this object.

Remarks
  this member is only available if DCMTK is compiled with thread support enabled.

Referenced by DiObjectCounter(), addReference(), and removeReference().

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

- dcmimgle/include/dcmtk/dcmimgle/diobjcou.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1