nux-0.9.48
|
A weak smart pointer class. Implemented as an intrusive smart pointer. More...
#include <NuxCore/ObjectPtr.h>
Public Member Functions | |
ObjectWeakPtr () | |
Constructor. | |
ObjectWeakPtr (T *ptr, bool WarnMissuse=false) | |
Construction with a base pointer of type T. | |
template<typename O > | |
ObjectWeakPtr (O *ptr, bool WarnMissuse=false) | |
Construction with a base pointer of type O that inherits from type T. | |
ObjectWeakPtr (const ObjectWeakPtr< T > &other) | |
Copy constructor. | |
template<typename O > | |
ObjectWeakPtr (const ObjectWeakPtr< O > &other) | |
Copy constructor. | |
template<typename O > | |
ObjectWeakPtr (const ObjectPtr< O > &other) | |
Construction from a smart pointer of type O that inherits from type T. | |
ObjectWeakPtr & | operator= (const ObjectWeakPtr< T > &other) |
Assignment of a weak smart pointer of type T. | |
template<typename O > | |
ObjectWeakPtr & | operator= (const ObjectWeakPtr< O > &other) |
Assignment of a weak smart pointer of Type O that inherits from type T. | |
template<typename O > | |
ObjectWeakPtr & | operator= (const ObjectPtr< O > &other) |
Assignment of a smart pointer of Type T. | |
ObjectWeakPtr & | operator= (T *ptr) |
Construction with a base pointer of type T. | |
template<typename O > | |
ObjectWeakPtr & | operator= (O *ptr) |
Construction with a base pointer of type O that inherits from type T. | |
~ObjectWeakPtr () | |
T & | operator* () const |
T * | operator-> () const |
bool | operator< (T *ptr) const |
bool | operator> (T *ptr) const |
bool | operator< (ObjectWeakPtr< T > other) const |
bool | operator> (ObjectWeakPtr< T > other) const |
bool | operator!= (T *ptr) const |
bool | operator== (T *ptr) const |
template<typename U > | |
bool | operator!= (U *ptr) const |
template<typename U > | |
bool | operator== (U *ptr) const |
template<typename U > | |
bool | operator!= (const ObjectWeakPtr< U > &other) const |
template<typename U > | |
bool | operator== (const ObjectWeakPtr< U > &other) const |
template<typename U > | |
bool | operator!= (const ObjectPtr< U > &other) const |
template<typename U > | |
bool | operator== (const ObjectPtr< U > &other) const |
bool | operator() () const |
Return true is the hosted pointer is not null or has not been destroyed. | |
bool | IsValid () const |
Return true is the hosted pointer is not null or has not been destroyed. | |
bool | IsNull () const |
Return true is the hosted pointer is null or has been destroyed. | |
bool | Release () |
Release the hosted pointer from this object. | |
const T * | GetPointer () const |
Return the stored pointer. | |
T * | GetPointer () |
Return the stored pointer. | |
int | GetReferenceCount () |
int | GetWeakReferenceCount () |
Friends | |
class | ObjectWeakPtr |
class | SmartPtr |
template<typename U > | |
bool | operator== (U *, const ObjectWeakPtr< U > &a) |
template<typename U > | |
bool | operator!= (U *, const ObjectWeakPtr< U > &a) |
template<typename U , typename F > | |
ObjectWeakPtr< U > | staticCast (const ObjectWeakPtr< F > &from) |
template<typename U , typename F > | |
ObjectWeakPtr< U > | constCast (const ObjectWeakPtr< F > &from) |
template<typename U , typename F > | |
ObjectWeakPtr< U > | dynamicCast (const ObjectWeakPtr< F > &from) |
template<typename U , typename F > | |
ObjectWeakPtr< U > | checkedCast (const ObjectWeakPtr< F > &from) |
template<typename U , typename F > | |
ObjectWeakPtr< U > | queryCast (const ObjectWeakPtr< F > &from) |
A weak smart pointer class. Implemented as an intrusive smart pointer.
A weak smart pointer is built from a smart pointer or another weak smart pointer. It increments and decrements the total reference count of an pointer. Even is the original pointer is destroyed, weak smart pointers still point to the RefCounts pointers of the original pointer and can use it to check if the pointer is still valid or not.
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | ) | [inline] |
Constructor.
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | T * | ptr, |
bool | WarnMissuse = false |
||
) | [inline, explicit] |
Construction with a base pointer of type T.
ptr | Start maintaining a reference count of the passed pointer. |
WarnMissuse | If True, then ObjectPtr test is ptr is owned or not. If ptr is not owned and WarnMissuse is True, then Print a warning message. This is a debug feature to detect cases such as "ObjectPtr(ObjectA) myobject(ptr);", because the calling code will no longer have a reference on ptr. |
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | O * | ptr, |
bool | WarnMissuse = false |
||
) | [inline, explicit] |
Construction with a base pointer of type O that inherits from type T.
ptr | Start maintaining a reference count of the passed pointer. |
WarnMissuse | If True, then ObjectPtr test is ptr is owned or not. If ptr is not owned and WarnMissuse is True, then Print a warning message. This is a debug feature to detect cases such as "ObjectPtr(ObjectA) myobject(ptr);", because the calling code will no longer have a reference on ptr. |
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | const ObjectWeakPtr< T > & | other | ) | [inline] |
Copy constructor.
other | Parameter with type T. |
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | const ObjectWeakPtr< O > & | other | ) | [inline] |
Copy constructor.
other | Parameter with a type derived from T. |
nux::ObjectWeakPtr< T >::ObjectWeakPtr | ( | const ObjectPtr< O > & | other | ) | [inline] |
Construction from a smart pointer of type O that inherits from type T.
other | Maintains a weak smart pointer reference to this parameter. |
nux::ObjectWeakPtr< T >::~ObjectWeakPtr | ( | ) | [inline] |
const T* nux::ObjectWeakPtr< T >::GetPointer | ( | ) | const [inline] |
Return the stored pointer.
Caller of this function should Reference the pointer if they intend to keep it.
Return | the stored pointer. |
Referenced by nux::ObjectWeakPtr< BaseWindow >::GetPointer(), nux::WindowCompositor::GetProcessingTopView(), nux::ObjectWeakPtr< BaseWindow >::IsNull(), nux::ObjectWeakPtr< BaseWindow >::IsValid(), nux::ObjectWeakPtr< BaseWindow >::operator()(), nux::ObjectWeakPtr< BaseWindow >::operator*(), nux::ObjectWeakPtr< BaseWindow >::operator->(), and nux::ObjectWeakPtr< BaseWindow >::operator=().
T* nux::ObjectWeakPtr< T >::GetPointer | ( | ) | [inline] |
Return the stored pointer.
Caller of this function should Reference the pointer if they intend to keep it.
Return | the stored pointer. |
int nux::ObjectWeakPtr< T >::GetReferenceCount | ( | ) | [inline] |
int nux::ObjectWeakPtr< T >::GetWeakReferenceCount | ( | ) | [inline] |
bool nux::ObjectWeakPtr< T >::IsNull | ( | ) | const [inline] |
Return true is the hosted pointer is null or has been destroyed.
bool nux::ObjectWeakPtr< T >::IsValid | ( | ) | const [inline] |
Return true is the hosted pointer is not null or has not been destroyed.
bool nux::ObjectWeakPtr< T >::operator!= | ( | const ObjectPtr< U > & | other | ) | const [inline] |
An object pointer
bool nux::ObjectWeakPtr< T >::operator!= | ( | T * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator!= | ( | const ObjectWeakPtr< U > & | other | ) | const [inline] |
A weak pointer
bool nux::ObjectWeakPtr< T >::operator!= | ( | U * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator() | ( | ) | const [inline] |
Return true is the hosted pointer is not null or has not been destroyed.
T& nux::ObjectWeakPtr< T >::operator* | ( | void | ) | const [inline] |
T* nux::ObjectWeakPtr< T >::operator-> | ( | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator< | ( | T * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator< | ( | ObjectWeakPtr< T > | other | ) | const [inline] |
ObjectWeakPtr& nux::ObjectWeakPtr< T >::operator= | ( | const ObjectWeakPtr< O > & | other | ) | [inline] |
Assignment of a weak smart pointer of Type O that inherits from type T.
other | Weak smart pointer of type O. |
ObjectWeakPtr& nux::ObjectWeakPtr< T >::operator= | ( | T * | ptr | ) | [inline] |
Construction with a base pointer of type T.
ptr | Start maintaining a reference count of the passed pointer. |
WarnMissuse | If True, then ObjectPtr test is ptr is owned or not. If ptr is not owned and WarnMissuse is True, then Print a warning message. This is a debug feature to detect cases such as "ObjectPtr(ObjectA) myobject(ptr);", because the calling code will no longer have a reference on ptr. |
ObjectWeakPtr& nux::ObjectWeakPtr< T >::operator= | ( | O * | ptr | ) | [inline] |
Construction with a base pointer of type O that inherits from type T.
ptr | Start maintaining a reference count of the passed pointer. |
WarnMissuse | If True, then ObjectPtr test is ptr is owned or not. If ptr is not owned and WarnMissuse is True, then Print a warning message. This is a debug feature to detect cases such as "ObjectPtr(ObjectA) myobject(ptr);", because the calling code will no longer have a reference on ptr. |
ObjectWeakPtr& nux::ObjectWeakPtr< T >::operator= | ( | const ObjectPtr< O > & | other | ) | [inline] |
Assignment of a smart pointer of Type T.
other | Maintains a smart pointer reference to this parameter. Assignment of a smart pointer of Type O that inherits from type T. |
other | Maintains a weak smart pointer reference to this parameter. |
ObjectWeakPtr& nux::ObjectWeakPtr< T >::operator= | ( | const ObjectWeakPtr< T > & | other | ) | [inline] |
Assignment of a weak smart pointer of type T.
other | Weak smart pointer of type T. |
bool nux::ObjectWeakPtr< T >::operator== | ( | T * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator== | ( | const ObjectPtr< U > & | other | ) | const [inline] |
An object pointer
bool nux::ObjectWeakPtr< T >::operator== | ( | U * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator== | ( | const ObjectWeakPtr< U > & | other | ) | const [inline] |
A weak pointer
bool nux::ObjectWeakPtr< T >::operator> | ( | ObjectWeakPtr< T > | other | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::operator> | ( | T * | ptr | ) | const [inline] |
bool nux::ObjectWeakPtr< T >::Release | ( | ) | [inline] |
Release the hosted pointer from this object.
Release the hosted pointer from this object. After this call, the following members are null: _reference_count _weak_reference_count ptr_ This call decreases the count of weak reference before setting _weak_reference_count to null.
ObjectWeakPtr<U> checkedCast | ( | const ObjectWeakPtr< F > & | from | ) | [friend] |
ObjectWeakPtr<U> constCast | ( | const ObjectWeakPtr< F > & | from | ) | [friend] |
ObjectWeakPtr<U> dynamicCast | ( | const ObjectWeakPtr< F > & | from | ) | [friend] |
friend class ObjectWeakPtr [friend] |
bool operator!= | ( | U * | , |
const ObjectWeakPtr< U > & | a | ||
) | [friend] |
bool operator== | ( | U * | , |
const ObjectWeakPtr< U > & | a | ||
) | [friend] |
ObjectWeakPtr<U> queryCast | ( | const ObjectWeakPtr< F > & | from | ) | [friend] |
friend class SmartPtr [friend] |
ObjectWeakPtr<U> staticCast | ( | const ObjectWeakPtr< F > & | from | ) | [friend] |