StrongWeakRefPtr
Engine/source/core/util/refBase.h
This oxymoron is a pointer that reference-counts the referenced object but also NULLs out if the object goes away.
Private Attributes
Public Functions
StrongWeakRefPtr(T * ptr)
T *
bool
isNull()
bool
bool
operator!=(T * ptr)
T *
bool
operator==(T * ptr)
Detailed Description
This oxymoron is a pointer that reference-counts the referenced object but also NULLs out if the object goes away.
This is useful for situations where an object's lifetime is ultimately governed by a superior entity but where individual objects may also die independently of the superior entity. All client code should use StrongWeakRefs that keep object live as long as the superior entity doesn't step in and kill them (in which case, the client code sees the reference disappear).
Private Attributes
WeakRefBase::WeakReference * mReference
Public Functions
StrongWeakRefPtr()
StrongWeakRefPtr(T * ptr)
~StrongWeakRefPtr()
getPointer()
isNull()
operator T*()
operator!()
operator!=(T * ptr)
operator*()
operator->()
operator=(T * ptr)
operator==(T * ptr)