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

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 
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 
00067 }