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

stdair/command/CmdBomManager.cpp

Go to the documentation of this file.
00001 
00005 // //////////////////////////////////////////////////////////////////////
00006 // Import section
00007 // //////////////////////////////////////////////////////////////////////
00008 // STL
00009 #include <cassert>
00010 #include <sstream>
00011 // StdAir
00012 #include <stdair/basic/BasConst_General.hpp>
00013 #include <stdair/basic/BasConst_DefaultObject.hpp>
00014 #include <stdair/basic/BasConst_Request.hpp>
00015 #include <stdair/basic/BasConst_Inventory.hpp>
00016 #include <stdair/bom/BomRetriever.hpp>
00017 #include <stdair/bom/BomRoot.hpp>
00018 #include <stdair/bom/Inventory.hpp>
00019 #include <stdair/bom/AirlineFeature.hpp>
00020 #include <stdair/bom/FlightDate.hpp>
00021 #include <stdair/bom/LegDate.hpp>
00022 #include <stdair/bom/LegCabin.hpp>
00023 #include <stdair/bom/SegmentDate.hpp>
00024 #include <stdair/bom/SegmentCabin.hpp>
00025 #include <stdair/bom/FareFamily.hpp>
00026 #include <stdair/bom/BookingClass.hpp>
00027 #include <stdair/bom/AirportPair.hpp>
00028 #include <stdair/bom/PosChannel.hpp>
00029 #include <stdair/bom/DatePeriod.hpp>
00030 #include <stdair/bom/TimePeriod.hpp>
00031 #include <stdair/bom/FareFeatures.hpp>
00032 #include <stdair/bom/YieldFeatures.hpp>
00033 #include <stdair/bom/AirlineClassList.hpp>
00034 #include <stdair/bom/BomManager.hpp>
00035 #include <stdair/bom/TravelSolutionStruct.hpp>
00036 #include <stdair/bom/BookingRequestStruct.hpp>
00037 #include <stdair/factory/FacBomManager.hpp>
00038 #include <stdair/factory/FacBom.hpp>
00039 #include <stdair/command/CmdBomManager.hpp>
00040 #include <stdair/service/Logger.hpp>
00041 #include <stdair/bom/OnDDate.hpp>
00042 #include <stdair/bom/SegmentPeriod.hpp>
00043 #include <stdair/bom/FlightPeriod.hpp>
00044 
00045 namespace stdair {
00046 
00047   // //////////////////////////////////////////////////////////////////////
00048   void CmdBomManager::buildSampleBom (BomRoot& ioBomRoot) {
00049 
00050     // DEBUG
00051     STDAIR_LOG_DEBUG ("StdAir is building the BOM tree from built-in "
00052                       << "specifications.");
00053 
00054     // ////// Basic Bom Tree ///////
00055     // Build the inventory (flight-dates) and the schedule (flight period) 
00056     // parts.
00057     buildSampleInventorySchedule (ioBomRoot);
00058 
00059     // Build the pricing (fare rules) and revenue accounting (yields) parts.
00060     buildSamplePricing (ioBomRoot);
00061 
00062     // ////// Partnership Bom Tree ///////    
00063     // Build the inventory (flight-dates) and the schedule (flight period) 
00064     // parts.
00065     buildPartnershipsSampleInventoryAndRM (ioBomRoot);
00066 
00067     // Build the pricing (fare rules) and revenue accounting (yields) parts.
00068     buildPartnershipsSamplePricing (ioBomRoot);
00069 
00070     // Build a dummy inventory, needed by RMOL.
00071     buildCompleteDummyInventory (ioBomRoot);
00072 
00073     // ////// Fare Families Bom Tree ///////
00074     // Build the inventory (flight-dates) and the schedule (flight period) 
00075     // parts with fare families.
00076     buildSampleInventoryScheduleForFareFamilies (ioBomRoot);
00077     
00078     // Build the pricing (fare rules) and revenue accounting (yields) parts.
00079     buildSamplePricingForFareFamilies (ioBomRoot);
00080 
00081     // Build a dummy inventory, needed by RMOL.
00082     buildCompleteDummyInventoryForFareFamilies (ioBomRoot);
00083   }
00084 
00085   // //////////////////////////////////////////////////////////////////////
00086   void CmdBomManager::buildSampleInventorySchedule (BomRoot& ioBomRoot) {
00087 
00088     // Inventory
00089     // Step 0.1: Inventory level
00090     // Create an Inventory for BA
00091     const AirlineCode_T lAirlineCodeBA ("BA");
00092     const InventoryKey lBAKey (lAirlineCodeBA);
00093     Inventory& lBAInv = FacBom<Inventory>::instance().create (lBAKey);
00094     FacBomManager::addToListAndMap (ioBomRoot, lBAInv);
00095     FacBomManager::linkWithParent (ioBomRoot, lBAInv);
00096 
00097     // Add the airline feature object to the BA inventory
00098     const AirlineFeatureKey lAirlineFeatureBAKey (lAirlineCodeBA);
00099     AirlineFeature& lAirlineFeatureBA =
00100       FacBom<AirlineFeature>::instance().create (lAirlineFeatureBAKey);
00101     FacBomManager::setAirlineFeature (lBAInv, lAirlineFeatureBA);
00102     FacBomManager::linkWithParent (lBAInv, lAirlineFeatureBA);
00103     // Link the airline feature object with the top of the BOM tree
00104     FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureBA);
00105     
00106     // Create an Inventory for AF
00107     const AirlineCode_T lAirlineCodeAF ("AF");
00108     const InventoryKey lAFKey (lAirlineCodeAF);
00109     Inventory& lAFInv = FacBom<Inventory>::instance().create (lAFKey);
00110     FacBomManager::addToListAndMap (ioBomRoot, lAFInv);
00111     FacBomManager::linkWithParent (ioBomRoot, lAFInv);
00112     
00113     // Add the airline feature object to the AF inventory
00114     const AirlineFeatureKey lAirlineFeatureAFKey (lAirlineCodeAF);
00115     AirlineFeature& lAirlineFeatureAF =
00116       FacBom<AirlineFeature>::instance().create (lAirlineFeatureAFKey);
00117     FacBomManager::setAirlineFeature (lAFInv, lAirlineFeatureAF);
00118     FacBomManager::linkWithParent (lAFInv, lAirlineFeatureAF);
00119     // Link the airline feature object with the top of the BOM tree
00120     FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureAF);
00121 
00122     // BA
00123     // Step 0.2: Flight-date level
00124     // Create a FlightDate (BA9/10-JUN-2011) for BA's Inventory
00125     FlightNumber_T lFlightNumber = 9;
00126     Date_T lDate (2011, 6, 10);
00127     FlightDateKey lFlightDateKey (lFlightNumber, lDate);
00128 
00129     FlightDate& lBA9_20110610_FD =
00130       FacBom<FlightDate>::instance().create (lFlightDateKey);
00131     FacBomManager::addToListAndMap (lBAInv, lBA9_20110610_FD);
00132     FacBomManager::linkWithParent (lBAInv, lBA9_20110610_FD);
00133     
00134     // Display the flight-date
00135     // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
00136     
00137     // Step 0.3: Segment-date level
00138     // Create a first SegmentDate (LHR-SYD) for BA's Inventory
00139     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=SYD&depDate=100611&SellingClass=O
00140     const AirportCode_T lLHR ("LHR");
00141     const AirportCode_T lSYD ("SYD");
00142     const DateOffset_T l1Day (1);
00143     const DateOffset_T l2Days (2);
00144     const Duration_T l2135 (21, 45, 0);
00145     const Duration_T l0610 (6, 10, 0);
00146     const Duration_T l2205 (22, 05, 0);
00147     SegmentDateKey lSegmentDateKey (lLHR, lSYD);
00148 
00149     SegmentDate& lLHRSYDSegment =
00150       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00151     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRSYDSegment);
00152     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRSYDSegment); 
00153 
00154     // Add the routing leg keys to the LHR-SYD segment.
00155     const std::string lBALHRRoutingLegStr = "BA;9;2011-Jun-10;LHR";
00156     const std::string lBABKKRoutingLegStr = "BA;9;2011-Jun-10;BKK";
00157     lLHRSYDSegment.addLegKey (lBALHRRoutingLegStr);
00158     lLHRSYDSegment.addLegKey (lBABKKRoutingLegStr);
00159 
00160     // Fill the SegmentDate content
00161     lLHRSYDSegment.setBoardingDate (lDate);
00162     lLHRSYDSegment.setOffDate (lDate + l2Days);
00163     lLHRSYDSegment.setBoardingTime (l2135);
00164     lLHRSYDSegment.setOffTime (l0610);
00165     lLHRSYDSegment.setElapsedTime (l2135);
00166   
00167     // Display the segment-date
00168     // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment);
00169 
00170     // Create a second SegmentDate (LHR-BKK) for BA's Inventory
00171     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=BKK&depDate=100611&SellingClass=O
00172     const AirportCode_T lBKK ("BKK");
00173     const Duration_T l1540 (15, 40, 0);
00174     const Duration_T l1105 (11, 5, 0);
00175     lSegmentDateKey = SegmentDateKey (lLHR, lBKK);
00176 
00177     SegmentDate& lLHRBKKSegment =
00178       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00179     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRBKKSegment);
00180     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRBKKSegment); 
00181 
00182     // Add the routing leg key to the LHR-BKK segment.
00183     lLHRBKKSegment.addLegKey (lBALHRRoutingLegStr);
00184 
00185     // Fill the SegmentDate content
00186     lLHRBKKSegment.setBoardingDate (lDate);
00187     lLHRBKKSegment.setOffDate (lDate + l1Day);
00188     lLHRBKKSegment.setBoardingTime (l2135);
00189     lLHRBKKSegment.setOffTime (l1540);
00190     lLHRBKKSegment.setElapsedTime (l1105);
00191   
00192     // Display the segment-date
00193     // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment);
00194 
00195     // Create a third SegmentDate (BKK-SYD) for BA's Inventory
00196     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=BKK&to=SYD&depDate=110611&SellingClass=O
00197     const Duration_T l1705 (17, 5, 0);
00198     const Duration_T l0905 (9, 5, 0);
00199     lSegmentDateKey = SegmentDateKey (lBKK, lSYD);
00200 
00201     SegmentDate& lBKKSYDSegment =
00202       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00203     FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKSYDSegment);
00204     FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKSYDSegment);
00205 
00206     // Add the routing leg key to the BKK-SYD segment.
00207     lBKKSYDSegment.addLegKey (lBABKKRoutingLegStr);
00208 
00209     // Fill the SegmentDate content
00210     lBKKSYDSegment.setBoardingDate (lDate + l1Day);
00211     lBKKSYDSegment.setOffDate (lDate + l2Days);
00212     lBKKSYDSegment.setBoardingTime (l1705);
00213     lBKKSYDSegment.setOffTime (l1540);
00214     lBKKSYDSegment.setElapsedTime (l0905);
00215   
00216     // Display the segment-date
00217     // STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment);
00218 
00219     // Step 0.4: Leg-date level
00220     // Create a first LegDate (LHR) for BA's Inventory
00221     LegDateKey lLegDateKey (lLHR);
00222 
00223     LegDate& lLHRLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00224     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRLeg);
00225     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRLeg);
00226 
00227     // Fill the LegDate content
00228     lLHRLeg.setOffPoint (lBKK);
00229     lLHRLeg.setBoardingDate (lDate);
00230     lLHRLeg.setOffDate (lDate + l1Day);
00231     lLHRLeg.setBoardingTime (l2135);
00232     lLHRLeg.setOffTime (l1540);
00233     lLHRLeg.setElapsedTime (l1105);
00234 
00235     // Display the leg-date
00236     // STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString());
00237     
00238     // Create a second LegDate (BKK)
00239     lLegDateKey = LegDateKey (lBKK);
00240 
00241     LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00242     FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKLeg);
00243     FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKLeg);
00244 
00245     // Display the leg-date
00246     // STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString());
00247 
00248     // Fill the LegDate content
00249     lBKKLeg.setOffPoint (lSYD);
00250     lBKKLeg.setBoardingDate (lDate + l1Day);
00251     lBKKLeg.setOffDate (lDate + l2Days);
00252     lBKKLeg.setBoardingTime (l1705);
00253     lBKKLeg.setOffTime (l1540);
00254     lBKKLeg.setElapsedTime (l0905);
00255 
00256     // Step 0.5: segment-cabin level
00257     // Create a SegmentCabin (Y) for the Segment LHR-BKK of BA's Inventory
00258     const CabinCode_T lY ("Y");
00259     SegmentCabinKey lYSegmentCabinKey (lY);
00260 
00261     SegmentCabin& lLHRBKKSegmentYCabin =
00262       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00263     FacBomManager::addToListAndMap (lLHRBKKSegment, lLHRBKKSegmentYCabin);
00264     FacBomManager::linkWithParent (lLHRBKKSegment, lLHRBKKSegmentYCabin);
00265 
00266     // Display the segment-cabin
00267     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString());
00268 
00269     // Create a SegmentCabin (Y) of the Segment BKK-SYD;
00270     SegmentCabin& lBKKSYDSegmentYCabin =
00271       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00272     FacBomManager::addToListAndMap (lBKKSYDSegment, lBKKSYDSegmentYCabin);
00273     FacBomManager::linkWithParent (lBKKSYDSegment, lBKKSYDSegmentYCabin);
00274 
00275      
00276     // Display the segment-cabin
00277     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString());
00278 
00279     // Create a SegmentCabin (Y) of the Segment LHR-SYD;
00280     SegmentCabin& lLHRSYDSegmentYCabin =
00281       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00282     FacBomManager::addToListAndMap (lLHRSYDSegment, lLHRSYDSegmentYCabin);
00283     FacBomManager::linkWithParent (lLHRSYDSegment, lLHRSYDSegmentYCabin);
00284       
00285     // Display the segment-cabin
00286     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString());
00287 
00288     // Step 0.6: leg-cabin level
00289     // Create a LegCabin (Y) for the Leg LHR-BKK on BA's Inventory
00290     LegCabinKey lYLegCabinKey (lY);
00291 
00292     LegCabin& lLHRLegYCabin =
00293       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00294     FacBomManager::addToListAndMap (lLHRLeg, lLHRLegYCabin);
00295     FacBomManager::linkWithParent (lLHRLeg, lLHRLegYCabin);
00296 
00297     // Display the leg-cabin
00298     // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
00299 
00300     // Create a LegCabin (Y) for the Leg BKK-SYD
00301     LegCabin& lBKKLegYCabin =
00302       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00303     FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
00304     FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
00305     // Display the leg-cabin
00306     // STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString());
00307 
00308     // Step 0.7: fare family level
00309     // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
00310     const FamilyCode_T l1 ("EcoSaver");
00311     FareFamilyKey l1FareFamilyKey (l1);
00312 
00313     FareFamily& lLHRBKKSegmentYCabin1Family =
00314       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00315     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
00316                                     lLHRBKKSegmentYCabin1Family);
00317     FacBomManager::linkWithParent (lLHRBKKSegmentYCabin,
00318                                    lLHRBKKSegmentYCabin1Family);
00319 
00320     // Display the booking class
00321     // STDAIR_LOG_DEBUG ("FareFamily: "
00322     //                   << lLHRBKKSegmentYCabin1Family.toString());
00323 
00324     // Create a FareFamily (1)  for the Segment BKK-SYD, cabin Y on BA's Inv
00325     FareFamily& lBKKSYDSegmentYCabin1Family =
00326       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00327     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
00328                                     lBKKSYDSegmentYCabin1Family);
00329     FacBomManager::linkWithParent (lBKKSYDSegmentYCabin,
00330                                    lBKKSYDSegmentYCabin1Family);
00331     
00332     // Display the booking class
00333     // STDAIR_LOG_DEBUG ("FareFamily: "
00334     //                   << lLHRBKKSegmentYCabin1Family.toString());
00335 
00336     // Create a FareFamily (1)  for the Segment LHR-SYD, cabin Y on BA's Inv
00337     FareFamily& lLHRSYDSegmentYCabin1Family =
00338       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00339     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
00340                                     lLHRSYDSegmentYCabin1Family);
00341     FacBomManager::linkWithParent (lLHRSYDSegmentYCabin,
00342                                    lLHRSYDSegmentYCabin1Family);
00343 
00344     // Display the booking class
00345     // STDAIR_LOG_DEBUG ("FareFamily: "
00346     //                   << lLHRBKKSegmentYCabin1Family.toString());
00347 
00348 
00349     // Step 0.8: booking class level
00350     // Create a BookingClass (Q) for the Segment LHR-BKK, cabin Y,
00351     // fare family 1 on BA's Inv
00352     const ClassCode_T lQ ("Q");
00353     BookingClassKey lQBookingClassKey (lQ);
00354 
00355     BookingClass& lLHRBKKSegmentYCabin1FamilyQClass =
00356       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00357     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin1Family,
00358                                     lLHRBKKSegmentYCabin1FamilyQClass);
00359     FacBomManager::linkWithParent (lLHRBKKSegmentYCabin1Family,
00360                                    lLHRBKKSegmentYCabin1FamilyQClass);
00361 
00362     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
00363                                     lLHRBKKSegmentYCabin1FamilyQClass);
00364     FacBomManager::addToListAndMap (lLHRBKKSegment,
00365                                     lLHRBKKSegmentYCabin1FamilyQClass);
00366 
00367     // Display the booking class
00368     // STDAIR_LOG_DEBUG ("BookingClass: "
00369     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00370 
00371     // Create a BookingClass (Q) for the Segment BKK-SYD, cabin Y,
00372     // fare family 1 on BA's Inv
00373     BookingClass& lBKKSYDSegmentYCabin1FamilyQClass =
00374       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00375     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin1Family,
00376                                     lBKKSYDSegmentYCabin1FamilyQClass);
00377     FacBomManager::linkWithParent (lBKKSYDSegmentYCabin1Family,
00378                                    lBKKSYDSegmentYCabin1FamilyQClass);
00379     
00380     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
00381                                     lBKKSYDSegmentYCabin1FamilyQClass);
00382     FacBomManager::addToListAndMap (lBKKSYDSegment,
00383                                     lBKKSYDSegmentYCabin1FamilyQClass);
00384 
00385     // Display the booking class
00386     // STDAIR_LOG_DEBUG ("BookingClass: "
00387     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00388 
00389     // Create a BookingClass (Q) for the Segment LHR-SYD, cabin Y,
00390     // fare family 1 on BA's Inv
00391     BookingClass& lLHRSYDSegmentYCabin1FamilyQClass =
00392       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00393     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin1Family,
00394                                     lLHRSYDSegmentYCabin1FamilyQClass);
00395     FacBomManager::linkWithParent (lLHRSYDSegmentYCabin1Family,
00396                                    lLHRSYDSegmentYCabin1FamilyQClass);
00397 
00398     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
00399                                     lLHRSYDSegmentYCabin1FamilyQClass);
00400     FacBomManager::addToListAndMap (lLHRSYDSegment,
00401                                     lLHRSYDSegmentYCabin1FamilyQClass);
00402 
00403     // Display the booking class
00404     // STDAIR_LOG_DEBUG ("BookingClass: "
00405     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00406 
00407     
00408     // ////// AF ///////    
00409     // Step 0.2: Flight-date level
00410     // Create a FlightDate (AF084/20-MAR-2011) for AF's Inventory
00411     lFlightNumber = 84;
00412     lDate = Date_T (2011, 3, 20);
00413     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
00414 
00415     FlightDate& lAF084_20110320_FD =
00416       FacBom<FlightDate>::instance().create (lFlightDateKey);
00417     FacBomManager::addToListAndMap (lAFInv, lAF084_20110320_FD);
00418     FacBomManager::linkWithParent (lAFInv, lAF084_20110320_FD);
00419     
00420     // Display the flight-date
00421     // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
00422 
00423     // Step 0.3: Segment-date level
00424     // Create a SegmentDate (CDG-SFO) for AF's Inventory
00425     const AirportCode_T lCDG ("CDG");
00426     const AirportCode_T lSFO ("SFO");
00427     const Duration_T l1040 (10, 40, 0);
00428     const Duration_T l1250 (12, 50, 0);
00429     const Duration_T l1110 (11, 10, 0);
00430     lSegmentDateKey = SegmentDateKey (lCDG, lSFO);
00431 
00432     SegmentDate& lCDGSFOSegment =
00433       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00434     FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGSFOSegment);
00435     FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGSFOSegment);  
00436 
00437     // Add the routing leg key to the CDG-SFO segment.
00438     const std::string lAFCDGRoutingLegStr = "AF;84;2011-Mar-20;CDG";
00439     lCDGSFOSegment.addLegKey (lAFCDGRoutingLegStr);
00440 
00441     // Display the segment-date
00442     // STDAIR_LOG_DEBUG ("SegmentDate: " << lCDGSFOSegment.toString());
00443 
00444     // Fill the SegmentDate content
00445     lCDGSFOSegment.setBoardingDate (lDate);
00446     lCDGSFOSegment.setOffDate (lDate);
00447     lCDGSFOSegment.setBoardingTime (l1040);
00448     lCDGSFOSegment.setOffTime (l1250);
00449     lCDGSFOSegment.setElapsedTime (l1110);
00450 
00451     // Step 0.4: Leg-date level
00452     // Create a LegDate (CDG) for AF's Inventory
00453     lLegDateKey = LegDateKey (lCDG);
00454 
00455     LegDate& lCDGLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00456     FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGLeg);
00457     FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGLeg);
00458 
00459     // Fill the LegDate content
00460     lCDGLeg.setOffPoint (lSFO);
00461     lCDGLeg.setBoardingDate (lDate);
00462     lCDGLeg.setOffDate (lDate);
00463     lCDGLeg.setBoardingTime (l1040);
00464     lCDGLeg.setOffTime (l1250);
00465     lCDGLeg.setElapsedTime (l1110);
00466 
00467     // Display the leg-date
00468     // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
00469 
00470     // Step 0.5: segment-cabin level
00471     // Create a SegmentCabin (Y) for the Segment CDG-SFO of AF's Inventory
00472     SegmentCabin& lCDGSFOSegmentYCabin =
00473       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00474     FacBomManager::addToListAndMap (lCDGSFOSegment, lCDGSFOSegmentYCabin);
00475     FacBomManager::linkWithParent (lCDGSFOSegment, lCDGSFOSegmentYCabin);
00476 
00477     // Display the segment-cabin
00478     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lCDGSFOSegmentYCabin.toString());
00479 
00480     // Step 0.6: leg-cabin level
00481     // Create a LegCabin (Y) for the Leg CDG-SFO on AF's Inventory
00482     LegCabin& lCDGLegYCabin =
00483       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00484     FacBomManager::addToListAndMap (lCDGLeg, lCDGLegYCabin);
00485     FacBomManager::linkWithParent (lCDGLeg, lCDGLegYCabin);
00486 
00487     // Display the leg-cabin
00488     // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
00489 
00490     // Step 0.7: fare family level
00491     // Create a fareFamily (1) for the Segment CDG-SFO, cabin Y on AF's Inv
00492     FareFamily& lCDGSFOSegmentYCabin1Family =
00493       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00494     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
00495                                     lCDGSFOSegmentYCabin1Family);
00496     FacBomManager::linkWithParent (lCDGSFOSegmentYCabin,
00497                                    lCDGSFOSegmentYCabin1Family);
00498 
00499     // Display the fare family
00500     // STDAIR_LOG_DEBUG ("fareFamily: "
00501     //
00502     //                   << lCDGSFOSegmentYCabin1Family.toString());
00503 
00504     // Step 0.8: booking class level Create a BookingClass (Q) for the
00505     // Segment CDG-SFO, cabin Y, fare family 1 on AF's Inv
00506     BookingClass& lCDGSFOSegmentYCabin1FamilyQClass =
00507       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00508     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin1Family,
00509                                     lCDGSFOSegmentYCabin1FamilyQClass);
00510     FacBomManager::linkWithParent (lCDGSFOSegmentYCabin1Family,
00511                                    lCDGSFOSegmentYCabin1FamilyQClass);
00512 
00513     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
00514                                     lCDGSFOSegmentYCabin1FamilyQClass);
00515     FacBomManager::addToListAndMap (lCDGSFOSegment,
00516                                     lCDGSFOSegmentYCabin1FamilyQClass);
00517 
00518     // Display the booking class
00519     // STDAIR_LOG_DEBUG ("BookingClass: "
00520     //                   << lCDGSFOSegmentYCabin1FamilyQClass.toString());
00521 
00522     /*================================================================================
00523       ================================================================================
00524       ================================================================================*/
00525     // Schedule:
00526     // BA:
00527     // Step 1: flight period level
00528     // Create a flight period for BA9:
00529     const DoWStruct lDoWSrtuct ("1111111");
00530     const Date_T lBA9DateRangeStart (2010, boost::gregorian::Jun, 6);
00531     const Date_T lBA9DateRangeEnd (2010, boost::gregorian::Jun, 7);
00532     const DatePeriod_T lBA9DatePeriod (lBA9DateRangeStart, lBA9DateRangeEnd);
00533     const PeriodStruct lBA9PeriodStruct (lBA9DatePeriod, lDoWSrtuct);
00534 
00535     lFlightNumber = FlightNumber_T (9);
00536 
00537     FlightPeriodKey lBA9FlightPeriodKey (lFlightNumber, lBA9PeriodStruct);
00538 
00539     FlightPeriod& lBA9FlightPeriod =
00540       FacBom<FlightPeriod>::instance().create (lBA9FlightPeriodKey);
00541     FacBomManager::addToListAndMap (lBAInv, lBA9FlightPeriod);
00542     FacBomManager::linkWithParent (lBAInv, lBA9FlightPeriod);
00543 
00544     // Step 2: segment period level
00545     // Create a segment period for LHR-SYD:
00546 
00547     SegmentPeriodKey lLHRSYDSegmentPeriodKey (lLHR, lSYD);
00548 
00549     SegmentPeriod& lLHRSYDSegmentPeriod =
00550       FacBom<SegmentPeriod>::instance().create (lLHRSYDSegmentPeriodKey);
00551     FacBomManager::addToListAndMap (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
00552     FacBomManager::linkWithParent (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
00553 
00554     lLHRSYDSegmentPeriod.setBoardingTime (l2135);
00555     lLHRSYDSegmentPeriod.setOffTime (l1540);
00556     lLHRSYDSegmentPeriod.setElapsedTime (l1105);
00557     ClassList_String_T lYM ("YM");
00558     lLHRSYDSegmentPeriod.addCabinBookingClassList (lY,lYM);
00559 
00560     // AF:
00561     // Step 1: flight period level
00562     // Create a flight period for AF84:
00563     const Date_T lAF84DateRangeStart (2011, boost::gregorian::Mar, 20);
00564     const Date_T lAF84DateRangeEnd (2011, boost::gregorian::Mar, 21);
00565     const DatePeriod_T lAF84DatePeriod (lAF84DateRangeStart, lAF84DateRangeEnd);
00566     const PeriodStruct lAF84PeriodStruct (lAF84DatePeriod, lDoWSrtuct);
00567 
00568     lFlightNumber = FlightNumber_T (84);
00569 
00570     FlightPeriodKey lAF84FlightPeriodKey (lFlightNumber, lAF84PeriodStruct);
00571 
00572     FlightPeriod& lAF84FlightPeriod =
00573       FacBom<FlightPeriod>::instance().create (lAF84FlightPeriodKey);
00574     FacBomManager::addToListAndMap (lAFInv, lAF84FlightPeriod);
00575     FacBomManager::linkWithParent (lAFInv, lAF84FlightPeriod);
00576 
00577     // Step 2: segment period level
00578     // Create a segment period for CDG-SFO:
00579 
00580     SegmentPeriodKey lCDGSFOSegmentPeriodKey (lCDG, lSFO);
00581 
00582     SegmentPeriod& lCDGSFOSegmentPeriod =
00583       FacBom<SegmentPeriod>::instance().create (lCDGSFOSegmentPeriodKey);
00584     FacBomManager::addToListAndMap (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
00585     FacBomManager::linkWithParent (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
00586 
00587     lCDGSFOSegmentPeriod.setBoardingTime (l1040);
00588     lCDGSFOSegmentPeriod.setOffTime (l1250);
00589     lCDGSFOSegmentPeriod.setElapsedTime (l1110);
00590     lCDGSFOSegmentPeriod.addCabinBookingClassList (lY,lYM);
00591 
00592     /*================================================================================
00593       ================================================================================
00594       ================================================================================*/
00595     // O&D 
00596     // Create an O&D Date (BA;9,2010-Jun-06;LHR,SYD) for BA's Inventory
00597     OnDString_T  lBALHRSYDOnDStr = "BA;9,2010-Jun-06;LHR,SYD";
00598     OnDStringList_T lBAOnDStrList;
00599     lBAOnDStrList.push_back (lBALHRSYDOnDStr);
00600 
00601     OnDDateKey lBAOnDDateKey (lBAOnDStrList);
00602     OnDDate& lBA_LHRSYD_OnDDate =
00603       FacBom<OnDDate>::instance().create (lBAOnDDateKey);
00604     // Link to the inventory
00605     FacBomManager::addToListAndMap (lBAInv, lBA_LHRSYD_OnDDate);
00606     FacBomManager::linkWithParent (lBAInv, lBA_LHRSYD_OnDDate);
00607 
00608     // Add the segment
00609     FacBomManager::addToListAndMap (lBA_LHRSYD_OnDDate, lLHRSYDSegment);
00610 
00611     // Add total forecast info for cabin Y.
00612     const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
00613     const WTP_T lWTP750 = 750.0;
00614     const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
00615     lBA_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
00616 
00617     // Create an O&D Date (AF;84,2011-Mar-21;CDG,SFO) for AF's Inventory
00618     OnDString_T lAFLHRSYDOnDStr = "AF;9,2011-Mar-20;CDG,SFO";
00619     OnDStringList_T lAFOnDStrList;
00620     lAFOnDStrList.push_back (lAFLHRSYDOnDStr);
00621 
00622     OnDDateKey lAFOnDDateKey (lAFOnDStrList);
00623     OnDDate& lAF_LHRSYD_OnDDate =
00624       FacBom<OnDDate>::instance().create (lAFOnDDateKey);
00625     // Link to the inventory
00626     FacBomManager::addToListAndMap (lAFInv, lAF_LHRSYD_OnDDate);
00627     FacBomManager::linkWithParent (lAFInv, lAF_LHRSYD_OnDDate);
00628 
00629     // Add the segment
00630     FacBomManager::addToListAndMap (lAF_LHRSYD_OnDDate, lLHRSYDSegment);
00631 
00632     // Add total forecast info for cabin Y. 
00633     lAF_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
00634     
00635   }
00636 
00637   // //////////////////////////////////////////////////////////////////////
00638   void CmdBomManager::
00639   buildSampleInventoryScheduleForFareFamilies (BomRoot& ioBomRoot) {
00640 
00641     // Inventory
00642     // Step 0.1: Inventory level
00643     // Get the Inventory SQ (already built by construction)  
00644     const InventoryKey lSQKey ("SQ");
00645     Inventory& lSQInv = BomManager::getObject<Inventory>(ioBomRoot,
00646                                                          lSQKey.toString());
00647 
00648     // SQ
00649     // Step 0.2: Flight-date level
00650     // Create a FlightDate (SQ747/8-FEB-2010) for SQ's Inventory
00651     const FlightNumber_T lFlightNumber747 = 747;
00652     const Date_T lDate (2010, 2, 8);
00653     const FlightDateKey lFlightDateKey (lFlightNumber747, lDate);
00654 
00655     FlightDate& lSQ747_20100208_FD =
00656         FacBom<FlightDate>::instance().create (lFlightDateKey);
00657     FacBomManager::addToListAndMap (lSQInv, lSQ747_20100208_FD);
00658     FacBomManager::linkWithParent (lSQInv, lSQ747_20100208_FD);
00659 
00660     // Display the flight-date
00661     // STDAIR_LOG_DEBUG ("FlightDate: " << lSQ747_20100208_FD.toString());
00662     
00663     // Step 0.3: Segment-date level
00664     // Create a SegmentDate (SIN-BKK) for SQ's Inventory
00665     const AirportCode_T lSIN ("SIN");
00666     const AirportCode_T lBKK ("BKK");
00667     const Duration_T l0635 (6, 35, 0);
00668     const Duration_T l0800 (8, 0, 0);
00669     const Duration_T l0225 (2, 25, 0);
00670     const SegmentDateKey lSegmentDateKey (lSIN, lBKK);
00671 
00672     SegmentDate& lSINBKKSegment =
00673       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00674     FacBomManager::addToListAndMap (lSQ747_20100208_FD, lSINBKKSegment);
00675     FacBomManager::linkWithParent (lSQ747_20100208_FD, lSINBKKSegment); 
00676 
00677     // Add the routing leg key to the SIN-BKK segment.
00678     const std::string lSQSINRoutingLegStr = "SQ;747;2010-Feb-8;SIN";
00679     lSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
00680 
00681     // Fill the SegmentDate content
00682     lSINBKKSegment.setBoardingDate (lDate);
00683     lSINBKKSegment.setOffDate (lDate);
00684     lSINBKKSegment.setBoardingTime (l0635);
00685     lSINBKKSegment.setOffTime (l0800);
00686     lSINBKKSegment.setElapsedTime (l0225);
00687   
00688     // Display the segment-date
00689     // STDAIR_LOG_DEBUG ("SegmentDate: " << lSINBKKSegment);
00690 
00691     // Step 0.4: Leg-date level
00692     // Create a LegDate (SIN) for SQ's Inventory
00693     const LegDateKey lLegDateKey (lSIN);
00694 
00695     LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00696     FacBomManager::addToListAndMap (lSQ747_20100208_FD, lSINLeg);
00697     FacBomManager::linkWithParent (lSQ747_20100208_FD, lSINLeg);
00698 
00699     // Fill the LegDate content
00700     lSINLeg.setOffPoint (lBKK);
00701     lSINLeg.setBoardingDate (lDate);
00702     lSINLeg.setOffDate (lDate);
00703     lSINLeg.setBoardingTime (l0635);
00704     lSINLeg.setOffTime (l0800);
00705     lSINLeg.setElapsedTime (l0225);
00706 
00707     // Display the leg-date
00708     // STDAIR_LOG_DEBUG ("LegDate: " << lSINLeg.toString());
00709 
00710     // Step 0.5: segment-cabin level
00711     // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
00712     const CabinCode_T lY ("Y");
00713     const SegmentCabinKey lYSegmentCabinKey (lY);
00714     SegmentCabin& lSINBKKSegmentYCabin =
00715       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00716     FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
00717     FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
00718     lSINBKKSegmentYCabin.activateFareFamily ();
00719     
00720     // Display the segment-cabin
00721     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lSINBKKSegmentYCabin.toString());
00722 
00723     // Step 0.6: leg-cabin level
00724     // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
00725     const LegCabinKey lYLegCabinKey (lY);
00726     LegCabin& lSINLegYCabin =
00727       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00728     FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
00729     FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
00730 
00731     // Display the leg-cabin
00732     // STDAIR_LOG_DEBUG ("LegCabin: " << lSINLegYCabin.toString());
00733    
00734     // Step 0.7: fare family level
00735     // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
00736     const FamilyCode_T l1 ("1");
00737     const FareFamilyKey l1FareFamilyKey (l1);
00738     FareFamily& lSINBKKSegmentYCabin1Family =
00739       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00740     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00741                                       lSINBKKSegmentYCabin1Family);
00742     FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
00743                                    lSINBKKSegmentYCabin1Family);
00744     
00745     // Display the booking class
00746     // STDAIR_LOG_DEBUG ("FareFamily: "
00747     //                   << lSINBKKSegmentYCabin1Family.toString());
00748 
00749     // Create a FareFamily (2) for the Segment SIN-BKK, cabin Y on SQ's Inv
00750     const FamilyCode_T l2 ("2");
00751     const FareFamilyKey l2FareFamilyKey (l2);
00752     FareFamily& lSINBKKSegmentYCabin2Family =
00753         FacBom<FareFamily>::instance().create (l2FareFamilyKey);
00754     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00755                                       lSINBKKSegmentYCabin2Family);
00756     FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
00757                                    lSINBKKSegmentYCabin2Family);
00758     
00759     // Display the booking class
00760     // STDAIR_LOG_DEBUG ("FareFamily: "
00761     //                   << lSINBKKSegmentYCabin2Family.toString());
00762    
00763     // Step 0.8: booking class level
00764     // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
00765     // fare family 2 on SQ's Inv
00766     const ClassCode_T lClassY ("Y");
00767     const BookingClassKey lYBookingClassKey (lClassY);
00768     BookingClass& lSINBKKSegmentYCabin2FamilyYClass =
00769       FacBom<BookingClass>::instance().create (lYBookingClassKey);
00770     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin2Family,
00771                                     lSINBKKSegmentYCabin2FamilyYClass);
00772     FacBomManager::linkWithParent (lSINBKKSegmentYCabin2Family,
00773                                    lSINBKKSegmentYCabin2FamilyYClass);
00774 
00775     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00776                                     lSINBKKSegmentYCabin2FamilyYClass);
00777     FacBomManager::addToListAndMap (lSINBKKSegment,
00778                                     lSINBKKSegmentYCabin2FamilyYClass);
00779     lSINBKKSegmentYCabin2FamilyYClass.setYield(1200);
00780     
00781     // Display the booking class
00782     // STDAIR_LOG_DEBUG ("BookingClass: "
00783     //                   << lSINBKKSegmentYCabin2FamilyYClass.toString());
00784     
00785     // Create a BookingClass (B) for the Segment SIN-BKK, cabin Y,
00786     // fare family 2 on SQ's Inv
00787     const ClassCode_T lB ("B");
00788     const BookingClassKey lBBookingClassKey (lB);
00789     BookingClass& lSINBKKSegmentYCabin2FamilyBClass =
00790       FacBom<BookingClass>::instance().create (lBBookingClassKey);
00791     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin2Family,
00792                                     lSINBKKSegmentYCabin2FamilyBClass);
00793     FacBomManager::linkWithParent (lSINBKKSegmentYCabin2Family,
00794                                    lSINBKKSegmentYCabin2FamilyBClass);
00795 
00796     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00797                                     lSINBKKSegmentYCabin2FamilyBClass);
00798     FacBomManager::addToListAndMap (lSINBKKSegment,
00799                                     lSINBKKSegmentYCabin2FamilyBClass);
00800     lSINBKKSegmentYCabin2FamilyBClass.setYield(800);
00801     
00802     // Display the booking class
00803     // STDAIR_LOG_DEBUG ("BookingClass: "
00804     //                   << lSINBKKSegmentYCabin2FamilyBClass.toString());
00805 
00806     // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
00807     // fare family 1 on SQ's Inv
00808     const ClassCode_T lM ("M");
00809     const BookingClassKey lMBookingClassKey (lM);
00810     BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
00811       FacBom<BookingClass>::instance().create (lMBookingClassKey);
00812     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
00813                                     lSINBKKSegmentYCabin1FamilyMClass);
00814     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
00815                                    lSINBKKSegmentYCabin1FamilyMClass);
00816 
00817     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00818                                     lSINBKKSegmentYCabin1FamilyMClass);
00819     FacBomManager::addToListAndMap (lSINBKKSegment,
00820                                     lSINBKKSegmentYCabin1FamilyMClass);
00821     lSINBKKSegmentYCabin1FamilyMClass.setYield(900);
00822     
00823     // Display the booking class
00824     // STDAIR_LOG_DEBUG ("BookingClass: "
00825     //                   << lSINBKKSegmentYCabin1FamilyMClass.toString());
00826    
00827     // Create a BookingClass (Q) for the Segment SIN-BKK, cabin Y,
00828     // fare family 1 on SQ's Inv
00829     const ClassCode_T lQ ("Q");
00830     const BookingClassKey lQBookingClassKey (lQ);
00831     BookingClass& lSINBKKSegmentYCabin1FamilyQClass =
00832       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00833     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
00834                                     lSINBKKSegmentYCabin1FamilyQClass);
00835     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
00836                                    lSINBKKSegmentYCabin1FamilyQClass);
00837 
00838     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
00839                                     lSINBKKSegmentYCabin1FamilyQClass);
00840     FacBomManager::addToListAndMap (lSINBKKSegment,
00841                                     lSINBKKSegmentYCabin1FamilyQClass);
00842     lSINBKKSegmentYCabin1FamilyQClass.setYield(600);
00843 
00844   
00845     // Display the booking class
00846     // STDAIR_LOG_DEBUG ("BookingClass: "
00847     //                   << lSINBKKSegmentYCabin1FamilyQClass.toString());
00848 
00849     /*================================================================================
00850       ================================================================================
00851       ================================================================================*/
00852     // Schedule:
00853     // SQ:
00854     // Step 1: flight period level
00855     // Create a flight period for SQ747:
00856     const DoWStruct lDoWSrtuct ("1111111");
00857     const Date_T lSQ747DateRangeStart (2010, boost::gregorian::Feb, 8);
00858     const Date_T lSQ747DateRangeEnd (2010, boost::gregorian::Feb, 9);
00859     const DatePeriod_T lSQ747DatePeriod (lSQ747DateRangeStart, 
00860                                          lSQ747DateRangeEnd);
00861     const PeriodStruct lSQ747PeriodStruct (lSQ747DatePeriod, lDoWSrtuct);
00862 
00863     const FlightPeriodKey lSQ747FlightPeriodKey (lFlightNumber747, 
00864                                            lSQ747PeriodStruct);
00865     FlightPeriod& lSQ747FlightPeriod =
00866       FacBom<FlightPeriod>::instance().create (lSQ747FlightPeriodKey);
00867     FacBomManager::addToListAndMap (lSQInv, lSQ747FlightPeriod);
00868     FacBomManager::linkWithParent (lSQInv, lSQ747FlightPeriod);
00869 
00870     // Step 2: segment period level
00871     // Create a segment period for SIN-BKK:
00872 
00873     const SegmentPeriodKey lSINBKKSegmentPeriodKey (lSIN, lBKK);
00874     SegmentPeriod& lSINBKKSegmentPeriod =
00875       FacBom<SegmentPeriod>::instance().create (lSINBKKSegmentPeriodKey);
00876     FacBomManager::addToListAndMap (lSQ747FlightPeriod, lSINBKKSegmentPeriod);
00877     FacBomManager::linkWithParent (lSQ747FlightPeriod, lSINBKKSegmentPeriod);
00878      
00879     ClassList_String_T lYBMQ  ("YBMQ");
00880     lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYBMQ);
00881     lSINBKKSegmentPeriod.setBoardingTime (l0635);
00882     lSINBKKSegmentPeriod.setOffTime (l0800);
00883     lSINBKKSegmentPeriod.setElapsedTime (l0225);
00884 
00885     /*================================================================================
00886       ================================================================================
00887       ================================================================================*/
00888     // O&D 
00889     // Create an O&D Date (SQ;747,2011-Feb-14;SIN,BKK) for SQ's Inventory
00890     const OnDString_T lSQSINBKKOnDStr = "SQ;747,2011-Feb-14;SIN,BKK";
00891     OnDStringList_T lSQOnDStrList;
00892     lSQOnDStrList.push_back (lSQSINBKKOnDStr);
00893 
00894     const OnDDateKey lSQOnDDateKey (lSQOnDStrList);
00895     OnDDate& lSQ_SINBKK_OnDDate =
00896       FacBom<OnDDate>::instance().create (lSQOnDDateKey);
00897     // Link to the inventory
00898     FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
00899     FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
00900     // Add total forecast info for cabin Y.
00901     const MeanStdDevPair_T lMean120StdDev12 (120.0, 12.0);
00902     const WTP_T lWTP1000 = 1000.0;
00903     const WTPDemandPair_T lWTP1000Mean120StdDev12 (lWTP1000, lMean120StdDev12);
00904     lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP1000Mean120StdDev12);
00905  
00906     // Add the segment
00907     FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
00908   }
00909 
00910   // //////////////////////////////////////////////////////////////////////
00911   void CmdBomManager::buildDummyLegSegmentAccesses (BomRoot& ioBomRoot) {    
00912 
00913     /* Build the direct accesses between the dummy segment cabins and the dummy 
00914      * leg cabins within the dummy flight dates (the dummy fare family 
00915      * flight date and the classic dummy flight date).
00916      *
00917      * As for now (May 2012), that method is called only by RMOL.
00918      * It is a substitute for the code doing it automatically located in AirInv.
00919      * See the AIRINV::InventoryManager::createDirectAccesses command.
00920      */
00921    
00922     // ////// Dummy Inventory Leg Segment Accesses ///////
00923     // Retrieve the (sample) segment-cabin.
00924     SegmentCabin& lDummySegmentCabin =
00925       BomRetriever::retrieveDummySegmentCabin (ioBomRoot);
00926     
00927     // Retrieve the (sample) leg-cabin.
00928     LegCabin& lDummyLegCabin =
00929       BomRetriever::retrieveDummyLegCabin (ioBomRoot);
00930 
00931     // Links between the segment-date and the leg-date
00932     FacBomManager::addToListAndMap (lDummyLegCabin, lDummySegmentCabin);
00933     FacBomManager::addToListAndMap (lDummySegmentCabin, lDummyLegCabin);
00934  
00935     // ////// Fare Families Dummy Inventory Leg Segment Accesses ///////
00936     const bool isForFareFamilies = true;
00937     // Retrieve the (sample) segment-cabin for fare families.
00938     SegmentCabin& lFFDummySegmentCabin =
00939       BomRetriever::retrieveDummySegmentCabin (ioBomRoot, isForFareFamilies);
00940     
00941     // Retrieve the (sample) leg-cabin for fare families.
00942     stdair::LegCabin& lFFDummyLegCabin =
00943       stdair::BomRetriever::retrieveDummyLegCabin (ioBomRoot, 
00944                                                    isForFareFamilies);
00945 
00946     // Links between the segment-date and the leg-date for fare families.
00947     FacBomManager::addToListAndMap (lFFDummyLegCabin, lFFDummySegmentCabin);
00948     FacBomManager::addToListAndMap (lFFDummySegmentCabin, lFFDummyLegCabin);
00949   }
00950 
00951   // //////////////////////////////////////////////////////////////////////
00952   void CmdBomManager::buildCompleteDummyInventory  (BomRoot& ioBomRoot) {
00953 
00954     // Build a dummy inventory, containing a dummy flight-date with a
00955     // single segment-cabin and a single leg-cabin.
00956     const CabinCapacity_T lCapacity = DEFAULT_CABIN_CAPACITY;
00957     buildDummyInventory (ioBomRoot, lCapacity);
00958 
00959     // Retrieve the (sample) segment-cabin.
00960     SegmentCabin& lDummySegmentCabin =
00961       BomRetriever::retrieveDummySegmentCabin (ioBomRoot);
00962     
00963     // Retrieve the (sample) leg-cabin.
00964     LegCabin& lDummyLegCabin =
00965       BomRetriever::retrieveDummyLegCabin (ioBomRoot);
00966 
00967     // Add some booking classes to the dummy segment-cabin and some
00968     // virtual ones to the dummy leg-cabin.
00969     // First booking class yield and demand information.
00970     Yield_T lYield = 100;
00971     MeanValue_T lMean = 20;
00972     StdDevValue_T lStdDev= 9;
00973     BookingClassKey lBCKey (DEFAULT_CLASS_CODE);
00974 
00975     BookingClass& lDummyBookingClass =
00976       FacBom<BookingClass>::instance().create (lBCKey);
00977     lDummyBookingClass.setYield (lYield);
00978     lDummyBookingClass.setMean (lMean);
00979     lDummyBookingClass.setStdDev (lStdDev);
00980     // Add a booking class to the segment-cabin.
00981     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
00982     BookingClassList_T lDummyBookingClassList;
00983     lDummyBookingClassList.push_back(&lDummyBookingClass);
00984 
00985     VirtualClassStruct lDummyVirtualClass (lDummyBookingClassList);
00986     lDummyVirtualClass.setYield (lYield);
00987     lDummyVirtualClass.setMean (lMean);
00988     lDummyVirtualClass.setStdDev (lStdDev);
00989     // Add the corresponding virtual class to the leg-cabin.
00990     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
00991 
00992     // Second booking class yield and demand information.
00993     lYield = 70;
00994     lMean = 45;
00995     lStdDev= 12;
00996     lDummyBookingClass.setYield (lYield);
00997     lDummyBookingClass.setMean (lMean);
00998     lDummyBookingClass.setStdDev (lStdDev);
00999     // Add a booking class to the segment-cabin.
01000     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
01001 
01002     lDummyVirtualClass.setYield (lYield);
01003     lDummyVirtualClass.setMean (lMean);
01004     lDummyVirtualClass.setStdDev (lStdDev);
01005     // Add the corresponding virtual class to the leg-cabin.
01006     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
01007     
01008     // Third booking class yield and demand information.
01009     lYield = 42;
01010     lMean = 80;
01011     lStdDev= 16;
01012     lDummyBookingClass.setYield (lYield);
01013     lDummyBookingClass.setMean (lMean);
01014     lDummyBookingClass.setStdDev (lStdDev);
01015     // Add a booking class to the segment-cabin.
01016     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
01017 
01018     lDummyVirtualClass.setYield (lYield);
01019     lDummyVirtualClass.setMean (lMean);
01020     lDummyVirtualClass.setStdDev (lStdDev);
01021     // Add the corresponding virtual class to the leg-cabin.
01022     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
01023     
01024   }
01025   
01026   // //////////////////////////////////////////////////////////////////////
01027   void CmdBomManager::buildDummyInventory (BomRoot& ioBomRoot,
01028                                            const CabinCapacity_T& iCapacity) {
01029     // Inventory
01030     const InventoryKey lInventoryKey (DEFAULT_AIRLINE_CODE);
01031     Inventory& lInv = FacBom<Inventory>::instance().create (lInventoryKey);
01032     FacBomManager::addToListAndMap (ioBomRoot, lInv);
01033     FacBomManager::linkWithParent (ioBomRoot, lInv);
01034 
01035     // Add the airline feature object to the dummy inventory
01036     const AirlineFeatureKey lAirlineFeatureKey (DEFAULT_AIRLINE_CODE);
01037     AirlineFeature& lAirlineFeature =
01038       FacBom<AirlineFeature>::instance().create (lAirlineFeatureKey);
01039     FacBomManager::setAirlineFeature (lInv, lAirlineFeature);
01040     FacBomManager::linkWithParent (lInv, lAirlineFeature);
01041     // Link the airline feature object with the top of the BOM tree
01042     FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeature);
01043 
01044     // Flight-date
01045     FlightDateKey lFlightDateKey(DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE);
01046     FlightDate& lFlightDate =
01047       FacBom<FlightDate>::instance().create (lFlightDateKey);
01048     FacBomManager::addToListAndMap (lInv, lFlightDate);
01049     FacBomManager::linkWithParent (lInv, lFlightDate);
01050 
01051     // Leg-date
01052     LegDateKey lLegDateKey (DEFAULT_ORIGIN);
01053     LegDate& lLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01054     FacBomManager::addToListAndMap (lFlightDate, lLeg);
01055     FacBomManager::linkWithParent (lFlightDate, lLeg);
01056 
01057     // Fill the LegDate content
01058     lLeg.setOffPoint (DEFAULT_DESTINATION);
01059     lLeg.setBoardingDate (DEFAULT_DEPARTURE_DATE);
01060     lLeg.setOffDate (DEFAULT_DEPARTURE_DATE);
01061     lLeg.setBoardingTime (Duration_T (14, 0, 0));
01062     lLeg.setOffTime (Duration_T (16, 0, 0));
01063     lLeg.setElapsedTime (Duration_T (8, 0, 0));
01064 
01065     // Leg-cabin
01066     LegCabinKey lLegCabinKey (DEFAULT_CABIN_CODE);
01067     LegCabin& lLegCabin = FacBom<LegCabin>::instance().create (lLegCabinKey);
01068     FacBomManager::addToListAndMap (lLeg, lLegCabin);
01069     FacBomManager::linkWithParent (lLeg, lLegCabin);
01070 
01071     lLegCabin.setCapacities (iCapacity);
01072     lLegCabin.setAvailabilityPool (iCapacity);
01073 
01074     // Segment-date
01075     SegmentDateKey lSegmentDateKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
01076     SegmentDate& lSegment =
01077       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01078     FacBomManager::addToListAndMap (lFlightDate, lSegment);
01079     FacBomManager::linkWithParent (lFlightDate, lSegment); 
01080 
01081     // Add the routing leg key to the dummy segment.
01082     std::ostringstream oStr;
01083     oStr << DEFAULT_AIRLINE_CODE << ";"
01084          << DEFAULT_FLIGHT_NUMBER << ";" 
01085          << DEFAULT_DEPARTURE_DATE << ";"
01086          << DEFAULT_ORIGIN;
01087     lSegment.addLegKey (oStr.str());
01088 
01089     // Fill the SegmentDate content
01090     lSegment.setBoardingDate (DEFAULT_DEPARTURE_DATE);
01091     lSegment.setOffDate (DEFAULT_DEPARTURE_DATE);
01092     lSegment.setBoardingTime (Duration_T (14, 0, 0));
01093     lSegment.setOffTime (Duration_T (16, 0, 0));
01094     lSegment.setElapsedTime (Duration_T (8, 0, 0));
01095 
01096     // Segment-cabin
01097     SegmentCabinKey lSegmentCabinKey (DEFAULT_CABIN_CODE);
01098     SegmentCabin& lSegmentCabin =
01099       FacBom<SegmentCabin>::instance().create (lSegmentCabinKey);
01100     FacBomManager::addToListAndMap (lSegment, lSegmentCabin);
01101     FacBomManager::linkWithParent (lSegment, lSegmentCabin);
01102 
01103     // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
01104     const FamilyCode_T l1 ("EcoSaver");
01105     FareFamilyKey l1FareFamilyKey (l1);
01106 
01107     FareFamily& lSegmentYCabin1Family =
01108       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01109     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1Family);
01110     FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin1Family);
01111 
01112     // Create a booking-class
01113     const ClassCode_T lQ ("Q");
01114     BookingClassKey lQBookingClassKey (lQ);
01115 
01116     BookingClass& lSegmentYCabin1FamilyQClass =
01117       FacBom<BookingClass>::instance().create (lQBookingClassKey);
01118     FacBomManager::addToListAndMap (lSegmentYCabin1Family,
01119                                     lSegmentYCabin1FamilyQClass);
01120     FacBomManager::linkWithParent (lSegmentYCabin1Family,
01121                                    lSegmentYCabin1FamilyQClass);
01122     
01123     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyQClass);
01124     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyQClass);
01125 
01126     /*================================================================================
01127       ================================================================================
01128       ================================================================================*/
01129     // Schedule:
01130     // XX:
01131     // Step 1: flight period level
01132     // Create a flight period for XX:
01133     const DoWStruct lDoWSrtuct ("1111111");
01134     const Date_T lXXDateRangeStart (DEFAULT_DEPARTURE_DATE);
01135     const Date_T lXXDateRangeEnd (DEFAULT_DEPARTURE_DATE);
01136     const DatePeriod_T lXXDatePeriod (lXXDateRangeStart, lXXDateRangeEnd);
01137     const PeriodStruct lXXPeriodStruct (lXXDatePeriod, lDoWSrtuct);
01138 
01139     FlightPeriodKey lXXFlightPeriodKey (DEFAULT_FLIGHT_NUMBER, lXXPeriodStruct);
01140 
01141     FlightPeriod& lXXFlightPeriod =
01142       FacBom<FlightPeriod>::instance().create (lXXFlightPeriodKey);
01143     FacBomManager::addToListAndMap (lInv, lXXFlightPeriod);
01144     FacBomManager::linkWithParent (lInv, lXXFlightPeriod);
01145 
01146     // Step 2: segment period level
01147     // Create a segment period 
01148 
01149     SegmentPeriodKey lXXSegmentPeriodKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
01150 
01151     SegmentPeriod& lXXSegmentPeriod =
01152       FacBom<SegmentPeriod>::instance().create (lXXSegmentPeriodKey);
01153     FacBomManager::addToListAndMap (lXXFlightPeriod, lXXSegmentPeriod);
01154     FacBomManager::linkWithParent (lXXFlightPeriod, lXXSegmentPeriod);
01155 
01156     lXXSegmentPeriod.setBoardingTime (Duration_T (14, 0, 0));
01157     lXXSegmentPeriod.setOffTime (Duration_T (16, 0, 0));
01158     lXXSegmentPeriod.setElapsedTime (Duration_T (8, 0, 0));
01159     const CabinCode_T lY ("Y");
01160     const ClassList_String_T lYQ ("YQ");
01161     lXXSegmentPeriod.addCabinBookingClassList (lY,lYQ);
01162 
01163 
01164   }
01165 
01166   // //////////////////////////////////////////////////////////////////////
01167   void CmdBomManager::
01168   buildCompleteDummyInventoryForFareFamilies (BomRoot& ioBomRoot) {
01169 
01170     // Build a dummy inventory, containing a dummy flight-date with a
01171     // single segment-cabin and a single leg-cabin (for fare families 
01172     // algorithms)
01173 
01174     // Get the default Inventory object (already built in by construction)
01175     const InventoryKey lInventoryKey (DEFAULT_AIRLINE_CODE);
01176     Inventory& lInv = BomManager::getObject<Inventory>(ioBomRoot,
01177                                                   lInventoryKey.toString());
01178 
01179     // Create a dummy Flight-date
01180     const FlightDateKey lFlightDateKey(DEFAULT_FLIGHT_NUMBER_FF, 
01181                                        DEFAULT_DEPARTURE_DATE);
01182     FlightDate& lFlightDate = 
01183       FacBom<FlightDate>::instance().create (lFlightDateKey);
01184     FacBomManager::addToListAndMap (lInv, lFlightDate);
01185     FacBomManager::linkWithParent (lInv, lFlightDate);
01186 
01187     // Create a dummy Leg-date
01188     LegDateKey lLegDateKey (DEFAULT_ORIGIN);
01189     LegDate& lLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01190     FacBomManager::addToListAndMap (lFlightDate, lLeg);
01191     FacBomManager::linkWithParent (lFlightDate, lLeg);
01192 
01193     // Fill the LegDate content
01194     lLeg.setOffPoint (DEFAULT_DESTINATION);
01195     lLeg.setBoardingDate (DEFAULT_DEPARTURE_DATE);
01196     lLeg.setOffDate (DEFAULT_DEPARTURE_DATE);
01197     lLeg.setBoardingTime (Duration_T (14, 0, 0));
01198     lLeg.setOffTime (Duration_T (16, 0, 0));
01199     lLeg.setElapsedTime (Duration_T (8, 0, 0));
01200 
01201     // Create a dummy Leg-cabin
01202     const LegCabinKey lLegCabinKey (DEFAULT_CABIN_CODE);
01203     LegCabin& lLegCabin = FacBom<LegCabin>::instance().create (lLegCabinKey);
01204     FacBomManager::addToListAndMap (lLeg, lLegCabin);
01205     FacBomManager::linkWithParent (lLeg, lLegCabin);
01206     const CabinCapacity_T lCapacity = DEFAULT_CABIN_CAPACITY;
01207     lLegCabin.setCapacities (lCapacity);
01208     lLegCabin.setAvailabilityPool (lCapacity);
01209 
01210     // Create a dummy Segment-date
01211     const SegmentDateKey lSegmentDateKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
01212     SegmentDate& lSegment =
01213       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01214     FacBomManager::addToListAndMap (lFlightDate, lSegment);
01215     FacBomManager::linkWithParent (lFlightDate, lSegment); 
01216 
01217     // Add the routing leg key to the dummy segment.
01218     std::ostringstream oStr;
01219     oStr << DEFAULT_AIRLINE_CODE << ";"
01220          << DEFAULT_FLIGHT_NUMBER << ";" 
01221          << DEFAULT_DEPARTURE_DATE << ";"
01222          << DEFAULT_ORIGIN;
01223     lSegment.addLegKey (oStr.str());
01224 
01225     // Fill the SegmentDate content
01226     lSegment.setBoardingDate (DEFAULT_DEPARTURE_DATE);
01227     lSegment.setOffDate (DEFAULT_DEPARTURE_DATE);
01228     lSegment.setBoardingTime (Duration_T (14, 0, 0));
01229     lSegment.setOffTime (Duration_T (16, 0, 0));
01230     lSegment.setElapsedTime (Duration_T (8, 0, 0));
01231 
01232     // Create a dummy Segment-cabin
01233     const SegmentCabinKey lSegmentCabinKey (DEFAULT_CABIN_CODE);
01234     SegmentCabin& lSegmentCabin =
01235       FacBom<SegmentCabin>::instance().create (lSegmentCabinKey);
01236     FacBomManager::addToListAndMap (lSegment, lSegmentCabin);
01237     FacBomManager::linkWithParent (lSegment, lSegmentCabin);
01238 
01239     // Create a dummy FareFamily (FF1) 
01240     const FamilyCode_T l1 ("FF1");
01241     const FareFamilyKey l1FareFamilyKey (l1);
01242 
01243     FareFamily& lSegmentYCabin1Family =
01244       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01245     // Set the forecasted demand
01246     // TODO change the size (hard code)
01247     MeanStdDevPairVector_T lDemandVector1FareFamily;
01248     const unsigned int size = 16;
01249     for (unsigned int idx = 0; idx < size; ++idx) {
01250       double i = static_cast<double> (idx);
01251       MeanStdDevPair_T lMeanStdDevPair (i/4.0, i/20.0);
01252       lDemandVector1FareFamily.push_back(lMeanStdDevPair);
01253     }
01254     lSegmentYCabin1Family.setMeanStdDev(lDemandVector1FareFamily);
01255     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1Family);
01256     FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin1Family);
01257 
01258     // Create a dummy booking-class
01259     const ClassCode_T lY ("Y");
01260     const BookingClassKey lYBookingClassKey (lY);
01261 
01262     BookingClass& lSegmentYCabin1FamilyYClass =
01263       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01264     Yield_T lYield = 1000;
01265     lSegmentYCabin1FamilyYClass.setYield(lYield);
01266     FacBomManager::addToListAndMap (lSegmentYCabin1Family,
01267                                     lSegmentYCabin1FamilyYClass);
01268     FacBomManager::linkWithParent (lSegmentYCabin1Family,
01269                                    lSegmentYCabin1FamilyYClass);
01270     
01271     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyYClass);
01272     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyYClass);
01273 
01274     // Create a second dummy booking-class
01275     const ClassCode_T lU ("U");
01276     const BookingClassKey lUBookingClassKey (lU);
01277 
01278     BookingClass& lSegmentYCabin1FamilyUClass =
01279       FacBom<BookingClass>::instance().create (lUBookingClassKey);
01280     lYield = 600;
01281     lSegmentYCabin1FamilyUClass.setYield(lYield);
01282     FacBomManager::addToListAndMap (lSegmentYCabin1Family,
01283                                     lSegmentYCabin1FamilyUClass);
01284     FacBomManager::linkWithParent (lSegmentYCabin1Family,
01285                                    lSegmentYCabin1FamilyUClass);
01286     
01287     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyUClass);
01288     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyUClass);
01289 
01290     // Create a second dummy FareFamily (2) 
01291     const FamilyCode_T l2 ("FF2");
01292     const FareFamilyKey l2FareFamilyKey (l2);
01293 
01294     FareFamily& lSegmentYCabin2Family =
01295       FacBom<FareFamily>::instance().create (l2FareFamilyKey);
01296     // Set the forecasted demand
01297     // TODO change the size (hard code)
01298     MeanStdDevPairVector_T lDemandVector2FareFamily;
01299     for (unsigned int idx = 0; idx < size; ++idx) {
01300       double i = static_cast<double> (idx);
01301       MeanStdDevPair_T lMeanStdDevPair (i/2.0, i/10.0);
01302       lDemandVector2FareFamily.push_back(lMeanStdDevPair);
01303     }
01304     lSegmentYCabin2Family.setMeanStdDev(lDemandVector2FareFamily);
01305 
01306     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2Family);
01307     FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin2Family);
01308 
01309     // Create a third dummy booking-class
01310     const ClassCode_T lO ("O");
01311     const BookingClassKey lOBookingClassKey (lO);
01312 
01313     BookingClass& lSegmentYCabin2FamilyOClass =
01314       FacBom<BookingClass>::instance().create (lOBookingClassKey);
01315     lYield = 750;
01316     lSegmentYCabin2FamilyOClass.setYield(lYield);
01317     FacBomManager::addToListAndMap (lSegmentYCabin2Family,
01318                                     lSegmentYCabin2FamilyOClass);
01319     FacBomManager::linkWithParent (lSegmentYCabin2Family,
01320                                    lSegmentYCabin2FamilyOClass);
01321     
01322     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2FamilyOClass);
01323     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin2FamilyOClass);
01324 
01325      // Create a fourth dummy booking-class
01326     const ClassCode_T lQ ("Q");
01327     const BookingClassKey lQBookingClassKey (lQ);
01328 
01329     BookingClass& lSegmentYCabin2FamilyQClass =
01330       FacBom<BookingClass>::instance().create (lQBookingClassKey);
01331     lYield = 400;
01332     lSegmentYCabin2FamilyQClass.setYield(lYield);
01333     FacBomManager::addToListAndMap (lSegmentYCabin2Family,
01334                                     lSegmentYCabin2FamilyQClass);
01335     FacBomManager::linkWithParent (lSegmentYCabin2Family,
01336                                    lSegmentYCabin2FamilyQClass);
01337     
01338     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2FamilyQClass);
01339     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin2FamilyQClass);
01340 
01341 
01342     /*================================================================================
01343       ================================================================================
01344       ================================================================================*/
01345     // Schedule:
01346     // XX:
01347     // Step 1: flight period level
01348     // Create a flight period for XX:
01349     const DoWStruct lDoWSrtuct ("1111111");
01350     const Date_T lXXDateRangeStart (DEFAULT_DEPARTURE_DATE);
01351     const Date_T lXXDateRangeEnd (DEFAULT_DEPARTURE_DATE);
01352     const DatePeriod_T lXXDatePeriod (lXXDateRangeStart, lXXDateRangeEnd);
01353     const PeriodStruct lXXPeriodStruct (lXXDatePeriod, lDoWSrtuct);
01354 
01355     const FlightPeriodKey lXXFlightPeriodKey (DEFAULT_FLIGHT_NUMBER_FF, 
01356                                               lXXPeriodStruct);
01357 
01358     FlightPeriod& lXXFlightPeriod =
01359       FacBom<FlightPeriod>::instance().create (lXXFlightPeriodKey);
01360     FacBomManager::addToListAndMap (lInv, lXXFlightPeriod);
01361     FacBomManager::linkWithParent (lInv, lXXFlightPeriod);
01362 
01363     // Step 2: segment period level
01364     // Create a segment period 
01365     const SegmentPeriodKey lXXSegmentPeriodKey (DEFAULT_ORIGIN, 
01366                                                 DEFAULT_DESTINATION);
01367 
01368     SegmentPeriod& lXXSegmentPeriod =
01369       FacBom<SegmentPeriod>::instance().create (lXXSegmentPeriodKey);
01370     FacBomManager::addToListAndMap (lXXFlightPeriod, lXXSegmentPeriod);
01371     FacBomManager::linkWithParent (lXXFlightPeriod, lXXSegmentPeriod);
01372 
01373     lXXSegmentPeriod.setBoardingTime (Duration_T (14, 0, 0));
01374     lXXSegmentPeriod.setOffTime (Duration_T (16, 0, 0));
01375     lXXSegmentPeriod.setElapsedTime (Duration_T (8, 0, 0));
01376     const CabinCode_T lYCabin ("Y");
01377     const ClassList_String_T lYUOQ ("YUOQ");
01378     lXXSegmentPeriod.addCabinBookingClassList (lYCabin,lYUOQ);
01379 
01380   }
01381 
01382   // //////////////////////////////////////////////////////////////////////
01383   void CmdBomManager::buildSamplePricing (BomRoot& ioBomRoot) {
01384 
01385     // Set the airport-pair primary key.
01386     const AirportPairKey lAirportPairKey (AIRPORT_LHR, AIRPORT_SYD);
01387     
01388     // Create the AirportPairKey object and link it to the BOM tree root.
01389     AirportPair& lAirportPair =
01390       FacBom<AirportPair>::instance().create (lAirportPairKey);
01391     FacBomManager::addToListAndMap (ioBomRoot, lAirportPair);
01392     FacBomManager::linkWithParent (ioBomRoot, lAirportPair);
01393 
01394     // Set the fare date-period primary key.
01395     const Date_T lDateRangeStart (2011, boost::gregorian::Jan, 15);
01396     const Date_T lDateRangeEnd (2011, boost::gregorian::Dec, 31);
01397     const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
01398     const DatePeriodKey lDatePeriodKey (lDateRange);
01399 
01400     // Create the DatePeriodKey object and link it to the PosChannel object.
01401     DatePeriod& lDatePeriod =
01402       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
01403     FacBomManager::addToListAndMap (lAirportPair, lDatePeriod);
01404     FacBomManager::linkWithParent (lAirportPair, lDatePeriod);    
01405 
01406     // Set the point-of-sale-channel primary key.
01407     const PosChannelKey lPosChannelKey (POS_LHR, CHANNEL_DN);  
01408     
01409     // Create the PositionKey object and link it to the AirportPair object.
01410     PosChannel& lPosChannel =
01411       FacBom<PosChannel>::instance().create (lPosChannelKey);
01412     FacBomManager::addToListAndMap (lDatePeriod, lPosChannel);
01413     FacBomManager::linkWithParent (lDatePeriod, lPosChannel);
01414    
01415     // Set the fare time-period primary key.
01416     const Time_T lTimeRangeStart (0, 0, 0);
01417     const Time_T lTimeRangeEnd (23, 0, 0);
01418     const TimePeriodKey lTimePeriodKey (lTimeRangeStart, lTimeRangeEnd);
01419 
01420     // Create the TimePeriodKey and link it to the DatePeriod object.
01421     TimePeriod& lTimePeriod =
01422       FacBom<TimePeriod>::instance().create (lTimePeriodKey);
01423     FacBomManager::addToListAndMap (lPosChannel, lTimePeriod);
01424     FacBomManager::linkWithParent (lPosChannel, lTimePeriod);        
01425 
01426     // Pricing -- Generate the FareRule
01427     const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ROUND_TRIP,
01428                                             NO_ADVANCE_PURCHASE,
01429                                             SATURDAY_STAY,
01430                                             CHANGE_FEES,
01431                                             NON_REFUNDABLE,
01432                                             NO_STAY_DURATION);
01433 
01434     // Create the FareFeaturesKey and link it to the TimePeriod object.
01435     FareFeatures& lFareFeatures =
01436       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
01437     FacBomManager::addToListAndMap (lTimePeriod, lFareFeatures);
01438     FacBomManager::linkWithParent (lTimePeriod, lFareFeatures);        
01439 
01440     // Revenue Accounting -- Generate the YieldRule
01441     const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ROUND_TRIP,
01442                                               CABIN_Y);
01443     
01444     // Create the YieldFeaturesKey and link it to the TimePeriod object.
01445     YieldFeatures& lYieldFeatures =
01446       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
01447     FacBomManager::addToListAndMap (lTimePeriod, lYieldFeatures);
01448     FacBomManager::linkWithParent (lTimePeriod, lYieldFeatures);     
01449                                               
01450     // Generate Segment Features and link them to their respective
01451     // fare and yield rules.
01452     AirlineCodeList_T lAirlineCodeList;
01453     lAirlineCodeList.push_back (AIRLINE_CODE_BA);
01454     ClassList_StringList_T lClassCodeList;
01455     lClassCodeList.push_back (CLASS_CODE_Y);
01456     const AirlineClassListKey lAirlineClassListKey (lAirlineCodeList,
01457                                                     lClassCodeList);
01458 
01459     // Create the AirlineClassList
01460     AirlineClassList& lAirlineClassList =
01461       FacBom<AirlineClassList>::instance().create (lAirlineClassListKey);
01462     // Link the AirlineClassList to the FareFeatures object
01463     lAirlineClassList.setFare (900);
01464     FacBomManager::addToListAndMap (lFareFeatures, lAirlineClassList);
01465     FacBomManager::linkWithParent (lFareFeatures, lAirlineClassList);
01466 
01467     // Link the AirlineClassList to the YieldFeatures object
01468     lAirlineClassList.setYield (900);
01469     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassList);
01470     // \todo (gsabatier): the following calls overrides the parent for
01471     //       lAirlineClassList. Check that it is what is actually wanted.
01472     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassList);
01473   }
01474 
01475   // //////////////////////////////////////////////////////////////////////
01476   void CmdBomManager::buildSamplePricingForFareFamilies (BomRoot& ioBomRoot) {
01477 
01478     // Get the airport-pair primary key SIN-BKK
01479     // (already built by construction)
01480     const AirportPairKey lAirportPairKey ("SIN", "BKK");
01481     AirportPair& lAirportPair =
01482       BomManager::getObject<AirportPair>(ioBomRoot, lAirportPairKey.toString());
01483 
01484     // Set the fare date-period primary key.
01485     const Date_T lDateRangeStart (2010, boost::gregorian::Feb, 1);
01486     const Date_T lDateRangeEnd (2011, boost::gregorian::Feb, 15);
01487     const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
01488     const DatePeriodKey lDatePeriodKey (lDateRange);
01489 
01490     // Create the DatePeriodKey object and link it to the PosChannel object.
01491     DatePeriod& lDatePeriod =
01492       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
01493     FacBomManager::addToListAndMap (lAirportPair, lDatePeriod);
01494     FacBomManager::linkWithParent (lAirportPair, lDatePeriod);  
01495 
01496     // Set the point-of-sale-channel primary key.
01497     const PosChannelKey lPosChannelKey ("SIN", CHANNEL_IN);  
01498     
01499     // Create the PositionKey object and link it to the AirportPair object.
01500     PosChannel& lPosChannel =
01501       FacBom<PosChannel>::instance().create (lPosChannelKey);
01502     FacBomManager::addToListAndMap (lDatePeriod, lPosChannel);
01503     FacBomManager::linkWithParent (lDatePeriod, lPosChannel);
01504 
01505     // Set the fare time-period primary key.
01506     const Time_T lTimeRangeStart (0, 0, 0);
01507     const Time_T lTimeRangeEnd (23, 0, 0);
01508     const TimePeriodKey lTimePeriodKey (lTimeRangeStart, lTimeRangeEnd);
01509 
01510     // Create the TimePeriodKey and link it to the DatePeriod object.
01511     TimePeriod& lTimePeriod =
01512       FacBom<TimePeriod>::instance().create (lTimePeriodKey);
01513     FacBomManager::addToListAndMap (lPosChannel, lTimePeriod);
01514     FacBomManager::linkWithParent (lPosChannel, lTimePeriod);        
01515 
01516     // Pricing -- Generate the FareRule
01517     const DayDuration_T ONE_MONTH_ADVANCE_PURCHASE = 30;
01518     // Generate the first FareFeatures for the class Q 
01519     const FareFeaturesKey lFareFeaturesQKey (TRIP_TYPE_ONE_WAY,
01520                                             ONE_MONTH_ADVANCE_PURCHASE,
01521                                             SATURDAY_STAY,
01522                                             CHANGE_FEES,
01523                                             NON_REFUNDABLE,
01524                                             NO_STAY_DURATION);
01525 
01526     // Create the FareFeaturesKey and link it to the TimePeriod object.
01527     FareFeatures& lFareFeaturesQ =
01528       FacBom<FareFeatures>::instance().create (lFareFeaturesQKey);
01529     FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesQ);
01530     FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesQ);
01531 
01532     // Generate the second FareFeatures for the class M 
01533     const FareFeaturesKey lFareFeaturesMKey (TRIP_TYPE_ONE_WAY,
01534                                             NO_ADVANCE_PURCHASE,
01535                                             SATURDAY_STAY,
01536                                             CHANGE_FEES,
01537                                             NON_REFUNDABLE,
01538                                             NO_STAY_DURATION);
01539 
01540     // Create the FareFeaturesKey and link it to the TimePeriod object.
01541     FareFeatures& lFareFeaturesM =
01542       FacBom<FareFeatures>::instance().create (lFareFeaturesMKey);
01543     FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesM);
01544     FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesM); 
01545 
01546     // Generate the third FareFeatures for the class B
01547     const FareFeaturesKey lFareFeaturesBKey (TRIP_TYPE_ONE_WAY,
01548                                              ONE_MONTH_ADVANCE_PURCHASE,
01549                                              SATURDAY_STAY,
01550                                              NO_CHANGE_FEES,
01551                                              NO_NON_REFUNDABLE,//Refundable
01552                                              NO_STAY_DURATION);
01553 
01554     // Create the FareFeaturesKey and link it to the TimePeriod object.
01555     FareFeatures& lFareFeaturesB =
01556       FacBom<FareFeatures>::instance().create (lFareFeaturesBKey);
01557     FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesB);
01558     FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesB);       
01559 
01560     // Generate the fourth FareFeatures for the class Y
01561     const FareFeaturesKey lFareFeaturesYKey (TRIP_TYPE_ONE_WAY,
01562                                             NO_ADVANCE_PURCHASE,
01563                                             SATURDAY_STAY,
01564                                             NO_CHANGE_FEES,
01565                                             NO_NON_REFUNDABLE,//Refundable
01566                                             NO_STAY_DURATION);
01567 
01568     // Create the FareFeaturesKey and link it to the TimePeriod object.
01569     FareFeatures& lFareFeaturesY =
01570       FacBom<FareFeatures>::instance().create (lFareFeaturesYKey);
01571     FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesY);
01572     FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesY);
01573   
01574     // Revenue Accounting -- Generate the YieldRule
01575     const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
01576                                               CABIN_Y);
01577 
01578     // Create the YieldFeaturesKey and link it to the TimePeriod object.
01579     YieldFeatures& lYieldFeatures =
01580       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
01581     FacBomManager::addToListAndMap (lTimePeriod, lYieldFeatures);
01582     FacBomManager::linkWithParent (lTimePeriod, lYieldFeatures);
01583                                   
01584     // Generate Segment Features and link them to their respective
01585     // fare and yield rules.
01586     AirlineCodeList_T lAirlineCodeList;
01587     lAirlineCodeList.push_back ("SQ");
01588 
01589     ClassList_StringList_T lClassYList;
01590     lClassYList.push_back (CLASS_CODE_Y);
01591     const AirlineClassListKey lAirlineClassYListKey (lAirlineCodeList,
01592                                                     lClassYList);
01593     
01594     // Create the AirlineClassList
01595     AirlineClassList& lAirlineClassYList =
01596         FacBom<AirlineClassList>::instance().create (lAirlineClassYListKey);
01597     // Link the AirlineClassList to the FareFeatures object
01598     FacBomManager::addToListAndMap (lFareFeaturesY, lAirlineClassYList);
01599     FacBomManager::linkWithParent (lFareFeaturesY, lAirlineClassYList);
01600     lAirlineClassYList.setFare (1200);    
01601     lAirlineClassYList.setYield (1200);
01602 
01603     // Link the AirlineClassList to the YieldFeatures object
01604     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassYList);
01605     // \todo (gsabatier): the following calls overrides the parent for
01606     //       lAirlineClassList. Check that it is what is actually wanted.
01607     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassYList);
01608 
01609     ClassList_StringList_T lClassBList;
01610     lClassBList.push_back ("B");
01611     const AirlineClassListKey lAirlineClassBListKey (lAirlineCodeList,
01612                                                      lClassBList);
01613     // Create the AirlineClassList
01614     AirlineClassList& lAirlineClassBList =
01615       FacBom<AirlineClassList>::instance().create (lAirlineClassBListKey);
01616     // Link the AirlineClassList to the FareFeatures object
01617     FacBomManager::addToListAndMap (lFareFeaturesB, lAirlineClassBList);
01618     FacBomManager::linkWithParent (lFareFeaturesB, lAirlineClassBList);
01619     lAirlineClassBList.setFare (800); 
01620     lAirlineClassBList.setYield (800);
01621   
01622     // Link the AirlineClassList to the YieldFeatures object
01623     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassBList);
01624     // \todo (gsabatier): the following calls overrides the parent for
01625     //       lAirlineClassList. Check that it is what is actually wanted.
01626     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassBList);
01627 
01628     ClassList_StringList_T lClassMList;
01629     lClassMList.push_back ("M");
01630     const AirlineClassListKey lAirlineClassMListKey (lAirlineCodeList,
01631                                                     lClassMList);
01632 
01633     // Create the AirlineClassList
01634     AirlineClassList& lAirlineClassMList =
01635       FacBom<AirlineClassList>::instance().create (lAirlineClassMListKey);
01636     // Link the AirlineClassList to the FareFeatures object
01637     FacBomManager::addToListAndMap (lFareFeaturesM, lAirlineClassMList);
01638     FacBomManager::linkWithParent (lFareFeaturesM, lAirlineClassMList);
01639     lAirlineClassMList.setFare (900);   
01640     lAirlineClassMList.setYield (900);
01641 
01642     // Link the AirlineClassList to the YieldFeatures object
01643     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassMList);
01644     // \todo (gsabatier): the following calls overrides the parent for
01645     //       lAirlineClassList. Check that it is what is actually wanted.
01646     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassMList);
01647 
01648     ClassList_StringList_T lClassQList;
01649     lClassQList.push_back ("Q");
01650     const AirlineClassListKey lAirlineClassQListKey (lAirlineCodeList,
01651                                                      lClassQList);
01652 
01653     // Create the AirlineClassList
01654     AirlineClassList& lAirlineClassQList =
01655       FacBom<AirlineClassList>::instance().create (lAirlineClassQListKey);
01656     // Link the AirlineClassList to the FareFeatures object
01657     FacBomManager::addToListAndMap (lFareFeaturesQ, lAirlineClassQList);
01658     FacBomManager::linkWithParent (lFareFeaturesQ, lAirlineClassQList);
01659     lAirlineClassQList.setFare (600);  
01660     lAirlineClassQList.setYield (600);
01661     
01662     // Link the AirlineClassList to the YieldFeatures object
01663     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassQList);
01664     // \todo (gsabatier): the following calls overrides the parent for
01665     //       lAirlineClassList. Check that it is what is actually wanted.
01666     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassQList);
01667         
01668   }
01669 
01670   // //////////////////////////////////////////////////////////////////////
01671   void CmdBomManager::
01672   buildSampleTravelSolutionForPricing (TravelSolutionList_T& ioTravelSolutionList) {
01673 
01674     // Clean the list
01675     ioTravelSolutionList.clear();
01676 
01677     //
01678     const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
01679 
01680     // Add the segment date key to the travel solution
01681     TravelSolutionStruct lTS;
01682     lTS.addSegment (lBA9_SegmentDateKey);
01683 
01684     // Add the travel solution to the list
01685     ioTravelSolutionList.push_back (lTS);
01686   }
01687   
01688   // //////////////////////////////////////////////////////////////////////
01689   void CmdBomManager::
01690   buildSampleTravelSolutions (TravelSolutionList_T& ioTravelSolutionList) {
01691 
01692     // Clean the list
01693     ioTravelSolutionList.clear();
01694 
01695     //
01696     const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
01697 
01698     // Add the segment date key to the travel solution
01699     TravelSolutionStruct lTS1;
01700     lTS1.addSegment (lBA9_SegmentDateKey);
01701 
01702     // Fare option number 1
01703     const ClassCode_T lClassPathQ (CLASS_CODE_Q);
01704     const Fare_T lFare900 (900);
01705     const ChangeFees_T lChangeFee (CHANGE_FEES);
01706     const NonRefundable_T isNonRefundable (NON_REFUNDABLE);
01707     const SaturdayStay_T lSaturdayStay (SATURDAY_STAY);
01708     const FareOptionStruct lFareOption1 (lClassPathQ, lFare900, lChangeFee,
01709                                         isNonRefundable, lSaturdayStay);
01710 
01711     // Add (a copy of) the fare option
01712     lTS1.addFareOption (lFareOption1);
01713     //
01714 
01715     // Map of class availabilities: set the availability for the Q
01716     // booking class (the one corresponding to the fare option) to 8.
01717     ClassAvailabilityMap_T lClassAvailabilityMap1;
01718     const Availability_T lAvl1 (8);
01719     bool hasInsertOfQBeenSuccessful = lClassAvailabilityMap1.
01720       insert (ClassAvailabilityMap_T::value_type (lClassPathQ, lAvl1)).second;
01721     assert (hasInsertOfQBeenSuccessful == true);
01722     // Add the map to the dedicated list held by the travel solution
01723     lTS1.addClassAvailabilityMap (lClassAvailabilityMap1);
01724 
01725     // Add the travel solution to the list
01726     ioTravelSolutionList.push_back (lTS1);
01727 
01728     //
01729     const std::string lQF12_SegmentDateKey ("QF, 12, 2011-06-10, LHR, SYD, 20:45");
01730 
01731     // Add the segment date key to the travel solution
01732     TravelSolutionStruct lTS2;
01733     lTS2.addSegment (lQF12_SegmentDateKey);
01734 
01735     // Fare option number 2
01736     const ClassCode_T lClassPathY (CLASS_CODE_Y);
01737     const Fare_T lFare1000 (1000);
01738     const ChangeFees_T lNoChangeFee (NO_CHANGE_FEES);
01739     const NonRefundable_T isRefundable (NO_NON_REFUNDABLE);
01740     const FareOptionStruct lFareOption2 (lClassPathY, lFare1000, lNoChangeFee,
01741                                          isRefundable, lSaturdayStay);
01742 
01743     // Map of class availabilities: set the availability for the Y
01744     // booking class (the one corresponding to the fare option) to 9.
01745     ClassAvailabilityMap_T lClassAvailabilityMap2;
01746     const Availability_T lAvl2 (9);
01747     const bool hasInsertOfYBeenSuccessful = lClassAvailabilityMap2.
01748       insert (ClassAvailabilityMap_T::value_type (lClassPathY, lAvl2)).second;
01749     assert (hasInsertOfYBeenSuccessful == true);
01750     // Add the map to the dedicated list held by the travel solution
01751     lTS2.addClassAvailabilityMap (lClassAvailabilityMap2);
01752 
01753     // Add (a copy of) the fare option
01754     lTS2.addFareOption (lFareOption2);
01755 
01756     // Fare option number 3
01757     const Fare_T lFare920 (920);
01758     const FareOptionStruct lFareOption3 (lClassPathQ, lFare920, lNoChangeFee,
01759                                          isNonRefundable, lSaturdayStay);
01760 
01761     // Map of class availabilities: set the availability for the Q
01762     // booking class (the one corresponding to the fare option) to 9.
01763     hasInsertOfQBeenSuccessful = lClassAvailabilityMap2.
01764       insert (ClassAvailabilityMap_T::value_type (lClassPathQ, lAvl2)).second;
01765     assert (hasInsertOfYBeenSuccessful == true);
01766     // Add the map to the dedicated list held by the travel solution
01767     lTS2.addClassAvailabilityMap (lClassAvailabilityMap2);
01768 
01769     // Add (a copy of) the fare option
01770     lTS2.addFareOption (lFareOption3);
01771 
01772     // Add the travel solution to the list
01773     ioTravelSolutionList.push_back (lTS2);
01774     
01775   }
01776 
01777   // //////////////////////////////////////////////////////////////////////
01778   BookingRequestStruct CmdBomManager::buildSampleBookingRequest() {
01779     // Origin
01780     const AirportCode_T lOrigin (AIRPORT_LHR);
01781 
01782     // Destination
01783     const AirportCode_T lDestination (AIRPORT_SYD);
01784 
01785     // Point of Sale (POS)
01786     const CityCode_T lPOS (POS_LHR);
01787 
01788     // Preferred departure date (10-JUN-2011)
01789     const Date_T lPreferredDepartureDate (2011, boost::gregorian::Jun, 10);
01790 
01791     // Preferred departure time (08:00)
01792     const Duration_T lPreferredDepartureTime (8, 0, 0);
01793 
01794     // Date of the request (15-MAY-2011)
01795     const Date_T lRequestDate (2011, boost::gregorian::May, 15);
01796 
01797     // Time of the request (10:00)
01798     const Duration_T lRequestTime (10, 0, 0);
01799 
01800     // Date-time of the request (made of the date and time above)
01801     const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
01802 
01803     // Preferred cabin (also named class of service sometimes)
01804     const CabinCode_T lPreferredCabin (CABIN_ECO);
01805 
01806     // Number of persons in the party
01807     const PartySize_T lPartySize (3);
01808 
01809     // Channel (direct/indirect, on-line/off-line)
01810     const ChannelLabel_T lChannel (CHANNEL_DN);
01811 
01812     // Type of the trip (one-way, inbound/outbound of a return trip)
01813     const TripType_T lTripType (TRIP_TYPE_INBOUND);
01814 
01815     // Duration of the stay (expressed as a number of days)
01816     const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
01817 
01818     // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
01819     const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
01820 
01821     // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
01822     const WTP_T lWTP (DEFAULT_WTP);
01823 
01824     // Value of time, for the customer (expressed in monetary unit per
01825     // unit of time, e.g., EUR/hour)
01826     const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
01827 
01828     // Restrictions
01829     const ChangeFees_T lChangeFees = false;
01830     const Disutility_T lChangeFeeDisutility = 30;
01831     const NonRefundable_T lNonRefundable = false;
01832     const Disutility_T lNonRefundableDisutility = 50;
01833 
01834     // Creation of the booking request structure
01835     BookingRequestStruct oBookingRequest (lOrigin, lDestination, lPOS,
01836                                           lPreferredDepartureDate,
01837                                           lRequestDateTime,
01838                                           lPreferredCabin,
01839                                           lPartySize, lChannel,
01840                                           lTripType, lStayDuration,
01841                                           lFrequentFlyerType,
01842                                           lPreferredDepartureTime,
01843                                           lWTP, lValueOfTime,
01844                                           lChangeFees, lChangeFeeDisutility,
01845                                           lNonRefundable,
01846                                           lNonRefundableDisutility);
01847 
01848     return oBookingRequest;
01849   }
01850 
01851   // //////////////////////////////////////////////////////////////////////
01852   BookingRequestStruct CmdBomManager::buildSampleBookingRequestForCRS() {
01853     // Origin
01854     const AirportCode_T lOrigin (AIRPORT_SIN);
01855 
01856     // Destination
01857     const AirportCode_T lDestination (AIRPORT_BKK);
01858 
01859     // Point of Sale (POS)
01860     const CityCode_T lPOS (POS_SIN);
01861 
01862     // Preferred departure date (30-JAN-2010)
01863     const Date_T lPreferredDepartureDate (2010, boost::gregorian::Jan, 30);
01864 
01865     // Preferred departure time (10:00)
01866     const Duration_T lPreferredDepartureTime (10, 0, 0);
01867 
01868     // Date of the request (22-JAN-2010)
01869     const Date_T lRequestDate (2010, boost::gregorian::Jan, 22);
01870 
01871     // Time of the request (10:00)
01872     const Duration_T lRequestTime (10, 0, 0);
01873 
01874     // Date-time of the request (made of the date and time above)
01875     const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
01876 
01877     // Preferred cabin (also named class of service sometimes)
01878     const CabinCode_T lPreferredCabin (CABIN_ECO);
01879 
01880     // Number of persons in the party
01881     const PartySize_T lPartySize (3);
01882 
01883     // Channel (direct/indirect, on-line/off-line)
01884     const ChannelLabel_T lChannel (CHANNEL_IN);
01885 
01886     // Type of the trip (one-way, inbound/outbound of a return trip)
01887     const TripType_T lTripType (TRIP_TYPE_INBOUND);
01888 
01889     // Duration of the stay (expressed as a number of days)
01890     const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
01891 
01892     // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
01893     const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
01894 
01895     // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
01896     const WTP_T lWTP (DEFAULT_WTP);
01897 
01898     // Value of time, for the customer (expressed in monetary unit per
01899     // unit of time, e.g., EUR/hour)
01900     const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
01901 
01902     // Restrictions
01903     const ChangeFees_T lChangeFees = true;
01904     const Disutility_T lChangeFeeDisutility = 50;
01905     const NonRefundable_T lNonRefundable = true;
01906     const Disutility_T lNonRefundableDisutility = 50;
01907     
01908     // Creation of the booking request structure
01909     BookingRequestStruct oBookingRequest (lOrigin,
01910                                           lDestination,
01911                                           lPOS,
01912                                           lPreferredDepartureDate,
01913                                           lRequestDateTime,
01914                                           lPreferredCabin,
01915                                           lPartySize, lChannel,
01916                                           lTripType, lStayDuration,
01917                                           lFrequentFlyerType,
01918                                           lPreferredDepartureTime,
01919                                           lWTP, lValueOfTime,
01920                                           lChangeFees, lChangeFeeDisutility,
01921                                           lNonRefundable,
01922                                           lNonRefundableDisutility);
01923 
01924     return oBookingRequest;
01925   }
01926 
01927   // //////////////////////////////////////////////////////////////////////
01928   void CmdBomManager::
01929   buildPartnershipsSampleInventoryAndRM (BomRoot& ioBomRoot) {
01930     
01931     // Step 0.1: Inventory level
01932     // Create an Inventory for SQ
01933     const AirlineCode_T lAirlineCodeSQ ("SQ");
01934     const InventoryKey lSQKey (lAirlineCodeSQ);
01935     Inventory& lSQInv = FacBom<Inventory>::instance().create (lSQKey);
01936     FacBomManager::addToListAndMap (ioBomRoot, lSQInv);
01937     FacBomManager::linkWithParent (ioBomRoot, lSQInv);
01938 
01939     // Add the airline feature object to the SQ inventory
01940     const AirlineFeatureKey lAirlineFeatureSQKey (lAirlineCodeSQ);
01941     AirlineFeature& lAirlineFeatureSQ =
01942       FacBom<AirlineFeature>::instance().create (lAirlineFeatureSQKey);
01943     FacBomManager::setAirlineFeature (lSQInv, lAirlineFeatureSQ);
01944     FacBomManager::linkWithParent (lSQInv, lAirlineFeatureSQ);
01945     // Link the airline feature object with the top of the BOM tree
01946     FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureSQ);
01947     
01948     // Create an Inventory for CX
01949     const AirlineCode_T lAirlineCodeCX ("CX");
01950     const InventoryKey lCXKey (lAirlineCodeCX);
01951     Inventory& lCXInv = FacBom<Inventory>::instance().create (lCXKey);
01952     FacBomManager::addToListAndMap (ioBomRoot, lCXInv);
01953     FacBomManager::linkWithParent (ioBomRoot, lCXInv);
01954 
01955     // Add the airline feature object to the CX inventory
01956     const AirlineFeatureKey lAirlineFeatureCXKey (lAirlineCodeCX);
01957     AirlineFeature& lAirlineFeatureCX =
01958       FacBom<AirlineFeature>::instance().create (lAirlineFeatureCXKey);
01959     FacBomManager::setAirlineFeature (lCXInv, lAirlineFeatureCX);
01960     FacBomManager::linkWithParent (lCXInv, lAirlineFeatureCX);
01961     // Link the airline feature object with the top of the BOM tree
01962     FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureCX);
01963     
01964     // ////// SQ ///////    
01965     // Step 0.2: Flight-date level
01966     // Create a FlightDate (SQ11/08-MAR-2010) for SQ's Inventory
01967     FlightNumber_T lFlightNumber = 11;
01968     Date_T lDate (2010, 3, 8);
01969     FlightDateKey lFlightDateKey (lFlightNumber, lDate);
01970 
01971     FlightDate& lSQ11_20100308_FD =
01972       FacBom<FlightDate>::instance().create (lFlightDateKey);
01973     FacBomManager::addToListAndMap (lSQInv, lSQ11_20100308_FD);
01974     FacBomManager::linkWithParent (lSQInv, lSQ11_20100308_FD);
01975 
01976     // Create a (mkt) FlightDate (SQ1200/08-MAR-2010) for SQ's Inventory
01977     FlightNumber_T lMktFlightNumber = 1200;
01978     //lDate = Date_T (2010, 3, 8);
01979     FlightDateKey lMktFlightDateKey (lMktFlightNumber, lDate);
01980 
01981     FlightDate& lSQ1200_20100308_FD =
01982       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
01983     FacBomManager::addToListAndMap (lSQInv, lSQ1200_20100308_FD);
01984     FacBomManager::linkWithParent (lSQInv, lSQ1200_20100308_FD);
01985     
01986     // Display the flight-date
01987     // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
01988     
01989     // Step 0.3: Segment-date level
01990     // Create a first SegmentDate (SIN-BKK) for SQ's Inventory
01991     const AirportCode_T lSIN ("SIN");
01992     const AirportCode_T lBKK ("BKK");
01993     const DateOffset_T l1Day (1);
01994     const DateOffset_T l2Days (2);
01995     const Duration_T l0820 (8, 20, 0);
01996     const Duration_T l1100 (11, 0, 0);
01997     const Duration_T l0340 (3, 40, 0);
01998     SegmentDateKey lSegmentDateKey (lSIN, lBKK);
01999 
02000     SegmentDate& lSINBKKSegment =
02001       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
02002     FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINBKKSegment);
02003     FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINBKKSegment);
02004 
02005     // Add the routing leg key to the SIN-BKK segment.
02006     const std::string lSQSINRoutingLegStr = "SQ;11;2010-Mar-8;SIN";
02007     lSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
02008 
02009     // Fill the SegmentDate content
02010     lSINBKKSegment.setBoardingDate (lDate);
02011     lSINBKKSegment.setOffDate (lDate);
02012     lSINBKKSegment.setBoardingTime (l0820);
02013     lSINBKKSegment.setOffTime (l1100);
02014     lSINBKKSegment.setElapsedTime (l0340);
02015 
02016     // Create a second (mkt) SegmentDate (BKK-HKG) for SQ's Inventory
02017     const AirportCode_T lHKG ("HKG");
02018     const Duration_T l1200 (12, 0, 0);
02019     const Duration_T l1540 (15, 40, 0);
02020     const Duration_T l0240 (2, 40, 0);
02021     SegmentDateKey lMktSegmentDateKey (lBKK, lHKG);
02022 
02023     SegmentDate& lMktBKKHKGSegment =
02024       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
02025     FacBomManager::addToListAndMap (lSQ1200_20100308_FD, lMktBKKHKGSegment);
02026     FacBomManager::linkWithParent (lSQ1200_20100308_FD, lMktBKKHKGSegment); 
02027 
02028     // Add the routing leg key CX;12;2010-Mar-8;BKK to the marketing
02029     // SQ;1200;2010-Mar-8;BKK-HKG segment.
02030     const std::string lCXBKKRoutingLegStr = "CX;12;2010-Mar-8;BKK";
02031     lMktBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
02032 
02033     // Fill the (mkt) SegmentDate content
02034     lMktBKKHKGSegment.setBoardingDate (lDate);
02035     lMktBKKHKGSegment.setOffDate (lDate);
02036     lMktBKKHKGSegment.setBoardingTime (l1200);
02037     lMktBKKHKGSegment.setOffTime (l1540);
02038     lMktBKKHKGSegment.setElapsedTime (l0240);
02039 
02040     // Step 0.4: Leg-date level
02041     // Create a first LegDate (SIN) for SQ's Inventory
02042     LegDateKey lLegDateKey (lSIN);
02043 
02044     LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
02045     FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINLeg);
02046     FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINLeg);
02047 
02048     // Fill the LegDate content
02049     lSINLeg.setOffPoint (lBKK);
02050     lSINLeg.setBoardingDate (lDate);
02051     lSINLeg.setOffDate (lDate);
02052     lSINLeg.setBoardingTime (l0820);
02053     lSINLeg.setOffTime (l1100);
02054     lSINLeg.setElapsedTime (l0340);
02055 
02056     // Step 0.5: segment-cabin level
02057     // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
02058     const CabinCode_T lY ("Y");
02059     SegmentCabinKey lYSegmentCabinKey (lY);
02060 
02061     SegmentCabin& lSINBKKSegmentYCabin =
02062       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
02063     FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
02064     FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
02065 
02066     // Create a SegmentCabin (Y) for the (mkt) Segment BKK-HKG of SQ's Inventory
02067     SegmentCabin& lMktBKKHKGSegmentYCabin =
02068       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
02069     FacBomManager::addToListAndMap (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
02070     FacBomManager::linkWithParent (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
02071 
02072 
02073     // Step 0.6: leg-cabin level
02074     // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
02075     LegCabinKey lYLegCabinKey (lY);
02076 
02077     LegCabin& lSINLegYCabin =
02078       FacBom<LegCabin>::instance().create (lYLegCabinKey);
02079     FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
02080     FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
02081 
02082     CabinCapacity_T lCapacity (100);
02083     lSINLegYCabin.setCapacities (lCapacity);
02084     lSINLegYCabin.setAvailabilityPool (lCapacity);
02085 
02086 
02087     // Step 0.7: fare family level
02088     // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
02089     const FamilyCode_T l1 ("EcoSaver");
02090     FareFamilyKey l1FareFamilyKey (l1);
02091 
02092     FareFamily& lSINBKKSegmentYCabin1Family =
02093       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
02094     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
02095                                     lSINBKKSegmentYCabin1Family);
02096     FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
02097                                    lSINBKKSegmentYCabin1Family);
02098 
02099     // Create a FareFamily (1) for the (mkt) Segment BKK-HKG, cabin Y on SQ's Inv
02100     FareFamily& lMktBKKHKGSegmentYCabin1Family =
02101       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
02102     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
02103                                     lMktBKKHKGSegmentYCabin1Family);
02104     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin,
02105                                     lMktBKKHKGSegmentYCabin1Family);
02106     
02107     // Step 0.8: booking class level
02108     // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
02109     // fare family 1 on SQ's Inv
02110     BookingClassKey lYBookingClassKey (lY);
02111 
02112     BookingClass& lSINBKKSegmentYCabin1FamilyYClass =
02113       FacBom<BookingClass>::instance().create (lYBookingClassKey);
02114     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
02115                                     lSINBKKSegmentYCabin1FamilyYClass);
02116     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
02117                                    lSINBKKSegmentYCabin1FamilyYClass);
02118 
02119     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
02120                                     lSINBKKSegmentYCabin1FamilyYClass);
02121     FacBomManager::addToListAndMap (lSINBKKSegment,
02122                                     lSINBKKSegmentYCabin1FamilyYClass);
02123 
02124     lSINBKKSegmentYCabin1FamilyYClass.setYield(700);
02125 
02126     // Create a BookingClass (Y) for the (mkt) Segment BKK-HKG, cabin Y,
02127     // fare family 1 on SQ's Inv
02128     BookingClass& lMktBKKHKGSegmentYCabin1FamilyYClass =
02129       FacBom<BookingClass>::instance().create (lYBookingClassKey);
02130     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
02131                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
02132     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
02133                                    lMktBKKHKGSegmentYCabin1FamilyYClass);
02134 
02135     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
02136                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
02137     FacBomManager::addToListAndMap (lMktBKKHKGSegment,
02138                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
02139 
02140     lMktBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
02141 
02142    
02143     // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
02144     // fare family 1 on SQ's Inv
02145     const ClassCode_T lM ("M");
02146     BookingClassKey lMBookingClassKey (lM);
02147 
02148     BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
02149       FacBom<BookingClass>::instance().create (lMBookingClassKey);
02150     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
02151                                     lSINBKKSegmentYCabin1FamilyMClass);
02152     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
02153                                    lSINBKKSegmentYCabin1FamilyMClass);
02154 
02155     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
02156                                     lSINBKKSegmentYCabin1FamilyMClass);
02157     FacBomManager::addToListAndMap (lSINBKKSegment,
02158                                     lSINBKKSegmentYCabin1FamilyMClass);
02159 
02160     lSINBKKSegmentYCabin1FamilyMClass.setYield(500);
02161 
02162     // Create a BookingClass (M) for the (mkt) Segment BKK-HKG, cabin Y,
02163     // fare family 1 on SQ's Inv
02164     BookingClass& lMktBKKHKGSegmentYCabin1FamilyMClass =
02165       FacBom<BookingClass>::instance().create (lMBookingClassKey);
02166     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
02167                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
02168     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
02169                                    lMktBKKHKGSegmentYCabin1FamilyMClass);
02170 
02171     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
02172                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
02173     FacBomManager::addToListAndMap (lMktBKKHKGSegment,
02174                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
02175 
02176     lMktBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
02177     
02178     /* =================================================================================== */
02179 
02180     // Step 1.0: O&D level
02181     // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK-SQ1200/08-MAR-2010/BKK-HKG)
02182     // for SQ's Inventory
02183     OnDString_T lSQSINBKKOnDStr = "SQ;11,2010-Mar-08;SIN,BKK";
02184     OnDString_T lMktSQBKKHKGOnDStr = "SQ;1200,2010-Mar-08;BKK,HKG";
02185     OnDStringList_T lOnDStringList;
02186     lOnDStringList.push_back (lSQSINBKKOnDStr);
02187     lOnDStringList.push_back (lMktSQBKKHKGOnDStr);
02188 
02189     OnDDateKey lOnDDateKey (lOnDStringList);
02190     OnDDate& lSQ_SINHKG_OnDDate =
02191       FacBom<OnDDate>::instance().create (lOnDDateKey);
02192     // Link to the inventory
02193     FacBomManager::addToListAndMap (lSQInv, lSQ_SINHKG_OnDDate);
02194     FacBomManager::linkWithParent (lSQInv, lSQ_SINHKG_OnDDate);
02195 
02196     // Add the segments
02197     FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lSINBKKSegment);
02198     FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lMktBKKHKGSegment);
02199 
02200     // Add total forecast info for cabin Y.
02201     const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
02202     const WTP_T lWTP750 = 750.0;
02203     const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
02204     lSQ_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
02205 
02206     // Add demand info (optional).
02207     // 2 legs here, so 2 CabinClassPair to add in the list.
02208     // Fist leg: cabin Y, class M.
02209     CabinClassPair_T lCC_YM1 (lY,lM);
02210     // Second leg: cabin Y, class M too.
02211     CabinClassPair_T lCC_YM2 (lY,lM);
02212     CabinClassPairList_T lCabinClassPairList;
02213     lCabinClassPairList.push_back(lCC_YM1);
02214     lCabinClassPairList.push_back(lCC_YM2);
02215     const MeanStdDevPair_T lMean20StdDev2 (20.0, 2.0);
02216     const Yield_T lYield850 = 850.0;
02217     const YieldDemandPair_T lYield850Mean20StdDev2 (lYield850, lMean20StdDev2);
02218     lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield850Mean20StdDev2);
02219     
02220     CabinClassPair_T lCC_YY1 (lY,lY);
02221     CabinClassPair_T lCC_YY2 (lY,lY);
02222     lCabinClassPairList.clear();
02223     lCabinClassPairList.push_back(lCC_YY1);
02224     lCabinClassPairList.push_back(lCC_YY2);
02225     const MeanStdDevPair_T lMean10StdDev1 (10.0, 1.0);
02226     const Yield_T lYield1200 = 1200.0;
02227     const YieldDemandPair_T lYield1200Mean10StdDev1 (lYield1200, 
02228                                                      lMean10StdDev1);
02229     lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, 
02230                                              lYield1200Mean10StdDev1);
02231 
02232     // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK) for SQ's Inventory
02233     lOnDStringList.clear();
02234     lOnDStringList.push_back (lSQSINBKKOnDStr);
02235 
02236     lOnDDateKey = OnDDateKey(lOnDStringList);
02237     OnDDate& lSQ_SINBKK_OnDDate =
02238       FacBom<OnDDate>::instance().create (lOnDDateKey);
02239     // Link to the inventory
02240     FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
02241     FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
02242 
02243     // Add the segments
02244     FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
02245 
02246     // Add total forecast info for cabin Y.
02247     const WTP_T lWTP400 = 400.0;
02248     const WTPDemandPair_T lWTP400Mean60StdDev6 (lWTP400, lMean60StdDev6);
02249     lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
02250 
02251     // Add demand info (optional).
02252     lCabinClassPairList.clear();
02253     lCabinClassPairList.push_back(lCC_YM1);
02254     const MeanStdDevPair_T lMean20StdDev1 (20.0, 1.0);
02255     const Yield_T lYield500 = 500.0;
02256     const YieldDemandPair_T lYield500Mean20StdDev1 (lYield500, lMean20StdDev1);
02257     lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 
02258                                              lYield500Mean20StdDev1);
02259 
02260     lCabinClassPairList.clear();
02261     lCabinClassPairList.push_back(lCC_YY1);
02262     const Yield_T lYield700 = 700.0;
02263     const YieldDemandPair_T lYield700Mean20StdDev1 (lYield700, lMean10StdDev1 );
02264     lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 
02265                                              lYield700Mean20StdDev1);
02266 
02267     /*******************************************************************************
02268     // Create an O&D Date (SQ1200/08-MAR-2010/BKK-HKG) for SQ's Inventory
02269     lFullKeyList.clear();
02270     lFullKeyList.push_back (lMktSQBKKHKGFullKeyStr);
02271 
02272     lOnDDateKey = OnDDateKey(lFullKeyList);
02273     OnDDate& lMktSQ_BKKHKG_OnDDate =
02274       FacBom<OnDDate>::instance().create (lOnDDateKey);
02275     // Link to the inventory
02276     FacBomManager::addToListAndMap (lSQInv, lMktSQ_BKKHKG_OnDDate);
02277     FacBomManager::linkWithParent (lSQInv, lMktSQ_BKKHKG_OnDDate);
02278 
02279     // Add the segments
02280     FacBomManager::addToListAndMap (lMktSQ_BKKHKG_OnDDate, lMktBKKHKGSegment);
02281 
02282     // Demand info is not added for purely marketed O&Ds
02283     // Add demand info
02284     // lCabinClassPairList.clear();
02285     // lCabinClassPairList.push_back(lCC_YM2);
02286     // lMktSQ_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
02287     ***********************************************************************************/
02288 
02289     
02290     // ////// CX ///////    
02291     // Step 0.2: Flight-date level
02292     // Create a FlightDate (CX12/08-MAR-2010) for CX's Inventory
02293     lFlightNumber = 12;
02294     //lDate = Date_T (2010, 2, 8);
02295     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
02296 
02297     FlightDate& lCX12_20100308_FD =
02298       FacBom<FlightDate>::instance().create (lFlightDateKey);
02299     FacBomManager::addToListAndMap (lCXInv, lCX12_20100308_FD);
02300     FacBomManager::linkWithParent (lCXInv, lCX12_20100308_FD);
02301 
02302     // Create a (mkt) FlightDate (CX1100/08-FEB-2010) for CX's Inventory
02303     lFlightNumber = 1100;
02304     //lDate = Date_T (2010, 2, 8);
02305     lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
02306 
02307     FlightDate& lCX1100_20100308_FD =
02308       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
02309     FacBomManager::addToListAndMap (lCXInv, lCX1100_20100308_FD);
02310     FacBomManager::linkWithParent (lCXInv, lCX1100_20100308_FD);
02311     
02312     // Display the flight-date
02313     // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
02314 
02315     // Step 0.3: Segment-date level
02316     // Create a SegmentDate BKK-HKG for CX's Inventory
02317     
02318     lSegmentDateKey = SegmentDateKey (lBKK, lHKG);
02319 
02320     SegmentDate& lBKKHKGSegment =
02321       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
02322     FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKHKGSegment);
02323     FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKHKGSegment);  
02324 
02325     // Add the routing leg key to the marketing BKK-HKG segment.
02326     lBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
02327 
02328     // Fill the SegmentDate content
02329     lBKKHKGSegment.setBoardingDate (lDate);
02330     lBKKHKGSegment.setOffDate (lDate);
02331     lBKKHKGSegment.setBoardingTime (l1200);
02332     lBKKHKGSegment.setOffTime (l1540);
02333     lBKKHKGSegment.setElapsedTime (l0240);
02334 
02335     // Create a second (mkt) SegmentDate (SIN-BKK) for CX's Inventory
02336     lMktSegmentDateKey = SegmentDateKey (lSIN, lBKK);
02337 
02338     SegmentDate& lMktSINBKKSegment =
02339       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
02340     FacBomManager::addToListAndMap (lCX1100_20100308_FD, lMktSINBKKSegment);
02341     FacBomManager::linkWithParent (lCX1100_20100308_FD, lMktSINBKKSegment);
02342 
02343     // Add the routing leg key SQ;11;2010-Mar-8;SIN to the marketing
02344     // CX;1100;2010-Mar-8;SIN-BKK segment.
02345     lMktSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
02346 
02347     // Fill the (mkt) SegmentDate content
02348     lMktSINBKKSegment.setBoardingDate (lDate);
02349     lMktSINBKKSegment.setOffDate (lDate);
02350     lMktSINBKKSegment.setBoardingTime (l0820);
02351     lMktSINBKKSegment.setOffTime (l1100);
02352     lMktSINBKKSegment.setElapsedTime (l0340);
02353 
02354     // Step 0.4: Leg-date level
02355     // Create a LegDate (BKK) for CX's Inventory
02356     lLegDateKey = LegDateKey (lBKK);
02357 
02358     LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
02359     FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKLeg);
02360     FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKLeg);
02361 
02362     // Fill the LegDate content
02363     lBKKLeg.setOffPoint (lHKG);
02364     lBKKLeg.setBoardingDate (lDate);
02365     lBKKLeg.setOffDate (lDate);
02366     lBKKLeg.setBoardingTime (l1200);
02367     lBKKLeg.setOffTime (l1540);
02368     lBKKLeg.setElapsedTime (l0240);
02369 
02370     // Display the leg-date
02371     // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
02372 
02373     // Step 0.5: segment-cabin level
02374     // Create a SegmentCabin (Y) for the Segment BKK-HKG of CX's Inventory
02375     SegmentCabin& lBKKHKGSegmentYCabin =
02376       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
02377     FacBomManager::addToListAndMap (lBKKHKGSegment, lBKKHKGSegmentYCabin);
02378     FacBomManager::linkWithParent (lBKKHKGSegment, lBKKHKGSegmentYCabin);
02379 
02380     // Create a SegmentCabin (Y) for the (mkt) Segment SIN-BKK of CX's Inventory
02381     SegmentCabin& lMktSINBKKSegmentYCabin =
02382       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
02383     FacBomManager::addToListAndMap (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
02384     FacBomManager::linkWithParent (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
02385 
02386     // Step 0.6: leg-cabin level
02387     // Create a LegCabin (Y) for the Leg BKK-HKG on CX's Inventory
02388     LegCabin& lBKKLegYCabin =
02389       FacBom<LegCabin>::instance().create (lYLegCabinKey);
02390     FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
02391     FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
02392 
02393     lCapacity = CabinCapacity_T(100);
02394     lBKKLegYCabin.setCapacities (lCapacity);
02395     lBKKLegYCabin.setAvailabilityPool (lCapacity);
02396 
02397     // Step 0.7: fare family level
02398     // Create a fareFamily (1) for the Segment BKK-HKG, cabin Y on CX's Inv
02399     FareFamily& lBKKHKGSegmentYCabin1Family =
02400       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
02401     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
02402                                     lBKKHKGSegmentYCabin1Family);
02403     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin,
02404                                    lBKKHKGSegmentYCabin1Family);
02405 
02406     // Create a FareFamily (1) for the (mkt) Segment SIN-BKK, cabin Y on CX's Inv
02407     FareFamily& lMktSINBKKSegmentYCabin1Family =
02408       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
02409     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
02410                                     lMktSINBKKSegmentYCabin1Family);
02411     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin,
02412                                    lMktSINBKKSegmentYCabin1Family);
02413 
02414     
02415     // Step 0.8: booking class level
02416     // Create a BookingClass (Y) for the
02417     // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
02418     BookingClass& lBKKHKGSegmentYCabin1FamilyYClass =
02419       FacBom<BookingClass>::instance().create (lYBookingClassKey);
02420     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
02421                                     lBKKHKGSegmentYCabin1FamilyYClass);
02422     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
02423                                    lBKKHKGSegmentYCabin1FamilyYClass);
02424 
02425     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
02426                                     lBKKHKGSegmentYCabin1FamilyYClass);
02427     FacBomManager::addToListAndMap (lBKKHKGSegment,
02428                                     lBKKHKGSegmentYCabin1FamilyYClass);
02429 
02430     lBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
02431 
02432     // Create a BookingClass (Y) for the (mkt) Segment SIN-BKK, cabin Y,
02433     // fare family 1 on CX's Inv
02434     BookingClass& lMktSINBKKSegmentYCabin1FamilyYClass =
02435       FacBom<BookingClass>::instance().create (lYBookingClassKey);
02436     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
02437                                     lMktSINBKKSegmentYCabin1FamilyYClass);
02438     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
02439                                    lMktSINBKKSegmentYCabin1FamilyYClass);
02440 
02441     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
02442                                     lMktSINBKKSegmentYCabin1FamilyYClass);
02443     FacBomManager::addToListAndMap (lMktSINBKKSegment,
02444                                     lMktSINBKKSegmentYCabin1FamilyYClass);
02445 
02446     lMktSINBKKSegmentYCabin1FamilyYClass.setYield(700);
02447     
02448     //Create a BookingClass (M) for the
02449     // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
02450     BookingClass& lBKKHKGSegmentYCabin1FamilyMClass =
02451       FacBom<BookingClass>::instance().create (lMBookingClassKey);
02452     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
02453                                     lBKKHKGSegmentYCabin1FamilyMClass);
02454     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
02455                                    lBKKHKGSegmentYCabin1FamilyMClass);
02456 
02457     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
02458                                     lBKKHKGSegmentYCabin1FamilyMClass);
02459     FacBomManager::addToListAndMap (lBKKHKGSegment,
02460                                     lBKKHKGSegmentYCabin1FamilyMClass);
02461 
02462     lBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
02463 
02464     // Create a BookingClass (M) for the (mkt) Segment SIN-BKK, cabin Y,
02465     // fare family 1 on CX's Inv
02466     BookingClass& lMktSINBKKSegmentYCabin1FamilyMClass =
02467       FacBom<BookingClass>::instance().create (lMBookingClassKey);
02468     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
02469                                     lMktSINBKKSegmentYCabin1FamilyMClass);
02470     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
02471                                    lMktSINBKKSegmentYCabin1FamilyMClass);
02472 
02473     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
02474                                     lMktSINBKKSegmentYCabin1FamilyMClass);
02475     FacBomManager::addToListAndMap (lMktSINBKKSegment,
02476                                     lMktSINBKKSegmentYCabin1FamilyMClass);
02477 
02478     lMktSINBKKSegmentYCabin1FamilyMClass.setYield(500);
02479 
02480     /* =================================================================================== */
02481 
02482     // Step 1.0: O&D level
02483     // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK-CX12/08-MAR-2010/BKK-HKG) for CX's Inventory
02484     OnDString_T lMktCXSINBKKOnDStr = "CX;1100,2010-Mar-08;SIN,BKK";
02485     OnDString_T lCXBKKHKGOnDStr = "CX;12,2010-Mar-08;BKK,HKG";
02486     lOnDStringList.clear();
02487     lOnDStringList.push_back (lMktCXSINBKKOnDStr);
02488     lOnDStringList.push_back (lCXBKKHKGOnDStr);
02489 
02490     lOnDDateKey = OnDDateKey(lOnDStringList);
02491     OnDDate& lCX_SINHKG_OnDDate =
02492       FacBom<OnDDate>::instance().create (lOnDDateKey);
02493     // Link to the inventory
02494     FacBomManager::addToListAndMap (lCXInv, lCX_SINHKG_OnDDate);
02495     FacBomManager::linkWithParent (lCXInv, lCX_SINHKG_OnDDate);
02496 
02497     // Add the segments
02498     FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lMktSINBKKSegment);
02499     FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lBKKHKGSegment);
02500 
02501     // Add total forecast info for cabin Y.
02502     lCX_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
02503     
02504     // Add demand info
02505     lCabinClassPairList.clear();
02506     lCabinClassPairList.push_back(lCC_YM1);
02507     lCabinClassPairList.push_back(lCC_YM2);
02508     lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, 
02509                                              lYield850Mean20StdDev2);
02510 
02511     lCabinClassPairList.clear();
02512     lCabinClassPairList.push_back(lCC_YY1);
02513     lCabinClassPairList.push_back(lCC_YY2);
02514     lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, 
02515                                              lYield1200Mean10StdDev1);
02516 
02517     /***********************************************************************************
02518     // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK) for CX's Inventory
02519     lFullKeyList.clear();
02520     lFullKeyList.push_back (lMktCXSINBKKFullKeyStr);
02521 
02522     lOnDDateKey = OnDDateKey(lFullKeyList);
02523     OnDDate& lMktCX_SINBKK_OnDDate =
02524       FacBom<OnDDate>::instance().create (lOnDDateKey);
02525     // Link to the inventory
02526     FacBomManager::addToListAndMap (lCXInv, lMktCX_SINBKK_OnDDate);
02527     FacBomManager::linkWithParent (lCXInv, lMktCX_SINBKK_OnDDate);
02528 
02529     // Add the segments
02530     FacBomManager::addToListAndMap (lMktCX_SINBKK_OnDDate, lMktSINBKKSegment);
02531 
02532     // Demand info is not added for purely marketed O&Ds
02533     // Add demand info
02534     // lCabinClassPairList.clear();
02535     // lCabinClassPairList.push_back(lCC_YM1);
02536     // lMktCX_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
02537     *************************************************************************************/
02538     
02539     // Create an O&D Date (CX12/08-FEB-2010/BKK-HKG) for CX's Inventory
02540     lOnDStringList.clear();
02541     lOnDStringList.push_back (lCXBKKHKGOnDStr);
02542 
02543     lOnDDateKey = OnDDateKey(lOnDStringList);
02544     OnDDate& lCX_BKKHKG_OnDDate =
02545       FacBom<OnDDate>::instance().create (lOnDDateKey);
02546     // Link to the inventory
02547     FacBomManager::addToListAndMap (lCXInv, lCX_BKKHKG_OnDDate);
02548     FacBomManager::linkWithParent (lCXInv, lCX_BKKHKG_OnDDate);
02549 
02550     // Add the segments
02551     FacBomManager::addToListAndMap (lCX_BKKHKG_OnDDate, lBKKHKGSegment);
02552 
02553     // Add total forecast info for cabin Y.
02554     lCX_BKKHKG_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
02555 
02556     // Add demand info
02557     lCabinClassPairList.clear();
02558     lCabinClassPairList.push_back(lCC_YM2);
02559     lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 
02560                                              lYield500Mean20StdDev1);
02561 
02562     lCabinClassPairList.clear();
02563     lCabinClassPairList.push_back(lCC_YY2);
02564     const YieldDemandPair_T lYield700Mean10StdDev1 (lYield700, lMean10StdDev1 );
02565     lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 
02566                                              lYield700Mean10StdDev1);
02567 
02568     /*================================================================================
02569       ================================================================================
02570       ================================================================================*/
02571     // Schedule:
02572     // SQ:
02573     // Step 1: flight period level
02574     // Create a flight period for SQ11:
02575     const DoWStruct lDoWSrtuct ("1111111");
02576     const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 8);
02577     const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 9);
02578     const DatePeriod_T lDatePeriod (lDateRangeStart, lDateRangeEnd);
02579     const PeriodStruct lPeriodStruct (lDatePeriod,lDoWSrtuct);
02580 
02581     lFlightNumber = FlightNumber_T (11);
02582 
02583     FlightPeriodKey lFlightPeriodKey (lFlightNumber, lPeriodStruct);
02584 
02585     FlightPeriod& lSQ11FlightPeriod =
02586       FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
02587     FacBomManager::addToListAndMap (lSQInv, lSQ11FlightPeriod);
02588     FacBomManager::linkWithParent (lSQInv, lSQ11FlightPeriod);
02589 
02590     // Step 2: segment period level
02591     // Create a segment period for SIN-BKK:
02592 
02593     SegmentPeriodKey lSegmentPeriodKey (lSIN, lBKK);
02594 
02595     SegmentPeriod& lSINBKKSegmentPeriod =
02596       FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
02597     FacBomManager::addToListAndMap (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
02598     FacBomManager::linkWithParent (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
02599 
02600     lSINBKKSegmentPeriod.setBoardingTime (l0820);
02601     lSINBKKSegmentPeriod.setOffTime (l1100);
02602     lSINBKKSegmentPeriod.setElapsedTime (l0340);
02603     ClassList_String_T lYM ("YM");
02604     lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYM);
02605 
02606     // CX:
02607     // Step 1: flight period level
02608     // Create a flight period for CX12:  
02609     lFlightNumber = FlightNumber_T (12);
02610 
02611     lFlightPeriodKey = FlightPeriodKey(lFlightNumber, lPeriodStruct);
02612 
02613     FlightPeriod& lCX12FlightPeriod =
02614       FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
02615     FacBomManager::addToListAndMap (lCXInv, lCX12FlightPeriod);
02616     FacBomManager::linkWithParent (lCXInv, lCX12FlightPeriod);
02617 
02618     // Step 2: segment period level
02619     // Create a segment period for BKK-HKG:
02620 
02621     lSegmentPeriodKey = SegmentPeriodKey (lBKK, lHKG);
02622 
02623     SegmentPeriod& lBKKHKGSegmentPeriod =
02624       FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
02625     FacBomManager::addToListAndMap (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
02626     FacBomManager::linkWithParent (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
02627 
02628     lBKKHKGSegmentPeriod.setBoardingTime (l1200);
02629     lBKKHKGSegmentPeriod.setOffTime (l1540);
02630     lBKKHKGSegmentPeriod.setElapsedTime (l0240);
02631     lBKKHKGSegmentPeriod.addCabinBookingClassList (lY,lYM);
02632     
02633   }
02634 
02635   // //////////////////////////////////////////////////////////////////////
02636   void CmdBomManager::buildPartnershipsSamplePricing (BomRoot& ioBomRoot) {
02637 
02639 
02640     /*===================================================================================*/
02641     // First airport pair SIN-BKK.
02642     // Set the airport-pair primary key.
02643     AirportPairKey lAirportPairKey ("SIN", "BKK");
02644     
02645     // Create the AirportPairKey object and link it to the ioBomRoot object.
02646     AirportPair& lSINBKKAirportPair =
02647       FacBom<AirportPair>::instance().create (lAirportPairKey);
02648     FacBomManager::addToListAndMap (ioBomRoot, lSINBKKAirportPair);
02649     FacBomManager::linkWithParent (ioBomRoot, lSINBKKAirportPair);
02650 
02651     // Set the fare date-period primary key.
02652     const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 01);
02653     const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 31);
02654     const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
02655     const DatePeriodKey lDatePeriodKey (lDateRange);
02656 
02657     // Create the DatePeriodKey object and link it to the PosChannel object.
02658     DatePeriod& lSINBKKDatePeriod =
02659       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02660     FacBomManager::addToListAndMap (lSINBKKAirportPair, lSINBKKDatePeriod);
02661     FacBomManager::linkWithParent (lSINBKKAirportPair, lSINBKKDatePeriod);    
02662 
02663     // Set the point-of-sale-channel primary key.
02664     PosChannelKey lPosChannelKey ("SIN","IN");  
02665     
02666     // Create the PositionKey object and link it to the AirportPair object.
02667     PosChannel& lSINPosChannel =
02668       FacBom<PosChannel>::instance().create (lPosChannelKey);
02669     FacBomManager::addToListAndMap (lSINBKKDatePeriod, lSINPosChannel);
02670     FacBomManager::linkWithParent (lSINBKKDatePeriod, lSINPosChannel);
02671    
02672     // Set the fare time-period primary key.
02673     const Time_T lTimeRangeStart (0, 0, 0);
02674     const Time_T lTimeRangeEnd (23, 0, 0);
02675     const TimePeriodKey lFareTimePeriodKey (lTimeRangeStart,
02676                                             lTimeRangeEnd);
02677 
02678     // Create the TimePeriodKey and link it to the DatePeriod object.
02679     TimePeriod& lSINBKKFareTimePeriod =
02680       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02681     FacBomManager::addToListAndMap (lSINPosChannel, lSINBKKFareTimePeriod);
02682     FacBomManager::linkWithParent (lSINPosChannel, lSINBKKFareTimePeriod); 
02683 
02684     // Generate the FareRule
02685     const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ONE_WAY,
02686                                             NO_ADVANCE_PURCHASE,
02687                                             SATURDAY_STAY,
02688                                             CHANGE_FEES,
02689                                             NON_REFUNDABLE,
02690                                             NO_STAY_DURATION);
02691 
02692     // Create the FareFeaturesKey and link it to the TimePeriod object.
02693     FareFeatures& lSINBKKFareFeatures =
02694       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02695     FacBomManager::addToListAndMap (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
02696     FacBomManager::linkWithParent (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
02697 
02698     // Generate Segment Features and link them to their FareRule.
02699     AirlineCodeList_T lSQAirlineCodeList;
02700     lSQAirlineCodeList.push_back ("SQ");
02701     
02702     ClassList_StringList_T lYClassCodeList;
02703     lYClassCodeList.push_back ("Y");    
02704     const AirlineClassListKey lSQAirlineYClassListKey (lSQAirlineCodeList,
02705                                                        lYClassCodeList);
02706 
02707     ClassList_StringList_T lMClassCodeList;
02708     lMClassCodeList.push_back ("M");
02709     const AirlineClassListKey lSQAirlineMClassListKey (lSQAirlineCodeList,
02710                                                        lMClassCodeList);
02711 
02712     // Create the AirlineClassListKey and link it to the FareFeatures object.
02713     AirlineClassList& lSQAirlineYClassList =
02714       FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
02715     lSQAirlineYClassList.setFare(700);
02716     FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineYClassList);
02717     FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineYClassList);
02718 
02719     AirlineClassList& lSQAirlineMClassList =
02720       FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
02721     lSQAirlineMClassList.setFare(500);
02722     FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineMClassList);
02723     FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineMClassList);
02724 
02725     /*===================================================================================*/
02726     // Second airport pair BKK-HKG.
02727     // Set the airport-pair primary key.
02728     lAirportPairKey = AirportPairKey ("BKK", "HKG");
02729     
02730     // Create the AirportPairKey object and link it to the ioBomRoot object.
02731     AirportPair& lBKKHKGAirportPair =
02732       FacBom<AirportPair>::instance().create (lAirportPairKey);
02733     FacBomManager::addToListAndMap (ioBomRoot, lBKKHKGAirportPair);
02734     FacBomManager::linkWithParent (ioBomRoot, lBKKHKGAirportPair);
02735 
02736     // Set the fare date-period primary key.
02737     // Use the same as previously.
02738 
02739     // Create the DatePeriodKey object and link it to the PosChannel object.
02740     DatePeriod& lBKKHKGDatePeriod =
02741       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02742     FacBomManager::addToListAndMap (lBKKHKGAirportPair, lBKKHKGDatePeriod);
02743     FacBomManager::linkWithParent (lBKKHKGAirportPair, lBKKHKGDatePeriod);    
02744 
02745     // Set the point-of-sale-channel primary key.
02746     lPosChannelKey  = PosChannelKey("BKK","IN");  
02747     
02748     // Create the PositionKey object and link it to the AirportPair object.
02749     PosChannel& lBKKPosChannel =
02750       FacBom<PosChannel>::instance().create (lPosChannelKey);
02751     FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lBKKPosChannel);
02752     FacBomManager::linkWithParent (lBKKHKGDatePeriod, lBKKPosChannel);
02753    
02754     // Set the fare time-period primary key.
02755     // Use the same as previously.
02756 
02757     // Create the TimePeriodKey and link it to the DatePeriod object.
02758     TimePeriod& lBKKHKGFareTimePeriod =
02759       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02760     FacBomManager::addToListAndMap (lBKKPosChannel, lBKKHKGFareTimePeriod);
02761     FacBomManager::linkWithParent (lBKKPosChannel, lBKKHKGFareTimePeriod);
02762 
02763     // Generate the FareRule
02764     // Use the same key as previously.
02765 
02766     // Create the FareFeaturesKey and link it to the TimePeriod object.
02767     FareFeatures& lBKKHKGFareFeatures =
02768       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02769     FacBomManager::addToListAndMap (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
02770     FacBomManager::linkWithParent (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
02771 
02772     // Generate Segment Features and link them to their FareRule.
02773     AirlineCodeList_T lCXAirlineCodeList;
02774     lCXAirlineCodeList.push_back ("CX");
02775     
02776     const AirlineClassListKey lCXAirlineYClassListKey (lCXAirlineCodeList,
02777                                                        lYClassCodeList);
02778 
02779     const AirlineClassListKey lCXAirlineMClassListKey (lCXAirlineCodeList,
02780                                                        lMClassCodeList);
02781 
02782     // Create the AirlineClassListKey and link it to the FareFeatures object.
02783     AirlineClassList& lCXAirlineYClassList =
02784       FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
02785     lCXAirlineYClassList.setFare(700);
02786     FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineYClassList);
02787     FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineYClassList);
02788     
02789     AirlineClassList& lCXAirlineMClassList =
02790       FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
02791     lCXAirlineMClassList.setFare(500);
02792     FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineMClassList);
02793     FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineMClassList);
02794 
02795     /*===================================================================================*/
02796     // Third airport pair SIN-HKG.
02797     // Set the airport-pair primary key.
02798     lAirportPairKey = AirportPairKey ("SIN", "HKG");
02799     
02800     // Create the AirportPairKey object and link it to the ioBomRoot object.
02801     AirportPair& lSINHKGAirportPair =
02802       FacBom<AirportPair>::instance().create (lAirportPairKey);
02803     FacBomManager::addToListAndMap (ioBomRoot, lSINHKGAirportPair);
02804     FacBomManager::linkWithParent (ioBomRoot, lSINHKGAirportPair);
02805 
02806     // Set the fare date-period primary key.
02807     // Use the same as previously.
02808 
02809     // Create the DatePeriodKey object and link it to the PosChannel object.
02810     DatePeriod& lSINHKGDatePeriod =
02811       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02812     FacBomManager::addToListAndMap (lSINHKGAirportPair, lSINHKGDatePeriod);
02813     FacBomManager::linkWithParent (lSINHKGAirportPair, lSINHKGDatePeriod);    
02814 
02815     // Set the point-of-sale-channel primary key.
02816     lPosChannelKey = PosChannelKey("SIN","IN");  
02817     
02818     // Create the PositionKey object and link it to the AirportPair object.
02819     PosChannel& lOnDSINPosChannel =
02820       FacBom<PosChannel>::instance().create (lPosChannelKey);
02821     FacBomManager::addToListAndMap (lSINHKGDatePeriod, lOnDSINPosChannel);
02822     FacBomManager::linkWithParent (lSINHKGDatePeriod, lOnDSINPosChannel);
02823    
02824     // Set the fare time-period primary key.
02825     // Use the same as previously.
02826 
02827     // Create the TimePeriodKey and link it to the DatePeriod object.
02828     TimePeriod& lSINHKGFareTimePeriod =
02829       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02830     FacBomManager::addToListAndMap (lOnDSINPosChannel, lSINHKGFareTimePeriod);
02831     FacBomManager::linkWithParent (lOnDSINPosChannel, lSINHKGFareTimePeriod);
02832 
02833     // Generate the FareRule
02834     // Use the same key as previously.
02835 
02836     // Create the FareFeaturesKey and link it to the TimePeriod object.
02837     FareFeatures& lSINHKGFareFeatures =
02838       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02839     FacBomManager::addToListAndMap (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
02840     FacBomManager::linkWithParent (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
02841 
02842     // Generate Segment Features and link them to their FareRule.
02843     AirlineCodeList_T lSQ_CXAirlineCodeList;
02844     lSQ_CXAirlineCodeList.push_back ("SQ");
02845     lSQ_CXAirlineCodeList.push_back ("CX");
02846 
02847     ClassList_StringList_T lY_YClassCodeList;
02848     lY_YClassCodeList.push_back ("Y");
02849     lY_YClassCodeList.push_back ("Y");
02850     const AirlineClassListKey lSQ_CXAirlineYClassListKey (lSQ_CXAirlineCodeList,
02851                                                           lY_YClassCodeList);
02852 
02853     ClassList_StringList_T lM_MClassCodeList;
02854     lM_MClassCodeList.push_back ("M");
02855     lM_MClassCodeList.push_back ("M");
02856     const AirlineClassListKey lSQ_CXAirlineMClassListKey (lSQ_CXAirlineCodeList,
02857                                                           lM_MClassCodeList);
02858 
02859     // Create the AirlineClassListKey and link it to the FareFeatures object.
02860     AirlineClassList& lSQ_CXAirlineYClassList =
02861       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
02862     lSQ_CXAirlineYClassList.setFare(1200);
02863     FacBomManager::addToListAndMap (lSINHKGFareFeatures, 
02864                                     lSQ_CXAirlineYClassList);
02865     FacBomManager::linkWithParent (lSINHKGFareFeatures, 
02866                                    lSQ_CXAirlineYClassList);
02867     
02868     AirlineClassList& lSQ_CXAirlineMClassList =
02869       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
02870     lSQ_CXAirlineMClassList.setFare(850);
02871     FacBomManager::addToListAndMap (lSINHKGFareFeatures, 
02872                                     lSQ_CXAirlineMClassList);
02873     FacBomManager::linkWithParent (lSINHKGFareFeatures, 
02874                                    lSQ_CXAirlineMClassList);
02875 
02876 
02878 
02879     /*===================================================================================*/
02880 
02881     // Use the same airport pair, and date period for adding SQ SIN-BKK yields.
02882     
02883     // Set the point-of-sale-channel primary key.
02884     lPosChannelKey = PosChannelKey(DEFAULT_POS, DEFAULT_CHANNEL);  
02885     
02886     // Create the PositionKey object and link it to the AirportPair object.
02887     PosChannel& lRAC_SINBKKPosChannel =
02888       FacBom<PosChannel>::instance().create (lPosChannelKey);
02889     FacBomManager::addToListAndMap (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
02890     FacBomManager::linkWithParent (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
02891    
02892     // Set the yield time-period primary key.
02893     const TimePeriodKey lYieldTimePeriodKey (lTimeRangeStart,
02894                                             lTimeRangeEnd);
02895 
02896     // Create the TimePeriodKey and link it to the DatePeriod object.
02897     TimePeriod& lSINBKKYieldTimePeriod =
02898       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
02899     FacBomManager::addToListAndMap (lRAC_SINBKKPosChannel, 
02900                                     lSINBKKYieldTimePeriod);
02901     FacBomManager::linkWithParent (lRAC_SINBKKPosChannel, 
02902                                    lSINBKKYieldTimePeriod);        
02903 
02904     // Generate the YieldRule
02905     const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
02906                                               CABIN_Y);
02907 
02908     // Create the YieldFeaturesKey and link it to the TimePeriod object.
02909     YieldFeatures& lSINBKKYieldFeatures =
02910       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
02911     FacBomManager::addToListAndMap (lSINBKKYieldTimePeriod,
02912                                     lSINBKKYieldFeatures);
02913     FacBomManager::linkWithParent (lSINBKKYieldTimePeriod, 
02914                                    lSINBKKYieldFeatures);        
02915 
02916     // Generate Segment Features and link them to their YieldRule.
02917     // Use the same key as previously.
02918 
02919     // Create the AirlineClassListKey and link it to the YieldFeatures object.
02920     AirlineClassList& lRAC_SQAirlineYClassList =
02921       FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
02922     lRAC_SQAirlineYClassList.setYield(700);
02923     FacBomManager::addToListAndMap (lSINBKKYieldFeatures, 
02924                                     lRAC_SQAirlineYClassList);
02925     FacBomManager::linkWithParent (lSINBKKYieldFeatures, 
02926                                    lRAC_SQAirlineYClassList);
02927 
02928     AirlineClassList& lRAC_SQAirlineMClassList =
02929       FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
02930     lRAC_SQAirlineMClassList.setYield(500);
02931     FacBomManager::addToListAndMap (lSINBKKYieldFeatures, 
02932                                     lRAC_SQAirlineMClassList);
02933     FacBomManager::linkWithParent (lSINBKKYieldFeatures, 
02934                                    lRAC_SQAirlineMClassList);
02935 
02936     /*===================================================================================*/
02937 
02938     // Use the same airport pair, and date period for adding CX BKK-HKG yields. 
02939     
02940     // Set the point-of-sale-channel primary key.
02941     // Use the same as previously.
02942     
02943     // Create the PositionKey object and link it to the AirportPair object.
02944     PosChannel& lRAC_BKKHKGPosChannel =
02945       FacBom<PosChannel>::instance().create (lPosChannelKey);
02946     FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
02947     FacBomManager::linkWithParent (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
02948    
02949     // Set the yield time-period primary key.
02950     // Use the same as previously.
02951 
02952     // Create the TimePeriodKey and link it to the DatePeriod object.
02953     TimePeriod& lBKKHKGYieldTimePeriod =
02954       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
02955     FacBomManager::addToListAndMap (lRAC_BKKHKGPosChannel, 
02956                                     lBKKHKGYieldTimePeriod);
02957     FacBomManager::linkWithParent (lRAC_BKKHKGPosChannel, 
02958                                    lBKKHKGYieldTimePeriod);        
02959 
02960     // Generate the YieldRule
02961     // Use the same key as previously.
02962 
02963     // Create the YieldFeaturesKey and link it to the TimePeriod object.
02964     YieldFeatures& lBKKHKGYieldFeatures =
02965       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
02966     FacBomManager::addToListAndMap (lBKKHKGYieldTimePeriod, 
02967                                     lBKKHKGYieldFeatures);
02968     FacBomManager::linkWithParent (lBKKHKGYieldTimePeriod, 
02969                                    lBKKHKGYieldFeatures);        
02970 
02971     // Generate Segment Features and link them to their YieldRule.
02972     // Use the same key as previously.
02973 
02974     // Create the AirlineClassListKey and link it to the YieldFeatures object.
02975     AirlineClassList& lRAC_CXAirlineYClassList =
02976       FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
02977     lRAC_CXAirlineYClassList.setYield(700);
02978     FacBomManager::addToListAndMap (lBKKHKGYieldFeatures, 
02979                                     lRAC_CXAirlineYClassList);
02980     FacBomManager::linkWithParent (lBKKHKGYieldFeatures, 
02981                                    lRAC_CXAirlineYClassList);
02982     
02983     AirlineClassList& lRAC_CXAirlineMClassList =
02984       FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
02985     lRAC_CXAirlineMClassList.setYield(500);
02986     FacBomManager::addToListAndMap (lBKKHKGYieldFeatures, 
02987                                     lRAC_CXAirlineMClassList);
02988     FacBomManager::linkWithParent (lBKKHKGYieldFeatures, 
02989                                    lRAC_CXAirlineMClassList);
02990 
02991     /*===================================================================================*/
02992 
02993     // Use the same airport pair, and date period for SQ-CX SIN-HKG
02994 
02995     // Set the point-of-sale-channel primary key.
02996     // Use the same as previously.
02997     
02998     // Create the PositionKey object and link it to the AirportPair object.
02999     PosChannel& lRAC_SINHKGChannel =
03000       FacBom<PosChannel>::instance().create (lPosChannelKey);
03001     FacBomManager::addToListAndMap (lSINHKGDatePeriod, lRAC_SINHKGChannel);
03002     FacBomManager::linkWithParent (lSINHKGDatePeriod, lRAC_SINHKGChannel);
03003    
03004     // Set the yield time-period primary key.
03005     // Use the same as previously.
03006 
03007     // Create the TimePeriodKey and link it to the DatePeriod object.
03008     TimePeriod& lSINHKGYieldTimePeriod =
03009       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
03010     FacBomManager::addToListAndMap (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
03011     FacBomManager::linkWithParent (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);  
03012 
03013     // Generate the YieldRule
03014     // Use the same key as previously.
03015 
03016     // Create the YieldFeaturesKey and link it to the TimePeriod object.
03017     YieldFeatures& lSINHKGYieldFeatures =
03018       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
03019     FacBomManager::addToListAndMap (lSINHKGYieldTimePeriod, 
03020                                     lSINHKGYieldFeatures);
03021     FacBomManager::linkWithParent (lSINHKGYieldTimePeriod, 
03022                                    lSINHKGYieldFeatures);        
03023 
03024     // Generate Segment Features and link them to their YieldRule.
03025     // Use the same key as previously
03026     
03027     // Create the AirlineClassListKey and link it to the YieldFeatures object.
03028     AirlineClassList& lRAC_SQ_CXAirlineYClassList =
03029       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
03030     lRAC_SQ_CXAirlineYClassList.setYield(1200);
03031     FacBomManager::addToListAndMap (lSINHKGYieldFeatures, 
03032                                     lRAC_SQ_CXAirlineYClassList);
03033     FacBomManager::linkWithParent (lSINHKGYieldFeatures, 
03034                                    lRAC_SQ_CXAirlineYClassList);
03035     
03036     AirlineClassList& lRAC_SQ_CXAirlineMClassList =
03037       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
03038     lRAC_SQ_CXAirlineMClassList.setYield(850);
03039     FacBomManager::addToListAndMap (lSINHKGYieldFeatures, 
03040                                     lRAC_SQ_CXAirlineMClassList);
03041     FacBomManager::linkWithParent (lSINHKGYieldFeatures, 
03042                                    lRAC_SQ_CXAirlineMClassList);
03043     
03044   }
03045 
03046 }
03047