TvlSim Logo  1.00.0
C++ Simulated Travel-Oriented Distribution System Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TVLSIM_Service.hpp
Go to the documentation of this file.
1 #ifndef __TVLSIM_SVC_TVLSIM_SERVICE_HPP
2 #define __TVLSIM_SVC_TVLSIM_SERVICE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // StdAir
8 #include <stdair/stdair_basic_types.hpp>
9 #include <stdair/stdair_file.hpp>
10 #include <stdair/stdair_date_time_types.hpp>
11 #include <stdair/stdair_maths_types.hpp>
12 #include <stdair/stdair_service_types.hpp>
13 #include <stdair/basic/DemandGenerationMethod.hpp>
14 #include <stdair/bom/TravelSolutionTypes.hpp>
15 #include <stdair/bom/BreakPointStruct.hpp>
16 // AIRRAC
17 #include <airrac/AIRRAC_Types.hpp>
18 // SimFQT
19 #include <simfqt/SIMFQT_Types.hpp>
20 // TRADEMGEN
21 #include <trademgen/TRADEMGEN_Types.hpp>
22 // Dsim
24 #include <tvlsim/TVLSIM_Types.hpp>
25 
26 // Forward declarations
27 namespace stdair {
28  class BomRoot;
29  struct BasLogParams;
30  struct BasDBParams;
31  struct BookingRequestStruct;
32  class JSONString;
33  struct RMEventStruct;
34 }
35 
36 namespace TVLSIM {
37 
38  // Forward declaration
39  class TVLSIM_ServiceContext;
40  struct RDSParameters;
41  class SimulationStatus;
42 
47  public:
48  // ////////////////// Constructors and Destructors //////////////////
74  TVLSIM_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
75  const stdair::Date_T& iStartDate,
76  const stdair::Date_T& iEndDate, const stdair::RandomSeed_T&,
77  const stdair::DemandGenerationMethod&,
78  const NbOfRuns_T& iNbOfRuns = DEFAULT_NUMBER_OF_RUNS);
79 
104  TVLSIM_Service (const stdair::BasLogParams&, const stdair::Date_T& iStartDate,
105  const stdair::Date_T& iEndDate, const stdair::RandomSeed_T&,
106  const stdair::DemandGenerationMethod&,
107  const NbOfRuns_T& iNbOfRuns = DEFAULT_NUMBER_OF_RUNS);
108 
134  TVLSIM_Service (stdair::STDAIR_ServicePtr_T, const stdair::Date_T& iStartDate,
135  const stdair::Date_T& iEndDate, const stdair::RandomSeed_T&,
136  const stdair::DemandGenerationMethod&,
137  const NbOfRuns_T& iNbOfRuns = DEFAULT_NUMBER_OF_RUNS);
138 
142  ~TVLSIM_Service();
143 
144 
145  public:
146  // /////////// Business Methods /////////////
158  void simulate ();
159 
163  void optimise (const stdair::RMEventStruct&);
164 
168  void displayAirlineListFromDB() const;
169 
179  void buildSampleBom();
180 
196  void setInputFiles (const stdair::ScheduleFilePath&,
197  const stdair::ODFilePath&,
198  const stdair::FRAT5FilePath&,
199  const stdair::FFDisutilityFilePath&,
200  const AIRRAC::YieldFilePath&,
201  const SIMFQT::FareFilePath&,
202  const TRADEMGEN::DemandFilePath&);
203 
211  void parseAndLoad ();
212 
216  void initSnapshotAndRMEvents();
217 
226  const stdair::Count_T initBreakPointEvents(const stdair::BreakPointList_T&);
227 
232  void reinitServices();
233 
253  void buildSampleTravelSolutions (stdair::TravelSolutionList_T&);
254 
285  stdair::BookingRequestStruct
286  buildSampleBookingRequest (const bool isForCRS = false);
287 
291  void reset();
292 
301  bool sell (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
302  const stdair::PartySize_T&);
303 
304 
305  public:
306  // //////////////// Export support methods /////////////////
316  std::string jsonHandler (const stdair::JSONString&);
317 
318  private:
327  std::string jsonBreakPointHandler (const stdair::JSONString&);
328 
337  std::string jsonRunHandler (const stdair::JSONString&);
338 
339 
340  public:
341  // //////////////// Display support methods /////////////////
349  std::string csvDisplay() const;
350 
357  std::string configDisplay () const;
358 
365  std::string listEvents () const;
366 
375  std::string listEvents (const stdair::EventType::EN_EventType&) const;
376 
385  std::string simulationStatusDisplay() const;
386 
400  std::string list (const stdair::AirlineCode_T& iAirlineCode = "all",
401  const stdair::FlightNumber_T& iFlightNumber = 0) const;
402 
414  std::string csvDisplay (const stdair::AirlineCode_T&,
415  const stdair::FlightNumber_T&,
416  const stdair::Date_T& iDepartureDate) const;
417 
418  public:
419  // //////////////// Getters /////////////////
424 
425  private:
426 
427  // /////// Construction and Destruction helper methods ///////
431  TVLSIM_Service();
432 
437 
447  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
448  const stdair::BasDBParams&);
449 
459  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
460 
467  void initSEVMGRService ();
468 
472  void initSIMCRSService();
473 
477  void initTRADEMGENService ();
478 
482  void initTRAVELCCMService();
483 
492  void addStdAirService (stdair::STDAIR_ServicePtr_T,
493  const bool iOwnStdairService);
494 
499  void initServiceContext ();
500 
518  void initConfig (const stdair::Date_T& iStartDate,
519  const stdair::Date_T& iEndDate,
520  const stdair::RandomSeed_T&,
521  const stdair::DemandGenerationMethod&,
522  const NbOfRuns_T&);
523 
528  void initDsimService();
529 
533  void finalise();
534 
538  void prepareNewRun();
539 
543  void clonePersistentBom ();
544 
549  void buildComplementaryLinks (stdair::BomRoot&);
550 
551 
552  private:
553  // ///////// Service Context /////////
557  TVLSIM_ServiceContext* _tvlsimServiceContext;
558  };
559 }
560 #endif // __TVLSIM_SVC_TVLSIM_SERVICE_HPP