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

FacRmolServiceContext.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // C
00005 #include <assert.h>
00006 // RMOL
00007 #include <rmol/service/RMOL_ServiceContext.hpp>
00008 #include <rmol/factory/FacSupervisor.hpp>
00009 #include <rmol/factory/FacRmolServiceContext.hpp>
00010 
00011 namespace RMOL {
00012 
00013   FacRmolServiceContext* FacRmolServiceContext::_instance = NULL;
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   FacRmolServiceContext::~FacRmolServiceContext () {
00017     _instance = NULL;
00018   }
00019 
00020   // //////////////////////////////////////////////////////////////////////
00021   FacRmolServiceContext& FacRmolServiceContext::instance () {
00022 
00023     if (_instance == NULL) {
00024       _instance = new FacRmolServiceContext();
00025       assert (_instance != NULL);
00026       
00027       FacSupervisor::instance().registerServiceFactory (_instance);
00028     }
00029     return *_instance;
00030   }
00031 
00032   // //////////////////////////////////////////////////////////////////////
00033   RMOL_ServiceContext& FacRmolServiceContext::create () {
00034     RMOL_ServiceContext* aServiceContext_ptr = NULL;
00035 
00036     aServiceContext_ptr = new RMOL_ServiceContext ();
00037     assert (aServiceContext_ptr != NULL);
00038 
00039     // The new object is added to the Bom pool
00040     _pool.push_back (aServiceContext_ptr);
00041 
00042     return *aServiceContext_ptr;
00043   }
00044 
00045   // //////////////////////////////////////////////////////////////////////
00046   RMOL_ServiceContext& FacRmolServiceContext::
00047   create (const ResourceCapacity_T iResourceCapacity) {
00048     RMOL_ServiceContext* aServiceContext_ptr = NULL;
00049 
00050     aServiceContext_ptr = new RMOL_ServiceContext (iResourceCapacity);
00051     assert (aServiceContext_ptr != NULL);
00052 
00053     // The new object is added to the Bom pool
00054     _pool.push_back (aServiceContext_ptr);
00055 
00056     return *aServiceContext_ptr;
00057   }
00058 
00059 }
SourceForge Logo

Generated on Sun Jun 14 23:33:59 2009 for RMOL by Doxygen 1.5.8