libassa
3.5.1
|
AutoPtr is based on SGI implementation of a auto_ptr template that makes memory handling a little bit easier. More...
#include <AutoPtr.h>
Public Member Functions | |
AutoPtr (X *p_=0) | |
Construct an AutoPtr from a raw pointer. More... | |
AutoPtr (AutoPtr &a_) | |
Construct AutoPtr from another AutoPtr. More... | |
template<typename T > | |
AutoPtr (AutoPtr< T > &a_) | |
Construct AutoPtr from another AutoPtr of different (but related) type. More... | |
AutoPtr & | operator= (AutoPtr &a_) |
Assignment operator deletes memory it owns and transfers the ownership from a_ to itself. More... | |
template<class T > | |
AutoPtr & | operator= (AutoPtr< T > &a_) |
Assignment from another AutoPtr of a different but related type. More... | |
~AutoPtr () | |
When AutoPtr goes out of scope, the object it owns is deleted. More... | |
X & | operator* () const |
Smart pointer dereferencing. More... | |
X * | operator-> () const |
Smart pointer dereferencing. More... | |
X * | get () const |
Get a raw memory pointer without changing ownership status. More... | |
X * | release () |
Give up the ownership of the memory. More... | |
void | reset (X *p_=0) |
Forcibly delete the managed object and assume the ownership of a_. More... | |
AutoPtr (AutoPtrRef< X > ref_) | |
Automagic conversions. More... | |
AutoPtr & | operator= (AutoPtrRef< X > ref_) |
template<typename T > | |
operator AutoPtrRef< T > () | |
template<typename T > | |
operator AutoPtr< T > () | |
Private Attributes | |
X * | m_ptr |
Pointer to the object we own. More... | |
AutoPtr is based on SGI implementation of a auto_ptr template that makes memory handling a little bit easier.
AutoPtr interface does not completely confirm to that of auto_ptr as specified in C++ Standard.
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Automagic conversions.
These operations convert an AutoPtr into/from an AutoPtrRef as needed. This allows on-the-fly conversion between AutoPtr of different but related types (parent/child):
Definition at line 159 of file AutoPtr.h.
|
inline |
Get a raw memory pointer without changing ownership status.
Usefull when you need to pass a pointer to the function.
Definition at line 123 of file AutoPtr.h.
References ASSA::AutoPtr< X >::m_ptr.
Referenced by ASSA::Logger::log_open(), and ASSA::AutoPtr< X >::operator=().
|
inline |
Smart pointer dereferencing.
Definition at line 111 of file AutoPtr.h.
References ASSA::AutoPtr< X >::m_ptr.
|
inline |
Smart pointer dereferencing.
Definition at line 116 of file AutoPtr.h.
References ASSA::AutoPtr< X >::m_ptr.
|
inline |
Assignment operator deletes memory it owns and transfers the ownership from a_ to itself.
a_ | another AutoPtr of the same type. |
Definition at line 83 of file AutoPtr.h.
References ASSA::AutoPtr< X >::release(), and ASSA::AutoPtr< X >::reset().
|
inline |
Assignment from another AutoPtr of a different but related type.
a_ | AutoPtr to assume ownership of |
Definition at line 93 of file AutoPtr.h.
References ASSA::AutoPtr< X >::release(), and ASSA::AutoPtr< X >::reset().
|
inline |
Definition at line 161 of file AutoPtr.h.
References ASSA::AutoPtr< X >::get(), ASSA::AutoPtrRef< R >::m_ptr, and ASSA::AutoPtr< X >::m_ptr.
|
inline |
Give up the ownership of the memory.
When AutoPtr gets out of scope, nothing happens. The caller becomes responsible for the memory management.
Definition at line 130 of file AutoPtr.h.
References ASSA::AutoPtr< X >::m_ptr.
Referenced by ASSA::Logger::log_open(), ASSA::AutoPtr< X >::operator AutoPtr< T >(), ASSA::AutoPtr< X >::operator AutoPtrRef< T >(), and ASSA::AutoPtr< X >::operator=().
|
inline |
Forcibly delete the managed object and assume the ownership of a_.
Definition at line 140 of file AutoPtr.h.
References ASSA::AutoPtr< X >::m_ptr.
Referenced by ASSA::AutoPtr< X >::operator=().
|
private |
Pointer to the object we own.
Definition at line 52 of file AutoPtr.h.
Referenced by ASSA::AutoPtr< X >::get(), ASSA::AutoPtr< X >::operator*(), ASSA::AutoPtr< X >::operator->(), ASSA::AutoPtr< X >::operator=(), ASSA::AutoPtr< X >::release(), ASSA::AutoPtr< X >::reset(), and ASSA::AutoPtr< X >::~AutoPtr().