This class implements support for a weak pointer that complements ACE_Strong_Bound_Ptr.
More...
#include <Bound_Ptr.h>
|
| ACE_Weak_Bound_Ptr (X *p=0) |
|
| ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) |
| Copy constructor binds this and r to the same object. More...
|
|
| ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) |
| Constructor binds this and r to the same object. More...
|
|
| ~ACE_Weak_Bound_Ptr (void) |
| Destructor. More...
|
|
void | operator= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) |
| Assignment operator that binds this and r to the same object. More...
|
|
void | operator= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) |
| Assignment operator that binds this and r to the same object. More...
|
|
bool | operator== (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
|
bool | operator== (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
|
bool | operator== (X *p) const |
|
bool | operator!= (const ACE_Weak_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. More...
|
|
bool | operator!= (const ACE_Strong_Bound_Ptr< X, ACE_LOCK > &r) const |
| Inequality operator, which is the opposite of equality. More...
|
|
bool | operator!= (X *p) const |
| Inequality operator, which is the opposite of equality. More...
|
|
ACE_Strong_Bound_Ptr< X, ACE_LOCK > | operator-> (void) const |
| Redirection operator. More...
|
|
ACE_Strong_Bound_Ptr< X, ACE_LOCK > | strong (void) const |
|
X * | unsafe_get (void) const |
|
void | reset (X *p=0) |
|
long | add_ref (void) |
| Increment the reference count on the underlying object. More...
|
|
long | remove_ref (void) |
|
bool | null (void) const |
| Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects. More...
|
|
This class implements support for a weak pointer that complements ACE_Strong_Bound_Ptr.
Unlike ACE_Strong_Bound_Ptr, assigning or copying instances of an ACE_Weak_Bound_Ptr will not automatically increment the reference count of the underlying object. What ACE_Weak_Bound_Ptr does is preserve the knowledge that the object is in fact reference counted, and thus provides an alternative to raw pointers where non-ownership associations must be maintained. When the last instance of an ACE_Strong_Bound_Ptr that references a particular object is destroyed or overwritten, the corresponding ACE_Weak_Bound_Ptr instances are set to NULL.
◆ COUNTER
◆ X_t
◆ ACE_Weak_Bound_Ptr() [1/3]
ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr |
( |
X * |
p = 0 | ) |
|
|
explicit |
Constructor that initializes an ACE_Weak_Bound_Ptr to point to the object <p> immediately.
◆ ACE_Weak_Bound_Ptr() [2/3]
Copy constructor binds this
and r to the same object.
◆ ACE_Weak_Bound_Ptr() [3/3]
Constructor binds this
and r to the same object.
◆ ~ACE_Weak_Bound_Ptr()
ACE_Weak_Bound_Ptr::~ACE_Weak_Bound_Ptr |
( |
void |
| ) |
|
|
inline |
◆ add_ref()
long ACE_Weak_Bound_Ptr::add_ref |
( |
void |
| ) |
|
|
inline |
Increment the reference count on the underlying object.
Returns the new reference count on the object. This function may be used to integrate the bound pointers into an external reference counting mechanism such as those used by COM or CORBA servants.
◆ null()
bool ACE_Weak_Bound_Ptr::null |
( |
void |
| ) |
const |
|
inline |
◆ operator!=() [1/3]
Inequality operator, which is the opposite of equality.
◆ operator!=() [2/3]
Inequality operator, which is the opposite of equality.
◆ operator!=() [3/3]
bool ACE_Weak_Bound_Ptr::operator!= |
( |
X * |
p | ) |
const |
|
inline |
Inequality operator, which is the opposite of equality.
◆ operator->()
Redirection operator.
It returns a temporary strong pointer and makes use of the chaining properties of operator-> to ensure that the underlying object does not disappear while you are using it. If you are certain of the lifetimes of the object, and do not want to incur the locking overhead, then use the unsafe_get method instead.
◆ operator=() [1/2]
Assignment operator that binds this
and r to the same object.
◆ operator=() [2/2]
Assignment operator that binds this
and r to the same object.
◆ operator==() [1/3]
Equality operator that returns true
if the ACE_Weak_Bound_Ptr and ACE_Strong_Bound_Ptr objects point to the same underlying object.
- Note
- It also returns
true
if both objects have just been instantiated and not used yet.
◆ operator==() [2/3]
Equality operator that returns true
if both ACE_Weak_Bound_Ptr objects point to the same underlying object.
- Note
- It also returns
true
if both objects have just been instantiated and not used yet.
◆ operator==() [3/3]
bool ACE_Weak_Bound_Ptr::operator== |
( |
X * |
p | ) |
const |
|
inline |
Equality operator that returns true
if the ACE_Weak_Bound_Ptr and the raw pointer point to the same underlying object.
◆ remove_ref()
long ACE_Weak_Bound_Ptr::remove_ref |
( |
void |
| ) |
|
|
inline |
Decrement the reference count on the underlying object, which is deleted if the count has reached zero. Returns the new reference count on the object. This function may be used to integrate the bound pointers into an external reference counting mechanism such as those used by COM or CORBA servants.
◆ reset()
void ACE_Weak_Bound_Ptr::reset |
( |
X * |
p = 0 | ) |
|
|
inline |
◆ strong()
Obtain a strong pointer corresponding to this weak pointer. This function is useful to create a temporary strong pointer for conversion to a reference.
◆ unsafe_get()
X * ACE_Weak_Bound_Ptr::unsafe_get |
( |
void |
| ) |
const |
|
inline |
Get the pointer value. Warning: this does not affect the reference count of the underlying object, so it may disappear on you while you are using it if you are not careful.
◆ ACE_Strong_Bound_Ptr< X, ACE_LOCK >
◆ ACE_ALLOC_HOOK_DECLARE
ACE_Weak_Bound_Ptr::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
◆ counter_
COUNTER* ACE_Weak_Bound_Ptr::counter_ |
|
private |
◆ ptr_
X* ACE_Weak_Bound_Ptr::ptr_ |
|
private |
The documentation for this class was generated from the following files: