AirInv Logo  0.1.2
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AIRINV_ServiceContext.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // AirInv
10 
11 namespace AIRINV {
12 
13  // //////////////////////////////////////////////////////////////////////
14  AIRINV_ServiceContext::AIRINV_ServiceContext()
15  : _ownStdairService (false), _airlineCode (DEFAULT_AIRLINE_CODE) {
16  }
17 
18  // //////////////////////////////////////////////////////////////////////
19  AIRINV_ServiceContext::
20  AIRINV_ServiceContext (const stdair::AirlineCode_T& iAirlineCode)
21  : _ownStdairService (false), _airlineCode (iAirlineCode) {
22  }
23 
24  // //////////////////////////////////////////////////////////////////////
25  AIRINV_ServiceContext::AIRINV_ServiceContext (const AIRINV_ServiceContext&)
26  : _ownStdairService (false), _airlineCode (DEFAULT_AIRLINE_CODE) {
27  }
28 
29  // //////////////////////////////////////////////////////////////////////
30  AIRINV_ServiceContext::~AIRINV_ServiceContext() {
31  }
32 
33  // //////////////////////////////////////////////////////////////////////
34  const std::string AIRINV_ServiceContext::shortDisplay() const {
35  std::ostringstream oStr;
36  oStr << "AIRINV_ServiceContext[" << _airlineCode
37  << "] -- Owns StdAir service: " << _ownStdairService;
38  return oStr.str();
39  }
40 
41  // //////////////////////////////////////////////////////////////////////
42  const std::string AIRINV_ServiceContext::display() const {
43  std::ostringstream oStr;
44  oStr << shortDisplay();
45  return oStr.str();
46  }
47 
48  // //////////////////////////////////////////////////////////////////////
49  const std::string AIRINV_ServiceContext::describe() const {
50  return shortDisplay();
51  }
52 
53  // //////////////////////////////////////////////////////////////////////
54  void AIRINV_ServiceContext::reset() {
55  if (_ownStdairService == true) {
56  _stdairService.reset();
57  }
58  }
59 
60 }