#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 | |
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) |
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 129 of file Refcounted_Auto_Ptr.h.
|
Definition at line 74 of file Refcounted_Auto_Ptr.inl.
00075 : ptr_ (p), 00076 ref_count_ (0) 00077 { 00078 } |
|
Definition at line 81 of file Refcounted_Auto_Ptr.inl.
00082 { 00083 } |
|
Increase the reference count on rep.
Definition at line 53 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::ref_count_.
00054 { 00055 if (rep == 0) 00056 return 0; 00057 00058 ++rep->ref_count_; 00059 00060 return rep; 00061 } |
|
Get the reference count value.
Definition at line 11 of file Refcounted_Auto_Ptr.inl. References ACE_Atomic_Op< ACE_LOCK, long >::value(). Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::count().
00012 { 00013 return this->ref_count_.value(); 00014 } |
|
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().
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 } |
|
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_.
00065 { 00066 if (rep == 0) 00067 return; 00068 00069 if (rep->ref_count_-- == 0) 00070 delete rep; 00071 } |
|
Get the pointer value.
Definition at line 86 of file Refcounted_Auto_Ptr.inl. Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::null(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator *(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator->().
00087 { 00088 return this->ptr_.get (); 00089 } |
|
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 } |
|
Definition at line 132 of file Refcounted_Auto_Ptr.h. |
|
Declare the dynamic allocation hooks.
Definition at line 141 of file Refcounted_Auto_Ptr.h. |
|
Pointer to the result.
Definition at line 168 of file Refcounted_Auto_Ptr.h. |
|
Reference count.
Definition at line 171 of file Refcounted_Auto_Ptr.h. Referenced by ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::attach(), and ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::detach(). |