From: <qua...@us...> - 2010-02-03 14:10:01
|
Revision: 112 http://stdair.svn.sourceforge.net/stdair/?rev=112&view=rev Author: quannaus Date: 2010-02-03 14:09:48 +0000 (Wed, 03 Feb 2010) Log Message: ----------- [dev] Added some 'get' functions. Modified Paths: -------------- trunk/stdair/stdair/bom/AirportDateKey.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassContent.cpp trunk/stdair/stdair/bom/BookingClassContent.hpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/BookingRequestStruct.cpp trunk/stdair/stdair/bom/Network.cpp trunk/stdair/stdair/bom/Network.hpp trunk/stdair/stdair/bom/NetworkDate.cpp trunk/stdair/stdair/bom/NetworkDate.hpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/TravelSolutionStruct.cpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/TravelSolutionTypes.hpp Modified: trunk/stdair/stdair/bom/AirportDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateKey.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/AirportDateKey.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -36,7 +36,7 @@ // //////////////////////////////////////////////////////////////////// const std::string AirportDateKey_T::toString() const { std::ostringstream oStr; - oStr << _parentKey.toString() << " " << _origin; + oStr << _origin; return oStr.str(); } Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -37,89 +37,8 @@ BOM content child type. */ typedef BookingClass ContentChild_T; - public: - // /////////// Getters ///////////// - /** Get the FareFamily (parent class). */ - // FareFamily* getFareFamily() const { -// return _fareFamily; -// } - // ////// Getters from the parent class /////// -// /** Get the airline code (from the parent class). */ -// const AirlineCode_T& getAirlineCode() const; - -// /** Get the flight number (from the parent class). */ -// const FlightNumber_T& getFlightNumber() const; - -// /** Get the flight-date (from the parent class). */ -// const Date_T& getFlightDateDate() const; - -// /** Get the board point (from the parent class). */ -// const AirportCode_T& getBoardPoint () const; - -// /** Get the off point (from the parent class). */ -// const AirportCode_T& getOffPoint () const; - -// /** Get the board date (from the parent class). */ -// const Date_T& getBoardDate () const; - -// /** Get the cabin code (from the parent class). */ -// const CabinCode_T& getCabinCode () const; - -// /** Get the board time (from the parent class). */ -// const Duration_T& getBoardTime () const; - -// /** Get the off date (from the parent class). */ -// const Date_T& getOffDate () const; - -// /** Get the off time (from the parent class). */ -// const Duration_T& getOffTime () const; - -// /** Get the elapsed time (from the parent class). */ -// const Duration_T& getElapsedTime() const; - -// /** Get the distance (from the parent class). */ -// const Distance_T& getDistance() const; - -// /** Get the date off set (from the parent class). */ -// const DateOffSet_T getDateOffSet () const; - -// /** Get the time off set between board and off points (from the -// parent class). */ -// const Duration_T getTimeOffSet() const; - -// /** Retrieve, if existing, theOnD corresponding to the -// given OnDKey. -// <br>If not existing, return the NULL pointer. */ -// OnD* getOnD (const OnDKey_T& iOnDKey) const; - -// /** Get the size of the OnD list. */ -// const unsigned int getOnDListSize () const { -// return _onDList.size(); -// } - -// /** Get the list of OnDs related to this class. */ -// const OnDList_T& getOnDList() const { -// return _onDList; -// } - public: - // ///////// Setters ////////// - /** Set the Fare family (parent class). */ -// void setFareFamily (FareFamily& ioFareFamily) { -// _fareFamily = &ioFareFamily; -// } - - /** Reset the number of bookings to its intial state. */ - //void reset (); - -// /** Reset the booking fare. */ -// void resetFare(); - -// /** Reset the booking yield. */ -// void resetYield(); - - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -140,46 +59,6 @@ at the same level). */ const std::string describeShortKey() const; - /** Give a description of the structure (for display purposes). */ - //const std::string describe() const; - - /** Get a string describing the solution (Fare, MatchIndicator...). */ - //const std::string describeSolution() const; - - public: - // ///////// Business Methods ////////// - /** Update the number of bookings. */ -// bool updateInventoryForReservation (const NbOfBookings_T&); - -// /** Update the number of cancellations. */ -// bool updateInventoryForCancellation (const NbOfCancellations_T&); - -// /** Update the number of no-shows. */ -// bool updateInventoryForNoShow (const NbOfNoShows_T&); - - -// /** Update the revenue of the booking. */ -// bool updateRevenue (const NbOfBookings_T&, const Fare_T&, -// const AnalysisStatus_T&); - -// /** Add the current censorship flag into the flag list. */ -// void addCurrentCensorshipFlagToTheFlagList(); - -// /** Build the Class-Segment code (for example:B-NCE-BKK->BNCEBKK). */ -// const std::string buildClassSegmentCode() const; - -// /** Insert a new OnD reference. */ -// void addOnD (OnD&); - -// /** Calculate the ratio of booking for this booking only -// (without OnD bookings). */ -// const BookingRatio_T calculateNetProductRatio(); - - protected: - /** Update some statistics of the SegmentCabin parent object.*/ -// void updateParentStatistics (const Revenue_T&, -// const NbOfBookings_T&) const; - private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { @@ -202,11 +81,6 @@ /** Reference structure. */ BomStructure_T& _bookingClassStructure; - /** Parent class: FareFamily. */ -// FareFamily* _fareFamily; - -// /** List of OnD references related to this bookingClass. */ -// OnDList_T _onDList; }; } Modified: trunk/stdair/stdair/bom/BookingClassContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingClassContent.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -41,17 +41,22 @@ BookingClassContent::~BookingClassContent () { } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// void BookingClassContent::setRemainingDemandMean(NbOfBookings_T& iMean) { _remainingDemandMean = iMean; _remainingProductDemandMean = iMean; } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// void BookingClassContent::setRemainingDemandSD(NbOfBookings_T& iSD) { _remainingDemandSD = iSD; _remainingProductDemandSD = iSD; } + // //////////////////////////////////////////////////////////////////// + const AirlineCode_T BookingClassContent::getAirlineCode () const { + return _key.getAirlineCode(); + } + } Modified: trunk/stdair/stdair/bom/BookingClassContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingClassContent.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -142,6 +142,9 @@ return _remainingProductDemandSD; } + /** Get the airline code. */ + const AirlineCode_T getAirlineCode () const; + public: // /////////// Setters //////////// /** Set the booking limit. */ Modified: trunk/stdair/stdair/bom/BookingClassKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingClassKey.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -27,8 +27,15 @@ ~BookingClassKey_T (); // /////////// Getters ////////// - /** Get the cabin code. */ - const ClassCode_T& getClassCode () const; + /** Get the class code. */ + const ClassCode_T& getClassCode () const { + return _classCode; + } + + /** Get the airline code. */ + const AirlineCode_T getAirlineCode () const { + return _parentKey.getAirlineCode(); + } // /////////// Setters ///////////// void setParentKey (const ParentKey_T& iParentKey) { Modified: trunk/stdair/stdair/bom/BookingClassTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassTypes.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingClassTypes.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -31,6 +31,10 @@ /** Define the booking class map. */ typedef BomMap_T<BookingClass> BookingClassMap_T; + + /** Define the STL list of booking classes. */ + typedef std::vector<BookingClass*> BookingClassSTLList_T; + } #endif // __STDAIR_BOM_BOOKINGCLASSTYPES_HPP Modified: trunk/stdair/stdair/bom/BookingRequestStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -16,7 +16,10 @@ const AirportCode_T& iDestination, const Date_T& iDepartureDate, const PassengerType_T& iPaxType, - const NbOfSeats_T& iPartySize) { + const NbOfSeats_T& iPartySize) + : _origin (iOrigin), _destination (iDestination), + _departureDate (iDepartureDate), _paxType (iPaxType), + _partySize (iPartySize) { } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Network.cpp =================================================================== --- trunk/stdair/stdair/bom/Network.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/Network.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -14,7 +14,7 @@ // //////////////////////////////////////////////////////////////////// Network::Network (const BomKey_T& iKey, - BomStructure_T& ioNetworkStructure) + BomStructure_T& ioNetworkStructure) : NetworkContent (iKey), _networkStructure (ioNetworkStructure) { } @@ -59,10 +59,26 @@ } // ////////////////////////////////////////////////////////////////////// - NetworkDate* Network:: - getNetworkDate (const NetworkDateKey_T& iKey) const { + NetworkDate* Network::getNetworkDate (const NetworkDateKey_T& iKey) const { return _networkStructure.getContentChild (iKey); } + // ////////////////////////////////////////////////////////////////////// + NetworkDate* Network::getNetworkDate (const Date_T& iDate) const { + NetworkDate* oNetworkDate_ptr = NULL; + + NetworkDateMap_T lNetworkDateMap = getNetworkDateMap (); + + std::ostringstream ostr; + ostr << iDate; + NetworkDateMap_T::iterator itNetworkDate = lNetworkDateMap.find (ostr.str()); + + if (itNetworkDate != lNetworkDateMap.end()) { + oNetworkDate_ptr = itNetworkDate->second; + } + + return oNetworkDate_ptr; + } + } Modified: trunk/stdair/stdair/bom/Network.hpp =================================================================== --- trunk/stdair/stdair/bom/Network.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/Network.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -72,9 +72,14 @@ NetworkDateMap_T getNetworkDateMap () const; /** Retrieve, if existing, the NetworkDate corresponding to the - given network number and network date (NetworkDate key). + given NetworkDate key. <br>If not existing, return the NULL pointer. */ NetworkDate* getNetworkDate (const NetworkDateKey_T&) const; + + /** Retrieve, if existing, the NetworkDate corresponding to the + given Date . + <br>If not existing, return the NULL pointer. */ + NetworkDate* getNetworkDate (const Date_T&) const; private: Modified: trunk/stdair/stdair/bom/NetworkDate.cpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/NetworkDate.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -14,7 +14,7 @@ // //////////////////////////////////////////////////////////////////// NetworkDate::NetworkDate (const BomKey_T& iKey, - BomStructure_T& ioNetworkDateStructure) + BomStructure_T& ioNetworkDateStructure) : NetworkDateContent (iKey), _networkDateStructure (ioNetworkDateStructure) { } @@ -63,6 +63,21 @@ getAirportDate (const AirportDateKey_T& iKey) const { return _networkDateStructure.getContentChild (iKey); } + + // ////////////////////////////////////////////////////////////////////// + AirportDate* NetworkDate::getAirportDate (const AirportCode_T& iCode) const { + AirportDate* oAirportDate_ptr = NULL; + + AirportDateMap_T lAirportDateMap = getAirportDateMap (); + + AirportDateMap_T::iterator itAirportDate = lAirportDateMap.find (iCode); + + if (itAirportDate != lAirportDateMap.end()) { + oAirportDate_ptr = itAirportDate->second; + } + + return oAirportDate_ptr; + } } Modified: trunk/stdair/stdair/bom/NetworkDate.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/NetworkDate.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -76,6 +76,11 @@ given airport-date key. <br>If not existing, return the NULL pointer. */ AirportDate* getAirportDate (const AirportDateKey_T&) const; + + /** Retrieve, if existing, the AirportDate corresponding to the + given airport-code. + <br>If not existing, return the NULL pointer. */ + AirportDate* getAirportDate (const AirportCode_T&) const; private: /** Retrieve the BOM structure object. */ Modified: trunk/stdair/stdair/bom/SegmentCabinKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -38,6 +38,11 @@ return _cabinCode; } + /** Get the airline code. */ + const AirlineCode_T getAirlineCode () const { + return _parentKey.getAirlineCode(); + } + // /////////// Setters ///////////// void setParentKey (const ParentKey_T& iParentKey) { _parentKey = iParentKey; Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-02-03 14:09:48 UTC (rev 112) @@ -11,7 +11,38 @@ namespace stdair { + // //////////////////////////////////////////////////////////////////// + TravelSolutionStruct::TravelSolutionStruct () + : _outboundPath_ptr (NULL) { + assert (false); + } + + // //////////////////////////////////////////////////////////////////// + TravelSolutionStruct:: + TravelSolutionStruct (const TravelSolutionStruct& iTravelSolutionStruct) + : _outboundPath_ptr (iTravelSolutionStruct._outboundPath_ptr), + _bookingClassList (iTravelSolutionStruct._bookingClassList) { + } + + // //////////////////////////////////////////////////////////////////// + TravelSolutionStruct:: + TravelSolutionStruct (OutboundPath& ioOutboundPath, + const BookingClassSTLList_T& iBookingClassList) + : _outboundPath_ptr (&ioOutboundPath), + _bookingClassList (iBookingClassList) { + } + + // //////////////////////////////////////////////////////////////////// + TravelSolutionStruct::~TravelSolutionStruct () { + } + // ////////////////////////////////////////////////////////////////////// + OutboundPath& TravelSolutionStruct::getOutboundPath() const { + assert (_outboundPath_ptr != NULL); + return *_outboundPath_ptr; + } + + // ////////////////////////////////////////////////////////////////////// void TravelSolutionStruct::toStream (std::ostream& ioOut) const { ioOut << describe(); } Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -7,15 +7,28 @@ // STL #include <iosfwd> #include <string> +#include <vector> // StdAir #include <stdair/bom/StructAbstract.hpp> +#include <stdair/bom/BookingClassTypes.hpp> namespace stdair { - + // Forward declarations + class OutboundPath; + /** Structure holding the elements of a travel solution. */ struct TravelSolutionStruct : public StructAbstract { public: - + // /////////// Getters /////////////// + /** Get the OutboundPath. */ + OutboundPath& getOutboundPath() const; + + /** Get the list of booking classes. */ + const BookingClassSTLList_T& getBookingClassList () const { + return _bookingClassList; + } + + public: // /////////// Display support method ///////////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -28,9 +41,25 @@ /** Display of the structure. */ const std::string describe() const; - + + // //////////// Constructors & Destructor /////////////// + public: + /** Main constructor. */ + TravelSolutionStruct (OutboundPath&, const BookingClassSTLList_T&); + /** Destructor. */ + ~TravelSolutionStruct (); + /** Default copy constructor. */ + TravelSolutionStruct (const TravelSolutionStruct&); + /** Default constructor, not to be used. */ + TravelSolutionStruct (); + private: + // Attributes + /** The outbound path associated to this solution.*/ + OutboundPath* _outboundPath_ptr; + /** The list of booking classes which make the travel solution. */ + BookingClassSTLList_T _bookingClassList; }; } Copied: trunk/stdair/stdair/bom/TravelSolutionTypes.hpp (from rev 111, trunk/stdair/stdair/bom/BookingClassTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/TravelSolutionTypes.hpp 2010-02-03 14:09:48 UTC (rev 112) @@ -0,0 +1,22 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_TRAVELSOLUTIONTYPES_HPP +#define __STDAIR_BOM_TRAVELSOLUTIONTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + struct TravelSolutionStruct; + + /** Define the booking class list. */ + typedef std::vector<TravelSolutionStruct> TravelSolutionList_T; + +} +#endif // __STDAIR_BOM_TRAVELSOLUTIONTYPES_HPP + Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-01-29 16:03:38 UTC (rev 111) +++ trunk/stdair/stdair/bom/sources.mk 2010-02-03 14:09:48 UTC (rev 112) @@ -83,6 +83,7 @@ $(top_srcdir)/stdair/bom/OptimizerStruct.hpp \ $(top_srcdir)/stdair/bom/DoWStruct.hpp \ $(top_srcdir)/stdair/bom/TravelSolutionStruct.hpp \ + $(top_srcdir)/stdair/bom/TravelSolutionTypes.hpp \ $(top_srcdir)/stdair/bom/BookingRequestStruct.hpp \ $(top_srcdir)/stdair/bom/BomManager.hpp bom_cc_sources = \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |