From: <qua...@us...> - 2010-02-17 14:57:12
|
Revision: 149 http://stdair.svn.sourceforge.net/stdair/?rev=149&view=rev Author: quannaus Date: 2010-02-17 14:57:06 +0000 (Wed, 17 Feb 2010) Log Message: ----------- [dev] Implemented the display for request. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-02-17 14:48:47 UTC (rev 148) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-02-17 14:57:06 UTC (rev 149) @@ -132,7 +132,7 @@ /** Time */ typedef boost::posix_time::time_duration Time_T; - /** Define an accurate time (date +time). */ + /** Define an accurate time (date+time). */ typedef boost::posix_time::ptime DateTime_T; /** Define a distance (kilometers). */ Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-02-17 14:48:47 UTC (rev 148) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-02-17 14:57:06 UTC (rev 149) @@ -418,7 +418,7 @@ // Store current formatting flags of the given output stream std::ios::fmtflags oldFlags = oStream.flags(); - /* + /** #id, request_date (YYMMDD), request_time (HHMMSS), POS (three-letter code), origin (three-letter code), destination (three-letter code), preferred departure date (YYMMDD), preferred departure time (HHMM), @@ -434,9 +434,76 @@ #Duration of stay: irrelevant in case of one-way, but set to 0 #Frequent-flyer tier: G=Gold, S=Silver, K=Basic (Krisflyer), N=None */ + + // Request date&time + const DateTime_T& lRequestDateTime = iBookingRequest.getRequestDateTime(); + intDisplay (oStream, lRequestDateTime.date().year()); + intDisplay (oStream, lRequestDateTime.date().month()); + intDisplay (oStream, lRequestDateTime.date().day()); + oStream << ", "; + intDisplay (oStream, lRequestDateTime.time_of_day().hours()); + intDisplay (oStream, lRequestDateTime.time_of_day().minutes()); + intDisplay (oStream, lRequestDateTime.time_of_day().seconds()); + oStream << ", "; + // POS + oStream << iBookingRequest.getPOS() << ", "; + // Origin + oStream << iBookingRequest.getOrigin() << ", "; + // Destination + oStream << iBookingRequest.getDestination() << ", "; + // Preferred departure date + const Date_T& lPreferredDepartureDate = + iBookingRequest.getPreferedDepartureDate(); + intDisplay (oStream, lPreferredDepartureDate.year()); + intDisplay (oStream, lPreferredDepartureDate.month()); + intDisplay (oStream, lPreferredDepartureDate.day()); + oStream << ", "; + // Preferred departure time + const Duration_T& lPreferredDepartureTime = + iBookingRequest.getPreferredDepartureTime(); + intDisplay (oStream, lPreferredDepartureTime.hours()); + intDisplay (oStream, lPreferredDepartureTime.minutes()); + oStream << ", "; + // MIN & MAX preferred departure time (hardcode) + oStream << "0000, 2359, "; + // Preferred cabin + oStream << iBookingRequest.getPreferredCabin() << ", "; + // Trip type + oStream << iBookingRequest.getTripType() << ", "; + // Duration of stay + if (iBookingRequest.getTripType() == "OW") { + oStream << "0, "; + } else { + oStream << iBookingRequest.getStayDuration() << ", "; + } + // Frequent flyer tier + oStream << iBookingRequest.getFrequentFlyerType() << ", "; + // Willingness-to-pay + oStream << iBookingRequest.getWTP() << ", "; + // Disutility per stop (hardcode to 100) + oStream << "100, "; + // Preferred arrival date (hardcode to the preferred departure date) + intDisplay (oStream, lPreferredDepartureDate.year()); + intDisplay (oStream, lPreferredDepartureDate.month()); + intDisplay (oStream, lPreferredDepartureDate.day()); + oStream << ", "; + // Preferred arrival time (hardcode to 23:55 + oStream << "2355, "; + // Value of time + oStream <<iBookingRequest.getValueOfTime() << std::endl; // Reset formatting flags of the given output stream oStream.flags (oldFlags); } + + // //////////////////////////////////////////////////////////////////// + void BomManager::intDisplay (std::ostream& oStream, const int& iInt) { + const int dInt = iInt - static_cast<int>(iInt/100)*100; + if (dInt < 10) { + oStream << "0" << dInt; + } else { + oStream << dInt; + } + } } Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-02-17 14:48:47 UTC (rev 148) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-02-17 14:57:06 UTC (rev 149) @@ -126,6 +126,8 @@ @param const LegCabin& Root of the BOM tree to be displayed. */ static void csvDisplay (std::ostream&, const BookingRequestStruct& iBookingRequest); + /** Helper fuction to display an interger. */ + static void intDisplay (std::ostream&, const int&); }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |