ACE  6.5.11
Public Member Functions | Public Attributes | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
ACE_Intrusive_Auto_Ptr Class 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) ...". More...
 
 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)
 
void operator= (const ACE_Intrusive_Auto_Ptr< X > &r)
 
X * operator-> (void) const
 Redirection operator. More...
 
X & operator* () const
 Accessor method. More...
 
X * release (void)
 
void reset (X *p=0)
 
X * get (void) const
 Get the pointer value. More...
 
long count (void) const
 Get the reference count value. More...
 
template<class X >
 ACE_Intrusive_Auto_Ptr (X *p, bool addref)
 
template<class X >
 ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr< X > &r)
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Returns true if this object does not contain a valid pointer. More...
 

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) ...". More...
 

Protected Attributes

X * rep_
 Protect operations on the ACE_Intrusive_Auto_Ptr. More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ ACE_Intrusive_Auto_Ptr() [1/5]

ACE_Intrusive_Auto_Ptr::ACE_Intrusive_Auto_Ptr ( X *  p = 0,
bool  addref = true 
)

Constructor that initializes an ACE_Intrusive_Auto_Ptr to the specified pointer value.

◆ ACE_Intrusive_Auto_Ptr() [2/5]

ACE_Intrusive_Auto_Ptr::ACE_Intrusive_Auto_Ptr ( const ACE_Intrusive_Auto_Ptr< X > &  r)

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/5]

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

◆ ~ACE_Intrusive_Auto_Ptr()

virtual ACE_Intrusive_Auto_Ptr::~ACE_Intrusive_Auto_Ptr ( void  )
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.

◆ ACE_Intrusive_Auto_Ptr() [4/5]

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

◆ ACE_Intrusive_Auto_Ptr() [5/5]

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

Member Function Documentation

◆ count()

long ACE_Intrusive_Auto_Ptr::count ( void  ) const

Get the reference count value.

◆ get()

X * ACE_Intrusive_Auto_Ptr::get ( void  ) const
inline

Get the pointer value.

◆ operator unspecified_bool_type()

ACE_Intrusive_Auto_Ptr::operator unspecified_bool_type ( ) const
inline

Enables "if (sp) ...".

◆ operator*()

X & ACE_Intrusive_Auto_Ptr::operator* ( ) const
inline

Accessor method.

◆ operator->()

X * ACE_Intrusive_Auto_Ptr::operator-> ( void  ) const
inline

Redirection operator.

◆ operator=()

void ACE_Intrusive_Auto_Ptr::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()

X * ACE_Intrusive_Auto_Ptr::release ( void  )
inline

Releases the reference to the underlying representation object.

Return values
Thepointer value prior to releasing it.

◆ reset()

void ACE_Intrusive_Auto_Ptr::reset ( X *  p = 0)
inline

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

◆ unspecified_bool()

static void ACE_Intrusive_Auto_Ptr::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

ACE_Intrusive_Auto_Ptr::ACE_ALLOC_HOOK_DECLARE

Returns true if this object does not contain a valid pointer.

Declare the dynamic allocation hooks.

◆ rep_

X* ACE_Intrusive_Auto_Ptr::rep_
protected

Protect operations on the ACE_Intrusive_Auto_Ptr.


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