$treeview $search $mathjax
StdAir Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

stdair/service/FacSTDAIRServiceContext.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 #include <stdair/service/FacSTDAIRServiceContext.hpp>
00009 #include <stdair/service/STDAIR_ServiceContext.hpp>
00010 
00011 namespace stdair {
00012 
00013   FacSTDAIRServiceContext* FacSTDAIRServiceContext::_instance = NULL;
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   FacSTDAIRServiceContext::~FacSTDAIRServiceContext() {
00017     _instance = NULL;
00018   }
00019 
00020   // //////////////////////////////////////////////////////////////////////
00021   FacSTDAIRServiceContext& FacSTDAIRServiceContext::instance() {
00022 
00023     if (_instance == NULL) {
00024       _instance = new FacSTDAIRServiceContext();
00025       assert (_instance != NULL);
00026       
00027       FacSupervisor::instance().registerServiceFactory (_instance);
00028     }
00029     return *_instance;
00030   }
00031 
00032   // //////////////////////////////////////////////////////////////////////
00033   STDAIR_ServiceContext& FacSTDAIRServiceContext::create() {
00034     STDAIR_ServiceContext* aServiceContext_ptr = NULL;
00035 
00036     aServiceContext_ptr = new STDAIR_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 }