#include <Bound_Ptr.h>
Collaboration diagram for ACE_Strong_Bound_Ptr:

Public Methods | |
| ACE_EXPLICIT | ACE_Strong_Bound_Ptr (X *p=0) |
| Constructor that initializes an ACE_Strong_Bound_Ptr to point to the object <p> immediately. More... | |
| ACE_EXPLICIT | ACE_Strong_Bound_Ptr (auto_ptr< X > p) |
| Constructor that initializes an ACE_Strong_Bound_Ptr by stealing ownership of an object from an auto_ptr. More... | |
| ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) | |
| Copy constructor binds <this> and <r> to the same object. More... | |
| ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) | |
| Constructor binds <this> and <r> to the same object. More... | |
| ~ACE_Strong_Bound_Ptr (void) | |
| Destructor. More... | |
| void | operator= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) |
| Assignment operator that binds <this> and <r> to the same object. More... | |
| void | operator= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) |
| Assignment operator that binds <this> and <r> to the same object. More... | |
| int | operator== (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
| Equality operator that returns 1 if both ACE_Strong_Bound_Ptr instances point to the same underlying object. More... | |
| int | operator== (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
| Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and ACE_Weak_Bound_Ptr objects point to the same underlying object. More... | |
| int | operator== (X *p) const |
| Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and the raw pointer point to the same underlying object. More... | |
| int | operator!= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. More... | |
| int | operator!= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. More... | |
| int | operator!= (X *p) const |
| Inequality operator, which is the opposite of equality. More... | |
| X * | operator-> (void) const |
| Redirection operator. More... | |
| X & | operator * (void) const |
| Dereference operator. More... | |
| X * | get (void) |
| Get the pointer value. More... | |
| void | reset (X *p=0) |
| Resets the ACE_Strong_Bound_Ptr to refer to a different underlying object. More... | |
| void | reset (auto_ptr< X > p) |
| Resets the ACE_Strong_Bound_Ptr to refer to a different underlying object, ownership of which is stolen from the auto_ptr. More... | |
| int | null (void) const |
| Allows us to check for NULL on all ACE_Strong_Bound_Ptr objects. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Private Types | |
| typedef ACE_Bound_Ptr_Counter< ACE_LOCK > | COUNTER |
| The ACE_Bound_Ptr_Counter type. More... | |
Private Attributes | |
| COUNTER * | counter_ |
| The reference counter. More... | |
| X * | ptr_ |
| The underlying object. More... | |
Friends | |
| class | ACE_Weak_Bound_Ptr< X, ACE_LOCK > |
Assigning or copying instances of an ACE_Strong_Bound_Ptr will automatically increment the reference count of the underlying object. When the last instance of an ACE_Strong_Bound_Ptr that references a particular object is destroyed or overwritten, it will invoke delete on its underlying pointer.
Definition at line 109 of file Bound_Ptr.h.
|
|||||
|
The ACE_Bound_Ptr_Counter type.
Definition at line 194 of file Bound_Ptr.h. |
|
||||||||||
|
Constructor that initializes an ACE_Strong_Bound_Ptr to point to the object <p> immediately.
Definition at line 142 of file Bound_Ptr.i.
|
|
||||||||||
|
Constructor that initializes an ACE_Strong_Bound_Ptr by stealing ownership of an object from an auto_ptr.
Definition at line 149 of file Bound_Ptr.i.
|
|
||||||||||
|
Copy constructor binds <this> and <r> to the same object.
Definition at line 156 of file Bound_Ptr.i.
|
|
||||||||||
|
Constructor binds <this> and <r> to the same object.
Definition at line 164 of file Bound_Ptr.i. References counter_, and ptr_.
00165 : counter_ (r.counter_), 00166 ptr_ (r.ptr_) 00167 { 00168 // When creating a strong pointer from a weak one we can't assume that the 00169 // underlying object still exists. Therefore we must check for a return value 00170 // of -1, which indicates that the object has been destroyed. 00171 if (COUNTER::attach_strong (this->counter_) == -1) 00172 { 00173 // Underlying object has already been deleted, so set this pointer to null. 00174 this->counter_ = COUNTER::create_strong (); 00175 this->ptr_ = 0; 00176 } 00177 } |
|
||||||||||
|
Destructor.
Definition at line 180 of file Bound_Ptr.i. References ptr_.
00181 {
00182 if (COUNTER::detach_strong (this->counter_) == 0)
00183 delete this->ptr_;
00184 }
|
|
||||||||||
|
Get the pointer value.
Definition at line 275 of file Bound_Ptr.i. References ptr_.
00276 {
00277 return this->ptr_;
00278 }
|
|
||||||||||
|
Allows us to check for NULL on all ACE_Strong_Bound_Ptr objects.
Definition at line 281 of file Bound_Ptr.i. References ptr_.
00282 {
00283 return this->ptr_ == 0;
00284 }
|
|
||||||||||
|
Dereference operator.
Definition at line 269 of file Bound_Ptr.i. References ptr_.
00270 {
00271 return *this->ptr_;
00272 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 257 of file Bound_Ptr.i. References ptr_.
00258 {
00259 return this->ptr_ != p;
00260 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 250 of file Bound_Ptr.i.
00251 {
00252 // Use the weak pointer's operator!= since it will check for null.
00253 return r != *this;
00254 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 244 of file Bound_Ptr.i. References ptr_.
|
|
||||||||||
|
Redirection operator.
Definition at line 263 of file Bound_Ptr.i. References ptr_.
00264 {
00265 return this->ptr_;
00266 }
|
|
||||||||||
|
Assignment operator that binds <this> and <r> to the same object.
Definition at line 201 of file Bound_Ptr.i. References counter_, ACE_Weak_Bound_Ptr::counter_, ptr_, and ACE_Weak_Bound_Ptr::ptr_.
00202 {
00203 // This will work if &r == this, by first increasing the ref count
00204
00205 COUNTER *new_counter = rhs.counter_;
00206 X* new_ptr = rhs.ptr_;
00207
00208 // When creating a strong pointer from a weak one we can't assume that the
00209 // underlying object still exists. Therefore we must check for a return value
00210 // of -1, which indicates that the object has been destroyed.
00211 if (COUNTER::attach_strong (new_counter) == -1)
00212 {
00213 // Underlying object has already been deleted, so set this pointer to null.
00214 new_counter = COUNTER::create_strong ();
00215 new_ptr = 0;
00216 }
00217
00218 if (COUNTER::detach_strong (this->counter_) == 0)
00219 delete this->ptr_;
00220 this->counter_ = new_counter;
00221 this->ptr_ = new_ptr;
00222 }
|
|
||||||||||
|
Assignment operator that binds <this> and <r> to the same object.
Definition at line 187 of file Bound_Ptr.i. References counter_, and ptr_.
00188 {
00189 // This will work if &r == this, by first increasing the ref count
00190
00191 COUNTER *new_counter = rhs.counter_;
00192 X* new_ptr = rhs.ptr_;
00193 COUNTER::attach_strong (new_counter);
00194 if (COUNTER::detach_strong (this->counter_) == 0)
00195 delete this->ptr_;
00196 this->counter_ = new_counter;
00197 this->ptr_ = new_ptr;
00198 }
|
|
||||||||||
|
Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and the raw pointer point to the same underlying object.
Definition at line 238 of file Bound_Ptr.i. References ptr_.
00239 {
00240 return this->ptr_ == p;
00241 }
|
|
||||||||||
|
Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and ACE_Weak_Bound_Ptr objects point to the same underlying object.
Definition at line 231 of file Bound_Ptr.i.
00232 {
00233 // Use the weak pointer's operator== since it will check for null.
00234 return r == *this;
00235 }
|
|
||||||||||
|
Equality operator that returns 1 if both ACE_Strong_Bound_Ptr instances point to the same underlying object.
Definition at line 225 of file Bound_Ptr.i. References ptr_.
|
|
||||||||||
|
Resets the ACE_Strong_Bound_Ptr to refer to a different underlying object, ownership of which is stolen from the auto_ptr.
Definition at line 298 of file Bound_Ptr.i. References counter_, ptr_, and ACE_Auto_Basic_Ptr::release.
|
|
||||||||||
|
Resets the ACE_Strong_Bound_Ptr to refer to a different underlying object.
Definition at line 287 of file Bound_Ptr.i. References counter_, and ptr_.
|
|
|||||
|
Definition at line 191 of file Bound_Ptr.h. |
|
|||||
|
Declare the dynamic allocation hooks.
Definition at line 188 of file Bound_Ptr.h. |
|
|||||
|
The reference counter.
Definition at line 197 of file Bound_Ptr.h. Referenced by ACE_Strong_Bound_Ptr, ACE_Weak_Bound_Ptr::operator=, operator=, and reset. |
|
|||||
|
The underlying object.
Definition at line 200 of file Bound_Ptr.h. Referenced by ACE_Strong_Bound_Ptr, get, null, operator *, ACE_Weak_Bound_Ptr::operator!=, operator!=, operator->, ACE_Weak_Bound_Ptr::operator=, operator=, ACE_Weak_Bound_Ptr::operator==, operator==, reset, and ~ACE_Strong_Bound_Ptr. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002