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_Service.hpp
Go to the documentation of this file.
1 #ifndef __AIRINV_SVC_AIRINV_SERVICE_HPP
2 #define __AIRINV_SVC_AIRINV_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_service_types.hpp>
12 #include <stdair/basic/JSonCommand.hpp>
13 #include <stdair/bom/RMEventTypes.hpp>
14 #include <stdair/bom/BomIDTypes.hpp>
15 // AirRAC
16 #include <airrac/AIRRAC_Types.hpp>
17 // SEvMgr
18 #include <sevmgr/SEVMGR_Types.hpp>
19 
21 namespace stdair {
22  class AirlineFeatureSet;
23  class STDAIR_Service;
24  class Inventory;
25  class JSONString;
26  struct TravelSolutionStruct;
27  struct BasLogParams;
28  struct BasDBParams;
29 }
30 
31 namespace AIRINV {
32 
34  class AIRINV_ServiceContext;
35 
36 
41  public:
42  // ////////// Constructors and destructors //////////
58  AIRINV_Service (const stdair::BasLogParams&, const stdair::BasDBParams&);
59 
71  AIRINV_Service (const stdair::BasLogParams&);
72 
88  AIRINV_Service (stdair::STDAIR_ServicePtr_T);
89 
106  AIRINV_Service (stdair::STDAIR_ServicePtr_T,
107  SEVMGR::SEVMGR_ServicePtr_T);
108 
118 
131  void parseAndLoad (const stdair::ScheduleFilePath&,
132  const stdair::ODFilePath&,
133  const stdair::FRAT5FilePath&,
134  const stdair::FFDisutilityFilePath&,
135  const AIRRAC::YieldFilePath&);
136 
140  ~AIRINV_Service();
141 
142 
143  public:
144  // /////////// Business Methods /////////////
152  void buildSampleBom();
153 
157  void clonePersistentBom ();
158 
164  void buildComplementaryLinks (stdair::BomRoot&);
165 
171  stdair::RMEventList_T initRMEvents (const stdair::Date_T& iStartDate,
172  const stdair::Date_T& iEndDate);
173 
177  void calculateAvailability (stdair::TravelSolutionStruct&);
178 
187  bool sell (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
188  const stdair::PartySize_T&);
189 
197  bool sell (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
198 
208  bool cancel (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
209  const stdair::PartySize_T&);
210 
218  bool cancel (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
219 
223  void takeSnapshots (const stdair::AirlineCode_T&,
224  const stdair::DateTime_T&);
225 
229  void optimise (const stdair::AirlineCode_T&,
230  const stdair::KeyDescription_T&,
231  const stdair::DateTime_T&);
232 
233  public:
234  // //////////////// Export support methods /////////////////
235 
245  std::string jsonHandler (const stdair::JSONString&) const;
246 
259  std::string jsonExportFlightDateList (const stdair::AirlineCode_T& iAirlineCode = "all",
260  const stdair::FlightNumber_T& iFlightNumber = 0) const;
271  std::string jsonExportFlightDateObjects (const stdair::AirlineCode_T&,
272  const stdair::FlightNumber_T&,
273  const stdair::Date_T& iDepartureDate) const;
274 
275  public:
276  // //////////////// Display support methods /////////////////
290  std::string list (const stdair::AirlineCode_T& iAirlineCode = "all",
291  const stdair::FlightNumber_T& iFlightNumber = 0) const;
292 
302  bool check (const stdair::AirlineCode_T&, const stdair::FlightNumber_T&,
303  const stdair::Date_T& iDepartureDate) const;
304 
312  std::string csvDisplay() const;
313 
325  std::string csvDisplay (const stdair::AirlineCode_T&,
326  const stdair::FlightNumber_T&,
327  const stdair::Date_T& iDepartureDate) const;
328 
329 
330  private:
331  // /////// Construction and Destruction helper methods ///////
335  AIRINV_Service ();
336 
341 
351  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
352  const stdair::BasDBParams&);
353 
362  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
363 
367  void initRMOLService();
368 
372  void initAIRRACService();
373 
377  void initSEVMGRService();
378 
387  void addStdAirService (stdair::STDAIR_ServicePtr_T,
388  const bool iOwnStdairService);
389 
395  void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T,
396  const bool iOwnSEVMGRService);
397 
402  void initServiceContext();
403 
410  void initAirinvService();
411 
415  void finalise();
416 
417 
418  private:
419  // ///////// Service Context /////////
423  AIRINV_ServiceContext* _airinvServiceContext;
424  };
425 }
426 #endif // __AIRINV_SVC_AIRINV_SERVICE_HPP