29#include <casacore/casa/aips.h>
244 inline const T &
ref()
const;
285 : obj_p (other.obj_p),
286 const_p (other.const_p)
295 if (
this != &other) {
304 return obj_p.operator->();
309 return obj_p.operator*();
335 return (const_p || obj_p.use_count()>1) ?
False :
True;
342#ifndef CASACORE_NO_AUTO_TEMPLATES
343#include <casacore/casa/Utilities/COWPtr.tcc>
Helper class to make deletion of object optional.
void operator()(T *data) const
const T * operator->() const
return a pointer to a const object.
Bool isReadOnly() const
returns True if the object is const, otherwise, return False.
Bool isNull() const
returns False if this contains a non-null ptr, otherwise, return True.
COWPtr()
The default constructor: used to create a null pointer which is delete-able by the destructor.
Bool makeUnique()
Return True if copied, otherwise, False.
Bool isUnique() const
returns True if the object is the only instance, otherwise, return False.
std::shared_ptr< T > obj_p
COWPtr & operator=(const COWPtr< T > &other)
assignment operator with reference semantics
COWPtr(T *obj, Bool deleteIt=True, Bool readOnly=False)
The dynamic "pointer to object" constructor: default behavior is to delete the allocated memory when ...
COWPtr(const COWPtr< T > &other)
copy ctor with reference semantics
const T & operator*() const
return a reference to a const object.
void set(T *obj, Bool deleteIt=True, Bool readOnly=False)
Function used to change this instance of COWPtr.
T & rwRef()
return a readable and writable reference to this instance.
const T & ref() const
return a const reference to the object.
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.