AirInv Logo  0.1.2
C++ Simulated Airline Inventory Management System library
AIRINV_ServiceContext.cpp
Go to the documentation of this file.
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), _airlineCode (DEFAULT_AIRLINE_CODE) {
00016   }
00017 
00018   // //////////////////////////////////////////////////////////////////////
00019   AIRINV_ServiceContext::
00020   AIRINV_ServiceContext (const stdair::AirlineCode_T& iAirlineCode)
00021     : _ownStdairService (false), _airlineCode (iAirlineCode) {
00022   }
00023 
00024   // //////////////////////////////////////////////////////////////////////
00025   AIRINV_ServiceContext::AIRINV_ServiceContext (const AIRINV_ServiceContext&)
00026     : _ownStdairService (false), _airlineCode (DEFAULT_AIRLINE_CODE) {
00027   }
00028 
00029   // //////////////////////////////////////////////////////////////////////
00030   AIRINV_ServiceContext::~AIRINV_ServiceContext() {
00031   }
00032   
00033   // //////////////////////////////////////////////////////////////////////
00034   const std::string AIRINV_ServiceContext::shortDisplay() const {
00035     std::ostringstream oStr;
00036     oStr << "AIRINV_ServiceContext[" << _airlineCode
00037          << "] -- Owns StdAir service: " << _ownStdairService;
00038     return oStr.str();
00039   }
00040 
00041   // //////////////////////////////////////////////////////////////////////
00042   const std::string AIRINV_ServiceContext::display() const {
00043     std::ostringstream oStr;
00044     oStr << shortDisplay();
00045     return oStr.str();
00046   }
00047 
00048   // //////////////////////////////////////////////////////////////////////
00049   const std::string AIRINV_ServiceContext::describe() const {
00050     return shortDisplay();
00051   }
00052 
00053   // //////////////////////////////////////////////////////////////////////
00054   void AIRINV_ServiceContext::reset() {
00055     if (_ownStdairService == true) {
00056       _stdairService.reset();
00057     }
00058   }
00059 
00060 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines