TraDemGen Logo  1.00.10
C++ Simulated Travel Demand Generation Library
Loading...
Searching...
No Matches
TRADEMGEN_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#include <stdair/basic/BasConst_General.hpp>
10// TraDemGen
13
14namespace TRADEMGEN {
15
16 // //////////////////////////////////////////////////////////////////////
17 TRADEMGEN_ServiceContext::TRADEMGEN_ServiceContext ()
18 : _ownStdairService (false), _uniformGenerator (stdair::DEFAULT_RANDOM_SEED),
19 _posProbabilityMass (DEFAULT_POS_PROBALILITY_MASS) {
20 }
21
22 // //////////////////////////////////////////////////////////////////////
23 TRADEMGEN_ServiceContext::
24 TRADEMGEN_ServiceContext (const TRADEMGEN_ServiceContext& iServiceContext)
25 : _ownStdairService (false), _uniformGenerator (stdair::DEFAULT_RANDOM_SEED),
26 _posProbabilityMass (DEFAULT_POS_PROBALILITY_MASS) {
27 }
28
29 // //////////////////////////////////////////////////////////////////////
30 TRADEMGEN_ServiceContext::
31 TRADEMGEN_ServiceContext (const stdair::RandomSeed_T& iRandomSeed)
32 : _ownStdairService (false), _uniformGenerator (iRandomSeed),
33 _posProbabilityMass (DEFAULT_POS_PROBALILITY_MASS) {
34 }
35
36 // //////////////////////////////////////////////////////////////////////
37 TRADEMGEN_ServiceContext::~TRADEMGEN_ServiceContext() {
38 }
39
40 // //////////////////////////////////////////////////////////////////////
41 const std::string TRADEMGEN_ServiceContext::shortDisplay() const {
42 std::ostringstream oStr;
43 oStr << "TRADEMGEN_ServiceContext -- Owns StdAir service: "
44 << _ownStdairService << " -- Generator: " << _uniformGenerator;
45 return oStr.str();
46 }
47
48 // //////////////////////////////////////////////////////////////////////
49 const std::string TRADEMGEN_ServiceContext::display() const {
50 std::ostringstream oStr;
51 oStr << shortDisplay();
52 return oStr.str();
53 }
54
55 // //////////////////////////////////////////////////////////////////////
56 const std::string TRADEMGEN_ServiceContext::describe() const {
57 return shortDisplay();
58 }
59
60 // //////////////////////////////////////////////////////////////////////
61 void TRADEMGEN_ServiceContext::reset() {
62
63 // The shared_ptr<>::reset() method drops the refcount by one.
64 // If the count result is dropping to zero, the resource pointed to
65 // by the shared_ptr<> will be freed.
66
67 // Reset the stdair shared pointer
68 _stdairService.reset();
69
70 // Reset the sevmgr shared pointer
71 _sevmgrService.reset();
72 }
73
74}
const POSProbabilityMassFunction_T DEFAULT_POS_PROBALILITY_MASS
Definition BasConst.cpp:16
Forward declarations.