|
From: <qua...@us...> - 2010-01-28 15:53:35
|
Revision: 55
http://dsim.svn.sourceforge.net/dsim/?rev=55&view=rev
Author: quannaus
Date: 2010-01-28 15:53:26 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
[Dev] Implementing the sale.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/command/Simulator.hpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-01-26 15:14:31 UTC (rev 54)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-01-28 15:53:26 UTC (rev 55)
@@ -8,10 +8,13 @@
#include <exception>
// StdAir
#include <stdair/STDAIR_Types.hpp>
+#include <stdair/bom/OutboundPathTypes.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
#include <stdair/service/Logger.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
+// Airsched
+#include <airsched/AIRSCHED_Service.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
#include <dsim/command/Simulator.hpp>
@@ -37,14 +40,14 @@
// Passenger type
stdair::PassengerType_T lPaxType ("L");
// Number of passengers in the travelling group
- stdair::PartySize_T lPartySize = 5;
+ stdair::NbOfSeats_T lPartySize = 5;
// Booking request
stdair::BookingRequestStruct lBookingRequest (lOrigin, lDestination,
lDepartureDate,
lPaxType, lPartySize);
// Play booking request
- playBookingRequest (lBookingRequest);
+ playBookingRequest (ioSIMCRS_Service, lBookingRequest);
// DEBUG
STDAIR_LOG_DEBUG ("The simulation has ended");
@@ -57,8 +60,23 @@
// ////////////////////////////////////////////////////////////////////
void Simulator::
- playBookingRequest (const stdair::BookingRequestStruct& iBookingRequest) {
-
+ playBookingRequest (SIMCRS::SIMCRS_Service& ioSIMCRS_Service,
+ const stdair::BookingRequestStruct& iBookingRequest) {
+ // Retrieve a list of travel solutions corresponding the given
+ // booking request.
+ stdair::OutboundPathLightList_T lOutboundPathList =
+ ioSIMCRS_Service.getTravelSolutions (iBookingRequest);
+
+ // Hardcode a travel solution choice.
+ if (lOutboundPathList.empty() == false) {
+ stdair::OutboundPath* lChosenTravelSolution_ptr = lOutboundPathList.at(0);
+
+ // Get the number of seats in the request.
+ const stdair::NbOfSeats_T& lNbOfSeats = iBookingRequest.getPartySize();
+
+ // Make a sale.
+ ioSIMCRS_Service.sell (*lChosenTravelSolution_ptr, lNbOfSeats);
+ }
}
}
Modified: trunk/dsim/dsim/command/Simulator.hpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.hpp 2010-01-26 15:14:31 UTC (rev 54)
+++ trunk/dsim/dsim/command/Simulator.hpp 2010-01-28 15:53:26 UTC (rev 55)
@@ -27,7 +27,8 @@
static void simulate (SIMCRS::SIMCRS_Service&);
/** Play a booking request event. */
- static void playBookingRequest (const stdair::BookingRequestStruct&);
+ static void playBookingRequest (SIMCRS::SIMCRS_Service&,
+ const stdair::BookingRequestStruct&);
private:
/** Constructors. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|