StrongRefHandler Class Reference Data Structures

#include <baseref.h>

Inheritance diagram for StrongRefHandler:

详细描述

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.

静态公共成员函数

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 const VALUEKIND   KIND

私有成员函数

  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 *)

成员函数文档编制

◆  MAXON_MEMBERFUNCTION_DETECTOR() [1/3]

MAXON_MEMBERFUNCTION_DETECTOR ( InitialReference   )
private

◆  MAXON_MEMBERFUNCTION_DETECTOR() [2/3]

MAXON_MEMBERFUNCTION_DETECTOR ( AddReference   )
private

◆  MAXON_MEMBERFUNCTION_DETECTOR() [3/3]

MAXON_MEMBERFUNCTION_DETECTOR ( RemoveReference   )
private

◆  InitialReference()

static void InitialReference ( const T *  o )
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.

◆  AddReference()

static void AddReference ( const T *  o )
static

Adds a reference to the referenced object.

参数
[in] o Pointer to the referenced object, must not be nullptr.

◆  RemoveReference()

static MAXON_ATTRIBUTE_NO_INLINE void RemoveReference ( const T *  o )
static

Removes a reference to the referenced object.

参数
[in] o Pointer to the referenced object, must not be nullptr.

◆  AddWeakReference()

static void AddWeakReference ( const T *  o ,
WeakRefBase weakRef  
)
static

◆  CreateStrongReference()

static Bool CreateStrongReference ( const T *  o )
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).
返回
True if a strong reference could be added.

◆  GetReferenceCounter()

static StrongReferenceCounter & GetReferenceCounter ( const T *  o )
static

◆  MakeWritable()

static ResultRef <typename R::ReferencedType> MakeWritable ( R &  ref ,
Bool   resetOnError  
)
static

◆  ChangeTarget() [1/2]

static void ChangeTarget ( T *&  o ,
T *  newTarget  
)
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.

◆  ChangeTarget() [2/2]

static void ChangeTarget ( T *&  o ,
ResultMemT < T * >  newTarget  
)
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.

◆  MoveTarget()

static void MoveTarget ( T *&  srcReference ,
T *&  dstReference  
)
static

Moves a target from one BaseRef to another. This is being called when a BaseRef is moved to another BaseRef using operator =(&&).

参数
[in] srcReference Reference to the source object pointer.
[in] dstReference Reference to the destination object pointer.

◆  InitialReferenceImpl() [1/2]

static void InitialReferenceImpl ( const T *  obj ,
std::false_type *   
)
static private

◆  InitialReferenceImpl() [2/2]

static void InitialReferenceImpl ( const T *  obj ,
std::true_type *   
)
static private

◆  AddReferenceImpl() [1/2]

static void AddReferenceImpl ( const T *  obj ,
std::false_type *   
)
static private

◆  AddReferenceImpl() [2/2]

static void AddReferenceImpl ( const T *  obj ,
std::true_type *   
)
static private

◆  RemoveReferenceImpl() [1/2]

static void RemoveReferenceImpl ( const T *  obj ,
std::false_type *   
)
static private

◆  RemoveReferenceImpl() [2/2]

static void RemoveReferenceImpl ( const T *  obj ,
std::true_type *   
)
static private

◆  CreateStrongReferenceImpl() [1/2]

static Bool CreateStrongReferenceImpl ( const T *  obj ,
std::false_type *   
)
static private

◆  CreateStrongReferenceImpl() [2/2]

static Bool CreateStrongReferenceImpl ( const T *  obj ,
std::true_type *   
)
static private

◆  AddWeakReferenceImpl() [1/2]

static void AddWeakReferenceImpl ( const T *  obj ,
WeakRefBase weakRef ,
std::false_type *   
)
static private

◆  AddWeakReferenceImpl() [2/2]

static void AddWeakReferenceImpl ( const T *  obj ,
WeakRefBase weakRef ,
std::true_type *   
)
static private

◆  GetReferenceCounterImpl() [1/2]

static StrongReferenceCounter & GetReferenceCounterImpl ( const T *  obj ,
std::false_type *   
)
static private

◆  GetReferenceCounterImpl() [2/2]

static StrongReferenceCounter & GetReferenceCounterImpl ( const T *  obj ,
std::true_type *   
)
static private

Member Data Documentation

◆  KIND

const VALUEKIND KIND static