#include <baseref.h>
StrongRefHandler has to be used as template argument for BaseRef to obtain a reference to objects which support reference counting. Whenever the pointer of such a BaseRef is set, the reference count of the pointee is increased by invocation of AddReference() on the pointee. If a pointer is cleared, the reference count of the pointee is decreased by means of RemoveReference(). If the reference count reaches zero, the pointee releases itself.
Classes | |
struct | HasAddReference< FlexibleArray< T, COUNT > > |
struct | HasRemoveReference< FlexibleArray< T, COUNT > > |
Static Public Member Functions | |
template<typename T > | |
static void | InitialReference (const T *o) |
template<typename T > | |
static void | AddReference (const T *o) |
template<typename T > | |
static MAXON_ATTRIBUTE_NO_INLINE void | RemoveReference (const T *o) |
template<typename T > | |
static void | AddWeakReference (const T *o, WeakRefBase &weakRef) |
template<typename T > | |
static Bool | CreateStrongReference (const T *o) |
template<typename T > | |
static StrongReferenceCounter & | GetReferenceCounter (const T *o) |
template<typename R > | |
static ResultRef< typename R::ReferencedType > | MakeWritable (R &ref, Bool resetOnError) |
template<typename T > | |
static void | ChangeTarget (T *&o, T *newTarget) |
template<typename T > | |
static void | ChangeTarget (T *&o, ResultMemT< T * > newTarget) |
template<typename T > | |
static void | MoveTarget (T *&srcReference, T *&dstReference) |
Static Public Attributes | |
static constexpr VALUEKIND | KIND |
Private Member Functions | |
MAXON_MEMBERFUNCTION_DETECTOR (InitialReference) | |
MAXON_MEMBERFUNCTION_DETECTOR (AddReference) | |
MAXON_MEMBERFUNCTION_DETECTOR (RemoveReference) | |
Static Private Member Functions | |
template<typename T > | |
static void | InitialReferenceImpl (const T *obj, std::false_type *) |
template<typename T > | |
static void | InitialReferenceImpl (const T *obj, std::true_type *) |
template<typename T > | |
static void | AddReferenceImpl (const T *obj, std::false_type *) |
template<typename T > | |
static void | AddReferenceImpl (const T *obj, std::true_type *) |
template<typename T > | |
static void | RemoveReferenceImpl (const T *obj, std::false_type *) |
template<typename T > | |
static void | RemoveReferenceImpl (const T *obj, std::true_type *) |
template<typename T > | |
static Bool | CreateStrongReferenceImpl (const T *obj, std::false_type *) |
template<typename T > | |
static Bool | CreateStrongReferenceImpl (const T *obj, std::true_type *) |
template<typename T > | |
static void | AddWeakReferenceImpl (const T *obj, WeakRefBase &weakRef, std::false_type *) |
template<typename T > | |
static void | AddWeakReferenceImpl (const T *obj, WeakRefBase &weakRef, std::true_type *) |
template<typename T > | |
static StrongReferenceCounter & | GetReferenceCounterImpl (const T *obj, std::false_type *) |
template<typename T > | |
static StrongReferenceCounter & | GetReferenceCounterImpl (const T *obj, std::true_type *) |
|
private |
|
private |
|
private |
|
static |
Sets the initial reference to a newly allocated object (slightly more efficient than AddReference).
[in] | o | Pointer to the referenced object, must not be nullptr. |
|
static |
Adds a reference to the referenced object.
[in] | o | Pointer to the referenced object, must not be nullptr. |
|
static |
Removes a reference to the referenced object.
[in] | o | Pointer to the referenced object, must not be nullptr. |
|
static |
|
static |
Tries to add a strong reference. If the object is already being released this will return false.
[in] | o | Weakly referenced object (might be nullptr). |
|
static |
|
static |
Changes the target of the reference (removes it from the old target and adds it to the new one).
[in] | o | Reference to the pointer to the old object. |
[in] | newTarget | Pointer to the new target object. |
|
static |
Changes the target of the reference to a yet unreferenced object.
[in] | o | Reference to the pointer to the old object. |
[in] | newTarget | Pointer to a just allocated unreferenced target object. |
|
static |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticconstexpr |