PointerHandler Class Reference

#include <baseref.h>

Inheritance diagram for PointerHandler:

Detailed Description

PointerHandler has to be used as template argument for BaseRef to obtain a reference with ordinary C++-pointer-like behavior. This means that no actions are performed when references are set or cleared. The easiest way to make use of PointerHandler is to use the Pointer template which is a BaseRef with PointerHandler argument.

Static Public Member Functions

template<typename T >
static void InitialReference (const T *o)
 
template<typename T >
static void AddReference (T *o)
 
template<typename T >
static void RemoveReference (T *o)
 
template<typename T >
static void ChangeTarget (T *&o, T *newTarget)
 
template<typename T >
static void ChangeTarget (T *&o, ResultPtr< T > newTarget)
 
template<typename T >
static void MoveTarget (T *&srcReference, T *&dstReference)
 
template<typename R >
static ResultRef< typename R::ReferencedType > MakeWritable (R &ref, Bool resetOnError)
 

Static Public Attributes

static constexpr VALUEKIND KIND
 

Member Function Documentation

◆ InitialReference()

static void InitialReference ( const T *  o)
static

Sets the initial reference to a newly allocated object (slightly more efficient than AddReference).

Parameters
[in]oPointer to the referenced object, must not be nullptr.

◆ AddReference()

static void AddReference ( T *  o)
static

Adds a reference to the referenced object.

Parameters
[in]oPointer to the referenced object, must not be nullptr.

◆ RemoveReference()

static void RemoveReference ( T *  o)
static

Removes a reference to the referenced object.

Parameters
[in]oPointer to the referenced object, must not be nullptr.

◆ ChangeTarget() [1/2]

static void ChangeTarget ( T *&  o,
T *  newTarget 
)
static

Changes the target of the pointer.

Parameters
[in]oReference to the pointer to the old object.
[in]newTargetPointer to the new target object.

◆ ChangeTarget() [2/2]

static void ChangeTarget ( T *&  o,
ResultPtr< T >  newTarget 
)
static

◆ MoveTarget()

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

Moves a target from one pointer to another.

Parameters
[in]srcReferenceReference to the source object pointer.
[in]dstReferenceReference to the destination object pointer.

◆ MakeWritable()

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

Member Data Documentation

◆ KIND

constexpr VALUEKIND KIND
staticconstexpr