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

Public Member Functions | |
| ACE_Strong_Bound_Ptr (X *p=0) | |
| ACE_Strong_Bound_Ptr (auto_ptr< X > p) | |
| ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) | |
Copy constructor binds this and r to the same object. | |
| ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) | |
Constructor binds this and r to the same object. | |
| template<class Y> | ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr< Y, ACE_LOCK > &r) |
| ~ACE_Strong_Bound_Ptr (void) | |
| Destructor. | |
| void | operator= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) |
Assignment operator that binds this and r to the same object. | |
| void | operator= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) |
Assignment operator that binds this and r to the same object. | |
| template<class Y> ACE_Weak_Bound_Ptr< X, ACE_LOCK > & | operator= (const ACE_Strong_Bound_Ptr< Y, ACE_LOCK > &r) |
| bool | operator== (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
| bool | operator== (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
| bool | operator== (X *p) const |
| bool | operator!= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. | |
| bool | operator!= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. | |
| bool | operator!= (X *p) const |
| Inequality operator, which is the opposite of equality. | |
| X * | operator-> (void) const |
| Redirection operator. | |
| X & | operator * (void) const |
| Dereference operator. | |
| X * | get (void) const |
| Get the pointer value. | |
| void | reset (X *p=0) |
| void | reset (auto_ptr< X > p) |
| int | null (void) const |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Private Types | |
| typedef X | X_t |
| typedef ACE_Bound_Ptr_Counter< ACE_LOCK > | COUNTER |
| The ACE_Bound_Ptr_Counter type. | |
Private Attributes | |
| COUNTER * | counter_ |
| The reference counter. | |
| X * | ptr_ |
| The underlying object. | |
Friends | |
| class | ACE_Weak_Bound_Ptr< X, ACE_LOCK > |
| class | ACE_Strong_Bound_Ptr |
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 112 of file Bound_Ptr.h.
|
|||||
|
The ACE_Bound_Ptr_Counter type.
Definition at line 240 of file Bound_Ptr.h. Referenced by ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ACE_Strong_Bound_Ptr(), ACE_Strong_Bound_Ptr< X, ACE_LOCK >::operator=(), and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::reset(). |
|
|||||
|
Definition at line 232 of file Bound_Ptr.h. Referenced by ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ACE_Strong_Bound_Ptr(), ACE_Strong_Bound_Ptr< X, ACE_LOCK >::operator=(), and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::reset(). |
|
||||||||||
|
Constructor that initializes an ACE_Strong_Bound_Ptr to point to the object <p> immediately. Definition at line 147 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER.
|
|
||||||||||
|
Constructor that initializes an ACE_Strong_Bound_Ptr by stealing ownership of an object from an auto_ptr. Definition at line 154 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER.
|
|
||||||||||
|
Copy constructor binds
Definition at line 161 of file Bound_Ptr.inl.
|
|
||||||||||
|
Constructor binds
Definition at line 169 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00170 : counter_ (r.counter_), 00171 ptr_ (r.ptr_) 00172 { 00173 // When creating a strong pointer from a weak one we can't assume that the 00174 // underlying object still exists. Therefore we must check for a return value 00175 // of -1, which indicates that the object has been destroyed. 00176 if (COUNTER::attach_strong (this->counter_) == -1) 00177 { 00178 // Underlying object has already been deleted, so set this pointer to null. 00179 this->counter_ = COUNTER::create_strong (); 00180 this->ptr_ = 0; 00181 } 00182 } |
|
||||||||||||||
|
Copy constructor binds Definition at line 132 of file Bound_Ptr.h. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_, and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::X_t.
|
|
||||||||||
|
Destructor.
Definition at line 185 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00186 {
00187 if (COUNTER::detach_strong (this->counter_) == 0)
00188 delete this->ptr_;
00189 }
|
|
||||||||||
|
Get the pointer value.
Definition at line 286 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00287 {
00288 return this->ptr_;
00289 }
|
|
||||||||||
|
Allows us to check for NULL on all ACE_Strong_Bound_Ptr objects. Definition at line 292 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00293 {
00294 return this->ptr_ == 0;
00295 }
|
|
||||||||||
|
Dereference operator.
Definition at line 280 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00281 {
00282 return *this->ptr_;
00283 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 268 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00269 {
00270 return this->ptr_ != p;
00271 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 261 of file Bound_Ptr.inl.
00262 {
00263 // Use the weak pointer's operator!= since it will check for null.
00264 return r != *this;
00265 }
|
|
||||||||||
|
Inequality operator, which is the opposite of equality.
Definition at line 255 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
|
|
||||||||||
|
Redirection operator.
Definition at line 274 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00275 {
00276 return this->ptr_;
00277 }
|
|
||||||||||||||
|
Assignment operator that binds Definition at line 155 of file Bound_Ptr.h. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::counter_, and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00156 {
00157 // This operator is temporarily defined here to increase our chances
00158 // of being accepted by broken compilers.
00159 //
00160
00161 // This will work if &r == this, by first increasing the ref count
00162
00163 COUNTER *new_counter = r.counter_;
00164 X* new_ptr = dynamic_cast<X_t*> (r.ptr_);
00165 COUNTER::attach_strong (new_counter);
00166 if (COUNTER::detach_strong (this->counter_) == 0)
00167 delete this->ptr_;
00168 this->counter_ = new_counter;
00169 this->ptr_ = new_ptr;
00170
00171 return *this;
00172 }
|
|
||||||||||
|
Assignment operator that binds
Definition at line 209 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER, ACE_Weak_Bound_Ptr< X, ACE_LOCK >::counter_, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_, ACE_Weak_Bound_Ptr< X, ACE_LOCK >::ptr_, and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::X_t.
00210 {
00211 // This will work if &r == this, by first increasing the ref count, but
00212 // why go through all that?
00213 if (&rhs == this)
00214 return;
00215
00216 COUNTER *new_counter = rhs.counter_;
00217 X_t *new_ptr = rhs.ptr_;
00218
00219 // When creating a strong pointer from a weak one we can't assume that the
00220 // underlying object still exists. Therefore we must check for a return value
00221 // of -1, which indicates that the object has been destroyed.
00222 if (COUNTER::attach_strong (new_counter) == -1)
00223 {
00224 // Underlying object has already been deleted, so set this pointer to null.
00225 new_counter = COUNTER::create_strong ();
00226 new_ptr = 0;
00227 }
00228
00229 if (COUNTER::detach_strong (this->counter_) == 0)
00230 delete this->ptr_;
00231 this->counter_ = new_counter;
00232 this->ptr_ = new_ptr;
00233 }
|
|
||||||||||
|
Assignment operator that binds
Definition at line 192 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::counter_, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_, and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::X_t.
00193 {
00194 // This will work if &r == this, by first increasing the ref count, but
00195 // why go through all that?
00196 if (&rhs == this)
00197 return;
00198
00199 COUNTER *new_counter = rhs.counter_;
00200 X_t *new_ptr = rhs.ptr_;
00201 COUNTER::attach_strong (new_counter);
00202 if (COUNTER::detach_strong (this->counter_) == 0)
00203 delete this->ptr_;
00204 this->counter_ = new_counter;
00205 this->ptr_ = new_ptr;
00206 }
|
|
||||||||||
|
Equality operator that returns Definition at line 249 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_.
00250 {
00251 return this->ptr_ == p;
00252 }
|
|
||||||||||
|
Definition at line 242 of file Bound_Ptr.inl.
00243 {
00244 // Use the weak pointer's operator== since it will check for null.
00245 return r == *this;
00246 }
|
|
||||||||||
|
Definition at line 236 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::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 309 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_, ACE_Auto_Basic_Ptr< X >::release(), and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::X_t.
|
|
||||||||||
|
Resets the ACE_Strong_Bound_Ptr to refer to a different underlying object. Definition at line 298 of file Bound_Ptr.inl. References ACE_Strong_Bound_Ptr< X, ACE_LOCK >::COUNTER, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::ptr_, and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::X_t.
|
|
|||||
|
Definition at line 237 of file Bound_Ptr.h. |
|
|||||
|
Definition at line 234 of file Bound_Ptr.h. |
|
|||||
|
Declare the dynamic allocation hooks.
Definition at line 229 of file Bound_Ptr.h. |
|
|||||
|
The reference counter.
Definition at line 243 of file Bound_Ptr.h. Referenced by ACE_Weak_Bound_Ptr< X, ACE_LOCK >::operator=(), and ACE_Strong_Bound_Ptr< X, ACE_LOCK >::operator=(). |
|
|||||
1.3.6