RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads

FacPartialSumHolder.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/PartialSumHolder.hpp>
00008 #include <rmol/factory/FacSupervisor.hpp>
00009 #include <rmol/factory/FacPartialSumHolder.hpp>
00010 
00011 namespace RMOL {
00012 
00013   FacPartialSumHolder* FacPartialSumHolder::_instance = NULL;
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   FacPartialSumHolder::~FacPartialSumHolder () {
00017     _instance = NULL;
00018   }
00019 
00020   // //////////////////////////////////////////////////////////////////////
00021   FacPartialSumHolder& FacPartialSumHolder::instance () {
00022 
00023     if (_instance == NULL) {
00024       _instance = new FacPartialSumHolder();
00025       assert (_instance != NULL);
00026       
00027       FacSupervisor::instance().registerBomFactory (_instance);
00028     }
00029     return *_instance;
00030   }
00031 
00032   // //////////////////////////////////////////////////////////////////////
00033   PartialSumHolder& FacPartialSumHolder::create () {
00034     PartialSumHolder* aPartialSumHolder_ptr = NULL;
00035 
00036     aPartialSumHolder_ptr = new PartialSumHolder ();
00037     assert (aPartialSumHolder_ptr != NULL);
00038 
00039     // The new object is added to the Bom pool
00040     _pool.push_back (aPartialSumHolder_ptr);
00041 
00042     return *aPartialSumHolder_ptr;
00043   }
00044 
00045 }
SourceForge Logo

Generated on Fri Jul 30 22:23:14 2010 for RMOL by Doxygen 1.6.1