SimCRS Logo  1.01.8
C++ Simulated Travel-Oriented Distribution System Library
Loading...
Searching...
No Matches
SIMCRS_ServiceContext.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6// Standard Airline Object Model
7#include <stdair/STDAIR_Service.hpp>
8#include <stdair/service/Logger.hpp>
9// SimCRS
12
13namespace SIMCRS {
14
15 // //////////////////////////////////////////////////////////////////////
16 SIMCRS_ServiceContext::SIMCRS_ServiceContext ()
17 : _ownStdairService (false), _ownSEVMGRService (true),
18 _CRSCode (DEFAULT_CRS_CODE) {
19 }
20
21 // //////////////////////////////////////////////////////////////////////
22 SIMCRS_ServiceContext::SIMCRS_ServiceContext (const SIMCRS_ServiceContext&)
23 : _ownStdairService (false), _ownSEVMGRService (true) {
24 }
25
26 // //////////////////////////////////////////////////////////////////////
27 SIMCRS_ServiceContext::SIMCRS_ServiceContext (const CRSCode_T& iCRSCode)
28 : _ownSEVMGRService (true),_CRSCode (iCRSCode) {
29 }
30
31 // //////////////////////////////////////////////////////////////////////
32 SIMCRS_ServiceContext::~SIMCRS_ServiceContext() {
33 }
34
35 // //////////////////////////////////////////////////////////////////////
36 const std::string SIMCRS_ServiceContext::shortDisplay() const {
37 std::ostringstream oStr;
38 oStr << "SIMCRS_ServiceContext [" << _CRSCode
39 << "] - Owns StdAir service: " << _ownStdairService;
40 return oStr.str();
41 }
42
43 // //////////////////////////////////////////////////////////////////////
44 const std::string SIMCRS_ServiceContext::display() const {
45 std::ostringstream oStr;
46 oStr << shortDisplay();
47 return oStr.str();
48 }
49
50 // //////////////////////////////////////////////////////////////////////
51 const std::string SIMCRS_ServiceContext::describe() const {
52 return shortDisplay();
53 }
54
55 // //////////////////////////////////////////////////////////////////////
56 void SIMCRS_ServiceContext::reset() {
57
58 // The shared_ptr<>::reset() method drops the refcount by one.
59 // If the count result is dropping to zero, the resource pointed to
60 // by the shared_ptr<> will be freed.
61
62 // Reset the StdAir shared pointer
63 _stdairService.reset();
64
65 // Reset the SimFQT shared pointer
66 _simfqtService.reset();
67
68 // Reset the AirTSP shared pointer
69 _airtspService.reset();
70
71 // Reset the AirInv shared pointer
72 _airinvService.reset();
73
74 // Reset the SEvMgr shared pointer
75 _sevmgrService.reset();
76 }
77
78}
const std::string DEFAULT_CRS_CODE
Definition BasConst.cpp:10