Medical Imaging Interaction Toolkit
2023.04.00
Medical Imaging Interaction Toolkit
|
Go to the documentation of this file.
32 #ifndef USSHAREDDATA_H
33 #define USSHAREDDATA_H
35 #include "usAtomicInt_p.h"
48 mutable AtomicInt
ref;
68 inline void Detach() {
if (d && d->ref != 1) Detach_helper(); }
73 inline operator T*() { Detach();
return d; }
74 inline operator const T*()
const {
return d; }
75 inline T*
Data() { Detach();
return d; }
76 inline const T*
Data()
const {
return d; }
96 if (old && !old->ref.Deref())
110 if (old && !old->ref.Deref())
128 void Detach_helper();
145 inline T*
Data()
const {
return d; }
148 inline void Detach() {
if (d && d->ref != 1) Detach_helper(); }
152 if(d && !d->ref.Deref())
158 inline operator bool ()
const {
return d !=
nullptr; }
162 inline bool operator==(
const T* ptr)
const {
return d == ptr; }
163 inline bool operator!=(
const T* ptr)
const {
return d != ptr; }
170 : d(o.d) {
if (d) d->ref.Ref(); }
174 : d(static_cast<T*>(o.Data()))
188 if (old && !old->ref.Deref())
202 if (old && !old->ref.Deref())
220 void Detach_helper();
228 {
if (d) d->ref.Ref(); }
265 {
if (d) d->ref.Ref(); }
277 #endif // USSHAREDDATA_H
bool operator==(const ExplicitlySharedDataPointer< T > &other) const
ExplicitlySharedDataPointer(const ExplicitlySharedDataPointer< T > &o)
void swap(us::ExplicitlySharedDataPointer< T > &p1, us::ExplicitlySharedDataPointer< T > &p2)
bool operator==(const SharedDataPointer< T > &other) const
ExplicitlySharedDataPointer()
ExplicitlySharedDataPointer(const ExplicitlySharedDataPointer< X > &o)
bool operator!=(const ExplicitlySharedDataPointer< T > &other) const
void Swap(SharedDataPointer &other)
SharedDataPointer< T > & operator=(const SharedDataPointer< T > &o)
ExplicitlySharedDataPointer & operator=(T *o)
const T * ConstData() const
bool operator!=(const T *ptr) const
SharedDataPointer & operator=(T *o)
const T * ConstData() const
#define US_BEGIN_NAMESPACE
void Swap(ExplicitlySharedDataPointer &other)
bool operator!=(const SharedDataPointer< T > &other) const
const T & operator*() const
const T * operator->() const
SharedDataPointer(const SharedDataPointer< T > &o)
#define US_PREPEND_NAMESPACE(name)
bool operator==(const T *ptr) const
ExplicitlySharedDataPointer< T > & operator=(const ExplicitlySharedDataPointer< T > &o)
SharedData(const SharedData &)
~ExplicitlySharedDataPointer()