Smart pointer class for managing COM-style reference-counted objects.
More...
#include <obj-ref-impl.hpp>
|
| SAutoRefPtr () |
| Default constructor that initializes the pointer to NULL.
|
|
| SAutoRefPtr (T *lp, BOOL bAddRef=TRUE) |
| Constructor that takes a pointer and optionally adds a reference.
|
|
| SAutoRefPtr (const SAutoRefPtr &src) |
| Copy constructor that adds a reference to the object.
|
|
| ~SAutoRefPtr () |
| Destructor that releases the object.
|
|
T * | operator-> () const |
| Overloaded operator-> to access members of the object.
|
|
| operator T* () const |
| Overloaded cast operator to T*.
|
|
T & | operator* () const |
| Overloaded dereference operator.
|
|
T ** | operator& () |
| Overloaded address-of operator.
|
|
bool | operator! () const |
| Overloaded not operator to check if the pointer is NULL.
|
|
bool | operator< (T *pT) const |
| Overloaded less-than operator.
|
|
bool | operator!= (T *pT) const |
| Overloaded not-equal operator.
|
|
bool | operator== (T *pT) const |
| Overloaded equal operator.
|
|
T * | operator= (T *lp) |
| Overloaded assignment operator from a raw pointer.
|
|
T * | operator= (const SAutoRefPtr< T > &lp) |
| Overloaded assignment operator from another SAutoRefPtr.
|
|
void | Release () |
| Releases the object and sets the pointer to NULL.
|
|
void | Attach (T *p2) |
| Attaches to an existing object without adding a reference.
|
|
T * | Detach () |
| Detaches the object without releasing it.
|
|
HRESULT | CopyTo (T **ppT) |
| Copies the pointer to another location and adds a reference.
|
|
|
T * | p |
| Pointer to the managed object.
|
|
template<class T>
class SAutoRefPtr< T >
Smart pointer class for managing COM-style reference-counted objects.
- Template Parameters
-
T | The type of the object being managed. |
Definition at line 74 of file obj-ref-impl.hpp.
◆ SAutoRefPtr() [1/3]
Default constructor that initializes the pointer to NULL.
Definition at line 78 of file obj-ref-impl.hpp.
◆ SAutoRefPtr() [2/3]
Constructor that takes a pointer and optionally adds a reference.
- Parameters
-
lp | The pointer to the object. |
bAddRef | Whether to add a reference to the object. |
Definition at line 86 of file obj-ref-impl.hpp.
◆ SAutoRefPtr() [3/3]
Copy constructor that adds a reference to the object.
- Parameters
-
src | The source smart pointer. |
Definition at line 97 of file obj-ref-impl.hpp.
◆ ~SAutoRefPtr()
◆ Attach()
Attaches to an existing object without adding a reference.
- Parameters
-
Definition at line 228 of file obj-ref-impl.hpp.
◆ CopyTo()
Copies the pointer to another location and adds a reference.
- Parameters
-
ppT | The destination pointer. |
- Returns
- S_OK if successful, E_POINTER if ppT is NULL.
Definition at line 249 of file obj-ref-impl.hpp.
◆ Detach()
Detaches the object without releasing it.
- Returns
- The pointer to the object.
Definition at line 239 of file obj-ref-impl.hpp.
◆ operator T*()
Overloaded cast operator to T*.
- Returns
- The pointer to the object.
Definition at line 124 of file obj-ref-impl.hpp.
◆ operator!()
Overloaded not operator to check if the pointer is NULL.
- Returns
- TRUE if the pointer is NULL, FALSE otherwise.
Definition at line 146 of file obj-ref-impl.hpp.
◆ operator!=()
Overloaded not-equal operator.
- Parameters
-
pT | The pointer to compare with. |
- Returns
- TRUE if the current pointer is not equal to pT, FALSE otherwise.
Definition at line 162 of file obj-ref-impl.hpp.
◆ operator&()
Overloaded address-of operator.
- Returns
- The address of the pointer.
Definition at line 138 of file obj-ref-impl.hpp.
◆ operator*()
Overloaded dereference operator.
- Returns
- The reference to the object.
Definition at line 131 of file obj-ref-impl.hpp.
◆ operator->()
Overloaded operator-> to access members of the object.
- Returns
- The pointer to the object.
Definition at line 117 of file obj-ref-impl.hpp.
◆ operator<()
Overloaded less-than operator.
- Parameters
-
pT | The pointer to compare with. |
- Returns
- TRUE if the current pointer is less than pT, FALSE otherwise.
Definition at line 154 of file obj-ref-impl.hpp.
◆ operator=() [1/2]
Overloaded assignment operator from another SAutoRefPtr.
- Parameters
-
lp | The source smart pointer. |
- Returns
- The pointer to the object.
Definition at line 198 of file obj-ref-impl.hpp.
◆ operator=() [2/2]
Overloaded assignment operator from a raw pointer.
- Parameters
-
- Returns
- The pointer to the object.
Definition at line 178 of file obj-ref-impl.hpp.
◆ operator==()
Overloaded equal operator.
- Parameters
-
pT | The pointer to compare with. |
- Returns
- TRUE if the current pointer is equal to pT, FALSE otherwise.
Definition at line 170 of file obj-ref-impl.hpp.
◆ Release()
Releases the object and sets the pointer to NULL.
Definition at line 216 of file obj-ref-impl.hpp.
The documentation for this class was generated from the following file: