|
libassa 3.5.1
|
AutoPtrArray handles memory management of an array of objects. More...
#include <AutoPtr.h>
Public Member Functions | |
| AutoPtrArray (X *p_=0) | |
| Construct an AutoPtrArray from a raw pointer. | |
| AutoPtrArray (AutoPtrArray &a_) | |
| Construct AutoPtrArray from another AutoPtrArray. | |
| template<typename T> | |
| AutoPtrArray (AutoPtrArray< T > &a_) | |
| Construct AutoPtrArray from another AutoPtrArray of different (but related) type. | |
| AutoPtrArray & | operator= (AutoPtrArray &a_) |
| Assignment operator deletes memory it owns and transfers the ownership from a_ to itself. | |
| template<class T> | |
| AutoPtrArray & | operator= (AutoPtrArray< T > &a_) |
| Assignment from another AutoPtrArray of a different but related type. | |
| ~AutoPtrArray () | |
| When AutoPtrArray goes out of scope, the object it owns is deleted. | |
| X & | operator* () const |
| Smart pointer dereferencing. | |
| X * | operator-> () const |
| Smart pointer dereferencing. | |
| X & | operator[] (int i) const |
| Access operator. | |
| X * | get () const |
| Get a raw memory pointer without changing ownership status. | |
| X * | release () |
| Give up the ownership of the memory. | |
| void | reset (X *p_=0) |
| Forcibly delete the managed object and assume the ownership of a_. | |
| AutoPtrArray (AutoPtrArrayRef< X > ref_) | |
| Automagic conversions. | |
| AutoPtrArray & | operator= (AutoPtrArrayRef< X > ref_) |
| template<typename T> | |
| operator AutoPtrArrayRef< T > () | |
| template<typename T> | |
| operator AutoPtrArray< T > () | |
Private Attributes | |
| X * | m_ptr |
| Pointer to the object we own. | |
AutoPtrArray handles memory management of an array of objects.
|
inlineexplicit |
Construct an AutoPtrArray from a raw pointer.
The word 'explicit' disallows implicit construction of objects, for example in function calls.
| p_ | pointer (defaults to NULL) to assume ownerwhip for. |
Definition at line 210 of file AutoPtr.h.
References m_ptr.
Referenced by AutoPtrArray(), AutoPtrArray(), operator AutoPtrArray< T >(), operator=(), operator=(), and operator=().
|
inline |
Construct AutoPtrArray from another AutoPtrArray.
| a_ | AutoPtrArray object that gives up its ownership. |
Definition at line 216 of file AutoPtr.h.
References AutoPtrArray(), m_ptr, and release().
|
inline |
Construct AutoPtrArray from another AutoPtrArray of different (but related) type.
A pointer to T must be convertible to a pointer to X.
| a_ | AutoPtrArray object that is released of ownership. |
Definition at line 226 of file AutoPtr.h.
References AutoPtrArray(), m_ptr, and release().
|
inline |
|
inline |
Automagic conversions.
These operations convert an AutoPtrArray into/from an AutoPtrArrayRef as needed. This allows on-the-fly conversion between AutoPtrArray of different but related types (parent/child):
Definition at line 320 of file AutoPtr.h.
References m_ptr.
|
inline |
Get a raw memory pointer without changing ownership status.
Usefull when you need to pass a pointer to the function.
Definition at line 284 of file AutoPtr.h.
References m_ptr.
Referenced by operator=(), and operator[]().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assignment operator deletes memory it owns and transfers the ownership from a_ to itself.
| a_ | another AutoPtrArray of the same type. |
Definition at line 235 of file AutoPtr.h.
References AutoPtrArray(), release(), and reset().
|
inline |
Assignment from another AutoPtrArray of a different but related type.
| a_ | AutoPtrArray to assume ownership of |
Definition at line 246 of file AutoPtr.h.
References AutoPtrArray(), release(), and reset().
|
inline |
Definition at line 322 of file AutoPtr.h.
References AutoPtrArray(), get(), m_ptr, and ASSA::AutoPtrArrayRef< R >::m_ptr.
|
inline |
|
inline |
Give up the ownership of the memory.
When AutoPtrArray gets out of scope, nothing happens. The caller becomes responsible for the memory management.
Definition at line 291 of file AutoPtr.h.
References m_ptr.
Referenced by AutoPtrArray(), AutoPtrArray(), operator AutoPtrArray< T >(), operator AutoPtrArrayRef< T >(), operator=(), and operator=().
|
inline |
Forcibly delete the managed object and assume the ownership of a_.
Definition at line 301 of file AutoPtr.h.
References m_ptr.
Referenced by operator=(), and operator=().
|
private |
Pointer to the object we own.
Definition at line 201 of file AutoPtr.h.
Referenced by AutoPtrArray(), AutoPtrArray(), AutoPtrArray(), AutoPtrArray(), get(), operator*(), operator->(), operator=(), release(), reset(), and ~AutoPtrArray().