StdAir Logo  0.45.0
C++ Standard Airline IT Object Library
STDAIR_Service.hpp
Go to the documentation of this file.
00001 
00012 #ifndef __STDAIR_STDAIR_HPP
00013 #define __STDAIR_STDAIR_HPP
00014 
00015 // //////////////////////////////////////////////////////////////////////
00016 // Import section
00017 // //////////////////////////////////////////////////////////////////////
00018 // STL
00019 #include <string>
00020 // StdAir
00021 #include <stdair/stdair_inventory_types.hpp>
00022 #include <stdair/stdair_service_types.hpp>
00023 #include <stdair/basic/BasLogParams.hpp>
00024 #include <stdair/basic/BasDBParams.hpp>
00025 #include <stdair/basic/ServiceInitialisationType.hpp>
00026 #include <stdair/basic/EventType.hpp>
00027 #include <stdair/bom/TravelSolutionTypes.hpp>
00028 
00029 namespace stdair {
00030 
00032   class BomRoot;
00033   class EventQueue;
00034   class EventStruct;
00035   struct ProgressStatusSet;
00036   struct BookingRequestStruct;
00037   class STDAIR_ServiceContext;
00038   
00039 
00043   class STDAIR_Service {
00044   public:
00045     // ////////// Constructors and destructors //////////
00049     STDAIR_Service();
00050 
00062     STDAIR_Service (const BasLogParams&);
00063 
00079     STDAIR_Service (const BasLogParams&, const BasDBParams&);
00080 
00084     ~STDAIR_Service();
00085     
00086 
00087   public:
00088     // ////////////////// Business support methods //////////////////    
00108     void buildSampleBom();
00109     
00131     void buildDummyInventory (const CabinCapacity_T& iCabinCapacity);
00132     
00147     void buildSampleTravelSolutionForPricing (TravelSolutionList_T&);
00148 
00166     void buildSampleTravelSolutions (TravelSolutionList_T&);
00167 
00196     BookingRequestStruct buildSampleBookingRequest (const bool isForCRS = false);
00197 
00212     const Count_T& getExpectedTotalNumberOfEventsToBeGenerated() const;
00213 
00230     const Count_T&
00231     getExpectedTotalNumberOfEventsToBeGenerated (const EventType::EN_EventType&) const;
00232 
00245     const Count_T& getActualTotalNumberOfEventsToBeGenerated() const;
00246 
00260     const Count_T&
00261     getActualTotalNumberOfEventsToBeGenerated (const EventType::EN_EventType&) const;
00262 
00279     ProgressStatusSet popEvent (EventStruct&) const;
00280 
00286     bool isQueueDone() const;
00287 
00292     void reset() const;
00293 
00294 
00295   public:
00296     // //////////////// Export support methods /////////////////
00306     std::string jsonExport (const AirlineCode_T&, const FlightNumber_T&,
00307                             const Date_T& iDepartureDate) const;
00308 
00309 
00310   public:
00311     // //////////////// Display support methods /////////////////
00325     std::string list (const AirlineCode_T& iAirlineCode = "all",
00326                       const FlightNumber_T& iFlightNumber = 0) const;
00327     
00334     std::string listAirportPairDateRange () const;
00335 
00345     bool check (const AirlineCode_T&, const FlightNumber_T&,
00346                 const Date_T& iDepartureDate) const;
00347 
00360     bool check (const AirportCode_T&, const AirportCode_T&,
00361                 const Date_T& iDepartureDate) const;
00362 
00370     std::string csvDisplay() const;
00371 
00381     std::string csvDisplay (const AirlineCode_T&, const FlightNumber_T&,
00382                             const Date_T& iDepartureDate) const;
00383 
00391     std::string csvDisplay (const TravelSolutionList_T&) const;
00392     
00403     std::string csvDisplay (const AirportCode_T&, const AirportCode_T&,
00404                             const Date_T& iDepartureDate) const;
00405 
00406 
00407   public:
00408     // ///////////////// Getters ///////////////////
00417     BomRoot& getBomRoot() const;
00418     
00427     EventQueue& getEventQueue() const;
00428     
00434     BasLogParams getLogParams() const;
00435 
00442     const BasDBParams& getDBParams() const;
00443 
00452     const ServiceInitialisationType& getServiceInitialisationType() const;
00453 
00454 
00455   private:
00456     // /////// Construction and Destruction helper methods ///////
00463     STDAIR_Service (const STDAIR_Service&);
00464     
00469     void initServiceContext();
00470 
00488     void logInit (const BasLogParams&);
00489     
00495     void dbInit (const BasDBParams&);
00496     
00512     void init();
00513     
00517     void finalise();
00518     
00519 
00520   private:
00521     // ///////// Service Context /////////
00525     STDAIR_ServiceContext* _stdairServiceContext;
00526   };
00527 }
00528 #endif // __STDAIR_STDAIR_HPP