DCMTK  Version 3.6.6
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
ptthe 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< Implementation >::destroy().

◆ pointer()

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

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


Generated on Thu Jan 14 2021 for DCMTK Version 3.6.6 by Doxygen 1.8.18