RMOL Logo  1.00.9
C++ library of Revenue Management and Optimisation classes and functions
Loading...
Searching...
No Matches
RMOL_ServiceContext.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7// StdAir
8#include <stdair/STDAIR_Service.hpp>
9// RMOL
12
13namespace RMOL {
14
15 // ////////////////////////////////////////////////////////////////////
16 RMOL_ServiceContext::RMOL_ServiceContext() : _ownStdairService (false) {
17 }
18
19 // ////////////////////////////////////////////////////////////////////
20 RMOL_ServiceContext::RMOL_ServiceContext (const RMOL_ServiceContext&) {
21 assert (false);
22 }
23
24 // ////////////////////////////////////////////////////////////////////
25 RMOL_ServiceContext::~RMOL_ServiceContext() {
26 }
27
28 // ////////////////////////////////////////////////////////////////////
29 stdair::STDAIR_Service& RMOL_ServiceContext::getSTDAIR_Service() const {
30 assert (_stdairService != NULL);
31 return *_stdairService;
32 }
33
34 // //////////////////////////////////////////////////////////////////////
35 const std::string RMOL_ServiceContext::shortDisplay() const {
36 std::ostringstream oStr;
37 oStr << "RMOL_ServiceContext -- Owns StdAir service: " << _ownStdairService;
38 return oStr.str();
39 }
40
41 // //////////////////////////////////////////////////////////////////////
42 const std::string RMOL_ServiceContext::display() const {
43 std::ostringstream oStr;
44 oStr << shortDisplay();
45 return oStr.str();
46 }
47
48 // //////////////////////////////////////////////////////////////////////
49 const std::string RMOL_ServiceContext::describe() const {
50 return shortDisplay();
51 }
52
53 // ////////////////////////////////////////////////////////////////////
54 void RMOL_ServiceContext::reset() {
55
56 // The shared_ptr<>::reset() method drops the refcount by one.
57 // If the count result is dropping to zero, the resource pointed to
58 // by the shared_ptr<> will be freed.
59
60 // Reset the stdair shared pointer
61 _stdairService.reset();
62 }
63
64}