AirSched Logo  1.00.0
C++ Simulated Airline Schedule Manager Library
AIRSCHED_ServiceContext.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // StdAir
8 #include <stdair/STDAIR_Service.hpp>
9 // AirSched
12 
13 namespace AIRSCHED {
14 
15  // //////////////////////////////////////////////////////////////////////
16  AIRSCHED_ServiceContext::AIRSCHED_ServiceContext()
17  : _ownStdairService (false) {
18  }
19 
20  // //////////////////////////////////////////////////////////////////////
21  AIRSCHED_ServiceContext::
22  AIRSCHED_ServiceContext (const AIRSCHED_ServiceContext&) {
23  assert (false);
24  }
25 
26  // //////////////////////////////////////////////////////////////////////
27  AIRSCHED_ServiceContext::~AIRSCHED_ServiceContext() {
28  }
29 
30  // ////////////////////////////////////////////////////////////////////
31  stdair::STDAIR_Service& AIRSCHED_ServiceContext::getSTDAIR_Service() const {
32  assert (_stdairService != NULL);
33  return *_stdairService;
34  }
35 
36  // //////////////////////////////////////////////////////////////////////
37  const std::string AIRSCHED_ServiceContext::shortDisplay() const {
38  std::ostringstream oStr;
39  oStr << "AIRSCHED_ServiceContext -- Owns StdAir service: "
40  << _ownStdairService;
41  return oStr.str();
42  }
43 
44  // //////////////////////////////////////////////////////////////////////
45  const std::string AIRSCHED_ServiceContext::display() const {
46  std::ostringstream oStr;
47  oStr << shortDisplay();
48  return oStr.str();
49  }
50 
51  // //////////////////////////////////////////////////////////////////////
52  const std::string AIRSCHED_ServiceContext::describe() const {
53  return shortDisplay();
54  }
55 
56  // ////////////////////////////////////////////////////////////////////
57  void AIRSCHED_ServiceContext::reset() {
58 
59  // The shared_ptr<>::reset() method drops the refcount by one.
60  // If the count result is dropping to zero, the resource pointed to
61  // by the shared_ptr<> will be freed.
62 
63  // Reset the stdair shared pointer
64  _stdairService.reset();
65  }
66 
67 }