29 #ifndef USSHAREDDATA_H
30 #define USSHAREDDATA_H
32 #include "usAtomicInt_p.h"
45 mutable AtomicInt
ref;
65 inline void Detach() {
if (d && d->ref != 1) Detach_helper(); }
70 inline operator T*() { Detach();
return d; }
71 inline operator const T*()
const {
return d; }
72 inline T*
Data() { Detach();
return d; }
73 inline const T*
Data()
const {
return d; }
93 if (old && !old->ref.Deref())
107 if (old && !old->ref.Deref())
125 void Detach_helper();
142 inline T*
Data()
const {
return d; }
145 inline void Detach() {
if (d && d->ref != 1) Detach_helper(); }
149 if(d && !d->ref.Deref())
155 inline operator bool ()
const {
return d != 0; }
159 inline bool operator==(
const T* ptr)
const {
return d == ptr; }
160 inline bool operator!=(
const T* ptr)
const {
return d != ptr; }
167 : d(o.d) {
if (d) d->ref.Ref(); }
171 : d(static_cast<T*>(o.Data()))
185 if (old && !old->ref.Deref())
199 if (old && !old->ref.Deref())
217 void Detach_helper();
225 {
if (d) d->ref.Ref(); }
262 {
if (d) d->ref.Ref(); }
274 #endif // USSHAREDDATA_H
ExplicitlySharedDataPointer()
bool operator==(const SharedDataPointer< T > &other) const
ExplicitlySharedDataPointer(const ExplicitlySharedDataPointer< X > &o)
const T * ConstData() const
void Swap(SharedDataPointer &other)
bool operator!=(const T *ptr) const
SharedData(const SharedData &)
SharedDataPointer< T > & operator=(const SharedDataPointer< T > &o)
bool operator!=(const SharedDataPointer< T > &other) const
void swap(us::SharedDataPointer< T > &p1, us::SharedDataPointer< T > &p2)
bool operator!=(const ExplicitlySharedDataPointer< T > &other) const
void Swap(ExplicitlySharedDataPointer &other)
SharedDataPointer & operator=(T *o)
~ExplicitlySharedDataPointer()
ExplicitlySharedDataPointer(const ExplicitlySharedDataPointer< T > &o)
ExplicitlySharedDataPointer< T > & operator=(const ExplicitlySharedDataPointer< T > &o)
bool operator==(const T *ptr) const
static void swap(T &x, T &y)
ExplicitlySharedDataPointer & operator=(T *o)
const T * operator->() const
const T * ConstData() const
SharedDataPointer(const SharedDataPointer< T > &o)
bool operator==(const ExplicitlySharedDataPointer< T > &other) const
const T & operator*() const