From: <den...@us...> - 2010-02-18 19:57:23
|
Revision: 158 http://stdair.svn.sourceforge.net/stdair/?rev=158&view=rev Author: denis_arnaud Date: 2010-02-18 19:57:17 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [Dev] Just improved a little bit the pretty print function for the segment-dates. Modified Paths: -------------- trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-02-18 18:28:42 UTC (rev 157) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-02-18 19:57:17 UTC (rev 158) @@ -115,21 +115,11 @@ csvBPVDisplay (oStream, iFlightDate); // Display the segment-cabins - // csvSegmentCabinDisplay (oStream, iFlightDate); + csvSegmentCabinDisplay (oStream, iFlightDate); // Display the booking classes // csvClassDisplay (oStream, iFlightDate); - // Browse the SegmentDate objects - const SegmentDateList_T& lSDList = iFlightDate.getSegmentDateList(); - for (SegmentDateList_T::iterator itSD = lSDList.begin(); - itSD != lSDList.end(); ++itSD) { - const SegmentDate& lCurrentSD = *itSD; - - // Call recursively the display() method on the children objects - display (oStream, lCurrentSD); - } - // Reset formatting flags of the given output stream oStream.flags (oldFlags); } @@ -266,24 +256,51 @@ } // ////////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const SegmentDate& iSegmentDate) { + void BomManager::csvSegmentCabinDisplay (std::ostream& oStream, + const FlightDate& iFlightDate) { // Store current formatting flags of the given output stream std::ios::fmtflags oldFlags = oStream.flags(); - // Segment-date level - oStream << iSegmentDate.describeKey() << std::endl; + // Display the header + oStream << "******************************************" << std::endl; + oStream << "SegmentCabins:" << std::endl + << "--------------" << std::endl; + oStream << "Segment, Cabin, Dates, Times, Dist, SS, Rev, Fare, URev, RPK, " + << std::endl; - // Browse the SegmentCabin objects - const SegmentCabinList_T& lSCList = iSegmentDate.getSegmentCabinList(); - for (SegmentCabinList_T::iterator itSC = lSCList.begin(); - itSC != lSCList.end(); ++itSC) { - const SegmentCabin& lCurrentSC = *itSC; + // Browse the SegmentDate objects + const SegmentDateList_T& lSDList = iFlightDate.getSegmentDateList(); + for (SegmentDateList_T::iterator itSD = lSDList.begin(); + itSD != lSDList.end(); ++itSD) { + const SegmentDate& lCurrentSD = *itSD; + + // Browse the SegmentCabin objects + const SegmentCabinList_T& lSCList = lCurrentSD.getSegmentCabinList(); + for (SegmentCabinList_T::iterator itSC = lSCList.begin(); + itSC != lSCList.end(); ++itSC) { + const SegmentCabin& lCurrentSC = *itSC; + + oStream << lCurrentSD.getBoardingPoint() << "-" + << lCurrentSD.getOffPoint() << ", " + << lCurrentSC.getCabinCode() << ", " + << lCurrentSD.getBoardingDate() << " -> " + << lCurrentSD.getOffDate() << " / " + << lCurrentSD.getDateOffSet() << ", " + << lCurrentSD.getBoardingTime() << " -> " + << lCurrentSD.getOffTime() << " (" + << lCurrentSD.getTimeOffSet() << ") / " + << lCurrentSD.getElapsedTime() << ", " + << lCurrentSD.getDistance() << ", " + << lCurrentSD.getBookingCounter() << ", " + << lCurrentSD.getRevenue() << ", " + << lCurrentSD.getAverageFare() << ", " + << lCurrentSD.getUnitRevenue() << ", " + << lCurrentSD.getRPK() << ", " + << std::endl; + } + } + oStream << "******************************************" << std::endl; - // Call recursively the display() method on the children objects - display (oStream, lCurrentSC); - } - // Reset formatting flags of the given output stream oStream.flags (oldFlags); } Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-02-18 18:28:42 UTC (rev 157) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-02-18 19:57:17 UTC (rev 158) @@ -76,7 +76,7 @@ @param std::ostream& Output stream in which the BOM tree should be logged/dumped. @param const SegmentDate& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const SegmentDate&); + static void csvSegmentCabinDisplay (std::ostream&, const FlightDate&); /** Recursively display (dump in the underlying output log stream) the objects of the given BOM tree. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |