$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 // AirInv 00008 #include <airinv/basic/BasConst_AIRINV_Service.hpp> 00009 #include <airinv/service/AIRINV_ServiceContext.hpp> 00010 00011 namespace AIRINV { 00012 00013 // ////////////////////////////////////////////////////////////////////// 00014 AIRINV_ServiceContext::AIRINV_ServiceContext() 00015 : _ownStdairService (false), _ownSEVMGRService (true), 00016 _airlineCode (DEFAULT_AIRLINE_CODE) { 00017 } 00018 00019 // ////////////////////////////////////////////////////////////////////// 00020 AIRINV_ServiceContext:: 00021 AIRINV_ServiceContext (const stdair::AirlineCode_T& iAirlineCode) 00022 : _ownStdairService (false), _ownSEVMGRService (true), 00023 _airlineCode (iAirlineCode) { 00024 } 00025 00026 // ////////////////////////////////////////////////////////////////////// 00027 AIRINV_ServiceContext::AIRINV_ServiceContext (const AIRINV_ServiceContext&) 00028 : _ownStdairService (false), _ownSEVMGRService (true), 00029 _airlineCode (DEFAULT_AIRLINE_CODE) { 00030 } 00031 00032 // ////////////////////////////////////////////////////////////////////// 00033 AIRINV_ServiceContext::~AIRINV_ServiceContext() { 00034 } 00035 00036 // ////////////////////////////////////////////////////////////////////// 00037 const std::string AIRINV_ServiceContext::shortDisplay() const { 00038 std::ostringstream oStr; 00039 oStr << "AIRINV_ServiceContext[" << _airlineCode 00040 << "] -- Owns StdAir service: " << _ownStdairService; 00041 return oStr.str(); 00042 } 00043 00044 // ////////////////////////////////////////////////////////////////////// 00045 const std::string AIRINV_ServiceContext::display() const { 00046 std::ostringstream oStr; 00047 oStr << shortDisplay(); 00048 return oStr.str(); 00049 } 00050 00051 // ////////////////////////////////////////////////////////////////////// 00052 const std::string AIRINV_ServiceContext::describe() const { 00053 return shortDisplay(); 00054 } 00055 00056 // ////////////////////////////////////////////////////////////////////// 00057 void AIRINV_ServiceContext::reset() { 00058 00059 // The shared_ptr<>::reset() method drops the refcount by one. 00060 // If the count result is dropping to zero, the resource pointed to 00061 // by the shared_ptr<> will be freed. 00062 00063 // Reset the stdair shared pointer 00064 _stdairService.reset(); 00065 00066 // Reset the rmol shared pointer 00067 _rmolService.reset(); 00068 00069 // Reset the airrac shared pointer 00070 _airracService.reset(); 00071 00072 // Reset the sevmgr shared pointer 00073 _sevmgrService.reset(); 00074 } 00075 00076 }