RMOL Logo  0.25.3
C++ library of Revenue Management and Optimisation classes and functions
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines
RMOL_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 // RMOL
00010 #include <rmol/basic/BasConst_RMOL_Service.hpp>
00011 #include <rmol/service/RMOL_ServiceContext.hpp>
00012 
00013 namespace RMOL {
00014 
00015   // ////////////////////////////////////////////////////////////////////
00016   RMOL_ServiceContext::RMOL_ServiceContext() : _ownStdairService (false) {
00017   }
00018   
00019   // ////////////////////////////////////////////////////////////////////
00020   RMOL_ServiceContext::RMOL_ServiceContext (const RMOL_ServiceContext&) {
00021     assert (false);
00022   }
00023   
00024   // ////////////////////////////////////////////////////////////////////
00025   RMOL_ServiceContext::~RMOL_ServiceContext() {
00026   }
00027 
00028   // ////////////////////////////////////////////////////////////////////
00029   stdair::STDAIR_Service& RMOL_ServiceContext::getSTDAIR_Service() const {
00030     assert (_stdairService != NULL);
00031     return *_stdairService;
00032   }
00033 
00034   // //////////////////////////////////////////////////////////////////////
00035   const std::string RMOL_ServiceContext::shortDisplay() const {
00036     std::ostringstream oStr;
00037     oStr << "RMOL_ServiceContext -- Owns StdAir service: " << _ownStdairService;
00038     return oStr.str();
00039   }
00040 
00041   // //////////////////////////////////////////////////////////////////////
00042   const std::string RMOL_ServiceContext::display() const {
00043     std::ostringstream oStr;
00044     oStr << shortDisplay();
00045     return oStr.str();
00046   }
00047 
00048   // //////////////////////////////////////////////////////////////////////
00049   const std::string RMOL_ServiceContext::describe() const {
00050     return shortDisplay();
00051   }
00052 
00053   // ////////////////////////////////////////////////////////////////////
00054   void RMOL_ServiceContext::reset() {
00055     if (_ownStdairService == true) {
00056       _stdairService.reset();
00057     }
00058   }
00059 
00060 }