$treeview $search $mathjax
TraDemGen Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

TRADEMGEN_Service.hpp

Go to the documentation of this file.
00001 #ifndef __TRADEMGEN_TRADEMGEN_SERVICE_HPP
00002 #define __TRADEMGEN_TRADEMGEN_SERVICE_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // StdAir
00008 #include <stdair/stdair_basic_types.hpp>
00009 #include <stdair/stdair_demand_types.hpp>
00010 #include <stdair/stdair_maths_types.hpp>
00011 #include <stdair/stdair_json.hpp>
00012 #include <stdair/stdair_service_types.hpp>
00013 #include <stdair/basic/DemandGenerationMethod.hpp>
00014 #include <stdair/bom/BookingRequestTypes.hpp>
00015 #include <stdair/bom/EventTypes.hpp>
00016 #include <stdair/bom/EventStruct.hpp>
00017 // SEvMgr
00018 #include <sevmgr/SEVMGR_Types.hpp>
00019 // TraDemGen
00020 #include <trademgen/TRADEMGEN_Types.hpp>
00021 
00022 // Forward declarations
00023 namespace stdair {  
00024   class BomRoot;
00025   struct ProgressStatusSet;
00026   struct BasLogParams;
00027   struct BasDBParams;
00028   struct BookingRequestStruct;
00029   struct DemandCharacteristics;
00030   struct DemandDistribution;
00031   struct EventStruct;
00032   struct TravelSolutionStruct;
00033 }
00034 
00035 namespace TRADEMGEN {
00036 
00038   class TRADEMGEN_ServiceContext; 
00039   struct DemandStreamKey;
00040   
00044   class TRADEMGEN_Service {
00045   public:
00046     // ////////////////// Constructors and Destructors //////////////////    
00063     TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
00064                        const stdair::RandomSeed_T&);
00065 
00078     TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::RandomSeed_T&);
00079 
00097     TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T, 
00098                        SEVMGR::SEVMGR_ServicePtr_T, 
00099                        const stdair::RandomSeed_T&);
00100     
00109     void parseAndLoad (const DemandFilePath&);
00110 
00114     ~TRADEMGEN_Service();
00115 
00116 
00117   public:
00118     // ////////////////// Business support methods //////////////////    
00198     void buildSampleBom();
00199 
00203     void clonePersistentBom ();
00204 
00209     void buildComplementaryLinks (stdair::BomRoot&); 
00210 
00241     stdair::BookingRequestStruct
00242     buildSampleBookingRequest (const bool isForCRS = false);
00243 
00247     void displayAirlineListFromDB() const;
00248 
00264     const stdair::Count_T& getExpectedTotalNumberOfRequestsToBeGenerated() const;
00265 
00280     const stdair::Count_T& getActualTotalNumberOfRequestsToBeGenerated() const;
00281 
00296     const bool
00297     stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T&,
00298                                       stdair::ProgressStatusSet&,
00299                                       const stdair::DemandGenerationMethod&) const;
00300 
00313     stdair::Count_T
00314     generateFirstRequests (const stdair::DemandGenerationMethod&) const;
00315 
00330     stdair::BookingRequestPtr_T
00331     generateNextRequest (const stdair::DemandStreamKeyStr_T&,
00332                          const stdair::DemandGenerationMethod&) const;
00333 
00341     bool hasDemandStream (const stdair::DemandStreamKeyStr_T&) const;
00342 
00359     stdair::ProgressStatusSet popEvent (stdair::EventStruct&) const;
00360 
00369     bool isQueueDone() const;
00370 
00374     bool generateCancellation (const stdair::TravelSolutionStruct&,
00375                                const stdair::PartySize_T&,
00376                                const stdair::DateTime_T&,
00377                                const stdair::Date_T&) const;
00378 
00383     void reset() const;  
00384 
00388     const stdair::ProgressStatus& getProgressStatus () const; 
00389 
00394     const stdair::ProgressStatus& getProgressStatus (const stdair::EventType::EN_EventType&) const;
00395     
00396   public:
00397     // //////////////// Export support methods /////////////////
00407     std::string jsonHandler (const stdair::JSONString&) const;
00408 
00409   public:
00410     // //////////////// Display support methods /////////////////
00418     std::string csvDisplay() const;
00419 
00426     std::string list () const;
00427 
00434     std::string list (const stdair::EventType::EN_EventType&) const;
00435 
00442     std::string displayDemandStream () const;
00443 
00444 
00445   private:
00446     // ////////////////// Constructors and Destructors //////////////////    
00450     TRADEMGEN_Service();
00451     
00455     TRADEMGEN_Service (const TRADEMGEN_Service&);
00456 
00468     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
00469                                                    const stdair::BasDBParams&);
00470     
00480     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
00481     
00485     void initSEVMGRService();
00486     
00495     void addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
00496                            const bool iOwnStdairService); 
00497 
00503     void addSEVMGRService (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr);
00504     
00511     void initServiceContext (const stdair::RandomSeed_T&);
00512 
00519     void initTrademgenService();
00520 
00524     void finalise();
00525 
00526     
00527   private:
00528     // ///////// Service Context /////////
00532     TRADEMGEN_ServiceContext* _trademgenServiceContext;
00533   };
00534 
00535 }
00536 #endif // __TRADEMGEN_TRADEMGEN_SERVICE_HPP