RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads
FacStudyStatManager.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // C
00005 #include <assert.h>
00006 // RMOL 
00007 #include <rmol/bom/StudyStatManager.hpp>
00008 #include <rmol/factory/FacSupervisor.hpp>
00009 #include <rmol/factory/FacStudyStatManager.hpp>
00010 #include <rmol/service/Logger.hpp>
00011 
00012 namespace RMOL {
00013   
00014   FacStudyStatManager* FacStudyStatManager::_instance = NULL;
00015   
00016   // //////////////////////////////////////////////////////////////////////
00017   FacStudyStatManager::~FacStudyStatManager () {
00018     _instance = NULL;
00019   }
00020   
00021   // //////////////////////////////////////////////////////////////////////
00022   FacStudyStatManager& FacStudyStatManager::instance () {
00023     
00024     if (_instance == NULL) {
00025       _instance = new FacStudyStatManager();
00026       assert (_instance != NULL);
00027       
00028       FacSupervisor::instance().registerBomFactory (_instance);
00029     }
00030     return *_instance;
00031   }
00032   
00033   // //////////////////////////////////////////////////////////////////////
00034   StudyStatManager& FacStudyStatManager::create () {
00035     StudyStatManager* aStudyStatManager_ptr = NULL;
00036     aStudyStatManager_ptr = new StudyStatManager ();
00037     assert (aStudyStatManager_ptr != NULL);
00038     
00039     // The new object is added to the Bom pool
00040     _pool.push_back (aStudyStatManager_ptr);
00041     
00042     return *aStudyStatManager_ptr;
00043   }
00044 
00045 }