TraDemGen Logo  1.00.6
C++ Simulated Travel Demand Generation Library
TRADEMGEN_Service.hpp
Go to the documentation of this file.
1 #ifndef __TRADEMGEN_TRADEMGEN_SERVICE_HPP
2 #define __TRADEMGEN_TRADEMGEN_SERVICE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // StdAir
8 #include <stdair/stdair_basic_types.hpp>
9 #include <stdair/stdair_demand_types.hpp>
10 #include <stdair/stdair_maths_types.hpp>
11 #include <stdair/stdair_json.hpp>
12 #include <stdair/stdair_service_types.hpp>
13 #include <stdair/basic/DemandGenerationMethod.hpp>
14 #include <stdair/bom/BookingRequestTypes.hpp>
15 #include <stdair/bom/EventTypes.hpp>
16 #include <stdair/bom/EventStruct.hpp>
17 // SEvMgr
18 #include <sevmgr/SEVMGR_Types.hpp>
19 // TraDemGen
21 
22 // Forward declarations
23 namespace stdair {
24  class BomRoot;
25  struct ProgressStatusSet;
26  struct BasLogParams;
27  struct BasDBParams;
28  struct BookingRequestStruct;
29  struct DemandCharacteristics;
30  struct DemandDistribution;
31  struct EventStruct;
32  struct TravelSolutionStruct;
33 }
34 
35 namespace TRADEMGEN {
36 
38  class TRADEMGEN_ServiceContext;
39  struct DemandStreamKey;
40 
45  public:
46  // ////////////////// Constructors and Destructors //////////////////
63  TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
64  const stdair::RandomSeed_T&);
65 
78  TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::RandomSeed_T&);
79 
97  TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T,
98  SEVMGR::SEVMGR_ServicePtr_T,
99  const stdair::RandomSeed_T&);
100 
109  void parseAndLoad (const DemandFilePath&);
110 
115 
116 
117  public:
118  // ////////////////// Business support methods //////////////////
198  void buildSampleBom();
199 
203  void clonePersistentBom ();
204 
209  void buildComplementaryLinks (stdair::BomRoot&);
210 
241  stdair::BookingRequestStruct
242  buildSampleBookingRequest (const bool isForCRS = false);
243 
247  void displayAirlineListFromDB() const;
248 
264  const stdair::Count_T& getExpectedTotalNumberOfRequestsToBeGenerated() const;
265 
280  const stdair::Count_T& getActualTotalNumberOfRequestsToBeGenerated() const;
281 
296  const bool
297  stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T&,
298  stdair::ProgressStatusSet&,
299  const stdair::DemandGenerationMethod&) const;
300 
313  stdair::Count_T
314  generateFirstRequests (const stdair::DemandGenerationMethod&) const;
315 
330  stdair::BookingRequestPtr_T
331  generateNextRequest (const stdair::DemandStreamKeyStr_T&,
332  const stdair::DemandGenerationMethod&) const;
333 
341  bool hasDemandStream (const stdair::DemandStreamKeyStr_T&) const;
342 
359  stdair::ProgressStatusSet popEvent (stdair::EventStruct&) const;
360 
369  bool isQueueDone() const;
370 
374  bool generateCancellation (const stdair::TravelSolutionStruct&,
375  const stdair::PartySize_T&,
376  const stdair::DateTime_T&,
377  const stdair::Date_T&) const;
378 
383  void reset() const;
384 
388  const stdair::ProgressStatus& getProgressStatus () const;
389 
394  const stdair::ProgressStatus& getProgressStatus (const stdair::EventType::EN_EventType&) const;
395 
396  public:
397  // //////////////// Export support methods /////////////////
407  std::string jsonHandler (const stdair::JSONString&) const;
408 
409  public:
410  // //////////////// Display support methods /////////////////
418  std::string csvDisplay() const;
419 
426  std::string list () const;
427 
434  std::string list (const stdair::EventType::EN_EventType&) const;
435 
442  std::string displayDemandStream () const;
443 
444 
445  private:
446  // ////////////////// Constructors and Destructors //////////////////
451 
456 
468  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
469  const stdair::BasDBParams&);
470 
480  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
481 
485  void initSEVMGRService();
486 
495  void addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
496  const bool iOwnStdairService);
497 
503  void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr);
504 
511  void initServiceContext (const stdair::RandomSeed_T&);
512 
519  void initTrademgenService();
520 
524  void finalise();
525 
526 
527  private:
528  // ///////// Service Context /////////
532  TRADEMGEN_ServiceContext* _trademgenServiceContext;
533  };
534 
535 }
536 #endif // __TRADEMGEN_TRADEMGEN_SERVICE_HPP
TRADEMGEN::TRADEMGEN_Service::stillHavingRequestsToBeGenerated
const bool stillHavingRequestsToBeGenerated(const stdair::DemandStreamKeyStr_T &, stdair::ProgressStatusSet &, const stdair::DemandGenerationMethod &) const
Definition: TRADEMGEN_Service.cpp:638
TRADEMGEN::TRADEMGEN_Service::buildComplementaryLinks
void buildComplementaryLinks(stdair::BomRoot &)
Definition: TRADEMGEN_Service.cpp:419
TRADEMGEN::TRADEMGEN_Service::isQueueDone
bool isQueueDone() const
Definition: TRADEMGEN_Service.cpp:729
TRADEMGEN::TRADEMGEN_Service::csvDisplay
std::string csvDisplay() const
Definition: TRADEMGEN_Service.cpp:468
TRADEMGEN::TRADEMGEN_Service::buildSampleBom
void buildSampleBom()
Definition: TRADEMGEN_Service.cpp:310
TRADEMGEN::TRADEMGEN_Service::reset
void reset() const
Definition: TRADEMGEN_Service.cpp:811
TRADEMGEN::TRADEMGEN_Service::generateNextRequest
stdair::BookingRequestPtr_T generateNextRequest(const stdair::DemandStreamKeyStr_T &, const stdair::DemandGenerationMethod &) const
Definition: TRADEMGEN_Service.cpp:689
TRADEMGEN::TRADEMGEN_Service::clonePersistentBom
void clonePersistentBom()
Definition: TRADEMGEN_Service.cpp:382
TRADEMGEN
Definition: BasConst.cpp:10
TRADEMGEN::TRADEMGEN_Service::~TRADEMGEN_Service
~TRADEMGEN_Service()
Definition: TRADEMGEN_Service.cpp:125
TRADEMGEN::TRADEMGEN_Service::popEvent
stdair::ProgressStatusSet popEvent(stdair::EventStruct &) const
Definition: TRADEMGEN_Service.cpp:713
TRADEMGEN::TRADEMGEN_Service::generateCancellation
bool generateCancellation(const stdair::TravelSolutionStruct &, const stdair::PartySize_T &, const stdair::DateTime_T &, const stdair::Date_T &) const
Definition: TRADEMGEN_Service.cpp:749
TRADEMGEN::TRADEMGEN_Service::hasDemandStream
bool hasDemandStream(const stdair::DemandStreamKeyStr_T &) const
Definition: TRADEMGEN_Service.cpp:868
stdair
Forward declarations.
Definition: CategoricalAttribute.hpp:14
TRADEMGEN::TRADEMGEN_Service::buildSampleBookingRequest
stdair::BookingRequestStruct buildSampleBookingRequest(const bool isForCRS=false)
Definition: TRADEMGEN_Service.cpp:425
TRADEMGEN::DemandFilePath
Definition: TRADEMGEN_Types.hpp:30
TRADEMGEN_Types.hpp
TRADEMGEN::TRADEMGEN_Service::parseAndLoad
void parseAndLoad(const DemandFilePath &)
Definition: TRADEMGEN_Service.cpp:241
TRADEMGEN::TRADEMGEN_Service::jsonHandler
std::string jsonHandler(const stdair::JSONString &) const
Definition: TRADEMGEN_Service.cpp:447
TRADEMGEN::TRADEMGEN_Service::generateFirstRequests
stdair::Count_T generateFirstRequests(const stdair::DemandGenerationMethod &) const
Definition: TRADEMGEN_Service.cpp:663
TRADEMGEN::TRADEMGEN_Service
class holding the services related to Travel Demand Generation.
Definition: TRADEMGEN_Service.hpp:44
TRADEMGEN::TRADEMGEN_Service::getActualTotalNumberOfRequestsToBeGenerated
const stdair::Count_T & getActualTotalNumberOfRequestsToBeGenerated() const
Definition: TRADEMGEN_Service.cpp:617
TRADEMGEN::TRADEMGEN_Service::getProgressStatus
const stdair::ProgressStatus & getProgressStatus() const
Definition: TRADEMGEN_Service.cpp:832
TRADEMGEN::TRADEMGEN_ServiceContext
Class holding the context of the Trademgen services.
Definition: TRADEMGEN_ServiceContext.hpp:34
TRADEMGEN::TRADEMGEN_Service::getExpectedTotalNumberOfRequestsToBeGenerated
const stdair::Count_T & getExpectedTotalNumberOfRequestsToBeGenerated() const
Definition: TRADEMGEN_Service.cpp:596
TRADEMGEN::TRADEMGEN_Service::displayAirlineListFromDB
void displayAirlineListFromDB() const
Definition: TRADEMGEN_Service.cpp:535
TRADEMGEN::TRADEMGEN_Service::displayDemandStream
std::string displayDemandStream() const
Definition: TRADEMGEN_Service.cpp:885
TRADEMGEN::TRADEMGEN_Service::list
std::string list() const
Definition: TRADEMGEN_Service.cpp:490