00001
00005
00006
00007
00008
00009 #include <cassert>
00010 #include <ostream>
00011
00012 #include <stdair/basic/BasConst_BomDisplay.hpp>
00013 #include <stdair/bom/BomManager.hpp>
00014 #include <stdair/bom/BomRoot.hpp>
00015 #include <stdair/bom/EventQueue.hpp>
00016 #include <stdair/bom/Inventory.hpp>
00017 #include <stdair/bom/FlightDate.hpp>
00018 #include <stdair/bom/LegDate.hpp>
00019 #include <stdair/bom/SegmentDate.hpp>
00020 #include <stdair/bom/LegCabin.hpp>
00021 #include <stdair/bom/SegmentCabin.hpp>
00022 #include <stdair/bom/FareFamily.hpp>
00023 #include <stdair/bom/BookingClass.hpp>
00024 #include <stdair/bom/AirportPair.hpp>
00025 #include <stdair/bom/PosChannel.hpp>
00026 #include <stdair/bom/DatePeriod.hpp>
00027 #include <stdair/bom/TimePeriod.hpp>
00028 #include <stdair/bom/FareFeatures.hpp>
00029 #include <stdair/bom/YieldFeatures.hpp>
00030 #include <stdair/bom/AirlineClassList.hpp>
00031 #include <stdair/bom/Bucket.hpp>
00032 #include <stdair/bom/TravelSolutionTypes.hpp>
00033 #include <stdair/bom/TravelSolutionStruct.hpp>
00034 #include <stdair/bom/BomDisplay.hpp>
00035 #include <stdair/bom/OnDDate.hpp>
00036
00037 namespace stdair {
00038
00044 struct FlagSaver {
00045 public:
00047 FlagSaver (std::ostream& oStream)
00048 : _oStream (oStream), _streamFlags (oStream.flags()) {
00049 }
00050
00052 ~FlagSaver() {
00053
00054 _oStream.flags (_streamFlags);
00055 }
00056
00057 private:
00059 std::ostream& _oStream;
00061 std::ios::fmtflags _streamFlags;
00062 };
00063
00064
00065 std::string BomDisplay::csvDisplay (const EventQueue& iEventQueue) {
00066 std::ostringstream oStream;
00067
00071 oStream << std::endl;
00072 oStream << "==============================================================="
00073 << std::endl;
00074 oStream << "EventQueue: " << iEventQueue.describeKey() << std::endl;
00075 oStream << "==============================================================="
00076 << std::endl;
00077
00078 return oStream.str();
00079 }
00080
00081
00082 void BomDisplay::list (std::ostream& oStream, const BomRoot& iBomRoot,
00083 const AirlineCode_T& iAirlineCode,
00084 const FlightNumber_T& iFlightNumber) {
00085
00086 FlagSaver flagSaver (oStream);
00087
00088
00089 if (BomManager::hasList<Inventory> (iBomRoot) == false) {
00090 return;
00091 }
00092
00093
00094 unsigned short invIdx = 1;
00095 const InventoryList_T& lInventoryList =
00096 BomManager::getList<Inventory> (iBomRoot);
00097 for (InventoryList_T::const_iterator itInv = lInventoryList.begin();
00098 itInv != lInventoryList.end(); ++itInv, ++invIdx) {
00099 const Inventory* lInv_ptr = *itInv;
00100 assert (lInv_ptr != NULL);
00101
00102
00103 const AirlineCode_T& lAirlineCode = lInv_ptr->getAirlineCode();
00104
00105
00106 if (iAirlineCode == "all" || iAirlineCode == lAirlineCode) {
00107
00108 list (oStream, *lInv_ptr, invIdx, iFlightNumber);
00109 }
00110 }
00111 }
00112
00113
00114 void BomDisplay::list (std::ostream& oStream, const Inventory& iInventory,
00115 const unsigned short iInventoryIndex,
00116 const FlightNumber_T& iFlightNumber) {
00117
00118 FlagSaver flagSaver (oStream);
00119
00120
00121 if (BomManager::hasMap<FlightDate> (iInventory) == false) {
00122 return;
00123 }
00124
00133
00134 const AirlineCode_T& lAirlineCode = iInventory.getAirlineCode();
00135 oStream << iInventoryIndex << ". " << lAirlineCode << std::endl;
00136
00137
00138 unsigned short lCurrentFlightNumber = 0;
00139 unsigned short flightNumberIdx = 0;
00140 unsigned short departureDateIdx = 1;
00141 const FlightDateMap_T& lFlightDateList =
00142 BomManager::getMap<FlightDate> (iInventory);
00143 for (FlightDateMap_T::const_iterator itFD = lFlightDateList.begin();
00144 itFD != lFlightDateList.end(); ++itFD, ++departureDateIdx) {
00145 const FlightDate* lFD_ptr = itFD->second;
00146 assert (lFD_ptr != NULL);
00147
00148
00149 const FlightNumber_T& lFlightNumber = lFD_ptr->getFlightNumber();
00150 const Date_T& lFlightDateDate = lFD_ptr->getDepartureDate();
00151
00152
00153 if (iFlightNumber == 0 || iFlightNumber == lFlightNumber) {
00154
00155 if (lCurrentFlightNumber != lFlightNumber) {
00156 lCurrentFlightNumber = lFlightNumber;
00157 ++flightNumberIdx; departureDateIdx = 1;
00158 oStream << " " << iInventoryIndex << "." << flightNumberIdx << ". "
00159 << lAirlineCode << lFlightNumber << std::endl;
00160 }
00161
00162 oStream << " " << iInventoryIndex << "." << flightNumberIdx
00163 << "." << departureDateIdx << ". "
00164 << lAirlineCode << lFlightNumber << " / " << lFlightDateDate
00165 << std::endl;
00166 }
00167 }
00168 }
00169
00170
00171 void BomDisplay::listAirportPairDateRange (std::ostream& oStream,
00172 const BomRoot& iBomRoot) {
00173
00174 FlagSaver flagSaver (oStream);
00175
00176
00177 if (BomManager::hasList<AirportPair> (iBomRoot) == false) {
00178 return;
00179 }
00180
00181 const AirportPairList_T& lAirportPairList =
00182 BomManager::getList<AirportPair> (iBomRoot);
00183 for (AirportPairList_T::const_iterator itAir = lAirportPairList.begin();
00184 itAir != lAirportPairList.end(); ++itAir ) {
00185 const AirportPair* lAir_ptr = *itAir;
00186 assert (lAir_ptr != NULL);
00187
00188
00189 assert (BomManager::hasList<DatePeriod> (*lAir_ptr) == true);
00190
00191
00192 const DatePeriodList_T& lDatePeriodList =
00193 BomManager::getList<DatePeriod> (*lAir_ptr);
00194
00195 for (DatePeriodList_T::const_iterator itDP = lDatePeriodList.begin();
00196 itDP != lDatePeriodList.end(); ++itDP) {
00197 const DatePeriod* lDP_ptr = *itDP;
00198 assert (lDP_ptr != NULL);
00199
00200
00201 oStream << lAir_ptr->describeKey()
00202 <<" / " << lDP_ptr->describeKey() << std::endl;
00203 }
00204
00205 }
00206 }
00207
00208
00209 void BomDisplay::csvDisplay (std::ostream& oStream,
00210 const BomRoot& iBomRoot) {
00211
00212 FlagSaver flagSaver (oStream);
00213
00217 oStream << std::endl;
00218 oStream << "==============================================================="
00219 << std::endl;
00220 oStream << "BomRoot: " << iBomRoot.describeKey() << std::endl;
00221 oStream << "==============================================================="
00222 << std::endl;
00223
00224
00225 if (BomManager::hasList<Inventory> (iBomRoot) == false) {
00226 return;
00227 }
00228
00229
00230 const InventoryList_T& lInventoryList =
00231 BomManager::getList<Inventory> (iBomRoot);
00232 for (InventoryList_T::const_iterator itInv = lInventoryList.begin();
00233 itInv != lInventoryList.end(); ++itInv) {
00234 const Inventory* lInv_ptr = *itInv;
00235 assert (lInv_ptr != NULL);
00236
00237
00238 csvDisplay (oStream, *lInv_ptr);
00239 }
00240 }
00241
00242
00243 void BomDisplay::csvDisplay (std::ostream& oStream,
00244 const Inventory& iInventory) {
00245
00246 FlagSaver flagSaver (oStream);
00247
00251 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
00252 oStream << "Inventory: " << iInventory.describeKey() << std::endl;
00253 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
00254
00255
00256 if (BomManager::hasList<FlightDate> (iInventory) == false) {
00257 return;
00258 }
00259
00260
00261 const FlightDateList_T& lFlightDateList =
00262 BomManager::getList<FlightDate> (iInventory);
00263 for (FlightDateList_T::const_iterator itFD = lFlightDateList.begin();
00264 itFD != lFlightDateList.end(); ++itFD) {
00265 const FlightDate* lFD_ptr = *itFD;
00266 assert (lFD_ptr != NULL);
00267
00268
00269 csvDisplay (oStream, *lFD_ptr);
00270 }
00271
00272
00273
00274 if (BomManager::hasList<Inventory> (iInventory)){
00275
00276
00277 const InventoryList_T& lPartnerInventoryList =
00278 BomManager::getList<Inventory> (iInventory);
00279
00280 for (InventoryList_T::const_iterator itInv = lPartnerInventoryList.begin();
00281 itInv != lPartnerInventoryList.end(); ++itInv) {
00282
00283 oStream << "-------------------------------------------------" << std::endl;
00284 oStream << "Partner inventory:" << std::endl;
00285 oStream << "-------------------------------------------------" << std::endl;
00286 const Inventory* lInv_ptr = *itInv;
00287 assert (lInv_ptr != NULL);
00288
00289
00290 csvDisplay (oStream, *lInv_ptr);
00291 }
00292 oStream << "******************************************" << std::endl;
00293 oStream << std::endl;
00294 }
00295
00296
00297
00298 if (BomManager::hasList<OnDDate> (iInventory)){
00299
00300
00301 const OnDDateList_T& lOnDDateList =
00302 BomManager::getList<OnDDate> (iInventory);
00303
00304 for (OnDDateList_T::const_iterator itOnD = lOnDDateList.begin();
00305 itOnD != lOnDDateList.end(); ++itOnD) {
00306 oStream << "******************************************" << std::endl;
00307 oStream << "O&D-Date:" << std::endl;
00308 oStream << "----------" << std::endl;
00309 oStream << "Airline, Date, Origin-Destination, Segments, " << std::endl;
00310
00311 const OnDDate* lOnDDate_ptr = *itOnD;
00312 assert (lOnDDate_ptr != NULL);
00313
00314
00315 csvDisplay (oStream, *lOnDDate_ptr);
00316 }
00317 oStream << "******************************************" << std::endl;
00318 }
00319 }
00320
00321
00322 void BomDisplay::csvDisplay (std::ostream& oStream,
00323 const OnDDate& iOnDDate) {
00324
00325 FlagSaver flagSaver (oStream);
00326
00330 const AirlineCode_T& lAirlineCode = iOnDDate.getAirlineCode();
00331 const Date_T& lDate = iOnDDate.getDate();
00332 const AirportCode_T& lOrigin = iOnDDate.getOrigin();
00333 const AirportCode_T& lDestination = iOnDDate.getDestination();
00334
00335 oStream << lAirlineCode <<", " << lDate << ", "<< lOrigin << "-"
00336 << lDestination << ", " << iOnDDate.describeKey() << ", "
00337 << std::endl;
00338
00339 const StringDemandStructMap_T& lDemandInfoMap =
00340 iOnDDate.getDemandInfoMap();
00341
00342
00343 const bool isInfoMapEmpty = lDemandInfoMap.empty();
00344 if (isInfoMapEmpty) {
00345 return;
00346 }
00347 assert (lDemandInfoMap.empty() ==false);
00348
00349 oStream << "----------" << std::endl;
00350 oStream << "Cabin-Class path, Demand mean, Demand std dev, Yield, "
00351 << std::endl;
00352
00353 for (StringDemandStructMap_T::const_iterator itDI = lDemandInfoMap.begin();
00354 itDI != lDemandInfoMap.end(); ++itDI) {
00355
00356 const std::string& lCabinClassPath = itDI->first;
00357 const YieldDemandPair_T lYieldDemandPair =
00358 itDI->second;
00359 const Yield_T lYield = lYieldDemandPair.first;
00360 const MeanStdDevPair_T lMeanStdDevPair =
00361 lYieldDemandPair.second;
00362 const MeanValue_T lDemandMean = lMeanStdDevPair.first;
00363 const StdDevValue_T lDemandStdDev = lMeanStdDevPair.second;
00364
00365 oStream << lCabinClassPath << ", "
00366 << lDemandMean << ", "
00367 << lDemandStdDev << ", "
00368 << lYield << ", "
00369 << std::endl;
00370 }
00371
00372 }
00373
00374
00375 void BomDisplay::csvDisplay (std::ostream& oStream,
00376 const FlightDate& iFlightDate) {
00377
00378 FlagSaver flagSaver (oStream);
00379
00383 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00384 oStream << "******************************************" << std::endl;
00385 oStream << "FlightDate: " << lAirlineCode << iFlightDate.describeKey()
00386 << std::endl;
00387 oStream << "******************************************" << std::endl;
00388
00389
00390 csvSegmentDateDisplay (oStream, iFlightDate);
00391
00392 csvLegDateDisplay (oStream, iFlightDate);
00393
00394
00395 csvLegCabinDisplay (oStream, iFlightDate);
00396
00397
00398 csvBucketDisplay (oStream, iFlightDate);
00399
00400
00401 csvFareFamilyDisplay (oStream, iFlightDate);
00402
00403
00404 csvBookingClassDisplay (oStream, iFlightDate);
00405 }
00406
00407
00408 void BomDisplay::csvLegDateDisplay (std::ostream& oStream,
00409 const FlightDate& iFlightDate) {
00410
00411 FlagSaver flagSaver (oStream);
00412
00418 oStream << "******************************************" << std::endl;
00419 oStream << "Leg-Dates:" << std::endl
00420 << "----------" << std::endl;
00421 oStream << "Flight, Leg, BoardDate, BoardTime, "
00422 << "OffDate, OffTime, Date Offset, Time Offset, Elapsed, "
00423 << "Distance, Capacity, " << std::endl;
00424
00425
00426 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00427 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00428 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00429
00430
00431 if (BomManager::hasList<LegDate> (iFlightDate) == false) {
00432 return;
00433 }
00434
00435
00436 const LegDateList_T& lLegDateList =
00437 BomManager::getList<LegDate> (iFlightDate);
00438 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
00439 itLD != lLegDateList.end(); ++itLD) {
00440 const LegDate* lLD_ptr = *itLD;
00441 assert (lLD_ptr != NULL);
00442
00443 oStream << lAirlineCode << lFlightNumber << " "
00444 << lFlightDateDate << ", ";
00445
00446 oStream << lLD_ptr->getBoardingPoint() << "-"
00447 << lLD_ptr->getOffPoint() << ", "
00448 << lLD_ptr->getBoardingDate() << ", "
00449 << lLD_ptr->getBoardingTime() << ", "
00450 << lLD_ptr->getOffDate() << ", "
00451 << lLD_ptr->getOffTime() << ", "
00452 << lLD_ptr->getElapsedTime() << ", "
00453 << lLD_ptr->getDateOffset() << ", "
00454 << lLD_ptr->getTimeOffset() << ", "
00455 << lLD_ptr->getDistance() << ", "
00456 << lLD_ptr->getCapacity() << ", " << std::endl;
00457 }
00458 oStream << "******************************************" << std::endl;
00459 }
00460
00461
00462 void BomDisplay::csvSegmentDateDisplay (std::ostream& oStream,
00463 const FlightDate& iFlightDate) {
00464
00465 FlagSaver flagSaver (oStream);
00466
00470 oStream << "******************************************" << std::endl;
00471 oStream << "SegmentDates:" << std::endl
00472 << "----------" << std::endl;
00473 oStream << "Flight, Segment, Date"
00474 << std::endl;
00475
00476
00477 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00478 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00479 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00480
00481
00482 if (BomManager::hasList<SegmentDate> (iFlightDate) == false) {
00483 return;
00484 }
00485
00486
00487 const SegmentDateList_T& lSegmentDateList =
00488 BomManager::getList<SegmentDate> (iFlightDate);
00489 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00490 itSD != lSegmentDateList.end(); ++itSD) {
00491 const SegmentDate* lSD_ptr = *itSD;
00492 assert (lSD_ptr != NULL);
00493
00494
00495 const Date_T& lSegmentDateDate = lSD_ptr->getBoardingDate();
00496 const AirportCode_T& lBoardPoint = lSD_ptr->getBoardingPoint();
00497 const AirportCode_T& lOffPoint = lSD_ptr->getOffPoint();
00498 oStream << lAirlineCode << lFlightNumber << " " << lFlightDateDate << ", "
00499 << lBoardPoint << "-" << lOffPoint << ", " << lSegmentDateDate << std::endl;
00500
00501
00502 const bool isAnotherAirlineOperating = lSD_ptr->isOtherAirlineOperating();
00503 const bool hasListSegmentDate = BomManager::hasList<SegmentDate> (*lSD_ptr);
00504
00505 if (hasListSegmentDate == true) {
00506
00507 if (isAnotherAirlineOperating == true) {
00508 const SegmentDateList_T& lOperatingSDList = BomManager::getList<SegmentDate> (*lSD_ptr);
00509 assert (lOperatingSDList.size() == 1);
00510 SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00511 const SegmentDate* lOperatingSD_ptr = *itSD;
00512 const FlightDate* lOperatingFD_ptr = BomManager::getParentPtr<FlightDate>(*lOperatingSD_ptr);
00513 const Inventory* lOperatingInv_ptr = BomManager::getParentPtr<Inventory>(*lOperatingFD_ptr);
00514 oStream << " *** Operated by " << lOperatingInv_ptr->toString()
00515 << lOperatingFD_ptr->toString() << std::endl;
00516
00517 } else {
00518
00519
00520 const SegmentDateList_T& lMarketingSDList = BomManager::getList<SegmentDate> (*lSD_ptr);
00521 assert (lMarketingSDList.empty() == false);
00522
00523 oStream << " *** Marketed by ";
00524 for (SegmentDateList_T::const_iterator itMarketingSD = lMarketingSDList.begin();
00525 itMarketingSD != lMarketingSDList.end(); ++itMarketingSD) {
00526 SegmentDate* lMarketingSD_ptr = *itMarketingSD;
00527 FlightDate* lMarketingFD_ptr = BomManager::getParentPtr<FlightDate>(*lMarketingSD_ptr);
00528 Inventory* lMarketingInv_ptr = BomManager::getParentPtr<Inventory>(*lMarketingFD_ptr);
00529 oStream << lMarketingInv_ptr->toString() << lMarketingFD_ptr->toString() <<" * ";
00530 }
00531
00532 oStream << std::endl;
00533 }
00534 }
00535 }
00536 }
00537
00538
00539 void BomDisplay::csvLegCabinDisplay (std::ostream& oStream,
00540 const FlightDate& iFlightDate) {
00541
00542 FlagSaver flagSaver (oStream);
00543
00547 oStream << "******************************************" << std::endl;
00548 oStream << "LegCabins:" << std::endl
00549 << "----------" << std::endl;
00550 oStream << "Flight, Leg, Cabin, "
00551 << "OffedCAP, PhyCAP, RgdADJ, AU, UPR, SS, Staff, WL, Group, "
00552 << "CommSpace, AvPool, Avl, NAV, GAV, ACP, ETB, BidPrice, "
00553 << std::endl;
00554
00555
00556 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00557 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00558 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00559
00560
00561 if (BomManager::hasList<LegDate> (iFlightDate) == false) {
00562 return;
00563 }
00564
00565
00566 const LegDateList_T& lLegDateList =
00567 BomManager::getList<LegDate> (iFlightDate);
00568 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
00569 itLD != lLegDateList.end(); ++itLD) {
00570 const LegDate* lLD_ptr = *itLD;
00571 assert (lLD_ptr != NULL);
00572
00573
00574 const Date_T& lLegDateDate = lLD_ptr->getBoardingDate();
00575 const AirportCode_T& lBoardPoint = lLD_ptr->getBoardingPoint();
00576 const AirportCode_T& lOffPoint = lLD_ptr->getOffPoint();
00577
00578
00579 const LegCabinList_T& lLegCabinList =
00580 BomManager::getList<LegCabin> (*lLD_ptr);
00581 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
00582 itLC != lLegCabinList.end(); ++itLC) {
00583 const LegCabin* lLC_ptr = *itLC;
00584 assert (lLC_ptr != NULL);
00585
00586 oStream << lAirlineCode << lFlightNumber << " "
00587 << lFlightDateDate << ", ";
00588
00589 oStream << lBoardPoint << "-" << lOffPoint
00590 << " " << lLegDateDate << ", ";
00591
00592 oStream << lLC_ptr->getCabinCode() << ", ";
00593
00594 oStream << lLC_ptr->getOfferedCapacity() << ", "
00595 << lLC_ptr->getPhysicalCapacity() << ", "
00596 << lLC_ptr->getRegradeAdjustment() << ", "
00597 << lLC_ptr->getAuthorizationLevel() << ", "
00598 << lLC_ptr->getUPR() << ", "
00599 << lLC_ptr->getSoldSeat() << ", "
00600 << lLC_ptr->getStaffNbOfSeats() << ", "
00601 << lLC_ptr->getWLNbOfSeats() << ", "
00602 << lLC_ptr->getGroupNbOfSeats() << ", "
00603 << lLC_ptr->getCommittedSpace() << ", "
00604 << lLC_ptr->getAvailabilityPool() << ", "
00605 << lLC_ptr->getAvailability() << ", "
00606 << lLC_ptr->getNetAvailability() << ", "
00607 << lLC_ptr->getGrossAvailability() << ", "
00608 << lLC_ptr->getAvgCancellationPercentage() << ", "
00609 << lLC_ptr->getETB() << ", "
00610 << lLC_ptr->getCurrentBidPrice() << ", "
00611 << std::endl;
00612 }
00613 }
00614 oStream << "******************************************" << std::endl;
00615 }
00616
00617
00618 void BomDisplay::csvSegmentCabinDisplay (std::ostream& oStream,
00619 const FlightDate& iFlightDate) {
00620
00621 FlagSaver flagSaver (oStream);
00622
00626 }
00627
00628
00629 void BomDisplay::csvFareFamilyDisplay (std::ostream& oStream,
00630 const FlightDate& iFlightDate) {
00631
00632 FlagSaver flagSaver (oStream);
00633
00638 oStream << "******************************************" << std::endl;
00639 oStream << "SegmentCabins:" << std::endl
00640 << "--------------" << std::endl;
00641 oStream << "Flight, Segment, Cabin, FF, Bkgs, MIN, UPR, "
00642 << "CommSpace, AvPool, BP, " << std::endl;
00643
00644
00645 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00646 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00647 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00648
00649
00650 if (BomManager::hasList<SegmentDate> (iFlightDate) == false) {
00651 return;
00652 }
00653
00654
00655 const SegmentDateList_T& lSegmentDateList =
00656 BomManager::getList<SegmentDate> (iFlightDate);
00657 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00658 itSD != lSegmentDateList.end(); ++itSD) {
00659 const SegmentDate* lSD_ptr = *itSD;
00660 assert (lSD_ptr != NULL);
00661
00662
00663 const Date_T& lSegmentDateDate = lSD_ptr->getBoardingDate();
00664 const AirportCode_T& lBoardPoint = lSD_ptr->getBoardingPoint();
00665 const AirportCode_T& lOffPoint = lSD_ptr->getOffPoint();
00666
00667
00668 const SegmentCabinList_T& lSegmentCabinList =
00669 BomManager::getList<SegmentCabin> (*lSD_ptr);
00670 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
00671 itSC != lSegmentCabinList.end(); ++itSC) {
00672 const SegmentCabin* lSC_ptr = *itSC;
00673 assert (lSC_ptr != NULL);
00674
00675
00676 const CabinCode_T& lCabinCode = lSC_ptr->getCabinCode();
00677
00678
00679 if (BomManager::hasList<FareFamily> (*lSC_ptr) == false) {
00680 continue;
00681 }
00682
00683
00684 const FareFamilyList_T& lFareFamilyList =
00685 BomManager::getList<FareFamily> (*lSC_ptr);
00686 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
00687 itFF != lFareFamilyList.end(); ++itFF) {
00688 const FareFamily* lFF_ptr = *itFF;
00689 assert (lFF_ptr != NULL);
00690
00691 oStream << lAirlineCode << lFlightNumber << " "
00692 << lFlightDateDate << ", ";
00693
00694 oStream << lBoardPoint << "-" << lOffPoint << " "
00695 << lSegmentDateDate << ", ";
00696
00697 oStream << lCabinCode << ", " << lFF_ptr->getFamilyCode() << ", ";
00698
00699 oStream << lSC_ptr->getBookingCounter() << ", "
00700 << lSC_ptr->getMIN() << ", "
00701 << lSC_ptr->getUPR() << ", "
00702 << lSC_ptr->getCommittedSpace() << ", "
00703 << lSC_ptr->getAvailabilityPool() << ", "
00704 << lSC_ptr->getCurrentBidPrice() << ", "
00705 << std::endl;
00706 }
00707 }
00708 }
00709 oStream << "******************************************" << std::endl;
00710 }
00711
00712
00713 void BomDisplay::csvBucketDisplay (std::ostream& oStream,
00714 const FlightDate& iFlightDate) {
00715
00716 FlagSaver flagSaver (oStream);
00717
00721 oStream << "******************************************" << std::endl;
00722 oStream << "Buckets:" << std::endl
00723 << "--------" << std::endl;
00724 oStream << "Flight, Leg, Cabin, Yield, AU/SI, SS, AV, "
00725 << std::endl;
00726
00727
00728 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00729 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00730 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00731
00732
00733 if (BomManager::hasList<LegDate> (iFlightDate) == false) {
00734 return;
00735 }
00736
00737
00738 const LegDateList_T& lLegDateList =
00739 BomManager::getList<LegDate> (iFlightDate);
00740 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
00741 itLD != lLegDateList.end(); ++itLD) {
00742 const LegDate* lLD_ptr = *itLD;
00743 assert (lLD_ptr != NULL);
00744
00745
00746 const Date_T& lLegDateDate = lLD_ptr->getBoardingDate();
00747 const AirportCode_T& lBoardPoint = lLD_ptr->getBoardingPoint();
00748 const AirportCode_T& lOffPoint = lLD_ptr->getOffPoint();
00749
00750
00751 const LegCabinList_T& lLegCabinList =
00752 BomManager::getList<LegCabin> (*lLD_ptr);
00753 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
00754 itLC != lLegCabinList.end(); ++itLC) {
00755 const LegCabin* lLC_ptr = *itLC;
00756 assert (lLC_ptr != NULL);
00757
00758
00759 if (BomManager::hasList<Bucket> (*lLC_ptr) == false) {
00760 continue;
00761 }
00762
00763
00764 const CabinCode_T& lCabinCode = lLC_ptr->getCabinCode();
00765
00766
00767 const BucketList_T& lBucketList = BomManager::getList<Bucket> (*lLC_ptr);
00768 for (BucketList_T::const_iterator itBuck = lBucketList.begin();
00769 itBuck != lBucketList.end(); ++itBuck) {
00770 const Bucket* lBucket_ptr = *itBuck;
00771 assert (lBucket_ptr != NULL);
00772
00773 oStream << lAirlineCode << lFlightNumber << " "
00774 << lFlightDateDate << ", ";
00775
00776 oStream << lBoardPoint << "-" << lOffPoint << " "
00777 << lLegDateDate << ", " << lCabinCode << ", ";
00778
00779 oStream << lBucket_ptr->getYieldRangeUpperValue() << ", "
00780 << lBucket_ptr->getSeatIndex() << ", "
00781 << lBucket_ptr->getSoldSeats() << ", "
00782 << lBucket_ptr->getAvailability() << ", ";
00783 oStream << std::endl;
00784 }
00785 }
00786 }
00787 oStream << "******************************************" << std::endl;
00788 }
00789
00790
00791 void BomDisplay::csvBookingClassDisplay (std::ostream& oStream,
00792 const BookingClass& iBookingClass,
00793 const std::string& iLeadingString) {
00794
00795 FlagSaver flagSaver (oStream);
00796
00803 oStream << iLeadingString << iBookingClass.getClassCode();
00804
00805 if (iBookingClass.getSubclassCode() == 0) {
00806 oStream << ", ";
00807 } else {
00808 oStream << iBookingClass.getSubclassCode() << ", ";
00809 }
00810 oStream << iBookingClass.getAuthorizationLevel() << " ("
00811 << iBookingClass.getProtection() << "), "
00812 << iBookingClass.getNegotiatedSpace() << ", "
00813 << iBookingClass.getNoShowPercentage() << ", "
00814 << iBookingClass.getCancellationPercentage() << ", "
00815 << iBookingClass.getNbOfBookings() << ", "
00816 << iBookingClass.getNbOfGroupBookings() << " ("
00817 << iBookingClass.getNbOfPendingGroupBookings() << "), "
00818 << iBookingClass.getNbOfStaffBookings() << ", "
00819 << iBookingClass.getNbOfWLBookings() << ", "
00820 << iBookingClass.getETB() << ", "
00821 << iBookingClass.getNetClassAvailability() << ", "
00822 << iBookingClass.getNetRevenueAvailability() << ", "
00823 << iBookingClass.getSegmentAvailability() << ", "
00824 << std::endl;
00825 }
00826
00827
00828 void BomDisplay::csvBookingClassDisplay (std::ostream& oStream,
00829 const FlightDate& iFlightDate) {
00830
00831 FlagSaver flagSaver (oStream);
00832
00833
00834 oStream << "******************************************" << std::endl;
00835 oStream << "Subclasses:" << std::endl
00836 << "-----------" << std::endl;
00837 oStream << "Flight, Segment, Cabin, FF, Subclass, MIN/AU (Prot), "
00838 << "Nego, NS%, OB%, "
00839 << "Bkgs, GrpBks (pdg), StfBkgs, WLBkgs, ETB, "
00840 << "ClassAvl, RevAvl, SegAvl, "
00841 << std::endl;
00842
00843
00844 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00845 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00846 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00847
00848
00849 if (BomManager::hasList<SegmentDate> (iFlightDate) == false) {
00850 return;
00851 }
00852
00853
00854 const SegmentDateList_T& lSegmentDateList =
00855 BomManager::getList<SegmentDate> (iFlightDate);
00856 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00857 itSD != lSegmentDateList.end(); ++itSD) {
00858 const SegmentDate* lSD_ptr = *itSD;
00859 assert (lSD_ptr != NULL);
00860
00861
00862 const Date_T& lSegmentDateDate = lSD_ptr->getBoardingDate();
00863 const AirportCode_T& lBoardPoint = lSD_ptr->getBoardingPoint();
00864 const AirportCode_T& lOffPoint = lSD_ptr->getOffPoint();
00865
00866
00867 const SegmentCabinList_T& lSegmentCabinList =
00868 BomManager::getList<SegmentCabin> (*lSD_ptr);
00869 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
00870 itSC != lSegmentCabinList.end(); ++itSC) {
00871 const SegmentCabin* lSC_ptr = *itSC;
00872 assert (lSC_ptr != NULL);
00873
00874
00875 const CabinCode_T& lCabinCode = lSC_ptr->getCabinCode();
00876
00877
00878 std::ostringstream oSCLeadingStr;
00879 oSCLeadingStr << lAirlineCode << lFlightNumber << " "
00880 << lFlightDateDate << ", "
00881 << lBoardPoint << "-" << lOffPoint << " "
00882 << lSegmentDateDate << ", "
00883 << lCabinCode << ", ";
00884
00885
00886 FamilyCode_T lFamilyCode ("NoFF");
00887
00888
00889 if (BomManager::hasList<FareFamily> (*lSC_ptr) == true) {
00890
00891
00892 const FareFamilyList_T& lFareFamilyList =
00893 BomManager::getList<FareFamily> (*lSC_ptr);
00894 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
00895 itFF != lFareFamilyList.end(); ++itFF) {
00896 const FareFamily* lFF_ptr = *itFF;
00897 assert (lFF_ptr != NULL);
00898
00899
00900 lFamilyCode = lFF_ptr->getFamilyCode();
00901
00902
00903 std::ostringstream oFFLeadingStr;
00904 oFFLeadingStr << oSCLeadingStr.str() << lFamilyCode << ", ";
00905
00906
00907 const BookingClassList_T& lBookingClassList =
00908 BomManager::getList<BookingClass> (*lFF_ptr);
00909 for (BookingClassList_T::const_iterator itBC =
00910 lBookingClassList.begin();
00911 itBC != lBookingClassList.end(); ++itBC) {
00912 const BookingClass* lBC_ptr = *itBC;
00913 assert (lBC_ptr != NULL);
00914
00915
00916 csvBookingClassDisplay (oStream, *lBC_ptr, oFFLeadingStr.str());
00917 }
00918 }
00919
00920
00921 continue;
00922 }
00923 assert (BomManager::hasList<FareFamily> (*lSC_ptr) == false);
00924
00925
00926
00927 std::ostringstream oFFLeadingStr;
00928 oFFLeadingStr << oSCLeadingStr.str() << lFamilyCode << ", ";
00929
00930
00931 const BookingClassList_T& lBookingClassList =
00932 BomManager::getList<BookingClass> (*lSC_ptr);
00933 for (BookingClassList_T::const_iterator itBC =
00934 lBookingClassList.begin();
00935 itBC != lBookingClassList.end(); ++itBC) {
00936 const BookingClass* lBC_ptr = *itBC;
00937 assert (lBC_ptr != NULL);
00938
00939
00940 csvBookingClassDisplay (oStream, *lBC_ptr, oFFLeadingStr.str());
00941 }
00942 }
00943 }
00944 oStream << "******************************************" << std::endl;
00945 }
00946
00947
00948 void BomDisplay::
00949 csvDisplay (std::ostream& oStream,
00950 const TravelSolutionList_T& iTravelSolutionList) {
00951
00952
00953 FlagSaver flagSaver (oStream);
00954
00955 oStream << "Travel solutions:";
00956 unsigned short idx = 0;
00957 for (TravelSolutionList_T::const_iterator itTS =
00958 iTravelSolutionList.begin();
00959 itTS != iTravelSolutionList.end(); ++itTS, ++idx) {
00960 const TravelSolutionStruct& lTS = *itTS;
00961
00962 oStream << std::endl;
00963 oStream << " [" << idx << "] " << lTS.display();
00964 }
00965 }
00966
00967
00968 void BomDisplay::
00969 csvDisplay (std::ostream& oStream,
00970 const DatePeriodList_T& iDatePeriodList) {
00971
00972
00973 FlagSaver flagSaver (oStream);
00974
00975
00976 for (DatePeriodList_T::const_iterator itDP = iDatePeriodList.begin();
00977 itDP != iDatePeriodList.end(); ++itDP) {
00978 const DatePeriod* lDP_ptr = *itDP;
00979 assert (lDP_ptr != NULL);
00980
00981
00982 csvDateDisplay (oStream, *lDP_ptr);
00983 }
00984 }
00985
00986
00987 void BomDisplay::csvSimFQTAirRACDisplay (std::ostream& oStream,
00988 const BomRoot& iBomRoot) {
00989
00990 FlagSaver flagSaver (oStream);
00991
00995 oStream << std::endl;
00996 oStream << "==============================================================="
00997 << std::endl;
00998 oStream << "BomRoot: " << iBomRoot.describeKey() << std::endl;
00999 oStream << "==============================================================="
01000 << std::endl;
01001
01002
01003 if (BomManager::hasList<AirportPair> (iBomRoot) == false) {
01004 return;
01005 }
01006
01007
01008 const AirportPairList_T& lAirportPairList =
01009 BomManager::getList<AirportPair> (iBomRoot);
01010 for (AirportPairList_T::const_iterator itAir = lAirportPairList.begin();
01011 itAir != lAirportPairList.end(); ++itAir ) {
01012 const AirportPair* lAir_ptr = *itAir;
01013 assert (lAir_ptr != NULL);
01014
01015
01016 csvAirportPairDisplay (oStream, *lAir_ptr);
01017 }
01018 }
01019
01020
01021 void BomDisplay::csvAirportPairDisplay (std::ostream& oStream,
01022 const AirportPair& iAirportPair) {
01023
01024 FlagSaver flagSaver (oStream);
01025
01029 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
01030 oStream << "AirportPair: " << iAirportPair.describeKey() << std::endl;
01031 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
01032
01033
01034 if (BomManager::hasList<DatePeriod> (iAirportPair) == false) {
01035 return;
01036 }
01037
01038
01039 const DatePeriodList_T& lDatePeriodList =
01040 BomManager::getList<DatePeriod> (iAirportPair);
01041 for (DatePeriodList_T::const_iterator itDP = lDatePeriodList.begin();
01042 itDP != lDatePeriodList.end(); ++itDP) {
01043 const DatePeriod* lDP_ptr = *itDP;
01044 assert (lDP_ptr != NULL);
01045
01046
01047 csvDateDisplay (oStream, *lDP_ptr);
01048 }
01049 }
01050
01051
01052 void BomDisplay::csvDateDisplay (std::ostream& oStream,
01053 const DatePeriod& iDatePeriod) {
01054
01055
01056 FlagSaver flagSaver (oStream);
01057
01061 oStream << "------------------------------------------" << std::endl;
01062 oStream << "DatePeriod: " << iDatePeriod.describeKey() << std::endl;
01063 oStream << "------------------------------------------" << std::endl;
01064
01065
01066 if (BomManager::hasList<PosChannel> (iDatePeriod) == false) {
01067 return;
01068 }
01069
01070
01071 const PosChannelList_T& lPosChannelList =
01072 BomManager::getList<PosChannel> (iDatePeriod);
01073 for (PosChannelList_T::const_iterator itPC = lPosChannelList.begin();
01074 itPC != lPosChannelList.end(); ++itPC) {
01075 const PosChannel* lPC_ptr = *itPC;
01076 assert (lPC_ptr != NULL);
01077
01078
01079 csvPosChannelDisplay (oStream, *lPC_ptr);
01080 }
01081 }
01082
01083
01084 void BomDisplay::csvPosChannelDisplay (std::ostream& oStream,
01085 const PosChannel& iPosChannel) {
01086
01087 FlagSaver flagSaver (oStream);
01088
01092 oStream << "******************************************" << std::endl;
01093 oStream << "PosChannel: " << iPosChannel.describeKey() << std::endl;
01094 oStream << "******************************************" << std::endl;
01095
01096
01097 if (BomManager::hasList<TimePeriod> (iPosChannel) == false) {
01098 return;
01099 }
01100
01101
01102 const TimePeriodList_T& lTimePeriodList =
01103 BomManager::getList<TimePeriod> (iPosChannel);
01104 for (TimePeriodList_T::const_iterator itTP = lTimePeriodList.begin();
01105 itTP != lTimePeriodList.end(); ++itTP) {
01106 const TimePeriod* lTP_ptr = *itTP;
01107 assert (lTP_ptr != NULL);
01108
01109
01110 csvTimeDisplay (oStream, *lTP_ptr);
01111 }
01112 }
01113
01114
01115 void BomDisplay::csvTimeDisplay (std::ostream& oStream,
01116 const TimePeriod& iTimePeriod) {
01117
01118
01119 FlagSaver flagSaver (oStream);
01120
01124 oStream << "----------------------------------------" << std::endl;
01125 oStream << "TimePeriod: " << iTimePeriod.describeKey() << std::endl;
01126 oStream << "----------------------------------------" << std::endl;
01127
01128
01129
01130
01131 csvFeatureListDisplay<FareFeatures> (oStream, iTimePeriod);
01132 csvFeatureListDisplay<YieldFeatures> (oStream, iTimePeriod);
01133 }
01134
01135
01136 template <typename FEATURE_TYPE>
01137 void BomDisplay::csvFeatureListDisplay (std::ostream& oStream,
01138 const TimePeriod& iTimePeriod) {
01139
01140
01141 if (BomManager::hasList<FEATURE_TYPE> (iTimePeriod) == false) {
01142 return;
01143 }
01144
01145
01146 typedef typename BomHolder<FEATURE_TYPE>::BomList_T FeaturesList_T;
01147 const FeaturesList_T& lFeaturesList =
01148 BomManager::getList<FEATURE_TYPE> (iTimePeriod);
01149 for (typename FeaturesList_T::const_iterator itFF = lFeaturesList.begin();
01150 itFF != lFeaturesList.end(); ++itFF) {
01151 const FEATURE_TYPE* lFF_ptr = *itFF;
01152 assert (lFF_ptr != NULL);
01153
01154
01155 csvFeaturesDisplay (oStream, *lFF_ptr);
01156 }
01157 }
01158
01159
01160 template <typename FEATURE_TYPE>
01161 void BomDisplay::csvFeaturesDisplay (std::ostream& oStream,
01162 const FEATURE_TYPE& iFeatures) {
01163
01164 FlagSaver flagSaver (oStream);
01165
01169 oStream << "--------------------------------------" << std::endl;
01170 oStream << "Fare/yield-Features: " << iFeatures.describeKey() << std::endl;
01171 oStream << "--------------------------------------" << std::endl;
01172
01173
01174 if (BomManager::hasList<AirlineClassList> (iFeatures) == false) {
01175 return;
01176 }
01177
01178
01179 const AirlineClassListList_T& lAirlineClassListList =
01180 BomManager::getList<AirlineClassList> (iFeatures);
01181 for (AirlineClassListList_T::const_iterator itACL =
01182 lAirlineClassListList.begin();
01183 itACL != lAirlineClassListList.end(); ++itACL) {
01184 const AirlineClassList* lACL_ptr = *itACL;
01185 assert (lACL_ptr != NULL);
01186
01187
01188 csvAirlineClassDisplay(oStream, *lACL_ptr);
01189 }
01190 }
01191
01192
01193 void BomDisplay::
01194 csvAirlineClassDisplay (std::ostream& oStream,
01195 const AirlineClassList& iAirlineClassList) {
01196
01197 FlagSaver flagSaver (oStream);
01198
01202 oStream << "------------------------------------" << std::endl;
01203 oStream << "AirlineClassList: "
01204 << iAirlineClassList.describeKey() << std::endl;
01205 oStream << "------------------------------------" << std::endl;
01206 }
01207
01208 }
01209