$treeview $search $mathjax
00001 00005 // ////////////////////////////////////////////////////////////////////// 00006 // Import section 00007 // ////////////////////////////////////////////////////////////////////// 00008 // STL 00009 #include <cassert> 00010 #include <sstream> 00011 // StdAir 00012 #include <stdair/factory/FacBomManager.hpp> 00013 #include <stdair/factory/FacCloneBom.hpp> 00014 #include <stdair/command/CmdCloneBomManager.hpp> 00015 #include <stdair/service/Logger.hpp> 00016 #include <stdair/bom/BomRetriever.hpp> 00017 00018 namespace stdair { 00019 00020 // //////////////////////////////////////////////////////////////////// 00021 void CmdCloneBomManager::cloneBomRoot (const BomRoot& iBomRoot, 00022 BomRoot& ioCloneBomRoot) { 00023 00029 // Check whether there are Inventory objects 00030 const bool hasInventoryList = BomManager::hasList<Inventory> (iBomRoot); 00031 if (hasInventoryList == true) { 00032 00033 // Browse the inventories 00034 const InventoryList_T& lInventoryList = 00035 BomManager::getList<Inventory> (iBomRoot); 00036 for (InventoryList_T::const_iterator itInv = lInventoryList.begin(); 00037 itInv != lInventoryList.end(); ++itInv) { 00038 const Inventory* lInv_ptr = *itInv; 00039 assert (lInv_ptr != NULL); 00040 00041 // Clone the current inventory 00042 Inventory& lCloneInventory = cloneInventory (*lInv_ptr, ioCloneBomRoot); 00043 FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneInventory); 00044 FacBomManager::linkWithParent (ioCloneBomRoot, lCloneInventory); 00045 } 00046 } 00047 00048 // Check whether there are Airport Pair objects 00049 const bool hastAirportPairList = 00050 BomManager::hasList<AirportPair> (iBomRoot); 00051 if (hastAirportPairList == true) { 00052 00053 // Browse the airport pairs 00054 const AirportPairList_T& lAirportPairList = 00055 BomManager::getList<AirportPair> (iBomRoot); 00056 for (AirportPairList_T::const_iterator itAirportPair = 00057 lAirportPairList.begin(); 00058 itAirportPair != lAirportPairList.end(); ++itAirportPair) { 00059 const AirportPair* lAirportPair_ptr = *itAirportPair; 00060 assert (lAirportPair_ptr != NULL); 00061 00062 // Clone the current airport pair 00063 AirportPair& lCloneAirportPair = cloneAirportPair (*lAirportPair_ptr); 00064 FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneAirportPair); 00065 FacBomManager::linkWithParent (ioCloneBomRoot, lCloneAirportPair); 00066 } 00067 } 00068 } 00069 00070 // //////////////////////////////////////////////////////////////////// 00071 Inventory& CmdCloneBomManager::cloneInventory (const Inventory& iInventory, 00072 BomRoot& ioCloneBomRoot) { 00073 00077 Inventory& lCloneInventory = 00078 FacCloneBom<Inventory>::instance().clone (iInventory); 00079 00080 // Check whether there are FlightDate objects 00081 const bool hasFlighDateList = BomManager::hasList<FlightDate> (iInventory); 00082 if (hasFlighDateList == true) { 00083 // Browse the flight-dates 00084 const FlightDateList_T& lFlightDateList = 00085 BomManager::getList<FlightDate> (iInventory); 00086 for (FlightDateList_T::const_iterator itFD = lFlightDateList.begin(); 00087 itFD != lFlightDateList.end(); ++itFD) { 00088 const FlightDate* lFD_ptr = *itFD; 00089 assert (lFD_ptr != NULL); 00090 00091 // Clone the current flight-date 00092 FlightDate& lCloneFD = cloneFlightDate (*lFD_ptr); 00093 FacBomManager::addToListAndMap (lCloneInventory, lCloneFD); 00094 FacBomManager::linkWithParent (lCloneInventory, lCloneFD); 00095 } 00096 } 00097 00098 // Check if the inventory contains a list of partners 00099 const bool hasPartnerList = BomManager::hasList<Inventory> (iInventory); 00100 if (hasPartnerList == true) { 00101 00102 // Browse the partner's inventories 00103 const InventoryList_T& lPartnerInventoryList = 00104 BomManager::getList<Inventory> (iInventory); 00105 00106 for (InventoryList_T::const_iterator itInv = 00107 lPartnerInventoryList.begin(); 00108 itInv != lPartnerInventoryList.end(); ++itInv) { 00109 const Inventory* lInv_ptr = *itInv; 00110 assert (lInv_ptr != NULL); 00111 00112 // Clone the current partnership inventory 00113 Inventory& lClonePartnerInventory = cloneInventory (*lInv_ptr, 00114 ioCloneBomRoot); 00115 FacBomManager::addToListAndMap (lCloneInventory, 00116 lClonePartnerInventory); 00117 FacBomManager::linkWithParent (lCloneInventory, 00118 lClonePartnerInventory); 00119 } 00120 } 00121 00122 // Check whether there are O&D date objects 00123 const bool hasOnDList = BomManager::hasList<OnDDate> (iInventory); 00124 if (hasOnDList == true){ 00125 00126 //Browse the O&Ds 00127 const OnDDateList_T& lOnDDateList = 00128 BomManager::getList<OnDDate> (iInventory); 00129 00130 for (OnDDateList_T::const_iterator itOnD = lOnDDateList.begin(); 00131 itOnD != lOnDDateList.end(); ++itOnD) { 00132 const OnDDate* lOnDDate_ptr = *itOnD; 00133 assert (lOnDDate_ptr != NULL); 00134 00135 // Clone the current O&D date 00136 OnDDate& lCloneOnDDate = cloneOnDDate (*lOnDDate_ptr); 00137 FacBomManager::addToListAndMap (lCloneInventory, lCloneOnDDate); 00138 FacBomManager::linkWithParent (lCloneInventory, lCloneOnDDate); 00139 } 00140 } 00141 00142 // Check whether there are Flight Period objects 00143 const bool hasFlightPeriodList = 00144 BomManager::hasList<FlightPeriod> (iInventory); 00145 if (hasFlightPeriodList == true) { 00146 00147 // Browse the flight-periods 00148 const FlightPeriodList_T& lFlightPeriodList = 00149 BomManager::getList<FlightPeriod> (iInventory); 00150 for (FlightPeriodList_T::const_iterator itFlightPeriod = 00151 lFlightPeriodList.begin(); 00152 itFlightPeriod != lFlightPeriodList.end(); ++itFlightPeriod) { 00153 const FlightPeriod* lFlightPeriod_ptr = *itFlightPeriod; 00154 assert (lFlightPeriod_ptr != NULL); 00155 00156 // Clone the current flight period 00157 FlightPeriod& lCloneFlightPeriod = cloneFlightPeriod (*lFlightPeriod_ptr); 00158 FacBomManager::addToListAndMap (lCloneInventory, lCloneFlightPeriod); 00159 FacBomManager::linkWithParent (lCloneInventory, lCloneFlightPeriod); 00160 } 00161 } 00162 00163 // Check whether there is an airline feature object 00164 const AirlineFeature* lAirlineFeature_ptr = 00165 BomManager::getObjectPtr<AirlineFeature,Inventory> (iInventory, 00166 iInventory.getAirlineCode()); 00167 if (lAirlineFeature_ptr != NULL) { 00168 // Clone the current airline feature object 00169 AirlineFeature& lCloneAirlineFeature = 00170 cloneAirlineFeature (*lAirlineFeature_ptr); 00171 FacBomManager::setAirlineFeature (lCloneInventory, lCloneAirlineFeature); 00172 FacBomManager::linkWithParent (lCloneInventory, lCloneAirlineFeature); 00173 // Link the airline feature object with the top of the BOM tree 00174 FacBomManager::addToListAndMap (ioCloneBomRoot, lCloneAirlineFeature); 00175 } 00176 00177 return lCloneInventory; 00178 } 00179 00180 // //////////////////////////////////////////////////////////////////// 00181 AirlineFeature& CmdCloneBomManager:: 00182 cloneAirlineFeature (const AirlineFeature& iAirlineFeature) { 00183 00187 AirlineFeature& lCloneAirlineFeature = 00188 FacCloneBom<AirlineFeature>::instance().clone (iAirlineFeature); 00189 00190 return lCloneAirlineFeature; 00191 } 00192 00193 00194 // //////////////////////////////////////////////////////////////////// 00195 OnDDate& CmdCloneBomManager::cloneOnDDate (const OnDDate& iOnDDate) { 00196 00200 OnDDate& lCloneOnDDate = 00201 FacCloneBom<OnDDate>::instance().clone (iOnDDate); 00202 00203 return lCloneOnDDate; 00204 } 00205 00206 // //////////////////////////////////////////////////////////////////// 00207 FlightDate& CmdCloneBomManager:: 00208 cloneFlightDate (const FlightDate& iFlightDate) { 00209 00213 FlightDate& lCloneFlightDate = 00214 FacCloneBom<FlightDate>::instance().clone (iFlightDate); 00215 00216 // Check whether there are LegDate objects 00217 const bool hasLegDateList = BomManager::hasList<LegDate> (iFlightDate); 00218 if (hasLegDateList == true) { 00219 00220 // Browse the leg-dates 00221 const LegDateList_T& lLegDateList = 00222 BomManager::getList<LegDate> (iFlightDate); 00223 for (LegDateList_T::const_iterator itLD = lLegDateList.begin(); 00224 itLD != lLegDateList.end(); ++itLD) { 00225 const LegDate* lLD_ptr = *itLD; 00226 assert (lLD_ptr != NULL); 00227 00228 // Clone the current leg-date 00229 LegDate& lCloneLegDate = cloneLegDate (*lLD_ptr); 00230 FacBomManager::addToListAndMap (lCloneFlightDate, lCloneLegDate); 00231 FacBomManager::linkWithParent (lCloneFlightDate, lCloneLegDate); 00232 } 00233 } 00234 00235 // Check whether there are SegmentDate objects 00236 const bool hasSegmentDateList = 00237 BomManager::hasList<SegmentDate> (iFlightDate); 00238 if (hasSegmentDateList == true) { 00239 00240 // Browse the segment-dates 00241 const SegmentDateList_T& lSegmentDateList = 00242 BomManager::getList<SegmentDate> (iFlightDate); 00243 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin(); 00244 itSD != lSegmentDateList.end(); ++itSD) { 00245 const SegmentDate* lSD_ptr = *itSD; 00246 assert (lSD_ptr != NULL); 00247 00248 // Clone the current segment-date 00249 SegmentDate& lCloneSegmentDate = cloneSegmentDate (*lSD_ptr); 00250 FacBomManager::addToListAndMap (lCloneFlightDate, lCloneSegmentDate); 00251 FacBomManager::linkWithParent (lCloneFlightDate, lCloneSegmentDate); 00252 00253 } 00254 } 00255 00256 return lCloneFlightDate; 00257 } 00258 00259 // //////////////////////////////////////////////////////////////////// 00260 LegDate& CmdCloneBomManager::cloneLegDate (const LegDate& iLegDate) { 00261 00265 LegDate& lCloneLegDate = 00266 FacCloneBom<LegDate>::instance().clone (iLegDate); 00267 00268 // Check whether there are LegCabin objects 00269 const bool hasLegCabinList = BomManager::hasList<LegCabin> (iLegDate); 00270 if (hasLegCabinList == true) { 00271 // Browse the leg-cabins 00272 const LegCabinList_T& lLegCabinList = 00273 BomManager::getList<LegCabin> (iLegDate); 00274 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin(); 00275 itLC != lLegCabinList.end(); ++itLC) { 00276 const LegCabin* lLC_ptr = *itLC; 00277 assert (lLC_ptr != NULL); 00278 00279 // Clone the current leg-cabin 00280 LegCabin& lCloneLegCabin = cloneLegCabin (*lLC_ptr); 00281 FacBomManager::addToListAndMap (lCloneLegDate, lCloneLegCabin); 00282 FacBomManager::linkWithParent (lCloneLegDate, lCloneLegCabin); 00283 } 00284 } 00285 00286 return lCloneLegDate; 00287 } 00288 00289 // //////////////////////////////////////////////////////////////////// 00290 LegCabin& CmdCloneBomManager::cloneLegCabin (const LegCabin& iLegCabin) { 00291 00295 LegCabin& lCloneLegCabin = 00296 FacCloneBom<LegCabin>::instance().clone (iLegCabin); 00297 00298 // Check whether there are Bucket objects 00299 const bool hasBucketList = BomManager::hasList<Bucket> (iLegCabin); 00300 if (hasBucketList == true) { 00301 // Browse the buckets 00302 const BucketList_T& lBucketList = 00303 BomManager::getList<Bucket> (iLegCabin); 00304 for (BucketList_T::const_iterator itBucket = lBucketList.begin(); 00305 itBucket != lBucketList.end(); ++itBucket) { 00306 const Bucket* lBucket_ptr = *itBucket; 00307 assert (lBucket_ptr != NULL); 00308 00309 // Clone the current bucket 00310 Bucket& lCloneBucket = cloneBucket (*lBucket_ptr); 00311 FacBomManager::addToListAndMap (lCloneLegCabin, lCloneBucket); 00312 FacBomManager::linkWithParent (lCloneLegCabin, lCloneBucket); 00313 } 00314 } 00315 00316 return lCloneLegCabin; 00317 } 00318 00319 // //////////////////////////////////////////////////////////////////// 00320 Bucket& CmdCloneBomManager::cloneBucket (const Bucket& iBucket) { 00321 00325 Bucket& lCloneBucket = 00326 FacCloneBom<Bucket>::instance().clone (iBucket); 00327 00328 return lCloneBucket; 00329 } 00330 00331 // //////////////////////////////////////////////////////////////////// 00332 SegmentDate& CmdCloneBomManager:: 00333 cloneSegmentDate (const SegmentDate& iSegmentDate) { 00334 00338 SegmentDate& lCloneSegmentDate = 00339 FacCloneBom<SegmentDate>::instance().clone (iSegmentDate); 00340 00341 // Check whether there are SegmentCabin objects 00342 const bool hasSegmentCabinList = 00343 BomManager::hasList<SegmentCabin> (iSegmentDate); 00344 if (hasSegmentCabinList == true) { 00345 // Browse the segment-cabins 00346 const SegmentCabinList_T& lSegmentCabinList = 00347 BomManager::getList<SegmentCabin> (iSegmentDate); 00348 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin(); 00349 itSC != lSegmentCabinList.end(); ++itSC) { 00350 const SegmentCabin* lSC_ptr = *itSC; 00351 assert (lSC_ptr != NULL); 00352 00353 // Clone the current segment-cabin 00354 SegmentCabin& lCloneSegmentCabin = cloneSegmentCabin (*lSC_ptr); 00355 FacBomManager::addToListAndMap (lCloneSegmentDate, lCloneSegmentCabin); 00356 FacBomManager::linkWithParent (lCloneSegmentDate, lCloneSegmentCabin); 00357 00358 linkBookingClassesWithSegment (lCloneSegmentDate, 00359 lCloneSegmentCabin); 00360 00361 } 00362 } 00363 return lCloneSegmentDate; 00364 } 00365 00366 // //////////////////////////////////////////////////////////////////// 00367 void CmdCloneBomManager:: 00368 linkBookingClassesWithSegment (SegmentDate& iCloneSegmentDate, 00369 SegmentCabin& iCloneSegmentCabin) { 00370 00371 // Browse the fare families to link the booking-classes to the 00372 // segment-cabin and to the segment-date 00373 const bool hasFareFamilyList = 00374 BomManager::hasList<FareFamily> (iCloneSegmentCabin); 00375 if (hasFareFamilyList == true) { 00376 const FareFamilyList_T& lCloneFFList = 00377 BomManager::getList<FareFamily> (iCloneSegmentCabin); 00378 for (FareFamilyList_T::const_iterator itCloneFF = lCloneFFList.begin(); 00379 itCloneFF != lCloneFFList.end(); ++itCloneFF) { 00380 const FareFamily* lCloneFF_ptr = *itCloneFF; 00381 assert (lCloneFF_ptr != NULL); 00382 00383 // Browse the list of booking classes 00384 const bool hasBookingClasslist = 00385 BomManager::hasList<BookingClass> (*lCloneFF_ptr); 00386 if (hasBookingClasslist == true) { 00387 const BookingClassList_T& lCloneBCList = 00388 BomManager::getList<BookingClass> (*lCloneFF_ptr); 00389 for (BookingClassList_T::const_iterator itCloneBC = 00390 lCloneBCList.begin(); 00391 itCloneBC != lCloneBCList.end(); ++itCloneBC) { 00392 const BookingClass* lCloneBC_ptr = *itCloneBC; 00393 assert (lCloneBC_ptr != NULL); 00394 00395 // Link the booking-class to the segment-cabin 00396 stdair::FacBomManager::addToListAndMap (iCloneSegmentCabin, 00397 *lCloneBC_ptr); 00398 00399 // Link the booking-class to the segment-date 00400 stdair::FacBomManager::addToListAndMap (iCloneSegmentDate, 00401 *lCloneBC_ptr); 00402 } 00403 } 00404 } 00405 } 00406 } 00407 00408 // //////////////////////////////////////////////////////////////////// 00409 SegmentCabin& CmdCloneBomManager:: 00410 cloneSegmentCabin (const SegmentCabin& iSegmentCabin) { 00411 00415 SegmentCabin& lCloneSegmentCabin = 00416 FacCloneBom<SegmentCabin>::instance().clone (iSegmentCabin); 00417 00418 // Check whether there are fare family objects 00419 const bool hasFareFamilyList = 00420 BomManager::hasList<FareFamily> (iSegmentCabin); 00421 if (hasFareFamilyList == true) { 00422 // Browse the fare families 00423 const FareFamilyList_T& lFareFamilyList = 00424 BomManager::getList<FareFamily> (iSegmentCabin); 00425 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin(); 00426 itFF != lFareFamilyList.end(); ++itFF) { 00427 const FareFamily* lFF_ptr = *itFF; 00428 assert (lFF_ptr != NULL); 00429 00430 // Clone the current fare-family 00431 FareFamily& lCloneFareFamily = cloneFareFamily (*lFF_ptr); 00432 FacBomManager::addToListAndMap (lCloneSegmentCabin, lCloneFareFamily); 00433 FacBomManager::linkWithParent (lCloneSegmentCabin, lCloneFareFamily); 00434 } 00435 } 00436 00437 return lCloneSegmentCabin; 00438 } 00439 00440 // //////////////////////////////////////////////////////////////////// 00441 FareFamily& CmdCloneBomManager:: 00442 cloneFareFamily (const FareFamily& iFareFamily) { 00446 FareFamily& lCloneFareFamily = 00447 FacCloneBom<FareFamily>::instance().clone (iFareFamily); 00448 00449 // Check whether there are booking classes objects 00450 const bool hasBookingClassList = 00451 BomManager::hasList<BookingClass> (iFareFamily); 00452 if (hasBookingClassList == true) { 00453 // Browse the list of booking classes 00454 const BookingClassList_T& lBookingClassList = 00455 BomManager::getList<BookingClass> (iFareFamily); 00456 for (BookingClassList_T::const_iterator itBookingClass = 00457 lBookingClassList.begin(); 00458 itBookingClass != lBookingClassList.end(); ++itBookingClass) { 00459 const BookingClass* lBC_ptr = *itBookingClass; 00460 assert (lBC_ptr != NULL); 00461 00462 // Clone the current booking class 00463 BookingClass& lCloneBookingClass = cloneBookingClass (*lBC_ptr); 00464 FacBomManager::addToListAndMap (lCloneFareFamily, lCloneBookingClass); 00465 FacBomManager::linkWithParent (lCloneFareFamily, lCloneBookingClass); 00466 } 00467 } 00468 00469 return lCloneFareFamily; 00470 } 00471 00472 // //////////////////////////////////////////////////////////////////// 00473 BookingClass& CmdCloneBomManager:: 00474 cloneBookingClass (const BookingClass& iBookingClass) { 00475 00479 BookingClass& lCloneBookingClass = 00480 FacCloneBom<BookingClass>::instance().clone (iBookingClass); 00481 00482 return lCloneBookingClass; 00483 } 00484 00485 // //////////////////////////////////////////////////////////////////// 00486 AirportPair& CmdCloneBomManager:: 00487 cloneAirportPair (const AirportPair& iAirportPair) { 00488 00492 AirportPair& lCloneAirportPair = 00493 FacCloneBom<AirportPair>::instance().clone (iAirportPair); 00494 00495 // Check whether there are date-period objects 00496 const bool hasDatePeriodList = 00497 BomManager::hasList<DatePeriod> (iAirportPair); 00498 if (hasDatePeriodList == true) { 00499 // Browse the date-periods 00500 const DatePeriodList_T& lDatePeriodList = 00501 BomManager::getList<DatePeriod> (iAirportPair); 00502 for (DatePeriodList_T::const_iterator itDatePeriod = 00503 lDatePeriodList.begin(); 00504 itDatePeriod != lDatePeriodList.end(); ++itDatePeriod) { 00505 const DatePeriod* lDatePeriod_ptr = *itDatePeriod; 00506 assert (lDatePeriod_ptr != NULL); 00507 00508 // Clone the current date-period 00509 DatePeriod& lCloneDatePeriod = cloneDatePeriod (*lDatePeriod_ptr); 00510 FacBomManager::addToListAndMap (lCloneAirportPair, lCloneDatePeriod); 00511 FacBomManager::linkWithParent (lCloneAirportPair, lCloneDatePeriod); 00512 } 00513 } 00514 00515 return lCloneAirportPair; 00516 } 00517 00518 // //////////////////////////////////////////////////////////////////// 00519 DatePeriod& CmdCloneBomManager:: 00520 cloneDatePeriod (const DatePeriod& iDatePeriod) { 00521 00525 DatePeriod& lCloneDatePeriod = 00526 FacCloneBom<DatePeriod>::instance().clone (iDatePeriod); 00527 00528 // Check whether there are pos-channel objects 00529 const bool hasPosChannelList = 00530 BomManager::hasList<PosChannel> (iDatePeriod); 00531 if (hasPosChannelList == true) { 00532 // Browse the pos-channels 00533 const PosChannelList_T& lPosChannelList = 00534 BomManager::getList<PosChannel> (iDatePeriod); 00535 for (PosChannelList_T::const_iterator itPosChannel = 00536 lPosChannelList.begin(); 00537 itPosChannel != lPosChannelList.end(); ++itPosChannel) { 00538 const PosChannel* lPosChannel_ptr = *itPosChannel; 00539 assert (lPosChannel_ptr != NULL); 00540 00541 // Clone the current pos-channel 00542 PosChannel& lClonePosChannel = clonePosChannel (*lPosChannel_ptr); 00543 FacBomManager::addToListAndMap (lCloneDatePeriod, lClonePosChannel); 00544 FacBomManager::linkWithParent (lCloneDatePeriod, lClonePosChannel); 00545 } 00546 } 00547 00548 return lCloneDatePeriod; 00549 } 00550 00551 00552 // //////////////////////////////////////////////////////////////////// 00553 PosChannel& CmdCloneBomManager:: 00554 clonePosChannel (const PosChannel& iPosChannel) { 00555 00559 PosChannel& lClonePosChannel = 00560 FacCloneBom<PosChannel>::instance().clone (iPosChannel); 00561 00562 // Check whether there are time-period objects 00563 const bool hasTimePeriodList = 00564 BomManager::hasList<TimePeriod> (iPosChannel); 00565 if (hasTimePeriodList == true) { 00566 // Browse the time-periods 00567 const TimePeriodList_T& lTimePeriodList = 00568 BomManager::getList<TimePeriod> (iPosChannel); 00569 for (TimePeriodList_T::const_iterator itTimePeriod = 00570 lTimePeriodList.begin(); 00571 itTimePeriod != lTimePeriodList.end(); ++itTimePeriod) { 00572 const TimePeriod* lTimePeriod_ptr = *itTimePeriod; 00573 assert (lTimePeriod_ptr != NULL); 00574 00575 // Clone the current time-period 00576 TimePeriod& lCloneTimePeriod = cloneTimePeriod (*lTimePeriod_ptr); 00577 FacBomManager::addToListAndMap (lClonePosChannel, lCloneTimePeriod); 00578 FacBomManager::linkWithParent (lClonePosChannel, lCloneTimePeriod); 00579 } 00580 } 00581 00582 return lClonePosChannel; 00583 } 00584 00585 // //////////////////////////////////////////////////////////////////// 00586 TimePeriod& CmdCloneBomManager:: 00587 cloneTimePeriod (const TimePeriod& iTimePeriod) { 00588 00592 TimePeriod& lCloneTimePeriod = 00593 FacCloneBom<TimePeriod>::instance().clone (iTimePeriod); 00594 00595 // Check whether there are fare-feature objects 00596 const bool hasFareFeaturesList = 00597 BomManager::hasList<FareFeatures> (iTimePeriod); 00598 if (hasFareFeaturesList == true) { 00599 // Browse the fare-features 00600 const FareFeaturesList_T& lFareFeaturesList = 00601 BomManager::getList<FareFeatures> (iTimePeriod); 00602 for (FareFeaturesList_T::const_iterator itFF = lFareFeaturesList.begin(); 00603 itFF != lFareFeaturesList.end(); ++itFF) { 00604 const FareFeatures* lFF_ptr = *itFF; 00605 assert (lFF_ptr != NULL); 00606 00607 // Clone the current fare-feature 00608 FareFeatures& lCloneFareFeatures = 00609 cloneFeatures<FareFeatures> (*lFF_ptr); 00610 FacBomManager::addToListAndMap (lCloneTimePeriod, lCloneFareFeatures); 00611 FacBomManager::linkWithParent (lCloneTimePeriod, lCloneFareFeatures); 00612 } 00613 } 00614 00615 // Check whether there are yield-feature objects 00616 const bool hasYieldFeaturesList = 00617 BomManager::hasList<YieldFeatures> (iTimePeriod); 00618 if (hasYieldFeaturesList == true) { 00619 // Browse the yield-features 00620 const YieldFeaturesList_T& lYieldFeaturesList = 00621 BomManager::getList<YieldFeatures> (iTimePeriod); 00622 for (YieldFeaturesList_T::const_iterator itYF = 00623 lYieldFeaturesList.begin(); 00624 itYF != lYieldFeaturesList.end(); ++itYF) { 00625 const YieldFeatures* lYF_ptr = *itYF; 00626 assert (lYF_ptr != NULL); 00627 00628 // Clone the current yield-feature 00629 YieldFeatures& lCloneYieldFeatures = 00630 cloneFeatures<YieldFeatures> (*lYF_ptr); 00631 FacBomManager::addToListAndMap (lCloneTimePeriod, lCloneYieldFeatures); 00632 FacBomManager::linkWithParent (lCloneTimePeriod, lCloneYieldFeatures); 00633 } 00634 } 00635 00636 return lCloneTimePeriod; 00637 } 00638 00639 // //////////////////////////////////////////////////////////////////// 00640 template <typename FEATURE_TYPE> 00641 FEATURE_TYPE& CmdCloneBomManager:: 00642 cloneFeatures (const FEATURE_TYPE& iFeatures) { 00643 00647 FEATURE_TYPE& lCloneFeatures = 00648 FacCloneBom<FEATURE_TYPE>::instance().clone (iFeatures); 00649 00650 // Check whether there are airline-class list objects 00651 const bool hasAirlineClassListList = 00652 BomManager::hasList<AirlineClassList> (iFeatures); 00653 if (hasAirlineClassListList == true) { 00654 // Browse the airline-class lists 00655 const AirlineClassListList_T& lAirlineClassList = 00656 BomManager::getList<AirlineClassList> (iFeatures); 00657 for (AirlineClassListList_T::const_iterator itACList = 00658 lAirlineClassList.begin(); 00659 itACList != lAirlineClassList.end(); ++itACList) { 00660 const AirlineClassList* lACList_ptr = *itACList; 00661 assert (lACList_ptr != NULL); 00662 00663 // Clone the current airline-class list 00664 AirlineClassList& lCloneAirlineClassList = 00665 cloneAirlineClassList (*lACList_ptr); 00666 FacBomManager::addToListAndMap (lCloneFeatures, 00667 lCloneAirlineClassList); 00668 FacBomManager::linkWithParent (lCloneFeatures, 00669 lCloneAirlineClassList); 00670 } 00671 } 00672 00673 return lCloneFeatures; 00674 } 00675 00676 // //////////////////////////////////////////////////////////////////// 00677 AirlineClassList& CmdCloneBomManager:: 00678 cloneAirlineClassList (const AirlineClassList& iAirlineClassList) { 00679 00683 AirlineClassList& lCloneAirlineClassList = 00684 FacCloneBom<AirlineClassList>::instance().clone (iAirlineClassList); 00685 00686 return lCloneAirlineClassList; 00687 } 00688 00689 // //////////////////////////////////////////////////////////////////// 00690 FlightPeriod& CmdCloneBomManager:: 00691 cloneFlightPeriod (const FlightPeriod& iFlightPeriod) { 00692 00696 FlightPeriod& lCloneFlightPeriod = 00697 FacCloneBom<FlightPeriod>::instance().clone (iFlightPeriod); 00698 00699 // Check whether there are airline-class list objects 00700 const bool hasSegmentPeriodList = 00701 BomManager::hasList<SegmentPeriod> (iFlightPeriod); 00702 if (hasSegmentPeriodList == true) { 00703 // Browse the airline-class lists 00704 const SegmentPeriodList_T& lSegmentPeriodList = 00705 BomManager::getList<SegmentPeriod> (iFlightPeriod); 00706 for (SegmentPeriodList_T::const_iterator itSegmentPeriod = 00707 lSegmentPeriodList.begin(); 00708 itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) { 00709 const SegmentPeriod* lSegmentPeriod_ptr = *itSegmentPeriod; 00710 assert (lSegmentPeriod_ptr != NULL); 00711 00712 // Clone the current airline-class list 00713 SegmentPeriod& lCloneSegmentPeriod = 00714 cloneSegmentPeriod (*lSegmentPeriod_ptr); 00715 FacBomManager::addToListAndMap (lCloneFlightPeriod, 00716 lCloneSegmentPeriod); 00717 FacBomManager::linkWithParent (lCloneFlightPeriod, 00718 lCloneSegmentPeriod); 00719 } 00720 } 00721 00722 return lCloneFlightPeriod; 00723 } 00724 00725 // //////////////////////////////////////////////////////////////////// 00726 SegmentPeriod& CmdCloneBomManager:: 00727 cloneSegmentPeriod (const SegmentPeriod& iSegmentPeriod) { 00728 00732 SegmentPeriod& lCloneSegmentPeriod = 00733 FacCloneBom<SegmentPeriod>::instance().clone (iSegmentPeriod); 00734 00735 return lCloneSegmentPeriod; 00736 } 00737 00738 } 00739