#include <Refcounted_Auto_Ptr.h>
Collaboration diagram for ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >:
Public Member Functions | |
ACE_Refcounted_Auto_Ptr (X *p=0) | |
ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) | |
virtual | ~ACE_Refcounted_Auto_Ptr (void) |
void | operator= (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) |
bool | operator== (const ACE_Refcounted_Auto_Ptr< X, ACE_LOCK > &r) const |
bool | 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 |
Accessor method. | |
X * | release (void) |
void | reset (X *p=0) |
X * | get (void) const |
Get the pointer value. | |
long | count (void) const |
Get the reference count value. | |
bool | null (void) const |
Returns true if this object does not contain a valid pointer. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
typedef ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK > | AUTO_REFCOUNTED_PTR_REP |
the ACE_Refcounted_Auto_Ptr_Rep | |
Protected Attributes | |
AUTO_REFCOUNTED_PTR_REP * | rep_ |
Protect operations on the ACE_Refcounted_Auto_Ptr. |
The ACE_Refcounted_Auto_Ptr works by maintaining a reference to a separate representation object, ACE_Refcounted_Auto_Ptr_Rep. That separate representation object contains the reference count and the actual pointer value.
Definition at line 47 of file Refcounted_Auto_Ptr.h.
|
the ACE_Refcounted_Auto_Ptr_Rep
Definition at line 112 of file Refcounted_Auto_Ptr.h. Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::ACE_Refcounted_Auto_Ptr(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator=(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::reset(). |
|
Constructor that initializes an ACE_Refcounted_Auto_Ptr to the specified pointer value. Definition at line 92 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::AUTO_REFCOUNTED_PTR_REP.
00093 : rep_ (AUTO_REFCOUNTED_PTR_REP::create (p)) 00094 { 00095 } |
|
Copy constructor binds the new ACE_Refcounted_Auto_Ptr to the representation object referenced by r. An ACE_Refcounted_Auto_Ptr_Rep is created if necessary. Definition at line 98 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::AUTO_REFCOUNTED_PTR_REP.
00099 : rep_ (AUTO_REFCOUNTED_PTR_REP::attach (((ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &) r).rep_)) 00100 { 00101 } |
|
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. Definition at line 11 of file Refcounted_Auto_Ptr.cpp.
00012 { 00013 AUTO_REFCOUNTED_PTR_REP::detach (rep_); 00014 } |
|
Get the reference count value.
Definition at line 17 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::count().
|
|
Get the pointer value.
Definition at line 128 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get(). Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::release(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::reset().
|
|
Returns
Definition at line 23 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get().
|
|
Accessor method.
Definition at line 122 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get().
|
|
Inequality operator, which is the opposite of equality.
Definition at line 110 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::rep_.
|
|
Redirection operator.
Definition at line 116 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::get().
|
|
Assignment operator that binds the current object and r to the same ACE_Refcounted_Auto_Ptr_Rep. An ACE_Refcounted_Auto_Ptr_Rep is created if necessary. Definition at line 160 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::AUTO_REFCOUNTED_PTR_REP, and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::rep_.
00161 { 00162 // bind <this> to the same <ACE_Refcounted_Auto_Ptr_Rep> as <r>. 00163 AUTO_REFCOUNTED_PTR_REP *old_rep = this->rep_; 00164 if (rhs.rep_ != 0) 00165 { 00166 this->rep_ = AUTO_REFCOUNTED_PTR_REP::attach 00167 (const_cast<ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>& > (rhs).rep_); 00168 if (this->rep_ != 0) 00169 AUTO_REFCOUNTED_PTR_REP::detach (old_rep); 00170 } 00171 else // Assign a 0 rep to this 00172 { 00173 AUTO_REFCOUNTED_PTR_REP::detach (old_rep); 00174 this->rep_ = 0; 00175 } 00176 } |
|
Definition at line 104 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::rep_.
|
|
Releases the reference to the underlying representation object.
Definition at line 135 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get().
|
|
Releases the current pointer value and then sets a new pointer value specified by p. Definition at line 144 of file Refcounted_Auto_Ptr.inl. References ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::AUTO_REFCOUNTED_PTR_REP, and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get().
00145 { 00146 // Avoid deleting the underlying auto_ptr if assigning the same actual 00147 // pointer value. 00148 if (this->get () == p) 00149 return; 00150 00151 AUTO_REFCOUNTED_PTR_REP *old_rep = this->rep_; 00152 if ((this->rep_ = AUTO_REFCOUNTED_PTR_REP::create (p)) != 0) 00153 AUTO_REFCOUNTED_PTR_REP::detach (old_rep); 00154 else 00155 this->rep_ = old_rep; 00156 return; 00157 } |
|
Declare the dynamic allocation hooks.
Definition at line 108 of file Refcounted_Auto_Ptr.h. |
|
Protect operations on the ACE_Refcounted_Auto_Ptr.
Definition at line 115 of file Refcounted_Auto_Ptr.h. Referenced by ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator!=(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator=(), and ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::operator==(). |