32#ifndef _QORE_QORETYPESAFEREFERENCEHELPER_H
34#define _QORE_QORETYPESAFEREFERENCEHELPER_H
58friend struct qore_type_safe_ref_helper_priv_t;
87 DLLEXPORT
operator bool()
const;
153 template <
typename T>
155 T* rv =
reinterpret_cast<T*
>(
getUnique());
156 assert(!rv ||
dynamic_cast<T*
>(rv));
211 DLLLOCAL
void*
operator new(size_t) =
delete;
214 struct qore_type_safe_ref_helper_priv_t* priv;
The base class for all value and parse types in Qore expression trees.
Definition AbstractQoreNode.h:57
AutoVLock is a container for safely managing global variable and object lock handovers,...
Definition AutoVLock.h:80
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition ExceptionSink.h:50
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition QoreObject.h:61
helper class to manage variable references passed to functions and class methods, stack only,...
Definition QoreTypeSafeReferenceHelper.h:57
DLLEXPORT ExceptionSink * getExceptionSink() const
Returns the ExceptionSink object.
DLLEXPORT AbstractQoreNode * getUnique()
returns a pointer to the value with a unique reference count (so it can be updated in place)
DLLEXPORT int reset(const ReferenceNode *ref, ExceptionSink *xsink)
Clears any existing reference and assigns the reference to use.
DLLEXPORT const char * getTypeName() const
returns the type name of the reference's value
DLLEXPORT QoreTypeSafeReferenceHelper(const ReferenceNode *ref, ExceptionSink *xsink)
initializes the object and tries to get the pointer to the pointer of the lvalue expression target
DLLEXPORT int assign(QoreValue val)
assigns a value to the reference, assumes the reference is valid
DLLEXPORT QoreTypeSafeReferenceHelper(ExceptionSink *xsink)
Initializes the object without a reference.
DLLEXPORT int setObjKey(QoreObject *obj, const char *key, bool for_remove=false)
Moves the reference to the given key of the given object.
DLLEXPORT const QoreTypeInfo * getReferenceTypeInfo() const
Returns the type of the reference.
DLLEXPORT ~QoreTypeSafeReferenceHelper()
destroys the object
DLLEXPORT int set(const ReferenceNode *ref)
Assigns the reference to use.
DLLEXPORT QoreValue removeHashObjKey(const char *key)
Removes the given key of the current hash or object.
DLLEXPORT const QoreValue getValue() const
returns the reference's value
DLLEXPORT bool isLocked() const
Returns true if managing a lock.
DLLEXPORT AutoVLock & getVLock() const
Returns the variable lock.
DLLLOCAL T * getUnique()
returns a pointer to the value with a unique reference count (so it can be updated in place)
Definition QoreTypeSafeReferenceHelper.h:154
DLLEXPORT void close()
Closes the object and unlocks all locks.
DLLEXPORT qore_type_t getType() const
returns the type of the reference's value
DLLEXPORT int moveToHashObjKey(const char *key, bool for_remove=false)
Moves the reference to the given key of the hash or object of the current value.
parse type: reference to a lvalue expression
Definition ReferenceNode.h:45
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition common.h:76
The main value class in Qore, designed to be passed by value.
Definition QoreValue.h:279