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().days() << ", "
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 isMarketingSDListEmpty = BomManager::hasList<SegmentDate>(*lSD_ptr);
00503 if (isMarketingSDListEmpty == false) {
00504
00505 const SegmentDateList_T& lMarketingSDList = BomManager::getList<SegmentDate>(*lSD_ptr);
00506
00507 oStream << " *** Marketed by ";
00508 for (SegmentDateList_T::const_iterator itMarketingSD = lMarketingSDList.begin();
00509 itMarketingSD != lMarketingSDList.end(); ++itMarketingSD) {
00510 SegmentDate* lMarketingSD_ptr = *itMarketingSD;
00511 FlightDate* lMarketingFD_ptr = BomManager::getParentPtr<FlightDate>(*lMarketingSD_ptr);
00512 Inventory* lMarketingInv_ptr = BomManager::getParentPtr<Inventory>(*lMarketingFD_ptr);
00513 oStream << lMarketingInv_ptr->toString() << lMarketingFD_ptr->toString() <<" * ";
00514 }
00515 }
00516
00517
00518 const SegmentDate* lOperatingSD_ptr = lSD_ptr->getOperatingSegmentDate ();
00519 if (lOperatingSD_ptr != NULL) {
00520
00521 const FlightDate* lOperatingFD_ptr = BomManager::getParentPtr<FlightDate>(*lOperatingSD_ptr);
00522 const Inventory* lOperatingInv_ptr = BomManager::getParentPtr<Inventory>(*lOperatingFD_ptr);
00523 oStream << " *** Operated by " << lOperatingInv_ptr->toString()
00524 << lOperatingFD_ptr->toString() << std::endl;
00525 }
00526
00527 oStream << std::endl;
00528 }
00529 }
00530
00531
00532 void BomDisplay::csvLegCabinDisplay (std::ostream& oStream,
00533 const FlightDate& iFlightDate) {
00534
00535 FlagSaver flagSaver (oStream);
00536
00540 oStream << "******************************************" << std::endl;
00541 oStream << "LegCabins:" << std::endl
00542 << "----------" << std::endl;
00543 oStream << "Flight, Leg, Cabin, "
00544 << "OffedCAP, PhyCAP, RgdADJ, AU, UPR, SS, Staff, WL, Group, "
00545 << "CommSpace, AvPool, Avl, NAV, GAV, ACP, ETB, BidPrice, "
00546 << std::endl;
00547
00548
00549 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00550 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00551 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00552
00553
00554 if (BomManager::hasList<LegDate> (iFlightDate) == false) {
00555 return;
00556 }
00557
00558
00559 const LegDateList_T& lLegDateList =
00560 BomManager::getList<LegDate> (iFlightDate);
00561 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
00562 itLD != lLegDateList.end(); ++itLD) {
00563 const LegDate* lLD_ptr = *itLD;
00564 assert (lLD_ptr != NULL);
00565
00566
00567 const Date_T& lLegDateDate = lLD_ptr->getBoardingDate();
00568 const AirportCode_T& lBoardPoint = lLD_ptr->getBoardingPoint();
00569 const AirportCode_T& lOffPoint = lLD_ptr->getOffPoint();
00570
00571
00572 const LegCabinList_T& lLegCabinList =
00573 BomManager::getList<LegCabin> (*lLD_ptr);
00574 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
00575 itLC != lLegCabinList.end(); ++itLC) {
00576 const LegCabin* lLC_ptr = *itLC;
00577 assert (lLC_ptr != NULL);
00578
00579 oStream << lAirlineCode << lFlightNumber << " "
00580 << lFlightDateDate << ", ";
00581
00582 oStream << lBoardPoint << "-" << lOffPoint
00583 << " " << lLegDateDate << ", ";
00584
00585 oStream << lLC_ptr->getCabinCode() << ", ";
00586
00587 oStream << lLC_ptr->getOfferedCapacity() << ", "
00588 << lLC_ptr->getPhysicalCapacity() << ", "
00589 << lLC_ptr->getRegradeAdjustment() << ", "
00590 << lLC_ptr->getAuthorizationLevel() << ", "
00591 << lLC_ptr->getUPR() << ", "
00592 << lLC_ptr->getSoldSeat() << ", "
00593 << lLC_ptr->getStaffNbOfSeats() << ", "
00594 << lLC_ptr->getWLNbOfSeats() << ", "
00595 << lLC_ptr->getGroupNbOfSeats() << ", "
00596 << lLC_ptr->getCommittedSpace() << ", "
00597 << lLC_ptr->getAvailabilityPool() << ", "
00598 << lLC_ptr->getAvailability() << ", "
00599 << lLC_ptr->getNetAvailability() << ", "
00600 << lLC_ptr->getGrossAvailability() << ", "
00601 << lLC_ptr->getAvgCancellationPercentage() << ", "
00602 << lLC_ptr->getETB() << ", "
00603 << lLC_ptr->getCurrentBidPrice() << ", "
00604 << std::endl;
00605 }
00606 }
00607 oStream << "******************************************" << std::endl;
00608 }
00609
00610
00611 void BomDisplay::csvSegmentCabinDisplay (std::ostream& oStream,
00612 const FlightDate& iFlightDate) {
00613
00614 FlagSaver flagSaver (oStream);
00615
00619 }
00620
00621
00622 void BomDisplay::csvFareFamilyDisplay (std::ostream& oStream,
00623 const FlightDate& iFlightDate) {
00624
00625 FlagSaver flagSaver (oStream);
00626
00631 oStream << "******************************************" << std::endl;
00632 oStream << "SegmentCabins:" << std::endl
00633 << "--------------" << std::endl;
00634 oStream << "Flight, Segment, Cabin, FF, Bkgs, MIN, UPR, "
00635 << "CommSpace, AvPool, BP, " << std::endl;
00636
00637
00638 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00639 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00640 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00641
00642
00643 if (BomManager::hasList<SegmentDate> (iFlightDate) == false) {
00644 return;
00645 }
00646
00647
00648 const SegmentDateList_T& lSegmentDateList =
00649 BomManager::getList<SegmentDate> (iFlightDate);
00650 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00651 itSD != lSegmentDateList.end(); ++itSD) {
00652 const SegmentDate* lSD_ptr = *itSD;
00653 assert (lSD_ptr != NULL);
00654
00655
00656 const Date_T& lSegmentDateDate = lSD_ptr->getBoardingDate();
00657 const AirportCode_T& lBoardPoint = lSD_ptr->getBoardingPoint();
00658 const AirportCode_T& lOffPoint = lSD_ptr->getOffPoint();
00659
00660
00661 const SegmentCabinList_T& lSegmentCabinList =
00662 BomManager::getList<SegmentCabin> (*lSD_ptr);
00663 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
00664 itSC != lSegmentCabinList.end(); ++itSC) {
00665 const SegmentCabin* lSC_ptr = *itSC;
00666 assert (lSC_ptr != NULL);
00667
00668
00669 const CabinCode_T& lCabinCode = lSC_ptr->getCabinCode();
00670
00671
00672 if (BomManager::hasList<FareFamily> (*lSC_ptr) == false) {
00673 continue;
00674 }
00675
00676
00677 const FareFamilyList_T& lFareFamilyList =
00678 BomManager::getList<FareFamily> (*lSC_ptr);
00679 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
00680 itFF != lFareFamilyList.end(); ++itFF) {
00681 const FareFamily* lFF_ptr = *itFF;
00682 assert (lFF_ptr != NULL);
00683
00684 oStream << lAirlineCode << lFlightNumber << " "
00685 << lFlightDateDate << ", ";
00686
00687 oStream << lBoardPoint << "-" << lOffPoint << " "
00688 << lSegmentDateDate << ", ";
00689
00690 oStream << lCabinCode << ", " << lFF_ptr->getFamilyCode() << ", ";
00691
00692 oStream << lSC_ptr->getBookingCounter() << ", "
00693 << lSC_ptr->getMIN() << ", "
00694 << lSC_ptr->getUPR() << ", "
00695 << lSC_ptr->getCommittedSpace() << ", "
00696 << lSC_ptr->getAvailabilityPool() << ", "
00697 << lSC_ptr->getCurrentBidPrice() << ", "
00698 << std::endl;
00699 }
00700 }
00701 }
00702 oStream << "******************************************" << std::endl;
00703 }
00704
00705
00706 void BomDisplay::csvBucketDisplay (std::ostream& oStream,
00707 const FlightDate& iFlightDate) {
00708
00709 FlagSaver flagSaver (oStream);
00710
00714 oStream << "******************************************" << std::endl;
00715 oStream << "Buckets:" << std::endl
00716 << "--------" << std::endl;
00717 oStream << "Flight, Leg, Cabin, Yield, AU/SI, SS, AV, "
00718 << std::endl;
00719
00720
00721 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00722 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00723 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00724
00725
00726 if (BomManager::hasList<LegDate> (iFlightDate) == false) {
00727 return;
00728 }
00729
00730
00731 const LegDateList_T& lLegDateList =
00732 BomManager::getList<LegDate> (iFlightDate);
00733 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
00734 itLD != lLegDateList.end(); ++itLD) {
00735 const LegDate* lLD_ptr = *itLD;
00736 assert (lLD_ptr != NULL);
00737
00738
00739 const Date_T& lLegDateDate = lLD_ptr->getBoardingDate();
00740 const AirportCode_T& lBoardPoint = lLD_ptr->getBoardingPoint();
00741 const AirportCode_T& lOffPoint = lLD_ptr->getOffPoint();
00742
00743
00744 const LegCabinList_T& lLegCabinList =
00745 BomManager::getList<LegCabin> (*lLD_ptr);
00746 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
00747 itLC != lLegCabinList.end(); ++itLC) {
00748 const LegCabin* lLC_ptr = *itLC;
00749 assert (lLC_ptr != NULL);
00750
00751
00752 if (BomManager::hasList<Bucket> (*lLC_ptr) == false) {
00753 continue;
00754 }
00755
00756
00757 const CabinCode_T& lCabinCode = lLC_ptr->getCabinCode();
00758
00759
00760 const BucketList_T& lBucketList = BomManager::getList<Bucket> (*lLC_ptr);
00761 for (BucketList_T::const_iterator itBuck = lBucketList.begin();
00762 itBuck != lBucketList.end(); ++itBuck) {
00763 const Bucket* lBucket_ptr = *itBuck;
00764 assert (lBucket_ptr != NULL);
00765
00766 oStream << lAirlineCode << lFlightNumber << " "
00767 << lFlightDateDate << ", ";
00768
00769 oStream << lBoardPoint << "-" << lOffPoint << " "
00770 << lLegDateDate << ", " << lCabinCode << ", ";
00771
00772 oStream << lBucket_ptr->getYieldRangeUpperValue() << ", "
00773 << lBucket_ptr->getSeatIndex() << ", "
00774 << lBucket_ptr->getSoldSeats() << ", "
00775 << lBucket_ptr->getAvailability() << ", ";
00776 oStream << std::endl;
00777 }
00778 }
00779 }
00780 oStream << "******************************************" << std::endl;
00781 }
00782
00783
00784 void BomDisplay::csvBookingClassDisplay (std::ostream& oStream,
00785 const BookingClass& iBookingClass,
00786 const std::string& iLeadingString) {
00787
00788 FlagSaver flagSaver (oStream);
00789
00796 oStream << iLeadingString << iBookingClass.getClassCode();
00797
00798 if (iBookingClass.getSubclassCode() == 0) {
00799 oStream << ", ";
00800 } else {
00801 oStream << iBookingClass.getSubclassCode() << ", ";
00802 }
00803 oStream << iBookingClass.getAuthorizationLevel() << " ("
00804 << iBookingClass.getProtection() << "), "
00805 << iBookingClass.getNegotiatedSpace() << ", "
00806 << iBookingClass.getNoShowPercentage() << ", "
00807 << iBookingClass.getCancellationPercentage() << ", "
00808 << iBookingClass.getNbOfBookings() << ", "
00809 << iBookingClass.getNbOfGroupBookings() << " ("
00810 << iBookingClass.getNbOfPendingGroupBookings() << "), "
00811 << iBookingClass.getNbOfStaffBookings() << ", "
00812 << iBookingClass.getNbOfWLBookings() << ", "
00813 << iBookingClass.getETB() << ", "
00814 << iBookingClass.getNetClassAvailability() << ", "
00815 << iBookingClass.getNetRevenueAvailability() << ", "
00816 << iBookingClass.getSegmentAvailability() << ", "
00817 << std::endl;
00818 }
00819
00820
00821 void BomDisplay::csvBookingClassDisplay (std::ostream& oStream,
00822 const FlightDate& iFlightDate) {
00823
00824 FlagSaver flagSaver (oStream);
00825
00826
00827 oStream << "******************************************" << std::endl;
00828 oStream << "Subclasses:" << std::endl
00829 << "-----------" << std::endl;
00830 oStream << "Flight, Segment, Cabin, FF, Subclass, MIN/AU (Prot), "
00831 << "Nego, NS%, OB%, "
00832 << "Bkgs, GrpBks (pdg), StfBkgs, WLBkgs, ETB, "
00833 << "ClassAvl, RevAvl, SegAvl, "
00834 << std::endl;
00835
00836
00837 const AirlineCode_T& lAirlineCode = iFlightDate.getAirlineCode();
00838 const FlightNumber_T& lFlightNumber = iFlightDate.getFlightNumber();
00839 const Date_T& lFlightDateDate = iFlightDate.getDepartureDate();
00840
00841
00842 if (BomManager::hasList<SegmentDate> (iFlightDate) == false) {
00843 return;
00844 }
00845
00846
00847 const SegmentDateList_T& lSegmentDateList =
00848 BomManager::getList<SegmentDate> (iFlightDate);
00849 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
00850 itSD != lSegmentDateList.end(); ++itSD) {
00851 const SegmentDate* lSD_ptr = *itSD;
00852 assert (lSD_ptr != NULL);
00853
00854
00855 const Date_T& lSegmentDateDate = lSD_ptr->getBoardingDate();
00856 const AirportCode_T& lBoardPoint = lSD_ptr->getBoardingPoint();
00857 const AirportCode_T& lOffPoint = lSD_ptr->getOffPoint();
00858
00859
00860 const SegmentCabinList_T& lSegmentCabinList =
00861 BomManager::getList<SegmentCabin> (*lSD_ptr);
00862 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
00863 itSC != lSegmentCabinList.end(); ++itSC) {
00864 const SegmentCabin* lSC_ptr = *itSC;
00865 assert (lSC_ptr != NULL);
00866
00867
00868 const CabinCode_T& lCabinCode = lSC_ptr->getCabinCode();
00869
00870
00871 std::ostringstream oSCLeadingStr;
00872 oSCLeadingStr << lAirlineCode << lFlightNumber << " "
00873 << lFlightDateDate << ", "
00874 << lBoardPoint << "-" << lOffPoint << " "
00875 << lSegmentDateDate << ", "
00876 << lCabinCode << ", ";
00877
00878
00879 FamilyCode_T lFamilyCode ("NoFF");
00880
00881
00882 if (BomManager::hasList<FareFamily> (*lSC_ptr) == true) {
00883
00884
00885 const FareFamilyList_T& lFareFamilyList =
00886 BomManager::getList<FareFamily> (*lSC_ptr);
00887 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
00888 itFF != lFareFamilyList.end(); ++itFF) {
00889 const FareFamily* lFF_ptr = *itFF;
00890 assert (lFF_ptr != NULL);
00891
00892
00893 lFamilyCode = lFF_ptr->getFamilyCode();
00894
00895
00896 std::ostringstream oFFLeadingStr;
00897 oFFLeadingStr << oSCLeadingStr.str() << lFamilyCode << ", ";
00898
00899
00900 const BookingClassList_T& lBookingClassList =
00901 BomManager::getList<BookingClass> (*lFF_ptr);
00902 for (BookingClassList_T::const_iterator itBC =
00903 lBookingClassList.begin();
00904 itBC != lBookingClassList.end(); ++itBC) {
00905 const BookingClass* lBC_ptr = *itBC;
00906 assert (lBC_ptr != NULL);
00907
00908
00909 csvBookingClassDisplay (oStream, *lBC_ptr, oFFLeadingStr.str());
00910 }
00911 }
00912
00913
00914 continue;
00915 }
00916 assert (BomManager::hasList<FareFamily> (*lSC_ptr) == false);
00917
00918
00919
00920 std::ostringstream oFFLeadingStr;
00921 oFFLeadingStr << oSCLeadingStr.str() << lFamilyCode << ", ";
00922
00923
00924 const BookingClassList_T& lBookingClassList =
00925 BomManager::getList<BookingClass> (*lSC_ptr);
00926 for (BookingClassList_T::const_iterator itBC =
00927 lBookingClassList.begin();
00928 itBC != lBookingClassList.end(); ++itBC) {
00929 const BookingClass* lBC_ptr = *itBC;
00930 assert (lBC_ptr != NULL);
00931
00932
00933 csvBookingClassDisplay (oStream, *lBC_ptr, oFFLeadingStr.str());
00934 }
00935 }
00936 }
00937 oStream << "******************************************" << std::endl;
00938 }
00939
00940
00941 void BomDisplay::
00942 csvDisplay (std::ostream& oStream,
00943 const TravelSolutionList_T& iTravelSolutionList) {
00944
00945
00946 FlagSaver flagSaver (oStream);
00947
00948 oStream << "Travel solutions:";
00949 unsigned short idx = 0;
00950 for (TravelSolutionList_T::const_iterator itTS =
00951 iTravelSolutionList.begin();
00952 itTS != iTravelSolutionList.end(); ++itTS, ++idx) {
00953 const TravelSolutionStruct& lTS = *itTS;
00954
00955 oStream << std::endl;
00956 oStream << " [" << idx << "] " << lTS.display();
00957 }
00958 }
00959
00960
00961 void BomDisplay::
00962 csvDisplay (std::ostream& oStream,
00963 const DatePeriodList_T& iDatePeriodList) {
00964
00965
00966 FlagSaver flagSaver (oStream);
00967
00968
00969 for (DatePeriodList_T::const_iterator itDP = iDatePeriodList.begin();
00970 itDP != iDatePeriodList.end(); ++itDP) {
00971 const DatePeriod* lDP_ptr = *itDP;
00972 assert (lDP_ptr != NULL);
00973
00974
00975 csvDateDisplay (oStream, *lDP_ptr);
00976 }
00977 }
00978
00979
00980 void BomDisplay::csvSimFQTAirRACDisplay (std::ostream& oStream,
00981 const BomRoot& iBomRoot) {
00982
00983 FlagSaver flagSaver (oStream);
00984
00988 oStream << std::endl;
00989 oStream << "==============================================================="
00990 << std::endl;
00991 oStream << "BomRoot: " << iBomRoot.describeKey() << std::endl;
00992 oStream << "==============================================================="
00993 << std::endl;
00994
00995
00996 if (BomManager::hasList<AirportPair> (iBomRoot) == false) {
00997 return;
00998 }
00999
01000
01001 const AirportPairList_T& lAirportPairList =
01002 BomManager::getList<AirportPair> (iBomRoot);
01003 for (AirportPairList_T::const_iterator itAir = lAirportPairList.begin();
01004 itAir != lAirportPairList.end(); ++itAir ) {
01005 const AirportPair* lAir_ptr = *itAir;
01006 assert (lAir_ptr != NULL);
01007
01008
01009 csvAirportPairDisplay (oStream, *lAir_ptr);
01010 }
01011 }
01012
01013
01014 void BomDisplay::csvAirportPairDisplay (std::ostream& oStream,
01015 const AirportPair& iAirportPair) {
01016
01017 FlagSaver flagSaver (oStream);
01018
01022 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
01023 oStream << "AirportPair: " << iAirportPair.describeKey() << std::endl;
01024 oStream << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
01025
01026
01027 if (BomManager::hasList<DatePeriod> (iAirportPair) == false) {
01028 return;
01029 }
01030
01031
01032 const DatePeriodList_T& lDatePeriodList =
01033 BomManager::getList<DatePeriod> (iAirportPair);
01034 for (DatePeriodList_T::const_iterator itDP = lDatePeriodList.begin();
01035 itDP != lDatePeriodList.end(); ++itDP) {
01036 const DatePeriod* lDP_ptr = *itDP;
01037 assert (lDP_ptr != NULL);
01038
01039
01040 csvDateDisplay (oStream, *lDP_ptr);
01041 }
01042 }
01043
01044
01045 void BomDisplay::csvDateDisplay (std::ostream& oStream,
01046 const DatePeriod& iDatePeriod) {
01047
01048
01049 FlagSaver flagSaver (oStream);
01050
01054 oStream << "------------------------------------------" << std::endl;
01055 oStream << "DatePeriod: " << iDatePeriod.describeKey() << std::endl;
01056 oStream << "------------------------------------------" << std::endl;
01057
01058
01059 if (BomManager::hasList<PosChannel> (iDatePeriod) == false) {
01060 return;
01061 }
01062
01063
01064 const PosChannelList_T& lPosChannelList =
01065 BomManager::getList<PosChannel> (iDatePeriod);
01066 for (PosChannelList_T::const_iterator itPC = lPosChannelList.begin();
01067 itPC != lPosChannelList.end(); ++itPC) {
01068 const PosChannel* lPC_ptr = *itPC;
01069 assert (lPC_ptr != NULL);
01070
01071
01072 csvPosChannelDisplay (oStream, *lPC_ptr);
01073 }
01074 }
01075
01076
01077 void BomDisplay::csvPosChannelDisplay (std::ostream& oStream,
01078 const PosChannel& iPosChannel) {
01079
01080 FlagSaver flagSaver (oStream);
01081
01085 oStream << "******************************************" << std::endl;
01086 oStream << "PosChannel: " << iPosChannel.describeKey() << std::endl;
01087 oStream << "******************************************" << std::endl;
01088
01089
01090 if (BomManager::hasList<TimePeriod> (iPosChannel) == false) {
01091 return;
01092 }
01093
01094
01095 const TimePeriodList_T& lTimePeriodList =
01096 BomManager::getList<TimePeriod> (iPosChannel);
01097 for (TimePeriodList_T::const_iterator itTP = lTimePeriodList.begin();
01098 itTP != lTimePeriodList.end(); ++itTP) {
01099 const TimePeriod* lTP_ptr = *itTP;
01100 assert (lTP_ptr != NULL);
01101
01102
01103 csvTimeDisplay (oStream, *lTP_ptr);
01104 }
01105 }
01106
01107
01108 void BomDisplay::csvTimeDisplay (std::ostream& oStream,
01109 const TimePeriod& iTimePeriod) {
01110
01111
01112 FlagSaver flagSaver (oStream);
01113
01117 oStream << "----------------------------------------" << std::endl;
01118 oStream << "TimePeriod: " << iTimePeriod.describeKey() << std::endl;
01119 oStream << "----------------------------------------" << std::endl;
01120
01121
01122
01123
01124 csvFeatureListDisplay<FareFeatures> (oStream, iTimePeriod);
01125 csvFeatureListDisplay<YieldFeatures> (oStream, iTimePeriod);
01126 }
01127
01128
01129 template <typename FEATURE_TYPE>
01130 void BomDisplay::csvFeatureListDisplay (std::ostream& oStream,
01131 const TimePeriod& iTimePeriod) {
01132
01133
01134 if (BomManager::hasList<FEATURE_TYPE> (iTimePeriod) == false) {
01135 return;
01136 }
01137
01138
01139 typedef typename BomHolder<FEATURE_TYPE>::BomList_T FeaturesList_T;
01140 const FeaturesList_T& lFeaturesList =
01141 BomManager::getList<FEATURE_TYPE> (iTimePeriod);
01142 for (typename FeaturesList_T::const_iterator itFF = lFeaturesList.begin();
01143 itFF != lFeaturesList.end(); ++itFF) {
01144 const FEATURE_TYPE* lFF_ptr = *itFF;
01145 assert (lFF_ptr != NULL);
01146
01147
01148 csvFeaturesDisplay (oStream, *lFF_ptr);
01149 }
01150 }
01151
01152
01153 template <typename FEATURE_TYPE>
01154 void BomDisplay::csvFeaturesDisplay (std::ostream& oStream,
01155 const FEATURE_TYPE& iFeatures) {
01156
01157 FlagSaver flagSaver (oStream);
01158
01162 oStream << "--------------------------------------" << std::endl;
01163 oStream << "Fare/yield-Features: " << iFeatures.describeKey() << std::endl;
01164 oStream << "--------------------------------------" << std::endl;
01165
01166
01167 if (BomManager::hasList<AirlineClassList> (iFeatures) == false) {
01168 return;
01169 }
01170
01171
01172 const AirlineClassListList_T& lAirlineClassListList =
01173 BomManager::getList<AirlineClassList> (iFeatures);
01174 for (AirlineClassListList_T::const_iterator itACL =
01175 lAirlineClassListList.begin();
01176 itACL != lAirlineClassListList.end(); ++itACL) {
01177 const AirlineClassList* lACL_ptr = *itACL;
01178 assert (lACL_ptr != NULL);
01179
01180
01181 csvAirlineClassDisplay(oStream, *lACL_ptr);
01182 }
01183 }
01184
01185
01186 void BomDisplay::
01187 csvAirlineClassDisplay (std::ostream& oStream,
01188 const AirlineClassList& iAirlineClassList) {
01189
01190 FlagSaver flagSaver (oStream);
01191
01195 oStream << "------------------------------------" << std::endl;
01196 oStream << "AirlineClassList: "
01197 << iAirlineClassList.describeKey() << std::endl;
01198 oStream << "------------------------------------" << std::endl;
01199 }
01200
01201 }
01202