AirInv Logo  1.00.0
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AIRINV_Master_Service.hpp
Go to the documentation of this file.
1 #ifndef __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP
2 #define __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <string>
9 // StdAir
10 #include <stdair/stdair_basic_types.hpp>
11 #include <stdair/stdair_file.hpp>
12 #include <stdair/stdair_service_types.hpp>
13 #include <stdair/stdair_inventory_types.hpp>
14 #include <stdair/stdair_maths_types.hpp>
15 #include <stdair/bom/BomIDTypes.hpp>
16 // AirRAC
17 #include <airrac/AIRRAC_Types.hpp>
18 // SEvMgr
19 #include <sevmgr/SEVMGR_Types.hpp>
20 // AirInv
21 #include <airinv/AIRINV_Types.hpp>
22 
23 
25 namespace stdair {
26  class BomRoot;
27  class AirlineFeatureSet;
28  class Inventory;
29  class JSONString;
30  class STDAIR_Service;
31  struct BasLogParams;
32  struct BasDBParams;
33  struct SnapshotStruct;
34  struct RMEventStruct;
35  struct TravelSolutionStruct;
36 }
37 
38 namespace AIRINV {
39 
42 
43 
48  public:
49  // ////////// Constructors and destructors //////////
65  AIRINV_Master_Service (const stdair::BasLogParams&,
66  const stdair::BasDBParams&);
67 
79  AIRINV_Master_Service (const stdair::BasLogParams&);
80 
96  AIRINV_Master_Service (stdair::STDAIR_ServicePtr_T);
97 
114  AIRINV_Master_Service (stdair::STDAIR_ServicePtr_T,
115  SEVMGR::SEVMGR_ServicePtr_T);
116 
125  void parseAndLoad (const InventoryFilePath&);
126 
139  void parseAndLoad (const stdair::ScheduleFilePath&,
140  const stdair::ODFilePath&,
141  const stdair::FRAT5FilePath&,
142  const stdair::FFDisutilityFilePath&,
143  const AIRRAC::YieldFilePath&);
144 
149 
154  void initSnapshotAndRMEvents (const stdair::Date_T&, const stdair::Date_T&);
155 
156 
157  public:
158  // /////////// Business Methods /////////////
166  void buildSampleBom();
167 
171  void clonePersistentBom ();
172 
177  void buildComplementaryLinks (stdair::BomRoot&);
178 
182  void calculateAvailability (stdair::TravelSolutionStruct&);
183 
192  bool sell (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
193  const stdair::PartySize_T&);
194 
202  bool sell (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
203 
213  bool cancel (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
214  const stdair::PartySize_T&);
215 
223  bool cancel (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
224 
228  void takeSnapshots (const stdair::SnapshotStruct&);
229 
233  void optimise (const stdair::RMEventStruct&);
234 
235 
236  public:
237 
238  // //////////////// Export support methods /////////////////
248  std::string jsonHandler (const stdair::JSONString&) const;
249 
262  std::string jsonExportFlightDateList (const stdair::AirlineCode_T& iAirlineCode = "all",
263  const stdair::FlightNumber_T& iFlightNumber = 0) const;
264 
275  std::string jsonExportFlightDateObjects (const stdair::AirlineCode_T&,
276  const stdair::FlightNumber_T&,
277  const stdair::Date_T& iDepartureDate) const;
278 
279 
280  public:
281  // //////////////// Display support methods /////////////////
295  std::string list (const stdair::AirlineCode_T& iAirlineCode = "all",
296  const stdair::FlightNumber_T& iFlightNumber = 0) const;
297 
307  bool check (const stdair::AirlineCode_T&, const stdair::FlightNumber_T&,
308  const stdair::Date_T& iDepartureDate) const;
309 
317  std::string csvDisplay() const;
318 
330  std::string csvDisplay (const stdair::AirlineCode_T&,
331  const stdair::FlightNumber_T&,
332  const stdair::Date_T& iDepartureDate) const;
333 
334 
335  private:
336  // /////// Construction and Destruction helper methods ///////
341 
346 
356  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
357  const stdair::BasDBParams&);
358 
367  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
368 
377  void addStdAirService (stdair::STDAIR_ServicePtr_T,
378  const bool iOwnStdairService);
379 
385  void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
386  const bool iOwnSEVMGRService);
387 
388 
393  void initServiceContext();
394 
401  void initSlaveAirinvService();
402 
406  void finalise();
407 
408 
409  private:
410  // ///////// Service Context /////////
414  AIRINV_Master_ServiceContext* _airinvMasterServiceContext;
415  };
416 }
417 #endif // __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP