$treeview $search $mathjax
AirInv Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

AIRINV_Master_Service.hpp

Go to the documentation of this file.
00001 #ifndef __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP
00002 #define __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <string>
00009 // StdAir
00010 #include <stdair/stdair_basic_types.hpp>
00011 #include <stdair/stdair_file.hpp>
00012 #include <stdair/stdair_service_types.hpp>
00013 #include <stdair/stdair_inventory_types.hpp>
00014 #include <stdair/stdair_maths_types.hpp>
00015 #include <stdair/bom/BomIDTypes.hpp>
00016 // AirRAC
00017 #include <airrac/AIRRAC_Types.hpp>
00018 // SEvMgr
00019 #include <sevmgr/SEVMGR_Types.hpp>
00020 // AirInv
00021 #include <airinv/AIRINV_Types.hpp>
00022 
00023 
00025 namespace stdair {
00026   class BomRoot;
00027   class AirlineFeatureSet;
00028   class Inventory;
00029   class JSONString;
00030   class STDAIR_Service;
00031   struct BasLogParams;
00032   struct BasDBParams;
00033   struct SnapshotStruct;
00034   struct RMEventStruct;
00035   struct TravelSolutionStruct;
00036 }
00037 
00038 namespace AIRINV {
00039 
00041   class AIRINV_Master_ServiceContext;
00042 
00043   
00047   class AIRINV_Master_Service {
00048   public:   
00049     // ////////// Constructors and destructors //////////
00065     AIRINV_Master_Service (const stdair::BasLogParams&,
00066                            const stdair::BasDBParams&);
00067 
00079     AIRINV_Master_Service (const stdair::BasLogParams&);  
00080 
00096     AIRINV_Master_Service (stdair::STDAIR_ServicePtr_T);
00097 
00114     AIRINV_Master_Service (stdair::STDAIR_ServicePtr_T,
00115                            SEVMGR::SEVMGR_ServicePtr_T);
00116 
00125     void parseAndLoad (const InventoryFilePath&);
00126 
00139     void parseAndLoad (const stdair::ScheduleFilePath&,
00140                        const stdair::ODFilePath&,
00141                        const stdair::FRAT5FilePath&,
00142                        const stdair::FFDisutilityFilePath&,
00143                        const AIRRAC::YieldFilePath&);
00144 
00148     ~AIRINV_Master_Service();
00149 
00154     void initSnapshotAndRMEvents (const stdair::Date_T&, const stdair::Date_T&);
00155     
00156 
00157   public:
00158     // /////////// Business Methods /////////////
00166     void buildSampleBom();
00167       
00171     void clonePersistentBom (); 
00172 
00177     void buildComplementaryLinks (stdair::BomRoot&);
00178 
00182     void calculateAvailability (stdair::TravelSolutionStruct&);
00183 
00192     bool sell (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
00193                const stdair::PartySize_T&);
00194 
00202     bool sell (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
00203     
00213     bool cancel (const std::string& iSegmentDateKey, const stdair::ClassCode_T&,
00214                  const stdair::PartySize_T&);
00215     
00223     bool cancel (const stdair::BookingClassID_T&, const stdair::PartySize_T&);
00224 
00228     void takeSnapshots (const stdair::SnapshotStruct&);
00229     
00233     void optimise (const stdair::RMEventStruct&);    
00234 
00235 
00236   public:
00237 
00238     // //////////////// Export support methods /////////////////   
00248     std::string jsonHandler (const stdair::JSONString&) const;
00249 
00262     std::string jsonExportFlightDateList (const stdair::AirlineCode_T& iAirlineCode = "all",
00263                                           const stdair::FlightNumber_T& iFlightNumber = 0) const;
00264 
00275     std::string jsonExportFlightDateObjects (const stdair::AirlineCode_T&,
00276                                              const stdair::FlightNumber_T&,
00277                                              const stdair::Date_T& iDepartureDate) const;
00278 
00279 
00280   public:
00281     // //////////////// Display support methods /////////////////
00295     std::string list (const stdair::AirlineCode_T& iAirlineCode = "all",
00296                       const stdair::FlightNumber_T& iFlightNumber = 0) const;
00297 
00307     bool check (const stdair::AirlineCode_T&, const stdair::FlightNumber_T&,
00308                 const stdair::Date_T& iDepartureDate) const;
00309 
00317     std::string csvDisplay() const;
00318 
00330     std::string csvDisplay (const stdair::AirlineCode_T&,
00331                             const stdair::FlightNumber_T&,
00332                             const stdair::Date_T& iDepartureDate) const;
00333 
00334 
00335   private:
00336     // /////// Construction and Destruction helper methods ///////
00340     AIRINV_Master_Service();
00341 
00345     AIRINV_Master_Service (const AIRINV_Master_Service&);
00346 
00356     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
00357                                                    const stdair::BasDBParams&);
00358 
00367     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
00368     
00377     void addStdAirService (stdair::STDAIR_ServicePtr_T,
00378                            const bool iOwnStdairService);
00379 
00385     void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
00386                            const bool iOwnSEVMGRService);
00387     
00388     
00393     void initServiceContext();
00394 
00401     void initSlaveAirinvService();
00402 
00406     void finalise();
00407     
00408 
00409   private:
00410     // ///////// Service Context /////////
00414     AIRINV_Master_ServiceContext* _airinvMasterServiceContext;
00415   };
00416 }
00417 #endif // __AIRINV_SVC_AIRINV_MASTER_SERVICE_HPP