ACE 8.0.0
|
This class implements support for a reference counted unique_ptr. Assigning or copying instances of an ACE_Refcounted_Auto_Ptr will automatically increment the reference count. When the last instance that references a ACE_Refcounted_Auto_Ptr instance is destroyed or overwritten, it will invoke delete on its underlying pointer. More...
#include <Refcounted_Auto_Ptr.h>
Public Member Functions | |
ACE_Refcounted_Auto_Ptr (X *p=nullptr) | |
ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) | |
virtual | ~ACE_Refcounted_Auto_Ptr () |
void | operator= (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) |
bool | operator== (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) const |
bool | operator!= (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) const |
Inequality operator, which is the opposite of equality. | |
X * | operator-> () const |
Redirection operator. | |
X & | operator* () const |
Accessor method. | |
bool | operator! () const |
Check rep easily. | |
operator unspecified_bool_type () const | |
Check rep easily. | |
X * | release () |
void | reset (X *p=nullptr) |
X * | get () const |
Get the pointer value. | |
long | count () const |
Get the reference count value. | |
bool | null () const |
Returns true if this object does not contain a valid pointer. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
typedef ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > | AUTO_REFCOUNTED_PTR_REP |
the ACE_Refcounted_Auto_Ptr_Rep | |
Protected Attributes | |
AUTO_REFCOUNTED_PTR_REP * | rep_ |
Protect operations on the ACE_Refcounted_Auto_Ptr. | |
Private Types | |
typedef void(* | unspecified_bool_type) (ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > ***) |
Static Private Member Functions | |
static void | unspecified_bool (ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > ***) |
Used to define a proper boolean conversion for "if (sp) ...". | |
This class implements support for a reference counted unique_ptr. Assigning or copying instances of an ACE_Refcounted_Auto_Ptr will automatically increment the reference count. When the last instance that references a ACE_Refcounted_Auto_Ptr instance is destroyed or overwritten, it will invoke delete on its underlying pointer.
The ACE_Refcounted_Auto_Ptr works by maintaining a reference to a separate representation object, ACE_Refcounted_Auto_Ptr_Rep. That separate representation object contains the reference count and the actual pointer value.
|
protected |
|
private |
|
inlineexplicit |
Constructor that initializes an ACE_Refcounted_Auto_Ptr to the specified pointer value.
|
inline |
Copy constructor binds the new ACE_Refcounted_Auto_Ptr to the representation object referenced by r. An ACE_Refcounted_Auto_Ptr_Rep is created if necessary.
|
virtual |
Destructor. Releases the reference to the underlying representation. If the release of that reference causes its reference count to reach 0, the representation object will also be destroyed.
|
inline |
Get the reference count value.
|
inline |
Get the pointer value.
|
inline |
Returns true
if this object does not contain a valid pointer.
|
inline |
Check rep easily.
|
inline |
Check rep easily.
|
inline |
Inequality operator, which is the opposite of equality.
|
inline |
Accessor method.
|
inline |
Redirection operator.
|
inline |
Assignment operator that binds the current object and r to the same ACE_Refcounted_Auto_Ptr_Rep. An ACE_Refcounted_Auto_Ptr_Rep is created if necessary.
|
inline |
Equality operator that returns true
if both ACE_Refcounted_Auto_Ptr objects point to the same underlying representation. It does not compare the actual pointers.
true
if both objects have just been instantiated and not used yet. Releases the reference to the underlying representation object.
The | pointer value prior to releasing it. |
|
inline |
Releases the current pointer value and then sets a new pointer value specified by p.
|
inlinestaticprivate |
Used to define a proper boolean conversion for "if (sp) ...".
ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
protected |
Protect operations on the ACE_Refcounted_Auto_Ptr.