From: <den...@us...> - 2010-01-21 23:31:04
|
Revision: 103 http://stdair.svn.sourceforge.net/stdair/?rev=103&view=rev Author: denis_arnaud Date: 2010-01-21 23:30:57 +0000 (Thu, 21 Jan 2010) Log Message: ----------- [Dev] The static log service instance is now cleaned directly within the FacSupervisor::cleanFactory() method. Modified Paths: -------------- trunk/stdair/stdair/factory/FacBomContent.cpp trunk/stdair/stdair/factory/FacBomStructure.cpp trunk/stdair/stdair/factory/FacSupervisor.cpp trunk/stdair/stdair/service/Logger.cpp Modified: trunk/stdair/stdair/factory/FacBomContent.cpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.cpp 2010-01-21 19:35:16 UTC (rev 102) +++ trunk/stdair/stdair/factory/FacBomContent.cpp 2010-01-21 23:30:57 UTC (rev 103) @@ -1,8 +1,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> +// STL +#include <cassert> // STDAIR #include <stdair/bom/BomStructure.hpp> #include <stdair/bom/BomContent.hpp> Modified: trunk/stdair/stdair/factory/FacBomStructure.cpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.cpp 2010-01-21 19:35:16 UTC (rev 102) +++ trunk/stdair/stdair/factory/FacBomStructure.cpp 2010-01-21 23:30:57 UTC (rev 103) @@ -1,9 +1,9 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> -// STDAIR +// STL +#include <cassert> +// StdAir #include <stdair/bom/BomStructure.hpp> #include <stdair/factory/FacSupervisor.hpp> #include <stdair/factory/FacBomStructure.hpp> Modified: trunk/stdair/stdair/factory/FacSupervisor.cpp =================================================================== --- trunk/stdair/stdair/factory/FacSupervisor.cpp 2010-01-21 19:35:16 UTC (rev 102) +++ trunk/stdair/stdair/factory/FacSupervisor.cpp 2010-01-21 23:30:57 UTC (rev 103) @@ -3,7 +3,6 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> -#include <ostream> // StdAir #include <stdair/factory/FacBomStructure.hpp> #include <stdair/factory/FacBomContent.hpp> @@ -39,6 +38,7 @@ FacSupervisor::~FacSupervisor() { cleanBomStructureLayer(); cleanBomContentLayer(); + cleanLoggerService(); } // ////////////////////////////////////////////////////////////////////// @@ -73,16 +73,16 @@ // ////////////////////////////////////////////////////////////////////// void FacSupervisor::cleanLoggerService() { + // Clean the static instance of the log service Logger::clean(); } // ////////////////////////////////////////////////////////////////////// void FacSupervisor::cleanFactory () { - if (_instance != NULL) { - _instance->cleanBomStructureLayer(); - _instance->cleanBomContentLayer(); - _instance->cleanLoggerService(); - } + // Clean the static instance of the log service + Logger::clean(); + + // Clean the static instance of the FacSupervisor delete _instance; _instance = NULL; } Modified: trunk/stdair/stdair/service/Logger.cpp =================================================================== --- trunk/stdair/stdair/service/Logger.cpp 2010-01-21 19:35:16 UTC (rev 102) +++ trunk/stdair/stdair/service/Logger.cpp 2010-01-21 23:30:57 UTC (rev 103) @@ -26,6 +26,7 @@ // ////////////////////////////////////////////////////////////////////// Logger::~Logger () { + std::cout << "In Logger destructor" << std::endl; } // ////////////////////////////////////////////////////////////////////// @@ -33,11 +34,11 @@ // Sanity check if (_instance != NULL) { STDAIR_LOG_ERROR ("Error: the log stream has already been initialised"); - // TODO: throw an exception? + assert (false); + } + assert (_instance == NULL); - } else { - _instance = new Logger (iLogParams); - } + _instance = new Logger (iLogParams); } // ////////////////////////////////////////////////////////////////////// @@ -51,7 +52,9 @@ // ////////////////////////////////////////////////////////////////////// void Logger::clean() { + std::cout << "In Logger::clean(), before static instance deletion" << std::endl; delete _instance; _instance = NULL; + std::cout << "In Logger::clean(), after static instance deletion" << std::endl; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |