35 #ifndef QORE_REFERENCE_HOLDER_H_ 36 #define QORE_REFERENCE_HOLDER_H_ 51 template<
typename T =
class AbstractQoreNode>
55 DLLLOCAL ReferenceHolder& operator=(
const ReferenceHolder&);
56 DLLLOCAL
void*
operator new(size_t);
63 DLLLOCAL ReferenceHolder(
ExceptionSink* xsink_) : p(0), xsink(xsink_) {}
66 DLLLOCAL ReferenceHolder(T* p_,
ExceptionSink* xsink_) : p(p_), xsink(xsink_) {}
84 DLLLOCAL
void operator=(T *nv) {
98 DLLLOCAL
operator bool()
const {
return p != 0; }
117 template<
typename T =
class SimpleQoreNode>
121 DLLLOCAL SimpleRefHolder& operator=(
const SimpleRefHolder&);
122 DLLLOCAL
void*
operator new(size_t);
127 DLLLOCAL SimpleRefHolder() : p(0) {}
128 DLLLOCAL SimpleRefHolder(T* p_) : p(p_) {}
133 DLLLOCAL SimpleRefHolder(SimpleRefHolder&& old) : p(
std::move(old.p)) {
137 DLLLOCAL ~SimpleRefHolder() {
if (p) p->deref(); }
141 DLLLOCAL
const T*
operator->()
const {
return p; }
142 DLLLOCAL
const T*
operator*()
const {
return p; }
143 DLLLOCAL
void operator=(T *nv) {
153 DLLLOCAL
operator bool()
const {
return p != 0; }
DLLLOCAL T ** getPtrPtr()
returns a pointer to the pointer being managed
Definition: ReferenceHolder.h:101
DLLLOCAL T * release()
releases the pointer to the caller
Definition: ReferenceHolder.h:91
DLLLOCAL T * operator*()
returns the pointer being managed
Definition: ReferenceHolder.h:75
DLLLOCAL ~ReferenceHolder()
calls deref(ExceptionSink *) on the pointer being managed if not 0
Definition: ReferenceHolder.h:69
DLLLOCAL T *& getRef()
returns a reference to the ptr being managed
Definition: ReferenceHolder.h:104
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition: ReferenceHolder.h:118
DLLLOCAL T * operator->()
returns the pointer being managed
Definition: ReferenceHolder.h:72
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:52