Version: 8.3.0
PROTECTED_DELETE Class Reference

The PROTECTED_DELETE base class provides a protected destructor. More...

#include <BasicsGenericDestructor.hxx>

Inheritance diagram for PROTECTED_DELETE:

Static Public Member Functions

static void deleteInstance (PROTECTED_DELETE *anObject)
 deleteInstance deletes only once the object. More...
 
static void addObj (PROTECTED_DELETE *anObject)
 To allow a further destruction of a PRTECTED_DELETE object, it must be added to the static list of PROTECTED_DELETE*. More...
 

Protected Member Functions

virtual ~PROTECTED_DELETE ()
 Herited classes have there own destructors. More...
 

Static Protected Attributes

static std::list
< PROTECTED_DELETE * > 
_objList
 

Static Private Attributes

static pthread_mutex_t _listMutex
 

Detailed Description

The PROTECTED_DELETE base class provides a protected destructor.

The only way to use PROTECTED_DELETE is inheritance: example: class LocalTraceBufferPool : public PROTECTED_DELETE Herited class destructor must stay protected. Normal use is:

  • create an instance of herited class on the heap (new),
  • use addObj(instance) to store the instance on the static list _objList,
  • delete instance with deleteInstance(instance)

This class is utilised with GENERIC_DESTRUCTOR and DESTRUCTOR_OF, to program automatic deletion of objects at the end of the process, while keeping the possibility of an early destruction, if required. This is used for unit testing and trace mecanism.

Constructor & Destructor Documentation

PROTECTED_DELETE::~PROTECTED_DELETE ( )
protectedvirtual

Herited classes have there own destructors.

References DEVTRACE.

Member Function Documentation

void PROTECTED_DELETE::addObj ( PROTECTED_DELETE anObject)
static

To allow a further destruction of a PRTECTED_DELETE object, it must be added to the static list of PROTECTED_DELETE*.

References _objList, and DEVTRACE.

Referenced by DESTRUCTOR_OF< TYPE >::DESTRUCTOR_OF().

void PROTECTED_DELETE::deleteInstance ( PROTECTED_DELETE anObject)
static

Field Documentation

pthread_mutex_t PROTECTED_DELETE::_listMutex
staticprivate

Referenced by deleteInstance().

std::list< PROTECTED_DELETE * > PROTECTED_DELETE::_objList
staticprotected

Referenced by addObj(), and deleteInstance().