StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
CmdCloneBomManager.cpp
Go to the documentation of this file.
1 
5 // //////////////////////////////////////////////////////////////////////
6 // Import section
7 // //////////////////////////////////////////////////////////////////////
8 // STL
9 #include <cassert>
10 #include <sstream>
11 // StdAir
17 
18 namespace stdair {
19 
20  // ////////////////////////////////////////////////////////////////////
21  void CmdCloneBomManager::cloneBomRoot (const BomRoot& iBomRoot,
22  BomRoot& ioCloneBomRoot) {
23 
29  // Check whether there are Inventory objects
30  const bool hasInventoryList = BomManager::hasList<Inventory> (iBomRoot);
31  if (hasInventoryList == true) {
32 
33  // Browse the inventories
34  const InventoryList_T& lInventoryList =
35  BomManager::getList<Inventory> (iBomRoot);
36  for (InventoryList_T::const_iterator itInv = lInventoryList.begin();
37  itInv != lInventoryList.end(); ++itInv) {
38  const Inventory* lInv_ptr = *itInv;
39  assert (lInv_ptr != NULL);
40 
41  // Clone the current inventory
42  Inventory& lCloneInventory = cloneInventory (*lInv_ptr, ioCloneBomRoot);
43  FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneInventory);
44  FacBomManager::linkWithParent (ioCloneBomRoot, lCloneInventory);
45  }
46  }
47 
48  // Check whether there are Airport Pair objects
49  const bool hastAirportPairList =
50  BomManager::hasList<AirportPair> (iBomRoot);
51  if (hastAirportPairList == true) {
52 
53  // Browse the airport pairs
54  const AirportPairList_T& lAirportPairList =
55  BomManager::getList<AirportPair> (iBomRoot);
56  for (AirportPairList_T::const_iterator itAirportPair =
57  lAirportPairList.begin();
58  itAirportPair != lAirportPairList.end(); ++itAirportPair) {
59  const AirportPair* lAirportPair_ptr = *itAirportPair;
60  assert (lAirportPair_ptr != NULL);
61 
62  // Clone the current airport pair
63  AirportPair& lCloneAirportPair = cloneAirportPair (*lAirportPair_ptr);
64  FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneAirportPair);
65  FacBomManager::linkWithParent (ioCloneBomRoot, lCloneAirportPair);
66  }
67  }
68  }
69 
70  // ////////////////////////////////////////////////////////////////////
71  Inventory& CmdCloneBomManager::cloneInventory (const Inventory& iInventory,
72  BomRoot& ioCloneBomRoot) {
73 
77  Inventory& lCloneInventory =
79 
80  // Check whether there are FlightDate objects
81  const bool hasFlighDateList = BomManager::hasList<FlightDate> (iInventory);
82  if (hasFlighDateList == true) {
83  // Browse the flight-dates
84  const FlightDateList_T& lFlightDateList =
85  BomManager::getList<FlightDate> (iInventory);
86  for (FlightDateList_T::const_iterator itFD = lFlightDateList.begin();
87  itFD != lFlightDateList.end(); ++itFD) {
88  const FlightDate* lFD_ptr = *itFD;
89  assert (lFD_ptr != NULL);
90 
91  // Clone the current flight-date
92  FlightDate& lCloneFD = cloneFlightDate (*lFD_ptr);
93  FacBomManager::addToListAndMap (lCloneInventory, lCloneFD);
94  FacBomManager::linkWithParent (lCloneInventory, lCloneFD);
95  }
96  }
97 
98  // Check if the inventory contains a list of partners
99  const bool hasPartnerList = BomManager::hasList<Inventory> (iInventory);
100  if (hasPartnerList == true) {
101 
102  // Browse the partner's inventories
103  const InventoryList_T& lPartnerInventoryList =
104  BomManager::getList<Inventory> (iInventory);
105 
106  for (InventoryList_T::const_iterator itInv =
107  lPartnerInventoryList.begin();
108  itInv != lPartnerInventoryList.end(); ++itInv) {
109  const Inventory* lInv_ptr = *itInv;
110  assert (lInv_ptr != NULL);
111 
112  // Clone the current partnership inventory
113  Inventory& lClonePartnerInventory = cloneInventory (*lInv_ptr,
114  ioCloneBomRoot);
115  FacBomManager::addToListAndMap (lCloneInventory,
116  lClonePartnerInventory);
117  FacBomManager::linkWithParent (lCloneInventory,
118  lClonePartnerInventory);
119  }
120  }
121 
122  // Check whether there are O&D date objects
123  const bool hasOnDList = BomManager::hasList<OnDDate> (iInventory);
124  if (hasOnDList == true){
125 
126  //Browse the O&Ds
127  const OnDDateList_T& lOnDDateList =
128  BomManager::getList<OnDDate> (iInventory);
129 
130  for (OnDDateList_T::const_iterator itOnD = lOnDDateList.begin();
131  itOnD != lOnDDateList.end(); ++itOnD) {
132  const OnDDate* lOnDDate_ptr = *itOnD;
133  assert (lOnDDate_ptr != NULL);
134 
135  // Clone the current O&D date
136  OnDDate& lCloneOnDDate = cloneOnDDate (*lOnDDate_ptr);
137  FacBomManager::addToListAndMap (lCloneInventory, lCloneOnDDate);
138  FacBomManager::linkWithParent (lCloneInventory, lCloneOnDDate);
139  }
140  }
141 
142  // Check whether there are Flight Period objects
143  const bool hasFlightPeriodList =
144  BomManager::hasList<FlightPeriod> (iInventory);
145  if (hasFlightPeriodList == true) {
146 
147  // Browse the flight-periods
148  const FlightPeriodList_T& lFlightPeriodList =
149  BomManager::getList<FlightPeriod> (iInventory);
150  for (FlightPeriodList_T::const_iterator itFlightPeriod =
151  lFlightPeriodList.begin();
152  itFlightPeriod != lFlightPeriodList.end(); ++itFlightPeriod) {
153  const FlightPeriod* lFlightPeriod_ptr = *itFlightPeriod;
154  assert (lFlightPeriod_ptr != NULL);
155 
156  // Clone the current flight period
157  FlightPeriod& lCloneFlightPeriod = cloneFlightPeriod (*lFlightPeriod_ptr);
158  FacBomManager::addToListAndMap (lCloneInventory, lCloneFlightPeriod);
159  FacBomManager::linkWithParent (lCloneInventory, lCloneFlightPeriod);
160  }
161  }
162 
163  // Check whether there is an airline feature object
164  const AirlineFeature* lAirlineFeature_ptr =
165  BomManager::getObjectPtr<AirlineFeature,Inventory> (iInventory,
166  iInventory.getAirlineCode());
167  if (lAirlineFeature_ptr != NULL) {
168  // Clone the current airline feature object
169  AirlineFeature& lCloneAirlineFeature =
170  cloneAirlineFeature (*lAirlineFeature_ptr);
171  FacBomManager::setAirlineFeature (lCloneInventory, lCloneAirlineFeature);
172  FacBomManager::linkWithParent (lCloneInventory, lCloneAirlineFeature);
173  // Link the airline feature object with the top of the BOM tree
174  FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneAirlineFeature);
175  }
176 
177  return lCloneInventory;
178  }
179 
180  // ////////////////////////////////////////////////////////////////////
181  AirlineFeature& CmdCloneBomManager::
182  cloneAirlineFeature (const AirlineFeature& iAirlineFeature) {
183 
187  AirlineFeature& lCloneAirlineFeature =
188  FacCloneBom<AirlineFeature>::instance().clone (iAirlineFeature);
189 
190  return lCloneAirlineFeature;
191  }
192 
193 
194  // ////////////////////////////////////////////////////////////////////
195  OnDDate& CmdCloneBomManager::cloneOnDDate (const OnDDate& iOnDDate) {
196 
200  OnDDate& lCloneOnDDate =
202 
203  return lCloneOnDDate;
204  }
205 
206  // ////////////////////////////////////////////////////////////////////
207  FlightDate& CmdCloneBomManager::
208  cloneFlightDate (const FlightDate& iFlightDate) {
209 
213  FlightDate& lCloneFlightDate =
214  FacCloneBom<FlightDate>::instance().clone (iFlightDate);
215 
216  // Check whether there are LegDate objects
217  const bool hasLegDateList = BomManager::hasList<LegDate> (iFlightDate);
218  if (hasLegDateList == true) {
219 
220  // Browse the leg-dates
221  const LegDateList_T& lLegDateList =
222  BomManager::getList<LegDate> (iFlightDate);
223  for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
224  itLD != lLegDateList.end(); ++itLD) {
225  const LegDate* lLD_ptr = *itLD;
226  assert (lLD_ptr != NULL);
227 
228  // Clone the current leg-date
229  LegDate& lCloneLegDate = cloneLegDate (*lLD_ptr);
230  FacBomManager::addToListAndMap (lCloneFlightDate, lCloneLegDate);
231  FacBomManager::linkWithParent (lCloneFlightDate, lCloneLegDate);
232  }
233  }
234 
235  // Check whether there are SegmentDate objects
236  const bool hasSegmentDateList =
237  BomManager::hasList<SegmentDate> (iFlightDate);
238  if (hasSegmentDateList == true) {
239 
240  // Browse the segment-dates
241  const SegmentDateList_T& lSegmentDateList =
242  BomManager::getList<SegmentDate> (iFlightDate);
243  for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
244  itSD != lSegmentDateList.end(); ++itSD) {
245  const SegmentDate* lSD_ptr = *itSD;
246  assert (lSD_ptr != NULL);
247 
248  // Clone the current segment-date
249  SegmentDate& lCloneSegmentDate = cloneSegmentDate (*lSD_ptr);
250  FacBomManager::addToListAndMap (lCloneFlightDate, lCloneSegmentDate);
251  FacBomManager::linkWithParent (lCloneFlightDate, lCloneSegmentDate);
252 
253  }
254  }
255 
256  return lCloneFlightDate;
257  }
258 
259  // ////////////////////////////////////////////////////////////////////
260  LegDate& CmdCloneBomManager::cloneLegDate (const LegDate& iLegDate) {
261 
265  LegDate& lCloneLegDate =
267 
268  // Check whether there are LegCabin objects
269  const bool hasLegCabinList = BomManager::hasList<LegCabin> (iLegDate);
270  if (hasLegCabinList == true) {
271  // Browse the leg-cabins
272  const LegCabinList_T& lLegCabinList =
273  BomManager::getList<LegCabin> (iLegDate);
274  for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
275  itLC != lLegCabinList.end(); ++itLC) {
276  const LegCabin* lLC_ptr = *itLC;
277  assert (lLC_ptr != NULL);
278 
279  // Clone the current leg-cabin
280  LegCabin& lCloneLegCabin = cloneLegCabin (*lLC_ptr);
281  FacBomManager::addToListAndMap (lCloneLegDate, lCloneLegCabin);
282  FacBomManager::linkWithParent (lCloneLegDate, lCloneLegCabin);
283  }
284  }
285 
286  return lCloneLegDate;
287  }
288 
289  // ////////////////////////////////////////////////////////////////////
290  LegCabin& CmdCloneBomManager::cloneLegCabin (const LegCabin& iLegCabin) {
291 
295  LegCabin& lCloneLegCabin =
297 
298  // Check whether there are Bucket objects
299  const bool hasBucketList = BomManager::hasList<Bucket> (iLegCabin);
300  if (hasBucketList == true) {
301  // Browse the buckets
302  const BucketList_T& lBucketList =
303  BomManager::getList<Bucket> (iLegCabin);
304  for (BucketList_T::const_iterator itBucket = lBucketList.begin();
305  itBucket != lBucketList.end(); ++itBucket) {
306  const Bucket* lBucket_ptr = *itBucket;
307  assert (lBucket_ptr != NULL);
308 
309  // Clone the current bucket
310  Bucket& lCloneBucket = cloneBucket (*lBucket_ptr);
311  FacBomManager::addToListAndMap (lCloneLegCabin, lCloneBucket);
312  FacBomManager::linkWithParent (lCloneLegCabin, lCloneBucket);
313  }
314  }
315 
316  return lCloneLegCabin;
317  }
318 
319  // ////////////////////////////////////////////////////////////////////
320  Bucket& CmdCloneBomManager::cloneBucket (const Bucket& iBucket) {
321 
325  Bucket& lCloneBucket =
327 
328  return lCloneBucket;
329  }
330 
331  // ////////////////////////////////////////////////////////////////////
332  SegmentDate& CmdCloneBomManager::
333  cloneSegmentDate (const SegmentDate& iSegmentDate) {
334 
338  SegmentDate& lCloneSegmentDate =
339  FacCloneBom<SegmentDate>::instance().clone (iSegmentDate);
340 
341  // Check whether there are SegmentCabin objects
342  const bool hasSegmentCabinList =
343  BomManager::hasList<SegmentCabin> (iSegmentDate);
344  if (hasSegmentCabinList == true) {
345  // Browse the segment-cabins
346  const SegmentCabinList_T& lSegmentCabinList =
347  BomManager::getList<SegmentCabin> (iSegmentDate);
348  for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
349  itSC != lSegmentCabinList.end(); ++itSC) {
350  const SegmentCabin* lSC_ptr = *itSC;
351  assert (lSC_ptr != NULL);
352 
353  // Clone the current segment-cabin
354  SegmentCabin& lCloneSegmentCabin = cloneSegmentCabin (*lSC_ptr);
355  FacBomManager::addToListAndMap (lCloneSegmentDate, lCloneSegmentCabin);
356  FacBomManager::linkWithParent (lCloneSegmentDate, lCloneSegmentCabin);
357 
358  linkBookingClassesWithSegment (lCloneSegmentDate,
359  lCloneSegmentCabin);
360 
361  }
362  }
363  return lCloneSegmentDate;
364  }
365 
366  // ////////////////////////////////////////////////////////////////////
367  void CmdCloneBomManager::
368  linkBookingClassesWithSegment (SegmentDate& iCloneSegmentDate,
369  SegmentCabin& iCloneSegmentCabin) {
370 
371  // Browse the fare families to link the booking-classes to the
372  // segment-cabin and to the segment-date
373  const bool hasFareFamilyList =
374  BomManager::hasList<FareFamily> (iCloneSegmentCabin);
375  if (hasFareFamilyList == true) {
376  const FareFamilyList_T& lCloneFFList =
377  BomManager::getList<FareFamily> (iCloneSegmentCabin);
378  for (FareFamilyList_T::const_iterator itCloneFF = lCloneFFList.begin();
379  itCloneFF != lCloneFFList.end(); ++itCloneFF) {
380  const FareFamily* lCloneFF_ptr = *itCloneFF;
381  assert (lCloneFF_ptr != NULL);
382 
383  // Browse the list of booking classes
384  const bool hasBookingClasslist =
385  BomManager::hasList<BookingClass> (*lCloneFF_ptr);
386  if (hasBookingClasslist == true) {
387  const BookingClassList_T& lCloneBCList =
388  BomManager::getList<BookingClass> (*lCloneFF_ptr);
389  for (BookingClassList_T::const_iterator itCloneBC =
390  lCloneBCList.begin();
391  itCloneBC != lCloneBCList.end(); ++itCloneBC) {
392  const BookingClass* lCloneBC_ptr = *itCloneBC;
393  assert (lCloneBC_ptr != NULL);
394 
395  // Link the booking-class to the segment-cabin
396  stdair::FacBomManager::addToListAndMap (iCloneSegmentCabin,
397  *lCloneBC_ptr);
398 
399  // Link the booking-class to the segment-date
400  stdair::FacBomManager::addToListAndMap (iCloneSegmentDate,
401  *lCloneBC_ptr);
402  }
403  }
404  }
405  }
406  }
407 
408  // ////////////////////////////////////////////////////////////////////
409  SegmentCabin& CmdCloneBomManager::
410  cloneSegmentCabin (const SegmentCabin& iSegmentCabin) {
411 
415  SegmentCabin& lCloneSegmentCabin =
416  FacCloneBom<SegmentCabin>::instance().clone (iSegmentCabin);
417 
418  // Check whether there are fare family objects
419  const bool hasFareFamilyList =
420  BomManager::hasList<FareFamily> (iSegmentCabin);
421  if (hasFareFamilyList == true) {
422  // Browse the fare families
423  const FareFamilyList_T& lFareFamilyList =
424  BomManager::getList<FareFamily> (iSegmentCabin);
425  for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
426  itFF != lFareFamilyList.end(); ++itFF) {
427  const FareFamily* lFF_ptr = *itFF;
428  assert (lFF_ptr != NULL);
429 
430  // Clone the current fare-family
431  FareFamily& lCloneFareFamily = cloneFareFamily (*lFF_ptr);
432  FacBomManager::addToListAndMap (lCloneSegmentCabin, lCloneFareFamily);
433  FacBomManager::linkWithParent (lCloneSegmentCabin, lCloneFareFamily);
434  }
435  }
436 
437  return lCloneSegmentCabin;
438  }
439 
440  // ////////////////////////////////////////////////////////////////////
441  FareFamily& CmdCloneBomManager::
442  cloneFareFamily (const FareFamily& iFareFamily) {
446  FareFamily& lCloneFareFamily =
448 
449  // Check whether there are booking classes objects
450  const bool hasBookingClassList =
451  BomManager::hasList<BookingClass> (iFareFamily);
452  if (hasBookingClassList == true) {
453  // Browse the list of booking classes
454  const BookingClassList_T& lBookingClassList =
455  BomManager::getList<BookingClass> (iFareFamily);
456  for (BookingClassList_T::const_iterator itBookingClass =
457  lBookingClassList.begin();
458  itBookingClass != lBookingClassList.end(); ++itBookingClass) {
459  const BookingClass* lBC_ptr = *itBookingClass;
460  assert (lBC_ptr != NULL);
461 
462  // Clone the current booking class
463  BookingClass& lCloneBookingClass = cloneBookingClass (*lBC_ptr);
464  FacBomManager::addToListAndMap (lCloneFareFamily, lCloneBookingClass);
465  FacBomManager::linkWithParent (lCloneFareFamily, lCloneBookingClass);
466  }
467  }
468 
469  return lCloneFareFamily;
470  }
471 
472  // ////////////////////////////////////////////////////////////////////
473  BookingClass& CmdCloneBomManager::
474  cloneBookingClass (const BookingClass& iBookingClass) {
475 
479  BookingClass& lCloneBookingClass =
480  FacCloneBom<BookingClass>::instance().clone (iBookingClass);
481 
482  return lCloneBookingClass;
483  }
484 
485  // ////////////////////////////////////////////////////////////////////
486  AirportPair& CmdCloneBomManager::
487  cloneAirportPair (const AirportPair& iAirportPair) {
488 
492  AirportPair& lCloneAirportPair =
493  FacCloneBom<AirportPair>::instance().clone (iAirportPair);
494 
495  // Check whether there are date-period objects
496  const bool hasDatePeriodList =
497  BomManager::hasList<DatePeriod> (iAirportPair);
498  if (hasDatePeriodList == true) {
499  // Browse the date-periods
500  const DatePeriodList_T& lDatePeriodList =
501  BomManager::getList<DatePeriod> (iAirportPair);
502  for (DatePeriodList_T::const_iterator itDatePeriod =
503  lDatePeriodList.begin();
504  itDatePeriod != lDatePeriodList.end(); ++itDatePeriod) {
505  const DatePeriod* lDatePeriod_ptr = *itDatePeriod;
506  assert (lDatePeriod_ptr != NULL);
507 
508  // Clone the current date-period
509  DatePeriod& lCloneDatePeriod = cloneDatePeriod (*lDatePeriod_ptr);
510  FacBomManager::addToListAndMap (lCloneAirportPair, lCloneDatePeriod);
511  FacBomManager::linkWithParent (lCloneAirportPair, lCloneDatePeriod);
512  }
513  }
514 
515  return lCloneAirportPair;
516  }
517 
518  // ////////////////////////////////////////////////////////////////////
519  DatePeriod& CmdCloneBomManager::
520  cloneDatePeriod (const DatePeriod& iDatePeriod) {
521 
525  DatePeriod& lCloneDatePeriod =
526  FacCloneBom<DatePeriod>::instance().clone (iDatePeriod);
527 
528  // Check whether there are pos-channel objects
529  const bool hasPosChannelList =
530  BomManager::hasList<PosChannel> (iDatePeriod);
531  if (hasPosChannelList == true) {
532  // Browse the pos-channels
533  const PosChannelList_T& lPosChannelList =
534  BomManager::getList<PosChannel> (iDatePeriod);
535  for (PosChannelList_T::const_iterator itPosChannel =
536  lPosChannelList.begin();
537  itPosChannel != lPosChannelList.end(); ++itPosChannel) {
538  const PosChannel* lPosChannel_ptr = *itPosChannel;
539  assert (lPosChannel_ptr != NULL);
540 
541  // Clone the current pos-channel
542  PosChannel& lClonePosChannel = clonePosChannel (*lPosChannel_ptr);
543  FacBomManager::addToListAndMap (lCloneDatePeriod, lClonePosChannel);
544  FacBomManager::linkWithParent (lCloneDatePeriod, lClonePosChannel);
545  }
546  }
547 
548  return lCloneDatePeriod;
549  }
550 
551 
552  // ////////////////////////////////////////////////////////////////////
553  PosChannel& CmdCloneBomManager::
554  clonePosChannel (const PosChannel& iPosChannel) {
555 
559  PosChannel& lClonePosChannel =
561 
562  // Check whether there are time-period objects
563  const bool hasTimePeriodList =
564  BomManager::hasList<TimePeriod> (iPosChannel);
565  if (hasTimePeriodList == true) {
566  // Browse the time-periods
567  const TimePeriodList_T& lTimePeriodList =
568  BomManager::getList<TimePeriod> (iPosChannel);
569  for (TimePeriodList_T::const_iterator itTimePeriod =
570  lTimePeriodList.begin();
571  itTimePeriod != lTimePeriodList.end(); ++itTimePeriod) {
572  const TimePeriod* lTimePeriod_ptr = *itTimePeriod;
573  assert (lTimePeriod_ptr != NULL);
574 
575  // Clone the current time-period
576  TimePeriod& lCloneTimePeriod = cloneTimePeriod (*lTimePeriod_ptr);
577  FacBomManager::addToListAndMap (lClonePosChannel, lCloneTimePeriod);
578  FacBomManager::linkWithParent (lClonePosChannel, lCloneTimePeriod);
579  }
580  }
581 
582  return lClonePosChannel;
583  }
584 
585  // ////////////////////////////////////////////////////////////////////
586  TimePeriod& CmdCloneBomManager::
587  cloneTimePeriod (const TimePeriod& iTimePeriod) {
588 
592  TimePeriod& lCloneTimePeriod =
594 
595  // Check whether there are fare-feature objects
596  const bool hasFareFeaturesList =
597  BomManager::hasList<FareFeatures> (iTimePeriod);
598  if (hasFareFeaturesList == true) {
599  // Browse the fare-features
600  const FareFeaturesList_T& lFareFeaturesList =
601  BomManager::getList<FareFeatures> (iTimePeriod);
602  for (FareFeaturesList_T::const_iterator itFF = lFareFeaturesList.begin();
603  itFF != lFareFeaturesList.end(); ++itFF) {
604  const FareFeatures* lFF_ptr = *itFF;
605  assert (lFF_ptr != NULL);
606 
607  // Clone the current fare-feature
608  FareFeatures& lCloneFareFeatures =
609  cloneFeatures<FareFeatures> (*lFF_ptr);
610  FacBomManager::addToListAndMap (lCloneTimePeriod, lCloneFareFeatures);
611  FacBomManager::linkWithParent (lCloneTimePeriod, lCloneFareFeatures);
612  }
613  }
614 
615  // Check whether there are yield-feature objects
616  const bool hasYieldFeaturesList =
617  BomManager::hasList<YieldFeatures> (iTimePeriod);
618  if (hasYieldFeaturesList == true) {
619  // Browse the yield-features
620  const YieldFeaturesList_T& lYieldFeaturesList =
621  BomManager::getList<YieldFeatures> (iTimePeriod);
622  for (YieldFeaturesList_T::const_iterator itYF =
623  lYieldFeaturesList.begin();
624  itYF != lYieldFeaturesList.end(); ++itYF) {
625  const YieldFeatures* lYF_ptr = *itYF;
626  assert (lYF_ptr != NULL);
627 
628  // Clone the current yield-feature
629  YieldFeatures& lCloneYieldFeatures =
630  cloneFeatures<YieldFeatures> (*lYF_ptr);
631  FacBomManager::addToListAndMap (lCloneTimePeriod, lCloneYieldFeatures);
632  FacBomManager::linkWithParent (lCloneTimePeriod, lCloneYieldFeatures);
633  }
634  }
635 
636  return lCloneTimePeriod;
637  }
638 
639  // ////////////////////////////////////////////////////////////////////
640  template <typename FEATURE_TYPE>
641  FEATURE_TYPE& CmdCloneBomManager::
642  cloneFeatures (const FEATURE_TYPE& iFeatures) {
643 
647  FEATURE_TYPE& lCloneFeatures =
649 
650  // Check whether there are airline-class list objects
651  const bool hasAirlineClassListList =
652  BomManager::hasList<AirlineClassList> (iFeatures);
653  if (hasAirlineClassListList == true) {
654  // Browse the airline-class lists
655  const AirlineClassListList_T& lAirlineClassList =
656  BomManager::getList<AirlineClassList> (iFeatures);
657  for (AirlineClassListList_T::const_iterator itACList =
658  lAirlineClassList.begin();
659  itACList != lAirlineClassList.end(); ++itACList) {
660  const AirlineClassList* lACList_ptr = *itACList;
661  assert (lACList_ptr != NULL);
662 
663  // Clone the current airline-class list
664  AirlineClassList& lCloneAirlineClassList =
665  cloneAirlineClassList (*lACList_ptr);
666  FacBomManager::addToListAndMap (lCloneFeatures,
667  lCloneAirlineClassList);
668  FacBomManager::linkWithParent (lCloneFeatures,
669  lCloneAirlineClassList);
670  }
671  }
672 
673  return lCloneFeatures;
674  }
675 
676  // ////////////////////////////////////////////////////////////////////
677  AirlineClassList& CmdCloneBomManager::
678  cloneAirlineClassList (const AirlineClassList& iAirlineClassList) {
679 
683  AirlineClassList& lCloneAirlineClassList =
684  FacCloneBom<AirlineClassList>::instance().clone (iAirlineClassList);
685 
686  return lCloneAirlineClassList;
687  }
688 
689  // ////////////////////////////////////////////////////////////////////
690  FlightPeriod& CmdCloneBomManager::
691  cloneFlightPeriod (const FlightPeriod& iFlightPeriod) {
692 
696  FlightPeriod& lCloneFlightPeriod =
697  FacCloneBom<FlightPeriod>::instance().clone (iFlightPeriod);
698 
699  // Check whether there are airline-class list objects
700  const bool hasSegmentPeriodList =
701  BomManager::hasList<SegmentPeriod> (iFlightPeriod);
702  if (hasSegmentPeriodList == true) {
703  // Browse the airline-class lists
704  const SegmentPeriodList_T& lSegmentPeriodList =
705  BomManager::getList<SegmentPeriod> (iFlightPeriod);
706  for (SegmentPeriodList_T::const_iterator itSegmentPeriod =
707  lSegmentPeriodList.begin();
708  itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) {
709  const SegmentPeriod* lSegmentPeriod_ptr = *itSegmentPeriod;
710  assert (lSegmentPeriod_ptr != NULL);
711 
712  // Clone the current airline-class list
713  SegmentPeriod& lCloneSegmentPeriod =
714  cloneSegmentPeriod (*lSegmentPeriod_ptr);
715  FacBomManager::addToListAndMap (lCloneFlightPeriod,
716  lCloneSegmentPeriod);
717  FacBomManager::linkWithParent (lCloneFlightPeriod,
718  lCloneSegmentPeriod);
719  }
720  }
721 
722  return lCloneFlightPeriod;
723  }
724 
725  // ////////////////////////////////////////////////////////////////////
726  SegmentPeriod& CmdCloneBomManager::
727  cloneSegmentPeriod (const SegmentPeriod& iSegmentPeriod) {
728 
732  SegmentPeriod& lCloneSegmentPeriod =
733  FacCloneBom<SegmentPeriod>::instance().clone (iSegmentPeriod);
734 
735  return lCloneSegmentPeriod;
736  }
737 
738 }
739 
static void linkWithParent(PARENT &, CHILD &)
std::list< PosChannel * > PosChannelList_T
std::list< YieldFeatures * > YieldFeaturesList_T
std::list< SegmentPeriod * > SegmentPeriodList_T
Handle on the StdAir library context.
std::list< AirlineClassList * > AirlineClassListList_T
std::list< DatePeriod * > DatePeriodList_T
std::list< OnDDate * > OnDDateList_T
static void addToListAndMap(OBJECT1 &, OBJECT2 &)
std::list< BookingClass * > BookingClassList_T
std::list< SegmentDate * > SegmentDateList_T
std::list< SegmentCabin * > SegmentCabinList_T
static void setAirlineFeature(Inventory &iInventory, AirlineFeature &iAirlineFeature)
std::list< FareFamily * > FareFamilyList_T
std::list< TimePeriod * > TimePeriodList_T
static FacCloneBom & instance()
Definition: FacCloneBom.hpp:82
std::list< LegDate * > LegDateList_T
std::list< FlightDate * > FlightDateList_T
std::list< AirportPair * > AirportPairList_T
std::list< Inventory * > InventoryList_T
std::list< LegCabin * > LegCabinList_T
std::list< FareFeatures * > FareFeaturesList_T
std::list< FlightPeriod * > FlightPeriodList_T
std::list< Bucket * > BucketList_T
Definition: BucketTypes.hpp:17
BOM & clone(const BOM &)