$treeview $search $mathjax
SimCRS Logo  1.00.0
$projectbrief
$projectbrief
$searchbox

SIMCRS_ServiceContext.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 // Standard Airline Object Model
00007 #include <stdair/STDAIR_Service.hpp>
00008 #include <stdair/service/Logger.hpp>
00009 // Simcrs
00010 #include <simcrs/basic/BasConst_SIMCRS_Service.hpp>
00011 #include <simcrs/service/SIMCRS_ServiceContext.hpp>
00012 
00013 namespace SIMCRS {
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   SIMCRS_ServiceContext::SIMCRS_ServiceContext ()
00017     : _ownStdairService (false), _ownSEVMGRService (true),
00018       _CRSCode (DEFAULT_CRS_CODE) {
00019   }
00020 
00021   // //////////////////////////////////////////////////////////////////////
00022   SIMCRS_ServiceContext::SIMCRS_ServiceContext (const SIMCRS_ServiceContext&)
00023     : _ownStdairService (false), _ownSEVMGRService (true) {
00024   }
00025 
00026   // //////////////////////////////////////////////////////////////////////
00027   SIMCRS_ServiceContext::SIMCRS_ServiceContext (const CRSCode_T& iCRSCode)
00028     : _ownSEVMGRService (true),_CRSCode (iCRSCode) {
00029   }
00030 
00031   // //////////////////////////////////////////////////////////////////////
00032   SIMCRS_ServiceContext::~SIMCRS_ServiceContext() {
00033   }
00034   
00035   // //////////////////////////////////////////////////////////////////////
00036   const std::string SIMCRS_ServiceContext::shortDisplay() const {
00037     std::ostringstream oStr;
00038     oStr << "SIMCRS_ServiceContext [" << _CRSCode
00039          << "] - Owns StdAir service: " << _ownStdairService;
00040     return oStr.str();
00041   }
00042 
00043   // //////////////////////////////////////////////////////////////////////
00044   const std::string SIMCRS_ServiceContext::display() const {
00045     std::ostringstream oStr;
00046     oStr << shortDisplay();
00047     return oStr.str();
00048   }
00049 
00050   // //////////////////////////////////////////////////////////////////////
00051   const std::string SIMCRS_ServiceContext::describe() const {
00052     return shortDisplay();
00053   }
00054 
00055   // //////////////////////////////////////////////////////////////////////
00056   void SIMCRS_ServiceContext::reset() {
00057 
00058     // The shared_ptr<>::reset() method drops the refcount by one.
00059     // If the count result is dropping to zero, the resource pointed to
00060     // by the shared_ptr<> will be freed.
00061     
00062     // Reset the stdair shared pointer
00063     _stdairService.reset();
00064 
00065     // Reset the simfqt shared pointer
00066     _simfqtService.reset();
00067     
00068      // Reset the airsched shared pointer
00069     _airschedService.reset();
00070 
00071     // Reset the airinv shared pointer 
00072     _airinvService.reset();
00073 
00074     // Reset the sevmgr shared pointer
00075     _sevmgrService.reset();
00076   }
00077 
00078 }