00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // C 00005 #include <assert.h> 00006 // RMOL 00007 #include <rmol/bom/Bucket.hpp> 00008 #include <rmol/factory/FacSupervisor.hpp> 00009 #include <rmol/factory/FacBucket.hpp> 00010 00011 namespace RMOL { 00012 00013 FacBucket* FacBucket::_instance = NULL; 00014 00015 // ////////////////////////////////////////////////////////////////////// 00016 FacBucket::~FacBucket () { 00017 _instance = NULL; 00018 } 00019 00020 // ////////////////////////////////////////////////////////////////////// 00021 FacBucket& FacBucket::instance () { 00022 00023 if (_instance == NULL) { 00024 _instance = new FacBucket(); 00025 assert (_instance != NULL); 00026 00027 FacSupervisor::instance().registerBomFactory (_instance); 00028 } 00029 return *_instance; 00030 } 00031 00032 // ////////////////////////////////////////////////////////////////////// 00033 Bucket& FacBucket::create (const FldYieldRange& iYieldRange) { 00034 Bucket* aBucket_ptr = NULL; 00035 00036 aBucket_ptr = new Bucket (iYieldRange); 00037 assert (aBucket_ptr != NULL); 00038 00039 // The new object is added to the Bom pool 00040 _pool.push_back (aBucket_ptr); 00041 00042 return *aBucket_ptr; 00043 } 00044 00045 // ////////////////////////////////////////////////////////////////////// 00046 Bucket& FacBucket::create (const FldYieldRange& iYieldRange, 00047 Demand& iDemand) { 00048 Bucket* aBucket_ptr = NULL; 00049 00050 aBucket_ptr = new Bucket (iYieldRange); 00051 assert (aBucket_ptr != NULL); 00052 00053 // Set the Demand link 00054 createDemandLink (*aBucket_ptr, iDemand); 00055 00056 // The new object is added to the Bom pool 00057 _pool.push_back (aBucket_ptr); 00058 00059 return *aBucket_ptr; 00060 } 00061 00062 // ////////////////////////////////////////////////////////////////////// 00063 void FacBucket::createDemandLink (Bucket& ioBucket, Demand& iDemand) { 00064 ioBucket.setDemand (iDemand); 00065 } 00066 00067 }
Generated on Sun Jun 14 23:33:59 2009 for RMOL by Doxygen 1.5.8