SimCRS Logo  1.00.0
C++ Simulated Travel-Oriented Distribution System Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
SIMCRS_Service.hpp
Go to the documentation of this file.
1 #ifndef __SIMCRS_SVC_SIMCRS_SERVICE_HPP
2 #define __SIMCRS_SVC_SIMCRS_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_service_types.hpp>
11 #include <stdair/bom/TravelSolutionTypes.hpp>
12 // SEvMgr
13 #include <sevmgr/SEVMGR_Types.hpp>
14 // SimFQT
15 #include <simfqt/SIMFQT_Types.hpp>
16 // AIRRAC
17 #include <airrac/AIRRAC_Types.hpp>
18 // SimCRS
19 #include <simcrs/SIMCRS_Types.hpp>
20 
22 namespace stdair {
23  class BomRoot;
24  struct BasLogParams;
25  struct BasDBParams;
26  struct BookingRequestStruct;
27  struct CancellationStruct;
28  struct SnapshotStruct;
29  struct RMEventStruct;
30  class JSONString;
31 }
32 
33 namespace SIMCRS {
34 
36  class SIMCRS_ServiceContext;
37 
38 
42  class SIMCRS_Service {
43  public:
44  // ////////////////// Constructors and Destructors //////////////////
61  SIMCRS_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
62  const CRSCode_T&);
63 
76  SIMCRS_Service (const stdair::BasLogParams&, const CRSCode_T&);
77 
96  SIMCRS_Service (stdair::STDAIR_ServicePtr_T, SEVMGR::SEVMGR_ServicePtr_T,
97  const CRSCode_T&);
98 
99 
113  void parseAndLoad (const stdair::ScheduleFilePath&,
114  const stdair::ODFilePath&,
115  const stdair::FRAT5FilePath&,
116  const stdair::FFDisutilityFilePath&,
117  const AIRRAC::YieldFilePath&,
118  const SIMFQT::FareFilePath&);
119 
126  void initSnapshotAndRMEvents (const stdair::Date_T& iStartDate,
127  const stdair::Date_T& iEndDate);
128 
132  ~SIMCRS_Service();
133 
134 
135  public:
136  // /////////////// Business Methods /////////////////
141  stdair::TravelSolutionList_T
142  calculateSegmentPathList (const stdair::BookingRequestStruct&);
143 
147  void fareQuote (const stdair::BookingRequestStruct&,
148  stdair::TravelSolutionList_T&);
149 
153  void calculateAvailability (stdair::TravelSolutionList_T&);
154 
158  bool sell (const stdair::TravelSolutionStruct&, const stdair::PartySize_T&);
159 
163  void takeSnapshots (const stdair::SnapshotStruct&);
164 
168  bool playCancellation (const stdair::CancellationStruct&);
169 
173  void optimise (const stdair::RMEventStruct&);
174 
183  bool sell (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
184  const stdair::PartySize_T&);
185 
195  void buildSampleBom ();
196 
200  void clonePersistentBom ();
201 
206  void buildComplementaryLinks (stdair::BomRoot&);
207 
227  void buildSampleTravelSolutions (stdair::TravelSolutionList_T&);
228 
259  stdair::BookingRequestStruct
260  buildSampleBookingRequest (const bool isForCRS = false);
261 
262 
263  public:
264  // //////////////// Export support methods /////////////////
274  std::string jsonHandler (const stdair::JSONString&) const;
275 
276  public:
277  // //////////////// Display support methods /////////////////
285  std::string csvDisplay() const;
286 
294  std::string csvDisplay (const stdair::TravelSolutionList_T&) const;
295 
309  std::string list (const stdair::AirlineCode_T& iAirlineCode = "all",
310  const stdair::FlightNumber_T& iFlightNumber = 0) const;
311 
323  std::string csvDisplay (const stdair::AirlineCode_T&,
324  const stdair::FlightNumber_T&,
325  const stdair::Date_T& iDepartureDate) const;
326 
327 
328  private:
329  // /////// Construction and Destruction helper methods ///////
333  SIMCRS_Service();
334 
339 
349  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
350  const stdair::BasDBParams&);
351 
361  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
362 
366  void initAIRSCHEDService();
367 
371  void initSIMFQTService();
372 
376  void initAIRINVService();
377 
386  void addStdAirService (stdair::STDAIR_ServicePtr_T,
387  const bool iOwnStdairService);
388 
394  void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T,
395  const bool iOwnSEVMGRService);
396 
403  void initServiceContext (const CRSCode_T&);
404 
409  void initSimcrsService();
410 
414  void finalise();
415 
416 
417  private:
418  // ///////// Service Context /////////
422  SIMCRS_ServiceContext* _simcrsServiceContext;
423  };
424 }
425 #endif // __SIMCRS_SVC_SIMCRS_SERVICE_HPP