AirSched Logo  0.1.4
C++ Simulated Airline Schedule Manager Library
AIRSCHED_ServiceContext.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 // StdAir
00008 #include <stdair/STDAIR_Service.hpp>
00009 // AirSched
00010 #include <airsched/basic/BasConst_AIRSCHED_Service.hpp>
00011 #include <airsched/service/AIRSCHED_ServiceContext.hpp>
00012 
00013 namespace AIRSCHED {
00014   
00015   // //////////////////////////////////////////////////////////////////////
00016   AIRSCHED_ServiceContext::AIRSCHED_ServiceContext()
00017     : _ownStdairService (false) {
00018   }
00019   
00020   // //////////////////////////////////////////////////////////////////////
00021   AIRSCHED_ServiceContext::
00022   AIRSCHED_ServiceContext (const AIRSCHED_ServiceContext&) {
00023     assert (false);
00024   }
00025 
00026   // //////////////////////////////////////////////////////////////////////
00027   AIRSCHED_ServiceContext::~AIRSCHED_ServiceContext() {
00028   }
00029 
00030   // ////////////////////////////////////////////////////////////////////
00031   stdair::STDAIR_Service& AIRSCHED_ServiceContext::getSTDAIR_Service() const {
00032     assert (_stdairService != NULL);
00033     return *_stdairService;
00034   }
00035 
00036   // //////////////////////////////////////////////////////////////////////
00037   const std::string AIRSCHED_ServiceContext::shortDisplay() const {
00038     std::ostringstream oStr;
00039     oStr << "AIRSCHED_ServiceContext -- Owns StdAir service: "
00040          << _ownStdairService;
00041     return oStr.str();
00042   }
00043 
00044   // //////////////////////////////////////////////////////////////////////
00045   const std::string AIRSCHED_ServiceContext::display() const {
00046     std::ostringstream oStr;
00047     oStr << shortDisplay();
00048     return oStr.str();
00049   }
00050 
00051   // //////////////////////////////////////////////////////////////////////
00052   const std::string AIRSCHED_ServiceContext::describe() const {
00053     return shortDisplay();
00054   }
00055 
00056   // ////////////////////////////////////////////////////////////////////
00057   void AIRSCHED_ServiceContext::reset() {
00058     if (_ownStdairService == true) {
00059       _stdairService.reset();
00060     }
00061   }
00062 
00063 }