DCMTK Version 3.7.0 OFFIS DICOM Toolkit

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. More...
| ~Data ()
| Delete the managed object. More...
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. More...
T * | pointer () const
| Get the managed object. More...

## 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.

## ◆ ~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 OFshared_ptr< T >::Data::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 OFMutex::lock(), OFshared_ptr< T >::Data::m_Count, OFshared_ptr< T >::Data::m_Mutex, and OFMutex::unlock().

Referenced by OFshared_ptr< T >::destroy().

## ◆ pointer()

template<typename T >

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

Get the managed object.

Returns
  a pointer to the managed object.

References OFshared_ptr< T >::Data::m_pT.

Referenced by OFshared_ptr< T >::get(), OFshared_ptr< T >::operator!(), OFshared_ptr< T >::operator*(), and OFshared_ptr< T >::operator->().

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

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

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