Back to index

salome-kernel  6.5.0
Classes | Functions | Variables
BasicsGenericDestructor.cxx File Reference
#include <iostream>
#include <list>
#include <cstdlib>
#include "BasicsGenericDestructor.hxx"

Go to the source code of this file.

Classes

class  atExitSingleton
 To execute only once GENERIC_DESTRUCTOR::HouseKeeping et the end of process, a dedicated object is created, as a singleton: atExitSingleton. More...

Functions

void HouseKeeping (void)
 Executes all objects of type DESTRUCTOR_OF in the Destructors list.

Variables

static bool atExitSingletonDone = false
static atExitSingleton HouseKeeper = atExitSingleton(false)
 static singleton for atExitSingleton class

Function Documentation

void HouseKeeping ( void  )

Executes all objects of type DESTRUCTOR_OF in the Destructors list.

Deletes all objects of type DESTRUCTOR_OF in the Destructors list. Deletes the list.

Definition at line 149 of file BasicsGenericDestructor.cxx.

{
  DEVTRACE("HouseKeeping()");
  assert(GENERIC_DESTRUCTOR::Destructors);
  if(GENERIC_DESTRUCTOR::Destructors->size())
    {
      std::list<GENERIC_DESTRUCTOR*>::iterator it =
        GENERIC_DESTRUCTOR::Destructors->end();

      do
        {
          it-- ;
          GENERIC_DESTRUCTOR* ptr = *it ;
          DEVTRACE("HouseKeeping() " << typeid(ptr).name());
          (*ptr)();
          delete ptr ;
        }
      while (it !=  GENERIC_DESTRUCTOR::Destructors->begin()) ;

      DEVTRACE("HouseKeeping() end list ");
      GENERIC_DESTRUCTOR::Destructors->clear() ;
      assert(GENERIC_DESTRUCTOR::Destructors->size() == 0);
      assert(GENERIC_DESTRUCTOR::Destructors->empty());
      DEVTRACE("HouseKeeping()after clear ");
    }

  delete GENERIC_DESTRUCTOR::Destructors;
  GENERIC_DESTRUCTOR::Destructors = 0;
  atExitSingletonDone = false ;
  DEVTRACE("HouseKeeping() very end ");
  return ;
}

Here is the caller graph for this function:


Variable Documentation

bool atExitSingletonDone = false [static]

Definition at line 46 of file BasicsGenericDestructor.cxx.

static singleton for atExitSingleton class

Definition at line 139 of file BasicsGenericDestructor.cxx.