From: <qua...@us...> - 2009-10-26 13:08:50
|
Revision: 55 http://stdair.svn.sourceforge.net/stdair/?rev=55&view=rev Author: quannaus Date: 2009-10-26 13:08:42 +0000 (Mon, 26 Oct 2009) Log Message: ----------- [Dev] Moved the key from structure into content. Modified Paths: -------------- trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomRootContent.cpp trunk/stdair/stdair/bom/BomRootContent.hpp trunk/stdair/stdair/bom/BomRootStructure.hpp trunk/stdair/stdair/bom/BookingClass.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassContent.cpp trunk/stdair/stdair/bom/BookingClassContent.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateContent.cpp trunk/stdair/stdair/bom/FlightDateContent.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryContent.cpp trunk/stdair/stdair/bom/InventoryContent.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinContent.cpp trunk/stdair/stdair/bom/LegCabinContent.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinContent.cpp trunk/stdair/stdair/bom/SegmentCabinContent.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.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/SegmentDateStructure.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -19,8 +19,8 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BomRoot::BomRoot (BomStructure_T& ioBomRootStructure) - : _bomRootStructure (ioBomRootStructure) { + BomRoot::BomRoot (const BomKey_T& iKey, BomStructure_T& ioBomRootStructure) + : BomRootContent (iKey), _bomRootStructure (ioBomRootStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -116,7 +116,7 @@ /** Default constructors. */ BomRoot (); BomRoot (const BomRoot&); - BomRoot (BomStructure_T&); + BomRoot (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~BomRoot(); Modified: trunk/stdair/stdair/bom/BomRootContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BomRootContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BomRootContent::BomRootContent () { + BomRootContent::BomRootContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/BomRootContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BomRootContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -4,14 +4,115 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STDAIR +// STDAIR +#include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BomRootKey.hpp> namespace stdair { /** Class representing the actual attributes for the Bom root. */ class BomRootContent : public BomContent { public: + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BomRootKey_T BomKey_T; + + public: + // /////////// Getters ////////////// + /** Get the BomRoot key. */ + const BomKey_T& getKey() const { + return _key; + } + + /** Get the update/creation date for the world schedule data. */ + const Date_T& getUpdateDate() const { + return _updateDate; + } + + /** Get the number of generated flight dates. */ + const NbOfFlightDates_T getNumberOfFlightDates() const { + return _flightDateCounter; + } + + /** Get the booking counter. */ + const NbOfBookings_T& getBookingCounter () const { + return _bookingCounter; + } + + /** Get the total revenue of the whole world schedule. */ + const Revenue_T& getRevenue () const { + return _worldScheduleRevenue; + } + + /** Get the world schedule average fare. */ + const Fare_T& getAverageFare() const { + return _wScheduleAverageFare; + } + + /** Get the Availability Seat Kilometer for the + world schedule. */ + const Distance_T& getASK() const { + return _worldScheduleASK; + } + + /** Get the yield value for the worldSchedule. */ + const Revenue_T& getYield () const { + return _worldScheduleYield; + } + + /** Get the Revenue Passanger Kilometer for the world schedule. */ + const Distance_T& getRPK() const { + return _worldScheduleRPK; + } + + /** Get the unit revenue value for the worldSchedule. */ + const Revenue_T& getUnitRevenue () const { + return _wScheduleUnitRevenue; + } + + /** Get the load factor value for the world schedule. */ + const Revenue_T& getLoadFactor () const { + return _wScheduleLoadFactor; + } + + public: + // ///////// Setters ////////// + /** Set the update/creation date for the world schdule data. */ + void setUpdateDate (const Date_T& iUpdateDate) { + _updateDate = iUpdateDate; + } + + /** Set the revenue amount. */ + void setRevenue (const Revenue_T& iWCRevenue) { + _worldScheduleRevenue = iWCRevenue; + } + + /** Set the Revenue Passanger Kilometer. */ + void setRPK (const Distance_T& iWSRPK) { + _worldScheduleRPK = iWSRPK; + } + + /** Set the unit revenue. */ + void setUnitRevenue (const Revenue_T& iWSURevenue) { + _wScheduleUnitRevenue = iWSURevenue; + } + + /** Set the average fare. */ + void setAverageFare(Fare_T iWSAFare) { + _wScheduleAverageFare = iWSAFare; + } + + /** Set the yield. */ + void setYield (const Revenue_T& iWSYield) { + _worldScheduleYield = iWSYield; + } + + /** Set the load factor. */ + void setLoadFactor (const Revenue_T& iWSLF) { + _wScheduleLoadFactor = iWSLF; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -36,13 +137,45 @@ /** Default constructors. */ BomRootContent (); BomRootContent (const BomRootContent&); + BomRootContent (const BomKey_T& iKey); /** Destructor. */ virtual ~BomRootContent(); protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + /** Update/creation date for the World Schedule data. */ + Date_T _updateDate; + + /** Counter of all generated flight dates in the world schedule. */ + NbOfFlightDates_T _flightDateCounter; + + /** Counter of all bookings into the worldSchedule. */ + NbOfBookings_T _bookingCounter; + + /** Total amount of money earn with all flight bookings. */ + Revenue_T _worldScheduleRevenue; + + /** Value of the average fare of the worldcshedule.*/ + Fare_T _wScheduleAverageFare; + + /** Value of the Available Seat Kilometer for the whole worldSchedule.*/ + Distance_T _worldScheduleASK; + + /** Value of the Yield (Revenue/ASK). */ + Revenue_T _worldScheduleYield; + + /** Value of the Revenue Passanger Kilometer for the worldSchedule.*/ + Distance_T _worldScheduleRPK; + + /** Value of the Unit Revenue (Revenue/RPK). */ + Revenue_T _wScheduleUnitRevenue; + + /** Value of the Load Factor (ASK/RPK). */ + Revenue_T _wScheduleLoadFactor; }; } Modified: trunk/stdair/stdair/bom/BomRootStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -11,7 +11,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/BomRootKey.hpp> #include <stdair/bom/InventoryStructure.hpp> namespace stdair { @@ -35,7 +34,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomRootKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; @@ -49,8 +48,9 @@ public: // /////////// Getters ///////////// /** Get the BomRootStructure key. */ - const BomKey_T& getKey() const { - return _key; + const BomKey_T& getKey () const { + assert (_content != NULL); + return _content->getKey (); } /** Get the list of inventories. */ @@ -91,28 +91,24 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } private: /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - BomRootStructure (); + BomRootStructure () : _content (NULL), _childrenList (NULL) { }; BomRootStructure (const BomRootStructure&); - BomRootStructure (const BomKey_T& iKey) { _key = iKey; } /** Destructor. */ ~BomRootStructure () { } private: // Attributes - /** The key of both the structure and content objects. */ - BomKey_T _key; - /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; Modified: trunk/stdair/stdair/bom/BookingClass.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BookingClass.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -10,8 +10,10 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BookingClass::BookingClass (BomStructure_T& ioBookingClassStructure) - : _bookingClassStructure (ioBookingClassStructure) { + BookingClass::BookingClass (const BomKey_T& iKey, + BomStructure_T& ioBookingClassStructure) + : BookingClassContent (iKey), + _bookingClassStructure (ioBookingClassStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -72,7 +72,7 @@ /** Default constructors. */ BookingClass (); BookingClass (const BookingClass&); - BookingClass (BomStructure_T&); + BookingClass (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~BookingClass(); Modified: trunk/stdair/stdair/bom/BookingClassContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BookingClassContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BookingClassContent::BookingClassContent () { + BookingClassContent::BookingClassContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/BookingClassContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BookingClassContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,25 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BookingClassKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline booking class. */ class BookingClassContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BookingClassKey_T BomKey_T; + + public: + // /////////// Getters //////////// + /** Get the booking class key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +48,7 @@ protected: /** Default constructors. */ - BookingClassContent (); + BookingClassContent (const BomKey_T&); BookingClassContent (const BookingClassContent&); /** Destructor. */ @@ -43,6 +56,8 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; }; } Modified: trunk/stdair/stdair/bom/BookingClassStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/BookingClassKey.hpp> namespace stdair { /** Wrapper class aimed at holding the actual content, modeled @@ -27,7 +26,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef BookingClassKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -52,7 +51,8 @@ /** Get the segment-cabin key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey(); } private: @@ -88,19 +88,18 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } private: /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - BookingClassStructure (); + BookingClassStructure () : _parent (NULL), _content (NULL) { } BookingClassStructure (const BookingClassStructure&); - BookingClassStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey){ } /** Destructor. */ virtual ~BookingClassStructure() { } @@ -113,9 +112,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** The key of both the structure and content objects. */ - BomKey_T _key; - }; } Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -19,8 +19,9 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - FlightDate::FlightDate (BomStructure_T& ioFlightStructure) - : _flightDateStructure (ioFlightStructure) { + FlightDate::FlightDate (const BomKey_T& iKey, + BomStructure_T& ioFlightStructure) + : FlightDateContent (iKey), _flightDateStructure (ioFlightStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -97,7 +97,7 @@ /** Default constructors. */ FlightDate (); FlightDate (const FlightDate&); - FlightDate (BomStructure_T&); + FlightDate (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~FlightDate(); Modified: trunk/stdair/stdair/bom/FlightDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/FlightDateContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - FlightDateContent::FlightDateContent () { + FlightDateContent::FlightDateContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/FlightDateContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,25 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/FlightDateKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline flight-date. */ class FlightDateContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FlightDateKey_T BomKey_T; + + public: + // /////////// Getters /////////////// + /** Get the flight-date key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +48,7 @@ protected: /** Default constructors. */ - FlightDateContent (); + FlightDateContent (const BomKey_T&); FlightDateContent (const FlightDateContent&); /** Destructor. */ @@ -43,6 +56,9 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + }; } Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/FlightDateKey.hpp> #include <stdair/bom/SegmentDateStructure.hpp> #include <stdair/bom/LegDateStructure.hpp> @@ -29,7 +28,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef FlightDateKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -71,7 +70,8 @@ /** Get the flight-date key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey(); } /** Get the list of segment-dates. */ @@ -139,11 +139,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } /** Dump the segment-date children list in to an output stream. @param ostream& the output stream. */ @@ -166,11 +166,10 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - FlightDateStructure (); + FlightDateStructure () : _parent (NULL), _content (NULL), + _childrenList (NULL), + _secondChildrenList (NULL) { } FlightDateStructure (const FlightDateStructure&); - FlightDateStructure (const BomKey_T& iKey) - : _parent (NULL), _key (iKey), _childrenList (NULL), - _secondChildrenList (NULL) { } /** Destructor. */ virtual ~FlightDateStructure() { } @@ -183,9 +182,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** The key of both the structure and content objects. */ - BomKey_T _key; - /** List of segment-dates. */ ChildrenBomHolder_T* _childrenList; Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -18,8 +18,9 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - Inventory::Inventory (BomStructure_T& ioInventoryStructure) - : _inventoryStructure (ioInventoryStructure) { + Inventory::Inventory (const BomKey_T& iKey, + BomStructure_T& ioInventoryStructure) + : InventoryContent (iKey), _inventoryStructure (ioInventoryStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -84,7 +84,7 @@ /** Default constructors. */ Inventory (); Inventory (const Inventory&); - Inventory (BomStructure_T&); + Inventory (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~Inventory(); Modified: trunk/stdair/stdair/bom/InventoryContent.cpp =================================================================== --- trunk/stdair/stdair/bom/InventoryContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/InventoryContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - InventoryContent::InventoryContent () { + InventoryContent::InventoryContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/InventoryContent.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/InventoryContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -7,11 +7,17 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/InventoryKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline inventory. */ class InventoryContent : public BomContent { + public : + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef InventoryKey_T BomKey_T; + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -35,6 +41,11 @@ public: // ////////// Getters //////////// + /** Get the inventory key. */ + const BomKey_T& getKey() const { + return _key; + } + /** Get the booking counter. */ const NbOfBookings_T& getBookingCounter () const { return _bookingCounter; @@ -109,7 +120,7 @@ protected: /** Default constructors. */ - InventoryContent (); + InventoryContent (const BomKey_T&); InventoryContent (const InventoryContent&); /** Destructor. */ @@ -117,6 +128,9 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + /** Counter of all bookings into the inventory. */ NbOfBookings_T _bookingCounter; Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -11,7 +11,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/InventoryKey.hpp> #include <stdair/bom/FlightDateStructure.hpp> namespace stdair { @@ -30,7 +29,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef InventoryKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ @@ -63,9 +62,10 @@ return *_parent; } - /** Get the flight-date key. */ + /** Get the inventory key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey (); } /** Get the list of flight-dates. */ @@ -118,11 +118,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } /** Dump the flight-date children list in to an output stream. @param ostream& the output stream. */ @@ -136,11 +136,10 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - InventoryStructure (); - InventoryStructure (const InventoryStructure&); - InventoryStructure (const BomKey_T& iKey) - : _parent (NULL), _key (iKey), _childrenList (NULL) { } + InventoryStructure () : _parent (NULL), _content (NULL), + _childrenList (NULL) { } + InventoryStructure (const InventoryStructure&); /** Destructor. */ virtual ~InventoryStructure() { } @@ -152,9 +151,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** The key of both the structure and content objects. */ - BomKey_T _key; - /** List of flight-dates. */ ChildrenBomHolder_T* _childrenList; }; Modified: trunk/stdair/stdair/bom/LegCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegCabin.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -10,8 +10,8 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - LegCabin::LegCabin (BomStructure_T& ioLegStructure) - : _legCabinStructure (ioLegStructure) { + LegCabin::LegCabin (const BomKey_T& iKey, BomStructure_T& ioLegStructure) + : LegCabinContent (iKey), _legCabinStructure (ioLegStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -65,7 +65,7 @@ /** Default constructors. */ LegCabin (); LegCabin (const LegCabin&); - LegCabin (BomStructure_T&); + LegCabin (const BomKey_T& iKey, BomStructure_T&); /** Destructor. */ virtual ~LegCabin(); Modified: trunk/stdair/stdair/bom/LegCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegCabinContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - LegCabinContent::LegCabinContent () { + LegCabinContent::LegCabinContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegCabinContent.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegCabinContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,25 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/LegCabinKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline leg-cabin. */ class LegCabinContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef LegCabinKey_T BomKey_T; + + public: + // /////////// Getters //////////// + /** Get the leg-cabin key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +48,7 @@ protected: /** Default constructors. */ - LegCabinContent (); + LegCabinContent (const BomKey_T&); LegCabinContent (const LegCabinContent&); /** Destructor. */ @@ -43,6 +56,8 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; }; } Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/LegCabinKey.hpp> #include <stdair/bom/BookingClassStructure.hpp> namespace stdair { @@ -28,7 +27,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef LegCabinKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -53,7 +52,8 @@ /** Get the leg-date key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey(); } private: @@ -89,19 +89,18 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } private: /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - LegCabinStructure (); + LegCabinStructure () : _parent (NULL), _content (NULL) { } LegCabinStructure (const LegCabinStructure&); - LegCabinStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey){ } /** Destructor. */ virtual ~LegCabinStructure() { } @@ -113,10 +112,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - - /** The key of both the structure and content objects. */ - BomKey_T _key; - }; } Modified: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegDate.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -13,8 +13,8 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - LegDate::LegDate (BomStructure_T& ioLegStructure) - : _legDateStructure (ioLegStructure) { + LegDate::LegDate (const BomKey_T& iKey, BomStructure_T& ioLegStructure) + : LegDateContent (iKey), _legDateStructure (ioLegStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -80,7 +80,7 @@ /** Default constructors. */ LegDate (); LegDate (const LegDate&); - LegDate (BomStructure_T&); + LegDate (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~LegDate(); Modified: trunk/stdair/stdair/bom/LegDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegDateContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - LegDateContent::LegDateContent () { + LegDateContent::LegDateContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegDateContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,25 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/LegDateKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline leg-date. */ class LegDateContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef LegDateKey_T BomKey_T; + + public: + // /////////// Getters ///////////// + /** Get the leg-date key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +48,7 @@ protected: /** Default constructors. */ - LegDateContent (); + LegDateContent (const BomKey_T&); LegDateContent (const LegDateContent&); /** Destructor. */ @@ -43,6 +56,8 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; }; } Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/LegDateKey.hpp> #include <stdair/bom/LegCabinStructure.hpp> namespace stdair { @@ -28,7 +27,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef LegDateKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -60,7 +59,8 @@ /** Get the leg-date key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey(); } /** Get the list of leg-cabins. */ @@ -112,11 +112,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } /** Dump the leg-cabin children list in to an output stream. @param ostream& the output stream. */ @@ -130,9 +130,9 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - LegDateStructure (); + LegDateStructure () : _parent (NULL), _content (NULL), + _childrenList (NULL) { } LegDateStructure (const LegDateStructure&); - LegDateStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey) { } /** Destructor. */ virtual ~LegDateStructure() { } @@ -145,9 +145,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** The key of both the structure and content objects. */ - BomKey_T _key; - /** List of leg-cabins. */ ChildrenBomHolder_T* _childrenList; }; Modified: trunk/stdair/stdair/bom/SegmentCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentCabin.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -13,8 +13,9 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - SegmentCabin::SegmentCabin (BomStructure_T& ioSegmentStructure) - : _segmentCabinStructure (ioSegmentStructure) { + SegmentCabin::SegmentCabin (const BomKey_T& iKey, + BomStructure_T& ioSegmentStructure) + : SegmentCabinContent (iKey), _segmentCabinStructure (ioSegmentStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -80,7 +80,7 @@ /** Default constructors. */ SegmentCabin (); SegmentCabin (const SegmentCabin&); - SegmentCabin (BomStructure_T&); + SegmentCabin (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~SegmentCabin(); Modified: trunk/stdair/stdair/bom/SegmentCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - SegmentCabinContent::SegmentCabinContent () { + SegmentCabinContent::SegmentCabinContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentCabinContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentCabinContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,25 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/SegmentCabinKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline segment-cabin. */ class SegmentCabinContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef SegmentCabinKey_T BomKey_T; + + public: + // /////////// Getters ///////////// + /** Get the segment-cabin key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +48,7 @@ protected: /** Default constructors. */ - SegmentCabinContent (); + SegmentCabinContent (const BomKey_T&); SegmentCabinContent (const SegmentCabinContent&); /** Destructor. */ @@ -43,6 +56,9 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + }; } Modified: trunk/stdair/stdair/bom/SegmentCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/SegmentCabinKey.hpp> #include <stdair/bom/BookingClassStructure.hpp> namespace stdair { @@ -28,7 +27,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef SegmentCabinKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -60,7 +59,8 @@ /** Get the segment-date key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey(); } /** Get the list of segment-cabins. */ @@ -112,11 +112,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } /** Dump the segment-cabin children list in to an output stream. @param ostream& the output stream. */ @@ -130,9 +130,9 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - SegmentCabinStructure (); + SegmentCabinStructure () : _parent (NULL), _content (NULL), + _childrenList (NULL) { } SegmentCabinStructure (const SegmentCabinStructure&); - SegmentCabinStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey){ } /** Destructor. */ virtual ~SegmentCabinStructure() { } @@ -144,9 +144,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - - /** The key of both the structure and content objects. */ - BomKey_T _key; /** List of segment-cabins. */ ChildrenBomHolder_T* _childrenList; Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -13,8 +13,9 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - SegmentDate::SegmentDate (BomStructure_T& ioSegmentStructure) - : _segmentDateStructure (ioSegmentStructure) { + SegmentDate::SegmentDate (const BomKey_T& iKey, + BomStructure_T& ioSegmentStructure) + : SegmentDateContent (iKey), _segmentDateStructure (ioSegmentStructure) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -80,7 +80,7 @@ /** Default constructors. */ SegmentDate (); SegmentDate (const SegmentDate&); - SegmentDate (BomStructure_T&); + SegmentDate (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~SegmentDate(); Modified: trunk/stdair/stdair/bom/SegmentDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateContent.cpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentDateContent.cpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - SegmentDateContent::SegmentDateContent () { + SegmentDateContent::SegmentDateContent (const BomKey_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentDateContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -6,12 +6,24 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/SegmentDateKey.hpp> namespace stdair { /** Class representing the actual attributes for an airline segment-date. */ class SegmentDateContent : public BomContent { public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef SegmentDateKey_T BomKey_T; + public: + // /////////// Getters ///////////// + /** Get the segment-date key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -35,7 +47,7 @@ protected: /** Default constructors. */ - SegmentDateContent (); + SegmentDateContent (const BomKey_T&); SegmentDateContent (const SegmentDateContent&); /** Destructor. */ @@ -43,6 +55,10 @@ protected: // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + + }; } Modified: trunk/stdair/stdair/bom/SegmentDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -9,7 +9,6 @@ // STDAIR #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> -#include <stdair/bom/SegmentDateKey.hpp> #include <stdair/bom/SegmentCabinStructure.hpp> namespace stdair { @@ -28,7 +27,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef SegmentDateKey_T BomKey_T; + typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ @@ -60,7 +59,8 @@ /** Get the segment-date key. */ const BomKey_T& getKey() const { - return _key; + assert (_content != NULL); + return _content->getKey (); } /** Get the list of segment-cabins. */ @@ -112,11 +112,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.toString(); } + const std::string describeKey() const { return getKey().toString(); } /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } + const std::string describeShortKey() const { return getKey().toString(); } /** Dump the segment-cabin children list in to an output stream. @param ostream& the output stream. */ @@ -130,9 +130,9 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - SegmentDateStructure (); + SegmentDateStructure () : _parent (NULL), _content (NULL), + _childrenList (NULL) { } SegmentDateStructure (const SegmentDateStructure&); - SegmentDateStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey) { } /** Destructor. */ virtual ~SegmentDateStructure() { } @@ -145,9 +145,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** The key of both the structure and content objects. */ - BomKey_T _key; - /** List of segment-cabins. */ ChildrenBomHolder_T* _childrenList; }; Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -88,12 +88,11 @@ // Create the structure/holder object typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; BOM_STRUCTURE_T& lBomStructure = - FacBomStructure::instance(). - create<typename BOM_CONTENT::BomKey_T, BOM_STRUCTURE_T> (iKey); + FacBomStructure::instance().create<BOM_STRUCTURE_T> (); // The created flight-date content (BomContent) object gets a constant // reference on its corresponding flight-date structure/holder object - BOM_CONTENT* aBomContent_ptr = new BOM_CONTENT (lBomStructure); + BOM_CONTENT* aBomContent_ptr = new BOM_CONTENT (iKey, lBomStructure); assert (aBomContent_ptr != NULL); // The new object is added to the pool of content objects Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-10-20 15:01:20 UTC (rev 54) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) @@ -51,11 +51,11 @@ static FacBomStructure& instance(); /** Create a structure object with the given key. */ - template <typename BOM_KEY, typename BOM_STRUCTURE> - BOM_STRUCTURE& create (const BOM_KEY& iKey) { + template <typename BOM_STRUCTURE> + BOM_STRUCTURE& create () { BOM_STRUCTURE* aBomStructure_ptr = NULL; - aBomStructure_ptr = new BOM_STRUCTURE (iKey); + aBomStructure_ptr = new BOM_STRUCTURE (); assert (aBomStructure_ptr != NULL); // Initialise the children list of the BOM structure. @@ -74,8 +74,9 @@ the parent structure object. . @return bool Whether or not the operation succeeded. */ template <typename BOM_STRUCTURE_CHILD> - static bool linkBomParentWithBomChild (typename BOM_STRUCTURE_CHILD::ParentBomStructure_T& ioBomParent, - BOM_STRUCTURE_CHILD& ioBomChild) { + static bool linkBomParentWithBomChild + (typename BOM_STRUCTURE_CHILD::ParentBomStructure_T& ioBomParent, + BOM_STRUCTURE_CHILD& ioBomChild) { // Set the parent of the child structure object ioBomChild._parent = &ioBomParent; @@ -109,7 +110,7 @@ private: /** Create a bom children holder object with the given children type. */ template <typename BOM_CONTENT_CHILD> - BomChildrenHolderImp<BOM_CONTENT_CHILD>& create () { + BomChildrenHolderImp<BOM_CONTENT_CHILD>& createBomHolder () { BomChildrenHolderImp<BOM_CONTENT_CHILD>* aBomChildrenHolder_ptr = NULL; @@ -134,7 +135,7 @@ typedef typename CHILDREN_TYPE_T::Content_T CONTENT_CHILDREN_T; BomChildrenHolderImp<CONTENT_CHILDREN_T>& lBomChildrenHolder= - instance().create<CONTENT_CHILDREN_T>(); + instance().createBomHolder<CONTENT_CHILDREN_T>(); ioBomStructure.setChildrenList (lBomChildrenHolder); @@ -142,7 +143,7 @@ typedef typename SECOND_CHILDREN_TYPE_T::Content_T SECOND_CONTENT_CHILDREN_T; BomChildrenHolderImp<SECOND_CONTENT_CHILDREN_T>& lSecondBomChildrenHolder = - instance().create<SECOND_CONTENT_CHILDREN_T>(); + instance().createBomHolder<SECOND_CONTENT_CHILDREN_T>(); ioBomStructure.setChildrenList (lSecondBomChildrenHolder); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |