26#ifndef CASA_PTRHOLDER_H
27#define CASA_PTRHOLDER_H
30#include <casacore/casa/aips.h>
82 [[deprecated(
"Use std::unique_ptr")]]
99 [[deprecated(
"Use std::unique_ptr")]]
124 operator T *()
const {
return ptr_p; }
213 {
if (ptr != itsPtr) {
delete itsPtr; itsPtr = ptr; }}
218 { T* ptr = itsPtr; itsPtr = 0;
return ptr; }
259#ifndef CASACORE_NO_AUTO_TEMPLATES
260#include <casacore/casa/Utilities/PtrHolder.tcc>
Hold and delete pointers not deleted by object destructors.
T * ptr()
Get the pointer for use.
T * transfer()
Transfer ownership of the pointer.
const T & operator*() const
void release()
Release the pointer.
SPtrHolder(const SPtrHolder< T > &other)
SPrtHolder cannot be copied.
SPtrHolder< T > & operator=(const SPtrHolder< T > &other)
T * operator->() const
Make it possible to use -> on the pointer object.
void reset(T *ptr)
Reset the pointer.
T & operator*()
Make it possible to dereference the pointer object.
SPtrHolder(T *ptr=0)
Construct an SPtrHolder from a pointer which MUST have been allocated from new, since the destructor ...
PtrHolder()
The default constructor uses a null pointer.
PtrHolder(T *pointer, Bool isCArray=False)
Construct a PtrHolder from a pointer which MUST have been allocated from new, since the destructor wi...
void set(T *pointer, Bool isCarray=False, Bool deleteCurrentPtr=True)
Set the pointer to a new value.
T * ptr()
Release the pointer for use.
void clear(Bool deleteCurrentPtr=True)
Set the current pointer to null; if deletePtr is True (the default), then the current pointer is dele...
this file contains all the compiler specific defines
T * operator->() const
Make it possible to use -> on the pointer object.
void delete_pointer_if_necessary()
Bool isCArray() const
See if the pointer points to a C-array.
bool Bool
Define the standard types used by Casacore.
PtrHolder< T > & operator=(const PtrHolder< T > &other)