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