DLSingletonDestroyer< SINGLETON > Class Template Reference

An object used to destroy singleton objects. More...

#include <DLSingletonDestroyer.h>

List of all members.

Public Member Functions

 DLSingletonDestroyer ()
 ~DLSingletonDestroyer ()
void SetSingleton (SINGLETON *s)


Detailed Description

template<class SINGLETON>
class DLSingletonDestroyer< SINGLETON >

An object used to destroy singleton objects.

Singleton objects are long-lived objects that live through the entire lifespan of an application. Most of the time, the memory allocated by the singleton object will be released when the application terminates. However, the destructor of the singleton object is not explicitly called in order to give the object a graceful destruction, since the singleton objects are created on the heap.

The main purpose of the DLSingletonDestroyer object is to gracefully destroy a singleton object.

This class should only be used within a singleton object. Upon creation, a singleton object registers itself with the DLSingletonDestroyer, which then takes responsibility for the object's deletion. In DOCLIB this class is used with DLImageFactory and the various image format classes.

Definition at line 29 of file DLSingletonDestroyer.h.


Constructor & Destructor Documentation

template<class SINGLETON>
DLSingletonDestroyer< SINGLETON >::DLSingletonDestroyer (  )  [inline]

Default constructor

Definition at line 35 of file DLSingletonDestroyer.h.

template<class SINGLETON>
DLSingletonDestroyer< SINGLETON >::~DLSingletonDestroyer (  )  [inline]

Destructor: deletes the instance of the singleton object which this object is responsible for.

Definition at line 41 of file DLSingletonDestroyer.h.


Member Function Documentation

template<class SINGLETON>
void DLSingletonDestroyer< SINGLETON >::SetSingleton ( SINGLETON *  s  )  [inline]

Assign responsibility for the destruction of a singleton object to this destroyer.

Parameters:
s pointer to the singleton object

Definition at line 49 of file DLSingletonDestroyer.h.


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

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007