PUMA Library Reference Manual
|
#include <Puma/SmartPtr.h>
Template based smart pointer implementation.
Classes must be derived from SmartPtr::RefCnt to be compatible with this implementation. Example:
Classes | |
class | RefCnt |
Reference counter for objects used with SmartPtr. More... | |
Public Member Functions | |
SmartPtr () | |
Construct an empty smart pointer. | |
SmartPtr (const RefCnt *pointer) | |
Construct a new smart pointer. | |
SmartPtr (const SmartPtr ©) | |
Copy a smart pointer. | |
~SmartPtr () | |
Destroy the smart pointer. | |
void | clear () |
Clear this smart pointer. | |
bool | valid () const |
Check whether the smart pointer is valid. | |
bool | operator== (const SmartPtr &other) const |
Compare this smart pointer with another smart pointer. | |
SmartPtr & | operator= (const SmartPtr ©) |
Assign a new object to this smart pointer. | |
SmartPtr & | operator= (const RefCnt *copy) |
Assign a new object to this smart pointer. | |
operator bool () const | |
Conversion operator to check whether the smart pointer is valid. | |
operator T* () const | |
Conversion operator for the managed object pointer type. | |
operator const T * () const | |
Conversion operator for the managed object pointer type. | |
T * | operator-> () |
Dereference operator for the managed object pointer type. | |
const T * | operator-> () const |
Dereference operator for the managed object pointer type. | |
T * | operator* () |
Indirection operator for the managed object pointer type. | |
const T * | operator* () const |
Indirection operator for the managed object pointer type. | |
|
inline |
Construct an empty smart pointer.
|
inline |
Construct a new smart pointer.
pointer | A pointer to the object to manage. |
|
inline |
Copy a smart pointer.
Increases the reference count of the managed object.
copy | The smart pointer to copy. |
|
inline |
Destroy the smart pointer.
If this was the last smart pointer referencing the managed object, the object is destroyed too.
|
inline |
Clear this smart pointer.
If this was the last smart pointer referencing the managed object, the object is destroyed.
|
inline |
Conversion operator to check whether the smart pointer is valid.
|
inline |
Conversion operator for the managed object pointer type.
|
inline |
Conversion operator for the managed object pointer type.
|
inline |
Indirection operator for the managed object pointer type.
|
inline |
Indirection operator for the managed object pointer type.
|
inline |
Dereference operator for the managed object pointer type.
|
inline |
Dereference operator for the managed object pointer type.
|
inline |
Assign a new object to this smart pointer.
If this smart pointer already points to an object, then this object might be destroyed if not referenced by another smart pointer.
copy | The smart pointer to copy. |
|
inline |
Assign a new object to this smart pointer.
If this smart pointer already points to an object, then this object might be destroyed if not referenced by another smart pointer.
copy | The smart pointer to copy. |
|
inline |
Compare this smart pointer with another smart pointer.
other | The smart pointer to compare with. |
|
inline |
Check whether the smart pointer is valid.
A smart pointer is valid if the managed pointer isn't NULL.