42 template <
typename Data>
85 myData = UTmakeShared<Data>();
98 return myData.get() ==
nullptr;
108 myData = UTmakeShared<Data>(*src);
130 {
return myData.use_count(); }
139 if (!myData.unique())
141 myData = UTmakeShared<Data>(*myData);
164 template <
typename Data>
180 myHandle = src.myHandle;
190 myHandle = src.myHandle;
213 return !myHandle.myData;
218 return *myHandle.myData;
223 return myHandle.myData.get();
225 const Data *
get()
const
227 return myHandle.myData.get();
251 template <
typename Data>
271 : myData (src.myData.
get())
290 myData = src.myData.get();
315 const Data *
get()
const
334 template <
typename Data>
368 myHandle = src.myHandle;
404 return !myHandle || !myHandle->myData;
415 return *(myHandle->myData);
422 return *(myHandle->myData);
434 return &*(myHandle->myData);
444 return &*(myHandle->myData);
459 if (!myHandle->myData)
463 myHandle->myWriteCount.
add(-1);
473 if (!myHandle->myData)
475 myHandle->myWriteCount.
add(1);
UT_COWWriteHandle(const UT_COWWriteHandle< Data > &src)
UT_COWTransientReadHandle(const UT_COWTransientReadHandle< Data > &src)
const UT_COWReadHandle< Data > & operator=(const UT_COWReadHandle< Data > &src)
UT_COWTransientReadHandle()
const UT_COWHandle< Data > & operator=(const UT_COWHandle< Data > &src)
void resetHandle()
Turns this into a null handle to drop references.
~UT_COWTransientReadHandle()
const Data & operator*() const
Data * operator->() const
UT_COWWriteHandle(UT_COWHandle< Data > *src)
int getRefCount() const
Returns the number of shared pointer references to the same Data.
void copy(const Data *src)
bool isNull() const
If the underlying object is allocatd.
const UT_COWTransientReadHandle< Data > & operator=(const UT_COWHandle< Data > &src)
const UT_COWReadHandle< Data > & operator=(const UT_COWHandle< Data > &src)
UT_COWReadHandle(const UT_COWReadHandle< Data > &src)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
const Data * operator->() const
const UT_COWWriteHandle< Data > & operator=(UT_COWHandle< Data > *src)
void allocate()
Calls the default constructor on the object.
UT_COWReadHandle(const UT_COWHandle< Data > &src)
const Data & operator*() const
SYS_FORCE_INLINE T relaxedLoad() const
const Data * operator->() const
const UT_COWTransientReadHandle< Data > & operator=(const UT_COWTransientReadHandle< Data > &src)
UT_COWHandle(const UT_COWHandle< Data > &src)
const UT_COWWriteHandle< Data > & operator=(const UT_COWWriteHandle< Data > &src)
bool isNull() const
Test if this is a NULL pointer.
T add(T val)
Atomically adds val to myValue, returning the new value of myValue.
UT_COWTransientReadHandle(const UT_COWHandle< Data > &src)
bool isNull() const
Test if this is a NULL pointer.
void allocateIfNeeded()
Calls the default constructor on the object.
void resetHandle()
Removes references, making this a null pointer.
void resetHandle()
Removes references, making this a null pointer.
bool isNull() const
Test if this is a NULL pointer.