#include <baseref.h>
StrongCOWRefHandler has to be used as template argument for BaseRef to obtain a reference to objects which support reference counting, and which shall have copy-on-write semantics. It shares the basic behavior of StrongRefHandler , but if a modification of the object is to be made through the reference, or if BaseRef::MakeWritable() is invoked, it is checked by invocation of GetReferenceCount() on the object if the reference is exclusive or not. If so, the object can be modified directly, otherwise a copy is made and set as new pointee of the reference. This way the other references to the original object aren't affected by the modification. If the allocation of a copy fails the reference will be set to null.
Classes |
|
struct | MakeWritableHelper |
struct | MakeWritableHelper< T, typename T::GenericContainerInterfaceMarker > |
静态公共成员函数 |
|
template<typename R > | |
static MAXON_ATTRIBUTE_NO_INLINE ResultRef < typename std::remove_const< typename R::ReferencedType >::type > | MakeWritable (R &ref, Bool resetOnError) |
![]() |
|
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 |
![]() |
|
static const VALUEKIND | KIND |
|
static |
[in] | resetOnError | If true (the default), the reference will be reset when the copy fails. If false, the reference will stay the same, but the function returns nullptr. |
|