WPILibC++
unspecified
|
IntrusiveRefCntPtr - A template class that implements a "smart pointer" that assumes the wrapped object has a reference count associated with it that can be managed via calls to IntrusivePtrAddRef/IntrusivePtrRelease. More...
#include <IntrusiveRefCntPtr.h>
Public Types | |
typedef T | element_type |
Public Member Functions | |
IntrusiveRefCntPtr (T *obj) | |
IntrusiveRefCntPtr (const IntrusiveRefCntPtr &S) | |
IntrusiveRefCntPtr (IntrusiveRefCntPtr &&S) | |
template<class X > | |
IntrusiveRefCntPtr (IntrusiveRefCntPtr< X > &&S) | |
template<class X > | |
IntrusiveRefCntPtr (const IntrusiveRefCntPtr< X > &S) | |
IntrusiveRefCntPtr & | operator= (IntrusiveRefCntPtr S) |
T & | operator* () const |
T * | operator-> () const |
T * | get () const |
operator bool () const | |
void | swap (IntrusiveRefCntPtr &other) |
void | reset () |
void | resetWithoutRelease () |
Friends | |
template<typename X > | |
class | IntrusiveRefCntPtr |
IntrusiveRefCntPtr - A template class that implements a "smart pointer" that assumes the wrapped object has a reference count associated with it that can be managed via calls to IntrusivePtrAddRef/IntrusivePtrRelease.
The smart pointers manage reference counts via the RAII idiom: upon creation of smart pointer the reference count of the wrapped object is incremented and upon destruction of the smart pointer the reference count is decremented. This class also safely handles wrapping NULL pointers.
Reference counting is implemented via calls to Obj->Retain()/Obj->Release(). Release() is required to destroy the object when the reference count reaches zero. Inheriting from RefCountedBase/RefCountedBaseVPTR takes care of this automatically.