AirInv Logo  1.00.12
C++ Simulated Airline Inventory Management System Library
Loading...
Searching...
No Matches
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
11namespace AIRINV {
12
13 // //////////////////////////////////////////////////////////////////////
14 AIRINV_ServiceContext::AIRINV_ServiceContext()
15 : _ownStdairService (false), _ownSEVMGRService (true),
16 _airlineCode (DEFAULT_AIRLINE_CODE) {
17 }
18
19 // //////////////////////////////////////////////////////////////////////
20 AIRINV_ServiceContext::
21 AIRINV_ServiceContext (const stdair::AirlineCode_T& iAirlineCode)
22 : _ownStdairService (false), _ownSEVMGRService (true),
23 _airlineCode (iAirlineCode) {
24 }
25
26 // //////////////////////////////////////////////////////////////////////
27 AIRINV_ServiceContext::AIRINV_ServiceContext (const AIRINV_ServiceContext&)
28 : _ownStdairService (false), _ownSEVMGRService (true),
29 _airlineCode (DEFAULT_AIRLINE_CODE) {
30 }
31
32 // //////////////////////////////////////////////////////////////////////
33 AIRINV_ServiceContext::~AIRINV_ServiceContext() {
34 }
35
36 // //////////////////////////////////////////////////////////////////////
37 const std::string AIRINV_ServiceContext::shortDisplay() const {
38 std::ostringstream oStr;
39 oStr << "AIRINV_ServiceContext[" << _airlineCode
40 << "] -- Owns StdAir service: " << _ownStdairService;
41 return oStr.str();
42 }
43
44 // //////////////////////////////////////////////////////////////////////
45 const std::string AIRINV_ServiceContext::display() const {
46 std::ostringstream oStr;
47 oStr << shortDisplay();
48 return oStr.str();
49 }
50
51 // //////////////////////////////////////////////////////////////////////
52 const std::string AIRINV_ServiceContext::describe() const {
53 return shortDisplay();
54 }
55
56 // //////////////////////////////////////////////////////////////////////
57 void AIRINV_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 // Reset the rmol shared pointer
67 _rmolService.reset();
68
69 // Reset the airrac shared pointer
70 _airracService.reset();
71
72 // Reset the sevmgr shared pointer
73 _sevmgrService.reset();
74 }
75
76}
const std::string DEFAULT_AIRLINE_CODE
Definition BasConst.cpp:11