DCMTK: OFshared_ptr< T >::Data Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
OFshared_ptr< T >::Data Class Reference

Helper class containing the reference to the managed object and the reference counter. More...

## Public Member Functions
| Data (T *const pt)
| Construct reference and counter from a raw pointer.
| ~Data ()
| Delete the managed object.
void | increment_count ()
| Increment the reference counter in a thread-safe and (if possible) lock-free fashion.
OFBool | decrement_count ()
| Decrement the reference counter in a thread-safe and (if possible) lock-free fashion.
T * | pointer () const
| Get the managed object.

## Private Attributes
OF_SHARED_PTR_COUNTER_TYPE | m_Count
| The counter.
T *const | m_pT
| The pointer to the managed object.
OFMutex | m_Mutex
| A mutex for platforms that don't support lock-free counters.

## Detailed Description

template<typename T>
class OFshared_ptr< T >::Data

Helper class containing the reference to the managed object and the reference counter.

## Constructor & Destructor Documentation

## ◆ Data()

template<typename T>

OFshared_ptr< T >::Data::Data | ( | T *const | pt | ) |
| inline

Construct reference and counter from a raw pointer.

Parameters

  pt | the raw pointer that becomes the managed object.

References m_Count, m_Mutex, and m_pT.

## ◆ ~Data()

template<typename T>

OFshared_ptr< T >::Data::~Data | ( |  | ) |
| inline

Delete the managed object.

We are deleted only if the reference counter reached zero, so we now have to delete the managed object.

References m_pT.

## Member Function Documentation

## ◆ decrement_count()

template<typename T>

OFBool OFshared_ptr< T >::Data::decrement_count | ( |  | ) |
| inline

Decrement the reference counter in a thread-safe and (if possible) lock-free fashion.

Returns
  OFTrue if the reference counter reached zero, OFFalse otherwise.

References m_Count, and m_Mutex.

## ◆ pointer()

template<typename T>

T * OFshared_ptr< T >::Data::pointer | ( |  | ) | const
| inline

Get the managed object.

Returns
  a pointer to the managed object.

References m_pT.

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

- ofstd/include/dcmtk/ofstd/ofmem.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1