Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Refcounted_Auto_Ptr Class Template Reference

This class implements support for a reference counted auto_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>

Collaboration diagram for ACE_Refcounted_Auto_Ptr:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Refcounted_Auto_Ptr (X *p = 0)
 Constructor that initializes an to point to the result <r> immediately.

 ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r)
 Copy constructor binds <this> and <r> to the same . An is created if necessary.

virtual ~ACE_Refcounted_Auto_Ptr (void)
 Destructor.

void operator= (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r)
 Assignment operator that binds <this> and <r> to the same . An is created if necessary.

int operator== (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const
 Equality operator that returns 1 if both ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> objects point to the same ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> object. Attention: It also returns 1 if both objects have just been instantiated and not used yet.

int operator!= (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const
 Inequality operator, which is the opposite of equality.

X* operator-> (void) const
 Redirection operator.

X& operator * () const
X* release (void)
 Sets the pointer value to 0 and returns its old value.

void reset (X *p = 0)
 Invokes delete on the previous pointer value and then sets the pointer value to the specified value.

X* get (void)
 Get the pointer value.

int count (void) const
 Get the reference count value.

int null (void) const
 Allows us to check for NULL on all ACE_Refcounted_Auto_Ptr objects.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Types

typedef ACE_Refcounted_Auto_Ptr_Rep<
X, ACE_LOCK> 
AUTO_REFCOUNTED_PTR_REP
 the ACE_Refcounted_Auto_Ptr_Rep.


Private Attributes

AUTO_REFCOUNTED_PTR_REPrep_
 Protect operations on the .


Detailed Description

template<class X, class ACE_LOCK> template class ACE_Refcounted_Auto_Ptr

This class implements support for a reference counted auto_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.


Member Typedef Documentation

template<classX, classACE_LOCK>
typedef ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::AUTO_REFCOUNTED_PTR_REP [private]
 

the ACE_Refcounted_Auto_Ptr_Rep.


Constructor & Destructor Documentation

template<classX, classACE_LOCK>
ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> ( X * p = 0 ) [inline]
 

Constructor that initializes an to point to the result <r> immediately.

template<classX, classACE_LOCK>
ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> ( const ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >& r ) [inline]
 

Copy constructor binds <this> and <r> to the same . An is created if necessary.

template<classX, classACE_LOCK>
ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::~ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> ( void ) [inline, virtual]
 

Destructor.


Member Function Documentation

template<classX, classACE_LOCK>
int ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::count ( void ) const [inline]
 

Get the reference count value.

template<classX, classACE_LOCK>
X * ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::get ( void ) [inline]
 

Get the pointer value.

template<classX, classACE_LOCK>
int ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::null ( void ) const [inline]
 

Allows us to check for NULL on all ACE_Refcounted_Auto_Ptr objects.

template<classX, classACE_LOCK>
X & ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::operator * ( ) const [inline]
 

template<classX, classACE_LOCK>
int ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::operator!= ( const ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >& r ) const [inline]
 

Inequality operator, which is the opposite of equality.

template<classX, classACE_LOCK>
X * ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::operator-> ( void ) const [inline]
 

Redirection operator.

template<classX, classACE_LOCK>
void ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::operator= ( const ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >& rhs ) [inline]
 

Assignment operator that binds <this> and <r> to the same . An is created if necessary.

template<classX, classACE_LOCK>
int ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::operator== ( const ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >& r ) const [inline]
 

Equality operator that returns 1 if both ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> objects point to the same ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> object. Attention: It also returns 1 if both objects have just been instantiated and not used yet.

template<classX, classACE_LOCK>
X * ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::release ( void ) [inline]
 

Sets the pointer value to 0 and returns its old value.

template<classX, classACE_LOCK>
void ACE_Refcounted_Auto_Ptr< X,ACE_LOCK >::reset ( X * p = 0 ) [inline]
 

Invokes delete on the previous pointer value and then sets the pointer value to the specified value.


Member Data Documentation

template<classX, classACE_LOCK>
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

template<classX, classACE_LOCK>
AUTO_REFCOUNTED_PTR_REP * ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::rep_ [private]
 

Protect operations on the .


The documentation for this class was generated from the following files:
Generated at Sat Dec 1 11:04:40 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000