$treeview $search $mathjax
AirInv Logo  1.00.0
$projectbrief
$projectbrief
$searchbox

SegmentCabinHelper.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 #include <limits>
00008 // StdAir
00009 #include <stdair/basic/BasConst_Inventory.hpp>
00010 #include <stdair/basic/float_utils.hpp>
00011 #include <stdair/bom/BomManager.hpp>
00012 #include <stdair/bom/FlightDate.hpp>
00013 #include <stdair/bom/LegCabin.hpp>
00014 #include <stdair/bom/SegmentCabin.hpp>
00015 #include <stdair/bom/FareFamily.hpp>
00016 #include <stdair/bom/BookingClass.hpp>
00017 #include <stdair/bom/SimpleNestingStructure.hpp>
00018 #include <stdair/bom/NestingNode.hpp>
00019 #include <stdair/bom/Policy.hpp>
00020 #include <stdair/factory/FacBomManager.hpp>
00021 // AirInv
00022 #include <airinv/bom/SegmentCabinHelper.hpp>
00023 #include <airinv/bom/FlightDateHelper.hpp>
00024 
00025 namespace AIRINV {
00026 
00027   // ////////////////////////////////////////////////////////////////////
00028   void SegmentCabinHelper::initialiseAU (stdair::SegmentCabin& iSegmentCabin) {
00029 
00030     // Initialise the capacity and availability pool.
00031     const stdair::LegCabinList_T& lLCList =
00032       stdair::BomManager::getList<stdair::LegCabin> (iSegmentCabin);
00033 
00034     stdair::CabinCapacity_T lCapacity =
00035       std::numeric_limits<stdair::CabinCapacity_T>::max();
00036     for (stdair::LegCabinList_T::const_iterator itLC = lLCList.begin();
00037          itLC != lLCList.end(); ++itLC) {
00038 
00039       const stdair::LegCabin* lLC_ptr = *itLC;
00040       assert (lLC_ptr != NULL);
00041 
00042       const stdair::CabinCapacity_T& lCabinCap = lLC_ptr->getOfferedCapacity();
00043       if (lCapacity > lCabinCap) {
00044         lCapacity = lCabinCap;
00045       }
00046     }
00047     iSegmentCabin.setCapacity (lCapacity);
00048     iSegmentCabin.setAvailabilityPool (lCapacity);
00049     
00050     // Browse the list of booking classes and set the AU of each booking
00051     // class to the availability pool of the cabin.
00052     const stdair::BookingClassList_T& lBCList =
00053       stdair::BomManager::getList<stdair::BookingClass> (iSegmentCabin);
00054     for (stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
00055          itBC != lBCList.end(); ++itBC) {
00056       stdair::BookingClass* lBC_ptr = *itBC;
00057       assert (lBC_ptr != NULL);
00058       lBC_ptr->setAuthorizationLevel (lCapacity);
00059     }
00060   }
00061   
00062   // ////////////////////////////////////////////////////////////////////
00063   void SegmentCabinHelper::
00064   updateFromReservation (const stdair::FlightDate& iFlightDate,
00065                          stdair::SegmentCabin& ioSegmentCabin,
00066                          const stdair::PartySize_T& iNbOfBookings){
00067     // Update the commited space of the segment-cabin.
00068     ioSegmentCabin.updateFromReservation (iNbOfBookings);
00069 
00070     // Update the availability of the flight-date.
00071     FlightDateHelper::updateAvailability (iFlightDate, ioSegmentCabin,
00072                                           iNbOfBookings);
00073   }
00074 
00075   // ////////////////////////////////////////////////////////////////////
00076   void SegmentCabinHelper::
00077   buildPseudoBidPriceVector (stdair::SegmentCabin& ioSegmentCabin) {
00078     // Retrieve the segment-cabin capacity.
00079     const stdair::Availability_T& lAvlPool =
00080       ioSegmentCabin.getAvailabilityPool();
00081     unsigned int lAvlPoolInt;
00082     if (lAvlPool < 0) {
00083       lAvlPoolInt = 0;
00084     } else {
00085       assert (lAvlPool >= 0);
00086       lAvlPoolInt = static_cast<unsigned int> (lAvlPool);
00087     }
00088     stdair::BidPriceVector_T lPseudoBidPriceVector (lAvlPoolInt, 0.0);
00089 
00090     // Browse the leg-cabin list.
00091     const stdair::LegCabinList_T& lLCList =
00092       stdair::BomManager::getList<stdair::LegCabin> (ioSegmentCabin);
00093     for (stdair::LegCabinList_T::const_iterator itLC = lLCList.begin();
00094          itLC != lLCList.end(); ++itLC) {
00095       const stdair::LegCabin* lLC_ptr = *itLC;
00096       assert (lLC_ptr != NULL);
00097 
00098       const stdair::BidPriceVector_T& lBPV = lLC_ptr->getBidPriceVector();
00099       stdair::BidPriceVector_T::const_reverse_iterator itBP = lBPV.rbegin();
00100       for (stdair::BidPriceVector_T::reverse_iterator itPBP =
00101              lPseudoBidPriceVector.rbegin();
00102            itPBP != lPseudoBidPriceVector.rend(); ++itPBP, ++itBP) {
00103         assert (itBP != lBPV.rend());
00104         stdair::BidPrice_T& lCurrentPBP = *itPBP;
00105         const stdair::BidPrice_T& lCurrentBP = *itBP;
00106         lCurrentPBP += lCurrentBP;
00107       }
00108     }
00109 
00110     ioSegmentCabin.setBidPriceVector (lPseudoBidPriceVector);
00111     
00112     // // DEBUG
00113     // std::ostringstream oStr;
00114     // oStr << "Pseudo BPV: ";
00115     // for (stdair::BidPriceVector_T::const_iterator itBP =
00116     //       lPseudoBidPriceVector.begin(); itBP != lPseudoBidPriceVector.end();
00117     //      ++itBP) {
00118     //   const stdair::BidPrice_T& lCurrentBP = *itBP;      
00119     //   oStr << lCurrentBP << " ";
00120     // }
00121     // oStr << std::endl;
00122     // // STDAIR_LOG_DEBUG (oStr.str());
00123     // std::cout << oStr.str() << std::endl;
00124   }
00125 
00126   // ////////////////////////////////////////////////////////////////////
00127   void SegmentCabinHelper::
00128   updateBookingControlsUsingPseudoBidPriceVector (const stdair::SegmentCabin& iSegmentCabin) {
00129     // Retrieve the pseudo bid price vector.
00130     const stdair::BidPriceVector_T& lPseudoBPV =
00131       iSegmentCabin.getBidPriceVector();
00132     const stdair::Availability_T& lAvlPool= iSegmentCabin.getAvailabilityPool();
00133 
00134     // Update the cumulative booking limit for all booking classes.
00135     // Browse the nesting structure
00136     const stdair::SimpleNestingStructure& lYieldBasedNestingStructure = 
00137       stdair::BomManager::getObject<stdair::SimpleNestingStructure>(iSegmentCabin, stdair::YIELD_BASED_NESTING_STRUCTURE_CODE);
00138     const stdair::NestingNodeList_T& lNestingNodeList = 
00139       stdair::BomManager::getList<stdair::NestingNode>(lYieldBasedNestingStructure);
00140     for (stdair::NestingNodeList_T::const_iterator itNS =
00141            lNestingNodeList.begin();
00142          itNS != lNestingNodeList.end(); ++itNS) {
00143       stdair::NestingNode* lNestingNode_ptr = *itNS;
00144       assert (lNestingNode_ptr != NULL);
00145       const stdair::Yield_T lNodeYield = 
00146         lNestingNode_ptr->getYield();
00147       if (lNodeYield < 0) {
00148         continue;
00149       }
00150       const stdair::BookingClassList_T& lBCList =
00151         stdair::BomManager::getList<stdair::BookingClass> (*lNestingNode_ptr);
00152       stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
00153       assert(itBC != lBCList.end());
00154       // Browse the booking class list of the current node   
00155       const stdair::Yield_T& lYield = lNestingNode_ptr->getYield();
00156       const FloatingPoint<double> lYieldFlotingPoint (lYield);
00157       stdair::BookingLimit_T lCumuBL = lAvlPool;
00158       for (stdair::BidPriceVector_T::const_reverse_iterator itBP =
00159            lPseudoBPV.rbegin(); itBP != lPseudoBPV.rend(); ++itBP) {
00160         const stdair::BidPrice_T& lBP = *itBP;
00161         const FloatingPoint<double> lBPFlotingPoint (lBP);
00162         const bool isAlmostEqual = 
00163           lYieldFlotingPoint.AlmostEquals(lBPFlotingPoint);
00164 
00165         if ((lYield < lBP) && (isAlmostEqual == false)) {
00166           lCumuBL = itBP - lPseudoBPV.rbegin();
00167           break;
00168         }
00169       }
00170       for (; itBC != lBCList.end(); ++itBC) {
00171         stdair::BookingClass* lBC_ptr = *itBC;
00172         assert (lBC_ptr != NULL);
00173         lBC_ptr->setCumulatedBookingLimit (lCumuBL);
00174         // DEBUG
00175         // STDAIR_LOG_DEBUG("Updating the BL for class: "
00176         //                  << lBC_ptr->describeKey()
00177         //                  << ", with yield " << lNodeYield
00178         //                  << " and BL: " << lCumuBL);
00179       }
00180     }
00181     // Update the authorization levels from the booking limits
00182     updateAUs (iSegmentCabin);
00183   }
00184 
00185   // ////////////////////////////////////////////////////////////////////
00186   void SegmentCabinHelper::updateAUs(const stdair::SegmentCabin& iSegmentCabin){
00187     // Browse the nesting structure and compute the AU from the
00188     // cumulative booking counter and the cumulative booking limit.
00189     stdair::NbOfBookings_T lCumulativeBookingCounter = 0.0;
00190     // Browse the nesting structure
00191     const stdair::SimpleNestingStructure& lYieldBasedNestingStructure = 
00192       stdair::BomManager::getObject<stdair::SimpleNestingStructure>(iSegmentCabin, stdair::YIELD_BASED_NESTING_STRUCTURE_CODE);
00193     const stdair::NestingNodeList_T& lNestingNodeList = 
00194       stdair::BomManager::getList<stdair::NestingNode>(lYieldBasedNestingStructure);
00195     for (stdair::NestingNodeList_T::const_reverse_iterator itNS =
00196            lNestingNodeList.rbegin();
00197          itNS != lNestingNodeList.rend(); ++itNS) {
00198       stdair::NestingNode* lNestingNode_ptr = *itNS;
00199       assert (lNestingNode_ptr != NULL);
00200       const stdair::Yield_T lNodeYield = 
00201         lNestingNode_ptr->getYield();
00202       if (lNodeYield < 0) {
00203         continue;
00204       } 
00205       const stdair::BookingClassList_T& lBCList =
00206         stdair::BomManager::getList<stdair::BookingClass> (*lNestingNode_ptr);
00207       stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
00208       assert(itBC != lBCList.end());
00209       const stdair::BookingLimit_T& lCumuBookingLimit =
00210         (*itBC)->getCumulatedBookingLimit();
00211       // Browse the booking class list of the current node to update the 
00212       // cumulative booking counter
00213       for (; itBC != lBCList.end(); ++itBC) {
00214         stdair::BookingClass* lBC_ptr = *itBC;
00215         assert (lBC_ptr != NULL);
00216         assert(lCumuBookingLimit == lBC_ptr->getCumulatedBookingLimit());
00217         const stdair::NbOfBookings_T& lNbOfBookings = lBC_ptr->getNbOfBookings();
00218         lCumulativeBookingCounter += lNbOfBookings;
00219       }
00220       stdair::AuthorizationLevel_T lAU =
00221           lCumulativeBookingCounter + lCumuBookingLimit;
00222       // Browse the booking class list of the current node to set
00223       // the authorization level of all booking classes of the node
00224       for (itBC = lBCList.begin(); itBC != lBCList.end(); ++itBC) {
00225         stdair::BookingClass* lBC_ptr = *itBC;
00226         assert (lBC_ptr != NULL);
00227         lBC_ptr->setAuthorizationLevel (lAU);
00228         // DEBUG
00229         // STDAIR_LOG_DEBUG ("Updating the AU for class: "
00230         //                   << lBC_ptr->describeKey()
00231         //                   << ", with BL: " << lCumuBookingLimit
00232         //                   << ", CumuBkg: " << lCumulativeBookingCounter
00233         //                   << ", AU: " << lAU);
00234       }
00235     }
00236   }
00237 
00238   // ////////////////////////////////////////////////////////////////////
00239   void SegmentCabinHelper::
00240   updateAvailabilities (const stdair::SegmentCabin& iSegmentCabin) {
00241     // Browse the nesting structure and compute the avl from the
00242     // cumulative booking counter and the AU.
00243     stdair::NbOfBookings_T lCumulativeBookingCounter = 0.0;
00244     const stdair::SimpleNestingStructure& lYieldBasedNestingStructure = 
00245       stdair::BomManager::getObject<stdair::SimpleNestingStructure>(iSegmentCabin, stdair::YIELD_BASED_NESTING_STRUCTURE_CODE);
00246     const stdair::NestingNodeList_T& lNestingNodeList = 
00247       stdair::BomManager::getList<stdair::NestingNode>(lYieldBasedNestingStructure);
00248     for (stdair::NestingNodeList_T::const_reverse_iterator itNS =
00249            lNestingNodeList.rbegin();
00250          itNS != lNestingNodeList.rend(); ++itNS) {
00251       stdair::NestingNode* lNestingNode_ptr = *itNS;
00252       assert (lNestingNode_ptr != NULL);
00253       const stdair::Yield_T& lNodeYield = lNestingNode_ptr->getYield();
00254       if (lNodeYield < 0) {
00255         continue;
00256       }
00257       const stdair::BookingClassList_T& lBCList =
00258         stdair::BomManager::getList<stdair::BookingClass> (*lNestingNode_ptr);
00259       stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
00260       assert(itBC != lBCList.end());
00261       stdair::BookingClass* lFirstBC_ptr = *itBC;
00262       assert (lFirstBC_ptr != NULL);
00263       const stdair::AuthorizationLevel_T& lNodeAU =
00264         lFirstBC_ptr->getAuthorizationLevel();
00265       // Browse the booking class list of the current node to update the 
00266       // cumulative booking counter
00267       for (; itBC != lBCList.end(); ++itBC) {
00268         stdair::BookingClass* lBC_ptr = *itBC;
00269         assert (lBC_ptr != NULL);
00270         assert(lNodeAU == lBC_ptr->getAuthorizationLevel());
00271         const stdair::NbOfBookings_T& lNbOfBookings = lBC_ptr->getNbOfBookings();
00272         lCumulativeBookingCounter += lNbOfBookings;
00273       }
00274       const stdair::Availability_T lNodeAvl = lNodeAU - lCumulativeBookingCounter;
00275       // Browse the booking class list of the current node to set
00276       // the availability of all booking classes of the node
00277       for (itBC = lBCList.begin(); itBC != lBCList.end(); ++itBC) {
00278         stdair::BookingClass* lBC_ptr = *itBC;
00279         assert (lBC_ptr != NULL);    
00280         lBC_ptr->setSegmentAvailability (lNodeAvl);
00281       }
00282     }
00283 
00284     // Cascading
00285     stdair::NestingNodeList_T::const_iterator itCurrentNode = 
00286       lNestingNodeList.begin();
00287     assert (itCurrentNode != lNestingNodeList.end());
00288     stdair::NestingNodeList_T::const_iterator itNextNode = itCurrentNode; 
00289     ++itNextNode;
00290     for (; itNextNode != lNestingNodeList.end(); ++itCurrentNode, ++itNextNode) {
00291       assert(itCurrentNode != lNestingNodeList.end());
00292       stdair::NestingNode* lCurrentNode_ptr = *itCurrentNode;
00293       assert (lCurrentNode_ptr != NULL);
00294       const stdair::Yield_T& lCurrentNodeYield = lCurrentNode_ptr->getYield();
00295       if (lCurrentNodeYield < 0) {
00296         break;
00297       }
00298       const stdair::BookingClassList_T& lCurrentBCList = 
00299         stdair::BomManager::getList<stdair::BookingClass> (*lCurrentNode_ptr);
00300       stdair::BookingClassList_T::const_iterator itCurrentBC = 
00301         lCurrentBCList.begin();
00302       stdair::BookingClass* lCurrentBC_ptr = *(itCurrentBC);
00303       assert (lCurrentBC_ptr != NULL);
00304       assert(itNextNode != lNestingNodeList.end());
00305       stdair::NestingNode* lNextNode_ptr = *itNextNode;
00306       assert (lNextNode_ptr != NULL);
00307       const stdair::Yield_T& lNextNodeYield = lNextNode_ptr->getYield();
00308       if (lNextNodeYield < 0) {
00309         break;
00310       }
00311       const stdair::BookingClassList_T& lNextBCList = 
00312         stdair::BomManager::getList<stdair::BookingClass> (*lNextNode_ptr);
00313       stdair::BookingClassList_T::const_iterator itNextBC = 
00314         lNextBCList.begin();
00315       stdair::BookingClass* lNextBC_ptr = *(itNextBC);
00316       assert (lNextBC_ptr != NULL);
00317       const stdair::Availability_T& lCurrentAvl = 
00318         lCurrentBC_ptr->getSegmentAvailability();
00319       const stdair::Availability_T& lNextAvl = 
00320         lNextBC_ptr->getSegmentAvailability();
00321       if (lCurrentAvl < lNextAvl) {
00322         for (; itNextBC != lNextBCList.end(); ++itNextBC) {
00323           lNextBC_ptr = *itNextBC;
00324           assert (lNextBC_ptr != NULL);
00325           lNextBC_ptr->setSegmentAvailability (lCurrentAvl);
00326         }
00327       }
00328     }
00329   }
00330 
00331   // ////////////////////////////////////////////////////////////////////
00332   void SegmentCabinHelper::
00333   initYieldBasedNestingStructure (stdair::SegmentCabin& ioSegmentCabin) {
00334     // Create the nesting structure.
00335     stdair::NestingStructureKey lKey (stdair::YIELD_BASED_NESTING_STRUCTURE_CODE);
00336     stdair::SimpleNestingStructure& lNestingStructure =
00337       stdair::FacBom<stdair::SimpleNestingStructure>::instance().create(lKey);
00338     stdair::FacBomManager::addToListAndMap (ioSegmentCabin, lNestingStructure);
00339     stdair::FacBomManager::linkWithParent (ioSegmentCabin, lNestingStructure);
00340     
00341     // Build a multimap of booking classes with their yields as keys.
00342     std::multimap<const stdair::Yield_T, stdair::BookingClass*> lClassMap;
00343     const stdair::BookingClassList_T& lBCList =
00344       stdair::BomManager::getList<stdair::BookingClass> (ioSegmentCabin);
00345     for (stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
00346          itBC != lBCList.end(); ++itBC) {
00347       stdair::BookingClass* lBC_ptr = *itBC;
00348       assert (lBC_ptr != NULL);
00349       const stdair::Yield_T& lYield = lBC_ptr->getYield();
00350       lClassMap.insert(std::multimap<const stdair::Yield_T, stdair::BookingClass*>::value_type(lYield, lBC_ptr));
00351     }
00352 
00353     stdair::Yield_T lLastYield = -1.0;
00354     stdair::NestingNode* lCurrentNode_ptr = NULL;
00355     for (std::multimap<const stdair::Yield_T, stdair::BookingClass*>::reverse_iterator itBC = lClassMap.rbegin();
00356          itBC != lClassMap.rend(); ++itBC) {
00357       const stdair::Yield_T& lCurrentYield = itBC->first;
00358       stdair::BookingClass* lBC_ptr = itBC->second;
00359       
00360       // Compare the current yield and the last one.
00361       // TODO: use float utils
00362       //if (lCurrentYield.AlmostEquals (lLastYield) == false) {
00363       if (lCurrentYield != lLastYield) {
00364         // Create a nesting node
00365         stdair::NestingNodeCode_T lNodeCode (lBC_ptr->describeKey());
00366         stdair::NestingNodeKey lNodeKey (lNodeCode);
00367         stdair::NestingNode& lNestingNode =
00368           stdair::FacBom<stdair::NestingNode>::instance().create (lNodeKey);
00369         stdair::FacBomManager::addToList (lNestingStructure, lNestingNode);
00370         stdair::FacBomManager::linkWithParent (lNestingStructure, lNestingNode);
00371         lCurrentNode_ptr = &lNestingNode;
00372         lCurrentNode_ptr->setYield(lCurrentYield);
00373         // Add the booking class to the node.
00374         stdair::FacBomManager::addToList (lNestingNode, *lBC_ptr);
00375         lLastYield = lCurrentYield;
00376       } else {        
00377         // Add the booking class to the current node.
00378         stdair::FacBomManager::addToList (*lCurrentNode_ptr, *lBC_ptr);      
00379       }
00380     }
00381   }
00382 
00383   // ////////////////////////////////////////////////////////////////////
00384   void SegmentCabinHelper::
00385   initListOfUsablePolicies (stdair::SegmentCabin& ioSegmentCabin) {
00386     const stdair::FareFamilyList_T& lFareFamilyList =
00387       stdair::BomManager::getList<stdair::FareFamily> (ioSegmentCabin);
00388     stdair::FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
00389     
00390     unsigned int lPolicyCounter = 0;
00391     std::ostringstream oStr;
00392     oStr << lPolicyCounter;
00393     stdair::PolicyKey lKey (oStr.str());
00394     stdair::Policy& lPolicy =
00395       stdair::FacBom<stdair::Policy>::instance().create(lKey);
00396     stdair::FacBomManager::addToList (ioSegmentCabin, lPolicy);
00397     stdair::FacBomManager::linkWithParent (ioSegmentCabin, lPolicy);
00398     createPolicies (ioSegmentCabin, lFareFamilyList, itFF, lPolicy,
00399                     lPolicyCounter,
00400                     std::numeric_limits<stdair::Yield_T>::max());
00401   }
00402 
00403   // ////////////////////////////////////////////////////////////////////
00404   void SegmentCabinHelper::
00405   createPolicies (stdair::SegmentCabin& ioSegmentCabin,
00406                   const stdair::FareFamilyList_T& iFareFamilyList,
00407                   const stdair::FareFamilyList_T::const_iterator& itFF,
00408                   stdair::Policy& ioCurrentPolicy,
00409                   unsigned int& ioPolicyCounter,
00410                   const stdair::Yield_T& iPreviousYield) {
00411     if (itFF != iFareFamilyList.end()) {
00412       // We add a booking class of the next Fare Family if it is cheapest than 
00413       // the previous booking class in the policy. 
00414       // Assumption: the fare family list is sorted according to their fares:
00415       // Fare_1 > Fare_2 > ... > Fare_n
00416       const stdair::FareFamily* lFF_ptr = *itFF;
00417       //Retrieve the booking class list of the current fare family
00418       const stdair::BookingClassList_T& lBookingClassList =
00419         stdair::BomManager::getList<stdair::BookingClass> (*lFF_ptr);
00420       stdair::BookingClassList_T::const_iterator itBC =
00421         lBookingClassList.begin();
00422       stdair::FareFamilyList_T::const_iterator lItFF = itFF;
00423       lItFF++;
00424       
00425       // Browse the booking class list
00426       for (; itBC != lBookingClassList.end(); ++itBC) {
00427         stdair::BookingClass* lBC_ptr = *itBC;
00428         assert(lBC_ptr != NULL);
00429         const stdair::Yield_T& lCurrentYield = lBC_ptr->getYield();
00430         if (lCurrentYield >= iPreviousYield) {
00431           continue;
00432         }
00433         assert(lCurrentYield < iPreviousYield);
00434         // Add the current booking class to the list, update the current policy
00435         // and call the same method for the next fare family
00436         ++ioPolicyCounter;
00437         std::ostringstream oStr;
00438         oStr << ioPolicyCounter;
00439         stdair::PolicyKey lKey (oStr.str());
00440         stdair::Policy& lNewPolicy =
00441           stdair::FacBom<stdair::Policy>::instance().create(lKey);
00442         stdair::FacBomManager::addToList (ioSegmentCabin, lNewPolicy);
00443         stdair::FacBomManager::linkWithParent (ioSegmentCabin, lNewPolicy);
00444 
00445         // Copy the list of booking classes of the current policy to the new one
00446         bool hasAListOfBC = 
00447           stdair::BomManager::hasList<stdair::BookingClass> (ioCurrentPolicy);
00448         if (hasAListOfBC == true) { 
00449           const stdair::BookingClassList_T& lToBeCopiedBCList =
00450             stdair::BomManager::getList<stdair::BookingClass> (ioCurrentPolicy);
00451           for (stdair::BookingClassList_T::const_iterator itBCToBeCopied =
00452                  lToBeCopiedBCList.begin();
00453                itBCToBeCopied != lToBeCopiedBCList.end(); ++itBCToBeCopied) {
00454             stdair::BookingClass* lBCToBeCopied_ptr = *itBCToBeCopied;
00455             assert (lBCToBeCopied_ptr != NULL);
00456             stdair::FacBomManager::addToList (lNewPolicy, *lBCToBeCopied_ptr);
00457           }
00458         }          
00459         stdair::FacBomManager::addToList(lNewPolicy, *lBC_ptr);
00460         
00461         createPolicies (ioSegmentCabin, iFareFamilyList, lItFF, lNewPolicy,
00462                         ioPolicyCounter, lCurrentYield);
00463       }
00464     }
00465 
00466   }
00467   
00468 }