$treeview $search $mathjax
TravelCCM Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

ChoiceManager.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 // StdAir
00007 #include <stdair/bom/TravelSolutionStruct.hpp>
00008 #include <stdair/bom/BookingRequestStruct.hpp>
00009 // TravelCCM
00010 #include <travelccm/bom/HybridModel.hpp>
00011 #include <travelccm/bom/HardRestrictionModel.hpp>
00012 #include <travelccm/bom/PriceOrientedModel.hpp>
00013 #include <travelccm/command/ChoiceManager.hpp>
00014 
00015 namespace TRAVELCCM {
00016 
00017   // ////////////////////////////////////////////////////////////////////
00018   const stdair::TravelSolutionStruct* ChoiceManager::
00019   chooseTravelSolution (stdair::TravelSolutionList_T& ioTravelSolutionList,
00020                         const stdair::BookingRequestStruct& iBookingRequest,
00021                         const stdair::PassengerChoiceModel::EN_PassengerChoiceModel& iPassengerChoiceModel) {
00022 
00023     const stdair::TravelSolutionStruct* oTravelSolution_ptr = NULL;
00024 
00025     switch (iPassengerChoiceModel) {
00026     case stdair::PassengerChoiceModel::HYBRID:
00027 
00028       // Return the cheapest solution which minimises the fare plus the
00029       // disutility for each unsatisfied restriction.
00030       oTravelSolution_ptr = 
00031        HybridModel::chooseTravelSolution (ioTravelSolutionList,
00032                                           iBookingRequest);
00033       break;
00034       
00035     case stdair::PassengerChoiceModel::HARD_RESTRICTION:
00036 
00037       // Return the cheapest solution which satisfies the hard restrictions
00038       // such as change fees and non refundable.
00039       oTravelSolution_ptr = 
00040         HardRestrictionModel::chooseTravelSolution (ioTravelSolutionList,
00041                                                     iBookingRequest);
00042       break;
00043     case stdair::PassengerChoiceModel::PRICE_ORIENTED:
00044       
00045       // Return the cheapest solution
00046       oTravelSolution_ptr = 
00047         PriceOrientedModel::chooseTravelSolution (ioTravelSolutionList,
00048                                                   iBookingRequest);
00049       break;
00050     default:
00051       assert(false);
00052       break;
00053     }
00054     return oTravelSolution_ptr;
00055   }
00056 
00057 }