#include <DLSingletonDestroyer.h>
Public Member Functions | |
DLSingletonDestroyer () | |
~DLSingletonDestroyer () | |
void | SetSingleton (SINGLETON *s) |
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.
DLSingletonDestroyer< SINGLETON >::DLSingletonDestroyer | ( | ) | [inline] |
Default constructor
Definition at line 35 of file DLSingletonDestroyer.h.
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.
void DLSingletonDestroyer< SINGLETON >::SetSingleton | ( | SINGLETON * | s | ) | [inline] |
Assign responsibility for the destruction of a singleton object to this destroyer.
s | pointer to the singleton object |
Definition at line 49 of file DLSingletonDestroyer.h.