AirTSP Logo  1.01.0
C++ Simulated Airline Travel Solution Provider Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AIRTSP_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 // AirTSP
12 
13 namespace AIRTSP {
14 
15  // //////////////////////////////////////////////////////////////////////
16  AIRTSP_ServiceContext::AIRTSP_ServiceContext()
17  : _ownStdairService (false) {
18  }
19 
20  // //////////////////////////////////////////////////////////////////////
21  AIRTSP_ServiceContext::
22  AIRTSP_ServiceContext (const AIRTSP_ServiceContext&) {
23  assert (false);
24  }
25 
26  // //////////////////////////////////////////////////////////////////////
27  AIRTSP_ServiceContext::~AIRTSP_ServiceContext() {
28  }
29 
30  // ////////////////////////////////////////////////////////////////////
31  stdair::STDAIR_Service& AIRTSP_ServiceContext::getSTDAIR_Service() const {
32  assert (_stdairService != NULL);
33  return *_stdairService;
34  }
35 
36  // //////////////////////////////////////////////////////////////////////
37  const std::string AIRTSP_ServiceContext::shortDisplay() const {
38  std::ostringstream oStr;
39  oStr << "AIRTSP_ServiceContext -- Owns StdAir service: "
40  << _ownStdairService;
41  return oStr.str();
42  }
43 
44  // //////////////////////////////////////////////////////////////////////
45  const std::string AIRTSP_ServiceContext::display() const {
46  std::ostringstream oStr;
47  oStr << shortDisplay();
48  return oStr.str();
49  }
50 
51  // //////////////////////////////////////////////////////////////////////
52  const std::string AIRTSP_ServiceContext::describe() const {
53  return shortDisplay();
54  }
55 
56  // ////////////////////////////////////////////////////////////////////
57  void AIRTSP_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 }