From: <qua...@us...> - 2010-06-28 08:53:31
|
Revision: 200 http://stdair.svn.sourceforge.net/stdair/?rev=200&view=rev Author: quannaus Date: 2010-06-28 08:53:24 +0000 (Mon, 28 Jun 2010) Log Message: ----------- [dev] Added ReachableUniverse, OriginDestinationSet, SegmentPathPeriod, FlightPeriod, SegmentPeriod Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/DoWStruct.cpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.hpp trunk/stdair/stdair/bom/OutboundPath.cpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/OutboundPathContent.cpp trunk/stdair/stdair/bom/OutboundPathContent.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateContent.cpp trunk/stdair/stdair/bom/SegmentDateContent.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp Added Paths: ----------- trunk/stdair/stdair/bom/FlightPeriod.cpp trunk/stdair/stdair/bom/FlightPeriod.hpp trunk/stdair/stdair/bom/FlightPeriodContent.cpp trunk/stdair/stdair/bom/FlightPeriodContent.hpp trunk/stdair/stdair/bom/FlightPeriodKey.cpp trunk/stdair/stdair/bom/FlightPeriodKey.hpp trunk/stdair/stdair/bom/FlightPeriodTypes.hpp trunk/stdair/stdair/bom/OriginDestinationSet.cpp trunk/stdair/stdair/bom/OriginDestinationSet.hpp trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp trunk/stdair/stdair/bom/ReachableUniverse.cpp trunk/stdair/stdair/bom/ReachableUniverse.hpp trunk/stdair/stdair/bom/ReachableUniverseContent.cpp trunk/stdair/stdair/bom/ReachableUniverseContent.hpp trunk/stdair/stdair/bom/ReachableUniverseKey.cpp trunk/stdair/stdair/bom/ReachableUniverseKey.hpp trunk/stdair/stdair/bom/ReachableUniverseTypes.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp trunk/stdair/stdair/bom/SegmentPeriod.cpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/SegmentPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPeriodTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -29,47 +29,36 @@ class STDAIR_Service; // ///////// Exceptions /////////// - class RootException : public std::exception { - }; + class RootException : public std::exception { }; - class FileNotFoundException : public RootException { - }; + class FileNotFoundException : public RootException { }; - class NonInitialisedLogServiceException : public RootException { - }; + class NonInitialisedLogServiceException : public RootException { }; - class NonInitialisedDBSessionManagerException : public RootException { - }; + class NonInitialisedDBSessionManagerException : public RootException { }; - class NonInitialisedServiceException : public RootException { - }; + class NonInitialisedServiceException : public RootException { }; - class MemoryAllocationException : public RootException { - }; + class MemoryAllocationException : public RootException { }; - class ObjectLinkingException : public RootException { - }; + class ObjectLinkingException : public RootException { }; - class ParserException : public RootException { - }; + class ParserException : public RootException { }; - class CodeConversionException : public ParserException { - }; + class CodeConversionException : public ParserException { }; - class CodeDuplicationException : public ParserException { - }; + class CodeDuplicationException : public ParserException { }; - class ObjectNotFoundException : public RootException { - }; + class ObjectCreationgDuplicationException : public ParserException { }; - class SQLDatabaseException : public RootException { - }; + class ObjectNotFoundException : public RootException { }; + class SQLDatabaseException : public RootException { }; + class SQLDatabaseConnectionImpossibleException : public SQLDatabaseException { }; - class DocumentNotFoundException : public RootException { - }; + class DocumentNotFoundException : public RootException { }; // /////////////// Log ///////////// /** Level of logs. */ @@ -147,8 +136,8 @@ /** Define the Day-Of-the-Week as a string. */ typedef std::string DOW_String_T; - /** Define the Date Off-Set (e.g., -1 ). */ - typedef boost::gregorian::date_duration DateOffSet_T; + /** Define the Date Offset (e.g., -1 ). */ + typedef boost::gregorian::date_duration DateOffset_T; /** Define a duration in number of days. */ typedef unsigned int DayDuration_T; Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -42,11 +42,11 @@ const std::string DOW_STR[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; - /** Default DOW String (e.g., "1111100"). */ - const DOW_String_T DEFAULT_DOW_STRING ("1111100"); + /** Default DOW String (e.g., "0000000"). */ + const DOW_String_T DEFAULT_DOW_STRING ("0000000"); - /** Default Date OffSet (e.g., 0). */ - const DateOffSet_T DEFAULT_DATE_OFFSET (0); + /** Default Date Offset (e.g., 0). */ + const DateOffset_T DEFAULT_DATE_OFFSET (0); // // //////// General /////// /** Default date for the General. */ Modified: trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -19,8 +19,8 @@ /** Default DOW String (e.g., "1111100"). */ extern const DOW_String_T DEFAULT_DOW_STRING; - /** Default Date OffSet (e.g., 0). */ - extern const DateOffSet_T DEFAULT_DATE_OFFSET; + /** Default Date Offset (e.g., 0). */ + extern const DateOffset_T DEFAULT_DATE_OFFSET; /** Default Duration in days (e.g., 0). */ extern const DayDuration_T DEFAULT_DAY_DURATION; Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -6,25 +6,7 @@ #include <ostream> // StdAir #include <stdair/basic/BasConst_BomManager.hpp> -#include <stdair/bom/BomChildrenHolderImp.hpp> -#include <stdair/bom/Structure.hpp> -#include <stdair/bom/BomList.hpp> -#include <stdair/bom/BomMap.hpp> -#include <stdair/bom/BomRoot.hpp> -#include <stdair/bom/AirlineFeature.hpp> -#include <stdair/bom/BomList.hpp> -#include <stdair/bom/BomMap.hpp> -#include <stdair/bom/Inventory.hpp> -#include <stdair/bom/FlightDate.hpp> -#include <stdair/bom/SegmentDate.hpp> -#include <stdair/bom/LegDate.hpp> -#include <stdair/bom/SegmentCabin.hpp> -#include <stdair/bom/LegCabin.hpp> -#include <stdair/bom/BookingClass.hpp> -#include <stdair/bom/Network.hpp> -#include <stdair/bom/NetworkDate.hpp> -#include <stdair/bom/AirportDate.hpp> -#include <stdair/bom/OutboundPath.hpp> +#include <stdair/bom/BomSource.hpp> #include <stdair/bom/BookingRequestStruct.hpp> #include <stdair/bom/BomManager.hpp> @@ -145,10 +127,10 @@ << lCurrentLD.getOffPoint() << ", " << lCurrentLD.getBoardingDate() << " -> " << lCurrentLD.getOffDate() << " / " - << lCurrentLD.getDateOffSet() << ", " + << lCurrentLD.getDateOffset() << ", " << lCurrentLD.getBoardingTime() << " -> " << lCurrentLD.getOffTime() << " (" - << lCurrentLD.getTimeOffSet() << ") / " + << lCurrentLD.getTimeOffset() << ") / " << lCurrentLD.getElapsedTime() << ", " << lCurrentLD.getDistance() << ", " << lCurrentLD.getCapacity() << ", " @@ -278,10 +260,10 @@ << lCurrentSC.getCabinCode() << ", " << lCurrentSD.getBoardingDate() << " -> " << lCurrentSD.getOffDate() << " / " - << lCurrentSD.getDateOffSet() << ", " + << lCurrentSD.getDateOffset() << ", " << lCurrentSD.getBoardingTime() << " -> " << lCurrentSD.getOffTime() << " (" - << lCurrentSD.getTimeOffSet() << ") / " + << lCurrentSD.getTimeOffset() << ") / " << lCurrentSD.getElapsedTime() << ", " << lCurrentSD.getDistance() << ", " << std::endl; Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -21,6 +21,7 @@ // //////////////////////////////////////////////////////////////////// void BomRoot::init() { _structure.initChildrenHolder<Inventory>(); + _structure.initChildrenHolder<ReachableUniverse>(); _structure.initChildrenHolder<Network>(); _structure.initChildrenHolder<AirlineFeature>(); _structure.initChildrenHolder<DemandStream>(); @@ -38,6 +39,16 @@ } // //////////////////////////////////////////////////////////////////// + ReachableUniverseList_T BomRoot::getReachableUniverseList () const { + return _structure.getChildrenHolder<ReachableUniverse>(); + } + + // //////////////////////////////////////////////////////////////////// + ReachableUniverseMap_T BomRoot::getReachableUniverseMap () const { + return _structure.getChildrenHolder<ReachableUniverse>(); + } + + // //////////////////////////////////////////////////////////////////// NetworkList_T BomRoot::getNetworkList () const { return _structure.getChildrenHolder<Network>(); } @@ -83,6 +94,12 @@ } // //////////////////////////////////////////////////////////////////// + ReachableUniverse* BomRoot:: + getReachableUniverse (const AirportCode_T& iAirportCode) const { + return _structure.getChildPtr<ReachableUniverse> (iAirportCode); + } + + // //////////////////////////////////////////////////////////////////// Network* BomRoot::getNetwork (const NetworkID_T& iNetworkID) const { return _structure.getChildPtr<Network> (iNetworkID); } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -14,6 +14,7 @@ #include <stdair/bom/BomRootContent.hpp> #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/ReachableUniverseTypes.hpp> #include <stdair/bom/NetworkTypes.hpp> #include <stdair/bom/DemandStreamTypes.hpp> #include <stdair/bom/AirlineFeatureTypes.hpp> @@ -62,6 +63,7 @@ #if BOOST_VERSION >= 103500 typedef boost::fusion::map< boost::fusion::pair<Inventory, InventoryHolder_T*>, + boost::fusion::pair<ReachableUniverse, ReachableUniverseHolder_T*>, boost::fusion::pair<Network, NetworkHolder_T*>, boost::fusion::pair<AirlineFeature, AirlineFeatureHolder_T*>, boost::fusion::pair<DemandStream, DemandStreamHolder_T*>, @@ -77,6 +79,8 @@ /** Get a list or map of a children type for iteration methods. */ InventoryList_T getInventoryList () const; InventoryMap_T getInventoryMap () const; + ReachableUniverseList_T getReachableUniverseList () const; + ReachableUniverseMap_T getReachableUniverseMap () const; NetworkList_T getNetworkList () const; NetworkMap_T getNetworkMap () const; DemandStreamList_T getDemandStreamList () const; @@ -91,6 +95,11 @@ <br>If not existing, return the NULL pointer. */ Inventory* getInventory (const AirlineCode_T&) const; + /** Retrieve, if existing, the ReachableUniverse corresponding to the + given airport. + <br>If not existing, return the NULL pointer. */ + ReachableUniverse* getReachableUniverse (const AirportCode_T&) const; + /** Retrieve, if existing, the Network corresponding to the given airline code (Network key). <br>If not existing, return the NULL pointer. */ Modified: trunk/stdair/stdair/bom/BomSource.hpp =================================================================== --- trunk/stdair/stdair/bom/BomSource.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomSource.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -22,6 +22,11 @@ #include <stdair/bom/LegDate.hpp> #include <stdair/bom/LegCabin.hpp> #include <stdair/bom/Bucket.hpp> +#include <stdair/bom/FlightPeriod.hpp> +#include <stdair/bom/SegmentPeriod.hpp> +#include <stdair/bom/ReachableUniverse.hpp> +#include <stdair/bom/OriginDestinationSet.hpp> +#include <stdair/bom/SegmentPathPeriod.hpp> #include <stdair/bom/DemandStream.hpp> #include <stdair/bom/AirlineFeature.hpp> #include <stdair/bom/YieldStore.hpp> Modified: trunk/stdair/stdair/bom/DoWStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -1,17 +1,16 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> // STL #include <sstream> +#include <cassert> // STDAIR #include <stdair/basic/BasConst_Period_BOM.hpp> #include <stdair/bom/DoWStruct.hpp> namespace stdair { - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// DoWStruct_T::DoWStruct_T (const std::string& iDowString) { const unsigned short lDowStringSize = iDowString.size(); assert (lDowStringSize == 7); @@ -24,13 +23,13 @@ } } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// DoWStruct_T::DoWStruct_T (const DoWStruct_T& iDowStruct) : _dowList (iDowStruct._dowList) { } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string DoWStruct_T::describeShort() const { std::ostringstream ostr; short i = 0; @@ -42,7 +41,7 @@ return ostr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string DoWStruct_T::describe() const { std::ostringstream ostr; short i = 0; @@ -56,12 +55,12 @@ return ostr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// bool DoWStruct_T::getDayOfWeek (const unsigned short i) const { return _dowList.at (i); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// bool DoWStruct_T::getStandardDayOfWeek (const unsigned short i) const { unsigned short iStd = i; if (iStd == 0) { Copied: trunk/stdair/stdair/bom/FlightPeriod.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriod.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,75 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iostream> +#include <algorithm> +// STDAIR +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriod::FlightPeriod (const Key_T& iKey, + Structure_T& ioFlightStructure) + : FlightPeriodContent (iKey), _structure (ioFlightStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriod::~FlightPeriod () { + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::init() { + _structure.initChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string FlightPeriod::toString() const { + std::ostringstream oStr; + + // First, put the key of that level + oStr << describeShortKey() << std::endl; + + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string FlightPeriod::describeKey() const { + std::ostringstream oStr; + oStr << _structure.describeParentKey() << ", " << describeShortKey(); + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const FlightPeriod::Parent_T& FlightPeriod::getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriodList_T FlightPeriod::getSegmentPeriodList () const { + return _structure.getChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriodMap_T FlightPeriod::getSegmentPeriodMap () const { + return _structure.getChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriod* FlightPeriod::getSegmentPeriod (const SegmentPeriodKey_T& iKey) const { + return _structure.getChildPtr<SegmentPeriod> (iKey.toString() ); + } +} + Copied: trunk/stdair/stdair/bom/FlightPeriod.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDate.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,98 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIOD_HPP +#define __STDAIR_BOM_FLIGHTPERIOD_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightPeriodContent.hpp> +#include <stdair/bom/FlightPeriodTypes.hpp> +#include <stdair/bom/SegmentPeriodTypes.hpp> + +namespace stdair { + // Forward declarations + class Inventory; + class SegmentPeriod; + struct SegmentPeriodKey_T; + + /** Class representing the actual functional/business content for a + flight-period. */ + class FlightPeriod : public FlightPeriodContent { + friend class FacBomContent; + + public: + // Type definitions + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef FlightPeriodStructure_T Structure_T; + + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef Inventory Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<SegmentPeriod, SegmentPeriodHolder_T*> + > ChildrenHolderMap_T; + // ////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + + /** Get a list or map of a children type for iteration methods. */ + SegmentPeriodList_T getSegmentPeriodList () const; + SegmentPeriodMap_T getSegmentPeriodMap () const; + + /** Retrieve, if existing, the SegmentPeriod corresponding to the + given SegmentPeriod key. + <br>If not existing, return the NULL pointer. */ + SegmentPeriod* getSegmentPeriod (const SegmentPeriodKey_T&) const; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Constructors. */ + FlightPeriod (const Key_T&, Structure_T&); + /** Destructor. */ + ~FlightPeriod(); + /** Initialise all the pointers of children holder to NULL. */ + void init(); + /** Default constructors. */ + FlightPeriod (); + FlightPeriod (const FlightPeriod&); + + protected: + // Attributes + /** Reference structure. */ + Structure_T& _structure; + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIOD_HPP + Copied: trunk/stdair/stdair/bom/FlightPeriodContent.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDateContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/FlightPeriodContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriodContent::FlightPeriodContent (const Key_T& iKey) + : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodContent::~FlightPeriodContent () { + } + +} + Copied: trunk/stdair/stdair/bom/FlightPeriodContent.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,74 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP +#define __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/FlightPeriodKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline flight-period. */ + class FlightPeriodContent : public BomContent { + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FlightPeriodKey_T Key_T; + + public: + // /////////// Getters /////////////// + /** Get the flight-period key. */ + const Key_T& getKey () const { + return _key; + } + + /** Get the flight number (part of the primary key). */ + const FlightNumber_T& getFlightNumber () const { + return _key.getFlightNumber(); + } + + /** Get the departure date range. */ + const DatePeriod_T& getDeparturePeriod () const { + return _key.getDeparturePeriod(); + } + + /** Get the active days-of-week. */ + const DoWStruct_T& getDoW () const { + return _key.getDoW(); + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + FlightPeriodContent (const Key_T&); + FlightPeriodContent (const FlightPeriodContent&); + /** Destructor. */ + virtual ~FlightPeriodContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + Key_T _key; + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP + Copied: trunk/stdair/stdair/bom/FlightPeriodKey.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDateKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodKey.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,43 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightPeriodKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::FlightPeriodKey_T (const FlightNumber_T& iFlightNumber, + const DatePeriod_T& iDatePeriod, + const DoWStruct_T& iDoW) + : _flightNumber (iFlightNumber), _dateRange (iDatePeriod), _dow (iDoW) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::FlightPeriodKey_T (const FlightPeriodKey_T& iKey) + : _flightNumber (iKey._flightNumber), _dateRange (iKey._dateRange), + _dow (iKey._dow) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::~FlightPeriodKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriodKey_T::toStream (std::ostream& ioOut) const { + ioOut << "FlightPeriodKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriodKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string FlightPeriodKey_T::toString() const { + std::ostringstream oStr; + oStr << _flightNumber << ", " << _dateRange << ", " + << _dow.describeShort(); + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/FlightPeriodKey.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodKey.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,73 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIODKEY_HPP +#define __STDAIR_BOM_FLIGHTPERIODKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/DoWStruct.hpp> + +namespace stdair { + /** Key of flight-period. */ + struct FlightPeriodKey_T : public BomKey_T { + + private: + // /////////// Default constructor ////////// + FlightPeriodKey_T (); + public: + // /////////// Construction /////////// + /** Constructors. */ + FlightPeriodKey_T (const FlightNumber_T&, const DatePeriod_T&, + const DoWStruct_T&); + FlightPeriodKey_T (const FlightPeriodKey_T&); + /** Destructor. */ + ~FlightPeriodKey_T (); + + // /////////// Getters ////////// + /** Get the flight number. */ + const FlightNumber_T& getFlightNumber() const { + return _flightNumber; + } + + /** Get the departure date range. */ + const DatePeriod_T& getDeparturePeriod () const { + return _dateRange; + } + + /** Get the active days-of-week. */ + const DoWStruct_T& getDoW () const { + return _dow; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-period. */ + const std::string toString() const; + + private: + // Attributes + /** Flight number. */ + FlightNumber_T _flightNumber; + + /** Departure period of the (first leg of the) flight. */ + DatePeriod_T _dateRange; + + /** DoW during the departure period. */ + DoWStruct_T _dow; + + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIODKEY_HPP Copied: trunk/stdair/stdair/bom/FlightPeriodTypes.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodTypes.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FLIGHTPERIODTYPES_HPP +#define __STDAIR_BOM_FLIGHTPERIODTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class FlightPeriod; + + /** Define the FlightPeriod structure. */ + typedef Structure<FlightPeriod> FlightPeriodStructure_T; + + /** Define the FlightPeriod holder. */ + typedef BomChildrenHolderImp<FlightPeriod> FlightPeriodHolder_T; + + /** Define the flight-period list. */ + typedef BomList_T<FlightPeriod> FlightPeriodList_T; + + /** Define the flight-period map. */ + typedef BomMap_T<FlightPeriod> FlightPeriodMap_T; +} +#endif // __STDAIR_BOM_FLIGHTPERIODTYPES_HPP + Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/Inventory.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -22,6 +22,7 @@ // //////////////////////////////////////////////////////////////////// void Inventory::init () { _structure.initChildrenHolder<FlightDate> (); + _structure.initChildrenHolder<FlightPeriod> (); } // //////////////////////////////////////////////////////////////////// @@ -46,6 +47,11 @@ } // //////////////////////////////////////////////////////////////////// + const Inventory::Parent_T& Inventory::getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// FlightDateList_T Inventory::getFlightDateList () const { return _structure.getChildrenHolder<FlightDate>(); } @@ -56,9 +62,25 @@ } // //////////////////////////////////////////////////////////////////// + FlightPeriodList_T Inventory::getFlightPeriodList () const { + return _structure.getChildrenHolder<FlightPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodMap_T Inventory::getFlightPeriodMap () const { + return _structure.getChildrenHolder<FlightPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// FlightDate* Inventory:: getFlightDate (const FlightDateKey_T& iKey) const { return _structure.getChildPtr<FlightDate> (iKey.toString()); } + + // //////////////////////////////////////////////////////////////////// + FlightPeriod* Inventory:: + getFlightPeriod (const FlightPeriodKey_T& iKey) const { + return _structure.getChildPtr<FlightPeriod> (iKey.toString()); + } } Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -14,13 +14,16 @@ #include <stdair/bom/InventoryContent.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/FlightPeriodTypes.hpp> namespace stdair { // Forward declarations class BomRoot; class FlightDate; + class FlightPeriod; class AirlineFeature; struct FlightDateKey_T; + struct FlightPeriodKey_T; /** Class representing the actual functional/business content for an airline inventory. */ @@ -46,7 +49,8 @@ /** Define the list of children holder types. */ #if BOOST_VERSION >= 103500 typedef boost::fusion::map< - boost::fusion::pair<FlightDate, FlightDateHolder_T*> + boost::fusion::pair<FlightDate, FlightDateHolder_T*>, + boost::fusion::pair<FlightPeriod, FlightPeriodHolder_T*> > ChildrenHolderMap_T; #else // BOOST_VERSION >= 103500 typedef boost::mpl::map< > ChildrenHolderMap_T; @@ -72,9 +76,14 @@ public: // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + /** Get a list or map of a children type for iteration methods. */ FlightDateList_T getFlightDateList () const; FlightDateMap_T getFlightDateMap () const; + FlightPeriodList_T getFlightPeriodList () const; + FlightPeriodMap_T getFlightPeriodMap () const; /** Get the airline feature. */ const AirlineFeature* getAirlineFeature () const { @@ -85,6 +94,11 @@ given flight number and flight date (FlightDate key). <br>If not existing, return the NULL pointer. */ FlightDate* getFlightDate (const FlightDateKey_T&) const; + + /** Retrieve, if existing, the FlightPeriod corresponding to the + given flight number and flight period (FlightPeriod key). + <br>If not existing, return the NULL pointer. */ + FlightPeriod* getFlightPeriod (const FlightPeriodKey_T&) const; public: // /////////// Setters //////////// Modified: trunk/stdair/stdair/bom/LegDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/LegDateContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -21,14 +21,14 @@ } // //////////////////////////////////////////////////////////////////// - const Duration_T LegDateContent::getTimeOffSet() const { - // TimeOffSet = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 + const Duration_T LegDateContent::getTimeOffset() const { + // TimeOffset = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 // - ElapsedTime - Duration_T oTimeOffSet = (_offTime - _boardingTime); - const DateOffSet_T& lDateOffSet = getDateOffSet(); - const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); - oTimeOffSet += lDateOffSetInHours - _elapsedTime; - return oTimeOffSet; + Duration_T oTimeOffset = (_offTime - _boardingTime); + const DateOffset_T& lDateOffset = getDateOffset(); + const Duration_T lDateOffsetInHours (lDateOffset.days() * 24, 0, 0); + oTimeOffset += lDateOffsetInHours - _elapsedTime; + return oTimeOffset; } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/LegDateContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -69,16 +69,16 @@ return _capacity; } - /** Get the date off set (off date - boarding date). */ - const DateOffSet_T getDateOffSet () const { + /** Get the date offset (off date - boarding date). */ + const DateOffset_T getDateOffset () const { return _offDate - _boardingDate; } /** Get the time off set between boarding and off points. <br>It is defined as being: - TimeOffSet = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 + TimeOffset = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 - ElapsedTime. */ - const Duration_T getTimeOffSet() const; + const Duration_T getTimeOffset() const; public: // ///////// Setters ////////// Copied: trunk/stdair/stdair/bom/OriginDestinationSet.cpp (from rev 195, trunk/stdair/stdair/bom/Network.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSet.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSet.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,68 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSet::OriginDestinationSet (const Key_T& iKey, + Structure_T& ioOriginDestinationSetStructure) + : OriginDestinationSetContent (iKey), + _structure (ioOriginDestinationSetStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSet::~OriginDestinationSet () { + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::init () { + _structure.initChildrenHolder<SegmentPathPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string OriginDestinationSet::toString() const { + std::ostringstream oStr; + oStr << _key.toString(); + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string OriginDestinationSet::describeKey() const { + return _key.toString(); + } + + // //////////////////////////////////////////////////////////////////// + const OriginDestinationSet::Parent_T& OriginDestinationSet:: + getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPathPeriodList_T OriginDestinationSet:: + getSegmentPathPeriodList () const { + return _structure.getChildrenHolder<SegmentPathPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPathPeriodMultimap_T OriginDestinationSet:: + getSegmentPathPeriodMultimap () const { + return _structure.getChildrenHolder<SegmentPathPeriod>(); + } + +} + Copied: trunk/stdair/stdair/bom/OriginDestinationSet.hpp (from rev 195, trunk/stdair/stdair/bom/Network.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSet.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSet.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,91 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSET_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSET_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/OriginDestinationSetContent.hpp> +#include <stdair/bom/OriginDestinationSetTypes.hpp> +#include <stdair/bom/SegmentPathPeriodTypes.hpp> + +namespace stdair { + // Forward declarations + class ReachableUniverse; + class SegmentPathPeriod; + + /** Class representing the actual functional/business content for + a network. */ + class OriginDestinationSet : public OriginDestinationSetContent { + friend class FacBomContent; + + public: + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef OriginDestinationSetStructure_T Structure_T; + + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef ReachableUniverse Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<SegmentPathPeriod, SegmentPathPeriodHolder_T*> + > ChildrenHolderMap_T; + // ////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + + /** Get a list or map of a children type for iteration methods. */ + SegmentPathPeriodList_T getSegmentPathPeriodList () const; + SegmentPathPeriodMultimap_T getSegmentPathPeriodMultimap () const; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Constructors. */ + OriginDestinationSet (const Key_T&, Structure_T&); + /** Destructor. */ + ~OriginDestinationSet(); + /** Initialise all the pointers of children holder to NULL. */ + void init(); + /** Default constructors. */ + OriginDestinationSet (); + OriginDestinationSet (const OriginDestinationSet&); + + protected: + // Attributes + /** Reference structure. */ + Structure_T& _structure; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSET_HPP + Copied: trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp (from rev 195, trunk/stdair/stdair/bom/NetworkContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/OriginDestinationSetContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetContent:: + OriginDestinationSetContent (const Key_T& iKey) : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetContent::~OriginDestinationSetContent () { + } + +} + Copied: trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,59 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/OriginDestinationSetKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline network. */ + class OriginDestinationSetContent : public BomContent { + public : + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef OriginDestinationSetKey_T Key_T; + + public: + // ////////// Getters //////////// + /** Get the network key. */ + const Key_T& getKey() const { + return _key; + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + OriginDestinationSetContent (const Key_T&); + OriginDestinationSetContent (const OriginDestinationSetContent&); + /** Destructor. */ + virtual ~OriginDestinationSetContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + Key_T _key; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP + Copied: trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp (from rev 195, trunk/stdair/stdair/bom/NetworkKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,40 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/OriginDestinationSetKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T:: + OriginDestinationSetKey_T (const AirportCode_T& iDestination) + : _destination (iDestination) { + } + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T:: + OriginDestinationSetKey_T (const OriginDestinationSetKey_T& iKey) + : _destination (iKey._destination) { + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T::~OriginDestinationSetKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSetKey_T::toStream (std::ostream& ioOut) const { + ioOut << "OriginDestinationSetKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSetKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string OriginDestinationSetKey_T::toString() const { + std::ostringstream oStr; + oStr << _destination; + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,57 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + /** Key of network. */ + struct OriginDestinationSetKey_T : public BomKey_T { + + private: + // /////////// Default constructor ////////// + OriginDestinationSetKey_T (); + + public: + // /////////// Construction /////////// + /** Constructors. */ + OriginDestinationSetKey_T (const AirportCode_T& ); + OriginDestinationSetKey_T (const OriginDestinationSetKey_T&); + /** Destructor. */ + ~OriginDestinationSetKey_T (); + + // /////////// Getters ////////// + /** Get the destination airport code. */ + const AirportCode_T& getOffPoint () const { + return _destination; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + const std::string toString() const; + + + private: + // Attributes + /** OriginDestinationSet ID. */ + AirportCode_T _destination; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP Copied: trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class OriginDestinationSet; + + /** Define the OriginDestinationSet structure. */ + typedef Structure<OriginDestinationSet> OriginDestinationSetStructure_T; + + /** Define the OriginDestinationSet holder. */ + typedef BomChildrenHolderImp<OriginDestinationSet> OriginDestinationSetHolder_T; + + /** Define the OriginDestinationSet list. */ + typedef BomList_T<OriginDestinationSet> OriginDestinationSetList_T; + + /** Define the OriginDestinationSet map. */ + typedef BomMap_T<OriginDestinationSet> OriginDestinationSetMap_T; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP + Modified: trunk/stdair/stdair/bom/OutboundPath.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPath.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -108,11 +108,6 @@ } // //////////////////////////////////////////////////////////////////// - void OutboundPath::incrementTotalFlightTime (const Duration_T& iElapsed) { - _flightTime += iElapsed; - } - - // //////////////////////////////////////////////////////////////////// void OutboundPath::updateAirlineCode() { // TODO: to be optimised. std::ostringstream ostr; @@ -163,7 +158,8 @@ iOutboundPath.getFirstSegmentDate(); assert (lBoardingSegment_ptr != NULL); - return lOffSegment_ptr->isConnectable (*lBoardingSegment_ptr); + //return lOffSegment_ptr->isConnectable (*lBoardingSegment_ptr); + return true; } // //////////////////////////////////////////////////////////////////// @@ -245,9 +241,6 @@ // //////////////////////////////////////////////////////////////////// void OutboundPath:: updateAfterAddingSegmentDate (const SegmentDate& iSegmentDate) { - // Increment the total flight time of the outbound path - const Duration_T lElapsed = iSegmentDate.getElapsedTime(); - incrementTotalFlightTime (lElapsed); // Increment the flight path code std::ostringstream ostr; FlightPathCode_T lPreviousFPCode = getCurrentFlightPathCode(); Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -68,11 +68,6 @@ <br>Return a NULL pointer if the list is empty. */ const SegmentDate* getFirstSegmentDate () const; - private: - // ////////////// Business methods ////////////// - /** Increments the total flight time of the outbound path.*/ - void incrementTotalFlightTime (const Duration_T&); - public: /** Get the AirportDate corresponding to the destination of the outbound-path, i.e., the off point of the last segment-date Modified: trunk/stdair/stdair/bom/OutboundPathContent.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPathContent.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPathContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -12,8 +12,7 @@ // //////////////////////////////////////////////////////////////////// OutboundPathContent::OutboundPathContent (const Key_T& iKey) : _key (iKey), _airlineCode (DEFAULT_AIRLINE_CODE), - _flightPathCode (DEFAULT_FLIGHTPATH_CODE), - _flightTime (NULL_BOOST_TIME_DURATION) { + _flightPathCode (DEFAULT_FLIGHTPATH_CODE) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/OutboundPathContent.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPathContent.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPathContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -38,11 +38,6 @@ return _flightPathCode; } - /** Get the total flight time. */ - const Duration_T& getTotalFlightTime () const { - return _flightTime; - } - /** Get the number of segments (part of the primary key). */ const NbOfSegments_T& getNbOfSegments() const { return _key.getNbOfSegments(); @@ -115,9 +110,6 @@ /** FlightPathCode (AirlineCode + flight numbers of all segments). */ FlightPathCode_T _flightPathCode; - - /** Total flight time (without stop time).*/ - Duration_T _flightTime; }; } Copied: trunk/stdair/stdair/bom/ReachableUniverse.cpp (from rev 195, trunk/stdair/stdair/bom/AirportDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/ReachableUniverse.cpp (rev 0) +++ trunk/stdair/stdair/bom/ReachableUniverse.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,98 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_Inventory.hpp> +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + ReachableUniverse::ReachableUniverse (const Key_T& iKey, + Structure_T& ioAirportStructure) + : ReachableUniverseContent (iKey), _structure (ioAirportStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + ReachableUniverse::~ReachableUniverse () { + } + + // //////////////////////////////////////////////////////////////////// + void ReachableUniverse::init () { + _structure.initChildrenHolder<OriginDestinationSet>(); + } + + // //////////////////////////////////////////////////////////////////// + voi... [truncated message content] |