HDK
|
A reference counter base class for use with UT_IntrusivePtr. More...
#include <UT_IntrusivePtr.h>
Public Member Functions | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter () noexcept |
Default constructor: Sets counter to 0. More... | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept |
Copy constructor: Sets counter to 0. More... | |
UT_IntrusiveRefCounter & | operator= (const UT_IntrusiveRefCounter &) noexcept |
Assignment operator: Does not modify counter. More... | |
SYS_FORCE_INLINE uint32 | use_count () const noexcept |
Return current counter. More... | |
SYS_FORCE_INLINE bool | conditionalAddRef () noexcept |
Protected Member Functions | |
SYS_FORCE_INLINE | ~UT_IntrusiveRefCounter () |
Destructor: Only derived classes can destruct this. More... | |
Friends | |
void | intrusive_ptr_add_ref (const UT_IntrusiveRefCounter< DerivedT, Deleter, CounterPolicyT > *p) noexcept |
void | intrusive_ptr_release (const UT_IntrusiveRefCounter< DerivedT, Deleter, CounterPolicyT > *p) noexcept |
void | intrusive_ptr_add_ref (const UT_IntrusiveRefCounter< DerivedT, Deleter, CounterPolicyT > *p, typename CounterPolicyT::pod_type refs_to_add) noexcept |
void | intrusive_ptr_release (const UT_IntrusiveRefCounter< DerivedT, Deleter, CounterPolicyT > *p, typename CounterPolicyT::pod_type refs_to_remove) noexcept |
A reference counter base class for use with UT_IntrusivePtr.
This base class can be used with user-defined classes to add support for UT_IntrusivePtr
. The class contains a reference counter defined by the CounterPolicyT
. Upon releasing the last UT_IntrusivePtr
referencing the object derived from the UT_IntrusiveRefCounter
class, operator delete
is automatically called on the pointer to the object.
The other template parameter, DerivedT
, is the user's class that derives from UT_IntrusiveRefCounter
.
Example:
Definition at line 242 of file UT_IntrusivePtr.h.
|
inlinenoexcept |
Default constructor: Sets counter to 0.
Definition at line 288 of file UT_IntrusivePtr.h.
|
inlinenoexcept |
Copy constructor: Sets counter to 0.
Definition at line 294 of file UT_IntrusivePtr.h.
|
inlineprotected |
Destructor: Only derived classes can destruct this.
Definition at line 321 of file UT_IntrusivePtr.h.
|
inlinenoexcept |
Adds a reference only if the reference count is not zero. This can be used to implement an operation similar to weak_ptr::lock().
Definition at line 313 of file UT_IntrusivePtr.h.
|
inlinenoexcept |
Assignment operator: Does not modify counter.
Definition at line 299 of file UT_IntrusivePtr.h.
|
inlinenoexcept |
Return current counter.
Definition at line 305 of file UT_IntrusivePtr.h.
|
friend |
Definition at line 345 of file UT_IntrusivePtr.h.
|
friend |
Definition at line 364 of file UT_IntrusivePtr.h.
|
friend |
Definition at line 352 of file UT_IntrusivePtr.h.
|
friend |
Definition at line 372 of file UT_IntrusivePtr.h.