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