Public Member Functions

cl7::memory::AutoDelete< T > Class Template Reference

#include <AutoDelete.h>

List of all members.

Public Member Functions

 AutoDelete (void)
 AutoDelete (T *pointer)
 AutoDelete (T *pointer, bool is_array)
 AutoDelete (AutoDelete &rhs)
AutoDeleteoperator= (AutoDelete &rhs)
 ~AutoDelete (void)
const T * get () const
const T * operator-> () const
const T & operator* () const
T * get ()
T * operator-> ()
T & operator* ()
void reset (T *pointer)
void reset (T *pointer, bool is_array)
void destruct ()
void decontrol ()
void swap (AutoDelete< T > &rhs)

Detailed Description

template<typename T>
class cl7::memory::AutoDelete< T >

An object wrapper that deletes the object(s) on destruction. It additionally holds a flag specifying whether the wrapper is responsible for the object(s) to delete. Only one wrapper should be responsible for the delete operation. If a wrapper is created through the copy constructor or the copy assignment operator, the new wrapper becomes responsible (if the source wrapper was responsible at all). This class works very similar to std::auto_ptr.


Constructor & Destructor Documentation

template<typename T >
cl7::memory::AutoDelete< T >::AutoDelete ( void   )  [inline]

Default constructor.

template<typename T >
cl7::memory::AutoDelete< T >::AutoDelete ( T *  pointer  )  [inline, explicit]

Explicit constructor.

template<typename T >
cl7::memory::AutoDelete< T >::AutoDelete ( T *  pointer,
bool  is_array 
) [inline]

Explicit constructor.

template<typename T >
cl7::memory::AutoDelete< T >::AutoDelete ( AutoDelete< T > &  rhs  )  [inline]

Copy constructor.

template<typename T >
cl7::memory::AutoDelete< T >::~AutoDelete ( void   )  [inline]

Destructor.


Member Function Documentation

template<typename T >
void cl7::memory::AutoDelete< T >::decontrol (  )  [inline]

Forces the wrapper to lose responsibility for the delete operation.

template<typename T >
void cl7::memory::AutoDelete< T >::destruct (  )  [inline]

Deletes the object(s) (if responsible).

template<typename T >
const T* cl7::memory::AutoDelete< T >::get (  )  const [inline]

Returns the pointer to the object(s).

template<typename T >
T* cl7::memory::AutoDelete< T >::get (  )  [inline]

Returns the pointer to the object(s).

template<typename T >
const T& cl7::memory::AutoDelete< T >::operator* (  )  const [inline]

Returns the (first) object.

template<typename T >
T& cl7::memory::AutoDelete< T >::operator* (  )  [inline]

Returns the (first) object.

template<typename T >
const T* cl7::memory::AutoDelete< T >::operator-> (  )  const [inline]

Returns the pointer to the object(s).

template<typename T >
T* cl7::memory::AutoDelete< T >::operator-> (  )  [inline]

Returns the pointer to the object(s).

template<typename T >
AutoDelete& cl7::memory::AutoDelete< T >::operator= ( AutoDelete< T > &  rhs  )  [inline]

Copy assignment operator.

template<typename T >
void cl7::memory::AutoDelete< T >::reset ( T *  pointer,
bool  is_array 
) [inline]

Replaces the pointer by another one. The current object(s) will be deleted if the wrapper is responsible. The wrapper will be responsible for the newly set object(s). The flag specifying whether the pointer holds an array of objects is reset.

template<typename T >
void cl7::memory::AutoDelete< T >::reset ( T *  pointer  )  [inline]

Replaces the pointer by another one. The current object(s) will be deleted if the wrapper is responsible. The wrapper will be responsible for the newly set object(s). The flag specifying whether the pointer holds an array of objects remains unchanged.

template<typename T >
void cl7::memory::AutoDelete< T >::swap ( AutoDelete< T > &  rhs  )  [inline]

Swaps the contents of two wrappers.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines