TraDemGen Logo  0.2.2
C++ Simulated Travel Demand Generation Library
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_service_types.hpp>
00012 #include <stdair/basic/DemandGenerationMethod.hpp>
00013 #include <stdair/bom/BookingRequestTypes.hpp>
00014 #include <stdair/bom/EventTypes.hpp>
00015 
00016 // Forward declarations
00017 namespace stdair {
00018   class EventQueue;
00019   struct ProgressStatusSet;
00020   struct BasLogParams;
00021   struct BasDBParams;
00022   struct BookingRequestStruct;
00023   struct DemandCharacteristics;
00024   struct DemandDistribution;
00025   struct EventStruct;
00026   struct TravelSolutionStruct;
00027 }
00028 
00029 namespace TRADEMGEN {
00030 
00032   class TRADEMGEN_ServiceContext;
00033   struct DemandStreamKey;
00034   
00038   class TRADEMGEN_Service {
00039   public:
00040     // ////////////////// Constructors and Destructors //////////////////    
00057     TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
00058                        const stdair::RandomSeed_T&);
00059 
00072     TRADEMGEN_Service (const stdair::BasLogParams&, const stdair::RandomSeed_T&);
00073 
00090     TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T, const stdair::RandomSeed_T&);
00091     
00100     void parseAndLoad (const stdair::Filename_T& iDemandInputFilename);
00101 
00105     ~TRADEMGEN_Service();
00106 
00107 
00108   public:
00109     // ////////////////// Business support methods //////////////////    
00189     void buildSampleBom();
00190 
00221     stdair::BookingRequestStruct
00222     buildSampleBookingRequest (const bool isForCRS = false);
00223 
00227     void displayAirlineListFromDB() const;
00228 
00243     const stdair::Count_T& getExpectedTotalNumberOfRequestsToBeGenerated() const;
00244 
00258     const stdair::Count_T& getActualTotalNumberOfRequestsToBeGenerated() const;
00259 
00274     const bool
00275     stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T&,
00276                                       stdair::ProgressStatusSet&,
00277                                       const stdair::DemandGenerationMethod&) const;
00278 
00291     stdair::Count_T
00292     generateFirstRequests (const stdair::DemandGenerationMethod&) const;
00293 
00308     stdair::BookingRequestPtr_T
00309     generateNextRequest (const stdair::DemandStreamKeyStr_T&,
00310                          const stdair::DemandGenerationMethod&) const;
00311 
00328     stdair::ProgressStatusSet popEvent (stdair::EventStruct&) const;
00329 
00335     bool isQueueDone() const;
00336 
00340     bool generateCancellation (const stdair::TravelSolutionStruct&,
00341                                const stdair::PartySize_T&,
00342                                const stdair::DateTime_T&,
00343                                const stdair::Date_T&) const;
00344 
00349     void reset() const;
00350 
00351 
00352   public:
00353     // //////////////// Display support methods /////////////////
00361     std::string csvDisplay() const;
00362 
00363 
00364   private:
00365     // ////////////////// Constructors and Destructors //////////////////    
00369     TRADEMGEN_Service();
00370     
00374     TRADEMGEN_Service (const TRADEMGEN_Service&);
00375 
00387     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
00388                                                    const stdair::BasDBParams&);
00389     
00399     stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
00400     
00409     void addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
00410                            const bool iOwnStdairService);
00411     
00418     void initServiceContext (const stdair::RandomSeed_T&);
00419 
00426     void initTrademgenService();
00427 
00431     void finalise();
00432 
00433     
00434   private:
00435     // ///////// Service Context /////////
00439     TRADEMGEN_ServiceContext* _trademgenServiceContext;
00440   };
00441 
00442 }
00443 #endif // __TRADEMGEN_TRADEMGEN_SERVICE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines