From: <qua...@us...> - 2010-02-03 16:29:34
|
Revision: 60 http://dsim.svn.sourceforge.net/dsim/?rev=60&view=rev Author: quannaus Date: 2010-02-03 16:28:56 +0000 (Wed, 03 Feb 2010) Log Message: ----------- [dev] Integrated TRADEMGEN service into DSIM. Modified Paths: -------------- trunk/dsim/dsim/command/Makefile.am trunk/dsim/dsim/command/Simulator.cpp trunk/dsim/dsim/command/Simulator.hpp trunk/dsim/dsim/core/Makefile.am trunk/dsim/dsim/service/DSIM_Service.cpp trunk/dsim/dsim/service/DSIM_ServiceContext.hpp Modified: trunk/dsim/dsim/command/Makefile.am =================================================================== --- trunk/dsim/dsim/command/Makefile.am 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/command/Makefile.am 2010-02-03 16:28:56 UTC (rev 60) @@ -8,7 +8,8 @@ libcmd_la_CXXFLAGS = $(BOOST_CFLAGS) libcmd_la_LIBADD = libcmd_la_LDFLAGS = $(BOOST_LIBS) \ - $(top_builddir)/simcrs/core/libsimcrs.la + $(top_builddir)/simcrs/core/libsimcrs.la \ + $(top_builddir)/trademgen/core/libtrademgen.la #pkgincludedir = $(includedir)/@PACKAGE@/command Modified: trunk/dsim/dsim/command/Simulator.cpp =================================================================== --- trunk/dsim/dsim/command/Simulator.cpp 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-03 16:28:56 UTC (rev 60) @@ -14,6 +14,8 @@ #include <stdair/service/Logger.hpp> // Distribution #include <simcrs/SIMCRS_Service.hpp> +// TRADEMGEN +#include <trademgen/TRADEMGEN_Service.hpp> // Airsched #include <airsched/AIRSCHED_Service.hpp> // Dsim @@ -23,30 +25,18 @@ namespace DSIM { // //////////////////////////////////////////////////////////////////// - void Simulator::simulate (SIMCRS::SIMCRS_Service& ioSIMCRS_Service) { + void Simulator::simulate (SIMCRS::SIMCRS_Service& ioSIMCRS_Service, + TRADEMGEN::TRADEMGEN_Service& ioTRADEMGEN_Service) { try { // DEBUG STDAIR_LOG_DEBUG ("The simulation is starting"); - // TODO: remove this hardcoded section - // Hardcode a booking request in order to simulate a sale. - // Departure airport code - stdair::AirportCode_T lOrigin ("LHR"); - // Arrival airport code - stdair::AirportCode_T lDestination ("JFK"); - // Departure date - stdair::Date_T lDepartureDate (2010, 01, 19); - // Passenger type - stdair::PassengerType_T lPaxType ("L"); - // Number of passengers in the travelling group - stdair::NbOfSeats_T lPartySize = 5; - // Booking request - stdair::BookingRequestStruct lBookingRequest (lOrigin, lDestination, - lDepartureDate, - lPaxType, lPartySize); - + // Generate a booking request. + stdair::BookingRequestStruct lBookingRequest = + ioTRADEMGEN_Service.generateBookingRequest (); + // Play booking request playBookingRequest (ioSIMCRS_Service, lBookingRequest); Modified: trunk/dsim/dsim/command/Simulator.hpp =================================================================== --- trunk/dsim/dsim/command/Simulator.hpp 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/command/Simulator.hpp 2010-02-03 16:28:56 UTC (rev 60) @@ -16,6 +16,10 @@ class SIMCRS_Service; } +namespace TRADEMGEN { + class TRADEMGEN_Service; +} + namespace DSIM { /** Class wrapping the simulation methods. */ @@ -24,7 +28,7 @@ private: /** Perform a simulation. */ - static void simulate (SIMCRS::SIMCRS_Service&); + static void simulate (SIMCRS::SIMCRS_Service&,TRADEMGEN::TRADEMGEN_Service&); /** Play a booking request event. */ static void playBookingRequest (SIMCRS::SIMCRS_Service&, Modified: trunk/dsim/dsim/core/Makefile.am =================================================================== --- trunk/dsim/dsim/core/Makefile.am 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/core/Makefile.am 2010-02-03 16:28:56 UTC (rev 60) @@ -24,4 +24,5 @@ $(top_builddir)/stdair/core/libstdair.la \ $(top_builddir)/airsched/core/libairsched.la \ $(top_builddir)/simcrs/core/libsimcrs.la \ + $(top_builddir)/trademgen/core/libtrademgen.la \ -version-info $(GENERIC_LIBRARY_VERSION) Modified: trunk/dsim/dsim/service/DSIM_Service.cpp =================================================================== --- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-02-03 16:28:56 UTC (rev 60) @@ -15,6 +15,9 @@ #include <stdair/STDAIR_Service.hpp> // Distribution #include <simcrs/SIMCRS_Service.hpp> +// TRADEMGEN +#include <trademgen/TRADEMGEN_Service.hpp> +#include <trademgen/DBParams.hpp> // Dsim #include <dsim/basic/BasConst_DSIM_Service.hpp> #include <dsim/command/Simulator.hpp> @@ -136,6 +139,16 @@ lCRSCode, iScheduleInputFilename)); lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service); + + // TODO: do not hardcode the DBParams. + // Initialise the TRADEMGEN service handler + const TRADEMGEN::DBParams lDBParams = + TRADEMGEN::DBParams ("anguyen", "anguyen", "ncemysqlp.nce.amadeus.net", + "3321", "sim_anguyen"); + TRADEMGEN_ServicePtr_T lTRADEMGEN_Service = + TRADEMGEN_ServicePtr_T (new TRADEMGEN::TRADEMGEN_Service (lDBParams)); + lDSIM_ServiceContext.setTRADEMGEN_Service (lTRADEMGEN_Service); + } // ////////////////////////////////////////////////////////////////////// @@ -157,11 +170,14 @@ // Get a reference on the SIMCRS service handler SIMCRS::SIMCRS_Service& lSIMCRS_Service = lDSIM_ServiceContext.getSIMCRS_Service(); + // Get a reference on the TRADEMGEN service handler + TRADEMGEN::TRADEMGEN_Service& lTRADEMGEN_Service = + lDSIM_ServiceContext.getTRADEMGEN_Service(); // Delegate the booking to the dedicated command stdair::BasChronometer lSimulationChronometer; lSimulationChronometer.start(); - Simulator::simulate (lSIMCRS_Service); + Simulator::simulate (lSIMCRS_Service, lTRADEMGEN_Service); const double lSimulationMeasure = lSimulationChronometer.elapsed(); // DEBUG Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp =================================================================== --- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-02-03 14:57:56 UTC (rev 59) +++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-02-03 16:28:56 UTC (rev 60) @@ -18,11 +18,17 @@ namespace SIMCRS { class SIMCRS_Service; } +namespace TRADEMGEN { + class TRADEMGEN_Service; +} /** Pointer on the SIMCRS Service handler. */ typedef boost::shared_ptr<SIMCRS::SIMCRS_Service> SIMCRS_ServicePtr_T; +/** Pointer on the TRADEMGEN Service handler. */ +typedef boost::shared_ptr<TRADEMGEN::TRADEMGEN_Service> TRADEMGEN_ServicePtr_T; + namespace DSIM { /** Class holding the context of the Dsim services. */ @@ -50,6 +56,11 @@ return *_simcrsService.get(); } + /** Get a reference on the TRADEMGEN service handler. */ + TRADEMGEN::TRADEMGEN_Service& getTRADEMGEN_Service () const { + return *_trademgenService.get(); + } + // ///////// Setters ////////// /** Set the simulator ID. */ void setSimulatorID (const SimulatorID_T& iSimulatorID) { @@ -71,6 +82,11 @@ _simcrsService = ioSIMCRS_ServicePtr; } + /** Set the pointer on the TRADEMGEN service handler. */ + void setTRADEMGEN_Service (TRADEMGEN_ServicePtr_T ioTRADEMGEN_ServicePtr) { + _trademgenService = ioTRADEMGEN_ServicePtr; + } + // ///////// Display Methods ////////// /** Display the short DSIM_ServiceContext content. */ const std::string shortDisplay() const; @@ -92,6 +108,8 @@ // ///////////// Children //////////// /** CRS Service Handler. */ SIMCRS_ServicePtr_T _simcrsService; + /** TRADEMGEN Service Handler. */ + TRADEMGEN_ServicePtr_T _trademgenService; private: // //////////// Attributes ////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |