TraDemGen Logo  0.2.2
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros 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_service_types.hpp>
12 #include <stdair/basic/DemandGenerationMethod.hpp>
13 #include <stdair/bom/BookingRequestTypes.hpp>
14 #include <stdair/bom/EventTypes.hpp>
15 
16 // Forward declarations
17 namespace stdair {
18  class EventQueue;
19  struct ProgressStatusSet;
20  struct BasLogParams;
21  struct BasDBParams;
22  struct BookingRequestStruct;
23  struct DemandCharacteristics;
24  struct DemandDistribution;
25  struct EventStruct;
26  struct TravelSolutionStruct;
27 }
28 
29 namespace TRADEMGEN {
30 
32  class TRADEMGEN_ServiceContext;
33  struct DemandStreamKey;
34 
39  public:
40  // ////////////////// Constructors and Destructors //////////////////
57  TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
58  const stdair::RandomSeed_T&);
59 
72  TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::RandomSeed_T&);
73 
90  TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T, const stdair::RandomSeed_T&);
91 
100  void parseAndLoad (const stdair::Filename_T& iDemandInputFilename);
101 
106 
107 
108  public:
109  // ////////////////// Business support methods //////////////////
189  void buildSampleBom();
190 
221  stdair::BookingRequestStruct
222  buildSampleBookingRequest (const bool isForCRS = false);
223 
227  void displayAirlineListFromDB() const;
228 
243  const stdair::Count_T& getExpectedTotalNumberOfRequestsToBeGenerated() const;
244 
258  const stdair::Count_T& getActualTotalNumberOfRequestsToBeGenerated() const;
259 
274  const bool
275  stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T&,
276  stdair::ProgressStatusSet&,
277  const stdair::DemandGenerationMethod&) const;
278 
291  stdair::Count_T
292  generateFirstRequests (const stdair::DemandGenerationMethod&) const;
293 
308  stdair::BookingRequestPtr_T
309  generateNextRequest (const stdair::DemandStreamKeyStr_T&,
310  const stdair::DemandGenerationMethod&) const;
311 
328  stdair::ProgressStatusSet popEvent (stdair::EventStruct&) const;
329 
335  bool isQueueDone() const;
336 
340  bool generateCancellation (const stdair::TravelSolutionStruct&,
341  const stdair::PartySize_T&,
342  const stdair::DateTime_T&,
343  const stdair::Date_T&) const;
344 
349  void reset() const;
350 
351 
352  public:
353  // //////////////// Display support methods /////////////////
361  std::string csvDisplay() const;
362 
363 
364  private:
365  // ////////////////// Constructors and Destructors //////////////////
370 
375 
387  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
388  const stdair::BasDBParams&);
389 
399  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
400 
409  void addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
410  const bool iOwnStdairService);
411 
418  void initServiceContext (const stdair::RandomSeed_T&);
419 
426  void initTrademgenService();
427 
431  void finalise();
432 
433 
434  private:
435  // ///////// Service Context /////////
439  TRADEMGEN_ServiceContext* _trademgenServiceContext;
440  };
441 
442 }
443 #endif // __TRADEMGEN_TRADEMGEN_SERVICE_HPP