35 #ifndef QORE_REFERENCE_HOLDER_H_
36 #define QORE_REFERENCE_HOLDER_H_
50 template<
typename T =
class AbstractQoreNode>
54 DLLLOCAL ReferenceHolder& operator=(
const ReferenceHolder&);
55 DLLLOCAL
void*
operator new(size_t);
91 DLLLOCAL
operator bool()
const {
return p != 0; }
114 DLLLOCAL SimpleRefHolder& operator=(
const SimpleRefHolder&);
115 DLLLOCAL
void*
operator new(size_t);
120 DLLLOCAL SimpleRefHolder() : p(0) {}
121 DLLLOCAL SimpleRefHolder(T* p_) : p(p_) {}
122 DLLLOCAL ~SimpleRefHolder() {
if (p) p->deref(); }
124 DLLLOCAL T* operator->() {
return p; }
125 DLLLOCAL T* operator*() {
return p; }
126 DLLLOCAL
void operator=(T *nv) {
131 DLLLOCAL T *release() {
136 DLLLOCAL
operator bool()
const {
return p != 0; }
DLLLOCAL T ** getPtrPtr()
returns a pointer to the pointer being managed
Definition: ReferenceHolder.h:94
DLLLOCAL ReferenceHolder(T *p_, ExceptionSink *xsink_)
populates with object with data and the ExceptionSink pointer
Definition: ReferenceHolder.h:65
DLLLOCAL T * release()
releases the pointer to the caller
Definition: ReferenceHolder.h:84
DLLLOCAL T * operator*()
returns the pointer being managed
Definition: ReferenceHolder.h:74
DLLLOCAL ~ReferenceHolder()
calls deref(ExceptionSink *) on the pointer being managed if not 0
Definition: ReferenceHolder.h:68
DLLLOCAL T *& getRef()
returns a reference to the ptr being managed
Definition: ReferenceHolder.h:97
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition: ReferenceHolder.h:111
DLLLOCAL T * operator->()
returns the pointer being managed
Definition: ReferenceHolder.h:71
DLLLOCAL ReferenceHolder(ExceptionSink *xsink_)
creates an empty ReferenceHolder
Definition: ReferenceHolder.h:62
DLLLOCAL void operator=(T *nv)
assigns a new pointer to the holder, dereferences the current pointer if any
Definition: ReferenceHolder.h:77
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:51