StdAir Logo  1.00.12
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
44
45namespace 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,
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,
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,
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,
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,
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 DateOffset_T l1Day (1);
1994 const DateOffset_T l2Days (2);
1995 const Duration_T l0820 (8, 20, 0);
1996 const Duration_T l1100 (11, 0, 0);
1997 const Duration_T l0340 (3, 40, 0);
1998 SegmentDateKey lSegmentDateKey (lSIN, lBKK);
1999
2000 SegmentDate& lSINBKKSegment =
2001 FacBom<SegmentDate>::instance().create (lSegmentDateKey);
2002 FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINBKKSegment);
2003 FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINBKKSegment);
2004
2005 // Add the routing leg key to the SIN-BKK segment.
2006 const std::string lSQSINRoutingLegStr = "SQ;11;2010-Mar-8;SIN";
2007 lSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
2008
2009 // Fill the SegmentDate content
2010 lSINBKKSegment.setBoardingDate (lDate);
2011 lSINBKKSegment.setOffDate (lDate);
2012 lSINBKKSegment.setBoardingTime (l0820);
2013 lSINBKKSegment.setOffTime (l1100);
2014 lSINBKKSegment.setElapsedTime (l0340);
2015
2016 // Create a second (mkt) SegmentDate (BKK-HKG) for SQ's Inventory
2017 const AirportCode_T lHKG ("HKG");
2018 const Duration_T l1200 (12, 0, 0);
2019 const Duration_T l1540 (15, 40, 0);
2020 const Duration_T l0240 (2, 40, 0);
2021 SegmentDateKey lMktSegmentDateKey (lBKK, lHKG);
2022
2023 SegmentDate& lMktBKKHKGSegment =
2024 FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
2025 FacBomManager::addToListAndMap (lSQ1200_20100308_FD, lMktBKKHKGSegment);
2026 FacBomManager::linkWithParent (lSQ1200_20100308_FD, lMktBKKHKGSegment);
2027
2028 // Add the routing leg key CX;12;2010-Mar-8;BKK to the marketing
2029 // SQ;1200;2010-Mar-8;BKK-HKG segment.
2030 const std::string lCXBKKRoutingLegStr = "CX;12;2010-Mar-8;BKK";
2031 lMktBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
2032
2033 // Fill the (mkt) SegmentDate content
2034 lMktBKKHKGSegment.setBoardingDate (lDate);
2035 lMktBKKHKGSegment.setOffDate (lDate);
2036 lMktBKKHKGSegment.setBoardingTime (l1200);
2037 lMktBKKHKGSegment.setOffTime (l1540);
2038 lMktBKKHKGSegment.setElapsedTime (l0240);
2039
2040 // Step 0.4: Leg-date level
2041 // Create a first LegDate (SIN) for SQ's Inventory
2042 LegDateKey lLegDateKey (lSIN);
2043
2044 LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
2045 FacBomManager::addToListAndMap (lSQ11_20100308_FD, lSINLeg);
2046 FacBomManager::linkWithParent (lSQ11_20100308_FD, lSINLeg);
2047
2048 // Fill the LegDate content
2049 lSINLeg.setOffPoint (lBKK);
2050 lSINLeg.setBoardingDate (lDate);
2051 lSINLeg.setOffDate (lDate);
2052 lSINLeg.setBoardingTime (l0820);
2053 lSINLeg.setOffTime (l1100);
2054 lSINLeg.setElapsedTime (l0340);
2055
2056 // Step 0.5: segment-cabin level
2057 // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
2058 const CabinCode_T lY ("Y");
2059 SegmentCabinKey lYSegmentCabinKey (lY);
2060
2061 SegmentCabin& lSINBKKSegmentYCabin =
2062 FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2063 FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
2064 FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
2065
2066 // Create a SegmentCabin (Y) for the (mkt) Segment BKK-HKG of SQ's Inventory
2067 SegmentCabin& lMktBKKHKGSegmentYCabin =
2068 FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2069 FacBomManager::addToListAndMap (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
2070 FacBomManager::linkWithParent (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
2071
2072
2073 // Step 0.6: leg-cabin level
2074 // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
2075 LegCabinKey lYLegCabinKey (lY);
2076
2077 LegCabin& lSINLegYCabin =
2078 FacBom<LegCabin>::instance().create (lYLegCabinKey);
2079 FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
2080 FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
2081
2082 CabinCapacity_T lCapacity (100);
2083 lSINLegYCabin.setCapacities (lCapacity);
2084 lSINLegYCabin.setAvailabilityPool (lCapacity);
2085
2086
2087 // Step 0.7: fare family level
2088 // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
2089 const FamilyCode_T l1 ("EcoSaver");
2090 FareFamilyKey l1FareFamilyKey (l1);
2091
2092 FareFamily& lSINBKKSegmentYCabin1Family =
2093 FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2094 FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2095 lSINBKKSegmentYCabin1Family);
2096 FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
2097 lSINBKKSegmentYCabin1Family);
2098
2099 // Create a FareFamily (1) for the (mkt) Segment BKK-HKG, cabin Y on SQ's Inv
2100 FareFamily& lMktBKKHKGSegmentYCabin1Family =
2101 FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2102 FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2103 lMktBKKHKGSegmentYCabin1Family);
2104 FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin,
2105 lMktBKKHKGSegmentYCabin1Family);
2106
2107 // Step 0.8: booking class level
2108 // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
2109 // fare family 1 on SQ's Inv
2110 BookingClassKey lYBookingClassKey (lY);
2111
2112 BookingClass& lSINBKKSegmentYCabin1FamilyYClass =
2113 FacBom<BookingClass>::instance().create (lYBookingClassKey);
2114 FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
2115 lSINBKKSegmentYCabin1FamilyYClass);
2116 FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
2117 lSINBKKSegmentYCabin1FamilyYClass);
2118
2119 FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2120 lSINBKKSegmentYCabin1FamilyYClass);
2121 FacBomManager::addToListAndMap (lSINBKKSegment,
2122 lSINBKKSegmentYCabin1FamilyYClass);
2123
2124 lSINBKKSegmentYCabin1FamilyYClass.setYield(700);
2125
2126 // Create a BookingClass (Y) for the (mkt) Segment BKK-HKG, cabin Y,
2127 // fare family 1 on SQ's Inv
2128 BookingClass& lMktBKKHKGSegmentYCabin1FamilyYClass =
2129 FacBom<BookingClass>::instance().create (lYBookingClassKey);
2130 FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
2131 lMktBKKHKGSegmentYCabin1FamilyYClass);
2132 FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
2133 lMktBKKHKGSegmentYCabin1FamilyYClass);
2134
2135 FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2136 lMktBKKHKGSegmentYCabin1FamilyYClass);
2137 FacBomManager::addToListAndMap (lMktBKKHKGSegment,
2138 lMktBKKHKGSegmentYCabin1FamilyYClass);
2139
2140 lMktBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
2141
2142
2143 // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
2144 // fare family 1 on SQ's Inv
2145 const ClassCode_T lM ("M");
2146 BookingClassKey lMBookingClassKey (lM);
2147
2148 BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
2149 FacBom<BookingClass>::instance().create (lMBookingClassKey);
2150 FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
2151 lSINBKKSegmentYCabin1FamilyMClass);
2152 FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
2153 lSINBKKSegmentYCabin1FamilyMClass);
2154
2155 FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
2156 lSINBKKSegmentYCabin1FamilyMClass);
2157 FacBomManager::addToListAndMap (lSINBKKSegment,
2158 lSINBKKSegmentYCabin1FamilyMClass);
2159
2160 lSINBKKSegmentYCabin1FamilyMClass.setYield(500);
2161
2162 // Create a BookingClass (M) for the (mkt) Segment BKK-HKG, cabin Y,
2163 // fare family 1 on SQ's Inv
2164 BookingClass& lMktBKKHKGSegmentYCabin1FamilyMClass =
2165 FacBom<BookingClass>::instance().create (lMBookingClassKey);
2166 FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
2167 lMktBKKHKGSegmentYCabin1FamilyMClass);
2168 FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
2169 lMktBKKHKGSegmentYCabin1FamilyMClass);
2170
2171 FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
2172 lMktBKKHKGSegmentYCabin1FamilyMClass);
2173 FacBomManager::addToListAndMap (lMktBKKHKGSegment,
2174 lMktBKKHKGSegmentYCabin1FamilyMClass);
2175
2176 lMktBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
2177
2178 /* =================================================================================== */
2179
2180 // Step 1.0: O&D level
2181 // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK-SQ1200/08-MAR-2010/BKK-HKG)
2182 // for SQ's Inventory
2183 OnDString_T lSQSINBKKOnDStr = "SQ;11,2010-Mar-08;SIN,BKK";
2184 OnDString_T lMktSQBKKHKGOnDStr = "SQ;1200,2010-Mar-08;BKK,HKG";
2185 OnDStringList_T lOnDStringList;
2186 lOnDStringList.push_back (lSQSINBKKOnDStr);
2187 lOnDStringList.push_back (lMktSQBKKHKGOnDStr);
2188
2189 OnDDateKey lOnDDateKey (lOnDStringList);
2190 OnDDate& lSQ_SINHKG_OnDDate =
2191 FacBom<OnDDate>::instance().create (lOnDDateKey);
2192 // Link to the inventory
2193 FacBomManager::addToListAndMap (lSQInv, lSQ_SINHKG_OnDDate);
2194 FacBomManager::linkWithParent (lSQInv, lSQ_SINHKG_OnDDate);
2195
2196 // Add the segments
2197 FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lSINBKKSegment);
2198 FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lMktBKKHKGSegment);
2199
2200 // Add total forecast info for cabin Y.
2201 const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
2202 const WTP_T lWTP750 = 750.0;
2203 const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
2204 lSQ_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
2205
2206 // Add demand info (optional).
2207 // 2 legs here, so 2 CabinClassPair to add in the list.
2208 // Fist leg: cabin Y, class M.
2209 CabinClassPair_T lCC_YM1 (lY,lM);
2210 // Second leg: cabin Y, class M too.
2211 CabinClassPair_T lCC_YM2 (lY,lM);
2212 CabinClassPairList_T lCabinClassPairList;
2213 lCabinClassPairList.push_back(lCC_YM1);
2214 lCabinClassPairList.push_back(lCC_YM2);
2215 const MeanStdDevPair_T lMean20StdDev2 (20.0, 2.0);
2216 const Yield_T lYield850 = 850.0;
2217 const YieldDemandPair_T lYield850Mean20StdDev2 (lYield850, lMean20StdDev2);
2218 lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield850Mean20StdDev2);
2219
2220 CabinClassPair_T lCC_YY1 (lY,lY);
2221 CabinClassPair_T lCC_YY2 (lY,lY);
2222 lCabinClassPairList.clear();
2223 lCabinClassPairList.push_back(lCC_YY1);
2224 lCabinClassPairList.push_back(lCC_YY2);
2225 const MeanStdDevPair_T lMean10StdDev1 (10.0, 1.0);
2226 const Yield_T lYield1200 = 1200.0;
2227 const YieldDemandPair_T lYield1200Mean10StdDev1 (lYield1200,
2228 lMean10StdDev1);
2229 lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2230 lYield1200Mean10StdDev1);
2231
2232 // Create an O&D Date (SQ11/08-MAR-2010/SIN-BKK) for SQ's Inventory
2233 lOnDStringList.clear();
2234 lOnDStringList.push_back (lSQSINBKKOnDStr);
2235
2236 lOnDDateKey = OnDDateKey(lOnDStringList);
2237 OnDDate& lSQ_SINBKK_OnDDate =
2238 FacBom<OnDDate>::instance().create (lOnDDateKey);
2239 // Link to the inventory
2240 FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
2241 FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
2242
2243 // Add the segments
2244 FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
2245
2246 // Add total forecast info for cabin Y.
2247 const WTP_T lWTP400 = 400.0;
2248 const WTPDemandPair_T lWTP400Mean60StdDev6 (lWTP400, lMean60StdDev6);
2249 lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
2250
2251 // Add demand info (optional).
2252 lCabinClassPairList.clear();
2253 lCabinClassPairList.push_back(lCC_YM1);
2254 const MeanStdDevPair_T lMean20StdDev1 (20.0, 1.0);
2255 const Yield_T lYield500 = 500.0;
2256 const YieldDemandPair_T lYield500Mean20StdDev1 (lYield500, lMean20StdDev1);
2257 lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList,
2258 lYield500Mean20StdDev1);
2259
2260 lCabinClassPairList.clear();
2261 lCabinClassPairList.push_back(lCC_YY1);
2262 const Yield_T lYield700 = 700.0;
2263 const YieldDemandPair_T lYield700Mean20StdDev1 (lYield700, lMean10StdDev1 );
2264 lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList,
2265 lYield700Mean20StdDev1);
2266
2267 /*******************************************************************************
2268 // Create an O&D Date (SQ1200/08-MAR-2010/BKK-HKG) for SQ's Inventory
2269 lFullKeyList.clear();
2270 lFullKeyList.push_back (lMktSQBKKHKGFullKeyStr);
2271
2272 lOnDDateKey = OnDDateKey(lFullKeyList);
2273 OnDDate& lMktSQ_BKKHKG_OnDDate =
2274 FacBom<OnDDate>::instance().create (lOnDDateKey);
2275 // Link to the inventory
2276 FacBomManager::addToListAndMap (lSQInv, lMktSQ_BKKHKG_OnDDate);
2277 FacBomManager::linkWithParent (lSQInv, lMktSQ_BKKHKG_OnDDate);
2278
2279 // Add the segments
2280 FacBomManager::addToListAndMap (lMktSQ_BKKHKG_OnDDate, lMktBKKHKGSegment);
2281
2282 // Demand info is not added for purely marketed O&Ds
2283 // Add demand info
2284 // lCabinClassPairList.clear();
2285 // lCabinClassPairList.push_back(lCC_YM2);
2286 // lMktSQ_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
2287 ***********************************************************************************/
2288
2289
2290 // ////// CX ///////
2291 // Step 0.2: Flight-date level
2292 // Create a FlightDate (CX12/08-MAR-2010) for CX's Inventory
2293 lFlightNumber = 12;
2294 //lDate = Date_T (2010, 2, 8);
2295 lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
2296
2297 FlightDate& lCX12_20100308_FD =
2298 FacBom<FlightDate>::instance().create (lFlightDateKey);
2299 FacBomManager::addToListAndMap (lCXInv, lCX12_20100308_FD);
2300 FacBomManager::linkWithParent (lCXInv, lCX12_20100308_FD);
2301
2302 // Create a (mkt) FlightDate (CX1100/08-FEB-2010) for CX's Inventory
2303 lFlightNumber = 1100;
2304 //lDate = Date_T (2010, 2, 8);
2305 lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
2306
2307 FlightDate& lCX1100_20100308_FD =
2308 FacBom<FlightDate>::instance().create (lMktFlightDateKey);
2309 FacBomManager::addToListAndMap (lCXInv, lCX1100_20100308_FD);
2310 FacBomManager::linkWithParent (lCXInv, lCX1100_20100308_FD);
2311
2312 // Display the flight-date
2313 // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
2314
2315 // Step 0.3: Segment-date level
2316 // Create a SegmentDate BKK-HKG for CX's Inventory
2317
2318 lSegmentDateKey = SegmentDateKey (lBKK, lHKG);
2319
2320 SegmentDate& lBKKHKGSegment =
2321 FacBom<SegmentDate>::instance().create (lSegmentDateKey);
2322 FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKHKGSegment);
2323 FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKHKGSegment);
2324
2325 // Add the routing leg key to the marketing BKK-HKG segment.
2326 lBKKHKGSegment.addLegKey (lCXBKKRoutingLegStr);
2327
2328 // Fill the SegmentDate content
2329 lBKKHKGSegment.setBoardingDate (lDate);
2330 lBKKHKGSegment.setOffDate (lDate);
2331 lBKKHKGSegment.setBoardingTime (l1200);
2332 lBKKHKGSegment.setOffTime (l1540);
2333 lBKKHKGSegment.setElapsedTime (l0240);
2334
2335 // Create a second (mkt) SegmentDate (SIN-BKK) for CX's Inventory
2336 lMktSegmentDateKey = SegmentDateKey (lSIN, lBKK);
2337
2338 SegmentDate& lMktSINBKKSegment =
2339 FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
2340 FacBomManager::addToListAndMap (lCX1100_20100308_FD, lMktSINBKKSegment);
2341 FacBomManager::linkWithParent (lCX1100_20100308_FD, lMktSINBKKSegment);
2342
2343 // Add the routing leg key SQ;11;2010-Mar-8;SIN to the marketing
2344 // CX;1100;2010-Mar-8;SIN-BKK segment.
2345 lMktSINBKKSegment.addLegKey (lSQSINRoutingLegStr);
2346
2347 // Fill the (mkt) SegmentDate content
2348 lMktSINBKKSegment.setBoardingDate (lDate);
2349 lMktSINBKKSegment.setOffDate (lDate);
2350 lMktSINBKKSegment.setBoardingTime (l0820);
2351 lMktSINBKKSegment.setOffTime (l1100);
2352 lMktSINBKKSegment.setElapsedTime (l0340);
2353
2354 // Step 0.4: Leg-date level
2355 // Create a LegDate (BKK) for CX's Inventory
2356 lLegDateKey = LegDateKey (lBKK);
2357
2358 LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
2359 FacBomManager::addToListAndMap (lCX12_20100308_FD, lBKKLeg);
2360 FacBomManager::linkWithParent (lCX12_20100308_FD, lBKKLeg);
2361
2362 // Fill the LegDate content
2363 lBKKLeg.setOffPoint (lHKG);
2364 lBKKLeg.setBoardingDate (lDate);
2365 lBKKLeg.setOffDate (lDate);
2366 lBKKLeg.setBoardingTime (l1200);
2367 lBKKLeg.setOffTime (l1540);
2368 lBKKLeg.setElapsedTime (l0240);
2369
2370 // Display the leg-date
2371 // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
2372
2373 // Step 0.5: segment-cabin level
2374 // Create a SegmentCabin (Y) for the Segment BKK-HKG of CX's Inventory
2375 SegmentCabin& lBKKHKGSegmentYCabin =
2376 FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2377 FacBomManager::addToListAndMap (lBKKHKGSegment, lBKKHKGSegmentYCabin);
2378 FacBomManager::linkWithParent (lBKKHKGSegment, lBKKHKGSegmentYCabin);
2379
2380 // Create a SegmentCabin (Y) for the (mkt) Segment SIN-BKK of CX's Inventory
2381 SegmentCabin& lMktSINBKKSegmentYCabin =
2382 FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
2383 FacBomManager::addToListAndMap (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
2384 FacBomManager::linkWithParent (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
2385
2386 // Step 0.6: leg-cabin level
2387 // Create a LegCabin (Y) for the Leg BKK-HKG on CX's Inventory
2388 LegCabin& lBKKLegYCabin =
2389 FacBom<LegCabin>::instance().create (lYLegCabinKey);
2390 FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
2391 FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
2392
2393 lCapacity = CabinCapacity_T(100);
2394 lBKKLegYCabin.setCapacities (lCapacity);
2395 lBKKLegYCabin.setAvailabilityPool (lCapacity);
2396
2397 // Step 0.7: fare family level
2398 // Create a fareFamily (1) for the Segment BKK-HKG, cabin Y on CX's Inv
2399 FareFamily& lBKKHKGSegmentYCabin1Family =
2400 FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2401 FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2402 lBKKHKGSegmentYCabin1Family);
2403 FacBomManager::linkWithParent (lBKKHKGSegmentYCabin,
2404 lBKKHKGSegmentYCabin1Family);
2405
2406 // Create a FareFamily (1) for the (mkt) Segment SIN-BKK, cabin Y on CX's Inv
2407 FareFamily& lMktSINBKKSegmentYCabin1Family =
2408 FacBom<FareFamily>::instance().create (l1FareFamilyKey);
2409 FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2410 lMktSINBKKSegmentYCabin1Family);
2411 FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin,
2412 lMktSINBKKSegmentYCabin1Family);
2413
2414
2415 // Step 0.8: booking class level
2416 // Create a BookingClass (Y) for the
2417 // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
2418 BookingClass& lBKKHKGSegmentYCabin1FamilyYClass =
2419 FacBom<BookingClass>::instance().create (lYBookingClassKey);
2420 FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
2421 lBKKHKGSegmentYCabin1FamilyYClass);
2422 FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
2423 lBKKHKGSegmentYCabin1FamilyYClass);
2424
2425 FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2426 lBKKHKGSegmentYCabin1FamilyYClass);
2427 FacBomManager::addToListAndMap (lBKKHKGSegment,
2428 lBKKHKGSegmentYCabin1FamilyYClass);
2429
2430 lBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
2431
2432 // Create a BookingClass (Y) for the (mkt) Segment SIN-BKK, cabin Y,
2433 // fare family 1 on CX's Inv
2434 BookingClass& lMktSINBKKSegmentYCabin1FamilyYClass =
2435 FacBom<BookingClass>::instance().create (lYBookingClassKey);
2436 FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
2437 lMktSINBKKSegmentYCabin1FamilyYClass);
2438 FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
2439 lMktSINBKKSegmentYCabin1FamilyYClass);
2440
2441 FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2442 lMktSINBKKSegmentYCabin1FamilyYClass);
2443 FacBomManager::addToListAndMap (lMktSINBKKSegment,
2444 lMktSINBKKSegmentYCabin1FamilyYClass);
2445
2446 lMktSINBKKSegmentYCabin1FamilyYClass.setYield(700);
2447
2448 //Create a BookingClass (M) for the
2449 // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
2450 BookingClass& lBKKHKGSegmentYCabin1FamilyMClass =
2451 FacBom<BookingClass>::instance().create (lMBookingClassKey);
2452 FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
2453 lBKKHKGSegmentYCabin1FamilyMClass);
2454 FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
2455 lBKKHKGSegmentYCabin1FamilyMClass);
2456
2457 FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
2458 lBKKHKGSegmentYCabin1FamilyMClass);
2459 FacBomManager::addToListAndMap (lBKKHKGSegment,
2460 lBKKHKGSegmentYCabin1FamilyMClass);
2461
2462 lBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
2463
2464 // Create a BookingClass (M) for the (mkt) Segment SIN-BKK, cabin Y,
2465 // fare family 1 on CX's Inv
2466 BookingClass& lMktSINBKKSegmentYCabin1FamilyMClass =
2467 FacBom<BookingClass>::instance().create (lMBookingClassKey);
2468 FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
2469 lMktSINBKKSegmentYCabin1FamilyMClass);
2470 FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
2471 lMktSINBKKSegmentYCabin1FamilyMClass);
2472
2473 FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
2474 lMktSINBKKSegmentYCabin1FamilyMClass);
2475 FacBomManager::addToListAndMap (lMktSINBKKSegment,
2476 lMktSINBKKSegmentYCabin1FamilyMClass);
2477
2478 lMktSINBKKSegmentYCabin1FamilyMClass.setYield(500);
2479
2480 /* =================================================================================== */
2481
2482 // Step 1.0: O&D level
2483 // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK-CX12/08-MAR-2010/BKK-HKG) for CX's Inventory
2484 OnDString_T lMktCXSINBKKOnDStr = "CX;1100,2010-Mar-08;SIN,BKK";
2485 OnDString_T lCXBKKHKGOnDStr = "CX;12,2010-Mar-08;BKK,HKG";
2486 lOnDStringList.clear();
2487 lOnDStringList.push_back (lMktCXSINBKKOnDStr);
2488 lOnDStringList.push_back (lCXBKKHKGOnDStr);
2489
2490 lOnDDateKey = OnDDateKey(lOnDStringList);
2491 OnDDate& lCX_SINHKG_OnDDate =
2492 FacBom<OnDDate>::instance().create (lOnDDateKey);
2493 // Link to the inventory
2494 FacBomManager::addToListAndMap (lCXInv, lCX_SINHKG_OnDDate);
2495 FacBomManager::linkWithParent (lCXInv, lCX_SINHKG_OnDDate);
2496
2497 // Add the segments
2498 FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lMktSINBKKSegment);
2499 FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lBKKHKGSegment);
2500
2501 // Add total forecast info for cabin Y.
2502 lCX_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
2503
2504 // Add demand info
2505 lCabinClassPairList.clear();
2506 lCabinClassPairList.push_back(lCC_YM1);
2507 lCabinClassPairList.push_back(lCC_YM2);
2508 lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2509 lYield850Mean20StdDev2);
2510
2511 lCabinClassPairList.clear();
2512 lCabinClassPairList.push_back(lCC_YY1);
2513 lCabinClassPairList.push_back(lCC_YY2);
2514 lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2515 lYield1200Mean10StdDev1);
2516
2517 /***********************************************************************************
2518 // Create an O&D Date (CX1100/08-MAR-2010/SIN-BKK) for CX's Inventory
2519 lFullKeyList.clear();
2520 lFullKeyList.push_back (lMktCXSINBKKFullKeyStr);
2521
2522 lOnDDateKey = OnDDateKey(lFullKeyList);
2523 OnDDate& lMktCX_SINBKK_OnDDate =
2524 FacBom<OnDDate>::instance().create (lOnDDateKey);
2525 // Link to the inventory
2526 FacBomManager::addToListAndMap (lCXInv, lMktCX_SINBKK_OnDDate);
2527 FacBomManager::linkWithParent (lCXInv, lMktCX_SINBKK_OnDDate);
2528
2529 // Add the segments
2530 FacBomManager::addToListAndMap (lMktCX_SINBKK_OnDDate, lMktSINBKKSegment);
2531
2532 // Demand info is not added for purely marketed O&Ds
2533 // Add demand info
2534 // lCabinClassPairList.clear();
2535 // lCabinClassPairList.push_back(lCC_YM1);
2536 // lMktCX_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
2537 *************************************************************************************/
2538
2539 // Create an O&D Date (CX12/08-FEB-2010/BKK-HKG) for CX's Inventory
2540 lOnDStringList.clear();
2541 lOnDStringList.push_back (lCXBKKHKGOnDStr);
2542
2543 lOnDDateKey = OnDDateKey(lOnDStringList);
2544 OnDDate& lCX_BKKHKG_OnDDate =
2545 FacBom<OnDDate>::instance().create (lOnDDateKey);
2546 // Link to the inventory
2547 FacBomManager::addToListAndMap (lCXInv, lCX_BKKHKG_OnDDate);
2548 FacBomManager::linkWithParent (lCXInv, lCX_BKKHKG_OnDDate);
2549
2550 // Add the segments
2551 FacBomManager::addToListAndMap (lCX_BKKHKG_OnDDate, lBKKHKGSegment);
2552
2553 // Add total forecast info for cabin Y.
2554 lCX_BKKHKG_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
2555
2556 // Add demand info
2557 lCabinClassPairList.clear();
2558 lCabinClassPairList.push_back(lCC_YM2);
2559 lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2560 lYield500Mean20StdDev1);
2561
2562 lCabinClassPairList.clear();
2563 lCabinClassPairList.push_back(lCC_YY2);
2564 const YieldDemandPair_T lYield700Mean10StdDev1 (lYield700, lMean10StdDev1 );
2565 lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList,
2566 lYield700Mean10StdDev1);
2567
2568 /*================================================================================
2569 ================================================================================
2570 ================================================================================*/
2571 // Schedule:
2572 // SQ:
2573 // Step 1: flight period level
2574 // Create a flight period for SQ11:
2575 const DoWStruct lDoWSrtuct ("1111111");
2576 const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 8);
2577 const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 9);
2578 const DatePeriod_T lDatePeriod (lDateRangeStart, lDateRangeEnd);
2579 const PeriodStruct lPeriodStruct (lDatePeriod,lDoWSrtuct);
2580
2581 lFlightNumber = FlightNumber_T (11);
2582
2583 FlightPeriodKey lFlightPeriodKey (lFlightNumber, lPeriodStruct);
2584
2585 FlightPeriod& lSQ11FlightPeriod =
2586 FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
2587 FacBomManager::addToListAndMap (lSQInv, lSQ11FlightPeriod);
2588 FacBomManager::linkWithParent (lSQInv, lSQ11FlightPeriod);
2589
2590 // Step 2: segment period level
2591 // Create a segment period for SIN-BKK:
2592
2593 SegmentPeriodKey lSegmentPeriodKey (lSIN, lBKK);
2594
2595 SegmentPeriod& lSINBKKSegmentPeriod =
2596 FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
2597 FacBomManager::addToListAndMap (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
2598 FacBomManager::linkWithParent (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
2599
2600 lSINBKKSegmentPeriod.setBoardingTime (l0820);
2601 lSINBKKSegmentPeriod.setOffTime (l1100);
2602 lSINBKKSegmentPeriod.setElapsedTime (l0340);
2603 ClassList_String_T lYM ("YM");
2604 lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYM);
2605
2606 // CX:
2607 // Step 1: flight period level
2608 // Create a flight period for CX12:
2609 lFlightNumber = FlightNumber_T (12);
2610
2611 lFlightPeriodKey = FlightPeriodKey(lFlightNumber, lPeriodStruct);
2612
2613 FlightPeriod& lCX12FlightPeriod =
2614 FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
2615 FacBomManager::addToListAndMap (lCXInv, lCX12FlightPeriod);
2616 FacBomManager::linkWithParent (lCXInv, lCX12FlightPeriod);
2617
2618 // Step 2: segment period level
2619 // Create a segment period for BKK-HKG:
2620
2621 lSegmentPeriodKey = SegmentPeriodKey (lBKK, lHKG);
2622
2623 SegmentPeriod& lBKKHKGSegmentPeriod =
2624 FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
2625 FacBomManager::addToListAndMap (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
2626 FacBomManager::linkWithParent (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
2627
2628 lBKKHKGSegmentPeriod.setBoardingTime (l1200);
2629 lBKKHKGSegmentPeriod.setOffTime (l1540);
2630 lBKKHKGSegmentPeriod.setElapsedTime (l0240);
2631 lBKKHKGSegmentPeriod.addCabinBookingClassList (lY,lYM);
2632
2633 }
2634
2635 // //////////////////////////////////////////////////////////////////////
2636 void CmdBomManager::buildPartnershipsSamplePricing (BomRoot& ioBomRoot) {
2637
2639
2640 /*===================================================================================*/
2641 // First airport pair SIN-BKK.
2642 // Set the airport-pair primary key.
2643 AirportPairKey lAirportPairKey ("SIN", "BKK");
2644
2645 // Create the AirportPairKey object and link it to the ioBomRoot object.
2646 AirportPair& lSINBKKAirportPair =
2647 FacBom<AirportPair>::instance().create (lAirportPairKey);
2648 FacBomManager::addToListAndMap (ioBomRoot, lSINBKKAirportPair);
2649 FacBomManager::linkWithParent (ioBomRoot, lSINBKKAirportPair);
2650
2651 // Set the fare date-period primary key.
2652 const Date_T lDateRangeStart (2010, boost::gregorian::Mar, 01);
2653 const Date_T lDateRangeEnd (2010, boost::gregorian::Mar, 31);
2654 const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
2655 const DatePeriodKey lDatePeriodKey (lDateRange);
2656
2657 // Create the DatePeriodKey object and link it to the PosChannel object.
2658 DatePeriod& lSINBKKDatePeriod =
2659 FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2660 FacBomManager::addToListAndMap (lSINBKKAirportPair, lSINBKKDatePeriod);
2661 FacBomManager::linkWithParent (lSINBKKAirportPair, lSINBKKDatePeriod);
2662
2663 // Set the point-of-sale-channel primary key.
2664 PosChannelKey lPosChannelKey ("SIN","IN");
2665
2666 // Create the PositionKey object and link it to the AirportPair object.
2667 PosChannel& lSINPosChannel =
2668 FacBom<PosChannel>::instance().create (lPosChannelKey);
2669 FacBomManager::addToListAndMap (lSINBKKDatePeriod, lSINPosChannel);
2670 FacBomManager::linkWithParent (lSINBKKDatePeriod, lSINPosChannel);
2671
2672 // Set the fare time-period primary key.
2673 const Time_T lTimeRangeStart (0, 0, 0);
2674 const Time_T lTimeRangeEnd (23, 0, 0);
2675 const TimePeriodKey lFareTimePeriodKey (lTimeRangeStart,
2676 lTimeRangeEnd);
2677
2678 // Create the TimePeriodKey and link it to the DatePeriod object.
2679 TimePeriod& lSINBKKFareTimePeriod =
2680 FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2681 FacBomManager::addToListAndMap (lSINPosChannel, lSINBKKFareTimePeriod);
2682 FacBomManager::linkWithParent (lSINPosChannel, lSINBKKFareTimePeriod);
2683
2684 // Generate the FareRule
2685 const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ONE_WAY,
2691
2692 // Create the FareFeaturesKey and link it to the TimePeriod object.
2693 FareFeatures& lSINBKKFareFeatures =
2694 FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2695 FacBomManager::addToListAndMap (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
2696 FacBomManager::linkWithParent (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
2697
2698 // Generate Segment Features and link them to their FareRule.
2699 AirlineCodeList_T lSQAirlineCodeList;
2700 lSQAirlineCodeList.push_back ("SQ");
2701
2702 ClassList_StringList_T lYClassCodeList;
2703 lYClassCodeList.push_back ("Y");
2704 const AirlineClassListKey lSQAirlineYClassListKey (lSQAirlineCodeList,
2705 lYClassCodeList);
2706
2707 ClassList_StringList_T lMClassCodeList;
2708 lMClassCodeList.push_back ("M");
2709 const AirlineClassListKey lSQAirlineMClassListKey (lSQAirlineCodeList,
2710 lMClassCodeList);
2711
2712 // Create the AirlineClassListKey and link it to the FareFeatures object.
2713 AirlineClassList& lSQAirlineYClassList =
2714 FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
2715 lSQAirlineYClassList.setFare(700);
2716 FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineYClassList);
2717 FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineYClassList);
2718
2719 AirlineClassList& lSQAirlineMClassList =
2720 FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
2721 lSQAirlineMClassList.setFare(500);
2722 FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineMClassList);
2723 FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineMClassList);
2724
2725 /*===================================================================================*/
2726 // Second airport pair BKK-HKG.
2727 // Set the airport-pair primary key.
2728 lAirportPairKey = AirportPairKey ("BKK", "HKG");
2729
2730 // Create the AirportPairKey object and link it to the ioBomRoot object.
2731 AirportPair& lBKKHKGAirportPair =
2732 FacBom<AirportPair>::instance().create (lAirportPairKey);
2733 FacBomManager::addToListAndMap (ioBomRoot, lBKKHKGAirportPair);
2734 FacBomManager::linkWithParent (ioBomRoot, lBKKHKGAirportPair);
2735
2736 // Set the fare date-period primary key.
2737 // Use the same as previously.
2738
2739 // Create the DatePeriodKey object and link it to the PosChannel object.
2740 DatePeriod& lBKKHKGDatePeriod =
2741 FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2742 FacBomManager::addToListAndMap (lBKKHKGAirportPair, lBKKHKGDatePeriod);
2743 FacBomManager::linkWithParent (lBKKHKGAirportPair, lBKKHKGDatePeriod);
2744
2745 // Set the point-of-sale-channel primary key.
2746 lPosChannelKey = PosChannelKey("BKK","IN");
2747
2748 // Create the PositionKey object and link it to the AirportPair object.
2749 PosChannel& lBKKPosChannel =
2750 FacBom<PosChannel>::instance().create (lPosChannelKey);
2751 FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lBKKPosChannel);
2752 FacBomManager::linkWithParent (lBKKHKGDatePeriod, lBKKPosChannel);
2753
2754 // Set the fare time-period primary key.
2755 // Use the same as previously.
2756
2757 // Create the TimePeriodKey and link it to the DatePeriod object.
2758 TimePeriod& lBKKHKGFareTimePeriod =
2759 FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2760 FacBomManager::addToListAndMap (lBKKPosChannel, lBKKHKGFareTimePeriod);
2761 FacBomManager::linkWithParent (lBKKPosChannel, lBKKHKGFareTimePeriod);
2762
2763 // Generate the FareRule
2764 // Use the same key as previously.
2765
2766 // Create the FareFeaturesKey and link it to the TimePeriod object.
2767 FareFeatures& lBKKHKGFareFeatures =
2768 FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2769 FacBomManager::addToListAndMap (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
2770 FacBomManager::linkWithParent (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
2771
2772 // Generate Segment Features and link them to their FareRule.
2773 AirlineCodeList_T lCXAirlineCodeList;
2774 lCXAirlineCodeList.push_back ("CX");
2775
2776 const AirlineClassListKey lCXAirlineYClassListKey (lCXAirlineCodeList,
2777 lYClassCodeList);
2778
2779 const AirlineClassListKey lCXAirlineMClassListKey (lCXAirlineCodeList,
2780 lMClassCodeList);
2781
2782 // Create the AirlineClassListKey and link it to the FareFeatures object.
2783 AirlineClassList& lCXAirlineYClassList =
2784 FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
2785 lCXAirlineYClassList.setFare(700);
2786 FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineYClassList);
2787 FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineYClassList);
2788
2789 AirlineClassList& lCXAirlineMClassList =
2790 FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
2791 lCXAirlineMClassList.setFare(500);
2792 FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineMClassList);
2793 FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineMClassList);
2794
2795 /*===================================================================================*/
2796 // Third airport pair SIN-HKG.
2797 // Set the airport-pair primary key.
2798 lAirportPairKey = AirportPairKey ("SIN", "HKG");
2799
2800 // Create the AirportPairKey object and link it to the ioBomRoot object.
2801 AirportPair& lSINHKGAirportPair =
2802 FacBom<AirportPair>::instance().create (lAirportPairKey);
2803 FacBomManager::addToListAndMap (ioBomRoot, lSINHKGAirportPair);
2804 FacBomManager::linkWithParent (ioBomRoot, lSINHKGAirportPair);
2805
2806 // Set the fare date-period primary key.
2807 // Use the same as previously.
2808
2809 // Create the DatePeriodKey object and link it to the PosChannel object.
2810 DatePeriod& lSINHKGDatePeriod =
2811 FacBom<DatePeriod>::instance().create (lDatePeriodKey);
2812 FacBomManager::addToListAndMap (lSINHKGAirportPair, lSINHKGDatePeriod);
2813 FacBomManager::linkWithParent (lSINHKGAirportPair, lSINHKGDatePeriod);
2814
2815 // Set the point-of-sale-channel primary key.
2816 lPosChannelKey = PosChannelKey("SIN","IN");
2817
2818 // Create the PositionKey object and link it to the AirportPair object.
2819 PosChannel& lOnDSINPosChannel =
2820 FacBom<PosChannel>::instance().create (lPosChannelKey);
2821 FacBomManager::addToListAndMap (lSINHKGDatePeriod, lOnDSINPosChannel);
2822 FacBomManager::linkWithParent (lSINHKGDatePeriod, lOnDSINPosChannel);
2823
2824 // Set the fare time-period primary key.
2825 // Use the same as previously.
2826
2827 // Create the TimePeriodKey and link it to the DatePeriod object.
2828 TimePeriod& lSINHKGFareTimePeriod =
2829 FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
2830 FacBomManager::addToListAndMap (lOnDSINPosChannel, lSINHKGFareTimePeriod);
2831 FacBomManager::linkWithParent (lOnDSINPosChannel, lSINHKGFareTimePeriod);
2832
2833 // Generate the FareRule
2834 // Use the same key as previously.
2835
2836 // Create the FareFeaturesKey and link it to the TimePeriod object.
2837 FareFeatures& lSINHKGFareFeatures =
2838 FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
2839 FacBomManager::addToListAndMap (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
2840 FacBomManager::linkWithParent (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
2841
2842 // Generate Segment Features and link them to their FareRule.
2843 AirlineCodeList_T lSQ_CXAirlineCodeList;
2844 lSQ_CXAirlineCodeList.push_back ("SQ");
2845 lSQ_CXAirlineCodeList.push_back ("CX");
2846
2847 ClassList_StringList_T lY_YClassCodeList;
2848 lY_YClassCodeList.push_back ("Y");
2849 lY_YClassCodeList.push_back ("Y");
2850 const AirlineClassListKey lSQ_CXAirlineYClassListKey (lSQ_CXAirlineCodeList,
2851 lY_YClassCodeList);
2852
2853 ClassList_StringList_T lM_MClassCodeList;
2854 lM_MClassCodeList.push_back ("M");
2855 lM_MClassCodeList.push_back ("M");
2856 const AirlineClassListKey lSQ_CXAirlineMClassListKey (lSQ_CXAirlineCodeList,
2857 lM_MClassCodeList);
2858
2859 // Create the AirlineClassListKey and link it to the FareFeatures object.
2860 AirlineClassList& lSQ_CXAirlineYClassList =
2861 FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
2862 lSQ_CXAirlineYClassList.setFare(1200);
2863 FacBomManager::addToListAndMap (lSINHKGFareFeatures,
2864 lSQ_CXAirlineYClassList);
2865 FacBomManager::linkWithParent (lSINHKGFareFeatures,
2866 lSQ_CXAirlineYClassList);
2867
2868 AirlineClassList& lSQ_CXAirlineMClassList =
2869 FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
2870 lSQ_CXAirlineMClassList.setFare(850);
2871 FacBomManager::addToListAndMap (lSINHKGFareFeatures,
2872 lSQ_CXAirlineMClassList);
2873 FacBomManager::linkWithParent (lSINHKGFareFeatures,
2874 lSQ_CXAirlineMClassList);
2875
2876
2878
2879 /*===================================================================================*/
2880
2881 // Use the same airport pair, and date period for adding SQ SIN-BKK yields.
2882
2883 // Set the point-of-sale-channel primary key.
2884 lPosChannelKey = PosChannelKey(DEFAULT_POS, DEFAULT_CHANNEL);
2885
2886 // Create the PositionKey object and link it to the AirportPair object.
2887 PosChannel& lRAC_SINBKKPosChannel =
2888 FacBom<PosChannel>::instance().create (lPosChannelKey);
2889 FacBomManager::addToListAndMap (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
2890 FacBomManager::linkWithParent (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
2891
2892 // Set the yield time-period primary key.
2893 const TimePeriodKey lYieldTimePeriodKey (lTimeRangeStart,
2894 lTimeRangeEnd);
2895
2896 // Create the TimePeriodKey and link it to the DatePeriod object.
2897 TimePeriod& lSINBKKYieldTimePeriod =
2898 FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
2899 FacBomManager::addToListAndMap (lRAC_SINBKKPosChannel,
2900 lSINBKKYieldTimePeriod);
2901 FacBomManager::linkWithParent (lRAC_SINBKKPosChannel,
2902 lSINBKKYieldTimePeriod);
2903
2904 // Generate the YieldRule
2905 const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
2906 CABIN_Y);
2907
2908 // Create the YieldFeaturesKey and link it to the TimePeriod object.
2909 YieldFeatures& lSINBKKYieldFeatures =
2910 FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
2911 FacBomManager::addToListAndMap (lSINBKKYieldTimePeriod,
2912 lSINBKKYieldFeatures);
2913 FacBomManager::linkWithParent (lSINBKKYieldTimePeriod,
2914 lSINBKKYieldFeatures);
2915
2916 // Generate Segment Features and link them to their YieldRule.
2917 // Use the same key as previously.
2918
2919 // Create the AirlineClassListKey and link it to the YieldFeatures object.
2920 AirlineClassList& lRAC_SQAirlineYClassList =
2921 FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
2922 lRAC_SQAirlineYClassList.setYield(700);
2923 FacBomManager::addToListAndMap (lSINBKKYieldFeatures,
2924 lRAC_SQAirlineYClassList);
2925 FacBomManager::linkWithParent (lSINBKKYieldFeatures,
2926 lRAC_SQAirlineYClassList);
2927
2928 AirlineClassList& lRAC_SQAirlineMClassList =
2929 FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
2930 lRAC_SQAirlineMClassList.setYield(500);
2931 FacBomManager::addToListAndMap (lSINBKKYieldFeatures,
2932 lRAC_SQAirlineMClassList);
2933 FacBomManager::linkWithParent (lSINBKKYieldFeatures,
2934 lRAC_SQAirlineMClassList);
2935
2936 /*===================================================================================*/
2937
2938 // Use the same airport pair, and date period for adding CX BKK-HKG yields.
2939
2940 // Set the point-of-sale-channel primary key.
2941 // Use the same as previously.
2942
2943 // Create the PositionKey object and link it to the AirportPair object.
2944 PosChannel& lRAC_BKKHKGPosChannel =
2945 FacBom<PosChannel>::instance().create (lPosChannelKey);
2946 FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
2947 FacBomManager::linkWithParent (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
2948
2949 // Set the yield time-period primary key.
2950 // Use the same as previously.
2951
2952 // Create the TimePeriodKey and link it to the DatePeriod object.
2953 TimePeriod& lBKKHKGYieldTimePeriod =
2954 FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
2955 FacBomManager::addToListAndMap (lRAC_BKKHKGPosChannel,
2956 lBKKHKGYieldTimePeriod);
2957 FacBomManager::linkWithParent (lRAC_BKKHKGPosChannel,
2958 lBKKHKGYieldTimePeriod);
2959
2960 // Generate the YieldRule
2961 // Use the same key as previously.
2962
2963 // Create the YieldFeaturesKey and link it to the TimePeriod object.
2964 YieldFeatures& lBKKHKGYieldFeatures =
2965 FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
2966 FacBomManager::addToListAndMap (lBKKHKGYieldTimePeriod,
2967 lBKKHKGYieldFeatures);
2968 FacBomManager::linkWithParent (lBKKHKGYieldTimePeriod,
2969 lBKKHKGYieldFeatures);
2970
2971 // Generate Segment Features and link them to their YieldRule.
2972 // Use the same key as previously.
2973
2974 // Create the AirlineClassListKey and link it to the YieldFeatures object.
2975 AirlineClassList& lRAC_CXAirlineYClassList =
2976 FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
2977 lRAC_CXAirlineYClassList.setYield(700);
2978 FacBomManager::addToListAndMap (lBKKHKGYieldFeatures,
2979 lRAC_CXAirlineYClassList);
2980 FacBomManager::linkWithParent (lBKKHKGYieldFeatures,
2981 lRAC_CXAirlineYClassList);
2982
2983 AirlineClassList& lRAC_CXAirlineMClassList =
2984 FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
2985 lRAC_CXAirlineMClassList.setYield(500);
2986 FacBomManager::addToListAndMap (lBKKHKGYieldFeatures,
2987 lRAC_CXAirlineMClassList);
2988 FacBomManager::linkWithParent (lBKKHKGYieldFeatures,
2989 lRAC_CXAirlineMClassList);
2990
2991 /*===================================================================================*/
2992
2993 // Use the same airport pair, and date period for SQ-CX SIN-HKG
2994
2995 // Set the point-of-sale-channel primary key.
2996 // Use the same as previously.
2997
2998 // Create the PositionKey object and link it to the AirportPair object.
2999 PosChannel& lRAC_SINHKGChannel =
3000 FacBom<PosChannel>::instance().create (lPosChannelKey);
3001 FacBomManager::addToListAndMap (lSINHKGDatePeriod, lRAC_SINHKGChannel);
3002 FacBomManager::linkWithParent (lSINHKGDatePeriod, lRAC_SINHKGChannel);
3003
3004 // Set the yield time-period primary key.
3005 // Use the same as previously.
3006
3007 // Create the TimePeriodKey and link it to the DatePeriod object.
3008 TimePeriod& lSINHKGYieldTimePeriod =
3009 FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
3010 FacBomManager::addToListAndMap (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
3011 FacBomManager::linkWithParent (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
3012
3013 // Generate the YieldRule
3014 // Use the same key as previously.
3015
3016 // Create the YieldFeaturesKey and link it to the TimePeriod object.
3017 YieldFeatures& lSINHKGYieldFeatures =
3018 FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
3019 FacBomManager::addToListAndMap (lSINHKGYieldTimePeriod,
3020 lSINHKGYieldFeatures);
3021 FacBomManager::linkWithParent (lSINHKGYieldTimePeriod,
3022 lSINHKGYieldFeatures);
3023
3024 // Generate Segment Features and link them to their YieldRule.
3025 // Use the same key as previously
3026
3027 // Create the AirlineClassListKey and link it to the YieldFeatures object.
3028 AirlineClassList& lRAC_SQ_CXAirlineYClassList =
3029 FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
3030 lRAC_SQ_CXAirlineYClassList.setYield(1200);
3031 FacBomManager::addToListAndMap (lSINHKGYieldFeatures,
3032 lRAC_SQ_CXAirlineYClassList);
3033 FacBomManager::linkWithParent (lSINHKGYieldFeatures,
3034 lRAC_SQ_CXAirlineYClassList);
3035
3036 AirlineClassList& lRAC_SQ_CXAirlineMClassList =
3037 FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
3038 lRAC_SQ_CXAirlineMClassList.setYield(850);
3039 FacBomManager::addToListAndMap (lSINHKGYieldFeatures,
3040 lRAC_SQ_CXAirlineMClassList);
3041 FacBomManager::linkWithParent (lSINHKGYieldFeatures,
3042 lRAC_SQ_CXAirlineMClassList);
3043
3044 }
3045
3046}
3047
#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 &)