35#ifndef QORE_REFERENCE_HOLDER_H_
36#define QORE_REFERENCE_HOLDER_H_
51template<
typename T =
class AbstractQoreNode>
99 DLLLOCAL
operator bool()
const {
return p !=
nullptr; }
114 void*
operator new(size_t) =
delete;
126template<
typename T =
class SimpleQoreNode>
141 DLLLOCAL
void discard() {
148 DLLLOCAL T* operator->() {
return p; }
149 DLLLOCAL T* operator*() {
return p; }
150 DLLLOCAL
const T* operator->()
const {
return p; }
151 DLLLOCAL
const T* operator*()
const {
return p; }
153 DLLLOCAL
void operator=(T* nv) {
160 DLLLOCAL T* release() {
175 DLLLOCAL
operator bool()
const {
185 void*
operator new(size_t) =
delete;
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition ExceptionSink.h:50
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition ReferenceHolder.h:52
DLLLOCAL ReferenceHolder(T *p_, ExceptionSink *xsink_)
populates with object with data and the ExceptionSink pointer
Definition ReferenceHolder.h:58
DLLLOCAL T * operator->()
returns the pointer being managed
Definition ReferenceHolder.h:64
DLLLOCAL ~ReferenceHolder()
calls deref(ExceptionSink *) on the pointer being managed if not 0
Definition ReferenceHolder.h:61
DLLLOCAL const T * operator*() const
returns the pointer being managed
Definition ReferenceHolder.h:73
DLLLOCAL const T * operator->() const
returns the pointer being managed
Definition ReferenceHolder.h:70
DLLLOCAL T ** getPtrPtr()
returns a pointer to the pointer being managed
Definition ReferenceHolder.h:102
DLLLOCAL ReferenceHolder(ExceptionSink *xsink_)
creates an empty ReferenceHolder
Definition ReferenceHolder.h:55
DLLLOCAL T *& getRef()
returns a reference to the ptr being managed
Definition ReferenceHolder.h:105
DLLLOCAL T * operator*()
returns the pointer being managed
Definition ReferenceHolder.h:67
DLLLOCAL T * release()
releases the pointer to the caller
Definition ReferenceHolder.h:83
DLLLOCAL T * swap(T *val)
swaps the current value for a new one
Definition ReferenceHolder.h:92
DLLLOCAL void operator=(T *nv)
assigns a new pointer to the holder, dereferences the current pointer if any
Definition ReferenceHolder.h:76
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition ReferenceHolder.h:127
DLLLOCAL T * swap(T *val)
swaps the current value for a new one
Definition ReferenceHolder.h:169
DLLLOCAL SimpleRefHolder(SimpleRefHolder &&old)
move constructor
Definition ReferenceHolder.h:135