# ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > Class Template Reference

An ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> object encapsulates a pointer to an object of type X. It is pointed to by ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> object[s] and only accessible through them. More...

`#include <Refcounted_Auto_Ptr.h>`

Collaboration diagram for ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >:

[legend]
List of all members.

## Private Member Functions

X * | release (void)
| Sets the pointer value to 0 and returns its old value.
void | reset (X *p=0)
X * | get (void) const
| 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.
| ACE_Refcounted_Auto_Ptr_Rep (X *p=0)
| ~ACE_Refcounted_Auto_Ptr_Rep (void)

## Static Private Member Functions

ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | internal_create (X *p)
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | create (X *p)
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | attach (ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *&rep)
void | detach (ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *&rep)
void | assign (ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *&rep, ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *new_rep)

## Private Attributes

| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.
ACE_Auto_Basic_Ptr< X > | ptr_
| Pointer to the result.
int | ref_count_
| Reference count.
ACE_LOCK | lock_
| Synchronization variable for the MT_SAFE <ace_hash_map_manager_ex>.

## Friends

class | ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>

## Detailed Description

### template<class X, class ACE_LOCK>
class ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >

An ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> object encapsulates a pointer to an object of type X. It is pointed to by ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> object[s] and only accessible through them.

## Constructor & Destructor Documentation

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ACE_Refcounted_Auto_Ptr_Rep | ( | X * | p = `0` | ) | `[inline, private]`

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::~ACE_Refcounted_Auto_Ptr_Rep | ( | void |  | ) | `[inline, private]`

## Member Function Documentation

template<class X, class ACE_LOCK>
void ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::assign | ( | ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *& | rep,
|  | ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | new_rep
| ) | `[inline, static, private]`

| Decreases the rep's reference count and and deletes rep if there are no more references to rep. Then assigns new_rep to rep. Precondition (rep != 0 && new_rep != 0)

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::attach | ( | ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *& | rep | ) | `[inline, static, private]`

| Increase the reference count and return argument. Uses the attribute "ace_lock_" to synchronize reference count updating. Precondition (rep != 0).

template<class X, class ACE_LOCK>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::count | ( | void |  | ) | const`[inline, private]`

| Get the reference count value.

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::create | ( | X * | p | ) | `[inline, static, private]`

| Create a ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> and initialize the reference count.

template<class X, class ACE_LOCK>
void ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::detach | ( | ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *& | rep | ) | `[inline, static, private]`

| Decreases the reference count and and deletes rep if there are no more references to rep. Precondition (rep != 0)

template<class X, class ACE_LOCK>
X * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get | ( | void |  | ) | const`[inline, private]`

| Get the pointer value.

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::internal_create | ( | X * | p | ) | `[inline, static, private]`

| Allocate a new ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> instance, returning NULL if it cannot be created.

template<class X, class ACE_LOCK>
int ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::null | ( | void |  | ) | const`[inline, private]`

| Allows us to check for NULL on all ACE_Refcounted_Auto_Ptr objects.

template<class X, class ACE_LOCK>
X * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::release | ( | void |  | ) | `[inline, private]`

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

template<class X, class ACE_LOCK>
void ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::reset | ( | X * | p = `0` | ) | `[inline, private]`

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

## Friends And Related Function Documentation

template<class X, class ACE_LOCK>
friend class ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>`[friend]`

## Member Data Documentation

template<class X, class ACE_LOCK>
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ACE_ALLOC_HOOK_DECLARE `[private]`

| Declare the dynamic allocation hooks.

template<class X, class ACE_LOCK>
ACE_LOCK ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::lock_ `[mutable, private]`

| Synchronization variable for the MT_SAFE <ace_hash_map_manager_ex>.

template<class X, class ACE_LOCK>
ACE_Auto_Basic_Ptr<X> ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ptr_ `[private]`

| Pointer to the result.

template<class X, class ACE_LOCK>
int ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_ `[private]`

| Reference count.

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

- Refcounted_Auto_Ptr.h
- Refcounted_Auto_Ptr.inl