185 template <
class T>
class COWPtr
208 inline COWPtr(
const COWPtr<T> &other);
242 inline const T &
ref()
const;
275 :obj_p(static_cast<T *>(0),
True), const_p(
False)
282 : obj_p(other.obj_p), const_p(other.const_p)
293 const_p = other.const_p;
310 return obj_p.operator->();
315 return obj_p.operator*();
341 return (const_p || obj_p.nrefs()>1) ?
False :
True;
348 #ifndef CASACORE_NO_AUTO_TEMPLATES
349 #include <casacore/casa/Utilities/COWPtr.tcc>
350 #endif //# CASACORE_NO_AUTO_TEMPLATES
Bool isReadOnly() const
returns True if the object is const, otherwise, return False.
const T & ref() const
return a const reference to the object.
void set(T *obj, Bool deleteIt=True, Bool readOnly=False)
Function used to change this instance of COWPtr.
Bool isUnique() const
returns True if the object is the only instance, otherwise, return False.
COWPtr()
The default constructor: used to create a null pointer which is delete-able by the destructor...
const T & operator*() const
return a reference to a const object.
Bool makeUnique()
Return True if copied, otherwise, False.
Referenced counted pointer for constant data.
Copy-On-Write-Pointer class - allows control of copy based on constness.
COWPtr & operator=(const COWPtr< T > &other)
assignment operator with reference semantics
bool Bool
Define the standard types used by Casacore.
const T * operator->() const
return a pointer to a const object.
T & rwRef()
return a readable and writable reference to this instance.
Bool isNull() const
returns False if this contains a non-null ptr, otherwise, return True.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.