StdAir Logo  1.00.15
C++ Standard Airline IT Object Library
CmdBomManager.cpp
Go to the documentation of this file.
1 
5 // //////////////////////////////////////////////////////////////////////
6 // Import section
7 // //////////////////////////////////////////////////////////////////////
8 // STL
9 #include <cassert>
10 #include <sstream>
11 // StdAir
17 #include <stdair/bom/BomRoot.hpp>
18 #include <stdair/bom/Inventory.hpp>
21 #include <stdair/bom/LegDate.hpp>
22 #include <stdair/bom/LegCabin.hpp>
41 #include <stdair/bom/OnDDate.hpp>
44 
45 namespace stdair {
46 
47  // //////////////////////////////////////////////////////////////////////
48  void CmdBomManager::buildSampleBom (BomRoot& ioBomRoot) {
49 
50  // DEBUG
51  STDAIR_LOG_DEBUG ("StdAir is building the BOM tree from built-in "
52  << "specifications.");
53 
54  // ////// Basic Bom Tree ///////
55  // Build the inventory (flight-dates) and the schedule (flight period)
56  // parts.
57  buildSampleInventorySchedule (ioBomRoot);
58 
59  // Build the pricing (fare rules) and revenue accounting (yields) parts.
60  buildSamplePricing (ioBomRoot);
61 
62  // ////// Partnership Bom Tree ///////
63  // Build the inventory (flight-dates) and the schedule (flight period)
64  // parts.
65  buildPartnershipsSampleInventoryAndRM (ioBomRoot);
66 
67  // Build the pricing (fare rules) and revenue accounting (yields) parts.
68  buildPartnershipsSamplePricing (ioBomRoot);
69 
70  // Build a dummy inventory, needed by RMOL.
71  buildCompleteDummyInventory (ioBomRoot);
72 
73  // ////// Fare Families Bom Tree ///////
74  // Build the inventory (flight-dates) and the schedule (flight period)
75  // parts with fare families.
76  buildSampleInventoryScheduleForFareFamilies (ioBomRoot);
77 
78  // Build the pricing (fare rules) and revenue accounting (yields) parts.
79  buildSamplePricingForFareFamilies (ioBomRoot);
80 
81  // Build a dummy inventory, needed by RMOL.
82  buildCompleteDummyInventoryForFareFamilies (ioBomRoot);
83  }
84 
85  // //////////////////////////////////////////////////////////////////////
86  void CmdBomManager::buildSampleInventorySchedule (BomRoot& ioBomRoot) {
87 
88  // Inventory
89  // Step 0.1: Inventory level
90  // Create an Inventory for BA
91  const AirlineCode_T lAirlineCodeBA ("BA");
92  const InventoryKey lBAKey (lAirlineCodeBA);
93  Inventory& lBAInv = FacBom<Inventory>::instance().create (lBAKey);
94  FacBomManager::addToListAndMap (ioBomRoot, lBAInv);
95  FacBomManager::linkWithParent (ioBomRoot, lBAInv);
96 
97  // Add the airline feature object to the BA inventory
98  const AirlineFeatureKey lAirlineFeatureBAKey (lAirlineCodeBA);
99  AirlineFeature& lAirlineFeatureBA =
100  FacBom<AirlineFeature>::instance().create (lAirlineFeatureBAKey);
101  FacBomManager::setAirlineFeature (lBAInv, lAirlineFeatureBA);
102  FacBomManager::linkWithParent (lBAInv, lAirlineFeatureBA);
103  // Link the airline feature object with the top of the BOM tree
104  FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureBA);
105 
106  // Create an Inventory for AF
107  const AirlineCode_T lAirlineCodeAF ("AF");
108  const InventoryKey lAFKey (lAirlineCodeAF);
109  Inventory& lAFInv = FacBom<Inventory>::instance().create (lAFKey);
110  FacBomManager::addToListAndMap (ioBomRoot, lAFInv);
111  FacBomManager::linkWithParent (ioBomRoot, lAFInv);
112 
113  // Add the airline feature object to the AF inventory
114  const AirlineFeatureKey lAirlineFeatureAFKey (lAirlineCodeAF);
115  AirlineFeature& lAirlineFeatureAF =
116  FacBom<AirlineFeature>::instance().create (lAirlineFeatureAFKey);
117  FacBomManager::setAirlineFeature (lAFInv, lAirlineFeatureAF);
118  FacBomManager::linkWithParent (lAFInv, lAirlineFeatureAF);
119  // Link the airline feature object with the top of the BOM tree
120  FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureAF);
121 
122  // BA
123  // Step 0.2: Flight-date level
124  // Create a FlightDate (BA9/10-JUN-2011) for BA's Inventory
125  FlightNumber_T lFlightNumber = 9;
126  Date_T lDate (2011, 6, 10);
127  FlightDateKey lFlightDateKey (lFlightNumber, lDate);
128 
129  FlightDate& lBA9_20110610_FD =
130  FacBom<FlightDate>::instance().create (lFlightDateKey);
131  FacBomManager::addToListAndMap (lBAInv, lBA9_20110610_FD);
132  FacBomManager::linkWithParent (lBAInv, lBA9_20110610_FD);
133 
134  // Display the flight-date
135  // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
136 
137  // Step 0.3: Segment-date level
138  // Create a first SegmentDate (LHR-SYD) for BA's Inventory
139  // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=SYD&depDate=100611&SellingClass=O
140  const AirportCode_T lLHR ("LHR");
141  const AirportCode_T lSYD ("SYD");
142  const DateOffset_T l1Day (1);
143  const DateOffset_T l2Days (2);
144  const Duration_T l2135 (21, 45, 0);
145  const Duration_T l0610 (6, 10, 0);
146  //const Duration_T l2205 (22, 05, 0);
147  SegmentDateKey lSegmentDateKey (lLHR, lSYD);
148 
149  SegmentDate& lLHRSYDSegment =
150  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
151  FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRSYDSegment);
152  FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRSYDSegment);
153 
154  // Add the routing leg keys to the LHR-SYD segment.
155  const std::string lBALHRRoutingLegStr = "BA;9;2011-Jun-10;LHR";
156  const std::string lBABKKRoutingLegStr = "BA;9;2011-Jun-10;BKK";
157  lLHRSYDSegment.addLegKey (lBALHRRoutingLegStr);
158  lLHRSYDSegment.addLegKey (lBABKKRoutingLegStr);
159 
160  // Fill the SegmentDate content
161  lLHRSYDSegment.setBoardingDate (lDate);
162  lLHRSYDSegment.setOffDate (lDate + l2Days);
163  lLHRSYDSegment.setBoardingTime (l2135);
164  lLHRSYDSegment.setOffTime (l0610);
165  lLHRSYDSegment.setElapsedTime (l2135);
166 
167  // Display the segment-date
168  // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment);
169 
170  // Create a second SegmentDate (LHR-BKK) for BA's Inventory
171  // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=BKK&depDate=100611&SellingClass=O
172  const AirportCode_T lBKK ("BKK");
173  const Duration_T l1540 (15, 40, 0);
174  const Duration_T l1105 (11, 5, 0);
175  lSegmentDateKey = SegmentDateKey (lLHR, lBKK);
176 
177  SegmentDate& lLHRBKKSegment =
178  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
179  FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRBKKSegment);
180  FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRBKKSegment);
181 
182  // Add the routing leg key to the LHR-BKK segment.
183  lLHRBKKSegment.addLegKey (lBALHRRoutingLegStr);
184 
185  // Fill the SegmentDate content
186  lLHRBKKSegment.setBoardingDate (lDate);
187  lLHRBKKSegment.setOffDate (lDate + l1Day);
188  lLHRBKKSegment.setBoardingTime (l2135);
189  lLHRBKKSegment.setOffTime (l1540);
190  lLHRBKKSegment.setElapsedTime (l1105);
191 
192  // Display the segment-date
193  // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment);
194 
195  // Create a third SegmentDate (BKK-SYD) for BA's Inventory
196  // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=BKK&to=SYD&depDate=110611&SellingClass=O
197  const Duration_T l1705 (17, 5, 0);
198  const Duration_T l0905 (9, 5, 0);
199  lSegmentDateKey = SegmentDateKey (lBKK, lSYD);
200 
201  SegmentDate& lBKKSYDSegment =
202  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
203  FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKSYDSegment);
204  FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKSYDSegment);
205 
206  // Add the routing leg key to the BKK-SYD segment.
207  lBKKSYDSegment.addLegKey (lBABKKRoutingLegStr);
208 
209  // Fill the SegmentDate content
210  lBKKSYDSegment.setBoardingDate (lDate + l1Day);
211  lBKKSYDSegment.setOffDate (lDate + l2Days);
212  lBKKSYDSegment.setBoardingTime (l1705);
213  lBKKSYDSegment.setOffTime (l1540);
214  lBKKSYDSegment.setElapsedTime (l0905);
215 
216  // Display the segment-date
217  // STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment);
218 
219  // Step 0.4: Leg-date level
220  // Create a first LegDate (LHR) for BA's Inventory
221  LegDateKey lLegDateKey (lLHR);
222 
223  LegDate& lLHRLeg = FacBom<LegDate>::instance().create (lLegDateKey);
224  FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRLeg);
225  FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRLeg);
226 
227  // Fill the LegDate content
228  lLHRLeg.setOffPoint (lBKK);
229  lLHRLeg.setBoardingDate (lDate);
230  lLHRLeg.setOffDate (lDate + l1Day);
231  lLHRLeg.setBoardingTime (l2135);
232  lLHRLeg.setOffTime (l1540);
233  lLHRLeg.setElapsedTime (l1105);
234 
235  // Display the leg-date
236  // STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString());
237 
238  // Create a second LegDate (BKK)
239  lLegDateKey = LegDateKey (lBKK);
240 
241  LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
242  FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKLeg);
243  FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKLeg);
244 
245  // Display the leg-date
246  // STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString());
247 
248  // Fill the LegDate content
249  lBKKLeg.setOffPoint (lSYD);
250  lBKKLeg.setBoardingDate (lDate + l1Day);
251  lBKKLeg.setOffDate (lDate + l2Days);
252  lBKKLeg.setBoardingTime (l1705);
253  lBKKLeg.setOffTime (l1540);
254  lBKKLeg.setElapsedTime (l0905);
255 
256  // Step 0.5: segment-cabin level
257  // Create a SegmentCabin (Y) for the Segment LHR-BKK of BA's Inventory
258  const CabinCode_T lY ("Y");
259  SegmentCabinKey lYSegmentCabinKey (lY);
260 
261  SegmentCabin& lLHRBKKSegmentYCabin =
262  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
263  FacBomManager::addToListAndMap (lLHRBKKSegment, lLHRBKKSegmentYCabin);
264  FacBomManager::linkWithParent (lLHRBKKSegment, lLHRBKKSegmentYCabin);
265 
266  // Display the segment-cabin
267  // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString());
268 
269  // Create a SegmentCabin (Y) of the Segment BKK-SYD;
270  SegmentCabin& lBKKSYDSegmentYCabin =
271  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
272  FacBomManager::addToListAndMap (lBKKSYDSegment, lBKKSYDSegmentYCabin);
273  FacBomManager::linkWithParent (lBKKSYDSegment, lBKKSYDSegmentYCabin);
274 
275 
276  // Display the segment-cabin
277  // STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString());
278 
279  // Create a SegmentCabin (Y) of the Segment LHR-SYD;
280  SegmentCabin& lLHRSYDSegmentYCabin =
281  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
282  FacBomManager::addToListAndMap (lLHRSYDSegment, lLHRSYDSegmentYCabin);
283  FacBomManager::linkWithParent (lLHRSYDSegment, lLHRSYDSegmentYCabin);
284 
285  // Display the segment-cabin
286  // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString());
287 
288  // Step 0.6: leg-cabin level
289  // Create a LegCabin (Y) for the Leg LHR-BKK on BA's Inventory
290  LegCabinKey lYLegCabinKey (lY);
291 
292  LegCabin& lLHRLegYCabin =
293  FacBom<LegCabin>::instance().create (lYLegCabinKey);
294  FacBomManager::addToListAndMap (lLHRLeg, lLHRLegYCabin);
295  FacBomManager::linkWithParent (lLHRLeg, lLHRLegYCabin);
296 
297  // Display the leg-cabin
298  // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
299 
300  // Create a LegCabin (Y) for the Leg BKK-SYD
301  LegCabin& lBKKLegYCabin =
302  FacBom<LegCabin>::instance().create (lYLegCabinKey);
303  FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
304  FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
305  // Display the leg-cabin
306  // STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString());
307 
308  // Step 0.7: fare family level
309  // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
310  const FamilyCode_T l1 ("EcoSaver");
311  FareFamilyKey l1FareFamilyKey (l1);
312 
313  FareFamily& lLHRBKKSegmentYCabin1Family =
314  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
315  FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
316  lLHRBKKSegmentYCabin1Family);
317  FacBomManager::linkWithParent (lLHRBKKSegmentYCabin,
318  lLHRBKKSegmentYCabin1Family);
319 
320  // Display the booking class
321  // STDAIR_LOG_DEBUG ("FareFamily: "
322  // << lLHRBKKSegmentYCabin1Family.toString());
323 
324  // Create a FareFamily (1) for the Segment BKK-SYD, cabin Y on BA's Inv
325  FareFamily& lBKKSYDSegmentYCabin1Family =
326  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
327  FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
328  lBKKSYDSegmentYCabin1Family);
329  FacBomManager::linkWithParent (lBKKSYDSegmentYCabin,
330  lBKKSYDSegmentYCabin1Family);
331 
332  // Display the booking class
333  // STDAIR_LOG_DEBUG ("FareFamily: "
334  // << lLHRBKKSegmentYCabin1Family.toString());
335 
336  // Create a FareFamily (1) for the Segment LHR-SYD, cabin Y on BA's Inv
337  FareFamily& lLHRSYDSegmentYCabin1Family =
338  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
339  FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
340  lLHRSYDSegmentYCabin1Family);
341  FacBomManager::linkWithParent (lLHRSYDSegmentYCabin,
342  lLHRSYDSegmentYCabin1Family);
343 
344  // Display the booking class
345  // STDAIR_LOG_DEBUG ("FareFamily: "
346  // << lLHRBKKSegmentYCabin1Family.toString());
347 
348 
349  // Step 0.8: booking class level
350  // Create a BookingClass (Q) for the Segment LHR-BKK, cabin Y,
351  // fare family 1 on BA's Inv
352  const ClassCode_T lQ ("Q");
353  BookingClassKey lQBookingClassKey (lQ);
354 
355  BookingClass& lLHRBKKSegmentYCabin1FamilyQClass =
356  FacBom<BookingClass>::instance().create (lQBookingClassKey);
357  FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin1Family,
358  lLHRBKKSegmentYCabin1FamilyQClass);
359  FacBomManager::linkWithParent (lLHRBKKSegmentYCabin1Family,
360  lLHRBKKSegmentYCabin1FamilyQClass);
361 
362  FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
363  lLHRBKKSegmentYCabin1FamilyQClass);
364  FacBomManager::addToListAndMap (lLHRBKKSegment,
365  lLHRBKKSegmentYCabin1FamilyQClass);
366 
367  // Display the booking class
368  // STDAIR_LOG_DEBUG ("BookingClass: "
369  // << lLHRBKKSegmentYCabin1FamilyQClass.toString());
370 
371  // Create a BookingClass (Q) for the Segment BKK-SYD, cabin Y,
372  // fare family 1 on BA's Inv
373  BookingClass& lBKKSYDSegmentYCabin1FamilyQClass =
374  FacBom<BookingClass>::instance().create (lQBookingClassKey);
375  FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin1Family,
376  lBKKSYDSegmentYCabin1FamilyQClass);
377  FacBomManager::linkWithParent (lBKKSYDSegmentYCabin1Family,
378  lBKKSYDSegmentYCabin1FamilyQClass);
379 
380  FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
381  lBKKSYDSegmentYCabin1FamilyQClass);
382  FacBomManager::addToListAndMap (lBKKSYDSegment,
383  lBKKSYDSegmentYCabin1FamilyQClass);
384 
385  // Display the booking class
386  // STDAIR_LOG_DEBUG ("BookingClass: "
387  // << lLHRBKKSegmentYCabin1FamilyQClass.toString());
388 
389  // Create a BookingClass (Q) for the Segment LHR-SYD, cabin Y,
390  // fare family 1 on BA's Inv
391  BookingClass& lLHRSYDSegmentYCabin1FamilyQClass =
392  FacBom<BookingClass>::instance().create (lQBookingClassKey);
393  FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin1Family,
394  lLHRSYDSegmentYCabin1FamilyQClass);
395  FacBomManager::linkWithParent (lLHRSYDSegmentYCabin1Family,
396  lLHRSYDSegmentYCabin1FamilyQClass);
397 
398  FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
399  lLHRSYDSegmentYCabin1FamilyQClass);
400  FacBomManager::addToListAndMap (lLHRSYDSegment,
401  lLHRSYDSegmentYCabin1FamilyQClass);
402 
403  // Display the booking class
404  // STDAIR_LOG_DEBUG ("BookingClass: "
405  // << lLHRBKKSegmentYCabin1FamilyQClass.toString());
406 
407 
408  // ////// AF ///////
409  // Step 0.2: Flight-date level
410  // Create a FlightDate (AF084/20-MAR-2011) for AF's Inventory
411  lFlightNumber = 84;
412  lDate = Date_T (2011, 3, 20);
413  lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
414 
415  FlightDate& lAF084_20110320_FD =
416  FacBom<FlightDate>::instance().create (lFlightDateKey);
417  FacBomManager::addToListAndMap (lAFInv, lAF084_20110320_FD);
418  FacBomManager::linkWithParent (lAFInv, lAF084_20110320_FD);
419 
420  // Display the flight-date
421  // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
422 
423  // Step 0.3: Segment-date level
424  // Create a SegmentDate (CDG-SFO) for AF's Inventory
425  const AirportCode_T lCDG ("CDG");
426  const AirportCode_T lSFO ("SFO");
427  const Duration_T l1040 (10, 40, 0);
428  const Duration_T l1250 (12, 50, 0);
429  const Duration_T l1110 (11, 10, 0);
430  lSegmentDateKey = SegmentDateKey (lCDG, lSFO);
431 
432  SegmentDate& lCDGSFOSegment =
433  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
434  FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGSFOSegment);
435  FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGSFOSegment);
436 
437  // Add the routing leg key to the CDG-SFO segment.
438  const std::string lAFCDGRoutingLegStr = "AF;84;2011-Mar-20;CDG";
439  lCDGSFOSegment.addLegKey (lAFCDGRoutingLegStr);
440 
441  // Display the segment-date
442  // STDAIR_LOG_DEBUG ("SegmentDate: " << lCDGSFOSegment.toString());
443 
444  // Fill the SegmentDate content
445  lCDGSFOSegment.setBoardingDate (lDate);
446  lCDGSFOSegment.setOffDate (lDate);
447  lCDGSFOSegment.setBoardingTime (l1040);
448  lCDGSFOSegment.setOffTime (l1250);
449  lCDGSFOSegment.setElapsedTime (l1110);
450 
451  // Step 0.4: Leg-date level
452  // Create a LegDate (CDG) for AF's Inventory
453  lLegDateKey = LegDateKey (lCDG);
454 
455  LegDate& lCDGLeg = FacBom<LegDate>::instance().create (lLegDateKey);
456  FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGLeg);
457  FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGLeg);
458 
459  // Fill the LegDate content
460  lCDGLeg.setOffPoint (lSFO);
461  lCDGLeg.setBoardingDate (lDate);
462  lCDGLeg.setOffDate (lDate);
463  lCDGLeg.setBoardingTime (l1040);
464  lCDGLeg.setOffTime (l1250);
465  lCDGLeg.setElapsedTime (l1110);
466 
467  // Display the leg-date
468  // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
469 
470  // Step 0.5: segment-cabin level
471  // Create a SegmentCabin (Y) for the Segment CDG-SFO of AF's Inventory
472  SegmentCabin& lCDGSFOSegmentYCabin =
473  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
474  FacBomManager::addToListAndMap (lCDGSFOSegment, lCDGSFOSegmentYCabin);
475  FacBomManager::linkWithParent (lCDGSFOSegment, lCDGSFOSegmentYCabin);
476 
477  // Display the segment-cabin
478  // STDAIR_LOG_DEBUG ("SegmentCabin: " << lCDGSFOSegmentYCabin.toString());
479 
480  // Step 0.6: leg-cabin level
481  // Create a LegCabin (Y) for the Leg CDG-SFO on AF's Inventory
482  LegCabin& lCDGLegYCabin =
483  FacBom<LegCabin>::instance().create (lYLegCabinKey);
484  FacBomManager::addToListAndMap (lCDGLeg, lCDGLegYCabin);
485  FacBomManager::linkWithParent (lCDGLeg, lCDGLegYCabin);
486 
487  // Display the leg-cabin
488  // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
489 
490  // Step 0.7: fare family level
491  // Create a fareFamily (1) for the Segment CDG-SFO, cabin Y on AF's Inv
492  FareFamily& lCDGSFOSegmentYCabin1Family =
493  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
494  FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
495  lCDGSFOSegmentYCabin1Family);
496  FacBomManager::linkWithParent (lCDGSFOSegmentYCabin,
497  lCDGSFOSegmentYCabin1Family);
498 
499  // Display the fare family
500  // STDAIR_LOG_DEBUG ("fareFamily: "
501  //
502  // << lCDGSFOSegmentYCabin1Family.toString());
503 
504  // Step 0.8: booking class level Create a BookingClass (Q) for the
505  // Segment CDG-SFO, cabin Y, fare family 1 on AF's Inv
506  BookingClass& lCDGSFOSegmentYCabin1FamilyQClass =
507  FacBom<BookingClass>::instance().create (lQBookingClassKey);
508  FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin1Family,
509  lCDGSFOSegmentYCabin1FamilyQClass);
510  FacBomManager::linkWithParent (lCDGSFOSegmentYCabin1Family,
511  lCDGSFOSegmentYCabin1FamilyQClass);
512 
513  FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
514  lCDGSFOSegmentYCabin1FamilyQClass);
515  FacBomManager::addToListAndMap (lCDGSFOSegment,
516  lCDGSFOSegmentYCabin1FamilyQClass);
517 
518  // Display the booking class
519  // STDAIR_LOG_DEBUG ("BookingClass: "
520  // << lCDGSFOSegmentYCabin1FamilyQClass.toString());
521 
522  /*================================================================================
523  ================================================================================
524  ================================================================================*/
525  // Schedule:
526  // BA:
527  // Step 1: flight period level
528  // Create a flight period for BA9:
529  const DoWStruct lDoWSrtuct ("1111111");
530  const Date_T lBA9DateRangeStart (2010, boost::gregorian::Jun, 6);
531  const Date_T lBA9DateRangeEnd (2010, boost::gregorian::Jun, 7);
532  const DatePeriod_T lBA9DatePeriod (lBA9DateRangeStart, lBA9DateRangeEnd);
533  const PeriodStruct lBA9PeriodStruct (lBA9DatePeriod, lDoWSrtuct);
534 
535  lFlightNumber = FlightNumber_T (9);
536 
537  FlightPeriodKey lBA9FlightPeriodKey (lFlightNumber, lBA9PeriodStruct);
538 
539  FlightPeriod& lBA9FlightPeriod =
540  FacBom<FlightPeriod>::instance().create (lBA9FlightPeriodKey);
541  FacBomManager::addToListAndMap (lBAInv, lBA9FlightPeriod);
542  FacBomManager::linkWithParent (lBAInv, lBA9FlightPeriod);
543 
544  // Step 2: segment period level
545  // Create a segment period for LHR-SYD:
546 
547  SegmentPeriodKey lLHRSYDSegmentPeriodKey (lLHR, lSYD);
548 
549  SegmentPeriod& lLHRSYDSegmentPeriod =
550  FacBom<SegmentPeriod>::instance().create (lLHRSYDSegmentPeriodKey);
551  FacBomManager::addToListAndMap (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
552  FacBomManager::linkWithParent (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
553 
554  lLHRSYDSegmentPeriod.setBoardingTime (l2135);
555  lLHRSYDSegmentPeriod.setOffTime (l1540);
556  lLHRSYDSegmentPeriod.setElapsedTime (l1105);
557  ClassList_String_T lYM ("YM");
558  lLHRSYDSegmentPeriod.addCabinBookingClassList (lY,lYM);
559 
560  // AF:
561  // Step 1: flight period level
562  // Create a flight period for AF84:
563  const Date_T lAF84DateRangeStart (2011, boost::gregorian::Mar, 20);
564  const Date_T lAF84DateRangeEnd (2011, boost::gregorian::Mar, 21);
565  const DatePeriod_T lAF84DatePeriod (lAF84DateRangeStart, lAF84DateRangeEnd);
566  const PeriodStruct lAF84PeriodStruct (lAF84DatePeriod, lDoWSrtuct);
567 
568  lFlightNumber = FlightNumber_T (84);
569 
570  FlightPeriodKey lAF84FlightPeriodKey (lFlightNumber, lAF84PeriodStruct);
571 
572  FlightPeriod& lAF84FlightPeriod =
573  FacBom<FlightPeriod>::instance().create (lAF84FlightPeriodKey);
574  FacBomManager::addToListAndMap (lAFInv, lAF84FlightPeriod);
575  FacBomManager::linkWithParent (lAFInv, lAF84FlightPeriod);
576 
577  // Step 2: segment period level
578  // Create a segment period for CDG-SFO:
579 
580  SegmentPeriodKey lCDGSFOSegmentPeriodKey (lCDG, lSFO);
581 
582  SegmentPeriod& lCDGSFOSegmentPeriod =
583  FacBom<SegmentPeriod>::instance().create (lCDGSFOSegmentPeriodKey);
584  FacBomManager::addToListAndMap (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
585  FacBomManager::linkWithParent (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
586 
587  lCDGSFOSegmentPeriod.setBoardingTime (l1040);
588  lCDGSFOSegmentPeriod.setOffTime (l1250);
589  lCDGSFOSegmentPeriod.setElapsedTime (l1110);
590  lCDGSFOSegmentPeriod.addCabinBookingClassList (lY,lYM);
591 
592  /*================================================================================
593  ================================================================================
594  ================================================================================*/
595  // O&D
596  // Create an O&D Date (BA;9,2010-Jun-06;LHR,SYD) for BA's Inventory
597  OnDString_T lBALHRSYDOnDStr = "BA;9,2010-Jun-06;LHR,SYD";
598  OnDStringList_T lBAOnDStrList;
599  lBAOnDStrList.push_back (lBALHRSYDOnDStr);
600 
601  OnDDateKey lBAOnDDateKey (lBAOnDStrList);
602  OnDDate& lBA_LHRSYD_OnDDate =
603  FacBom<OnDDate>::instance().create (lBAOnDDateKey);
604  // Link to the inventory
605  FacBomManager::addToListAndMap (lBAInv, lBA_LHRSYD_OnDDate);
606  FacBomManager::linkWithParent (lBAInv, lBA_LHRSYD_OnDDate);
607 
608  // Add the segment
609  FacBomManager::addToListAndMap (lBA_LHRSYD_OnDDate, lLHRSYDSegment);
610 
611  // Add total forecast info for cabin Y.
612  const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
613  const WTP_T lWTP750 = 750.0;
614  const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
615  lBA_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
616 
617  // Create an O&D Date (AF;84,2011-Mar-21;CDG,SFO) for AF's Inventory
618  OnDString_T lAFLHRSYDOnDStr = "AF;9,2011-Mar-20;CDG,SFO";
619  OnDStringList_T lAFOnDStrList;
620  lAFOnDStrList.push_back (lAFLHRSYDOnDStr);
621 
622  OnDDateKey lAFOnDDateKey (lAFOnDStrList);
623  OnDDate& lAF_LHRSYD_OnDDate =
624  FacBom<OnDDate>::instance().create (lAFOnDDateKey);
625  // Link to the inventory
626  FacBomManager::addToListAndMap (lAFInv, lAF_LHRSYD_OnDDate);
627  FacBomManager::linkWithParent (lAFInv, lAF_LHRSYD_OnDDate);
628 
629  // Add the segment
630  FacBomManager::addToListAndMap (lAF_LHRSYD_OnDDate, lLHRSYDSegment);
631 
632  // Add total forecast info for cabin Y.
633  lAF_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
634 
635  }
636 
637  // //////////////////////////////////////////////////////////////////////
638  void CmdBomManager::
639  buildSampleInventoryScheduleForFareFamilies (BomRoot& ioBomRoot) {
640 
641  // Inventory
642  // Step 0.1: Inventory level
643  // Get the Inventory SQ (already built by construction)
644  const InventoryKey lSQKey ("SQ");
645  Inventory& lSQInv = BomManager::getObject<Inventory>(ioBomRoot,
646  lSQKey.toString());
647 
648  // SQ
649  // Step 0.2: Flight-date level
650  // Create a FlightDate (SQ747/8-FEB-2010) for SQ's Inventory
651  const FlightNumber_T lFlightNumber747 = 747;
652  const Date_T lDate (2010, 2, 8);
653  const FlightDateKey lFlightDateKey (lFlightNumber747, lDate);
654 
655  FlightDate& lSQ747_20100208_FD =
656  FacBom<FlightDate>::instance().create (lFlightDateKey);
657  FacBomManager::addToListAndMap (lSQInv, lSQ747_20100208_FD);
658  FacBomManager::linkWithParent (lSQInv, lSQ747_20100208_FD);
659 
660  // Display the flight-date
661  // STDAIR_LOG_DEBUG ("FlightDate: " << lSQ747_20100208_FD.toString());
662 
663  // Step 0.3: Segment-date level
664  // Create a SegmentDate (SIN-BKK) for SQ's Inventory
665  const AirportCode_T lSIN ("SIN");
666  const AirportCode_T lBKK ("BKK");
667  const Duration_T l0635 (6, 35, 0);
668  const Duration_T l0800 (8, 0, 0);
669  const Duration_T l0225 (2, 25, 0);
670  const SegmentDateKey lSegmentDateKey (lSIN, lBKK);
671 
672  SegmentDate& lSINBKKSegment =
673  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
674  FacBomManager::addToListAndMap (lSQ747_20100208_FD, lSINBKKSegment);
675  FacBomManager::linkWithParent (lSQ747_20100208_FD, lSINBKKSegment);
676 
677  // Add the routing leg key to the SIN-BKK segment.
678  const std::string lSQSINRoutingLegStr = "SQ;747;2010-Feb-8;SIN";
679  lSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
680 
681  // Fill the SegmentDate content
682  lSINBKKSegment.setBoardingDate (lDate);
683  lSINBKKSegment.setOffDate (lDate);
684  lSINBKKSegment.setBoardingTime (l0635);
685  lSINBKKSegment.setOffTime (l0800);
686  lSINBKKSegment.setElapsedTime (l0225);
687 
688  // Display the segment-date
689  // STDAIR_LOG_DEBUG ("SegmentDate: " << lSINBKKSegment);
690 
691  // Step 0.4: Leg-date level
692  // Create a LegDate (SIN) for SQ's Inventory
693  const LegDateKey lLegDateKey (lSIN);
694 
695  LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
696  FacBomManager::addToListAndMap (lSQ747_20100208_FD, lSINLeg);
697  FacBomManager::linkWithParent (lSQ747_20100208_FD, lSINLeg);
698 
699  // Fill the LegDate content
700  lSINLeg.setOffPoint (lBKK);
701  lSINLeg.setBoardingDate (lDate);
702  lSINLeg.setOffDate (lDate);
703  lSINLeg.setBoardingTime (l0635);
704  lSINLeg.setOffTime (l0800);
705  lSINLeg.setElapsedTime (l0225);
706 
707  // Display the leg-date
708  // STDAIR_LOG_DEBUG ("LegDate: " << lSINLeg.toString());
709 
710  // Step 0.5: segment-cabin level
711  // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
712  const CabinCode_T lY ("Y");
713  const SegmentCabinKey lYSegmentCabinKey (lY);
714  SegmentCabin& lSINBKKSegmentYCabin =
715  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
716  FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
717  FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
718  lSINBKKSegmentYCabin.activateFareFamily ();
719 
720  // Display the segment-cabin
721  // STDAIR_LOG_DEBUG ("SegmentCabin: " << lSINBKKSegmentYCabin.toString());
722 
723  // Step 0.6: leg-cabin level
724  // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
725  const LegCabinKey lYLegCabinKey (lY);
726  LegCabin& lSINLegYCabin =
727  FacBom<LegCabin>::instance().create (lYLegCabinKey);
728  FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
729  FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
730 
731  // Display the leg-cabin
732  // STDAIR_LOG_DEBUG ("LegCabin: " << lSINLegYCabin.toString());
733 
734  // Step 0.7: fare family level
735  // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
736  const FamilyCode_T l1 ("1");
737  const FareFamilyKey l1FareFamilyKey (l1);
738  FareFamily& lSINBKKSegmentYCabin1Family =
739  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
740  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
741  lSINBKKSegmentYCabin1Family);
742  FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
743  lSINBKKSegmentYCabin1Family);
744 
745  // Display the booking class
746  // STDAIR_LOG_DEBUG ("FareFamily: "
747  // << lSINBKKSegmentYCabin1Family.toString());
748 
749  // Create a FareFamily (2) for the Segment SIN-BKK, cabin Y on SQ's Inv
750  const FamilyCode_T l2 ("2");
751  const FareFamilyKey l2FareFamilyKey (l2);
752  FareFamily& lSINBKKSegmentYCabin2Family =
753  FacBom<FareFamily>::instance().create (l2FareFamilyKey);
754  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
755  lSINBKKSegmentYCabin2Family);
756  FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
757  lSINBKKSegmentYCabin2Family);
758 
759  // Display the booking class
760  // STDAIR_LOG_DEBUG ("FareFamily: "
761  // << lSINBKKSegmentYCabin2Family.toString());
762 
763  // Step 0.8: booking class level
764  // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
765  // fare family 2 on SQ's Inv
766  const ClassCode_T lClassY ("Y");
767  const BookingClassKey lYBookingClassKey (lClassY);
768  BookingClass& lSINBKKSegmentYCabin2FamilyYClass =
769  FacBom<BookingClass>::instance().create (lYBookingClassKey);
770  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin2Family,
771  lSINBKKSegmentYCabin2FamilyYClass);
772  FacBomManager::linkWithParent (lSINBKKSegmentYCabin2Family,
773  lSINBKKSegmentYCabin2FamilyYClass);
774 
775  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
776  lSINBKKSegmentYCabin2FamilyYClass);
777  FacBomManager::addToListAndMap (lSINBKKSegment,
778  lSINBKKSegmentYCabin2FamilyYClass);
779  lSINBKKSegmentYCabin2FamilyYClass.setYield(1200);
780 
781  // Display the booking class
782  // STDAIR_LOG_DEBUG ("BookingClass: "
783  // << lSINBKKSegmentYCabin2FamilyYClass.toString());
784 
785  // Create a BookingClass (B) for the Segment SIN-BKK, cabin Y,
786  // fare family 2 on SQ's Inv
787  const ClassCode_T lB ("B");
788  const BookingClassKey lBBookingClassKey (lB);
789  BookingClass& lSINBKKSegmentYCabin2FamilyBClass =
790  FacBom<BookingClass>::instance().create (lBBookingClassKey);
791  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin2Family,
792  lSINBKKSegmentYCabin2FamilyBClass);
793  FacBomManager::linkWithParent (lSINBKKSegmentYCabin2Family,
794  lSINBKKSegmentYCabin2FamilyBClass);
795 
796  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
797  lSINBKKSegmentYCabin2FamilyBClass);
798  FacBomManager::addToListAndMap (lSINBKKSegment,
799  lSINBKKSegmentYCabin2FamilyBClass);
800  lSINBKKSegmentYCabin2FamilyBClass.setYield(800);
801 
802  // Display the booking class
803  // STDAIR_LOG_DEBUG ("BookingClass: "
804  // << lSINBKKSegmentYCabin2FamilyBClass.toString());
805 
806  // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
807  // fare family 1 on SQ's Inv
808  const ClassCode_T lM ("M");
809  const BookingClassKey lMBookingClassKey (lM);
810  BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
811  FacBom<BookingClass>::instance().create (lMBookingClassKey);
812  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
813  lSINBKKSegmentYCabin1FamilyMClass);
814  FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
815  lSINBKKSegmentYCabin1FamilyMClass);
816 
817  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
818  lSINBKKSegmentYCabin1FamilyMClass);
819  FacBomManager::addToListAndMap (lSINBKKSegment,
820  lSINBKKSegmentYCabin1FamilyMClass);
821  lSINBKKSegmentYCabin1FamilyMClass.setYield(900);
822 
823  // Display the booking class
824  // STDAIR_LOG_DEBUG ("BookingClass: "
825  // << lSINBKKSegmentYCabin1FamilyMClass.toString());
826 
827  // Create a BookingClass (Q) for the Segment SIN-BKK, cabin Y,
828  // fare family 1 on SQ's Inv
829  const ClassCode_T lQ ("Q");
830  const BookingClassKey lQBookingClassKey (lQ);
831  BookingClass& lSINBKKSegmentYCabin1FamilyQClass =
832  FacBom<BookingClass>::instance().create (lQBookingClassKey);
833  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
834  lSINBKKSegmentYCabin1FamilyQClass);
835  FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
836  lSINBKKSegmentYCabin1FamilyQClass);
837 
838  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
839  lSINBKKSegmentYCabin1FamilyQClass);
840  FacBomManager::addToListAndMap (lSINBKKSegment,
841  lSINBKKSegmentYCabin1FamilyQClass);
842  lSINBKKSegmentYCabin1FamilyQClass.setYield(600);
843 
844 
845  // Display the booking class
846  // STDAIR_LOG_DEBUG ("BookingClass: "
847  // << lSINBKKSegmentYCabin1FamilyQClass.toString());
848 
849  /*================================================================================
850  ================================================================================
851  ================================================================================*/
852  // Schedule:
853  // SQ:
854  // Step 1: flight period level
855  // Create a flight period for SQ747:
856  const DoWStruct lDoWSrtuct ("1111111");
857  const Date_T lSQ747DateRangeStart (2010, boost::gregorian::Feb, 8);
858  const Date_T lSQ747DateRangeEnd (2010, boost::gregorian::Feb, 9);
859  const DatePeriod_T lSQ747DatePeriod (lSQ747DateRangeStart,
860  lSQ747DateRangeEnd);
861  const PeriodStruct lSQ747PeriodStruct (lSQ747DatePeriod, lDoWSrtuct);
862 
863  const FlightPeriodKey lSQ747FlightPeriodKey (lFlightNumber747,
864  lSQ747PeriodStruct);
865  FlightPeriod& lSQ747FlightPeriod =
866  FacBom<FlightPeriod>::instance().create (lSQ747FlightPeriodKey);
867  FacBomManager::addToListAndMap (lSQInv, lSQ747FlightPeriod);
868  FacBomManager::linkWithParent (lSQInv, lSQ747FlightPeriod);
869 
870  // Step 2: segment period level
871  // Create a segment period for SIN-BKK:
872 
873  const SegmentPeriodKey lSINBKKSegmentPeriodKey (lSIN, lBKK);
874  SegmentPeriod& lSINBKKSegmentPeriod =
875  FacBom<SegmentPeriod>::instance().create (lSINBKKSegmentPeriodKey);
876  FacBomManager::addToListAndMap (lSQ747FlightPeriod, lSINBKKSegmentPeriod);
877  FacBomManager::linkWithParent (lSQ747FlightPeriod, lSINBKKSegmentPeriod);
878 
879  ClassList_String_T lYBMQ ("YBMQ");
880  lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYBMQ);
881  lSINBKKSegmentPeriod.setBoardingTime (l0635);
882  lSINBKKSegmentPeriod.setOffTime (l0800);
883  lSINBKKSegmentPeriod.setElapsedTime (l0225);
884 
885  /*================================================================================
886  ================================================================================
887  ================================================================================*/
888  // O&D
889  // Create an O&D Date (SQ;747,2011-Feb-14;SIN,BKK) for SQ's Inventory
890  const OnDString_T lSQSINBKKOnDStr = "SQ;747,2011-Feb-14;SIN,BKK";
891  OnDStringList_T lSQOnDStrList;
892  lSQOnDStrList.push_back (lSQSINBKKOnDStr);
893 
894  const OnDDateKey lSQOnDDateKey (lSQOnDStrList);
895  OnDDate& lSQ_SINBKK_OnDDate =
896  FacBom<OnDDate>::instance().create (lSQOnDDateKey);
897  // Link to the inventory
898  FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
899  FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
900  // Add total forecast info for cabin Y.
901  const MeanStdDevPair_T lMean120StdDev12 (120.0, 12.0);
902  const WTP_T lWTP1000 = 1000.0;
903  const WTPDemandPair_T lWTP1000Mean120StdDev12 (lWTP1000, lMean120StdDev12);
904  lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP1000Mean120StdDev12);
905 
906  // Add the segment
907  FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
908  }
909 
910  // //////////////////////////////////////////////////////////////////////
911  void CmdBomManager::buildDummyLegSegmentAccesses (BomRoot& ioBomRoot) {
912 
913  /* Build the direct accesses between the dummy segment cabins and the dummy
914  * leg cabins within the dummy flight dates (the dummy fare family
915  * flight date and the classic dummy flight date).
916  *
917  * As for now (May 2012), that method is called only by RMOL.
918  * It is a substitute for the code doing it automatically located in AirInv.
919  * See the AIRINV::InventoryManager::createDirectAccesses command.
920  */
921 
922  // ////// Dummy Inventory Leg Segment Accesses ///////
923  // Retrieve the (sample) segment-cabin.
924  SegmentCabin& lDummySegmentCabin =
926 
927  // Retrieve the (sample) leg-cabin.
928  LegCabin& lDummyLegCabin =
930 
931  // Links between the segment-date and the leg-date
932  FacBomManager::addToListAndMap (lDummyLegCabin, lDummySegmentCabin);
933  FacBomManager::addToListAndMap (lDummySegmentCabin, lDummyLegCabin);
934 
935  // ////// Fare Families Dummy Inventory Leg Segment Accesses ///////
936  const bool isForFareFamilies = true;
937  // Retrieve the (sample) segment-cabin for fare families.
938  SegmentCabin& lFFDummySegmentCabin =
939  BomRetriever::retrieveDummySegmentCabin (ioBomRoot, isForFareFamilies);
940 
941  // Retrieve the (sample) leg-cabin for fare families.
942  stdair::LegCabin& lFFDummyLegCabin =
944  isForFareFamilies);
945 
946  // Links between the segment-date and the leg-date for fare families.
947  FacBomManager::addToListAndMap (lFFDummyLegCabin, lFFDummySegmentCabin);
948  FacBomManager::addToListAndMap (lFFDummySegmentCabin, lFFDummyLegCabin);
949  }
950 
951  // //////////////////////////////////////////////////////////////////////
952  void CmdBomManager::buildCompleteDummyInventory (BomRoot& ioBomRoot) {
953 
954  // Build a dummy inventory, containing a dummy flight-date with a
955  // single segment-cabin and a single leg-cabin.
956  const CabinCapacity_T lCapacity = DEFAULT_CABIN_CAPACITY;
957  buildDummyInventory (ioBomRoot, lCapacity);
958 
959  // Retrieve the (sample) segment-cabin.
960  SegmentCabin& lDummySegmentCabin =
962 
963  // Retrieve the (sample) leg-cabin.
964  LegCabin& lDummyLegCabin =
966 
967  // Add some booking classes to the dummy segment-cabin and some
968  // virtual ones to the dummy leg-cabin.
969  // First booking class yield and demand information.
970  Yield_T lYield = 100;
971  MeanValue_T lMean = 20;
972  StdDevValue_T lStdDev= 9;
973  BookingClassKey lBCKey (DEFAULT_CLASS_CODE);
974 
975  BookingClass& lDummyBookingClass =
977  lDummyBookingClass.setYield (lYield);
978  lDummyBookingClass.setMean (lMean);
979  lDummyBookingClass.setStdDev (lStdDev);
980  // Add a booking class to the segment-cabin.
981  FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
982  BookingClassList_T lDummyBookingClassList;
983  lDummyBookingClassList.push_back(&lDummyBookingClass);
984 
985  VirtualClassStruct lDummyVirtualClass (lDummyBookingClassList);
986  lDummyVirtualClass.setYield (lYield);
987  lDummyVirtualClass.setMean (lMean);
988  lDummyVirtualClass.setStdDev (lStdDev);
989  // Add the corresponding virtual class to the leg-cabin.
990  lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
991 
992  // Second booking class yield and demand information.
993  lYield = 70;
994  lMean = 45;
995  lStdDev= 12;
996  lDummyBookingClass.setYield (lYield);
997  lDummyBookingClass.setMean (lMean);
998  lDummyBookingClass.setStdDev (lStdDev);
999  // Add a booking class to the segment-cabin.
1000  FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
1001 
1002  lDummyVirtualClass.setYield (lYield);
1003  lDummyVirtualClass.setMean (lMean);
1004  lDummyVirtualClass.setStdDev (lStdDev);
1005  // Add the corresponding virtual class to the leg-cabin.
1006  lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
1007 
1008  // Third booking class yield and demand information.
1009  lYield = 42;
1010  lMean = 80;
1011  lStdDev= 16;
1012  lDummyBookingClass.setYield (lYield);
1013  lDummyBookingClass.setMean (lMean);
1014  lDummyBookingClass.setStdDev (lStdDev);
1015  // Add a booking class to the segment-cabin.
1016  FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
1017 
1018  lDummyVirtualClass.setYield (lYield);
1019  lDummyVirtualClass.setMean (lMean);
1020  lDummyVirtualClass.setStdDev (lStdDev);
1021  // Add the corresponding virtual class to the leg-cabin.
1022  lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
1023 
1024  }
1025 
1026  // //////////////////////////////////////////////////////////////////////
1027  void CmdBomManager::buildDummyInventory (BomRoot& ioBomRoot,
1028  const CabinCapacity_T& iCapacity) {
1029  // Inventory
1030  const InventoryKey lInventoryKey (DEFAULT_AIRLINE_CODE);
1031  Inventory& lInv = FacBom<Inventory>::instance().create (lInventoryKey);
1032  FacBomManager::addToListAndMap (ioBomRoot, lInv);
1033  FacBomManager::linkWithParent (ioBomRoot, lInv);
1034 
1035  // Add the airline feature object to the dummy inventory
1036  const AirlineFeatureKey lAirlineFeatureKey (DEFAULT_AIRLINE_CODE);
1037  AirlineFeature& lAirlineFeature =
1038  FacBom<AirlineFeature>::instance().create (lAirlineFeatureKey);
1039  FacBomManager::setAirlineFeature (lInv, lAirlineFeature);
1040  FacBomManager::linkWithParent (lInv, lAirlineFeature);
1041  // Link the airline feature object with the top of the BOM tree
1042  FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeature);
1043 
1044  // Flight-date
1045  FlightDateKey lFlightDateKey(DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE);
1046  FlightDate& lFlightDate =
1047  FacBom<FlightDate>::instance().create (lFlightDateKey);
1048  FacBomManager::addToListAndMap (lInv, lFlightDate);
1049  FacBomManager::linkWithParent (lInv, lFlightDate);
1050 
1051  // Leg-date
1052  LegDateKey lLegDateKey (DEFAULT_ORIGIN);
1053  LegDate& lLeg = FacBom<LegDate>::instance().create (lLegDateKey);
1054  FacBomManager::addToListAndMap (lFlightDate, lLeg);
1055  FacBomManager::linkWithParent (lFlightDate, lLeg);
1056 
1057  // Fill the LegDate content
1058  lLeg.setOffPoint (DEFAULT_DESTINATION);
1059  lLeg.setBoardingDate (DEFAULT_DEPARTURE_DATE);
1060  lLeg.setOffDate (DEFAULT_DEPARTURE_DATE);
1061  lLeg.setBoardingTime (Duration_T (14, 0, 0));
1062  lLeg.setOffTime (Duration_T (16, 0, 0));
1063  lLeg.setElapsedTime (Duration_T (8, 0, 0));
1064 
1065  // Leg-cabin
1066  LegCabinKey lLegCabinKey (DEFAULT_CABIN_CODE);
1067  LegCabin& lLegCabin = FacBom<LegCabin>::instance().create (lLegCabinKey);
1068  FacBomManager::addToListAndMap (lLeg, lLegCabin);
1069  FacBomManager::linkWithParent (lLeg, lLegCabin);
1070 
1071  lLegCabin.setCapacities (iCapacity);
1072  lLegCabin.setAvailabilityPool (iCapacity);
1073 
1074  // Segment-date
1075  SegmentDateKey lSegmentDateKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
1076  SegmentDate& lSegment =
1077  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
1078  FacBomManager::addToListAndMap (lFlightDate, lSegment);
1079  FacBomManager::linkWithParent (lFlightDate, lSegment);
1080 
1081  // Add the routing leg key to the dummy segment.
1082  std::ostringstream oStr;
1083  oStr << DEFAULT_AIRLINE_CODE << ";"
1084  << DEFAULT_FLIGHT_NUMBER << ";"
1085  << DEFAULT_DEPARTURE_DATE << ";"
1086  << DEFAULT_ORIGIN;
1087  lSegment.addLegKey (oStr.str());
1088 
1089  // Fill the SegmentDate content
1090  lSegment.setBoardingDate (DEFAULT_DEPARTURE_DATE);
1091  lSegment.setOffDate (DEFAULT_DEPARTURE_DATE);
1092  lSegment.setBoardingTime (Duration_T (14, 0, 0));
1093  lSegment.setOffTime (Duration_T (16, 0, 0));
1094  lSegment.setElapsedTime (Duration_T (8, 0, 0));
1095 
1096  // Segment-cabin
1097  SegmentCabinKey lSegmentCabinKey (DEFAULT_CABIN_CODE);
1098  SegmentCabin& lSegmentCabin =
1099  FacBom<SegmentCabin>::instance().create (lSegmentCabinKey);
1100  FacBomManager::addToListAndMap (lSegment, lSegmentCabin);
1101  FacBomManager::linkWithParent (lSegment, lSegmentCabin);
1102 
1103  // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
1104  const FamilyCode_T l1 ("EcoSaver");
1105  FareFamilyKey l1FareFamilyKey (l1);
1106 
1107  FareFamily& lSegmentYCabin1Family =
1108  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
1109  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1Family);
1110  FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin1Family);
1111 
1112  // Create a booking-class
1113  const ClassCode_T lQ ("Q");
1114  BookingClassKey lQBookingClassKey (lQ);
1115 
1116  BookingClass& lSegmentYCabin1FamilyQClass =
1117  FacBom<BookingClass>::instance().create (lQBookingClassKey);
1118  FacBomManager::addToListAndMap (lSegmentYCabin1Family,
1119  lSegmentYCabin1FamilyQClass);
1120  FacBomManager::linkWithParent (lSegmentYCabin1Family,
1121  lSegmentYCabin1FamilyQClass);
1122 
1123  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyQClass);
1124  FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyQClass);
1125 
1126  /*================================================================================
1127  ================================================================================
1128  ================================================================================*/
1129  // Schedule:
1130  // XX:
1131  // Step 1: flight period level
1132  // Create a flight period for XX:
1133  const DoWStruct lDoWSrtuct ("1111111");
1134  const Date_T lXXDateRangeStart (DEFAULT_DEPARTURE_DATE);
1135  const Date_T lXXDateRangeEnd (DEFAULT_DEPARTURE_DATE);
1136  const DatePeriod_T lXXDatePeriod (lXXDateRangeStart, lXXDateRangeEnd);
1137  const PeriodStruct lXXPeriodStruct (lXXDatePeriod, lDoWSrtuct);
1138 
1139  FlightPeriodKey lXXFlightPeriodKey (DEFAULT_FLIGHT_NUMBER, lXXPeriodStruct);
1140 
1141  FlightPeriod& lXXFlightPeriod =
1142  FacBom<FlightPeriod>::instance().create (lXXFlightPeriodKey);
1143  FacBomManager::addToListAndMap (lInv, lXXFlightPeriod);
1144  FacBomManager::linkWithParent (lInv, lXXFlightPeriod);
1145 
1146  // Step 2: segment period level
1147  // Create a segment period
1148 
1149  SegmentPeriodKey lXXSegmentPeriodKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
1150 
1151  SegmentPeriod& lXXSegmentPeriod =
1152  FacBom<SegmentPeriod>::instance().create (lXXSegmentPeriodKey);
1153  FacBomManager::addToListAndMap (lXXFlightPeriod, lXXSegmentPeriod);
1154  FacBomManager::linkWithParent (lXXFlightPeriod, lXXSegmentPeriod);
1155 
1156  lXXSegmentPeriod.setBoardingTime (Duration_T (14, 0, 0));
1157  lXXSegmentPeriod.setOffTime (Duration_T (16, 0, 0));
1158  lXXSegmentPeriod.setElapsedTime (Duration_T (8, 0, 0));
1159  const CabinCode_T lY ("Y");
1160  const ClassList_String_T lYQ ("YQ");
1161  lXXSegmentPeriod.addCabinBookingClassList (lY,lYQ);
1162 
1163 
1164  }
1165 
1166  // //////////////////////////////////////////////////////////////////////
1167  void CmdBomManager::
1168  buildCompleteDummyInventoryForFareFamilies (BomRoot& ioBomRoot) {
1169 
1170  // Build a dummy inventory, containing a dummy flight-date with a
1171  // single segment-cabin and a single leg-cabin (for fare families
1172  // algorithms)
1173 
1174  // Get the default Inventory object (already built in by construction)
1175  const InventoryKey lInventoryKey (DEFAULT_AIRLINE_CODE);
1176  Inventory& lInv = BomManager::getObject<Inventory>(ioBomRoot,
1177  lInventoryKey.toString());
1178 
1179  // Create a dummy Flight-date
1180  const FlightDateKey lFlightDateKey(DEFAULT_FLIGHT_NUMBER_FF,
1182  FlightDate& lFlightDate =
1183  FacBom<FlightDate>::instance().create (lFlightDateKey);
1184  FacBomManager::addToListAndMap (lInv, lFlightDate);
1185  FacBomManager::linkWithParent (lInv, lFlightDate);
1186 
1187  // Create a dummy Leg-date
1188  LegDateKey lLegDateKey (DEFAULT_ORIGIN);
1189  LegDate& lLeg = FacBom<LegDate>::instance().create (lLegDateKey);
1190  FacBomManager::addToListAndMap (lFlightDate, lLeg);
1191  FacBomManager::linkWithParent (lFlightDate, lLeg);
1192 
1193  // Fill the LegDate content
1194  lLeg.setOffPoint (DEFAULT_DESTINATION);
1195  lLeg.setBoardingDate (DEFAULT_DEPARTURE_DATE);
1196  lLeg.setOffDate (DEFAULT_DEPARTURE_DATE);
1197  lLeg.setBoardingTime (Duration_T (14, 0, 0));
1198  lLeg.setOffTime (Duration_T (16, 0, 0));
1199  lLeg.setElapsedTime (Duration_T (8, 0, 0));
1200 
1201  // Create a dummy Leg-cabin
1202  const LegCabinKey lLegCabinKey (DEFAULT_CABIN_CODE);
1203  LegCabin& lLegCabin = FacBom<LegCabin>::instance().create (lLegCabinKey);
1204  FacBomManager::addToListAndMap (lLeg, lLegCabin);
1205  FacBomManager::linkWithParent (lLeg, lLegCabin);
1206  const CabinCapacity_T lCapacity = DEFAULT_CABIN_CAPACITY;
1207  lLegCabin.setCapacities (lCapacity);
1208  lLegCabin.setAvailabilityPool (lCapacity);
1209 
1210  // Create a dummy Segment-date
1211  const SegmentDateKey lSegmentDateKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
1212  SegmentDate& lSegment =
1213  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
1214  FacBomManager::addToListAndMap (lFlightDate, lSegment);
1215  FacBomManager::linkWithParent (lFlightDate, lSegment);
1216 
1217  // Add the routing leg key to the dummy segment.
1218  std::ostringstream oStr;
1219  oStr << DEFAULT_AIRLINE_CODE << ";"
1220  << DEFAULT_FLIGHT_NUMBER << ";"
1221  << DEFAULT_DEPARTURE_DATE << ";"
1222  << DEFAULT_ORIGIN;
1223  lSegment.addLegKey (oStr.str());
1224 
1225  // Fill the SegmentDate content
1226  lSegment.setBoardingDate (DEFAULT_DEPARTURE_DATE);
1227  lSegment.setOffDate (DEFAULT_DEPARTURE_DATE);
1228  lSegment.setBoardingTime (Duration_T (14, 0, 0));
1229  lSegment.setOffTime (Duration_T (16, 0, 0));
1230  lSegment.setElapsedTime (Duration_T (8, 0, 0));
1231 
1232  // Create a dummy Segment-cabin
1233  const SegmentCabinKey lSegmentCabinKey (DEFAULT_CABIN_CODE);
1234  SegmentCabin& lSegmentCabin =
1235  FacBom<SegmentCabin>::instance().create (lSegmentCabinKey);
1236  FacBomManager::addToListAndMap (lSegment, lSegmentCabin);
1237  FacBomManager::linkWithParent (lSegment, lSegmentCabin);
1238 
1239  // Create a dummy FareFamily (FF1)
1240  const FamilyCode_T l1 ("FF1");
1241  const FareFamilyKey l1FareFamilyKey (l1);
1242 
1243  FareFamily& lSegmentYCabin1Family =
1244  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
1245  // Set the forecasted demand
1246  // TODO change the size (hard code)
1247  MeanStdDevPairVector_T lDemandVector1FareFamily;
1248  const unsigned int size = 16;
1249  for (unsigned int idx = 0; idx < size; ++idx) {
1250  double i = static_cast<double> (idx);
1251  MeanStdDevPair_T lMeanStdDevPair (i/4.0, i/20.0);
1252  lDemandVector1FareFamily.push_back(lMeanStdDevPair);
1253  }
1254  lSegmentYCabin1Family.setMeanStdDev(lDemandVector1FareFamily);
1255  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1Family);
1256  FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin1Family);
1257 
1258  // Create a dummy booking-class
1259  const ClassCode_T lY ("Y");
1260  const BookingClassKey lYBookingClassKey (lY);
1261 
1262  BookingClass& lSegmentYCabin1FamilyYClass =
1263  FacBom<BookingClass>::instance().create (lYBookingClassKey);
1264  Yield_T lYield = 1000;
1265  lSegmentYCabin1FamilyYClass.setYield(lYield);
1266  FacBomManager::addToListAndMap (lSegmentYCabin1Family,
1267  lSegmentYCabin1FamilyYClass);
1268  FacBomManager::linkWithParent (lSegmentYCabin1Family,
1269  lSegmentYCabin1FamilyYClass);
1270 
1271  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyYClass);
1272  FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyYClass);
1273 
1274  // Create a second dummy booking-class
1275  const ClassCode_T lU ("U");
1276  const BookingClassKey lUBookingClassKey (lU);
1277 
1278  BookingClass& lSegmentYCabin1FamilyUClass =
1279  FacBom<BookingClass>::instance().create (lUBookingClassKey);
1280  lYield = 600;
1281  lSegmentYCabin1FamilyUClass.setYield(lYield);
1282  FacBomManager::addToListAndMap (lSegmentYCabin1Family,
1283  lSegmentYCabin1FamilyUClass);
1284  FacBomManager::linkWithParent (lSegmentYCabin1Family,
1285  lSegmentYCabin1FamilyUClass);
1286 
1287  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyUClass);
1288  FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyUClass);
1289 
1290  // Create a second dummy FareFamily (2)
1291  const FamilyCode_T l2 ("FF2");
1292  const FareFamilyKey l2FareFamilyKey (l2);
1293 
1294  FareFamily& lSegmentYCabin2Family =
1295  FacBom<FareFamily>::instance().create (l2FareFamilyKey);
1296  // Set the forecasted demand
1297  // TODO change the size (hard code)
1298  MeanStdDevPairVector_T lDemandVector2FareFamily;
1299  for (unsigned int idx = 0; idx < size; ++idx) {
1300  double i = static_cast<double> (idx);
1301  MeanStdDevPair_T lMeanStdDevPair (i/2.0, i/10.0);
1302  lDemandVector2FareFamily.push_back(lMeanStdDevPair);
1303  }
1304  lSegmentYCabin2Family.setMeanStdDev(lDemandVector2FareFamily);
1305 
1306  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2Family);
1307  FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin2Family);
1308 
1309  // Create a third dummy booking-class
1310  const ClassCode_T lO ("O");
1311  const BookingClassKey lOBookingClassKey (lO);
1312 
1313  BookingClass& lSegmentYCabin2FamilyOClass =
1314  FacBom<BookingClass>::instance().create (lOBookingClassKey);
1315  lYield = 750;
1316  lSegmentYCabin2FamilyOClass.setYield(lYield);
1317  FacBomManager::addToListAndMap (lSegmentYCabin2Family,
1318  lSegmentYCabin2FamilyOClass);
1319  FacBomManager::linkWithParent (lSegmentYCabin2Family,
1320  lSegmentYCabin2FamilyOClass);
1321 
1322  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2FamilyOClass);
1323  FacBomManager::addToListAndMap (lSegment, lSegmentYCabin2FamilyOClass);
1324 
1325  // Create a fourth dummy booking-class
1326  const ClassCode_T lQ ("Q");
1327  const BookingClassKey lQBookingClassKey (lQ);
1328 
1329  BookingClass& lSegmentYCabin2FamilyQClass =
1330  FacBom<BookingClass>::instance().create (lQBookingClassKey);
1331  lYield = 400;
1332  lSegmentYCabin2FamilyQClass.setYield(lYield);
1333  FacBomManager::addToListAndMap (lSegmentYCabin2Family,
1334  lSegmentYCabin2FamilyQClass);
1335  FacBomManager::linkWithParent (lSegmentYCabin2Family,
1336  lSegmentYCabin2FamilyQClass);
1337 
1338  FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin2FamilyQClass);
1339  FacBomManager::addToListAndMap (lSegment, lSegmentYCabin2FamilyQClass);
1340 
1341 
1342  /*================================================================================
1343  ================================================================================
1344  ================================================================================*/
1345  // Schedule:
1346  // XX:
1347  // Step 1: flight period level
1348  // Create a flight period for XX:
1349  const DoWStruct lDoWSrtuct ("1111111");
1350  const Date_T lXXDateRangeStart (DEFAULT_DEPARTURE_DATE);
1351  const Date_T lXXDateRangeEnd (DEFAULT_DEPARTURE_DATE);
1352  const DatePeriod_T lXXDatePeriod (lXXDateRangeStart, lXXDateRangeEnd);
1353  const PeriodStruct lXXPeriodStruct (lXXDatePeriod, lDoWSrtuct);
1354 
1355  const FlightPeriodKey lXXFlightPeriodKey (DEFAULT_FLIGHT_NUMBER_FF,
1356  lXXPeriodStruct);
1357 
1358  FlightPeriod& lXXFlightPeriod =
1359  FacBom<FlightPeriod>::instance().create (lXXFlightPeriodKey);
1360  FacBomManager::addToListAndMap (lInv, lXXFlightPeriod);
1361  FacBomManager::linkWithParent (lInv, lXXFlightPeriod);
1362 
1363  // Step 2: segment period level
1364  // Create a segment period
1365  const SegmentPeriodKey lXXSegmentPeriodKey (DEFAULT_ORIGIN,
1367 
1368  SegmentPeriod& lXXSegmentPeriod =
1369  FacBom<SegmentPeriod>::instance().create (lXXSegmentPeriodKey);
1370  FacBomManager::addToListAndMap (lXXFlightPeriod, lXXSegmentPeriod);
1371  FacBomManager::linkWithParent (lXXFlightPeriod, lXXSegmentPeriod);
1372 
1373  lXXSegmentPeriod.setBoardingTime (Duration_T (14, 0, 0));
1374  lXXSegmentPeriod.setOffTime (Duration_T (16, 0, 0));
1375  lXXSegmentPeriod.setElapsedTime (Duration_T (8, 0, 0));
1376  const CabinCode_T lYCabin ("Y");
1377  const ClassList_String_T lYUOQ ("YUOQ");
1378  lXXSegmentPeriod.addCabinBookingClassList (lYCabin,lYUOQ);
1379 
1380  }
1381 
1382  // //////////////////////////////////////////////////////////////////////
1383  void CmdBomManager::buildSamplePricing (BomRoot& ioBomRoot) {
1384 
1385  // Set the airport-pair primary key.
1386  const AirportPairKey lAirportPairKey (AIRPORT_LHR, AIRPORT_SYD);
1387 
1388  // Create the AirportPairKey object and link it to the BOM tree root.
1389  AirportPair& lAirportPair =
1390  FacBom<AirportPair>::instance().create (lAirportPairKey);
1391  FacBomManager::addToListAndMap (ioBomRoot, lAirportPair);
1392  FacBomManager::linkWithParent (ioBomRoot, lAirportPair);
1393 
1394  // Set the fare date-period primary key.
1395  const Date_T lDateRangeStart (2011, boost::gregorian::Jan, 15);
1396  const Date_T lDateRangeEnd (2011, boost::gregorian::Dec, 31);
1397  const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
1398  const DatePeriodKey lDatePeriodKey (lDateRange);
1399 
1400  // Create the DatePeriodKey object and link it to the PosChannel object.
1401  DatePeriod& lDatePeriod =
1402  FacBom<DatePeriod>::instance().create (lDatePeriodKey);
1403  FacBomManager::addToListAndMap (lAirportPair, lDatePeriod);
1404  FacBomManager::linkWithParent (lAirportPair, lDatePeriod);
1405 
1406  // Set the point-of-sale-channel primary key.
1407  const PosChannelKey lPosChannelKey (POS_LHR, CHANNEL_DN);
1408 
1409  // Create the PositionKey object and link it to the AirportPair object.
1410  PosChannel& lPosChannel =
1411  FacBom<PosChannel>::instance().create (lPosChannelKey);
1412  FacBomManager::addToListAndMap (lDatePeriod, lPosChannel);
1413  FacBomManager::linkWithParent (lDatePeriod, lPosChannel);
1414 
1415  // Set the fare time-period primary key.
1416  const Time_T lTimeRangeStart (0, 0, 0);
1417  const Time_T lTimeRangeEnd (23, 0, 0);
1418  const TimePeriodKey lTimePeriodKey (lTimeRangeStart, lTimeRangeEnd);
1419 
1420  // Create the TimePeriodKey and link it to the DatePeriod object.
1421  TimePeriod& lTimePeriod =
1422  FacBom<TimePeriod>::instance().create (lTimePeriodKey);
1423  FacBomManager::addToListAndMap (lPosChannel, lTimePeriod);
1424  FacBomManager::linkWithParent (lPosChannel, lTimePeriod);
1425 
1426  // Pricing -- Generate the FareRule
1427  const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ROUND_TRIP,
1429  SATURDAY_STAY,
1430  CHANGE_FEES,
1433 
1434  // Create the FareFeaturesKey and link it to the TimePeriod object.
1435  FareFeatures& lFareFeatures =
1436  FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
1437  FacBomManager::addToListAndMap (lTimePeriod, lFareFeatures);
1438  FacBomManager::linkWithParent (lTimePeriod, lFareFeatures);
1439 
1440  // Revenue Accounting -- Generate the YieldRule
1441  const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ROUND_TRIP,
1442  CABIN_Y);
1443 
1444  // Create the YieldFeaturesKey and link it to the TimePeriod object.
1445  YieldFeatures& lYieldFeatures =
1446  FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
1447  FacBomManager::addToListAndMap (lTimePeriod, lYieldFeatures);
1448  FacBomManager::linkWithParent (lTimePeriod, lYieldFeatures);
1449 
1450  // Generate Segment Features and link them to their respective
1451  // fare and yield rules.
1452  AirlineCodeList_T lAirlineCodeList;
1453  lAirlineCodeList.push_back (AIRLINE_CODE_BA);
1454  ClassList_StringList_T lClassCodeList;
1455  lClassCodeList.push_back (CLASS_CODE_Y);
1456  const AirlineClassListKey lAirlineClassListKey (lAirlineCodeList,
1457  lClassCodeList);
1458 
1459  // Create the AirlineClassList
1460  AirlineClassList& lAirlineClassList =
1461  FacBom<AirlineClassList>::instance().create (lAirlineClassListKey);
1462  // Link the AirlineClassList to the FareFeatures object
1463  lAirlineClassList.setFare (900);
1464  FacBomManager::addToListAndMap (lFareFeatures, lAirlineClassList);
1465  FacBomManager::linkWithParent (lFareFeatures, lAirlineClassList);
1466 
1467  // Link the AirlineClassList to the YieldFeatures object
1468  lAirlineClassList.setYield (900);
1469  FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassList);
1470  // \todo (gsabatier): the following calls overrides the parent for
1471  // lAirlineClassList. Check that it is what is actually wanted.
1472  FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassList);
1473  }
1474 
1475  // //////////////////////////////////////////////////////////////////////
1476  void CmdBomManager::buildSamplePricingForFareFamilies (BomRoot& ioBomRoot) {
1477 
1478  // Get the airport-pair primary key SIN-BKK
1479  // (already built by construction)
1480  const AirportPairKey lAirportPairKey ("SIN", "BKK");
1481  AirportPair& lAirportPair =
1482  BomManager::getObject<AirportPair>(ioBomRoot, lAirportPairKey.toString());
1483 
1484  // Set the fare date-period primary key.
1485  const Date_T lDateRangeStart (2010, boost::gregorian::Feb, 1);
1486  const Date_T lDateRangeEnd (2011, boost::gregorian::Feb, 15);
1487  const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
1488  const DatePeriodKey lDatePeriodKey (lDateRange);
1489 
1490  // Create the DatePeriodKey object and link it to the PosChannel object.
1491  DatePeriod& lDatePeriod =
1492  FacBom<DatePeriod>::instance().create (lDatePeriodKey);
1493  FacBomManager::addToListAndMap (lAirportPair, lDatePeriod);
1494  FacBomManager::linkWithParent (lAirportPair, lDatePeriod);
1495 
1496  // Set the point-of-sale-channel primary key.
1497  const PosChannelKey lPosChannelKey ("SIN", CHANNEL_IN);
1498 
1499  // Create the PositionKey object and link it to the AirportPair object.
1500  PosChannel& lPosChannel =
1501  FacBom<PosChannel>::instance().create (lPosChannelKey);
1502  FacBomManager::addToListAndMap (lDatePeriod, lPosChannel);
1503  FacBomManager::linkWithParent (lDatePeriod, lPosChannel);
1504 
1505  // Set the fare time-period primary key.
1506  const Time_T lTimeRangeStart (0, 0, 0);
1507  const Time_T lTimeRangeEnd (23, 0, 0);
1508  const TimePeriodKey lTimePeriodKey (lTimeRangeStart, lTimeRangeEnd);
1509 
1510  // Create the TimePeriodKey and link it to the DatePeriod object.
1511  TimePeriod& lTimePeriod =
1512  FacBom<TimePeriod>::instance().create (lTimePeriodKey);
1513  FacBomManager::addToListAndMap (lPosChannel, lTimePeriod);
1514  FacBomManager::linkWithParent (lPosChannel, lTimePeriod);
1515 
1516  // Pricing -- Generate the FareRule
1517  const DayDuration_T ONE_MONTH_ADVANCE_PURCHASE = 30;
1518  // Generate the first FareFeatures for the class Q
1519  const FareFeaturesKey lFareFeaturesQKey (TRIP_TYPE_ONE_WAY,
1520  ONE_MONTH_ADVANCE_PURCHASE,
1521  SATURDAY_STAY,
1522  CHANGE_FEES,
1525 
1526  // Create the FareFeaturesKey and link it to the TimePeriod object.
1527  FareFeatures& lFareFeaturesQ =
1528  FacBom<FareFeatures>::instance().create (lFareFeaturesQKey);
1529  FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesQ);
1530  FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesQ);
1531 
1532  // Generate the second FareFeatures for the class M
1533  const FareFeaturesKey lFareFeaturesMKey (TRIP_TYPE_ONE_WAY,
1535  SATURDAY_STAY,
1536  CHANGE_FEES,
1539 
1540  // Create the FareFeaturesKey and link it to the TimePeriod object.
1541  FareFeatures& lFareFeaturesM =
1542  FacBom<FareFeatures>::instance().create (lFareFeaturesMKey);
1543  FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesM);
1544  FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesM);
1545 
1546  // Generate the third FareFeatures for the class B
1547  const FareFeaturesKey lFareFeaturesBKey (TRIP_TYPE_ONE_WAY,
1548  ONE_MONTH_ADVANCE_PURCHASE,
1549  SATURDAY_STAY,
1551  NO_NON_REFUNDABLE,//Refundable
1553 
1554  // Create the FareFeaturesKey and link it to the TimePeriod object.
1555  FareFeatures& lFareFeaturesB =
1556  FacBom<FareFeatures>::instance().create (lFareFeaturesBKey);
1557  FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesB);
1558  FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesB);
1559 
1560  // Generate the fourth FareFeatures for the class Y
1561  const FareFeaturesKey lFareFeaturesYKey (TRIP_TYPE_ONE_WAY,
1563  SATURDAY_STAY,
1565  NO_NON_REFUNDABLE,//Refundable
1567 
1568  // Create the FareFeaturesKey and link it to the TimePeriod object.
1569  FareFeatures& lFareFeaturesY =
1570  FacBom<FareFeatures>::instance().create (lFareFeaturesYKey);
1571  FacBomManager::addToListAndMap (lTimePeriod, lFareFeaturesY);
1572  FacBomManager::linkWithParent (lTimePeriod, lFareFeaturesY);
1573 
1574  // Revenue Accounting -- Generate the YieldRule
1575  const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
1576  CABIN_Y);
1577 
1578  // Create the YieldFeaturesKey and link it to the TimePeriod object.
1579  YieldFeatures& lYieldFeatures =
1580  FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
1581  FacBomManager::addToListAndMap (lTimePeriod, lYieldFeatures);
1582  FacBomManager::linkWithParent (lTimePeriod, lYieldFeatures);
1583 
1584  // Generate Segment Features and link them to their respective
1585  // fare and yield rules.
1586  AirlineCodeList_T lAirlineCodeList;
1587  lAirlineCodeList.push_back ("SQ");
1588 
1589  ClassList_StringList_T lClassYList;
1590  lClassYList.push_back (CLASS_CODE_Y);
1591  const AirlineClassListKey lAirlineClassYListKey (lAirlineCodeList,
1592  lClassYList);
1593 
1594  // Create the AirlineClassList
1595  AirlineClassList& lAirlineClassYList =
1596  FacBom<AirlineClassList>::instance().create (lAirlineClassYListKey);
1597  // Link the AirlineClassList to the FareFeatures object
1598  FacBomManager::addToListAndMap (lFareFeaturesY, lAirlineClassYList);
1599  FacBomManager::linkWithParent (lFareFeaturesY, lAirlineClassYList);
1600  lAirlineClassYList.setFare (1200);
1601  lAirlineClassYList.setYield (1200);
1602 
1603  // Link the AirlineClassList to the YieldFeatures object
1604  FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassYList);
1605  // \todo (gsabatier): the following calls overrides the parent for
1606  // lAirlineClassList. Check that it is what is actually wanted.
1607  FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassYList);
1608 
1609  ClassList_StringList_T lClassBList;
1610  lClassBList.push_back ("B");
1611  const AirlineClassListKey lAirlineClassBListKey (lAirlineCodeList,
1612  lClassBList);
1613  // Create the AirlineClassList
1614  AirlineClassList& lAirlineClassBList =
1615  FacBom<AirlineClassList>::instance().create (lAirlineClassBListKey);
1616  // Link the AirlineClassList to the FareFeatures object
1617  FacBomManager::addToListAndMap (lFareFeaturesB, lAirlineClassBList);
1618  FacBomManager::linkWithParent (lFareFeaturesB, lAirlineClassBList);
1619  lAirlineClassBList.setFare (800);
1620  lAirlineClassBList.setYield (800);
1621 
1622  // Link the AirlineClassList to the YieldFeatures object
1623  FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassBList);
1624  // \todo (gsabatier): the following calls overrides the parent for
1625  // lAirlineClassList. Check that it is what is actually wanted.
1626  FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassBList);
1627 
1628  ClassList_StringList_T lClassMList;
1629  lClassMList.push_back ("M");
1630  const AirlineClassListKey lAirlineClassMListKey (lAirlineCodeList,
1631  lClassMList);
1632 
1633  // Create the AirlineClassList
1634  AirlineClassList& lAirlineClassMList =
1635  FacBom<AirlineClassList>::instance().create (lAirlineClassMListKey);
1636  // Link the AirlineClassList to the FareFeatures object
1637  FacBomManager::addToListAndMap (lFareFeaturesM, lAirlineClassMList);
1638  FacBomManager::linkWithParent (lFareFeaturesM, lAirlineClassMList);
1639  lAirlineClassMList.setFare (900);
1640  lAirlineClassMList.setYield (900);
1641 
1642  // Link the AirlineClassList to the YieldFeatures object
1643  FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassMList);
1644  // \todo (gsabatier): the following calls overrides the parent for
1645  // lAirlineClassList. Check that it is what is actually wanted.
1646  FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassMList);
1647 
1648  ClassList_StringList_T lClassQList;
1649  lClassQList.push_back ("Q");
1650  const AirlineClassListKey lAirlineClassQListKey (lAirlineCodeList,
1651  lClassQList);
1652 
1653  // Create the AirlineClassList
1654  AirlineClassList& lAirlineClassQList =
1655  FacBom<AirlineClassList>::instance().create (lAirlineClassQListKey);
1656  // Link the AirlineClassList to the FareFeatures object
1657  FacBomManager::addToListAndMap (lFareFeaturesQ, lAirlineClassQList);
1658  FacBomManager::linkWithParent (lFareFeaturesQ, lAirlineClassQList);
1659  lAirlineClassQList.setFare (600);
1660  lAirlineClassQList.setYield (600);
1661 
1662  // Link the AirlineClassList to the YieldFeatures object
1663  FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassQList);
1664  // \todo (gsabatier): the following calls overrides the parent for
1665  // lAirlineClassList. Check that it is what is actually wanted.
1666  FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassQList);
1667 
1668  }
1669 
1670  // //////////////////////////////////////////////////////////////////////
1671  void CmdBomManager::
1672  buildSampleTravelSolutionForPricing (TravelSolutionList_T& ioTravelSolutionList) {
1673 
1674  // Clean the list
1675  ioTravelSolutionList.clear();
1676 
1677  //
1678  const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
1679 
1680  // Add the segment date key to the travel solution
1681  TravelSolutionStruct lTS;
1682  lTS.addSegment (lBA9_SegmentDateKey);
1683 
1684  // Add the travel solution to the list
1685  ioTravelSolutionList.push_back (lTS);
1686  }
1687 
1688  // //////////////////////////////////////////////////////////////////////
1689  void CmdBomManager::
1690  buildSampleTravelSolutions (TravelSolutionList_T& ioTravelSolutionList) {
1691 
1692  // Clean the list
1693  ioTravelSolutionList.clear();
1694 
1695  //
1696  const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
1697 
1698  // Add the segment date key to the travel solution
1699  TravelSolutionStruct lTS1;
1700  lTS1.addSegment (lBA9_SegmentDateKey);
1701 
1702  // Fare option number 1
1703  const ClassCode_T lClassPathQ (CLASS_CODE_Q);
1704  const Fare_T lFare900 (900);
1705  const ChangeFees_T lChangeFee (CHANGE_FEES);
1706  const NonRefundable_T isNonRefundable (NON_REFUNDABLE);
1707  const SaturdayStay_T lSaturdayStay (SATURDAY_STAY);
1708  const FareOptionStruct lFareOption1 (lClassPathQ, lFare900, lChangeFee,
1709  isNonRefundable, lSaturdayStay);
1710 
1711  // Add (a copy of) the fare option
1712  lTS1.addFareOption (lFareOption1);
1713  //
1714 
1715  // Map of class availabilities: set the availability for the Q
1716  // booking class (the one corresponding to the fare option) to 8.
1717  ClassAvailabilityMap_T lClassAvailabilityMap1;
1718  const Availability_T lAvl1 (8);
1719  bool hasInsertOfQBeenSuccessful = lClassAvailabilityMap1.
1720  insert (ClassAvailabilityMap_T::value_type (lClassPathQ, lAvl1)).second;
1721  assert (hasInsertOfQBeenSuccessful == true);
1722  // Add the map to the dedicated list held by the travel solution
1723  lTS1.addClassAvailabilityMap (lClassAvailabilityMap1);
1724 
1725  // Add the travel solution to the list
1726  ioTravelSolutionList.push_back (lTS1);
1727 
1728  //
1729  const std::string lQF12_SegmentDateKey ("QF, 12, 2011-06-10, LHR, SYD, 20:45");
1730 
1731  // Add the segment date key to the travel solution
1732  TravelSolutionStruct lTS2;
1733  lTS2.addSegment (lQF12_SegmentDateKey);
1734 
1735  // Fare option number 2
1736  const ClassCode_T lClassPathY (CLASS_CODE_Y);
1737  const Fare_T lFare1000 (1000);
1738  const ChangeFees_T lNoChangeFee (NO_CHANGE_FEES);
1739  const NonRefundable_T isRefundable (NO_NON_REFUNDABLE);
1740  const FareOptionStruct lFareOption2 (lClassPathY, lFare1000, lNoChangeFee,
1741  isRefundable, lSaturdayStay);
1742 
1743  // Map of class availabilities: set the availability for the Y
1744  // booking class (the one corresponding to the fare option) to 9.
1745  ClassAvailabilityMap_T lClassAvailabilityMap2;
1746  const Availability_T lAvl2 (9);
1747  const bool hasInsertOfYBeenSuccessful = lClassAvailabilityMap2.
1748  insert (ClassAvailabilityMap_T::value_type (lClassPathY, lAvl2)).second;
1749  assert (hasInsertOfYBeenSuccessful == true);
1750  // Add the map to the dedicated list held by the travel solution
1751  lTS2.addClassAvailabilityMap (lClassAvailabilityMap2);
1752 
1753  // Add (a copy of) the fare option
1754  lTS2.addFareOption (lFareOption2);
1755 
1756  // Fare option number 3
1757  const Fare_T lFare920 (920);
1758  const FareOptionStruct lFareOption3 (lClassPathQ, lFare920, lNoChangeFee,
1759  isNonRefundable, lSaturdayStay);
1760 
1761  // Map of class availabilities: set the availability for the Q
1762  // booking class (the one corresponding to the fare option) to 9.
1763  hasInsertOfQBeenSuccessful = lClassAvailabilityMap2.
1764  insert (ClassAvailabilityMap_T::value_type (lClassPathQ, lAvl2)).second;
1765  assert (hasInsertOfYBeenSuccessful == true);
1766  // Add the map to the dedicated list held by the travel solution
1767  lTS2.addClassAvailabilityMap (lClassAvailabilityMap2);
1768 
1769  // Add (a copy of) the fare option
1770  lTS2.addFareOption (lFareOption3);
1771 
1772  // Add the travel solution to the list
1773  ioTravelSolutionList.push_back (lTS2);
1774 
1775  }
1776 
1777  // //////////////////////////////////////////////////////////////////////
1778  BookingRequestStruct CmdBomManager::buildSampleBookingRequest() {
1779  // Origin
1780  const AirportCode_T lOrigin (AIRPORT_LHR);
1781 
1782  // Destination
1783  const AirportCode_T lDestination (AIRPORT_SYD);
1784 
1785  // Point of Sale (POS)
1786  const CityCode_T lPOS (POS_LHR);
1787 
1788  // Preferred departure date (10-JUN-2011)
1789  const Date_T lPreferredDepartureDate (2011, boost::gregorian::Jun, 10);
1790 
1791  // Preferred departure time (08:00)
1792  const Duration_T lPreferredDepartureTime (8, 0, 0);
1793 
1794  // Date of the request (15-MAY-2011)
1795  const Date_T lRequestDate (2011, boost::gregorian::May, 15);
1796 
1797  // Time of the request (10:00)
1798  const Duration_T lRequestTime (10, 0, 0);
1799 
1800  // Date-time of the request (made of the date and time above)
1801  const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
1802 
1803  // Preferred cabin (also named class of service sometimes)
1804  const CabinCode_T lPreferredCabin (CABIN_ECO);
1805 
1806  // Number of persons in the party
1807  const PartySize_T lPartySize (3);
1808 
1809  // Channel (direct/indirect, on-line/off-line)
1810  const ChannelLabel_T lChannel (CHANNEL_DN);
1811 
1812  // Type of the trip (one-way, inbound/outbound of a return trip)
1813  const TripType_T lTripType (TRIP_TYPE_INBOUND);
1814 
1815  // Duration of the stay (expressed as a number of days)
1816  const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
1817 
1818  // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
1819  const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
1820 
1821  // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
1822  const WTP_T lWTP (DEFAULT_WTP);
1823 
1824  // Value of time, for the customer (expressed in monetary unit per
1825  // unit of time, e.g., EUR/hour)
1826  const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
1827 
1828  // Restrictions
1829  const ChangeFees_T lChangeFees = false;
1830  const Disutility_T lChangeFeeDisutility = 30;
1831  const NonRefundable_T lNonRefundable = false;
1832  const Disutility_T lNonRefundableDisutility = 50;
1833 
1834  // Creation of the booking request structure
1835  BookingRequestStruct oBookingRequest (lOrigin, lDestination, lPOS,
1836  lPreferredDepartureDate,
1837  lRequestDateTime,
1838  lPreferredCabin,
1839  lPartySize, lChannel,
1840  lTripType, lStayDuration,
1841  lFrequentFlyerType,
1842  lPreferredDepartureTime,
1843  lWTP, lValueOfTime,
1844  lChangeFees, lChangeFeeDisutility,
1845  lNonRefundable,
1846  lNonRefundableDisutility);
1847 
1848  return oBookingRequest;
1849  }
1850 
1851  // //////////////////////////////////////////////////////////////////////
1852  BookingRequestStruct CmdBomManager::buildSampleBookingRequestForCRS() {
1853  // Origin
1854  const AirportCode_T lOrigin (AIRPORT_SIN);
1855 
1856  // Destination
1857  const AirportCode_T lDestination (AIRPORT_BKK);
1858 
1859  // Point of Sale (POS)
1860  const CityCode_T lPOS (POS_SIN);
1861 
1862  // Preferred departure date (30-JAN-2010)
1863  const Date_T lPreferredDepartureDate (2010, boost::gregorian::Jan, 30);
1864 
1865  // Preferred departure time (10:00)
1866  const Duration_T lPreferredDepartureTime (10, 0, 0);
1867 
1868  // Date of the request (22-JAN-2010)
1869  const Date_T lRequestDate (2010, boost::gregorian::Jan, 22);
1870 
1871  // Time of the request (10:00)
1872  const Duration_T lRequestTime (10, 0, 0);
1873 
1874  // Date-time of the request (made of the date and time above)
1875  const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
1876 
1877  // Preferred cabin (also named class of service sometimes)
1878  const CabinCode_T lPreferredCabin (CABIN_ECO);
1879 
1880  // Number of persons in the party
1881  const PartySize_T lPartySize (3);
1882 
1883  // Channel (direct/indirect, on-line/off-line)
1884  const ChannelLabel_T lChannel (CHANNEL_IN);
1885 
1886  // Type of the trip (one-way, inbound/outbound of a return trip)
1887  const TripType_T lTripType (TRIP_TYPE_INBOUND);
1888 
1889  // Duration of the stay (expressed as a number of days)
1890  const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
1891 
1892  // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
1893  const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
1894 
1895  // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
1896  const WTP_T lWTP (DEFAULT_WTP);
1897 
1898  // Value of time, for the customer (expressed in monetary unit per
1899  // unit of time, e.g., EUR/hour)
1900  const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
1901 
1902  // Restrictions
1903  const ChangeFees_T lChangeFees = true;
1904  const Disutility_T lChangeFeeDisutility = 50;
1905  const NonRefundable_T lNonRefundable = true;
1906  const Disutility_T lNonRefundableDisutility = 50;
1907 
1908  // Creation of the booking request structure
1909  BookingRequestStruct oBookingRequest (lOrigin,
1910  lDestination,
1911  lPOS,
1912  lPreferredDepartureDate,
1913  lRequestDateTime,
1914  lPreferredCabin,
1915  lPartySize, lChannel,
1916  lTripType, lStayDuration,
1917  lFrequentFlyerType,
1918  lPreferredDepartureTime,
1919  lWTP, lValueOfTime,
1920  lChangeFees, lChangeFeeDisutility,
1921  lNonRefundable,
1922  lNonRefundableDisutility);
1923 
1924  return oBookingRequest;
1925  }
1926 
1927  // //////////////////////////////////////////////////////////////////////
1928  void CmdBomManager::
1929  buildPartnershipsSampleInventoryAndRM (BomRoot& ioBomRoot) {
1930 
1931  // Step 0.1: Inventory level
1932  // Create an Inventory for SQ
1933  const AirlineCode_T lAirlineCodeSQ ("SQ");
1934  const InventoryKey lSQKey (lAirlineCodeSQ);
1935  Inventory& lSQInv = FacBom<Inventory>::instance().create (lSQKey);
1936  FacBomManager::addToListAndMap (ioBomRoot, lSQInv);
1937  FacBomManager::linkWithParent (ioBomRoot, lSQInv);
1938 
1939  // Add the airline feature object to the SQ inventory
1940  const AirlineFeatureKey lAirlineFeatureSQKey (lAirlineCodeSQ);
1941  AirlineFeature& lAirlineFeatureSQ =
1942  FacBom<AirlineFeature>::instance().create (lAirlineFeatureSQKey);
1943  FacBomManager::setAirlineFeature (lSQInv, lAirlineFeatureSQ);
1944  FacBomManager::linkWithParent (lSQInv, lAirlineFeatureSQ);
1945  // Link the airline feature object with the top of the BOM tree
1946  FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureSQ);
1947 
1948  // Create an Inventory for CX
1949  const AirlineCode_T lAirlineCodeCX ("CX");
1950  const InventoryKey lCXKey (lAirlineCodeCX);
1951  Inventory& lCXInv = FacBom<Inventory>::instance().create (lCXKey);
1952  FacBomManager::addToListAndMap (ioBomRoot, lCXInv);
1953  FacBomManager::linkWithParent (ioBomRoot, lCXInv);
1954 
1955  // Add the airline feature object to the CX inventory
1956  const AirlineFeatureKey lAirlineFeatureCXKey (lAirlineCodeCX);
1957  AirlineFeature& lAirlineFeatureCX =
1958  FacBom<AirlineFeature>::instance().create (lAirlineFeatureCXKey);
1959  FacBomManager::setAirlineFeature (lCXInv, lAirlineFeatureCX);
1960  FacBomManager::linkWithParent (lCXInv, lAirlineFeatureCX);
1961  // Link the airline feature object with the top of the BOM tree
1962  FacBomManager::addToListAndMap (ioBomRoot, lAirlineFeatureCX);
1963 
1964  // ////// SQ ///////
1965  // Step 0.2: Flight-date level
1966  // Create a FlightDate (SQ11/08-MAR-2010) for SQ's Inventory
1967  FlightNumber_T lFlightNumber = 11;
1968  Date_T lDate (2010, 3, 8);
1969  FlightDateKey lFlightDateKey (lFlightNumber, lDate);
1970 
1971  FlightDate& lSQ11_20100308_FD =
1972  FacBom<FlightDate>::instance().create (lFlightDateKey);
1973  FacBomManager::addToListAndMap (lSQInv, lSQ11_20100308_FD);
1974  FacBomManager::linkWithParent (lSQInv, lSQ11_20100308_FD);
1975 
1976  // Create a (mkt) FlightDate (SQ1200/08-MAR-2010) for SQ's Inventory
1977  FlightNumber_T lMktFlightNumber = 1200;
1978  //lDate = Date_T (2010, 3, 8);
1979  FlightDateKey lMktFlightDateKey (lMktFlightNumber, lDate);
1980 
1981  FlightDate& lSQ1200_20100308_FD =
1982  FacBom<FlightDate>::instance().create (lMktFlightDateKey);
1983  FacBomManager::addToListAndMap (lSQInv, lSQ1200_20100308_FD);
1984  FacBomManager::linkWithParent (lSQInv, lSQ1200_20100308_FD);
1985 
1986  // Display the flight-date
1987  // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
1988 
1989  // Step 0.3: Segment-date level
1990  // Create a first SegmentDate (SIN-BKK) for SQ's Inventory
1991  const AirportCode_T lSIN ("SIN");
1992  const AirportCode_T lBKK ("BKK");
1993  const Duration_T l0820 (8, 20, 0);
1994  const Duration_T l1100 (11, 0, 0);
1995  const Duration_T l0340 (3, 40, 0);
1996  SegmentDateKey lSegmentDateKey (lSIN, lBKK);
1997 
1998  SegmentDate& lSINBKKSegment =
1999  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
2000  FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINBKKSegment);
2001  FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINBKKSegment);
2002 
2003  // Add the routing leg key to the SIN-BKK segment.
2004  const std::string lSQSINRoutingLegStr = "SQ;11;2010-Mar-8;SIN";
2005  lSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
2006 
2007  // Fill the SegmentDate content
2008  lSINBKKSegment.setBoardingDate (lDate);
2009  lSINBKKSegment.setOffDate (lDate);
2010  lSINBKKSegment.setBoardingTime (l0820);
2011  lSINBKKSegment.setOffTime (l1100);
2012  lSINBKKSegment.setElapsedTime (l0340);
2013 
2014  // Create a second (mkt) SegmentDate (BKK-HKG) for SQ's Inventory
2015  const AirportCode_T lHKG ("HKG");
2016  const Duration_T l1200 (12, 0, 0);
2017  const Duration_T l1540 (15, 40, 0);
2018  const Duration_T l0240 (2, 40, 0);
2019  SegmentDateKey lMktSegmentDateKey (lBKK, lHKG);
2020 
2021  SegmentDate& lMktBKKHKGSegment =
2022  FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
2023  FacBomManager::addToListAndMap (lSQ1200_20100308_FD, lMktBKKHKGSegment);
2024  FacBomManager::linkWithParent (lSQ1200_20100308_FD, lMktBKKHKGSegment);
2025 
2026  // Add the routing leg key CX;12;2010-Mar-8;BKK to the marketing
2027  // SQ;1200;2010-Mar-8;BKK-HKG segment.
2028  const std::string lCXBKKRoutingLegStr = "CX;12;2010-Mar-8;BKK";
2029  lMktBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
2030 
2031  // Fill the (mkt) SegmentDate content
2032  lMktBKKHKGSegment.setBoardingDate (lDate);
2033  lMktBKKHKGSegment.setOffDate (lDate);
2034  lMktBKKHKGSegment.setBoardingTime (l1200);
2035  lMktBKKHKGSegment.setOffTime (l1540);
2036  lMktBKKHKGSegment.setElapsedTime (l0240);
2037 
2038  // Step 0.4: Leg-date level
2039  // Create a first LegDate (SIN) for SQ's Inventory
2040  LegDateKey lLegDateKey (lSIN);
2041 
2042  LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
2043  FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINLeg);
2044  FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINLeg);
2045 
2046  // Fill the LegDate content
2047  lSINLeg.setOffPoint (lBKK);
2048  lSINLeg.setBoardingDate (lDate);
2049  lSINLeg.setOffDate (lDate);
2050  lSINLeg.setBoardingTime (l0820);
2051  lSINLeg.setOffTime (l1100);
2052  lSINLeg.setElapsedTime (l0340);
2053 
2054  // Step 0.5: segment-cabin level
2055  // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
2056  const CabinCode_T lY ("Y");
2057  SegmentCabinKey lYSegmentCabinKey (lY);
2058 
2059  SegmentCabin& lSINBKKSegmentYCabin =
2060  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2061  FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
2062  FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
2063 
2064  // Create a SegmentCabin (Y) for the (mkt) Segment BKK-HKG of SQ's Inventory
2065  SegmentCabin& lMktBKKHKGSegmentYCabin =
2066  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2067  FacBomManager::addToListAndMap (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
2068  FacBomManager::linkWithParent (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
2069 
2070 
2071  // Step 0.6: leg-cabin level
2072  // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
2073  LegCabinKey lYLegCabinKey (lY);
2074 
2075  LegCabin& lSINLegYCabin =
2076  FacBom<LegCabin>::instance().create (lYLegCabinKey);
2077  FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
2078  FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
2079 
2080  CabinCapacity_T lCapacity (100);
2081  lSINLegYCabin.setCapacities (lCapacity);
2082  lSINLegYCabin.setAvailabilityPool (lCapacity);
2083 
2084 
2085  // Step 0.7: fare family level
2086  // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
2087  const FamilyCode_T l1 ("EcoSaver");
2088  FareFamilyKey l1FareFamilyKey (l1);
2089 
2090  FareFamily& lSINBKKSegmentYCabin1Family =
2091  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2092  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2093  lSINBKKSegmentYCabin1Family);
2094  FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
2095  lSINBKKSegmentYCabin1Family);
2096 
2097  // Create a FareFamily (1) for the (mkt) Segment BKK-HKG, cabin Y on SQ's Inv
2098  FareFamily& lMktBKKHKGSegmentYCabin1Family =
2099  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2100  FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2101  lMktBKKHKGSegmentYCabin1Family);
2102  FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin,
2103  lMktBKKHKGSegmentYCabin1Family);
2104 
2105  // Step 0.8: booking class level
2106  // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
2107  // fare family 1 on SQ's Inv
2108  BookingClassKey lYBookingClassKey (lY);
2109 
2110  BookingClass& lSINBKKSegmentYCabin1FamilyYClass =
2111  FacBom<BookingClass>::instance().create (lYBookingClassKey);
2112  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
2113  lSINBKKSegmentYCabin1FamilyYClass);
2114  FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
2115  lSINBKKSegmentYCabin1FamilyYClass);
2116 
2117  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2118  lSINBKKSegmentYCabin1FamilyYClass);
2119  FacBomManager::addToListAndMap (lSINBKKSegment,
2120  lSINBKKSegmentYCabin1FamilyYClass);
2121 
2122  lSINBKKSegmentYCabin1FamilyYClass.setYield(700);
2123 
2124  // Create a BookingClass (Y) for the (mkt) Segment BKK-HKG, cabin Y,
2125  // fare family 1 on SQ's Inv
2126  BookingClass& lMktBKKHKGSegmentYCabin1FamilyYClass =
2127  FacBom<BookingClass>::instance().create (lYBookingClassKey);
2128  FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
2129  lMktBKKHKGSegmentYCabin1FamilyYClass);
2130  FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
2131  lMktBKKHKGSegmentYCabin1FamilyYClass);
2132 
2133  FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2134  lMktBKKHKGSegmentYCabin1FamilyYClass);
2135  FacBomManager::addToListAndMap (lMktBKKHKGSegment,
2136  lMktBKKHKGSegmentYCabin1FamilyYClass);
2137 
2138  lMktBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
2139 
2140 
2141  // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
2142  // fare family 1 on SQ's Inv
2143  const ClassCode_T lM ("M");
2144  BookingClassKey lMBookingClassKey (lM);
2145 
2146  BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
2147  FacBom<BookingClass>::instance().create (lMBookingClassKey);
2148  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
2149  lSINBKKSegmentYCabin1FamilyMClass);
2150  FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
2151  lSINBKKSegmentYCabin1FamilyMClass);
2152 
2153  FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2154  lSINBKKSegmentYCabin1FamilyMClass);
2155  FacBomManager::addToListAndMap (lSINBKKSegment,
2156  lSINBKKSegmentYCabin1FamilyMClass);
2157 
2158  lSINBKKSegmentYCabin1FamilyMClass.setYield(500);
2159 
2160  // Create a BookingClass (M) for the (mkt) Segment BKK-HKG, cabin Y,
2161  // fare family 1 on SQ's Inv
2162  BookingClass& lMktBKKHKGSegmentYCabin1FamilyMClass =
2163  FacBom<BookingClass>::instance().create (lMBookingClassKey);
2164  FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
2165  lMktBKKHKGSegmentYCabin1FamilyMClass);
2166  FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
2167  lMktBKKHKGSegmentYCabin1FamilyMClass);
2168 
2169  FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2170  lMktBKKHKGSegmentYCabin1FamilyMClass);
2171  FacBomManager::addToListAndMap (lMktBKKHKGSegment,
2172  lMktBKKHKGSegmentYCabin1FamilyMClass);
2173 
2174  lMktBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
2175 
2176  /* =================================================================================== */
2177 
2178  // Step 1.0: O&D level
2179  // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK-SQ1200/08-MAR-2010/BKK-HKG)
2180  // for SQ's Inventory
2181  OnDString_T lSQSINBKKOnDStr = "SQ;11,2010-Mar-08;SIN,BKK";
2182  OnDString_T lMktSQBKKHKGOnDStr = "SQ;1200,2010-Mar-08;BKK,HKG";
2183  OnDStringList_T lOnDStringList;
2184  lOnDStringList.push_back (lSQSINBKKOnDStr);
2185  lOnDStringList.push_back (lMktSQBKKHKGOnDStr);
2186 
2187  OnDDateKey lOnDDateKey (lOnDStringList);
2188  OnDDate& lSQ_SINHKG_OnDDate =
2189  FacBom<OnDDate>::instance().create (lOnDDateKey);
2190  // Link to the inventory
2191  FacBomManager::addToListAndMap (lSQInv, lSQ_SINHKG_OnDDate);
2192  FacBomManager::linkWithParent (lSQInv, lSQ_SINHKG_OnDDate);
2193 
2194  // Add the segments
2195  FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lSINBKKSegment);
2196  FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lMktBKKHKGSegment);
2197 
2198  // Add total forecast info for cabin Y.
2199  const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
2200  const WTP_T lWTP750 = 750.0;
2201  const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
2202  lSQ_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
2203 
2204  // Add demand info (optional).
2205  // 2 legs here, so 2 CabinClassPair to add in the list.
2206  // Fist leg: cabin Y, class M.
2207  CabinClassPair_T lCC_YM1 (lY,lM);
2208  // Second leg: cabin Y, class M too.
2209  CabinClassPair_T lCC_YM2 (lY,lM);
2210  CabinClassPairList_T lCabinClassPairList;
2211  lCabinClassPairList.push_back(lCC_YM1);
2212  lCabinClassPairList.push_back(lCC_YM2);
2213  const MeanStdDevPair_T lMean20StdDev2 (20.0, 2.0);
2214  const Yield_T lYield850 = 850.0;
2215  const YieldDemandPair_T lYield850Mean20StdDev2 (lYield850, lMean20StdDev2);
2216  lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield850Mean20StdDev2);
2217 
2218  CabinClassPair_T lCC_YY1 (lY,lY);
2219  CabinClassPair_T lCC_YY2 (lY,lY);
2220  lCabinClassPairList.clear();
2221  lCabinClassPairList.push_back(lCC_YY1);
2222  lCabinClassPairList.push_back(lCC_YY2);
2223  const MeanStdDevPair_T lMean10StdDev1 (10.0, 1.0);
2224  const Yield_T lYield1200 = 1200.0;
2225  const YieldDemandPair_T lYield1200Mean10StdDev1 (lYield1200,
2226  lMean10StdDev1);
2227  lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2228  lYield1200Mean10StdDev1);
2229 
2230  // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK) for SQ's Inventory
2231  lOnDStringList.clear();
2232  lOnDStringList.push_back (lSQSINBKKOnDStr);
2233 
2234  lOnDDateKey = OnDDateKey(lOnDStringList);
2235  OnDDate& lSQ_SINBKK_OnDDate =
2236  FacBom<OnDDate>::instance().create (lOnDDateKey);
2237  // Link to the inventory
2238  FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
2239  FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
2240 
2241  // Add the segments
2242  FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
2243 
2244  // Add total forecast info for cabin Y.
2245  const WTP_T lWTP400 = 400.0;
2246  const WTPDemandPair_T lWTP400Mean60StdDev6 (lWTP400, lMean60StdDev6);
2247  lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
2248 
2249  // Add demand info (optional).
2250  lCabinClassPairList.clear();
2251  lCabinClassPairList.push_back(lCC_YM1);
2252  const MeanStdDevPair_T lMean20StdDev1 (20.0, 1.0);
2253  const Yield_T lYield500 = 500.0;
2254  const YieldDemandPair_T lYield500Mean20StdDev1 (lYield500, lMean20StdDev1);
2255  lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList,
2256  lYield500Mean20StdDev1);
2257 
2258  lCabinClassPairList.clear();
2259  lCabinClassPairList.push_back(lCC_YY1);
2260  const Yield_T lYield700 = 700.0;
2261  const YieldDemandPair_T lYield700Mean20StdDev1 (lYield700, lMean10StdDev1 );
2262  lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList,
2263  lYield700Mean20StdDev1);
2264 
2265  /*******************************************************************************
2266  // Create an O&D Date (SQ1200/08-MAR-2010/BKK-HKG) for SQ's Inventory
2267  lFullKeyList.clear();
2268  lFullKeyList.push_back (lMktSQBKKHKGFullKeyStr);
2269 
2270  lOnDDateKey = OnDDateKey(lFullKeyList);
2271  OnDDate& lMktSQ_BKKHKG_OnDDate =
2272  FacBom<OnDDate>::instance().create (lOnDDateKey);
2273  // Link to the inventory
2274  FacBomManager::addToListAndMap (lSQInv, lMktSQ_BKKHKG_OnDDate);
2275  FacBomManager::linkWithParent (lSQInv, lMktSQ_BKKHKG_OnDDate);
2276 
2277  // Add the segments
2278  FacBomManager::addToListAndMap (lMktSQ_BKKHKG_OnDDate, lMktBKKHKGSegment);
2279 
2280  // Demand info is not added for purely marketed O&Ds
2281  // Add demand info
2282  // lCabinClassPairList.clear();
2283  // lCabinClassPairList.push_back(lCC_YM2);
2284  // lMktSQ_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
2285  ***********************************************************************************/
2286 
2287 
2288  // ////// CX ///////
2289  // Step 0.2: Flight-date level
2290  // Create a FlightDate (CX12/08-MAR-2010) for CX's Inventory
2291  lFlightNumber = 12;
2292  //lDate = Date_T (2010, 2, 8);
2293  lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
2294 
2295  FlightDate& lCX12_20100308_FD =
2296  FacBom<FlightDate>::instance().create (lFlightDateKey);
2297  FacBomManager::addToListAndMap (lCXInv, lCX12_20100308_FD);
2298  FacBomManager::linkWithParent (lCXInv, lCX12_20100308_FD);
2299 
2300  // Create a (mkt) FlightDate (CX1100/08-FEB-2010) for CX's Inventory
2301  lFlightNumber = 1100;
2302  //lDate = Date_T (2010, 2, 8);
2303  lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
2304 
2305  FlightDate& lCX1100_20100308_FD =
2306  FacBom<FlightDate>::instance().create (lMktFlightDateKey);
2307  FacBomManager::addToListAndMap (lCXInv, lCX1100_20100308_FD);
2308  FacBomManager::linkWithParent (lCXInv, lCX1100_20100308_FD);
2309 
2310  // Display the flight-date
2311  // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
2312 
2313  // Step 0.3: Segment-date level
2314  // Create a SegmentDate BKK-HKG for CX's Inventory
2315 
2316  lSegmentDateKey = SegmentDateKey (lBKK, lHKG);
2317 
2318  SegmentDate& lBKKHKGSegment =
2319  FacBom<SegmentDate>::instance().create (lSegmentDateKey);
2320  FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKHKGSegment);
2321  FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKHKGSegment);
2322 
2323  // Add the routing leg key to the marketing BKK-HKG segment.
2324  lBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
2325 
2326  // Fill the SegmentDate content
2327  lBKKHKGSegment.setBoardingDate (lDate);
2328  lBKKHKGSegment.setOffDate (lDate);
2329  lBKKHKGSegment.setBoardingTime (l1200);
2330  lBKKHKGSegment.setOffTime (l1540);
2331  lBKKHKGSegment.setElapsedTime (l0240);
2332 
2333  // Create a second (mkt) SegmentDate (SIN-BKK) for CX's Inventory
2334  lMktSegmentDateKey = SegmentDateKey (lSIN, lBKK);
2335 
2336  SegmentDate& lMktSINBKKSegment =
2337  FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
2338  FacBomManager::addToListAndMap (lCX1100_20100308_FD, lMktSINBKKSegment);
2339  FacBomManager::linkWithParent (lCX1100_20100308_FD, lMktSINBKKSegment);
2340 
2341  // Add the routing leg key SQ;11;2010-Mar-8;SIN to the marketing
2342  // CX;1100;2010-Mar-8;SIN-BKK segment.
2343  lMktSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
2344 
2345  // Fill the (mkt) SegmentDate content
2346  lMktSINBKKSegment.setBoardingDate (lDate);
2347  lMktSINBKKSegment.setOffDate (lDate);
2348  lMktSINBKKSegment.setBoardingTime (l0820);
2349  lMktSINBKKSegment.setOffTime (l1100);
2350  lMktSINBKKSegment.setElapsedTime (l0340);
2351 
2352  // Step 0.4: Leg-date level
2353  // Create a LegDate (BKK) for CX's Inventory
2354  lLegDateKey = LegDateKey (lBKK);
2355 
2356  LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
2357  FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKLeg);
2358  FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKLeg);
2359 
2360  // Fill the LegDate content
2361  lBKKLeg.setOffPoint (lHKG);
2362  lBKKLeg.setBoardingDate (lDate);
2363  lBKKLeg.setOffDate (lDate);
2364  lBKKLeg.setBoardingTime (l1200);
2365  lBKKLeg.setOffTime (l1540);
2366  lBKKLeg.setElapsedTime (l0240);
2367 
2368  // Display the leg-date
2369  // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
2370 
2371  // Step 0.5: segment-cabin level
2372  // Create a SegmentCabin (Y) for the Segment BKK-HKG of CX's Inventory
2373  SegmentCabin& lBKKHKGSegmentYCabin =
2374  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2375  FacBomManager::addToListAndMap (lBKKHKGSegment, lBKKHKGSegmentYCabin);
2376  FacBomManager::linkWithParent (lBKKHKGSegment, lBKKHKGSegmentYCabin);
2377 
2378  // Create a SegmentCabin (Y) for the (mkt) Segment SIN-BKK of CX's Inventory
2379  SegmentCabin& lMktSINBKKSegmentYCabin =
2380  FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2381  FacBomManager::addToListAndMap (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
2382  FacBomManager::linkWithParent (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
2383 
2384  // Step 0.6: leg-cabin level
2385  // Create a LegCabin (Y) for the Leg BKK-HKG on CX's Inventory
2386  LegCabin& lBKKLegYCabin =
2387  FacBom<LegCabin>::instance().create (lYLegCabinKey);
2388  FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
2389  FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
2390 
2391  lCapacity = CabinCapacity_T(100);
2392  lBKKLegYCabin.setCapacities (lCapacity);
2393  lBKKLegYCabin.setAvailabilityPool (lCapacity);
2394 
2395  // Step 0.7: fare family level
2396  // Create a fareFamily (1) for the Segment BKK-HKG, cabin Y on CX's Inv
2397  FareFamily& lBKKHKGSegmentYCabin1Family =
2398  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2399  FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2400  lBKKHKGSegmentYCabin1Family);
2401  FacBomManager::linkWithParent (lBKKHKGSegmentYCabin,
2402  lBKKHKGSegmentYCabin1Family);
2403 
2404  // Create a FareFamily (1) for the (mkt) Segment SIN-BKK, cabin Y on CX's Inv
2405  FareFamily& lMktSINBKKSegmentYCabin1Family =
2406  FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2407  FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2408  lMktSINBKKSegmentYCabin1Family);
2409  FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin,
2410  lMktSINBKKSegmentYCabin1Family);
2411 
2412 
2413  // Step 0.8: booking class level
2414  // Create a BookingClass (Y) for the
2415  // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
2416  BookingClass& lBKKHKGSegmentYCabin1FamilyYClass =
2417  FacBom<BookingClass>::instance().create (lYBookingClassKey);
2418  FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
2419  lBKKHKGSegmentYCabin1FamilyYClass);
2420  FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
2421  lBKKHKGSegmentYCabin1FamilyYClass);
2422 
2423  FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2424  lBKKHKGSegmentYCabin1FamilyYClass);
2425  FacBomManager::addToListAndMap (lBKKHKGSegment,
2426  lBKKHKGSegmentYCabin1FamilyYClass);
2427 
2428  lBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
2429 
2430  // Create a BookingClass (Y) for the (mkt) Segment SIN-BKK, cabin Y,
2431  // fare family 1 on CX's Inv
2432  BookingClass& lMktSINBKKSegmentYCabin1FamilyYClass =
2433  FacBom<BookingClass>::instance().create (lYBookingClassKey);
2434  FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
2435  lMktSINBKKSegmentYCabin1FamilyYClass);
2436  FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
2437  lMktSINBKKSegmentYCabin1FamilyYClass);
2438 
2439  FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2440  lMktSINBKKSegmentYCabin1FamilyYClass);
2441  FacBomManager::addToListAndMap (lMktSINBKKSegment,
2442  lMktSINBKKSegmentYCabin1FamilyYClass);
2443 
2444  lMktSINBKKSegmentYCabin1FamilyYClass.setYield(700);
2445 
2446  //Create a BookingClass (M) for the
2447  // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
2448  BookingClass& lBKKHKGSegmentYCabin1FamilyMClass =
2449  FacBom<BookingClass>::instance().create (lMBookingClassKey);
2450  FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
2451  lBKKHKGSegmentYCabin1FamilyMClass);
2452  FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
2453  lBKKHKGSegmentYCabin1FamilyMClass);
2454 
2455  FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2456  lBKKHKGSegmentYCabin1FamilyMClass);
2457  FacBomManager::addToListAndMap (lBKKHKGSegment,
2458  lBKKHKGSegmentYCabin1FamilyMClass);
2459 
2460  lBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
2461 
2462  // Create a BookingClass (M) for the (mkt) Segment SIN-BKK, cabin Y,
2463  // fare family 1 on CX's Inv
2464  BookingClass& lMktSINBKKSegmentYCabin1FamilyMClass =
2465  FacBom<BookingClass>::instance().create (lMBookingClassKey);
2466  FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
2467  lMktSINBKKSegmentYCabin1FamilyMClass);
2468  FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
2469  lMktSINBKKSegmentYCabin1FamilyMClass);
2470 
2471  FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2472  lMktSINBKKSegmentYCabin1FamilyMClass);
2473  FacBomManager::addToListAndMap (lMktSINBKKSegment,
2474  lMktSINBKKSegmentYCabin1FamilyMClass);
2475 
2476  lMktSINBKKSegmentYCabin1FamilyMClass.setYield(500);
2477 
2478  /* =================================================================================== */
2479 
2480  // Step 1.0: O&D level
2481  // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK-CX12/08-MAR-2010/BKK-HKG) for CX's Inventory
2482  OnDString_T lMktCXSINBKKOnDStr = "CX;1100,2010-Mar-08;SIN,BKK";
2483  OnDString_T lCXBKKHKGOnDStr = "CX;12,2010-Mar-08;BKK,HKG";
2484  lOnDStringList.clear();
2485  lOnDStringList.push_back (lMktCXSINBKKOnDStr);
2486  lOnDStringList.push_back (lCXBKKHKGOnDStr);
2487 
2488  lOnDDateKey = OnDDateKey(lOnDStringList);
2489  OnDDate& lCX_SINHKG_OnDDate =
2490  FacBom<OnDDate>::instance().create (lOnDDateKey);
2491  // Link to the inventory
2492  FacBomManager::addToListAndMap (lCXInv, lCX_SINHKG_OnDDate);
2493  FacBomManager::linkWithParent (lCXInv, lCX_SINHKG_OnDDate);
2494 
2495  // Add the segments
2496  FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lMktSINBKKSegment);
2497  FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lBKKHKGSegment);
2498 
2499  // Add total forecast info for cabin Y.
2500  lCX_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
2501 
2502  // Add demand info
2503  lCabinClassPairList.clear();
2504  lCabinClassPairList.push_back(lCC_YM1);
2505  lCabinClassPairList.push_back(lCC_YM2);
2506  lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2507  lYield850Mean20StdDev2);
2508 
2509  lCabinClassPairList.clear();
2510  lCabinClassPairList.push_back(lCC_YY1);
2511  lCabinClassPairList.push_back(lCC_YY2);
2512  lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2513  lYield1200Mean10StdDev1);
2514 
2515  /***********************************************************************************
2516  // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK) for CX's Inventory
2517  lFullKeyList.clear();
2518  lFullKeyList.push_back (lMktCXSINBKKFullKeyStr);
2519 
2520  lOnDDateKey = OnDDateKey(lFullKeyList);
2521  OnDDate& lMktCX_SINBKK_OnDDate =
2522  FacBom<OnDDate>::instance().create (lOnDDateKey);
2523  // Link to the inventory
2524  FacBomManager::addToListAndMap (lCXInv, lMktCX_SINBKK_OnDDate);
2525  FacBomManager::linkWithParent (lCXInv, lMktCX_SINBKK_OnDDate);
2526 
2527  // Add the segments
2528  FacBomManager::addToListAndMap (lMktCX_SINBKK_OnDDate, lMktSINBKKSegment);
2529 
2530  // Demand info is not added for purely marketed O&Ds
2531  // Add demand info
2532  // lCabinClassPairList.clear();
2533  // lCabinClassPairList.push_back(lCC_YM1);
2534  // lMktCX_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
2535  *************************************************************************************/
2536 
2537  // Create an O&D Date (CX12/08-FEB-2010/BKK-HKG) for CX's Inventory
2538  lOnDStringList.clear();
2539  lOnDStringList.push_back (lCXBKKHKGOnDStr);
2540 
2541  lOnDDateKey = OnDDateKey(lOnDStringList);
2542  OnDDate& lCX_BKKHKG_OnDDate =
2543  FacBom<OnDDate>::instance().create (lOnDDateKey);
2544  // Link to the inventory
2545  FacBomManager::addToListAndMap (lCXInv, lCX_BKKHKG_OnDDate);
2546  FacBomManager::linkWithParent (lCXInv, lCX_BKKHKG_OnDDate);
2547 
2548  // Add the segments
2549  FacBomManager::addToListAndMap (lCX_BKKHKG_OnDDate, lBKKHKGSegment);
2550 
2551  // Add total forecast info for cabin Y.
2552  lCX_BKKHKG_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
2553 
2554  // Add demand info
2555  lCabinClassPairList.clear();
2556  lCabinClassPairList.push_back(lCC_YM2);
2557  lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2558  lYield500Mean20StdDev1);
2559 
2560  lCabinClassPairList.clear();
2561  lCabinClassPairList.push_back(lCC_YY2);
2562  const YieldDemandPair_T lYield700Mean10StdDev1 (lYield700, lMean10StdDev1 );
2563  lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2564  lYield700Mean10StdDev1);
2565 
2566  /*================================================================================
2567  ================================================================================
2568  ================================================================================*/
2569  // Schedule:
2570  // SQ:
2571  // Step 1: flight period level
2572  // Create a flight period for SQ11:
2573  const DoWStruct lDoWSrtuct ("1111111");
2574  const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 8);
2575  const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 9);
2576  const DatePeriod_T lDatePeriod (lDateRangeStart, lDateRangeEnd);
2577  const PeriodStruct lPeriodStruct (lDatePeriod,lDoWSrtuct);
2578 
2579  lFlightNumber = FlightNumber_T (11);
2580 
2581  FlightPeriodKey lFlightPeriodKey (lFlightNumber, lPeriodStruct);
2582 
2583  FlightPeriod& lSQ11FlightPeriod =
2584  FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
2585  FacBomManager::addToListAndMap (lSQInv, lSQ11FlightPeriod);
2586  FacBomManager::linkWithParent (lSQInv, lSQ11FlightPeriod);
2587 
2588  // Step 2: segment period level
2589  // Create a segment period for SIN-BKK:
2590 
2591  SegmentPeriodKey lSegmentPeriodKey (lSIN, lBKK);
2592 
2593  SegmentPeriod& lSINBKKSegmentPeriod =
2594  FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
2595  FacBomManager::addToListAndMap (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
2596  FacBomManager::linkWithParent (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
2597 
2598  lSINBKKSegmentPeriod.setBoardingTime (l0820);
2599  lSINBKKSegmentPeriod.setOffTime (l1100);
2600  lSINBKKSegmentPeriod.setElapsedTime (l0340);
2601  ClassList_String_T lYM ("YM");
2602  lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYM);
2603 
2604  // CX:
2605  // Step 1: flight period level
2606  // Create a flight period for CX12:
2607  lFlightNumber = FlightNumber_T (12);
2608 
2609  lFlightPeriodKey = FlightPeriodKey(lFlightNumber, lPeriodStruct);
2610 
2611  FlightPeriod& lCX12FlightPeriod =
2612  FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
2613  FacBomManager::addToListAndMap (lCXInv, lCX12FlightPeriod);
2614  FacBomManager::linkWithParent (lCXInv, lCX12FlightPeriod);
2615 
2616  // Step 2: segment period level
2617  // Create a segment period for BKK-HKG:
2618 
2619  lSegmentPeriodKey = SegmentPeriodKey (lBKK, lHKG);
2620 
2621  SegmentPeriod& lBKKHKGSegmentPeriod =
2622  FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
2623  FacBomManager::addToListAndMap (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
2624  FacBomManager::linkWithParent (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
2625 
2626  lBKKHKGSegmentPeriod.setBoardingTime (l1200);
2627  lBKKHKGSegmentPeriod.setOffTime (l1540);
2628  lBKKHKGSegmentPeriod.setElapsedTime (l0240);
2629  lBKKHKGSegmentPeriod.addCabinBookingClassList (lY,lYM);
2630 
2631  }
2632 
2633  // //////////////////////////////////////////////////////////////////////
2634  void CmdBomManager::buildPartnershipsSamplePricing (BomRoot& ioBomRoot) {
2635 
2637 
2638  /*===================================================================================*/
2639  // First airport pair SIN-BKK.
2640  // Set the airport-pair primary key.
2641  AirportPairKey lAirportPairKey ("SIN", "BKK");
2642 
2643  // Create the AirportPairKey object and link it to the ioBomRoot object.
2644  AirportPair& lSINBKKAirportPair =
2645  FacBom<AirportPair>::instance().create (lAirportPairKey);
2646  FacBomManager::addToListAndMap (ioBomRoot, lSINBKKAirportPair);
2647  FacBomManager::linkWithParent (ioBomRoot, lSINBKKAirportPair);
2648 
2649  // Set the fare date-period primary key.
2650  const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 01);
2651  const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 31);
2652  const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
2653  const DatePeriodKey lDatePeriodKey (lDateRange);
2654 
2655  // Create the DatePeriodKey object and link it to the PosChannel object.
2656  DatePeriod& lSINBKKDatePeriod =
2657  FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2658  FacBomManager::addToListAndMap (lSINBKKAirportPair, lSINBKKDatePeriod);
2659  FacBomManager::linkWithParent (lSINBKKAirportPair, lSINBKKDatePeriod);
2660 
2661  // Set the point-of-sale-channel primary key.
2662  PosChannelKey lPosChannelKey ("SIN","IN");
2663 
2664  // Create the PositionKey object and link it to the AirportPair object.
2665  PosChannel& lSINPosChannel =
2666  FacBom<PosChannel>::instance().create (lPosChannelKey);
2667  FacBomManager::addToListAndMap (lSINBKKDatePeriod, lSINPosChannel);
2668  FacBomManager::linkWithParent (lSINBKKDatePeriod, lSINPosChannel);
2669 
2670  // Set the fare time-period primary key.
2671  const Time_T lTimeRangeStart (0, 0, 0);
2672  const Time_T lTimeRangeEnd (23, 0, 0);
2673  const TimePeriodKey lFareTimePeriodKey (lTimeRangeStart,
2674  lTimeRangeEnd);
2675 
2676  // Create the TimePeriodKey and link it to the DatePeriod object.
2677  TimePeriod& lSINBKKFareTimePeriod =
2678  FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2679  FacBomManager::addToListAndMap (lSINPosChannel, lSINBKKFareTimePeriod);
2680  FacBomManager::linkWithParent (lSINPosChannel, lSINBKKFareTimePeriod);
2681 
2682  // Generate the FareRule
2683  const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ONE_WAY,
2685  SATURDAY_STAY,
2686  CHANGE_FEES,
2689 
2690  // Create the FareFeaturesKey and link it to the TimePeriod object.
2691  FareFeatures& lSINBKKFareFeatures =
2692  FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2693  FacBomManager::addToListAndMap (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
2694  FacBomManager::linkWithParent (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
2695 
2696  // Generate Segment Features and link them to their FareRule.
2697  AirlineCodeList_T lSQAirlineCodeList;
2698  lSQAirlineCodeList.push_back ("SQ");
2699 
2700  ClassList_StringList_T lYClassCodeList;
2701  lYClassCodeList.push_back ("Y");
2702  const AirlineClassListKey lSQAirlineYClassListKey (lSQAirlineCodeList,
2703  lYClassCodeList);
2704 
2705  ClassList_StringList_T lMClassCodeList;
2706  lMClassCodeList.push_back ("M");
2707  const AirlineClassListKey lSQAirlineMClassListKey (lSQAirlineCodeList,
2708  lMClassCodeList);
2709 
2710  // Create the AirlineClassListKey and link it to the FareFeatures object.
2711  AirlineClassList& lSQAirlineYClassList =
2712  FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
2713  lSQAirlineYClassList.setFare(700);
2714  FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineYClassList);
2715  FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineYClassList);
2716 
2717  AirlineClassList& lSQAirlineMClassList =
2718  FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
2719  lSQAirlineMClassList.setFare(500);
2720  FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineMClassList);
2721  FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineMClassList);
2722 
2723  /*===================================================================================*/
2724  // Second airport pair BKK-HKG.
2725  // Set the airport-pair primary key.
2726  lAirportPairKey = AirportPairKey ("BKK", "HKG");
2727 
2728  // Create the AirportPairKey object and link it to the ioBomRoot object.
2729  AirportPair& lBKKHKGAirportPair =
2730  FacBom<AirportPair>::instance().create (lAirportPairKey);
2731  FacBomManager::addToListAndMap (ioBomRoot, lBKKHKGAirportPair);
2732  FacBomManager::linkWithParent (ioBomRoot, lBKKHKGAirportPair);
2733 
2734  // Set the fare date-period primary key.
2735  // Use the same as previously.
2736 
2737  // Create the DatePeriodKey object and link it to the PosChannel object.
2738  DatePeriod& lBKKHKGDatePeriod =
2739  FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2740  FacBomManager::addToListAndMap (lBKKHKGAirportPair, lBKKHKGDatePeriod);
2741  FacBomManager::linkWithParent (lBKKHKGAirportPair, lBKKHKGDatePeriod);
2742 
2743  // Set the point-of-sale-channel primary key.
2744  lPosChannelKey = PosChannelKey("BKK","IN");
2745 
2746  // Create the PositionKey object and link it to the AirportPair object.
2747  PosChannel& lBKKPosChannel =
2748  FacBom<PosChannel>::instance().create (lPosChannelKey);
2749  FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lBKKPosChannel);
2750  FacBomManager::linkWithParent (lBKKHKGDatePeriod, lBKKPosChannel);
2751 
2752  // Set the fare time-period primary key.
2753  // Use the same as previously.
2754 
2755  // Create the TimePeriodKey and link it to the DatePeriod object.
2756  TimePeriod& lBKKHKGFareTimePeriod =
2757  FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2758  FacBomManager::addToListAndMap (lBKKPosChannel, lBKKHKGFareTimePeriod);
2759  FacBomManager::linkWithParent (lBKKPosChannel, lBKKHKGFareTimePeriod);
2760 
2761  // Generate the FareRule
2762  // Use the same key as previously.
2763 
2764  // Create the FareFeaturesKey and link it to the TimePeriod object.
2765  FareFeatures& lBKKHKGFareFeatures =
2766  FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2767  FacBomManager::addToListAndMap (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
2768  FacBomManager::linkWithParent (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
2769 
2770  // Generate Segment Features and link them to their FareRule.
2771  AirlineCodeList_T lCXAirlineCodeList;
2772  lCXAirlineCodeList.push_back ("CX");
2773 
2774  const AirlineClassListKey lCXAirlineYClassListKey (lCXAirlineCodeList,
2775  lYClassCodeList);
2776 
2777  const AirlineClassListKey lCXAirlineMClassListKey (lCXAirlineCodeList,
2778  lMClassCodeList);
2779 
2780  // Create the AirlineClassListKey and link it to the FareFeatures object.
2781  AirlineClassList& lCXAirlineYClassList =
2782  FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
2783  lCXAirlineYClassList.setFare(700);
2784  FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineYClassList);
2785  FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineYClassList);
2786 
2787  AirlineClassList& lCXAirlineMClassList =
2788  FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
2789  lCXAirlineMClassList.setFare(500);
2790  FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineMClassList);
2791  FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineMClassList);
2792 
2793  /*===================================================================================*/
2794  // Third airport pair SIN-HKG.
2795  // Set the airport-pair primary key.
2796  lAirportPairKey = AirportPairKey ("SIN", "HKG");
2797 
2798  // Create the AirportPairKey object and link it to the ioBomRoot object.
2799  AirportPair& lSINHKGAirportPair =
2800  FacBom<AirportPair>::instance().create (lAirportPairKey);
2801  FacBomManager::addToListAndMap (ioBomRoot, lSINHKGAirportPair);
2802  FacBomManager::linkWithParent (ioBomRoot, lSINHKGAirportPair);
2803 
2804  // Set the fare date-period primary key.
2805  // Use the same as previously.
2806 
2807  // Create the DatePeriodKey object and link it to the PosChannel object.
2808  DatePeriod& lSINHKGDatePeriod =
2809  FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2810  FacBomManager::addToListAndMap (lSINHKGAirportPair, lSINHKGDatePeriod);
2811  FacBomManager::linkWithParent (lSINHKGAirportPair, lSINHKGDatePeriod);
2812 
2813  // Set the point-of-sale-channel primary key.
2814  lPosChannelKey = PosChannelKey("SIN","IN");
2815 
2816  // Create the PositionKey object and link it to the AirportPair object.
2817  PosChannel& lOnDSINPosChannel =
2818  FacBom<PosChannel>::instance().create (lPosChannelKey);
2819  FacBomManager::addToListAndMap (lSINHKGDatePeriod, lOnDSINPosChannel);
2820  FacBomManager::linkWithParent (lSINHKGDatePeriod, lOnDSINPosChannel);
2821 
2822  // Set the fare time-period primary key.
2823  // Use the same as previously.
2824 
2825  // Create the TimePeriodKey and link it to the DatePeriod object.
2826  TimePeriod& lSINHKGFareTimePeriod =
2827  FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2828  FacBomManager::addToListAndMap (lOnDSINPosChannel, lSINHKGFareTimePeriod);
2829  FacBomManager::linkWithParent (lOnDSINPosChannel, lSINHKGFareTimePeriod);
2830 
2831  // Generate the FareRule
2832  // Use the same key as previously.
2833 
2834  // Create the FareFeaturesKey and link it to the TimePeriod object.
2835  FareFeatures& lSINHKGFareFeatures =
2836  FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2837  FacBomManager::addToListAndMap (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
2838  FacBomManager::linkWithParent (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
2839 
2840  // Generate Segment Features and link them to their FareRule.
2841  AirlineCodeList_T lSQ_CXAirlineCodeList;
2842  lSQ_CXAirlineCodeList.push_back ("SQ");
2843  lSQ_CXAirlineCodeList.push_back ("CX");
2844 
2845  ClassList_StringList_T lY_YClassCodeList;
2846  lY_YClassCodeList.push_back ("Y");
2847  lY_YClassCodeList.push_back ("Y");
2848  const AirlineClassListKey lSQ_CXAirlineYClassListKey (lSQ_CXAirlineCodeList,
2849  lY_YClassCodeList);
2850 
2851  ClassList_StringList_T lM_MClassCodeList;
2852  lM_MClassCodeList.push_back ("M");
2853  lM_MClassCodeList.push_back ("M");
2854  const AirlineClassListKey lSQ_CXAirlineMClassListKey (lSQ_CXAirlineCodeList,
2855  lM_MClassCodeList);
2856 
2857  // Create the AirlineClassListKey and link it to the FareFeatures object.
2858  AirlineClassList& lSQ_CXAirlineYClassList =
2859  FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
2860  lSQ_CXAirlineYClassList.setFare(1200);
2861  FacBomManager::addToListAndMap (lSINHKGFareFeatures,
2862  lSQ_CXAirlineYClassList);
2863  FacBomManager::linkWithParent (lSINHKGFareFeatures,
2864  lSQ_CXAirlineYClassList);
2865 
2866  AirlineClassList& lSQ_CXAirlineMClassList =
2867  FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
2868  lSQ_CXAirlineMClassList.setFare(850);
2869  FacBomManager::addToListAndMap (lSINHKGFareFeatures,
2870  lSQ_CXAirlineMClassList);
2871  FacBomManager::linkWithParent (lSINHKGFareFeatures,
2872  lSQ_CXAirlineMClassList);
2873 
2874 
2876 
2877  /*===================================================================================*/
2878 
2879  // Use the same airport pair, and date period for adding SQ SIN-BKK yields.
2880 
2881  // Set the point-of-sale-channel primary key.
2882  lPosChannelKey = PosChannelKey(DEFAULT_POS, DEFAULT_CHANNEL);
2883 
2884  // Create the PositionKey object and link it to the AirportPair object.
2885  PosChannel& lRAC_SINBKKPosChannel =
2886  FacBom<PosChannel>::instance().create (lPosChannelKey);
2887  FacBomManager::addToListAndMap (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
2888  FacBomManager::linkWithParent (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
2889 
2890  // Set the yield time-period primary key.
2891  const TimePeriodKey lYieldTimePeriodKey (lTimeRangeStart,
2892  lTimeRangeEnd);
2893 
2894  // Create the TimePeriodKey and link it to the DatePeriod object.
2895  TimePeriod& lSINBKKYieldTimePeriod =
2896  FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
2897  FacBomManager::addToListAndMap (lRAC_SINBKKPosChannel,
2898  lSINBKKYieldTimePeriod);
2899  FacBomManager::linkWithParent (lRAC_SINBKKPosChannel,
2900  lSINBKKYieldTimePeriod);
2901 
2902  // Generate the YieldRule
2903  const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
2904  CABIN_Y);
2905 
2906  // Create the YieldFeaturesKey and link it to the TimePeriod object.
2907  YieldFeatures& lSINBKKYieldFeatures =
2908  FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
2909  FacBomManager::addToListAndMap (lSINBKKYieldTimePeriod,
2910  lSINBKKYieldFeatures);
2911  FacBomManager::linkWithParent (lSINBKKYieldTimePeriod,
2912  lSINBKKYieldFeatures);
2913 
2914  // Generate Segment Features and link them to their YieldRule.
2915  // Use the same key as previously.
2916 
2917  // Create the AirlineClassListKey and link it to the YieldFeatures object.
2918  AirlineClassList& lRAC_SQAirlineYClassList =
2919  FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
2920  lRAC_SQAirlineYClassList.setYield(700);
2921  FacBomManager::addToListAndMap (lSINBKKYieldFeatures,
2922  lRAC_SQAirlineYClassList);
2923  FacBomManager::linkWithParent (lSINBKKYieldFeatures,
2924  lRAC_SQAirlineYClassList);
2925 
2926  AirlineClassList& lRAC_SQAirlineMClassList =
2927  FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
2928  lRAC_SQAirlineMClassList.setYield(500);
2929  FacBomManager::addToListAndMap (lSINBKKYieldFeatures,
2930  lRAC_SQAirlineMClassList);
2931  FacBomManager::linkWithParent (lSINBKKYieldFeatures,
2932  lRAC_SQAirlineMClassList);
2933 
2934  /*===================================================================================*/
2935 
2936  // Use the same airport pair, and date period for adding CX BKK-HKG yields.
2937 
2938  // Set the point-of-sale-channel primary key.
2939  // Use the same as previously.
2940 
2941  // Create the PositionKey object and link it to the AirportPair object.
2942  PosChannel& lRAC_BKKHKGPosChannel =
2943  FacBom<PosChannel>::instance().create (lPosChannelKey);
2944  FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
2945  FacBomManager::linkWithParent (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
2946 
2947  // Set the yield time-period primary key.
2948  // Use the same as previously.
2949 
2950  // Create the TimePeriodKey and link it to the DatePeriod object.
2951  TimePeriod& lBKKHKGYieldTimePeriod =
2952  FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
2953  FacBomManager::addToListAndMap (lRAC_BKKHKGPosChannel,
2954  lBKKHKGYieldTimePeriod);
2955  FacBomManager::linkWithParent (lRAC_BKKHKGPosChannel,
2956  lBKKHKGYieldTimePeriod);
2957 
2958  // Generate the YieldRule
2959  // Use the same key as previously.
2960 
2961  // Create the YieldFeaturesKey and link it to the TimePeriod object.
2962  YieldFeatures& lBKKHKGYieldFeatures =
2963  FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
2964  FacBomManager::addToListAndMap (lBKKHKGYieldTimePeriod,
2965  lBKKHKGYieldFeatures);
2966  FacBomManager::linkWithParent (lBKKHKGYieldTimePeriod,
2967  lBKKHKGYieldFeatures);
2968 
2969  // Generate Segment Features and link them to their YieldRule.
2970  // Use the same key as previously.
2971 
2972  // Create the AirlineClassListKey and link it to the YieldFeatures object.
2973  AirlineClassList& lRAC_CXAirlineYClassList =
2974  FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
2975  lRAC_CXAirlineYClassList.setYield(700);
2976  FacBomManager::addToListAndMap (lBKKHKGYieldFeatures,
2977  lRAC_CXAirlineYClassList);
2978  FacBomManager::linkWithParent (lBKKHKGYieldFeatures,
2979  lRAC_CXAirlineYClassList);
2980 
2981  AirlineClassList& lRAC_CXAirlineMClassList =
2982  FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
2983  lRAC_CXAirlineMClassList.setYield(500);
2984  FacBomManager::addToListAndMap (lBKKHKGYieldFeatures,
2985  lRAC_CXAirlineMClassList);
2986  FacBomManager::linkWithParent (lBKKHKGYieldFeatures,
2987  lRAC_CXAirlineMClassList);
2988 
2989  /*===================================================================================*/
2990 
2991  // Use the same airport pair, and date period for SQ-CX SIN-HKG
2992 
2993  // Set the point-of-sale-channel primary key.
2994  // Use the same as previously.
2995 
2996  // Create the PositionKey object and link it to the AirportPair object.
2997  PosChannel& lRAC_SINHKGChannel =
2998  FacBom<PosChannel>::instance().create (lPosChannelKey);
2999  FacBomManager::addToListAndMap (lSINHKGDatePeriod, lRAC_SINHKGChannel);
3000  FacBomManager::linkWithParent (lSINHKGDatePeriod, lRAC_SINHKGChannel);
3001 
3002  // Set the yield time-period primary key.
3003  // Use the same as previously.
3004 
3005  // Create the TimePeriodKey and link it to the DatePeriod object.
3006  TimePeriod& lSINHKGYieldTimePeriod =
3007  FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
3008  FacBomManager::addToListAndMap (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
3009  FacBomManager::linkWithParent (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
3010 
3011  // Generate the YieldRule
3012  // Use the same key as previously.
3013 
3014  // Create the YieldFeaturesKey and link it to the TimePeriod object.
3015  YieldFeatures& lSINHKGYieldFeatures =
3016  FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
3017  FacBomManager::addToListAndMap (lSINHKGYieldTimePeriod,
3018  lSINHKGYieldFeatures);
3019  FacBomManager::linkWithParent (lSINHKGYieldTimePeriod,
3020  lSINHKGYieldFeatures);
3021 
3022  // Generate Segment Features and link them to their YieldRule.
3023  // Use the same key as previously
3024 
3025  // Create the AirlineClassListKey and link it to the YieldFeatures object.
3026  AirlineClassList& lRAC_SQ_CXAirlineYClassList =
3027  FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
3028  lRAC_SQ_CXAirlineYClassList.setYield(1200);
3029  FacBomManager::addToListAndMap (lSINHKGYieldFeatures,
3030  lRAC_SQ_CXAirlineYClassList);
3031  FacBomManager::linkWithParent (lSINHKGYieldFeatures,
3032  lRAC_SQ_CXAirlineYClassList);
3033 
3034  AirlineClassList& lRAC_SQ_CXAirlineMClassList =
3035  FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
3036  lRAC_SQ_CXAirlineMClassList.setYield(850);
3037  FacBomManager::addToListAndMap (lSINHKGYieldFeatures,
3038  lRAC_SQ_CXAirlineMClassList);
3039  FacBomManager::linkWithParent (lSINHKGYieldFeatures,
3040  lRAC_SQ_CXAirlineMClassList);
3041 
3042  }
3043 
3044 }
3045 
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition: Logger.hpp:32
Handle on the StdAir library context.
boost::gregorian::date Date_T
const ChangeFees_T CHANGE_FEES
boost::posix_time::ptime DateTime_T
const SaturdayStay_T SATURDAY_STAY
boost::gregorian::date_duration DateOffset_T
const WTP_T DEFAULT_WTP
const ClassCode_T CLASS_CODE_Y
std::string ClassCode_T
const AirlineCode_T AIRLINE_CODE_BA
std::pair< MeanValue_T, StdDevValue_T > MeanStdDevPair_T
const ChannelLabel_T CHANNEL_DN
double PriceValue_T
std::pair< CabinCode_T, ClassCode_T > CabinClassPair_T
std::pair< WTP_T, MeanStdDevPair_T > WTPDemandPair_T
double StdDevValue_T
std::string ChannelLabel_T
std::string TripType_T
const TripType_T TRIP_TYPE_INBOUND
const TripType_T TRIP_TYPE_ROUND_TRIP
boost::posix_time::time_duration Time_T
const CityCode_T POS_SIN
const NonRefundable_T NON_REFUNDABLE
std::list< BookingClass * > BookingClassList_T
const CabinCode_T CABIN_ECO
const AirportCode_T AIRPORT_SYD
const CabinCode_T DEFAULT_CABIN_CODE
const DayDuration_T NO_STAY_DURATION
const AirportCode_T DEFAULT_DESTINATION
const AirlineCode_T DEFAULT_AIRLINE_CODE
std::vector< ClassList_String_T > ClassList_StringList_T
std::map< const ClassCode_T, Availability_T > ClassAvailabilityMap_T
std::list< TravelSolutionStruct > TravelSolutionList_T
const PriceValue_T DEFAULT_VALUE_OF_TIME
double MeanValue_T
const ClassCode_T CLASS_CODE_Q
std::string FrequentFlyer_T
const AirportCode_T DEFAULT_ORIGIN
std::list< OnDString_T > OnDStringList_T
const CabinCode_T CABIN_Y
std::string ClassList_String_T
std::string OnDString_T
std::vector< MeanStdDevPair_T > MeanStdDevPairVector_T
const AirportCode_T AIRPORT_BKK
const DayDuration_T DEFAULT_STAY_DURATION
boost::gregorian::date_period DatePeriod_T
const NonRefundable_T NO_NON_REFUNDABLE
double Availability_T
std::list< CabinClassPair_T > CabinClassPairList_T
const ChannelLabel_T DEFAULT_CHANNEL
const CabinCapacity_T DEFAULT_CABIN_CAPACITY
const ClassCode_T DEFAULT_CLASS_CODE
const TripType_T TRIP_TYPE_ONE_WAY
const ChangeFees_T NO_CHANGE_FEES
std::string FamilyCode_T
const FrequentFlyer_T FREQUENT_FLYER_MEMBER
const CityCode_T POS_LHR
const CityCode_T DEFAULT_POS
unsigned short FlightNumber_T
std::string AirlineCode_T
boost::posix_time::time_duration Duration_T
const AirportCode_T AIRPORT_SIN
const DayDuration_T NO_ADVANCE_PURCHASE
const AirportCode_T AIRPORT_LHR
std::vector< AirlineCode_T > AirlineCodeList_T
const FlightNumber_T DEFAULT_FLIGHT_NUMBER_FF
LocationCode_T CityCode_T
const Date_T DEFAULT_DEPARTURE_DATE
double Disutility_T
LocationCode_T AirportCode_T
const ChannelLabel_T CHANNEL_IN
std::string CabinCode_T
std::pair< Yield_T, MeanStdDevPair_T > YieldDemandPair_T
const FlightNumber_T DEFAULT_FLIGHT_NUMBER
static stdair::LegCabin & retrieveDummyLegCabin(stdair::BomRoot &, const bool isForFareFamilies=false)
static stdair::SegmentCabin & retrieveDummySegmentCabin(stdair::BomRoot &, const bool isForFareFamilies=false)
Class representing the actual attributes for an airline leg-cabin.
Definition: LegCabin.hpp:25
BOM & create()
Definition: FacBom.hpp:112
static FacBom & instance()
Definition: FacBom.hpp:84
static void setAirlineFeature(Inventory &iInventory, AirlineFeature &iAirlineFeature)
static void linkWithParent(PARENT &, CHILD &)
static void addToListAndMap(OBJECT1 &, OBJECT2 &)
static void addToList(OBJECT1 &, OBJECT2 &)