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

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

Generated on Sat Jun 6 13:49:02 2009 for RMOL by Doxygen 1.5.7.1