Version: 8.3.0
DESTRUCTOR_OF< TYPE > Class Template Reference

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>

Inheritance diagram for DESTRUCTOR_OF< TYPE >:

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
 

Detailed Description

template<class TYPE>
class DESTRUCTOR_OF< TYPE >

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.

Constructor & Destructor Documentation

template<class TYPE>
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.

template<class TYPE>
virtual DESTRUCTOR_OF< TYPE >::~DESTRUCTOR_OF ( )
virtual

Member Function Documentation

const int GENERIC_DESTRUCTOR::Add ( GENERIC_DESTRUCTOR anObject)
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().

template<class TYPE>
virtual void DESTRUCTOR_OF< TYPE >::operator() ( void  )
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.

Field Documentation

std::list< GENERIC_DESTRUCTOR * > * GENERIC_DESTRUCTOR::Destructors = 0
staticinherited