Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::CleanList Class Reference

#include <elm/util/Cleaner.h>

Public Member Functions

 ~CleanList (void)
 
void add (Cleaner *cleaner)
 
void clean (void)
 
Cleaneroperator() (Cleaner *cleaner)
 
template<class T >
const AutoPtr< T > & operator() (const AutoPtr< T > &object)
 
template<class T >
T * operator() (T *object)
 

Detailed Description

A CleanList is an easy way to not forget or to delegate clean-up in complex program. A CleanList receives a list of Cleaner object that records some cleanup to perform. When the CleanList is deleted or when the method clean() is called, clean-up actions of all stored object is invoked ensuring to not forget clean-up to perform. { CleanList to_clean; int *p = to_clean(new int); ... } // p deletion automatically performed at clean deletion

Constructor & Destructor Documentation

elm::CleanList::~CleanList ( void  )

References clean().

Member Function Documentation

void elm::CleanList::add ( Cleaner cleaner)

Add a cleaner to the list.

Parameters
cleanerCleaner to add.

References elm::genstruct::SLList< T, E >::add().

Referenced by operator()().

void elm::CleanList::clean ( void  )

Clean the recorded cleaners.

References elm::genstruct::SLList< T, E >::clear().

Referenced by ~CleanList().

Cleaner* elm::CleanList::operator() ( Cleaner cleaner)

References add().

template<class T >
const AutoPtr<T>& elm::CleanList::operator() ( const AutoPtr< T > &  object)

References add().

template<class T >
T* elm::CleanList::operator() ( T *  object)

References add().


The documentation for this class was generated from the following files: