From: <qua...@us...> - 2009-10-09 13:58:08
|
Revision: 39 http://stdair.svn.sourceforge.net/stdair/?rev=39&view=rev Author: quannaus Date: 2009-10-09 13:58:02 +0000 (Fri, 09 Oct 2009) Log Message: ----------- [Dev] Added the content objects. Modified Paths: -------------- trunk/stdair/stdair/bom/BomStructureRoot.hpp trunk/stdair/stdair/bom/FlightDateKey.hpp trunk/stdair/stdair/bom/FlightDateList.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/InventoryList.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegDateKey.hpp trunk/stdair/stdair/bom/LegDateList.hpp trunk/stdair/stdair/bom/SegmentDateKey.hpp trunk/stdair/stdair/bom/SegmentDateList.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/BomRootTypes.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateList.cpp trunk/stdair/stdair/bom/FlightDateMap.cpp trunk/stdair/stdair/bom/FlightDateMap.hpp trunk/stdair/stdair/bom/FlightDateTypes.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryTypes.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateList.cpp trunk/stdair/stdair/bom/LegDateMap.cpp trunk/stdair/stdair/bom/LegDateMap.hpp trunk/stdair/stdair/bom/LegDateTypes.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateList.cpp trunk/stdair/stdair/bom/SegmentDateMap.cpp trunk/stdair/stdair/bom/SegmentDateMap.hpp trunk/stdair/stdair/bom/SegmentDateTypes.hpp Added: trunk/stdair/stdair/bom/BomRootTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootTypes.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,27 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BOMROOTTYPES_HPP +#define __STDAIR_BOM_BOMROOTTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename BOM_CONTENT> class BomStructureRoot; + template <typename BOM_CONTENT> class BomStructureRootKey; + template <typename BOM_CHILD> class BomContentRoot; + class Inventory; + + /** Define the BomContentRoot. */ + typedef BomContentRoot<Inventory> BomContentRoot_T; + + /** Define the BomStructureRoot. */ + typedef BomStructureRoot<BomContentRoot_T> BomStructureRoot_T; + + /** Define the BomStructureRootKey. */ + typedef BomStructureRootKey<BomContentRoot_T> BomStructureRootKey_T; + +} +#endif // __STDAIR_BOM_BOMROOTTYPES_HPP + Modified: trunk/stdair/stdair/bom/BomStructureRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureRoot.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/BomStructureRoot.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -13,7 +13,7 @@ namespace stdair { // Forward declarations. - template <typename BOM_CONTENT> class Inventory; + template <typename BOM_CONTENT> class InventoryStructure; class BomStructureDummy; class BomContentDummy; @@ -38,7 +38,7 @@ typedef BomStructureRootKey<BOM_CONTENT> BomKey_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<Inventory<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; + typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; /** Definition allowing to retrive the default children bom holder type. */ typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; Added: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,81 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STL +#include <iostream> +#include <algorithm> +// STDAIR +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/SegmentDateList.hpp> +#include <stdair/bom/SegmentDateMap.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegDateList.hpp> +#include <stdair/bom/LegDateMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightDate::FlightDate (BomStructure_T& ioFlightStructure) + : _flightDateStructure (ioFlightStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDate::~FlightDate () { + } + + // ////////////////////////////////////////////////////////////////////// + void FlightDate::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void FlightDate::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string FlightDate::toString() const { + std::ostringstream oStr; + + // First, put the key of that level + oStr << describeShortKey() << std::endl; + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string FlightDate::describeKey() const { + return _flightDateStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string FlightDate::describeShortKey() const { + return _flightDateStructure.describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateList_T FlightDate::getSegmentDateList () const { + return SegmentDateList_T (_flightDateStructure); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateMap_T FlightDate::getSegmentDateMap () const { + return SegmentDateMap_T (_flightDateStructure); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T FlightDate::getLegDateList () const { + return LegDateList_T (_flightDateStructure); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateMap_T FlightDate::getLegDateMap () const { + return LegDateMap_T (_flightDateStructure); + } + +} + Added: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,113 @@ +#ifndef __STDAIR_BOM_FLIGHTDATE_HPP +#define __STDAIR_BOM_FLIGHTDATE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomStructureList.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/SegmentDateTypes.hpp> +#include <stdair/bom/LegDateTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + class BomStructure; + class Inventory; + struct SegmentDateList_T; + struct SegmentDateMap_T; + struct LegDateList_T; + struct LegDateMap_T; + + /** Class representing the actual functional/business content for a + flight-date. */ + class FlightDate : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the BomContentRoot class, for all + // the types which require to be specified below + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef Inventory ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef FlightDateStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FlightDateKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef SegmentDate ContentChild_T; + + /** Definition allowing to retrieve the associated second + BOM content child type. */ + typedef LegDate SecondContentChild_T; + + 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; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + public: + // /////////// Getters ///////////// + /** Get a SegmentDateList_T for iteration methods. */ + SegmentDateList_T getSegmentDateList () const; + + /** Get a SegmentDateMap_T for iteration methods. */ + SegmentDateMap_T getSegmentDateMap () const; + + /** Get a LegDateList_T for iteration methods. */ + LegDateList_T getLegDateList () const; + + /** Get a LegDateMap_T for iteration methods. */ + LegDateMap_T getLegDateMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _flightDateStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + FlightDate (); + FlightDate (const FlightDate&); + FlightDate (BomStructure_T&); + + /** Destructor. */ + virtual ~FlightDate(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _flightDateStructure; + }; + +} +#endif // __STDAIR_BOM_FLIGHTDATE_HPP + Modified: trunk/stdair/stdair/bom/FlightDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -12,7 +12,7 @@ // Forward declarations template <typename BOM_CONTENT> - class FlightDate; + class FlightDateStructure; /** Key of flight-date. */ template <typename BOM_CONTENT> @@ -23,7 +23,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM structure type. */ - typedef FlightDate<BOM_CONTENT> BomStructure_T; + typedef FlightDateStructure<BOM_CONTENT> BomStructure_T; public: // /////////// Construction /////////// Added: trunk/stdair/stdair/bom/FlightDateList.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateList.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDateList.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,51 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/InventoryStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/FlightDateList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightDateList_T:: + FlightDateList_T (const InventoryStructure_T& iInventoryStructure) + : _inventoryStructure (iInventoryStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDateList_T:: + FlightDateList_T (const FlightDateList_T& iFDList) + : _inventoryStructure (iFDList._inventoryStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDateList_T::~FlightDateList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateList_T::iterator FlightDateList_T::begin () const { + return _inventoryStructure.flightDateListBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateList_T::iterator FlightDateList_T::end () const { + return _inventoryStructure.flightDateListEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateList_T::reverse_iterator FlightDateList_T::rbegin () const { + return _inventoryStructure.flightDateListRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateList_T::reverse_iterator FlightDateList_T::rend () const { + return _inventoryStructure.flightDateListREnd (); + } + +} + Modified: trunk/stdair/stdair/bom/FlightDateList.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateList.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/FlightDateList.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -4,21 +4,63 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -#include <vector> -#include <list> +// STDAIR +#include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/FlightDateTypes.hpp> namespace stdair { + +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; - /** Forward declarations. */ - class FlightDate; + /** Structure which handles the iterators for a flight-date list. */ + struct FlightDateList_T { - /** Define lists of Flight-Date objects. */ - typedef std::map<std::string, FlightDate*> FlightDateList_T; - typedef std::vector<FlightDate*> FlightDateOrderedList_T; - typedef std::list<const FlightDate*> FlightDateLightList_T; + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the flight-date list iterators. */ + typedef BomIterator_T<FlightDate, + FlightDateStructureList_T::const_iterator> iterator; + typedef BomIterator_T<FlightDate, + FlightDateStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on flight date: + return the iterator at the begining of the list. */ + iterator begin () const; + + /** Initialise the internal iterator on flight date: + return the iterator at the end of the list. */ + iterator end () const; + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the rbegining of the list. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the end of the list. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + FlightDateList_T (); + FlightDateList_T (const FlightDateList_T&); + FlightDateList_T (const InventoryStructure_T&); + + /** Destructor. */ + virtual ~FlightDateList_T(); + + private: + // Attributes + /** Reference structure. */ + const InventoryStructure_T& _inventoryStructure; + }; + } #endif // __STDAIR_BOM_FLIGHTDATELIST_HPP + Added: trunk/stdair/stdair/bom/FlightDateMap.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDateMap.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,51 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/InventoryStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/FlightDateMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightDateMap_T:: + FlightDateMap_T (const InventoryStructure_T& iInventoryStructure) + : _inventoryStructure (iInventoryStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDateMap_T:: + FlightDateMap_T (const FlightDateMap_T& iFDMap) + : _inventoryStructure (iFDMap._inventoryStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDateMap_T::~FlightDateMap_T () { + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateMap_T::iterator FlightDateMap_T::begin () const { + return _inventoryStructure.flightDateMapBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateMap_T::iterator FlightDateMap_T::end () const { + return _inventoryStructure.flightDateMapEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateMap_T::reverse_iterator FlightDateMap_T::rbegin () const { + return _inventoryStructure.flightDateMapRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateMap_T::reverse_iterator FlightDateMap_T::rend () const { + return _inventoryStructure.flightDateMapREnd (); + } + +} + Added: trunk/stdair/stdair/bom/FlightDateMap.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateMap.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDateMap.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_FLIGHTDATEMAP_HPP +#define __STDAIR_BOM_FLIGHTDATEMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/FlightDateTypes.hpp> + +namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + + /** Structure which handles the iterators for a flight-date map. */ + struct FlightDateMap_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the flight-date map iterators. */ + typedef BomIterator_T<FlightDate, + FlightDateStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<FlightDate, + FlightDateStructureMap_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on flight date: + return the iterator at the begining of the map. */ + iterator begin () const; + + /** Initialise the internal iterator on flight date: + return the iterator at the end of the map. */ + iterator end () const; + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the rbegining of the map. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the end of the map. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + FlightDateMap_T (); + FlightDateMap_T (const FlightDateMap_T&); + FlightDateMap_T (const InventoryStructure_T&); + + /** Destructor. */ + virtual ~FlightDateMap_T(); + + private: + // Attributes + /** Reference structure. */ + const InventoryStructure_T& _inventoryStructure; + }; + +} +#endif // __STDAIR_BOM_FLIGHTDATEMAP_HPP + Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -16,7 +16,7 @@ namespace stdair { // Forward declaration - template <typename BOM_CONTENT> class Inventory; + template <typename BOM_CONTENT> class InventoryStructure; class BomContentDummy; /** Wrapper class aimed at holding the actual content, modeled Added: trunk/stdair/stdair/bom/FlightDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDateTypes.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FLIGHTDATETYPES_HPP +#define __STDAIR_BOM_FLIGHTDATETYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class FlightDateStructure; + template <typename BOM_CONTENT> class FlightDateKey; + class FlightDate; + + /** Define the FlightDate structure. */ + typedef FlightDateStructure<FlightDate> FlightDateStructure_T; + + /** Define the FlightDate key. */ + typedef FlightDateKey<FlightDate> FlightDateKey_T; + + /** Define the flight-date structure list. */ + typedef std::vector<FlightDateStructure_T*> FlightDateStructureList_T; + + /** Define the flight-date structure map. */ + typedef std::map<const std::string, FlightDateStructure_T*> FlightDateStructureMap_T; + +} +#endif // __STDAIR_BOM_FLIGHTDATETYPES_HPP + Added: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp (rev 0) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,65 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/InventoryStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/FlightDateList.hpp> +#include <stdair/bom/FlightDateMap.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/LegDate.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + Inventory::Inventory (BomStructure_T& ioInventoryStructure) + : _inventoryStructure (ioInventoryStructure) { + } + + // //////////////////////////////////////////////////////////////////// + Inventory::~Inventory () { + } + + // ////////////////////////////////////////////////////////////////////// + void Inventory::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void Inventory::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string Inventory::toString() const { + std::ostringstream oStr; + + _inventoryStructure.describeFull (oStr); + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Inventory::describeKey() const { + return _inventoryStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Inventory::describeShortKey() const { + return _inventoryStructure.describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateList_T Inventory::getFlightDateList () const { + return FlightDateList_T (_inventoryStructure); + } + + // ////////////////////////////////////////////////////////////////////// + FlightDateMap_T Inventory::getFlightDateMap () const { + return FlightDateMap_T (_inventoryStructure); + } + +} + Added: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp (rev 0) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,101 @@ +#ifndef __STDAIR_BOM_INVENTORY_HPP +#define __STDAIR_BOM_INVENTORY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BomContentRoot.hpp> +#include <stdair/bom/BomRootTypes.hpp> +#include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/FlightDateTypes.hpp> + +namespace stdair { + + // Forward declarations + class FacBomContent; + class FlightDate; + struct FlightDateList_T; + struct FlightDateMap_T; + + /** Class representing the actual functional/business content for + an airline inventory. */ + class Inventory : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the BomContentRoot class, for all + // the types which require to be specified below + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef BomContentRoot_T ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef InventoryStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef InventoryKey_T BomKey_T; + + /** Definition allowing to retrieve the associated BOM content child + type. */ + typedef FlightDate ContentChild_T; + // ///////////////////////////////////////////////////////////////////////// + + 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; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + public: + // /////////// Getters ///////////// + /** Get a FlightDateList_T for iteration methods. */ + FlightDateList_T getFlightDateList () const; + + /** Get a FlightDateMap_T for iteration methods. */ + FlightDateMap_T getFlightDateMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _inventoryStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + Inventory (); + Inventory (const Inventory&); + Inventory (BomStructure_T&); + + /** Destructor. */ + virtual ~Inventory(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _inventoryStructure; + }; + +} +#endif // __STDAIR_BOM_INVENTORY_HPP + Modified: trunk/stdair/stdair/bom/InventoryKey.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/InventoryKey.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -11,7 +11,7 @@ namespace stdair { // Forward declarations - template<typename BOM_CONTENT> class Inventory; + template<typename BOM_CONTENT> class InventoryStructure; /** Key of flight-date. */ template <typename BOM_CONTENT> @@ -22,7 +22,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM structure type. */ - typedef Inventory<BOM_CONTENT> BomStructure_T; + typedef InventoryStructure<BOM_CONTENT> BomStructure_T; public: // /////////// Construction /////////// Modified: trunk/stdair/stdair/bom/InventoryList.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryList.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/InventoryList.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -15,10 +15,5 @@ /** Forward declarations. */ class Inventory; - /** Define lists of Inventory objects. */ - typedef std::map<std::string, Inventory*> InventoryList_T; - typedef std::vector<Inventory*> InventoryOrderedList_T; - typedef std::list<const Inventory*> InventoryLightList_T; - } #endif // __STDAIR_BOM_INVENTORYLIST_HPP Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -48,7 +48,7 @@ typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<FlightDate<ContentChild_T>, + typedef boost::mpl::vector<FlightDateStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; /** Define the default children bom holder type. */ Added: trunk/stdair/stdair/bom/InventoryTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/InventoryTypes.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_INVENTORYTYPES_HPP +#define __STDAIR_BOM_INVENTORYTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <vector> +#include <map> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class InventoryStructure; + template <typename BOM_CONTENT> class InventoryKey; + class Inventory; + + /** Define the Inventory structure. */ + typedef InventoryStructure<Inventory> InventoryStructure_T; + + /** Define the Inventory key. */ + typedef InventoryKey<Inventory> InventoryKey_T; + + /** Define the flight-date structure list. */ + typedef std::vector<InventoryStructure_T*> InventoryStructureList_T; + + /** Define the flight-date structure map. */ + typedef std::map<const std::string, InventoryStructure_T*> InventoryStructureMap_T; + +} +#endif // __STDAIR_BOM_INVENTORYTYPES_HPP + Added: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegDate.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,55 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/LegDateStructure.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/LegDate.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegDate::LegDate (BomStructure_T& ioLegStructure) + : _legDateStructure (ioLegStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegDate::~LegDate () { + } + + // ////////////////////////////////////////////////////////////////////// + void LegDate::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void LegDate::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string LegDate::toString() const { + std::ostringstream oStr; + + // First, put the key of that level + oStr << describeShortKey() << std::endl; + + // Then, browse the children + // [...] (no child for now) + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string LegDate::describeKey() const { + return _legDateStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string LegDate::describeShortKey() const { + return _legDateStructure.describeShortKey(); + } + +} + Added: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,80 @@ +#ifndef __STDAIR_BOM_LEGDATE_HPP +#define __STDAIR_BOM_LEGDATE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/LegDateTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + class FlightDate; + + /** Class representing the actual functional/business content for a + leg-date. */ + class LegDate : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef FlightDate ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef LegDateStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef LegDateKey_T BomKey_T; + + 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; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _legDateStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + LegDate (); + LegDate (const LegDate&); + LegDate (BomStructure_T&); + + /** Destructor. */ + virtual ~LegDate(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _legDateStructure; + }; + +} +#endif // __STDAIR_BOM_LEGDATE_HPP + Modified: trunk/stdair/stdair/bom/LegDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateKey.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/LegDateKey.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -12,7 +12,7 @@ // Forward declarations template <typename BOM_CONTENT> - class LegDate; + class LegDateStructure; /** Key of leg-date. */ template <typename BOM_CONTENT> @@ -23,7 +23,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM structure type. */ - typedef LegDate<BOM_CONTENT> BomStructure_T; + typedef LegDateStructure<BOM_CONTENT> BomStructure_T; public: // /////////// Construction /////////// Added: trunk/stdair/stdair/bom/LegDateList.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateList.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegDateList.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,53 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegDateList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegDateList_T:: + LegDateList_T (const FlightDateStructure_T& iFlightDateStructure) + : _flightDateStructure (iFlightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegDateList_T:: + LegDateList_T (const LegDateList_T& iSDList) + : _flightDateStructure (iSDList._flightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegDateList_T::~LegDateList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T::iterator LegDateList_T::begin () const { + return _flightDateStructure.legDateListBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T::iterator LegDateList_T::end () const { + return _flightDateStructure.legDateListEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T::reverse_iterator LegDateList_T::rbegin () const { + return _flightDateStructure.legDateListRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T::reverse_iterator LegDateList_T::rend () const { + return _flightDateStructure.legDateListREnd (); + } + +} + Modified: trunk/stdair/stdair/bom/LegDateList.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateList.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/LegDateList.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -4,21 +4,62 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -#include <vector> -#include <list> +// STDAIR +#include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/LegDateTypes.hpp> namespace stdair { + // Forward declarations. + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; - /** Forward declarations. */ - class LegDate; + /** Structure which handles the iterators for a leg-date list. */ + struct LegDateList_T { - /** Define lists of Leg-Date objects. */ - typedef std::map<std::string, LegDate*> LegDateList_T; - typedef std::vector<LegDate*> LegDateOrderedList_T; - typedef std::list<const LegDate*> LegDateLightList_T; + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the leg-date list iterators. */ + typedef BomIterator_T<LegDate, + LegDateStructureList_T::const_iterator> iterator; + typedef BomIterator_T<LegDate, + LegDateStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on leg date: + return the iterator at the begining of the list. */ + iterator begin () const; + + /** Initialise the internal iterator on leg date: + return the iterator at the end of the list. */ + iterator end () const; + + /** Initialise the internal reverse iterator on leg date: + return the reverse iterator at the rbegining of the list. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on leg date: + return the reverse iterator at the end of the list. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + LegDateList_T (); + LegDateList_T (const LegDateList_T&); + LegDateList_T (const FlightDateStructure_T&); + + /** Destructor. */ + virtual ~LegDateList_T(); + + private: + // Attributes + /** Reference structure. */ + const FlightDateStructure_T& _flightDateStructure; + }; + } #endif // __STDAIR_BOM_LEGDATELIST_HPP + Added: trunk/stdair/stdair/bom/LegDateMap.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegDateMap.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,53 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegDateMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegDateMap_T:: + LegDateMap_T (const FlightDateStructure_T& iFlightDateStructure) + : _flightDateStructure (iFlightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegDateMap_T:: + LegDateMap_T (const LegDateMap_T& iSDMap) + : _flightDateStructure (iSDMap._flightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegDateMap_T::~LegDateMap_T () { + } + + // ////////////////////////////////////////////////////////////////////// + LegDateMap_T::iterator LegDateMap_T::begin () const { + return _flightDateStructure.legDateMapBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateMap_T::iterator LegDateMap_T::end () const { + return _flightDateStructure.legDateMapEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateMap_T::reverse_iterator LegDateMap_T::rbegin () const { + return _flightDateStructure.legDateMapRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegDateMap_T::reverse_iterator LegDateMap_T::rend () const { + return _flightDateStructure.legDateMapREnd (); + } + +} + Added: trunk/stdair/stdair/bom/LegDateMap.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateMap.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegDateMap.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_LEGDATEMAP_HPP +#define __STDAIR_BOM_LEGDATEMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/LegDateTypes.hpp> + +namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + + /** Structure which handles the iterators for a leg-date map. */ + struct LegDateMap_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the leg-date map iterators. */ + typedef BomIterator_T<LegDate, + LegDateStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<LegDate, + LegDateStructureMap_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on leg date: + return the iterator at the begining of the map. */ + iterator begin () const; + + /** Initialise the internal iterator on leg date: + return the iterator at the end of the map. */ + iterator end () const; + + /** Initialise the internal reverse iterator on leg date: + return the reverse iterator at the rbegining of the map. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on leg date: + return the reverse iterator at the end of the map. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + LegDateMap_T (); + LegDateMap_T (const LegDateMap_T&); + LegDateMap_T (const FlightDateStructure_T&); + + /** Destructor. */ + virtual ~LegDateMap_T(); + + private: + // Attributes + /** Reference structure. */ + const FlightDateStructure_T& _flightDateStructure; + }; + +} +#endif // __STDAIR_BOM_LEGDATEMAP_HPP + Added: trunk/stdair/stdair/bom/LegDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegDateTypes.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_LEGDATETYPES_HPP +#define __STDAIR_BOM_LEGDATETYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class LegDateStructure; + template <typename BOM_CONTENT> class LegDateKey; + class LegDate; + + /** Define the LegDate structure. */ + typedef LegDateStructure<LegDate> LegDateStructure_T; + + /** Define the LegDate key. */ + typedef LegDateKey<LegDate> LegDateKey_T; + + /** Define the leg-date structure list. */ + typedef std::vector<LegDateStructure_T*> LegDateStructureList_T; + + /** Define the leg-date structure map. */ + typedef std::map<const std::string, LegDateStructure_T*> LegDateStructureMap_T; + +} +#endif // __STDAIR_BOM_LEGDATETYPES_HPP + Added: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,55 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/SegmentDateStructure.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + SegmentDate::SegmentDate (BomStructure_T& ioSegmentStructure) + : _segmentDateStructure (ioSegmentStructure) { + } + + // //////////////////////////////////////////////////////////////////// + SegmentDate::~SegmentDate () { + } + + // ////////////////////////////////////////////////////////////////////// + void SegmentDate::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void SegmentDate::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string SegmentDate::toString() const { + std::ostringstream oStr; + + // First, put the key of that level + oStr << describeShortKey() << std::endl; + + // Then, browse the children + // [...] (no child for now) + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string SegmentDate::describeKey() const { + return _segmentDateStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string SegmentDate::describeShortKey() const { + return _segmentDateStructure.describeShortKey(); + } + +} + Added: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,80 @@ +#ifndef __STDAIR_BOM_SEGMENTDATE_HPP +#define __STDAIR_BOM_SEGMENTDATE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/SegmentDateTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + class FlightDate; + + /** Class representing the actual functional/business content for a + segment-date. */ + class SegmentDate : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef FlightDate ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef SegmentDateStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef SegmentDateKey_T BomKey_T; + + 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; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _segmentDateStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + SegmentDate (); + SegmentDate (const SegmentDate&); + SegmentDate (BomStructure_T&); + + /** Destructor. */ + virtual ~SegmentDate(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _segmentDateStructure; + }; + +} +#endif // __STDAIR_BOM_SEGMENTDATE_HPP + Modified: trunk/stdair/stdair/bom/SegmentDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -12,7 +12,7 @@ // Forward declarations template <typename BOM_CONTENT> - class SegmentDate; + class SegmentDateStructure; /** Key of segment-date. */ template <typename BOM_CONTENT> @@ -23,7 +23,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM structure type. */ - typedef SegmentDate<BOM_CONTENT> BomStructure_T; + typedef SegmentDateStructure<BOM_CONTENT> BomStructure_T; public: // /////////// Construction /////////// Added: trunk/stdair/stdair/bom/SegmentDateList.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateList.cpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentDateList.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,53 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/SegmentDateList.hpp> +#include <stdair/bom/LegDate.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + SegmentDateList_T:: + SegmentDateList_T (const FlightDateStructure_T& iFlightDateStructure) + : _flightDateStructure (iFlightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + SegmentDateList_T:: + SegmentDateList_T (const SegmentDateList_T& iSDList) + : _flightDateStructure (iSDList._flightDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + SegmentDateList_T::~SegmentDateList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateList_T::iterator SegmentDateList_T::begin () const { + return _flightDateStructure.segmentDateListBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateList_T::iterator SegmentDateList_T::end () const { + return _flightDateStructure.segmentDateListEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateList_T::reverse_iterator SegmentDateList_T::rbegin () const { + return _flightDateStructure.segmentDateListRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDateList_T::reverse_iterator SegmentDateList_T::rend () const { + return _flightDateStructure.segmentDateListREnd (); + } + +} + Modified: trunk/stdair/stdair/bom/SegmentDateList.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateList.hpp 2009-10-09 13:07:14 UTC (rev 38) +++ trunk/stdair/stdair/bom/SegmentDateList.hpp 2009-10-09 13:58:02 UTC (rev 39) @@ -4,21 +4,62 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -#include <vector> -#include <list> +// STDAIR +#include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/SegmentDateTypes.hpp> namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; - /** Forward declarations. */ - class SegmentDate; + /** Structure which handles the iterators for a segment-date list. */ + struct SegmentDateList_T { - /** Define lists of Segment-Date objects. */ - typedef std::map<std::string, SegmentDate*> SegmentDateList_T; - typedef std::vector<SegmentDate*> SegmentDateOrderedList_T; - typedef std::list<const SegmentDate*> SegmentDateLightList_T; + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the segment-date list iterators. */ + typedef BomIterator_T<SegmentDate, + SegmentDateStructureList_T::const_iterator> iterator; + typedef BomIterator_T<SegmentDate, + SegmentDateStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on segment date: + return the iterator at the begining of the list. */ + iterator begin () const; + + /** Initialise the internal iterator on segment date: + return the iterator at the end of the list. */ + iterator end () const; + + /** Initialise the internal reverse iterator on segment date: + return the reverse iterator at the rbegining of the list. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on segment date: + return the reverse iterator at the end of the list. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + SegmentDateList_T (); + SegmentDateList_T (const SegmentDateList_T&); + SegmentDateList_T (const FlightDateStructure_T&); + + /** Destructor. */ + virtual ~SegmentDateList_T(); + + private: + // Attributes + /** Reference structure. */ + const FlightDateStructure_T& _flightDateStructure; + }; + } #endif // __STDAIR_BOM_SEGMENTDATELIST_HPP + Added: trunk/stdair/stdair/bom/SegmentDateMap.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentDateMap.cpp 2009-10-09 13:58:02 UTC (rev 39) @@ -0,0 +1,53 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// /////////////////////////////////////////////////////////////////... [truncated message content] |