ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
ACE_Intrusive_Auto_Ptr< X > Class Template Reference

This class implements support for a reference counted auto_ptr. It assumes reference counting abilities of the parameterizing class. More...

#include <Intrusive_Auto_Ptr.h>

Public Member Functions

 operator unspecified_bool_type () const
 Enables "if (sp) ...".
 
 ACE_Intrusive_Auto_Ptr (X *p=0, bool addref=true)
 
 ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr< X > &r)
 
template<class U >
 ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr< U > &rhs)
 
virtual ~ACE_Intrusive_Auto_Ptr ()
 
void operator= (const ACE_Intrusive_Auto_Ptr< X > &r)
 
Xoperator-> () const
 Redirection operator.
 
Xoperator* () const
 Accessor method.
 
Xrelease ()
 
void reset (X *p=0)
 
Xget () const
 Get the pointer value.
 
long count () const
 Get the reference count value.
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 

Protected Types

typedef void(* unspecified_bool_type) (ACE_Intrusive_Auto_Ptr< X > ***)
 

Static Protected Member Functions

static void unspecified_bool (ACE_Intrusive_Auto_Ptr< X > ***)
 Used to define a proper boolean conversion for "if (sp) ...".
 

Protected Attributes

Xrep_
 Protect operations on the ACE_Intrusive_Auto_Ptr.
 

Detailed Description

template<class X>
class ACE_Intrusive_Auto_Ptr< X >

This class implements support for a reference counted auto_ptr. It assumes reference counting abilities of the parameterizing class.

Assigning or copying instances of an ACE_Intrusive_Auto_Ptr will automatically increment the reference count. When the last instance that references a ACE_Intrusive_Auto_Ptr instance is destroyed or overwritten, it will invoke delete on its underlying pointer.

The ACE_Intrusive_Auto_Ptr works by maintaining a reference to a separate representation object, ACE_Intrusive_Auto_Ptr_Rep. That separate representation object contains the reference count and the actual pointer value.

Member Typedef Documentation

◆ unspecified_bool_type

template<class X >
typedef void(* ACE_Intrusive_Auto_Ptr< X >::unspecified_bool_type) (ACE_Intrusive_Auto_Ptr< X > ***)
protected

Constructor & Destructor Documentation

◆ ACE_Intrusive_Auto_Ptr() [1/3]

template<class X >
ACE_Intrusive_Auto_Ptr< X >::ACE_Intrusive_Auto_Ptr ( X * p = 0,
bool addref = true )
inline

Constructor that initializes an ACE_Intrusive_Auto_Ptr to the specified pointer value.

◆ ACE_Intrusive_Auto_Ptr() [2/3]

Copy constructor binds the new ACE_Intrusive_Auto_Ptr to the representation object referenced by r. An ACE_Intrusive_Auto_Ptr_Rep is created if necessary.

◆ ACE_Intrusive_Auto_Ptr() [3/3]

template<class X >
template<class U >
ACE_Intrusive_Auto_Ptr< X >::ACE_Intrusive_Auto_Ptr ( const ACE_Intrusive_Auto_Ptr< U > & rhs)
inline

◆ ~ACE_Intrusive_Auto_Ptr()

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.

Member Function Documentation

◆ count()

template<class X >
long ACE_Intrusive_Auto_Ptr< X >::count ( ) const

Get the reference count value.

◆ get()

template<class X >
X * ACE_Intrusive_Auto_Ptr< X >::get ( ) const
inline

Get the pointer value.

◆ operator unspecified_bool_type()

Enables "if (sp) ...".

◆ operator*()

template<class X >
X & ACE_Intrusive_Auto_Ptr< X >::operator* ( ) const
inline

Accessor method.

◆ operator->()

template<class X >
X * ACE_Intrusive_Auto_Ptr< X >::operator-> ( ) const
inline

Redirection operator.

◆ operator=()

template<class X >
void ACE_Intrusive_Auto_Ptr< X >::operator= ( const ACE_Intrusive_Auto_Ptr< X > & r)
inline

Assignment operator that binds the current object and r to the same ACE_Intrusive_Auto_Ptr_Rep. An ACE_Intrusive_Auto_Ptr_Rep is created if necessary.

◆ release()

template<class X >
X * ACE_Intrusive_Auto_Ptr< X >::release ( )
inline

Releases the reference to the underlying representation object.

Return values
Thepointer value prior to releasing it.

◆ reset()

template<class X >
void ACE_Intrusive_Auto_Ptr< X >::reset ( X * p = 0)
inline

Releases the current pointer value and then sets a new pointer value specified by p.

◆ unspecified_bool()

template<class X >
static void ACE_Intrusive_Auto_Ptr< X >::unspecified_bool ( ACE_Intrusive_Auto_Ptr< X > *** )
inlinestaticprotected

Used to define a proper boolean conversion for "if (sp) ...".

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

template<class X >
ACE_Intrusive_Auto_Ptr< X >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ rep_

template<class X >
X* ACE_Intrusive_Auto_Ptr< X >::rep_
protected

Protect operations on the ACE_Intrusive_Auto_Ptr.


The documentation for this class was generated from the following files: