TraDemGen Logo  1.00.0
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
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