Go to the documentation of this file.00001
00002
00003
00004
00005 #include <cassert>
00006 #include <sstream>
00007
00008 #include <stdair/bom/BomKeyManager.hpp>
00009 #include <stdair/bom/BookingClassKey.hpp>
00010 #include <stdair/bom/BookingRequestStruct.hpp>
00011 #include <stdair/bom/TravelSolutionStruct.hpp>
00012 #include <stdair/bom/FareOptionStruct.hpp>
00013 #include <stdair/service/Logger.hpp>
00014
00015 #include <travelccm/bom/PriceOrientedModel.hpp>
00016
00017 namespace TRAVELCCM {
00018
00019
00020 const stdair::TravelSolutionStruct* PriceOrientedModel::
00021 chooseTravelSolution (stdair::TravelSolutionList_T& ioTSList,
00022 const stdair::BookingRequestStruct& iBookingRequest) {
00023 stdair::TravelSolutionStruct* oChosenTS_ptr = NULL;
00024
00025
00026 const stdair::NbOfSeats_T& lPartySize = iBookingRequest.getPartySize();
00027
00028
00029 const stdair::WTP_T& lWTP = iBookingRequest.getWTP();
00030
00031
00032 stdair::Fare_T lLowestFare = std::numeric_limits<stdair::Fare_T>::max();
00033 for (stdair::TravelSolutionList_T::iterator itTS = ioTSList.begin();
00034 itTS != ioTSList.end(); ++itTS) {
00035 stdair::TravelSolutionStruct& lTS = *itTS;
00036
00037
00038 const stdair::FareOptionList_T& lFOList = lTS.getFareOptionList();
00039 for (stdair::FareOptionList_T::const_iterator itFO = lFOList.begin();
00040 itFO != lFOList.end(); ++itFO) {
00041 const stdair::FareOptionStruct& lFO = *itFO;
00042
00043
00044
00045 const stdair::Fare_T& lFOFare = lFO.getFare();
00046 const stdair::Availability_T& lFOAvl = lFO.getAvailability();
00047
00048 if (lFOFare < lLowestFare && lFOFare <= lWTP && lFOAvl >= lPartySize) {
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 lLowestFare = lFOFare;
00062 oChosenTS_ptr = &lTS;
00063 oChosenTS_ptr->setChosenFareOption (lFO);
00064
00065 } else {
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 }
00077 }
00078 }
00079
00080 return oChosenTS_ptr;
00081 }
00082
00083 }