#include <Refcounted_Auto_Ptr.h>
Collaboration diagram for ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >:
Private Member Functions | |
X * | get (void) const |
Get the pointer value. | |
long | count (void) const |
Get the reference count value. | |
ACE_Refcounted_Auto_Ptr_Rep (X *p=0) | |
~ACE_Refcounted_Auto_Ptr_Rep (void) | |
Static Private Member Functions | |
static ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | internal_create (X *p) |
static ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | create (X *p) |
static ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > * | attach (ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *&rep) |
static void | detach (ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > *&rep) |
Private Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
ACE_Auto_Basic_Ptr< X > | ptr_ |
Pointer to the result. | |
ACE_Atomic_Op< ACE_LOCK, long > | ref_count_ |
Reference count. | |
Friends | |
class | ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > |
For internal use only.
ACE_Refcounted_Auto_Ptr_Rep is used internally by the ACE_Refcounted_Auto_Ptr class and is only accessible through it.
Definition at line 135 of file Refcounted_Auto_Ptr.h.
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ACE_Refcounted_Auto_Ptr_Rep | ( | X * | p = 0 |
) | [inline, private] |
Definition at line 74 of file Refcounted_Auto_Ptr.inl.
00075 : ptr_ (p), 00076 ref_count_ (0) 00077 { 00078 }
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::~ACE_Refcounted_Auto_Ptr_Rep | ( | void | ) | [inline, private] |
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 on rep.
@a | rep if success, 0 if there's an error obtaining the lock on rep. |
Definition at line 53 of file Refcounted_Auto_Ptr.inl.
References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_.
Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator=().
00054 { 00055 if (rep == 0) 00056 return 0; 00057 00058 ++rep->ref_count_; 00059 00060 return rep; 00061 }
ACE_BEGIN_VERSIONED_NAMESPACE_DECL long ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::count | ( | void | ) | const [inline, private] |
Get the reference count value.
Definition at line 11 of file Refcounted_Auto_Ptr.inl.
References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_, and ACE_Atomic_Op< ACE_LOCK, TYPE >::value().
Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::count().
00012 { 00013 return this->ref_count_.value(); 00014 }
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.
Definition at line 39 of file Refcounted_Auto_Ptr.inl.
References ACE_ASSERT, ACE_throw_bad_alloc, and ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::internal_create().
Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::reset().
00040 { 00041 // Yes set ref count to zero. 00042 ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = internal_create (p); 00043 #if defined (ACE_NEW_THROWS_EXCEPTIONS) 00044 if (temp == 0) 00045 ACE_throw_bad_alloc; 00046 #else 00047 ACE_ASSERT (temp != 0); 00048 #endif /* ACE_NEW_THROWS_EXCEPTIONS */ 00049 return temp; 00050 }
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)
Definition at line 64 of file Refcounted_Auto_Ptr.inl.
References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_.
Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator=(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::release(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::reset(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::~ACE_Refcounted_Auto_Ptr().
00065 { 00066 if (rep == 0) 00067 return; 00068 00069 if (rep->ref_count_-- == 0) 00070 delete rep; 00071 }
X * ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get | ( | void | ) | const [inline, private] |
Get the pointer value.
Definition at line 86 of file Refcounted_Auto_Ptr.inl.
References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ptr_.
Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator *(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator bool(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator!(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator->().
00087 { 00088 return this->ptr_.get (); 00089 }
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.
Definition at line 29 of file Refcounted_Auto_Ptr.inl.
References ACE_NEW_RETURN.
Referenced by ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::create().
00030 { 00031 ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = 0; 00032 ACE_NEW_RETURN (temp, 00033 (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>) (p), 00034 0); 00035 return temp; 00036 }
friend class ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > [friend] |
Definition at line 138 of file Refcounted_Auto_Ptr.h.
ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ACE_ALLOC_HOOK_DECLARE [private] |
ACE_Auto_Basic_Ptr<X> ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ptr_ [private] |
Pointer to the result.
Definition at line 174 of file Refcounted_Auto_Ptr.h.
Referenced by ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get().
ACE_Atomic_Op<ACE_LOCK, long> ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_ [mutable, private] |
Reference count.
Definition at line 177 of file Refcounted_Auto_Ptr.h.
Referenced by ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::attach(), ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::count(), and ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::detach().