Simpatico
v1.10
|
A pointer that may or may not own the object to which it points.
FlexPtr overloads * and ->, and thus mimics a built-in pointer in most respects.
The acquire(T*) method copies a built-in pointer and accept ownership of the object to which it points, i.e., accepts responsibility for deleting the object, normally when the FlexPtr goes out of scope.
The copy(T*) method copies a built-in pointer without accepting ownership, i.e., without accepting responsibility for deleting the object to which it points.
Both acquire() and copy() destroy any object that is already owned by this FlexPtr before copying of a new pointer.
#include <FlexPtr.h>
Public Types | |
typedef T | element_type |
Type of object pointed to. More... | |
Public Member Functions | |
FlexPtr () | |
Constructor. More... | |
~FlexPtr () | |
Destructor. More... | |
void | acquire (T *p) |
Copy a built-in pointer, and accept ownership. More... | |
void | copy (T *p) |
Copy a built-in pointer, without accepting ownership. More... | |
T & | operator* () const |
Dereference. More... | |
T * | operator-> () const |
Member access. More... | |
T * | get () const |
Return the built-in pointer. More... | |
typedef T Util::FlexPtr< T >::element_type |
|
inline |
|
inline |
|
inline |
Copy a built-in pointer, and accept ownership.
If this FlexPtr already owns an object, it will be deleted before acquiring a new pointer.
Throws an Exception if p is null.
p | Built-in pointer to be acquired. |
Definition at line 73 of file FlexPtr.h.
References UTIL_THROW.
|
inline |
Copy a built-in pointer, without accepting ownership.
If this FlexPtr already owns an object, it will be deleted before copying a new pointer.
p | Built-in pointer to be copied. |
Definition at line 93 of file FlexPtr.h.
References UTIL_THROW.
|
inline |
|
inline |
|
inline |
Return the built-in pointer.
Definition at line 120 of file FlexPtr.h.
References Util::FlexPtr< T >::FlexPtr().
Referenced by Util::isNull().