#include <AutoPtr.h>
Collaboration diagram for ASSA::AutoPtrArray< X >:
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 () | |
template<typename T> | |
operator AutoPtrArray () | |
Private Attributes | |
X * | m_ptr |
Pointer to the object we own. |
Definition at line 198 of file AutoPtr.h.
|
Construct an AutoPtrArray from a raw pointer. The word 'explicit' disallows implicit construction of objects, for example in function calls.
Definition at line 210 of file AutoPtr.h. 00210 : m_ptr (p_) { /* no-op */ }
|
|
Construct AutoPtrArray from another AutoPtrArray.
Definition at line 216 of file AutoPtr.h. 00216 : m_ptr (a_.release ()) {/* no-op */ }
|
|
Construct AutoPtrArray from another AutoPtrArray of different (but related) type. A pointer to T must be convertible to a pointer to X.
Definition at line 226 of file AutoPtr.h. 00227 : m_ptr (a_.release ()) { /* no-op */ }
|
|
When AutoPtrArray goes out of scope, the object it owns is deleted. Not owning anything has no effect. Definition at line 255 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::m_ptr.
|
|
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): AutoPtrArray<Derived> FooReturnsAutoPtrArray () { ... }; AutoPtrArray<Base> aptr = FooReturnsAutoPtrArray (); Definition at line 320 of file AutoPtr.h. 00320 : m_ptr (ref_.m_ptr) { /* no-op */ }
|
|
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 ASSA::AutoPtrArray< X >::m_ptr. Referenced by ASSA::AutoPtrArray< X >::operator=(), and ASSA::AutoPtrArray< X >::operator[](). 00284 { return m_ptr; }
|
|
Smart pointer dereferencing.
Definition at line 264 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::m_ptr. 00264 { return *m_ptr; }
|
|
Definition at line 334 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::release(). 00334 { return AutoPtrArray<T> (release ()); }
|
|
Definition at line 331 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::release(). 00331 { return AutoPtrArrayRef<T> (release ()); }
|
|
Smart pointer dereferencing.
Definition at line 269 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::m_ptr. 00269 { return m_ptr; }
|
|
Definition at line 322 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::get(), ASSA::AutoPtrArray< X >::m_ptr, and ASSA::AutoPtrArrayRef< R >::m_ptr. 00322 { 00323 if (ref_.m_ptr != get ()) { 00324 delete [] m_ptr; 00325 m_ptr = ref_.m_ptr; 00326 } 00327 return *this; 00328 }
|
|
Assignment from another AutoPtrArray of a different but related type.
Definition at line 246 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::release(), and ASSA::AutoPtrArray< X >::reset(). 00246 { 00247 reset (a_.release ()); 00248 return *this; 00249 }
|
|
Assignment operator deletes memory it owns and transfers the ownership from a_ to itself.
Definition at line 235 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::release(), and ASSA::AutoPtrArray< X >::reset(). 00235 { 00236 reset (a_.release ()); 00237 return *this; 00238 }
|
|
Access operator.
Definition at line 274 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::get(). 00274 { 00275 X* array = get (); 00276 return (array [i]); 00277 }
|
|
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 ASSA::AutoPtrArray< X >::m_ptr. Referenced by ASSA::AutoPtrArray< X >::operator AutoPtrArray(), ASSA::AutoPtrArray< X >::operator AutoPtrArrayRef(), and ASSA::AutoPtrArray< X >::operator=().
|
|
Forcibly delete the managed object and assume the ownership of a_.
Definition at line 301 of file AutoPtr.h. References ASSA::AutoPtrArray< X >::m_ptr. Referenced by ASSA::AutoPtrArray< X >::operator=().
|
|
Pointer to the object we own.
Definition at line 201 of file AutoPtr.h. Referenced by ASSA::AutoPtrArray< X >::get(), ASSA::AutoPtrArray< X >::operator *(), ASSA::AutoPtrArray< X >::operator->(), ASSA::AutoPtrArray< X >::operator=(), ASSA::AutoPtrArray< X >::release(), ASSA::AutoPtrArray< X >::reset(), and ASSA::AutoPtrArray< X >::~AutoPtrArray(). |