AirInv Logo  0.1.2
C++ Simulated Airline Inventory Management System library
FacAirinvMasterServiceContext.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 // StdAir
00007 #include <stdair/service/FacSupervisor.hpp>
00008 // AirInv
00009 #include <airinv/factory/FacAirinvMasterServiceContext.hpp>
00010 #include <airinv/service/AIRINV_Master_ServiceContext.hpp>
00011 
00012 namespace AIRINV {
00013 
00014   FacAirinvMasterServiceContext* FacAirinvMasterServiceContext::_instance = NULL;
00015 
00016   // //////////////////////////////////////////////////////////////////////
00017   FacAirinvMasterServiceContext::~FacAirinvMasterServiceContext() {
00018     _instance = NULL;
00019   }
00020 
00021   // //////////////////////////////////////////////////////////////////////
00022   FacAirinvMasterServiceContext& FacAirinvMasterServiceContext::instance() {
00023 
00024     if (_instance == NULL) {
00025       _instance = new FacAirinvMasterServiceContext();
00026       assert (_instance != NULL);
00027       
00028       stdair::FacSupervisor::instance().registerServiceFactory (_instance);
00029     }
00030     return *_instance;
00031   }
00032 
00033   // //////////////////////////////////////////////////////////////////////
00034   AIRINV_Master_ServiceContext& FacAirinvMasterServiceContext::create() {
00035     AIRINV_Master_ServiceContext* aAIRINV_Master_ServiceContext_ptr = NULL;
00036 
00037     aAIRINV_Master_ServiceContext_ptr = new AIRINV_Master_ServiceContext();
00038     assert (aAIRINV_Master_ServiceContext_ptr != NULL);
00039 
00040     // The new object is added to the Bom pool
00041     _pool.push_back (aAIRINV_Master_ServiceContext_ptr);
00042 
00043     return *aAIRINV_Master_ServiceContext_ptr;
00044   }
00045 
00046 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines