The DESTRUCTOR_OF class allows the user to program - at any moment - the destruction of an object at the end of the process. More...
#include <BasicsGenericDestructor.hxx>
Public Member Functions | |
DESTRUCTOR_OF (TYPE &anObject) | |
Programs the destruction at the end of the process, of the object anObject. More... | |
virtual void | operator() (void) |
Performs the destruction of the object. More... | |
virtual | ~DESTRUCTOR_OF () |
Static Public Member Functions | |
static const int | Add (GENERIC_DESTRUCTOR &anObject) |
Adds a destruction object to the list of actions to be performed at the end of the process. More... | |
Static Public Attributes | |
static std::list < GENERIC_DESTRUCTOR * > * | Destructors = 0 |
Private Attributes | |
TYPE * | _objectPtr |
The DESTRUCTOR_OF class allows the user to program - at any moment - the destruction of an object at the end of the process.
Example: the POINT ptrPoint will be destroyed at the end of the process (atexit).
POINT *ptrPoint = new POINT ;
DESTRUCTOR_OF<POINT> *ptrDestruct = new DESTRUCTOR_OF<POINT>(*ptrPoint);
Note that neither ptrPoint, nor ptrDestruct should be destroyed by the user.
The destruction object must be created dynamically because it suscribes itself in the list of destruction to be performed at the end of the process.
DESTRUCTOR_OF< TYPE >::DESTRUCTOR_OF | ( | TYPE & | anObject | ) |
Programs the destruction at the end of the process, of the object anObject.
This method records in _objectPtr the address of an object to be destroyed at the end of the process
References DESTRUCTOR_OF< TYPE >::_objectPtr, GENERIC_DESTRUCTOR::Add(), PROTECTED_DELETE::addObj(), and DEVTRACE.
|
virtual |
References DESTRUCTOR_OF< TYPE >::_objectPtr, and DEVTRACE.
|
staticinherited |
Adds a destruction object to the list of actions to be performed at the end of the process.
References atExitSingletonDone, GENERIC_DESTRUCTOR::Destructors, and DEVTRACE.
Referenced by DESTRUCTOR_OF< TYPE >::DESTRUCTOR_OF().
|
virtual |
Performs the destruction of the object.
This method really destroys the object pointed by _objectPtr. It should be called at the end of the process (i.e. at exit).
Implements GENERIC_DESTRUCTOR.
References DESTRUCTOR_OF< TYPE >::_objectPtr, PROTECTED_DELETE::deleteInstance(), and DEVTRACE.
|
private |
|
staticinherited |
Referenced by GENERIC_DESTRUCTOR::Add(), and HouseKeeping().