From: <qua...@us...> - 2009-10-12 13:35:39
|
Revision: 42 http://stdair.svn.sourceforge.net/stdair/?rev=42&view=rev Author: quannaus Date: 2009-10-12 13:35:33 +0000 (Mon, 12 Oct 2009) Log Message: ----------- [Dev] Added SegmentCabin, LegCabin, BookingClass. Definately need to have some test (implementation). Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/BookingClass.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/BookingClassList.cpp trunk/stdair/stdair/bom/BookingClassList.hpp trunk/stdair/stdair/bom/BookingClassMap.cpp trunk/stdair/stdair/bom/BookingClassMap.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/LegCabinList.cpp trunk/stdair/stdair/bom/LegCabinList.hpp trunk/stdair/stdair/bom/LegCabinMap.cpp trunk/stdair/stdair/bom/LegCabinMap.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegCabinTypes.hpp trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/SegmentCabinList.cpp trunk/stdair/stdair/bom/SegmentCabinList.hpp trunk/stdair/stdair/bom/SegmentCabinMap.cpp trunk/stdair/stdair/bom/SegmentCabinMap.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentCabinTypes.hpp Removed Paths: ------------- trunk/stdair/stdair/bom/BomStructureList.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -54,6 +54,12 @@ /** Define the type for flight numbers. */ typedef unsigned int FlightNumber_T; + /** Define the type for cabin codes. */ + typedef std::string CabinCode_T; + + /** Define the type for class codes. */ + typedef std::string ClassCode_T; + /** Define the type for durations (e.g., elapsed in-flight time). */ typedef boost::posix_time::time_duration Duration_T; Deleted: trunk/stdair/stdair/bom/BomStructureList.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureList.hpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/BomStructureList.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -1,24 +0,0 @@ -#ifndef __STDAIR_BOM_BOMSTRUCTURELIST_HPP -#define __STDAIR_BOM_BOMSTRUCTURELIST_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -#include <vector> -#include <list> - -namespace stdair { - - /** Forward declarations. */ - class BomStructure; - - /** Define lists of Bom-Structure objects. */ - typedef std::map<std::string, BomStructure*> BomStructureList_T; - typedef std::vector<BomStructure*> BomStructureOrderedList_T; - typedef std::list<const BomStructure*> BomStructureLightList_T; - -} -#endif // __STDAIR_BOM_BOMSTRUCTURELIST_HPP Copied: trunk/stdair/stdair/bom/BookingClass.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClass.cpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClass.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,56 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/BookingClassStructure.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/BookingClass.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BookingClass::BookingClass (BomStructure_T& ioBookingClassStructure) + : _bookingClassStructure (ioBookingClassStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClass::~BookingClass () { + } + + // ////////////////////////////////////////////////////////////////////// + void BookingClass::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void BookingClass::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string BookingClass::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 BookingClass::describeKey() const { + return _bookingClassStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string BookingClass::describeShortKey() const { + return _bookingClassStructure.describeShortKey(); + } + +} + Copied: trunk/stdair/stdair/bom/BookingClass.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDate.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,86 @@ +#ifndef __STDAIR_BOM_BOOKINGCLASS_HPP +#define __STDAIR_BOM_BOOKINGCLASS_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/SegmentCabinTypes.hpp> +#include <stdair/bom/BookingClassTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + class SegmentCabin; + struct BookingClassList_T; + struct BookingClassMap_T; + + /** Class representing the actual functional/business content for a + segment-cabin. */ + class BookingClass : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef SegmentCabin ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BookingClassStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BookingClassKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef BookingClass 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; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _bookingClassStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BookingClass (); + BookingClass (const BookingClass&); + BookingClass (BomStructure_T&); + + /** Destructor. */ + virtual ~BookingClass(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _bookingClassStructure; + }; + +} +#endif // __STDAIR_BOM_BOOKINGCLASS_HPP + Copied: trunk/stdair/stdair/bom/BookingClassKey.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassKey.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,74 @@ +#ifndef __STDAIR_BOM_BOOKINGCLASSKEY_HPP +#define __STDAIR_BOM_BOOKINGCLASSKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT> + class BookingClassStructure; + + /** Key of segment-cabin. */ + template <typename BOM_CONTENT> + class BookingClassKey : public BomKey { + friend class FacBomStructure; + friend class FacBomContent; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BookingClassStructure<BOM_CONTENT> BomStructure_T; + + public: + // /////////// Construction /////////// + /** Constructor. */ + BookingClassKey (const ClassCode_T& iClassCode) + : _classCode (iClassCode) { + } + + /** Destructor. */ + ~BookingClassKey () { } + + // /////////// Getters ////////// + /** Get the cabin code. */ + const ClassCode_T& getClassCode () const { + return _classCode; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << "BookingClassKey: " << toString() << std::endl; + } + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { } + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-cabin. */ + std::string toString() const { + std::ostringstream oStr; + oStr << _classCode; + return oStr.str(); + } + + + private: + // Attributes + /** Cabin code. */ + ClassCode_T _classCode; + }; + +} +#endif // __STDAIR_BOM_BOOKINGCLASSKEY_HPP Copied: trunk/stdair/stdair/bom/BookingClassList.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateList.cpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassList.cpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassList.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,52 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/SegmentCabinStructure.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/BookingClass.hpp> +#include <stdair/bom/BookingClassList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BookingClassList_T:: + BookingClassList_T (const SegmentCabinStructure_T& iSegmentCabinStructure) + : _segmentCabinStructure (iSegmentCabinStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClassList_T:: + BookingClassList_T (const BookingClassList_T& iSCList) + : _segmentCabinStructure (iSCList._segmentCabinStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClassList_T::~BookingClassList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassList_T::iterator BookingClassList_T::begin () const { + return _segmentCabinStructure.bookingClassListBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassList_T::iterator BookingClassList_T::end () const { + return _segmentCabinStructure.bookingClassListEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassList_T::reverse_iterator BookingClassList_T::rbegin () const { + return _segmentCabinStructure.bookingClassListRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassList_T::reverse_iterator BookingClassList_T::rend () const { + return _segmentCabinStructure.bookingClassListREnd (); + } + +} + Copied: trunk/stdair/stdair/bom/BookingClassList.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateList.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassList.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassList.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_BOOKINGCLASSLIST_HPP +#define __STDAIR_BOM_BOOKINGCLASSLIST_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/SegmentCabinTypes.hpp> +#include <stdair/bom/BookingClassTypes.hpp> + +namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + + /** Structure which handles the iterators for a segment-cabin list. */ + struct BookingClassList_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the segment-cabin list iterators. */ + typedef BomIterator_T<BookingClass, + BookingClassStructureList_T::const_iterator> iterator; + typedef BomIterator_T<BookingClass, + BookingClassStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on segment cabin: + return the iterator at the begining of the list. */ + iterator begin () const; + + /** Initialise the internal iterator on segment cabin: + return the iterator at the end of the list. */ + iterator end () const; + + /** Initialise the internal reverse iterator on segment cabin: + return the reverse iterator at the rbegining of the list. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on segment cabin: + return the reverse iterator at the end of the list. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + BookingClassList_T (); + BookingClassList_T (const BookingClassList_T&); + BookingClassList_T (const SegmentCabinStructure_T&); + + /** Destructor. */ + virtual ~BookingClassList_T(); + + private: + // Attributes + /** Reference structure. */ + const SegmentCabinStructure_T& _segmentCabinStructure; + }; + +} +#endif // __STDAIR_BOM_BOOKINGCLASSLIST_HPP + Copied: trunk/stdair/stdair/bom/BookingClassMap.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateMap.cpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassMap.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,52 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/SegmentCabinStructure.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/BookingClass.hpp> +#include <stdair/bom/BookingClassMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BookingClassMap_T:: + BookingClassMap_T (const SegmentCabinStructure_T& iSegmentCabinStructure) + : _segmentCabinStructure (iSegmentCabinStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClassMap_T:: + BookingClassMap_T (const BookingClassMap_T& iSCMap) + : _segmentCabinStructure (iSCMap._segmentCabinStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClassMap_T::~BookingClassMap_T () { + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T::iterator BookingClassMap_T::begin () const { + return _segmentCabinStructure.bookingClassMapBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T::iterator BookingClassMap_T::end () const { + return _segmentCabinStructure.bookingClassMapEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T::reverse_iterator BookingClassMap_T::rbegin () const { + return _segmentCabinStructure.bookingClassMapRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T::reverse_iterator BookingClassMap_T::rend () const { + return _segmentCabinStructure.bookingClassMapREnd (); + } + +} + Copied: trunk/stdair/stdair/bom/BookingClassMap.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateMap.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassMap.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassMap.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_BOOKINGCLASSMAP_HPP +#define __STDAIR_BOM_BOOKINGCLASSMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/SegmentCabinTypes.hpp> +#include <stdair/bom/BookingClassTypes.hpp> + +namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + + /** Structure which handles the iterators for a segment-cabin map. */ + struct BookingClassMap_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the segment-cabin map iterators. */ + typedef BomIterator_T<BookingClass, + BookingClassStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<BookingClass, + BookingClassStructureMap_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on segment cabin: + return the iterator at the begining of the map. */ + iterator begin () const; + + /** Initialise the internal iterator on segment cabin: + return the iterator at the end of the map. */ + iterator end () const; + + /** Initialise the internal reverse iterator on segment cabin: + return the reverse iterator at the rbegining of the map. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on segment cabin: + return the reverse iterator at the end of the map. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + BookingClassMap_T (); + BookingClassMap_T (const BookingClassMap_T&); + BookingClassMap_T (const SegmentCabinStructure_T&); + + /** Destructor. */ + virtual ~BookingClassMap_T(); + + private: + // Attributes + /** Reference structure. */ + const SegmentCabinStructure_T& _segmentCabinStructure; + }; + +} +#endif // __STDAIR_BOM_BOOKINGCLASSMAP_HPP + Copied: trunk/stdair/stdair/bom/BookingClassStructure.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateStructure.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,128 @@ +#ifndef __STDAIR_BOM_BOOKINGCLASSSTRUCTURE_HPP +#define __STDAIR_BOM_BOOKINGCLASSSTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/BookingClassKey.hpp> +#include <stdair/bom/BomChildrenHolderImp.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT> class SegmentCabinStructure; + class BomStructureDummy; + class BomContentDummy; + + /** Wrapper class aimed at holding the actual content, modeled + by an external specific BookingClass class (for instance, + in the AIRSCHED library). */ + template <class BOM_CONTENT> + class BookingClassStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BookingClassKey<BOM_CONTENT> BomKey_T; + + /** Definition allowing to retrieve the associated parent + BOM structure type. */ + typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector <BomStructureDummy, + BomStructureDummy> ChildrenBomTypeList_T; + + /** Definition allowing to retrieve the default children bom holder type. */ + typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + + public: + // /////////// Getters ///////////// + /** Get the (parent) SegmentCabinStructure object. */ + ParentBomStructure_T* getSegmentCabinStructurePtr() const { + return _parent; + } + + /** Get the (parent) SegmentCabinStructure object. */ + ParentBomStructure_T& getSegmentCabinStructure() const; + + /** Get the segment-cabin key. */ + const BomKey_T& getKey() const { + return _key; + } + + private: + // /////////// Setters ///////////// + /** Set the (parent) SegmentCabinStructure object. */ + void setSegmentCabinStructure(ParentBomStructure_T& ioSegmentCabinStructure){ + _parent = &ioSegmentCabinStructure; + } + + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** Dump a Business Object with all its children into an output stream. + @param ostream& the output stream. */ + void describeFull (std::ostringstream& ioOut) const { + ioOut << describeShortKey () << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BookingClassStructure (); + BookingClassStructure (const BookingClassStructure&); + BookingClassStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey){ } + + /** Destructor. */ + virtual ~BookingClassStructure() { } + + private: + // Attributes + /** Parent segment-cabin. */ + ParentBomStructure_T* _parent; + + /** The actual functional (Business Object) content. */ + BOM_CONTENT* _content; + + /** The key of both the structure and content objects. */ + BomKey_T _key; + + }; + +} +#endif // __STDAIR_BOM_BOOKINGCLASSSTRUCTURE_HPP Copied: trunk/stdair/stdair/bom/BookingClassTypes.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/BookingClassTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassTypes.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BOOKINGCLASSTYPES_HPP +#define __STDAIR_BOM_BOOKINGCLASSTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class BookingClassStructure; + template <typename BOM_CONTENT> class BookingClassKey; + class BookingClass; + + /** Define the BookingClass structure. */ + typedef BookingClassStructure<BookingClass> BookingClassStructure_T; + + /** Define the BookingClass key. */ + typedef BookingClassKey<BookingClass> BookingClassKey_T; + + /** Define the segment-cabin structure list. */ + typedef std::vector<BookingClassStructure_T*> BookingClassStructureList_T; + + /** Define the segment-cabin structure map. */ + typedef std::map<const std::string, BookingClassStructure_T*> BookingClassStructureMap_T; + +} +#endif // __STDAIR_BOM_BOOKINGCLASSTYPES_HPP + Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -5,7 +5,6 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STDAIR -#include <stdair/bom/BomStructureList.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/FlightDateTypes.hpp> #include <stdair/bom/SegmentDateTypes.hpp> Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -11,6 +11,9 @@ #include <stdair/bom/FlightDateMap.hpp> #include <stdair/bom/SegmentDate.hpp> #include <stdair/bom/LegDate.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/BookingClass.hpp> namespace stdair { Copied: trunk/stdair/stdair/bom/LegCabin.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabin.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabin.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,55 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/LegCabinStructure.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegCabin.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegCabin::LegCabin (BomStructure_T& ioLegStructure) + : _legCabinStructure (ioLegStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabin::~LegCabin () { + } + + // ////////////////////////////////////////////////////////////////////// + void LegCabin::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void LegCabin::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string LegCabin::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 LegCabin::describeKey() const { + return _legCabinStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string LegCabin::describeShortKey() const { + return _legCabinStructure.describeShortKey(); + } + +} + Copied: trunk/stdair/stdair/bom/LegCabin.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDate.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,79 @@ +#ifndef __STDAIR_BOM_LEGCABIN_HPP +#define __STDAIR_BOM_LEGCABIN_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/LegCabinTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + class LegDate; + + /** Class representing the actual functional/business content for a + leg-date. */ + class LegCabin : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef LegDate ParentBomContent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef LegCabinStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef LegCabinKey_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 _legCabinStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + LegCabin (); + LegCabin (const LegCabin&); + LegCabin (BomStructure_T&); + + /** Destructor. */ + virtual ~LegCabin(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _legCabinStructure; + }; + +} +#endif // __STDAIR_BOM_LEGCABIN_HPP + Copied: trunk/stdair/stdair/bom/LegCabinKey.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinKey.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,74 @@ +#ifndef __STDAIR_BOM_LEGCABINKEY_HPP +#define __STDAIR_BOM_LEGCABINKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT> + class LegCabinStructure; + + /** Key of leg-cabin. */ + template <typename BOM_CONTENT> + class LegCabinKey : public BomKey { + friend class FacBomStructure; + friend class FacBomContent; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef LegCabinStructure<BOM_CONTENT> BomStructure_T; + + public: + // /////////// Construction /////////// + /** Constructor. */ + LegCabinKey (const CabinCode_T& iCabinCode) + : _cabinCode (iCabinCode) { + } + + /** Destructor. */ + ~LegCabinKey () { } + + // /////////// Getters ////////// + /** Get the cabin code. */ + const CabinCode_T& getCabinCode () const { + return _cabinCode; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << "LegCabinKey: " << toString() << std::endl; + } + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { } + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same leg-cabin. */ + std::string toString() const { + std::ostringstream oStr; + oStr << _cabinCode; + return oStr.str(); + } + + + private: + // Attributes + /** Cabin code. */ + CabinCode_T _cabinCode; + }; + +} +#endif // __STDAIR_BOM_LEGCABINKEY_HPP Copied: trunk/stdair/stdair/bom/LegCabinList.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateList.cpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinList.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinList.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,52 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/LegDateStructure.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/LegCabinList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegCabinList_T:: + LegCabinList_T (const LegDateStructure_T& iLegDateStructure) + : _legDateStructure (iLegDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabinList_T:: + LegCabinList_T (const LegCabinList_T& iSCList) + : _legDateStructure (iSCList._legDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabinList_T::~LegCabinList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinList_T::iterator LegCabinList_T::begin () const { + return _legDateStructure.legCabinListBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinList_T::iterator LegCabinList_T::end () const { + return _legDateStructure.legCabinListEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinList_T::reverse_iterator LegCabinList_T::rbegin () const { + return _legDateStructure.legCabinListRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinList_T::reverse_iterator LegCabinList_T::rend () const { + return _legDateStructure.legCabinListREnd (); + } + +} + Copied: trunk/stdair/stdair/bom/LegCabinList.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateList.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinList.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinList.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_LEGCABINLIST_HPP +#define __STDAIR_BOM_LEGCABINLIST_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/LegDateTypes.hpp> +#include <stdair/bom/LegCabinTypes.hpp> + +namespace stdair { +// Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + + /** Structure which handles the iterators for a leg-cabin list. */ + struct LegCabinList_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the leg-cabin list iterators. */ + typedef BomIterator_T<LegCabin, + LegCabinStructureList_T::const_iterator> iterator; + typedef BomIterator_T<LegCabin, + LegCabinStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on leg cabin: + return the iterator at the begining of the list. */ + iterator begin () const; + + /** Initialise the internal iterator on leg cabin: + return the iterator at the end of the list. */ + iterator end () const; + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the rbegining of the list. */ + reverse_iterator rbegin () const; + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the end of the list. */ + reverse_iterator rend () const; + + public: + /** Default constructors. */ + LegCabinList_T (); + LegCabinList_T (const LegCabinList_T&); + LegCabinList_T (const LegDateStructure_T&); + + /** Destructor. */ + virtual ~LegCabinList_T(); + + private: + // Attributes + /** Reference structure. */ + const LegDateStructure_T& _legDateStructure; + }; + +} +#endif // __STDAIR_BOM_LEGCABINLIST_HPP + Copied: trunk/stdair/stdair/bom/LegCabinMap.cpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateMap.cpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinMap.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,52 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/LegDateStructure.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/LegCabinMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegCabinMap_T:: + LegCabinMap_T (const LegDateStructure_T& iLegDateStructure) + : _legDateStructure (iLegDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabinMap_T:: + LegCabinMap_T (const LegCabinMap_T& iSCMap) + : _legDateStructure (iSCMap._legDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabinMap_T::~LegCabinMap_T () { + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinMap_T::iterator LegCabinMap_T::begin () const { + return _legDateStructure.legCabinMapBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinMap_T::iterator LegCabinMap_T::end () const { + return _legDateStructure.legCabinMapEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinMap_T::reverse_iterator LegCabinMap_T::rbegin () const { + return _legDateStructure.legCabinMapRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinMap_T::reverse_iterator LegCabinMap_T::rend () const { + return _legDateStructure.legCabinMapREnd (); + } + +} + Copied: trunk/stdair/stdair/bom/LegCabinMap.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateMap.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinMap.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinMap.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,65 @@ +#ifndef __STDAIR_BOM_LEGCABINMAP_HPP +#define __STDAIR_BOM_LEGCABINMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/LegDateTypes.hpp> +#include <stdair/bom/LegCabinTypes.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 LegCabinMap_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<LegCabin, + LegCabinStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<LegCabin, + LegCabinStructureMap_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. */ + LegCabinMap_T (); + LegCabinMap_T (const LegCabinMap_T&); + LegCabinMap_T (const LegDateStructure_T&); + + /** Destructor. */ + virtual ~LegCabinMap_T(); + + private: + // Attributes + /** Reference structure. */ + const LegDateStructure_T& _legDateStructure; + }; + +} +#endif // __STDAIR_BOM_LEGCABINMAP_HPP + Copied: trunk/stdair/stdair/bom/LegCabinStructure.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateStructure.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,129 @@ +#ifndef __STDAIR_BOM_LEGCABINSTRUCTURE_HPP +#define __STDAIR_BOM_LEGCABINSTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/LegCabinKey.hpp> +#include <stdair/bom/BookingClassStructure.hpp> +#include <stdair/bom/BomChildrenHolderImp.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT> class LegDateStructure; + class BomStructureDummy; + class BomContentDummy; + + /** Wrapper class aimed at holding the actual content, modeled + by an external specific LegCabin class (for instance, + in the AIRSCHED library). */ + template <class BOM_CONTENT> + class LegCabinStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef LegCabinKey<BOM_CONTENT> BomKey_T; + + /** Definition allowing to retrieve the associated parent + BOM structure type. */ + typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector <BomStructureDummy, + BomStructureDummy> ChildrenBomTypeList_T; + + /** Definition allowing to retrieve the default children bom holder type. */ + typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + + public: + // /////////// Getters ///////////// + /** Get the (parent) LegDateStructure object. */ + ParentBomStructure_T* getLegDateStructurePtr() const { + return _parent; + } + + /** Get the (parent) LegDateStructure object. */ + ParentBomStructure_T& getLegDateStructure() const; + + /** Get the leg-date key. */ + const BomKey_T& getKey() const { + return _key; + } + + private: + // /////////// Setters ///////////// + /** Set the (parent) LegDateStructure object. */ + void setLegDateStructure (ParentBomStructure_T& ioLegDateStructure) { + _parent = &ioLegDateStructure; + } + + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** Dump a Business Object with all its children into an output stream. + @param ostream& the output stream. */ + void describeFull (std::ostringstream& ioOut) const { + ioOut << describeShortKey () << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + LegCabinStructure (); + LegCabinStructure (const LegCabinStructure&); + LegCabinStructure (const BomKey_T& iKey) : _parent (NULL), _key (iKey){ } + + /** Destructor. */ + virtual ~LegCabinStructure() { } + + private: + // Attributes + /** Parent leg-date. */ + ParentBomStructure_T* _parent; + + /** The actual functional (Business Object) content. */ + BOM_CONTENT* _content; + + /** The key of both the structure and content objects. */ + BomKey_T _key; + + }; + +} +#endif // __STDAIR_BOM_LEGCABINSTRUCTURE_HPP Copied: trunk/stdair/stdair/bom/LegCabinTypes.hpp (from rev 40, trunk/stdair/stdair/bom/SegmentDateTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/LegCabinTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinTypes.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_LEGCABINTYPES_HPP +#define __STDAIR_BOM_LEGCABINTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class LegCabinStructure; + template <typename BOM_CONTENT> class LegCabinKey; + class LegCabin; + + /** Define the LegCabin structure. */ + typedef LegCabinStructure<LegCabin> LegCabinStructure_T; + + /** Define the LegCabin key. */ + typedef LegCabinKey<LegCabin> LegCabinKey_T; + + /** Define the leg-cabin structure list. */ + typedef std::vector<LegCabinStructure_T*> LegCabinStructureList_T; + + /** Define the leg-cabin structure map. */ + typedef std::map<const std::string, LegCabinStructure_T*> LegCabinStructureMap_T; + +} +#endif // __STDAIR_BOM_LEGCABINTYPES_HPP + Modified: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/LegDate.cpp 2009-10-12 13:35:33 UTC (rev 42) @@ -7,6 +7,9 @@ #include <stdair/bom/LegDateStructure.hpp> #include <stdair/bom/FlightDate.hpp> #include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/LegCabinList.hpp> +#include <stdair/bom/LegCabinMap.hpp> namespace stdair { @@ -51,5 +54,15 @@ return _legDateStructure.describeShortKey(); } + // ////////////////////////////////////////////////////////////////////// + LegCabinList_T LegDate::getLegCabinList () const { + return LegCabinList_T (_legDateStructure); + } + + // ////////////////////////////////////////////////////////////////////// + LegCabinMap_T LegDate::getLegCabinMap () const { + return LegCabinMap_T (_legDateStructure); + } + } Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -7,11 +7,14 @@ // STDAIR #include <stdair/bom/BomContent.hpp> #include <stdair/bom/LegDateTypes.hpp> +#include <stdair/bom/LegCabinTypes.hpp> namespace stdair { // Forward declarations class FacBomContent; class FlightDate; + struct LegCabinList_T; + struct LegCabinMap_T; /** Class representing the actual functional/business content for a leg-date. */ @@ -29,9 +32,12 @@ /** Definition allowing to retrieve the associated BOM key type. */ typedef LegDateKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef LegCabin ContentChild_T; public: - // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -51,7 +57,15 @@ /** Get a string describing the short key (differentiating two objects at the same level). */ const std::string describeShortKey() const; + + public: + // /////////// Getters ///////////// + /** Get a LegCabinList_T for iteration methods. */ + LegCabinList_T getLegCabinList () const; + /** Get a LegCabinMap_T for iteration methods. */ + LegCabinMap_T getLegCabinMap () const; + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-12 08:57:42 UTC (rev 41) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-12 13:35:33 UTC (rev 42) @@ -9,6 +9,7 @@ // STDAIR #include <stdair/bom/BomStructure.hpp> #include <stdair/bom/LegDateKey.hpp> +#include <stdair/bom/LegCabinStructure.hpp> #include <stdair/bom/BomChildrenHolderImp.hpp> namespace stdair { @@ -39,12 +40,28 @@ BOM structure type. */ typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; - /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector <BomStructureDummy, BomStructureDummy> ChildrenBomTypeList_T; + /** Definition allowing to retrieve the children type of the + BOM_CONTENT. */ + typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector <LegDateStructure<ContentChild_T>, + BomStructureDummy> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + /** Definition allowing to retrive the children bom holder type. */ + typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + + /** Define the iterators of the leg-cabin list. */ + typedef typename ChildrenBomHolder_T::ListIterator_T LegCabinListIterator_T; + typedef typename ChildrenBomHolder_T::ListReverseIterator_T LegCabinListReverseIterator_T; + + /** Define the iterators of the leg-cabin map. */ + typedef typename ChildrenBomHolder_T::MapIterator_T LegCabinMapIterator_T; + typedef typename ChildrenBomHolder_T::MapReverseIterator_T LegCabinMapReverseIterator_T; + public: // /////////// Getters ///////////// /** Get the (parent) FlightDateStructure object. */ @@ -60,6 +77,16 @@ return _key; } + /** Get the list of leg-cabins. */ + const ChildrenBomHolder_T& getChildrenList() const { + return *_childrenList; + } + + /** Get the list of leg-cabins. */ + void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { + ioChildrenList = _childrenList; + } + private: // /////////// Setters ///////////// /** Set the (parent) FlightDateStructure object. */ @@ -70,6 +97,10 @@ /** Default children list setter. */ void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Set the leg-cabin children list. */ + void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { + _childrenList = &ioChildrenList; + } public: // /////////// Display support methods ///////// @@ -83,6 +114,7 @@ @param ostream& the output stream. */ void describeFull (std::ostringstream& ioOut) const { ioOut << describeShortKey () << std::endl; + displayLegCabinList (ioOut); } /** Read a Business Object from an input stream. @@ -100,6 +132,72 @@ at the same level). */ const std::string describeShortKey() const { return _key.toString(); } + /** Dump the leg-cabin children list in to an output stream. + @param ostream& the output stream. */ + void displayLegCabinList (std::ostringstream& ioOut) const { + ioOut << "LegCabins: " << std::endl; + assert (_childrenList != NULL); + _childrenList->describeFull (ioOut); + } + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on leg cabin: + return the iterator at the begining of the list. */ + LegCabinListIterator_T legCabinListBegin () const { + assert (_childrenList != NULL); + return _childrenList->listBegin (); + } + + /** Initialise the internal iterator on leg cabin: + return the iterator at the end of the list. */ + LegCabinListIterator_T legCabinListEnd () const { + assert (_childrenList != NULL); + return _childrenList->listEnd (); + } + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the rbegining of the list. */ + LegCabinListReverseIterator_T legCabinListRBegin () const { + assert (_childrenList != NULL); + return _childrenList->listRBegin (); + } + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the rend of the list. */ + LegCabinListReverseIterator_T legCabinListREnd () const { + assert (_childrenList != NULL); + return _childrenList->listREnd (); + } + + /** Initialise the internal iterator on leg cabin: + return the iterator at the begining of the map. */ + LegCabinMapIterator_T legCabinMapBegin () const { + assert (_childrenList != NULL); + return _childrenList->mapBegin (); + } + + /** Initialise the internal iterator on leg cabin: + return the iterator at the end of the map. */ + LegCabinMapIterator_T legCabinMapEnd () const { + assert (_childrenList != NULL); + return _childrenList->mapEnd (); + } + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the rbegining of the map. */ + LegCabinMapReverseIterator_T legCabinMapRBegin () const { + assert (_childrenList != NULL); + return _childrenList->mapRBegin (); + } + + /** Initialise the internal reverse iterator on leg cabin: + return the reverse iterator at the rend of the map. */ + LegCabinMapReverseIterator_T legCabinMapREnd () const { + assert (_childrenList != NULL); + return _childrenList->mapREnd (); + } + ... [truncated message content] |
From: <qua...@us...> - 2009-10-15 15:11:33
|
Revision: 47 http://stdair.svn.sourceforge.net/stdair/?rev=47&view=rev Author: quannaus Date: 2009-10-15 15:11:19 +0000 (Thu, 15 Oct 2009) Log Message: ----------- [Dev] Transformed BomRoot from a template class to a normal class. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasTypes.hpp trunk/stdair/stdair/bom/BomRootTypes.hpp trunk/stdair/stdair/bom/BomStructureDummy.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryContent.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.cpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Added 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/BomRootKey.hpp trunk/stdair/stdair/bom/BomRootStructure.hpp Removed Paths: ------------- trunk/stdair/stdair/bom/BomContentRoot.hpp trunk/stdair/stdair/bom/BomStructureRoot.hpp trunk/stdair/stdair/bom/BomStructureRootKey.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -11,6 +11,7 @@ // Boost (Extended STL) #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/tuple/tuple.hpp> namespace stdair { @@ -48,18 +49,6 @@ } // //////// Type definitions ///////// - /** Define the type for airline codes. */ - typedef std::string AirlineCode_T; - - /** Define the type for flight numbers. */ - typedef unsigned int FlightNumber_T; - - /** Define the type for cabin codes. */ - typedef std::string CabinCode_T; - - /** Define the type for class codes. */ - typedef std::string ClassCode_T; - /** Define the type for durations (e.g., elapsed in-flight time). */ typedef boost::posix_time::time_duration Duration_T; @@ -68,6 +57,291 @@ /** Define the type for airport codes. */ typedef std::string AirportCode_T; + + /** Define the type for flight numbers. */ + typedef unsigned short FlightNumber_T; + + /** Define the file address type (e.g. "a_directory/a_filename")*/ + typedef std::string FileAddress_T; + + /** Define the replication number. */ + typedef unsigned int ReplicationNumber_T; + + /** Define the seed type of an Exponential function. */ + typedef unsigned long int ExponentialSeed_T; + + /** Define the seed type of an Uniform function. */ + typedef unsigned long int UniformSeed_T; + + /** Define the Airline Code type (2-letter-code, e.g., BA). */ + typedef std::string AirlineCode_T; + + /** Define the Airport Code type (3-letter-code, e.g., LHR). */ + typedef std::string AirportCode_T; + + /** Define the Request status for booking (1-letter-code, e.g., + B: booked, C: cancelled, R: Rejected). */ + typedef std::string RequestStatus_T; + + /** Define the Date (e.g., flight-date departure date). */ + typedef boost::gregorian::date Date_T; + + /** Define the Duration (e.g., elapsed in-flight time). */ + typedef boost::posix_time::time_duration Duration_T; + + /** Define an accurate time (date +time). */ + typedef boost::posix_time::ptime DateTime_T; + + /** Define a distance (kilometers). */ + typedef long int Distance_T; + + /** Define the Period (e.g., period during which flights depart). */ + typedef boost::gregorian::date_period DatePeriod_T; + + /** Define the Day-Of-the-Week as a string. */ + typedef std::string DOW_String_T; + + /** Define the Date Off-Set (e.g., -1 ). */ + typedef boost::gregorian::date_duration DateOffSet_T; + + /** Define a duration in number of days. */ + typedef long DayDuration_T; + + /** Define the Saturday stay status of a travel. */ + typedef bool SaturdayStay_T; + + /** Define the availability option allowing the ticket change. */ + typedef bool ChangeFees_T; + + /** Define the refundable availability of a tickets. */ + typedef bool NonRefundable_T; + + /** Define the average ratio (between 0 and 100) of demand with + a saturday stay status equal to TRUE. */ + typedef unsigned int SaturdayStayRatio_T; + + /** Define the average ratio of demand with change fee + availability. */ + typedef unsigned int ChangeFeesRatio_T; + + /** Define the average ratio of demand with non-refundable + availability. */ + typedef unsigned int NonRefundableRatio_T; + + /** Define the passenger characteristics, leisure or business + for instance (1-letter-code, e.g., L or B). */ + typedef std::string PassengerType_T; + + /** Define the identifier of a distribution pattern (e.g., 1). */ + typedef std::string DistributionPatternId_T; + + /** Define the identifier of a cancellation rate curve (e.g., C1). */ + typedef std::string CancellationRateCurveId_T; + + /** Define the identifier of an airline preference set list (e.g., AP1). */ + typedef std::string AirlinePreferenceId_T; + + /** Define a percentage value (between 0 and 100%). */ + typedef double Percentage_T; + + /** Define a cancellation & and no-show rate pair. */ + typedef std::pair<Percentage_T, Percentage_T> CancellationNoShowRatePair_T; + + /** Define the identifier of a demand characteristics pattern + (e.g. Ch12); for a customer choice model */ + typedef std::string CharacteristicsPatternId_T; + + /** Define characteristics component index (e.g. W for WTP) */ + typedef std::string CharacteristicsIndex_T; + + /** Define the cabin code (class of service, e.g., first, business, + economy). */ + typedef std::string CabinCode_T; + + /** Define a price value (e.g., 1000.0 Euros). */ + typedef double PriceValue_T; + + /** Define a price currency (e.g., EUR for Euros). */ + typedef std::string PriceCurrency_T; + + /** Define the number of seats required by a demand. */ + typedef unsigned short NbOfSeats_T; + + /** Define a mean value (e.g., 20.2). */ + typedef double MeanValue_T; + + /** Define a standard deviation value (e.g., 1.5). */ + typedef double StandardDeviationValue_T; + + /** Define the cabin capacity (resource, e.g., 200 seats). + <br>The capacity is expressed as a double to cope with overbooking. */ + typedef double CabinCapacity_T; + + /** Define the number of seat which could not be used for the booking. */ + typedef double BlockSpace_T; + + /** Define the code of the fare family (e.g., 1, 2, 3, etc.). */ + typedef std::string FamilyCode_T; + + /** Define the booking class code (product segment class, e.g., H, + B, K, etc.). */ + typedef std::string ClassCode_T; + + /** Define the flight path code (code made by a suite of flight numbers). */ + typedef std::string FlightPathCode_T; + + /** Define an availability. */ + typedef double Availability_T; + + /** Define an availability. */ + typedef bool AvailabilityStatus_T; + + /** Define a list of availabilities. */ + typedef std::vector<Availability_T> BucketAvailabilities_T; + + /** Define a identity number. */ + typedef unsigned long Identity_T; + + /** Define a map between a BookingID and a TravelSolutionID. */ + typedef std::map<Identity_T, Identity_T> BookingTSIDMap_T; + + /** Define a number of requests. */ + typedef double NbOfRequests_T; + + /** Define a number of bookings. */ + typedef NbOfRequests_T NbOfBookings_T; + + /** Define a number of cancellations (travellers). */ + typedef NbOfRequests_T NbOfCancellations_T; + + /** Define a number of no-shows. */ + typedef NbOfRequests_T NbOfNoShows_T; + + /** Define a number of fare rules. */ + typedef double NbOfFareRules_T; + + /** Define a number of yields. */ + typedef double NbOfYields_T; + + /** Define a number of InventoryControlRules. */ + typedef double NbOfInventoryControlRules_T; + + /** Define a number of flight dates. */ + typedef double NbOfFlightDates_T; + + /** Define a number of commited spaces in a cabin. */ + typedef double CommitedSpace_T; + + /** Define availibility of booking limit. */ + typedef bool CensorshipFlag_T; + + /** Define the list of censorship flags (une list per booking + class, one censorship flag per DCP). */ + typedef std::vector<bool> CensorshipFlagList_T; + + /** Define the value of the booking limit. */ + typedef double BookingLimit_T; + + /** Define the value of the authorization level. */ + typedef double AuthorizationLevel_T; + + /** Define the rate of overbooking */ + typedef double OverbookingRate_T; + + /** Define the bookingRatio (for instance OnD bookings + over whole class bookings). */ + typedef double BookingRatio_T; + + /** Define the list of class codes as a string. */ + typedef std::string ClassList_String_T; + + /** Define a number of segment-dates (in a path). */ + typedef unsigned short NbOfSegments_T; + + /** Define a number of airlines (in a path). */ + typedef unsigned short NbOfAirlines_T; + + /** Define the fare of a travel solution. */ + typedef double Fare_T; + + /** Define the yield of a virtual class. */ + typedef double Yield_T; + + /** Define the Bid-Price. */ + typedef double BidPrice_T; + + /** Define a Bid-Price Vector. */ + typedef std::vector<BidPrice_T> BidPriceVector_T; + + /** Define a number of travel solutions + (in a travel solution block). */ + typedef unsigned short NbOfTravelSolutions_T; + + /** Define a indicator of demand to class matching. */ + typedef double MatchingIndicator_T; + + /** Define an amount of revenue. */ + typedef double Revenue_T; + + /** Define the name of an event. */ + typedef std::string EventName_T; + + /** Define the name of an database connection. */ + typedef std::string DBConnectionName_T; + + /** Define a number of events. */ + typedef double NbOfEvents_T; + + /** Frequency of the Data Collection Point description (daily, monthly or + detailed). */ + typedef std::string DCPModeFrequency_T; + + /** Mode of the Data Collection Point description (Forecaster only, + Optimizer only or both of them). */ + typedef std::string DCPMode_T; + + /** Mode of the forecaster. */ + typedef std::string ForecasterMode_T; + + /** Limit of similar flight-dates used in the forecaster. */ + typedef short HistoricalDataLimit_T; + + /** Mode of the forecaster. */ + typedef std::string OptimizerMode_T; + + /** Mode of the forecaster. */ + typedef std::string DicoOptimizerMode_T; + + /** Mode of inventory control. */ + typedef std::string ControlMode_T; + + /** Analysis status (true or false). */ + typedef bool AnalysisStatus_T; + + /** Define the name of a multiplier. */ + typedef double Multiplier_T; + + /** Define the name of a WTP-component of characteristics pattern. */ + typedef boost::tuples::tuple<double, double> CharacteristicsWTP_tuple_T; + + /** Define the name of sell-up probability flag for RMS optimizer. */ + typedef bool SellupFlagForOptimizer_T; + + /** Define the name of sell-up probability for RMS optimizer. */ + typedef double SellupProbabilityForOptimizer_T; + + /** Define the name of sell-up probability vector for RMS optimizer. */ + typedef std::vector<SellupProbabilityForOptimizer_T> + SellupProbabilityVector_T; + + /** Define the demand for a policy. */ + typedef NbOfBookings_T PolicyDemand_T; + + /** Define the total revenue of an unconstrained policy. */ + typedef double PolicyRevenue_T; + + /** Define the total revenue of an unconstrained policy. */ + typedef double PolicyRevenue_T; } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/basic/BasTypes.hpp =================================================================== --- trunk/stdair/stdair/basic/BasTypes.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/basic/BasTypes.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -12,6 +12,5 @@ /** Key of a STL map. */ typedef std::string MapKey_T; - } #endif // __STDAIR_BAS_BASTYPES_HPP Deleted: trunk/stdair/stdair/bom/BomContentRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomContentRoot.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BomContentRoot.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -1,122 +0,0 @@ -#ifndef __STDAIR_BOM_BOMCONTENTROOT_HPP -#define __STDAIR_BOM_BOMCONTENTROOT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomContent.hpp> - -namespace stdair { - // Forward declarations. - template <typename BOM_CONTENT> class BomStructureRoot; - template <typename BOM_CONTENT> class BomStructureRootKey; - - /** Class representing the actual functional/business content - for the Bom root. - <br>That class is just an utility tool to mark the root - of the Bom tree. */ - template <typename BOM_CHILD> - class BomContentRoot : public BomContent { - friend class FacBomContent; - - // ///////////////////////////////////////////////////////////////////////// - // Type definitions, compulsary for the STDAIR library to work correctly - // ///////////////////////////////////////////////////////////////////////// - /** The following types must be defined: - <ul> - <li>ParentBomContent_T: Type corresponding to the parent BOM - class within that namespace (e.g., AIRSCHED here)</li> - <li>BomStructure_T: Type of the corresponding BOM class within - the stdair namespace</li> - <li>BomKey_T: Type of the corresponding BOM Key structure within - the stdair namespace</li> - <li>ContentChild_T: Type corresponding to the child BOM - class within that namespace (e.g., AIRSCHED here)</li> - </ul> - <br><br> - Note that the BomContentRoot has no parent. So, there is no need for - that class to define a ParentBomContent_T type. - <br><br> - Note that when there is a second type of children (for instance, - the FlightDate object contains two types of children, namely LegDate - and SegmentDate), an additional type definition must be given, namely - SecondContentChild_T. As, by default, there is a single type of - children, there is no need to specify "First" in the ContentChild_T - type. - */ - - public: - // ///////////////////////////////////////////////////////////////////////// - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BomStructureRoot<BomContentRoot> BomStructure_T; - - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomStructureRootKey<BomContentRoot> BomKey_T; - - /** Definition allowing to retrieve the associated - BOM content child type. */ - typedef BOM_CHILD ContentChild_T; - // ///////////////////////////////////////////////////////////////////////// - - - // ///////////////////////////////////////////////////////////////////////// - // In order to enable STL-iterator-like browsing of children objects, - // extra type definitions may be specified, such as the ones commented - // below. Hence, although those type definitions may appear not so simple - // (some will say "idiomatic"), they allow for a very simple use. - // ///////////////////////////////////////////////////////////////////////// - /** Define the const iterator on the list of children objects . */ - // typedef stdair::BomIterator_T<BomContent, - // BomStructureList_T::const_iterator> const_iterator; - // where BomStructureList_T is defined as std::vector<BomStructure_T*> - // ///////////////////////////////////////////////////////////////////////// - - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { ioOut << toString(); } - - /** 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 { return describeKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return std::string (""); } - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return std::string (""); } - - private: - /** Retrieve the BOM structure object. */ - BomStructure_T& getBomStructure () { - return _bomStructure; - } - - private: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Default constructors. */ - BomContentRoot (); - BomContentRoot (const BomContentRoot&); - BomContentRoot (BomStructure_T& ioBomStructure) - : _bomStructure (ioBomStructure) { } - - /** Destructor. */ - virtual ~BomContentRoot() { } - - private: - // Attributes - /** Reference structure. */ - BomStructure_T& _bomStructure; - }; - -} -#endif // __STDAIR_BOM_BOMCONTENTROOT_HPP Added: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp (rev 0) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,39 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomRootStructure.hpp> +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/InventoryList.hpp> +#include <stdair/bom/InventoryMap.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/BookingClass.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BomRoot::BomRoot (BomStructure_T& ioBomRootStructure) + : _bomRootStructure (ioBomRootStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BomRoot::~BomRoot () { + } + + // ////////////////////////////////////////////////////////////////////// + InventoryList_T BomRoot::getInventoryList () const { + return _bomRootStructure.getChildrenList(); + } + + // ////////////////////////////////////////////////////////////////////// + InventoryMap_T BomRoot::getInventoryMap () const { + return _bomRootStructure.getChildrenList(); + } +} Copied: trunk/stdair/stdair/bom/BomRoot.hpp (from rev 45, trunk/stdair/stdair/bom/BomContentRoot.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,129 @@ +#ifndef __STDAIR_BOM_BOMROOT_HPP +#define __STDAIR_BOM_BOMROOT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomRootContent.hpp> +#include <stdair/bom/BomRootTypes.hpp> +#include <stdair/bom/InventoryTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + class Inventory; + struct InventoryList_T; + struct InventoryMap_T; + + /** Class representing the actual functional/business content + for the Bom root. */ + class BomRoot : public BomRootContent { + friend class FacBomContent; + + // ///////////////////////////////////////////////////////////////////////// + // Type definitions, compulsary for the STDAIR library to work correctly + // ///////////////////////////////////////////////////////////////////////// + /** The following types must be defined: + <ul> + <li>Parent_T: Type corresponding to the parent BOM + class within that namespace (e.g., AIRSCHED here)</li> + <li>BomStructure_T: Type of the corresponding BOM class within + the stdair namespace</li> + <li>BomKey_T: Type of the corresponding BOM Key structure within + the stdair namespace</li> + <li>ContentChild_T: Type corresponding to the child BOM + class within that namespace (e.g., AIRSCHED here)</li> + </ul> + <br><br> + Note that the BomRoot has no parent. So, there is no need for + that class to define a Parent_T type. + <br><br> + Note that when there is a second type of children (for instance, + the FlightDate object contains two types of children, namely LegDate + and SegmentDate), an additional type definition must be given, namely + SecondContentChild_T. As, by default, there is a single type of + children, there is no need to specify "First" in the ContentChild_T + type. + */ + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BomRootStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BomRootKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef Inventory ContentChild_T; + // ///////////////////////////////////////////////////////////////////////// + + + // ///////////////////////////////////////////////////////////////////////// + // In order to enable STL-iterator-like browsing of children objects, + // extra type definitions may be specified, such as the ones commented + // below. Hence, although those type definitions may appear not so simple + // (some will say "idiomatic"), they allow for a very simple use. + // ///////////////////////////////////////////////////////////////////////// + /** Define the const iterator on the list of children objects . */ + // typedef stdair::BomIterator_T<BomContent, + // BomStructureList_T::const_iterator> const_iterator; + // where BomStructureList_T is defined as std::vector<BomStructure_T*> + // ///////////////////////////////////////////////////////////////////////// + + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { ioOut << toString(); } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return std::string (""); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return std::string (""); } + + public: + // /////////// Getters ///////////// + /** Get a InventoryList_T for iteration methods. */ + InventoryList_T getInventoryList () const; + + /** Get a InventoryMap_T for iteration methods. */ + InventoryMap_T getInventoryMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _bomRootStructure; + } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BomRoot (); + BomRoot (const BomRoot&); + BomRoot (BomStructure_T&); + /** Destructor. */ + virtual ~BomRoot(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _bomRootStructure; + }; + +} +#endif // __STDAIR_BOM_BOMROOT_HPP Added: trunk/stdair/stdair/bom/BomRootContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootContent.cpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,19 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomRootContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BomRootContent::BomRootContent () { + } + + // //////////////////////////////////////////////////////////////////// + BomRootContent::~BomRootContent () { + } + +} Copied: trunk/stdair/stdair/bom/BomRootContent.hpp (from rev 45, trunk/stdair/stdair/bom/BomContentRoot.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootContent.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,49 @@ +#ifndef __STDAIR_BOM_BOMROOTCONTENT_HPP +#define __STDAIR_BOM_BOMROOTCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> + +namespace stdair { + /** Class representing the actual attributes for the Bom root. */ + class BomRootContent : public BomContent { + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + protected: + /** Default constructors. */ + BomRootContent (); + BomRootContent (const BomRootContent&); + + /** Destructor. */ + virtual ~BomRootContent(); + + protected: + // Attributes + + }; + +} +#endif // __STDAIR_BOM_BOMROOTCONTENT_HPP Copied: trunk/stdair/stdair/bom/BomRootKey.hpp (from rev 45, trunk/stdair/stdair/bom/BomStructureRootKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootKey.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,66 @@ +#ifndef __STDAIR_BOM_BOMROOTKEY_HPP +#define __STDAIR_BOM_BOMROOTKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT> + class BomRootStructure; + + /** Key of the BOM structure root. */ + template <typename BOM_CONTENT> + class BomRootKey : public BomKey { + friend class FacBomStructure; + friend class FacBomContent; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BomRootStructure<BOM_CONTENT> BomStructure_T; + + public: + // /////////// Construction /////////// + /** Constructor. */ + BomRootKey () {} + + /** Destructor. */ + ~BomRootKey () {} + + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << "BomRootStructureKey: " << toString() << std::endl; + } + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { } + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + std::string toString() const { + std::ostringstream oStr; + oStr << " -- ROOT -- "; + return oStr.str(); + } + + + private: + // Attributes + // No attributes, as that class corresponds to the root of Bom structure. + }; + +} +#endif // __STDAIR_BOM_BOMROOTKEY_HPP Copied: trunk/stdair/stdair/bom/BomRootStructure.hpp (from rev 46, trunk/stdair/stdair/bom/BomStructureRoot.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomRootStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -0,0 +1,129 @@ +#ifndef __STDAIR_BOM_BOMROOTSTRUCTURE_HPP +#define __STDAIR_BOM_BOMROOTSTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/BomRootKey.hpp> +#include <stdair/bom/BomChildrenHolderImp.hpp> +#include <stdair/bom/InventoryStructure.hpp> + +namespace stdair { + // Forward declarations. + class BomStructureDummy; + class BomContentDummy; + + /** Wrapper class aimed at holding the actual content, modeled + by a specific BomContentRoot class. */ + template <typename BOM_CONTENT> + class BomRootStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the children type of the + BOM_CONTENT. */ + typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BomRootKey<BOM_CONTENT> BomKey_T; + + /** Definition allowing to retrieve the associated children type. */ + 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; + + /** Definition allowing to retrive the children bom holder type. */ + typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + + public: + // /////////// Getters ///////////// + /** Get the BomRootStructure key. */ + const BomKey_T& getKey() const { + return _key; + } + + /** Get the list of inventories. */ + const ChildrenBomHolder_T& getChildrenList() const { + assert (_childrenList != NULL); + return *_childrenList; + } + + /** Get the list of inventories. */ + void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { + ioChildrenList = _childrenList; + } + + private: + /////////////// Setters //////////////// + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + /** Set the children list. */ + void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { + _childrenList = &ioChildrenList; + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BomRootStructure (); + 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; + + /** List of inventories. */ + ChildrenBomHolder_T* _childrenList; + }; + +} +#endif // __STDAIR_BOM_BOMROOTSTRUCTURE_HPP + Modified: trunk/stdair/stdair/bom/BomRootTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootTypes.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BomRootTypes.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -8,20 +8,16 @@ namespace stdair { // Forward declarations. - template <typename BOM_CONTENT> class BomStructureRoot; - template <typename BOM_CONTENT> class BomStructureRootKey; - template <typename BOM_CHILD> class BomContentRoot; - class Inventory; + template <typename BOM_CONTENT> class BomRootStructure; + template <typename BOM_CONTENT> class BomRootKey; + class BomRoot; + + /** Define the BomRootStructure. */ + typedef BomRootStructure<BomRoot> BomRootStructure_T; - /** Define the BomContentRoot. */ - typedef BomContentRoot<Inventory> BomContentRoot_T; + /** Define the BomRootStructureKey. */ + typedef BomRootKey<BomRoot> BomRootKey_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/BomStructureDummy.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -6,6 +6,7 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/BomKey.hpp> #include <stdair/bom/BomChildrenHolderImp.hpp> // MPL #include <boost/mpl/vector.hpp> @@ -13,7 +14,6 @@ namespace stdair { // Forward declarations. class BomContentDummy; - class BomKey; /** Wrapper class aimed at holding the actual content, modeled by a specific BomContentDummy class. */ Deleted: trunk/stdair/stdair/bom/BomStructureRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureRoot.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BomStructureRoot.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -1,125 +0,0 @@ -#ifndef __STDAIR_BOM_BOMSTRUCTUREROOT_HPP -#define __STDAIR_BOM_BOMSTRUCTUREROOT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomStructure.hpp> -#include <stdair/bom/BomStructureRootKey.hpp> -#include <stdair/bom/BomChildrenHolderImp.hpp> -// MPL -#include <boost/mpl/vector.hpp> - -namespace stdair { - // Forward declarations. - template <typename BOM_CONTENT> class InventoryStructure; - class BomStructureDummy; - class BomContentDummy; - - /** Wrapper class aimed at holding the actual content, modeled - by a specific BomContentRoot class. */ - template <typename BOM_CONTENT> - class BomStructureRoot : public BomStructure { - friend class FacBomStructure; - friend class FacBomContent; - - // Type definitions - /** Definition allowing to retrieve the associated BOM content type. */ - typedef BOM_CONTENT Content_T; - - /** Definition allowing to retrieve the children type of the - BOM_CONTENT. */ - typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomStructureRootKey<BOM_CONTENT> BomKey_T; - - /** Definition allowing to retrieve the associated children type. */ - 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; - - /** Definition allowing to retrive the children bom holder type. */ - typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; - - public: - - // /////////// Getters ///////////// - /** Get the BomStructureRoot key. */ - const BomKey_T& getKey() const { - return _key; - } - - /** Get the list of inventories. */ - const ChildrenBomHolder_T& getChildrenList() const { - return *_childrenList; - } - - /** Get the list of inventories. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; - } - - private: - /////////////// Setters //////////////// - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } - - /** Set the children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; - } - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << toString() << std::endl; - } - - /** 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 { return describeKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return _key.toString(); } - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } - - private: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Default constructors. */ - BomStructureRoot (); - BomStructureRoot (const BomStructureRoot&); - BomStructureRoot (const BomKey_T& iKey) { _key = iKey; } - - /** Destructor. */ - ~BomStructureRoot () { } - - private: - // Attributes - /** The key of both the structure and content objects. */ - BomKey_T _key; - - /** The actual functional (Business Object) content. */ - BOM_CONTENT* _content; - - /** List of inventories. */ - ChildrenBomHolder_T* _childrenList; - }; - -} -#endif // __STDAIR_BOM_BOMSTRUCTUREROOT_HPP - Deleted: trunk/stdair/stdair/bom/BomStructureRootKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureRootKey.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BomStructureRootKey.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -1,66 +0,0 @@ -#ifndef __STDAIR_BOM_BOMSTRUCTUREROOTKEY_HPP -#define __STDAIR_BOM_BOMSTRUCTUREROOTKEY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/BomKey.hpp> - -namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class BomStructureRoot; - - /** Key of the BOM structure root. */ - template <typename BOM_CONTENT> - class BomStructureRootKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BomStructureRoot<BOM_CONTENT> BomStructure_T; - - public: - // /////////// Construction /////////// - /** Constructor. */ - BomStructureRootKey () {} - - /** Destructor. */ - ~BomStructureRootKey () {} - - - // /////////// Display support methods ///////// - /** Dump a Business Object Key into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "BomStructureRootKey: " << toString() << std::endl; - } - - /** Read a Business Object Key from an input stream. - @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } - - /** Get the serialised version of the Business Object Key. - <br>That string is unique, at the level of a given Business Object, - when among children of a given parent Business Object. - <br>For instance, "H" and "K" allow to differentiate among two - marketing classes for the same segment-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << " -- ROOT -- "; - return oStr.str(); - } - - - private: - // Attributes - // No attributes, as that class corresponds to the root of Bom structure. - }; - -} -#endif // __STDAIR_BOM_BOMSTRUCTUREROOTKEY_HPP Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -25,7 +25,7 @@ // Type definitions /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef SegmentCabin ParentBomContent_T; + typedef SegmentCabin Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef BookingClassStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/BookingClassStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -37,7 +37,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <BomStructureDummy, Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2009-10-15 15:11:19 UTC (rev 47) @@ -7,8 +7,9 @@ #include <iostream> #include <algorithm> // STDAIR +#include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/BomRoot.hpp> #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> Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -28,12 +28,12 @@ public: // Type definitions // ///////////////////////////////////////////////////////////////////////// - // See the explanations, within the BomContentRoot class, for all + // See the explanations, within the BomRoot 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; + typedef Inventory Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef FlightDateStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -16,7 +16,6 @@ namespace stdair { // Forward declaration - template <typename BOM_CONTENT> class InventoryStructure; class BomContentDummy; /** Wrapper class aimed at holding the actual content, modeled @@ -38,7 +37,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-10-15 15:11:19 UTC (rev 47) @@ -5,6 +5,7 @@ #include <cassert> // STDAIR #include <stdair/bom/InventoryStructure.hpp> +#include <stdair/bom/BomRoot.hpp> #include <stdair/bom/Inventory.hpp> #include <stdair/bom/FlightDate.hpp> #include <stdair/bom/FlightDateList.hpp> Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -5,16 +5,16 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STDAIR -#include <stdair/bom/BomContentRoot.hpp> -#include <stdair/bom/InventoryContent.hpp> #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/InventoryContent.hpp> namespace stdair { // Forward declarations class FacBomContent; + class BomRoot; class FlightDate; struct FlightDateList_T; struct FlightDateMap_T; @@ -26,12 +26,12 @@ public: // ///////////////////////////////////////////////////////////////////////// - // See the explanations, within the BomContentRoot class, for all + // See the explanations, within the BomRoot 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; + typedef BomRoot Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef InventoryStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/InventoryContent.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryContent.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/InventoryContent.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -4,7 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STDAIR +// STDAIR +#include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomContent.hpp> namespace stdair { @@ -32,7 +33,80 @@ at the same level). */ virtual const std::string describeShortKey() const = 0; - + public: + // ////////// Getters //////////// + /** Get the booking counter. */ + const NbOfBookings_T& getBookingCounter () const { + return _bookingCounter; + } + + /** Get the total inventory revenue. */ + const Revenue_T& getRevenue () const { + return _inventoryRevenue; + } + + /** Get the inventory average fare. */ + const Fare_T& getAverageFare() const { + return _inventoryAverageFare; + } + + /** Get the Availability Seat Kilometer for the inventory. */ + const Distance_T& getASK() const { + return _inventoryASK; + } + + /** Get the yield value for the inventory. */ + const Revenue_T& getYield () const { + return _inventoryYield; + } + + /** Get the Revenue Passanger Kilometer for the whole inventory. */ + const Distance_T& getRPK() const { + return _inventoryRPK; + } + + /** Get the unit revenue value for the whole inventory. */ + const Revenue_T& getUnitRevenue () const { + return _inventoryUnitRevenue; + } + + /** Get the load factor value for this inventory. */ + const Revenue_T& getLoadFactor () const { + return _inventoryLoadFactor; + } + + public: + // ///////// Setters ////////// + /** Set the revenue amount. */ + void setRevenue (const Revenue_T& iInventoryRevenue) { + _inventoryRevenue = iInventoryRevenue; + } + + /** Set the Revenue Passanger Kilometer. */ + void setRPK (const Distance_T& iInventoryRPK) { + _inventoryRPK = iInventoryRPK; + } + + /** Set the unit revenue. */ + void setUnitRevenue (const Revenue_T& iInventoryURevenue) { + _inventoryUnitRevenue = iInventoryURevenue; + } + + /** Set the average fare. */ + void setAverageFare(Fare_T iIAFare) { + _inventoryAverageFare = iIAFare; + } + + /** Set the yield. */ + void setYield (const Revenue_T& iInvYield) { + _inventoryYield = iInvYield; + } + + /** Set the load factor. */ + void setLoadFactor (const Revenue_T& iInventoryLF) { + _inventoryLoadFactor = iInventoryLF; + } + protected: /** Default constructors. */ InventoryContent (); @@ -43,6 +117,31 @@ protected: // Attributes + /** Counter of all bookings into the inventory. */ + NbOfBookings_T _bookingCounter; + + /** Total amount of money earn with all flight bookings + for one airline. */ + Revenue_T _inventoryRevenue; + + /** Value of the average fare of the inventory.*/ + Fare_T _inventoryAverageFare; + + /** Value of the Available Seat Kilometer for this Inventory.*/ + Distance_T _inventoryASK; + + /** Value of the Yield (Revenue/ASK). */ + Revenue_T _inventoryYield; + + /** Value of the Revenue Passanger Kilometer for the whole inventory.*/ + Distance_T _inventoryRPK; + + /** Value of the Unit Revenue (Revenue/RPK). */ + Revenue_T _inventoryUnitRevenue; + + /** Value of the Load Factor (ASK/RPK). */ + Revenue_T _inventoryLoadFactor; + }; } Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -12,13 +12,11 @@ #include <stdair/bom/BomStructure.hpp> #include <stdair/bom/InventoryKey.hpp> #include <stdair/bom/BomChildrenHolderImp.hpp> -#include <stdair/bom/BomIterator.hpp> #include <stdair/bom/FlightDateStructure.hpp> namespace stdair { // Forward declaration - template <typename BOM_CONTENT> class BomStructureRoot; class BomStructureDummy; class BomContentDummy; @@ -45,7 +43,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<FlightDateStructure<ContentChild_T>, Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -22,7 +22,7 @@ // Type definitions /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef LegDate ParentBomContent_T; + typedef LegDate Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef LegCabinStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -38,7 +38,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <BomStructureDummy, Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -25,7 +25,7 @@ // Type definitions /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef FlightDate ParentBomContent_T; + typedef FlightDate Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef LegDateStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -38,7 +38,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -25,7 +25,7 @@ // Type definitions /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef SegmentDate ParentBomContent_T; + typedef SegmentDate Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef SegmentCabinStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/SegmentCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -38,7 +38,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -25,7 +25,7 @@ // Type definitions /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef FlightDate ParentBomContent_T; + typedef FlightDate Parent_T; /** Definition allowing to retrieve the associated BOM structure type. */ typedef SegmentDateStructure_T BomStructure_T; Modified: trunk/stdair/stdair/bom/SegmentDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-15 15:11:19 UTC (rev 47) @@ -38,7 +38,7 @@ /** Definition allowing to retrieve the associated parent BOM structure type. */ - typedef typename BOM_CONTENT::ParentBomContent_T::BomStructure_T ParentBomStructure_T; + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2009-10-15 09:21:08 UTC (rev 46) +++ trunk/stdair/stdair/bom/sources.mk 2009-10-15 15:11:19 UTC (rev 47) @@ -1,6 +1,6 @@ bom_h_sources = \ $(top_srcdir)/stdair/bom/BomKey.hpp \ - $(top_srcdir)/stdair/bom/BomStructureRootKey.hpp \ + $(top_srcdir)/stdair/bom/BomRootKey.hpp \ $(top_srcdir)/stdair/bom/InventoryKey.hpp \ $(top_srcdir)/stdair/bom/FlightDateKey.hpp \ $(top_srcdir)/stdair/bom/LegDateKey.hpp \ @@ -8,8 +8,12 @@ $(top_srcdir)/stdair/bom/SegmentCabinKey.hpp \ $(top_srcdir)/stdair/bom/BookingClassK... [truncated message content] |
From: <qua...@us...> - 2009-10-20 14:04:56
|
Revision: 51 http://stdair.svn.sourceforge.net/stdair/?rev=51&view=rev Author: quannaus Date: 2009-10-20 14:04:45 +0000 (Tue, 20 Oct 2009) Log Message: ----------- [Dev] Changed the key from class template to struct. Modified Paths: -------------- trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomRootKey.hpp trunk/stdair/stdair/bom/BomRootStructure.hpp trunk/stdair/stdair/bom/BomRootTypes.hpp trunk/stdair/stdair/bom/BomStructureDummy.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateKey.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/FlightDateTypes.hpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/InventoryTypes.hpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegCabinTypes.hpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateKey.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/LegDateTypes.hpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentCabinTypes.hpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateKey.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/bom/SegmentDateTypes.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Added Paths: ----------- trunk/stdair/stdair/bom/BomRootKey.cpp trunk/stdair/stdair/bom/BookingClassKey.cpp trunk/stdair/stdair/bom/FlightDateKey.cpp trunk/stdair/stdair/bom/InventoryKey.cpp trunk/stdair/stdair/bom/LegCabinKey.cpp trunk/stdair/stdair/bom/LegDateKey.cpp trunk/stdair/stdair/bom/SegmentCabinKey.cpp trunk/stdair/stdair/bom/SegmentDateKey.cpp Modified: trunk/stdair/stdair/bom/BomKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -17,7 +17,7 @@ at the same level only. For instance, the segment-date key allows to differentiate two segment-dates under a given flight-date, but does not allow to differentiate two segemnt-dates in general. */ - class BomKey { + struct BomKey_T { public: // /////////// Display support methods ///////// @@ -48,7 +48,7 @@ inline std::basic_ostream<charT, traits>& operator<< (std::basic_ostream<charT, traits>& ioOut, - const stdair::BomKey& iBom) { + const stdair::BomKey_T& iBom) { /** string stream: - with same format @@ -76,7 +76,7 @@ inline std::basic_istream<charT, traits>& operator>> (std::basic_istream<charT, traits>& ioIn, - stdair::BomKey& ioBom) { + stdair::BomKey_T& ioBom) { // Fill Bom object with input stream ioBom.fromStream (ioIn); return ioIn; Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,6 +13,7 @@ namespace stdair { // Forward declarations. class FacBomContent; + struct BomRootKey_T; struct InventoryList_T; struct InventoryMap_T; Added: trunk/stdair/stdair/bom/BomRootKey.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/BomRootKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomRootKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BomRootKey_T::BomRootKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + BomRootKey_T::~BomRootKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void BomRootKey_T::toStream (std::ostream& ioOut) const { + ioOut << "BomRootStructureKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void BomRootKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string BomRootKey_T::toString() const { + std::ostringstream oStr; + oStr << " -- ROOT -- "; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/BomRootKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomRootKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,53 +9,33 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class BomRootStructure; - /** Key of the BOM structure root. */ - template <typename BOM_CONTENT> - class BomRootKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BomRootStructure<BOM_CONTENT> BomStructure_T; + struct BomRootKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - BomRootKey () {} + BomRootKey_T (); /** Destructor. */ - ~BomRootKey () {} + ~BomRootKey_T (); // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "BomRootStructureKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << " -- ROOT -- "; - return oStr.str(); - } - + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/BomRootStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -35,7 +35,7 @@ private: // Type definitions /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomRootKey<BOM_CONTENT> BomKey_T; + typedef BomRootKey_T BomKey_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; Modified: trunk/stdair/stdair/bom/BomRootTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomRootTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,15 +9,11 @@ namespace stdair { // Forward declarations. template <typename BOM_CONTENT> class BomRootStructure; - template <typename BOM_CONTENT> class BomRootKey; class BomRoot; /** Define the BomRootStructure. */ typedef BomRootStructure<BomRoot> BomRootStructure_T; - /** Define the BomRootStructureKey. */ - typedef BomRootKey<BomRoot> BomRootKey_T; - } #endif // __STDAIR_BOM_BOMROOTTYPES_HPP Modified: trunk/stdair/stdair/bom/BomStructureDummy.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -26,9 +26,6 @@ /** Definition allowing to retrieve the associated BOM content type. */ typedef BomContentDummy Content_T; - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomKey BomKey_T; - /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<> ChildrenBomTypeList_T; Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -14,6 +14,7 @@ // Forward declarations class FacBomContent; class SegmentCabin; + struct BookingClassKey_T; struct BookingClassList_T; struct BookingClassMap_T; Added: trunk/stdair/stdair/bom/BookingClassKey.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/BookingClassKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BookingClassKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BookingClassKey_T::BookingClassKey_T (const ClassCode_T& iClassCode) + : _classCode (iClassCode) { + } + + // //////////////////////////////////////////////////////////////////// + BookingClassKey_T::~BookingClassKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void BookingClassKey_T::toStream (std::ostream& ioOut) const { + ioOut << "BookingClassKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void BookingClassKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string BookingClassKey_T::toString() const { + std::ostringstream oStr; + oStr << _classCode; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/BookingClassKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BookingClassKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,60 +9,36 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class BookingClassStructure; - /** Key of segment-cabin. */ - template <typename BOM_CONTENT> - class BookingClassKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BookingClassStructure<BOM_CONTENT> BomStructure_T; + struct BookingClassKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - BookingClassKey (const ClassCode_T& iClassCode) - : _classCode (iClassCode) { - } + BookingClassKey_T (const ClassCode_T& iClassCode); /** Destructor. */ - ~BookingClassKey () { } + ~BookingClassKey_T (); // /////////// Getters ////////// /** Get the cabin code. */ - const ClassCode_T& getClassCode () const { - return _classCode; - } + const ClassCode_T& getClassCode () const; // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "BookingClassKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-cabin. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _classCode; - return oStr.str(); - } - + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/BookingClassStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -27,7 +27,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef BookingClassKey<BOM_CONTENT> BomKey_T; + typedef BookingClassKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/BookingClassTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/BookingClassTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // Forward declarations. template <typename BOM_CONTENT> class BookingClassStructure; - template <typename BOM_CONTENT> class BookingClassKey; class BookingClass; /** Define the BookingClass structure. */ typedef BookingClassStructure<BookingClass> BookingClassStructure_T; - /** Define the BookingClass key. */ - typedef BookingClassKey<BookingClass> BookingClassKey_T; - /** Define the segment-cabin structure list. */ typedef std::vector<BookingClassStructure_T*> BookingClassStructureList_T; Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -15,6 +15,7 @@ // Forward declarations class FacBomContent; class Inventory; + struct FlightDateKey_T; struct SegmentDateList_T; struct SegmentDateMap_T; struct LegDateList_T; Added: trunk/stdair/stdair/bom/FlightDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightDateKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightDateKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightDateKey_T::FlightDateKey_T (const FlightNumber_T& iFlightNumber, + const Date_T& iFlightDate) + : _flightNumber (iFlightNumber), _flightDate (iFlightDate) { + } + + // //////////////////////////////////////////////////////////////////// + FlightDateKey_T::~FlightDateKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void FlightDateKey_T::toStream (std::ostream& ioOut) const { + ioOut << "FlightDateKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FlightDateKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string FlightDateKey_T::toString() const { + std::ostringstream oStr; + oStr << _flightNumber << ", " << _flightDate; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/FlightDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,32 +9,16 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class FlightDateStructure; - /** Key of flight-date. */ - template <typename BOM_CONTENT> - class FlightDateKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef FlightDateStructure<BOM_CONTENT> BomStructure_T; + struct FlightDateKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - FlightDateKey (const FlightNumber_T& iFlightNumber, - const Date_T& iFlightDate) - : _flightNumber (iFlightNumber), _flightDate (iFlightDate) { - } + FlightDateKey_T (const FlightNumber_T&, const Date_T&); /** Destructor. */ - ~FlightDateKey () { } + ~FlightDateKey_T (); // /////////// Getters ////////// /** Get the flight number. */ @@ -50,24 +34,18 @@ // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "FlightDateKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _flightNumber << ", " << _flightDate; - return oStr.str(); - } + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -29,7 +29,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef FlightDateKey<BOM_CONTENT> BomKey_T; + typedef FlightDateKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/FlightDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/FlightDateTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // 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; Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -14,6 +14,7 @@ // Forward declarations class FacBomContent; class BomRoot; + struct InventoryKey_T; struct FlightDateList_T; struct FlightDateMap_T; Added: trunk/stdair/stdair/bom/InventoryKey.cpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/InventoryKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/InventoryKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + InventoryKey_T::InventoryKey_T (const AirlineCode_T& iAirlineCode) + : _airlineCode (iAirlineCode) { + } + + // //////////////////////////////////////////////////////////////////// + InventoryKey_T::~InventoryKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void InventoryKey_T::toStream (std::ostream& ioOut) const { + ioOut << "InventoryKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void InventoryKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string InventoryKey_T::toString() const { + std::ostringstream oStr; + oStr << _airlineCode; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/InventoryKey.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/InventoryKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,58 +9,36 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { + /** Key of inventory. */ + struct InventoryKey_T : public BomKey_T { - // Forward declarations - template<typename BOM_CONTENT> class InventoryStructure; - - /** Key of flight-date. */ - template <typename BOM_CONTENT> - class InventoryKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef InventoryStructure<BOM_CONTENT> BomStructure_T; - public: // /////////// Construction /////////// /** Constructor. */ - InventoryKey (const AirlineCode_T& iAirlineCode) - : _airlineCode (iAirlineCode) { - } + InventoryKey_T (const AirlineCode_T& iAirlineCode); /** Destructor. */ - ~InventoryKey () { } + ~InventoryKey_T (); // /////////// Getters ////////// /** Get the airline code. */ - const AirlineCode_T& getAirlineCode() const { - return _airlineCode; - } + const AirlineCode_T& getAirlineCode() const; // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "InventoryKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } - + void fromStream (std::istream& ioIn); + /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _airlineCode; - return oStr.str(); - } + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -30,7 +30,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef InventoryKey<BOM_CONTENT> BomKey_T; + typedef InventoryKey_T BomKey_T; /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ Modified: trunk/stdair/stdair/bom/InventoryTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/InventoryTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // 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 Inventory structure list. */ typedef std::vector<InventoryStructure_T*> InventoryStructureList_T; Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,7 +13,8 @@ // Forward declarations class FacBomContent; class LegDate; - + struct LegCabinKey_T; + /** Class representing the actual functional/business content for a leg-date. */ class LegCabin : public LegCabinContent { Added: trunk/stdair/stdair/bom/LegCabinKey.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegCabinKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/LegCabinKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegCabinKey_T::LegCabinKey_T (const CabinCode_T& iCabinCode) + : _cabinCode (iCabinCode) { + } + + // //////////////////////////////////////////////////////////////////// + LegCabinKey_T::~LegCabinKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void LegCabinKey_T::toStream (std::ostream& ioOut) const { + ioOut << "LegCabinKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void LegCabinKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string LegCabinKey_T::toString() const { + std::ostringstream oStr; + oStr << _cabinCode; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/LegCabinKey.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegCabinKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,31 +9,16 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class LegCabinStructure; - /** Key of leg-cabin. */ - template <typename BOM_CONTENT> - class LegCabinKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef LegCabinStructure<BOM_CONTENT> BomStructure_T; + struct LegCabinKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - LegCabinKey (const CabinCode_T& iCabinCode) - : _cabinCode (iCabinCode) { - } + LegCabinKey_T (const CabinCode_T& iCabinCode); /** Destructor. */ - ~LegCabinKey () { } + ~LegCabinKey_T (); // /////////// Getters ////////// /** Get the cabin code. */ @@ -44,25 +29,18 @@ // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "LegCabinKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same leg-cabin. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _cabinCode; - return oStr.str(); - } - + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -28,7 +28,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef LegCabinKey<BOM_CONTENT> BomKey_T; + typedef LegCabinKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/LegCabinTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegCabinTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // Forward declarations. template <typename BOM_CONTENT> class LegCabinStructure; - template <typename BOM_CONTENT> class LegCabinKey; class LegCabin; /** Define the LegCabin structure. */ typedef LegCabinStructure<LegCabin> LegCabinStructure_T; - /** Define the LegCabin key. */ - typedef LegCabinKey<LegCabin> LegCabinKey_T; - /** Define the leg-cabin structure list. */ typedef std::vector<LegCabinStructure_T*> LegCabinStructureList_T; Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -14,6 +14,7 @@ // Forward declarations class FacBomContent; class FlightDate; + struct LegDateKey_T; struct LegCabinList_T; struct LegCabinMap_T; Added: trunk/stdair/stdair/bom/LegDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/LegDateKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/LegDateKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LegDateKey_T::LegDateKey_T (const AirportCode_T& iBoardPoint) + : _boardPoint (iBoardPoint) { + } + + // //////////////////////////////////////////////////////////////////// + LegDateKey_T::~LegDateKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void LegDateKey_T::toStream (std::ostream& ioOut) const { + ioOut << "LegDateKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void LegDateKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string LegDateKey_T::toString() const { + std::ostringstream oStr; + oStr << _boardPoint; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/LegDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegDateKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,30 +9,16 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class LegDateStructure; - /** Key of leg-date. */ - template <typename BOM_CONTENT> - class LegDateKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef LegDateStructure<BOM_CONTENT> BomStructure_T; + struct LegDateKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - LegDateKey (const AirportCode_T& iBoardPoint) : _boardPoint (iBoardPoint) { - } + LegDateKey_T (const AirportCode_T& iBoardPoint); /** Destructor. */ - ~LegDateKey () { } + ~LegDateKey_T (); // /////////// Getters ////////// /** Get the boarding point. */ @@ -43,24 +29,18 @@ // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "LegDateKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same leg-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _boardPoint; - return oStr.str(); - } + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -28,7 +28,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef LegDateKey<BOM_CONTENT> BomKey_T; + typedef LegDateKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/LegDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/LegDateTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // 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; Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -14,6 +14,7 @@ // Forward declarations class FacBomContent; class SegmentDate; + struct SegmentCabinKey_T; struct BookingClassList_T; struct BookingClassMap_T; Added: trunk/stdair/stdair/bom/SegmentCabinKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentCabinKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/SegmentCabinKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + SegmentCabinKey_T::SegmentCabinKey_T (const CabinCode_T& iCabinCode) + : _cabinCode (iCabinCode) { + } + + // //////////////////////////////////////////////////////////////////// + SegmentCabinKey_T::~SegmentCabinKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void SegmentCabinKey_T::toStream (std::ostream& ioOut) const { + ioOut << "SegmentCabinKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void SegmentCabinKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string SegmentCabinKey_T::toString() const { + std::ostringstream oStr; + oStr << _cabinCode; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/SegmentCabinKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,31 +9,16 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class SegmentCabinStructure; - /** Key of segment-cabin. */ - template <typename BOM_CONTENT> - class SegmentCabinKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef SegmentCabinStructure<BOM_CONTENT> BomStructure_T; + struct SegmentCabinKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - SegmentCabinKey (const CabinCode_T& iCabinCode) - : _cabinCode (iCabinCode) { - } + SegmentCabinKey_T (const CabinCode_T& iCabinCode); /** Destructor. */ - ~SegmentCabinKey () { } + ~SegmentCabinKey_T (); // /////////// Getters ////////// /** Get the cabin code. */ @@ -44,25 +29,18 @@ // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "SegmentCabinKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-cabin. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _cabinCode; - return oStr.str(); - } - + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/SegmentCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -28,7 +28,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef SegmentCabinKey<BOM_CONTENT> BomKey_T; + typedef SegmentCabinKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/SegmentCabinTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentCabinTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // Forward declarations. template <typename BOM_CONTENT> class SegmentCabinStructure; - template <typename BOM_CONTENT> class SegmentCabinKey; class SegmentCabin; /** Define the SegmentCabin structure. */ typedef SegmentCabinStructure<SegmentCabin> SegmentCabinStructure_T; - /** Define the SegmentCabin key. */ - typedef SegmentCabinKey<SegmentCabin> SegmentCabinKey_T; - /** Define the segment-cabin structure list. */ typedef std::vector<SegmentCabinStructure_T*> SegmentCabinStructureList_T; Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -14,6 +14,7 @@ // Forward declarations class FacBomContent; class FlightDate; + struct SegmentDateKey_T; struct SegmentCabinList_T; struct SegmentCabinMap_T; Added: trunk/stdair/stdair/bom/SegmentDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/SegmentDateKey.cpp 2009-10-20 14:04:45 UTC (rev 51) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/SegmentDateKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + SegmentDateKey_T::SegmentDateKey_T (const AirportCode_T& iBoardPoint, + const AirportCode_T& iOffPoint) + : _boardPoint (iBoardPoint), _offPoint (iOffPoint) { + } + + // //////////////////////////////////////////////////////////////////// + SegmentDateKey_T::~SegmentDateKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void SegmentDateKey_T::toStream (std::ostream& ioOut) const { + ioOut << "SegmentDateKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void SegmentDateKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string SegmentDateKey_T::toString() const { + std::ostringstream oStr; + oStr << _boardPoint << "-" << _offPoint; + return oStr.str(); + } + +} Modified: trunk/stdair/stdair/bom/SegmentDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -9,32 +9,16 @@ #include <stdair/bom/BomKey.hpp> namespace stdair { - - // Forward declarations - template <typename BOM_CONTENT> - class SegmentDateStructure; - /** Key of segment-date. */ - template <typename BOM_CONTENT> - class SegmentDateKey : public BomKey { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef SegmentDateStructure<BOM_CONTENT> BomStructure_T; + struct SegmentDateKey_T : public BomKey_T { public: // /////////// Construction /////////// /** Constructor. */ - SegmentDateKey (const AirportCode_T& iBoardPoint, - const AirportCode_T& iOffPoint) - : _boardPoint (iBoardPoint), _offPoint (iOffPoint) { - } + SegmentDateKey_T (const AirportCode_T&, const AirportCode_T&); /** Destructor. */ - ~SegmentDateKey () { } + ~SegmentDateKey_T (); // /////////// Getters ////////// /** Get the boarding point. */ @@ -50,25 +34,18 @@ // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << "SegmentDateKey: " << toString() << std::endl; - } + void toStream (std::ostream& ioOut) const; /** Read a Business Object Key from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); /** Get the serialised version of the Business Object Key. <br>That string is unique, at the level of a given Business Object, when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const { - std::ostringstream oStr; - oStr << _boardPoint << "-" << _offPoint; - return oStr.str(); - } - + std::string toString() const; private: // Attributes Modified: trunk/stdair/stdair/bom/SegmentDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -28,7 +28,7 @@ typedef BOM_CONTENT Content_T; /** Definition allowing to retrieve the associated BOM key type. */ - typedef SegmentDateKey<BOM_CONTENT> BomKey_T; + typedef SegmentDateKey_T BomKey_T; /** Definition allowing to retrieve the associated parent BOM structure type. */ Modified: trunk/stdair/stdair/bom/SegmentDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateTypes.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/SegmentDateTypes.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -13,15 +13,11 @@ // Forward declarations. template <typename BOM_CONTENT> class SegmentDateStructure; - template <typename BOM_CONTENT> class SegmentDateKey; class SegmentDate; /** Define the SegmentDate structure. */ typedef SegmentDateStructure<SegmentDate> SegmentDateStructure_T; - /** Define the SegmentDate key. */ - typedef SegmentDateKey<SegmentDate> SegmentDateKey_T; - /** Define the segment-date structure list. */ typedef std::vector<SegmentDateStructure_T*> SegmentDateStructureList_T; Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/bom/sources.mk 2009-10-20 14:04:45 UTC (rev 51) @@ -61,6 +61,13 @@ $(top_srcdir)/stdair/bom/BomChildrenHolderImp.hpp \ $(top_srcdir)/stdair/bom/BomIterator.hpp bom_cc_sources = \ + $(top_srcdir)/stdair/bom/BomRootKey.cpp \ + $(top_srcdir)/stdair/bom/InventoryKey.cpp \ + $(top_srcdir)/stdair/bom/FlightDateKey.cpp \ + $(top_srcdir)/stdair/bom/LegDateKey.cpp \ + $(top_srcdir)/stdair/bom/SegmentDateKey.cpp \ + $(top_srcdir)/stdair/bom/SegmentCabinKey.cpp \ + $(top_srcdir)/stdair/bom/BookingClassKey.cpp \ $(top_srcdir)/stdair/bom/BomRoot.cpp \ $(top_srcdir)/stdair/bom/BomRootContent.cpp \ $(top_srcdir)/stdair/bom/Inventory.cpp \ Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -89,7 +89,7 @@ typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; BOM_STRUCTURE_T& lBomStructure = FacBomStructure::instance(). - create<typename BOM_CONTENT::BomKey_T> (iKey); + create<typename BOM_CONTENT::BomKey_T, BOM_STRUCTURE_T> (iKey); // The created flight-date content (BomContent) object gets a constant // reference on its corresponding flight-date structure/holder object Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-10-20 09:41:29 UTC (rev 50) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-10-20 14:04:45 UTC (rev 51) @@ -51,18 +51,15 @@ static FacBomStructure& instance(); /** Create a structure object with the given key. */ - template <typename BOM_KEY> - typename BOM_KEY::BomStructure_T& create (const BOM_KEY& iKey) { - // Type for the BOM structure. - typedef typename BOM_KEY::BomStructure_T BOM_STRUCTURE_T; + template <typename BOM_KEY, typename BOM_STRUCTURE> + BOM_STRUCTURE& create (const BOM_KEY& iKey) { + BOM_STRUCTURE* aBomStructure_ptr = NULL; - BOM_STRUCTURE_T* aBomStructure_ptr = NULL; - - aBomStructure_ptr = new BOM_STRUCTURE_T (iKey); + aBomStructure_ptr = new BOM_STRUCTURE (iKey); assert (aBomStructure_ptr != NULL); // Initialise the children list of the BOM structure. - initChildrenList<BOM_STRUCTURE_T> (*aBomStructure_ptr); + initChildrenList<BOM_STRUCTURE> (*aBomStructure_ptr); // The new object is added to the pool of structure objects _structurePool.push_back (aBomStructure_ptr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-01-29 16:03:44
|
Revision: 111 http://stdair.svn.sourceforge.net/stdair/?rev=111&view=rev Author: quannaus Date: 2010-01-29 16:03:38 +0000 (Fri, 29 Jan 2010) Log Message: ----------- [Dev] Moved the STDAIR_ServicePtr_T into STDAIR_Types.hpp Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/core/sources.mk Removed Paths: ------------- trunk/stdair/stdair/STDAIR_ServicePtr.hpp Deleted: trunk/stdair/stdair/STDAIR_ServicePtr.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_ServicePtr.hpp 2010-01-28 23:35:01 UTC (rev 110) +++ trunk/stdair/stdair/STDAIR_ServicePtr.hpp 2010-01-29 16:03:38 UTC (rev 111) @@ -1,19 +0,0 @@ -#ifndef __STDAIR_SVC_STDAIR_SERVICEPTR_HPP -#define __STDAIR_SVC_STDAIR_SERVICEPTR_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// Boost -#include <boost/shared_ptr.hpp> - -namespace stdair { - - // Forward declarations - class STDAIR_Service; - - /** Pointer on the STDAIR Service handler. */ - typedef boost::shared_ptr<STDAIR_Service> STDAIR_ServicePtr_T; - -} -#endif // __STDAIR_SVC_STDAIR_SERVICEPTR_HPP Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-28 23:35:01 UTC (rev 110) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-29 16:03:38 UTC (rev 111) @@ -12,9 +12,13 @@ #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/tuple/tuple.hpp> +#include <boost/shared_ptr.hpp> namespace stdair { + // Forward declarations + class STDAIR_Service; + // ///////// Exceptions /////////// class RootException : public std::exception { }; @@ -361,5 +365,8 @@ or C:\foo\bar). */ typedef std::string Filename_T; + /** Pointer on the STDAIR Service handler. */ + typedef boost::shared_ptr<STDAIR_Service> STDAIR_ServicePtr_T; + } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/core/sources.mk =================================================================== --- trunk/stdair/stdair/core/sources.mk 2010-01-28 23:35:01 UTC (rev 110) +++ trunk/stdair/stdair/core/sources.mk 2010-01-29 16:03:38 UTC (rev 111) @@ -1,4 +1,3 @@ service_h_sources = $(top_srcdir)/stdair/STDAIR_Types.hpp \ - $(top_srcdir)/stdair/STDAIR_Service.hpp \ - $(top_srcdir)/stdair/STDAIR_ServicePtr.hpp + $(top_srcdir)/stdair/STDAIR_Service.hpp service_cc_sources = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-02-07 02:14:50
|
Revision: 117 http://stdair.svn.sourceforge.net/stdair/?rev=117&view=rev Author: denis_arnaud Date: 2010-02-07 02:14:43 +0000 (Sun, 07 Feb 2010) Log Message: ----------- [DB] Now fully support database storage (with a simple example for airline names). Modified Paths: -------------- trunk/stdair/stdair/bom/AirlineStruct.cpp trunk/stdair/stdair/bom/AirlineStruct.hpp trunk/stdair/stdair/core/Makefile.am trunk/stdair/stdair/service/DBSessionManager.cpp Added Paths: ----------- trunk/stdair/stdair/dbadaptor/ trunk/stdair/stdair/dbadaptor/DbaAbstract.cpp trunk/stdair/stdair/dbadaptor/DbaAbstract.hpp trunk/stdair/stdair/dbadaptor/DbaAirline.cpp trunk/stdair/stdair/dbadaptor/DbaAirline.hpp trunk/stdair/stdair/dbadaptor/Makefile.am trunk/stdair/stdair/dbadaptor/sources.mk Modified: trunk/stdair/stdair/bom/AirlineStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineStruct.cpp 2010-02-06 17:57:52 UTC (rev 116) +++ trunk/stdair/stdair/bom/AirlineStruct.cpp 2010-02-07 02:14:43 UTC (rev 117) @@ -13,7 +13,6 @@ // //////////////////////////////////////////////////////////////////// AirlineStruct::AirlineStruct () { - assert (false); } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/AirlineStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineStruct.hpp 2010-02-06 17:57:52 UTC (rev 116) +++ trunk/stdair/stdair/bom/AirlineStruct.hpp 2010-02-07 02:14:43 UTC (rev 117) @@ -58,12 +58,13 @@ // //////////// Constructors & Destructor /////////////// /** Main constructor. */ AirlineStruct (const AirlineCode_T&, const std::string& iAirlineName); + /** Default constructor. */ + AirlineStruct (); + /** Default copy constructor. */ + AirlineStruct (const AirlineStruct&); /** Destructor. */ ~AirlineStruct (); - /** Default copy constructor. */ - AirlineStruct (const AirlineStruct&); - /** Default constructor, not to be used. */ - AirlineStruct (); + private: // ///////////////////// Attributes ////////////////////// Modified: trunk/stdair/stdair/core/Makefile.am =================================================================== --- trunk/stdair/stdair/core/Makefile.am 2010-02-06 17:57:52 UTC (rev 116) +++ trunk/stdair/stdair/core/Makefile.am 2010-02-07 02:14:43 UTC (rev 117) @@ -16,10 +16,12 @@ libstdair_la_LIBADD = \ $(top_builddir)/stdair/basic/libbas.la \ $(top_builddir)/stdair/bom/libbom.la \ + $(top_builddir)/stdair/dbadaptor/libdba.la \ $(top_builddir)/stdair/factory/libfac.la \ $(top_builddir)/stdair/service/libsvc.la libstdair_la_LDFLAGS = \ - $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB) \ + $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(BOOST_FILESYSTEM_LIB) \ -version-info $(GENERIC_LIBRARY_VERSION) # Property changes on: trunk/stdair/stdair/dbadaptor ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile Added: trunk/stdair/stdair/dbadaptor/DbaAbstract.cpp =================================================================== --- trunk/stdair/stdair/dbadaptor/DbaAbstract.cpp (rev 0) +++ trunk/stdair/stdair/dbadaptor/DbaAbstract.cpp 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,9 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// StdAir +#include <stdair/dbadaptor/DbaAbstract.hpp> + +namespace stdair { + +} Added: trunk/stdair/stdair/dbadaptor/DbaAbstract.hpp =================================================================== --- trunk/stdair/stdair/dbadaptor/DbaAbstract.hpp (rev 0) +++ trunk/stdair/stdair/dbadaptor/DbaAbstract.hpp 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,76 @@ +#ifndef __STDAIR_DBA_DBAABSTRACT_HPP +#define __STDAIR_DBA_DBAABSTRACT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> + +namespace stdair { + + /** Base class for the Database Adaptor (DBA) layer. */ + class DbaAbstract { + public: + + /** Destructor. */ + virtual ~DbaAbstract() {} + + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const {} + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) {} + + protected: + /** Protected Default Constructor to ensure this class is abtract. */ + DbaAbstract() {} + }; +} + +/** + Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing + Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial + and Reference", published by Addison-Wesley. +*/ +template <class charT, class traits> +inline +std::basic_ostream<charT, traits>& +operator<< (std::basic_ostream<charT, traits>& ioOut, + const stdair::DbaAbstract& iDba) { + /** + string stream: + - with same format + - without special field width + */ + std::basic_ostringstream<charT,traits> ostr; + ostr.copyfmt (ioOut); + ostr.width (0); + + // Fill string stream + iDba.toStream (ostr); + + // Print string stream + ioOut << ostr.str(); + + return ioOut; +} + +/** + Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing + Output Operators" (pp655-657) of his book "The C++ Standard Library: + A Tutorial and Reference", published by Addison-Wesley. +*/ +template <class charT, class traits> +inline +std::basic_istream<charT, traits>& +operator>> (std::basic_istream<charT, traits>& ioIn, + stdair::DbaAbstract& ioDba) { + // Fill Dba object with input stream + ioDba.fromStream (ioIn); + return ioIn; +} + +#endif // __STDAIR_DBA_DBAABSTRACT_HPP Added: trunk/stdair/stdair/dbadaptor/DbaAirline.cpp =================================================================== --- trunk/stdair/stdair/dbadaptor/DbaAirline.cpp (rev 0) +++ trunk/stdair/stdair/dbadaptor/DbaAirline.cpp 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,42 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <exception> +#include <string> +// Stdair +#include <stdair/bom/AirlineStruct.hpp> +#include <stdair/dbadaptor/DbaAirline.hpp> +#include <stdair/service/Logger.hpp> + +namespace soci { + + // ////////////////////////////////////////////////////////////////////// + void type_conversion<stdair::AirlineStruct>:: + from_base (values const& iAirlineValues, indicator /* ind */, + stdair::AirlineStruct& ioAirline) { + /* + iata_code, name + */ + ioAirline.setAirlineCode (iAirlineValues.get<std::string> ("iata_code")); + // The city code will be set to the default value (empty string) + // when the column is null + ioAirline.setAirlineName (iAirlineValues.get<std::string> ("name", "")); + } + + // ////////////////////////////////////////////////////////////////////// + void type_conversion<stdair::AirlineStruct>:: + to_base (const stdair::AirlineStruct& iAirline, values& ioAirlineValues, + indicator& ioIndicator) { + const indicator lNameIndicator = + iAirline.getAirlineName().empty() ? i_null : i_ok; + ioAirlineValues.set ("iata_code", iAirline.getAirlineCode()); + ioAirlineValues.set ("name", iAirline.getAirlineName(), lNameIndicator); + ioIndicator = i_ok; + } + +} + +namespace stdair { + +} Added: trunk/stdair/stdair/dbadaptor/DbaAirline.hpp =================================================================== --- trunk/stdair/stdair/dbadaptor/DbaAirline.hpp (rev 0) +++ trunk/stdair/stdair/dbadaptor/DbaAirline.hpp 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,37 @@ +#ifndef __STDAIR_DBA_DBAAIRLINE_HPP +#define __STDAIR_DBA_DBAAIRLINE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// SOCI +#include <soci/core/soci.h> + +// Forward declarations +namespace stdair { + struct AirlineStruct; +} + +namespace soci { + + /** Specify how the AirlineStruct struct can be converted to (resp. from) + values stored into (resp. retrieved from) database, using the SOCI + framework. */ + template <> + struct type_conversion<stdair::AirlineStruct> { + + typedef values base_type; + + /** Fill an Airline object from the database values. */ + static void from_base (values const& iAirlineValues, + indicator /* ind */, + stdair::AirlineStruct& ioAirline); + + + /** Fill the database values from an Airline object. */ + static void to_base (const stdair::AirlineStruct& iAirline, + values& ioAirlineValues, + indicator& ioIndicator); + }; +} +#endif // __STDAIR_DBA_DBAAIRLINE_HPP Added: trunk/stdair/stdair/dbadaptor/Makefile.am =================================================================== --- trunk/stdair/stdair/dbadaptor/Makefile.am (rev 0) +++ trunk/stdair/stdair/dbadaptor/Makefile.am 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,16 @@ +## dbadaptor sub-directory +include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk + +# +noinst_LTLIBRARIES= libdba.la + +libdba_la_SOURCES= $(dba_h_sources) $(dba_cc_sources) +libdba_la_CXXFLAGS = $(SOCI_CFLAGS) +libdba_la_LIBADD = +libdba_la_LDFLAGS = $(SOCI_LIBS) + + +# Header files +pkgincludedir = $(includedir)/stdair/dbadaptor +pkginclude_HEADERS = $(dba_h_sources) Added: trunk/stdair/stdair/dbadaptor/sources.mk =================================================================== --- trunk/stdair/stdair/dbadaptor/sources.mk (rev 0) +++ trunk/stdair/stdair/dbadaptor/sources.mk 2010-02-07 02:14:43 UTC (rev 117) @@ -0,0 +1,6 @@ +dba_h_sources = \ + $(top_srcdir)/stdair/dbadaptor/DbaAbstract.hpp \ + $(top_srcdir)/stdair/dbadaptor/DbaAirline.hpp +dba_cc_sources = \ + $(top_srcdir)/stdair/dbadaptor/DbaAbstract.cpp \ + $(top_srcdir)/stdair/dbadaptor/DbaAirline.cpp Modified: trunk/stdair/stdair/service/DBSessionManager.cpp =================================================================== --- trunk/stdair/stdair/service/DBSessionManager.cpp 2010-02-06 17:57:52 UTC (rev 116) +++ trunk/stdair/stdair/service/DBSessionManager.cpp 2010-02-07 02:14:43 UTC (rev 117) @@ -51,7 +51,7 @@ const std::string lDBSessionConnectionString (oStr.str()); // Instanciate the database session: nothing else is performed at that stage - _dbSession = new DBSession_T(); + _dbSession = new DBSession_T; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-02-08 09:22:28
|
Revision: 123 http://stdair.svn.sourceforge.net/stdair/?rev=123&view=rev Author: quannaus Date: 2010-02-08 09:22:21 +0000 (Mon, 08 Feb 2010) Log Message: ----------- [BOM] Delegated the creation of Inventory to the StdAir library. Modified Paths: -------------- trunk/stdair/stdair/command/sources.mk trunk/stdair/stdair/service/STDAIR_Service.cpp Added Paths: ----------- trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp Added: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp (rev 0) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-02-08 09:22:21 UTC (rev 123) @@ -0,0 +1,106 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// StdAir +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/AirlineFeatureSet.hpp> +#include <stdair/bom/AirlineFeature.hpp> +// Inventory: child of BomRoot, needed for creation of BomRoot +#include <stdair/bom/Inventory.hpp> +// Network: child of BomRoot, needed for creation of BomRoot +#include <stdair/bom/Network.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/factory/FacSupervisor.hpp> +#include <stdair/factory/FacBomContent.hpp> +#include <stdair/command/CmdBomManager.hpp> +#include <stdair/service/Logger.hpp> + +namespace stdair { + + // ////////////////////////////////////////////////////////////////////// + void CmdBomManager::initAirlineFeatureSet (BomRoot& ioBomRoot) { + // Initialise the set of required airline features + AirlineFeatureSet& lAirlineFeatureSet = + FacBomContent::instance().create<AirlineFeatureSet>(); + + // Set the AirlineFeatureSet for the BomRoot. + ioBomRoot.setAirlineFeatureSet (&lAirlineFeatureSet); + } + + // ////////////////////////////////////////////////////////////////////// + void CmdBomManager:: + addAirlineFeature (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { + + // Initialise an AirlineFeature object + AirlineFeatureKey_T lAirlineFeatureKey (iAirlineCode); + AirlineFeature& lAirlineFeature = FacBomContent:: + instance().create<AirlineFeature> (lAirlineFeatureKey); + + // Retrieve the AirlineFeatureSet object + AirlineFeatureSet& lAirlineFeatureSet = ioBomRoot.getAirlineFeatureSet(); + + // Add the AirlineFeature object to its AirlineFeatureSet parent + FacBomContent::linkWithParent<AirlineFeature> (lAirlineFeature, + lAirlineFeatureSet); + } + + // ////////////////////////////////////////////////////////////////////// + Inventory& CmdBomManager:: + createInventoryInternal (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { + InventoryKey_T lInventoryKey (iAirlineCode); + + // Instantiate an Inventory object with the given airline code + Inventory& lInventory = + FacBomContent::instance().create<Inventory> (lInventoryKey); + + // Link the created inventory with the bom root. + FacBomContent::linkWithParent<Inventory> (lInventory, ioBomRoot); + + return lInventory; + } + + // ////////////////////////////////////////////////////////////////////// + Inventory& CmdBomManager:: + getOrCreateInventory (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { + Inventory* lInventory_ptr = ioBomRoot.getInventory (iAirlineCode); + + // If there is no Inventory object for that airline already, create one + if (lInventory_ptr == NULL) { + const InventoryKey_T lInventoryKey (iAirlineCode); + + + // Instantiate an Inventory object with the given airline code + lInventory_ptr = &createInventoryInternal (ioBomRoot, iAirlineCode); + assert (lInventory_ptr != NULL); + + // Set the AirlineFeature for the inventory. + addAirlineFeature (ioBomRoot, iAirlineCode); + + // TODO: find a more elegant way to link the AirlineFeature back to the + // Inventory object + + // Link the AirlineFeature with the Inventory object + const AirlineFeatureSet& lAirlineFeatureSet = + ioBomRoot.getAirlineFeatureSet (); + const AirlineFeature* lAirlineFeature_ptr = + lAirlineFeatureSet.getAirlineFeature (iAirlineCode); + + if (lAirlineFeature_ptr == NULL) { + STDAIR_LOG_ERROR (lAirlineFeatureSet.display() + << "Needed airline code: " << iAirlineCode); + assert (false); + } + + lInventory_ptr->setAirlineFeature (lAirlineFeature_ptr); + } + assert (lInventory_ptr != NULL); + + return *lInventory_ptr; + } + +} Added: trunk/stdair/stdair/command/CmdBomManager.hpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.hpp (rev 0) +++ trunk/stdair/stdair/command/CmdBomManager.hpp 2010-02-08 09:22:21 UTC (rev 123) @@ -0,0 +1,56 @@ +#ifndef __STDAIR_CMD_CMDBOMMANAGER_HPP +#define __STDAIR_CMD_CMDBOMMANAGER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/command/CmdAbstract.hpp> + +namespace stdair { + + // Forward declarations + class BomRoot; + class Inventory; + + /** Class wrapping utility functions for handling the BOM tree objects. */ + class CmdBomManager : public CmdAbstract { + public: + + /** If needed, create the Inventory corresponding to the given airline code + (Inventory key), link it to the BomRoot object and to the + associated AirlineFeature object, itself retrieved from the + AirlineFeatureSet object. + Otherwise, just retrieve the reference on the existing Inventory object + corresponding to the given airline code. + <br>If not existing, a ObjectNotFoundException exception is thrown. + @param BomRoot& Root of the BOM tree. + @param const AirlineCode_T& Airline code for the inventory to be + created . */ + static Inventory& getOrCreateInventory (BomRoot&, const AirlineCode_T&); + + /** Initialise the AirlineFeatureSet object, and attach it to the + BomRoot. + @param BomRoot& Root of the BOM tree. */ + static void initAirlineFeatureSet (BomRoot&); + + /** Add the airline-specific AirlineFeature object to its AirlineFeatureSet + parent. + @param BomRoot& Root of the BOM tree. + @param const AirlineCode_T& Airline code for the inventory to be + created . */ + static void addAirlineFeature (BomRoot&, const AirlineCode_T& iAirlineCode); + + private: + // ///////////////////// Internal support methods //////////////////////// + /** Create the Inventory corresponding to the given airline code + (Inventory key). + @param BomRoot& Root of the BOM tree. + @param const AirlineCode_T& Airline code for the inventory to be + created . */ + static Inventory& createInventoryInternal (BomRoot&, const AirlineCode_T&); + }; + +} +#endif // ___STDAIR_CMD_CMDBOMMANAGER_HPP Modified: trunk/stdair/stdair/command/sources.mk =================================================================== --- trunk/stdair/stdair/command/sources.mk 2010-02-07 20:06:07 UTC (rev 122) +++ trunk/stdair/stdair/command/sources.mk 2010-02-08 09:22:21 UTC (rev 123) @@ -1,6 +1,8 @@ cmd_h_sources = \ $(top_srcdir)/stdair/command/CmdAbstract.hpp \ + $(top_srcdir)/stdair/command/CmdBomManager.hpp \ $(top_srcdir)/stdair/command/DBManagerForAirlines.hpp cmd_cc_sources = \ $(top_srcdir)/stdair/command/CmdAbstract.cpp \ + $(top_srcdir)/stdair/command/CmdBomManager.cpp \ $(top_srcdir)/stdair/command/DBManagerForAirlines.cpp Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-02-07 20:06:07 UTC (rev 122) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-02-08 09:22:21 UTC (rev 123) @@ -7,15 +7,11 @@ #include <stdair/basic/BasChronometer.hpp> #include <stdair/bom/BomManager.hpp> // for display() #include <stdair/bom/BomRoot.hpp> -#include <stdair/bom/AirlineFeatureSet.hpp> -#include <stdair/bom/AirlineFeature.hpp> -// Inventory: child of BomRoot, needed for creation of BomRoot -#include <stdair/bom/Inventory.hpp> -// Network: child of BomRoot, needed for creation of BomRoot #include <stdair/bom/Network.hpp> -#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/Inventory.hpp> #include <stdair/factory/FacSupervisor.hpp> #include <stdair/factory/FacBomContent.hpp> +#include <stdair/command/CmdBomManager.hpp> #include <stdair/service/Logger.hpp> #include <stdair/service/DBSessionManager.hpp> #include <stdair/STDAIR_Service.hpp> @@ -91,32 +87,16 @@ } // ////////////////////////////////////////////////////////////////////// - void STDAIR_Service::initAirlineFeatureSet () { - // Initialise the set of required airline features - stdair::AirlineFeatureSet& lAirlineFeatureSet = - stdair::FacBomContent::instance().create<stdair::AirlineFeatureSet>(); - - // Set the AirlineFeatureSet for the BomRoot. - _bomRoot.setAirlineFeatureSet (&lAirlineFeatureSet); + void STDAIR_Service::initAirlineFeatureSet () { + // Delegate to the dedicated command + CmdBomManager::initAirlineFeatureSet (_bomRoot); } // ////////////////////////////////////////////////////////////////////// void STDAIR_Service:: addAirlineFeature (const AirlineCode_T& iAirlineCode) const { - - // Initialise an AirlineFeature object - stdair::AirlineFeatureKey_T lAirlineFeatureKey (iAirlineCode); - stdair::AirlineFeature& lAirlineFeature = stdair::FacBomContent:: - instance().create<stdair::AirlineFeature> (lAirlineFeatureKey); - - // Retrieve the AirlineFeatureSet object - stdair::AirlineFeatureSet& lAirlineFeatureSet = - _bomRoot.getAirlineFeatureSet(); - - // Add the AirlineFeature object to its AirlineFeatureSet parent - stdair::FacBomContent:: - linkWithParent<stdair::AirlineFeature> (lAirlineFeature, - lAirlineFeatureSet); + // Delegate to the dedicated command + CmdBomManager::addAirlineFeature (_bomRoot, iAirlineCode); } // ////////////////////////////////////////////////////////////////////// @@ -139,42 +119,19 @@ return *lInventory_ptr; } + /** + Note that the AirlineFeature is linked both to the Inventory + and to the AirlineFeatureSet, which in turn is linked to the BomRoot. + There is therefore a duplication of the structure links. + */ + // ////////////////////////////////////////////////////////////////////// Inventory& STDAIR_Service:: createInventory (const AirlineCode_T& iAirlineCode) const { - Inventory* lInventory_ptr = _bomRoot.getInventory (iAirlineCode); - - // If there is no Inventory object for that airline already, create one - if (lInventory_ptr == NULL) { - const stdair::InventoryKey_T lInventoryKey (iAirlineCode); - - // Instantiate an Inventory object with the given airline code - lInventory_ptr = - &stdair::FacBomContent::instance(). - create<stdair::Inventory> (lInventoryKey); - assert (lInventory_ptr != NULL); - - // Link the created inventory with the bom root. - stdair::FacBomContent::linkWithParent<stdair::Inventory> (*lInventory_ptr, - _bomRoot); - - // Set the AirlineFeature for the inventory. - const stdair::AirlineFeatureSet& lAirlineFeatureSet = - _bomRoot.getAirlineFeatureSet (); - const stdair::AirlineFeature* lAirlineFeature_ptr = - lAirlineFeatureSet.getAirlineFeature (iAirlineCode); - - // TODO: throw an exception? - if (lAirlineFeature_ptr == NULL) { - STDAIR_LOG_ERROR (lAirlineFeatureSet.display() - << "Needed airline code: " << iAirlineCode); - } - - lInventory_ptr->setAirlineFeature (lAirlineFeature_ptr); - } - assert (lInventory_ptr != NULL); - - return *lInventory_ptr; + // Delegate to the dedicated command + Inventory& oInventory = + CmdBomManager::getOrCreateInventory (_bomRoot, iAirlineCode); + return oInventory; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-02-10 10:14:16
|
Revision: 125 http://stdair.svn.sourceforge.net/stdair/?rev=125&view=rev Author: quannaus Date: 2010-02-10 10:14:09 +0000 (Wed, 10 Feb 2010) Log Message: ----------- [dev] Some changes in several objects for the demand generation. Modified Paths: -------------- trunk/stdair/stdair/basic/DemandCharacteristics.cpp trunk/stdair/stdair/basic/DemandCharacteristics.hpp trunk/stdair/stdair/bom/BookingRequestStruct.cpp trunk/stdair/stdair/bom/BookingRequestStruct.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/EventStruct.cpp trunk/stdair/stdair/bom/EventStruct.hpp trunk/stdair/stdair/factory/FacBomContent.cpp trunk/stdair/stdair/factory/FacBomContent.hpp Modified: trunk/stdair/stdair/basic/DemandCharacteristics.cpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-02-10 10:14:09 UTC (rev 125) @@ -21,10 +21,12 @@ // ///////////////////////////////////////////////////// DemandCharacteristics:: - DemandCharacteristics (const DemandCharacteristics& iDemandCharacteristics) { - _origin = iDemandCharacteristics._origin; - _preferredDepartureDate = iDemandCharacteristics._preferredDepartureDate; - _arrivalPattern = iDemandCharacteristics._arrivalPattern; + DemandCharacteristics (const DemandCharacteristics& iDemandCharacteristics) + : _origin (iDemandCharacteristics._origin), + _destination (iDemandCharacteristics._destination), + _preferredDepartureDate (iDemandCharacteristics._preferredDepartureDate), + _paxType (iDemandCharacteristics._paxType), + _arrivalPattern (iDemandCharacteristics._arrivalPattern) { } // ///////////////////////////////////////////////////// Modified: trunk/stdair/stdair/basic/DemandCharacteristics.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-02-10 10:14:09 UTC (rev 125) @@ -18,14 +18,24 @@ // ///////////// Getters /////////// /** Get the origin. */ - const LocationCode_T& getOrigin() const { + const AirportCode_T& getOrigin() const { return _origin; } + /** Get the destination. */ + const AirportCode_T& getDestination() const { + return _destination; + } + /** Get the preferred departure date. */ const Date_T& getPreferredDepartureDate() const { return _preferredDepartureDate; } + + /** Get the passenger type. */ + const PassengerType_T& getPaxType() const { + return _paxType; + } /** Get the arrival pattern. */ const ContinuousAttribute<FloatDuration_T>& getArrivalPattern() const { @@ -35,15 +45,25 @@ public: // ///////////// Setters /////////// /** Set the origin. */ - void setOrigin (const LocationCode_T& iOrigin) { + void setOrigin (const AirportCode_T& iOrigin) { _origin = iOrigin; } + + /** Set the destination. */ + void setDestination (const AirportCode_T& iDestination) { + _destination = iDestination; + } /** Set the preferred departure date. */ void setPreferredDepartureDate (const Date_T& iPreferredDepartureDate) { _preferredDepartureDate = iPreferredDepartureDate; } + /** Set the passenger type. */ + void setPaxType (const PassengerType_T& iPaxType) { + _paxType = iPaxType; + } + /** Set the arrival pattern. */ void setArrivalPattern (const ContinuousAttribute<FloatDuration_T>& iArrivalPattern) { _arrivalPattern = iArrivalPattern; @@ -70,10 +90,16 @@ private: // ////////// Attributes ////////// /** Origin */ - LocationCode_T _origin; + AirportCode_T _origin; + /** Origin */ + AirportCode_T _destination; + /** Preferred departure date */ Date_T _preferredDepartureDate; + + /** Passenger type. */ + PassengerType_T _paxType; /** Arrival pattern (cumulative distribution of timing of arrival of requests (negative number of days between departure date @@ -81,10 +107,10 @@ ContinuousAttribute<FloatDuration_T> _arrivalPattern; /** Trip type probability mass */ - //CategoricalAttribute<TripType_T> _tripTypeProbabilityMass; + // CategoricalAttribute<TripType_T> _tripTypeProbabilityMass; /** Willingness-to-pay cumulative distribution */ - //ContinuousAttribute<MonetaryValue_T> _willingnessToPayCumulativeDistribution; + // ContinuousAttribute<MonetaryValue_T> _willingnessToPayCumulativeDistribution; }; Modified: trunk/stdair/stdair/bom/BookingRequestStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-02-10 10:14:09 UTC (rev 125) @@ -10,10 +10,6 @@ #include <stdair/bom/BookingRequestStruct.hpp> namespace stdair { - - // ////////////////////////////////////////////////////////////////////// - BookingRequestStruct::BookingRequestStruct () { - } // ////////////////////////////////////////////////////////////////////// BookingRequestStruct::BookingRequestStruct (const AirportCode_T& iOrigin, Modified: trunk/stdair/stdair/bom/BookingRequestStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-10 10:14:09 UTC (rev 125) @@ -15,6 +15,8 @@ /** Structure holding the elements of a booking request. */ struct BookingRequestStruct : public StructAbstract { + friend class DemandStream; + public: // /////////////// Getters ///////////////// /** Get the requested origin. */ @@ -92,12 +94,15 @@ /** Display of the structure. */ const std::string describe() const; - public: + private : // /////////////// Constructors and Destructors ///////////////// BookingRequestStruct (); + public : BookingRequestStruct (const AirportCode_T&, const AirportCode_T&, const Date_T&, const DateTime_T&, const PassengerType_T&, const NbOfSeats_T&); + BookingRequestStruct (const BookingRequestStruct&); + public: ~BookingRequestStruct(); Modified: trunk/stdair/stdair/bom/DemandStream.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.cpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/DemandStream.cpp 2010-02-10 10:14:09 UTC (rev 125) @@ -60,9 +60,9 @@ } _totalNumberOfRequestsToBeGenerated = lIntegerNumberOfRequestsToBeGenerated; } - - // ////////////////////////////////////////////////////////////////////// - bool DemandStream::generateNext (BookingRequestStruct& ioRequest) { + + // //////////////////////////////////////////////////////////////////// + const bool DemandStream::stillHavingRequestsToBeGenerated () const { // Check whether enough requests have already been generated const Count_T lNbOfRequestsGeneratedSoFar = _randomGenerationContext.getNumberOfRequestsGeneratedSoFar (); @@ -72,17 +72,31 @@ if (lRemainingNumberOfRequestsToBeGenerated <= 0) { return false; } - // DEBUG - STDAIR_LOG_DEBUG ("Here"); + return true; + + } + + // ////////////////////////////////////////////////////////////////////// + BookingRequestPtr_T DemandStream::generateNext () { + // Assert that there are requests to be generated. + const Count_T lNbOfRequestsGeneratedSoFar = + _randomGenerationContext.getNumberOfRequestsGeneratedSoFar (); + const Count_T lRemainingNumberOfRequestsToBeGenerated = + _totalNumberOfRequestsToBeGenerated - lNbOfRequestsGeneratedSoFar; + assert (lRemainingNumberOfRequestsToBeGenerated > 0); + + // Origin - ioRequest.setOrigin (_demandCharacteristics.getOrigin ()); - + const AirportCode_T& lOrigin = _demandCharacteristics.getOrigin (); + // Destination + const AirportCode_T& lDestination = _demandCharacteristics.getDestination (); // Preferred departure date - const Date_T lPreferredDepartureDate = + const Date_T& lPreferredDepartureDate = _demandCharacteristics.getPreferredDepartureDate (); - ioRequest.setPreferredDepartureDate (lPreferredDepartureDate); - + // Passenger type. + const PassengerType_T& lPassengerType = _demandCharacteristics.getPaxType(); + // Request datetime, determined from departure date and arrival pattern // Sequential generation const Probability_T lCumulativeProbabilitySoFar = @@ -99,34 +113,45 @@ // convert the number of days in number of seconds + number of milliseconds const FloatDuration_T lNumberOfSeconds = - lNumberOfDaysBetweenDepartureAndThisRequest*static_cast<float> (SECONDS_IN_ONE_DAY); + lNumberOfDaysBetweenDepartureAndThisRequest + * static_cast<float> (SECONDS_IN_ONE_DAY); const IntDuration_T lIntNumberOfSeconds = floor(lNumberOfSeconds); const FloatDuration_T lNumberOfMilliseconds = - (lNumberOfSeconds - lIntNumberOfSeconds) * static_cast<float> (MILLISECONDS_IN_ONE_SECOND); + (lNumberOfSeconds - lIntNumberOfSeconds) + * static_cast<float> (MILLISECONDS_IN_ONE_SECOND); const IntDuration_T lIntNumberOfMilliseconds = - floor(lNumberOfMilliseconds) + 1; // +1 is a trick to ensure that the next event is strictly later than the current one + floor(lNumberOfMilliseconds) + 1; // +1 is a trick to ensure that the next + // event is strictly later than the current one const Duration_T lDifferenceBetweenDepartureAndThisRequest = - boost::posix_time::seconds(lIntNumberOfSeconds) + boost::posix_time::millisec(lIntNumberOfMilliseconds); + boost::posix_time::seconds(lIntNumberOfSeconds) + + boost::posix_time::millisec(lIntNumberOfMilliseconds); const Time_T lHardcodedReferenceDepartureTime = boost::posix_time::hours(8); -const DateTime_T lDepartureDateTime = - boost::posix_time::ptime(lPreferredDepartureDate, lHardcodedReferenceDepartureTime); + const DateTime_T lDepartureDateTime = + boost::posix_time::ptime (lPreferredDepartureDate, + lHardcodedReferenceDepartureTime); const DateTime_T lDateTimeThisRequest = lDepartureDateTime + lDifferenceBetweenDepartureAndThisRequest; - ioRequest.setRequestDateTime (lDateTimeThisRequest); - + // Update random generation context _randomGenerationContext.setCumulativeProbabilitySoFar (lCumulativeProbabilityThisRequest); _randomGenerationContext.incrementGeneratedRequestsCounter (); - - return true; - + + + // Create the booking request with a hardcoded party size. + BookingRequestPtr_T oBookingRequest_ptr = + BookingRequestPtr_T (new BookingRequestStruct (lOrigin, lDestination, + lPreferredDepartureDate, + lDateTimeThisRequest, + lPassengerType, 1)); + assert (oBookingRequest_ptr != NULL); + return oBookingRequest_ptr; } } Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-02-10 10:14:09 UTC (rev 125) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// Boost +#include <boost/shared_ptr.hpp> // STL #include <iosfwd> // STDAIR @@ -12,13 +14,19 @@ #include <stdair/basic/DemandDistribution.hpp> #include <stdair/basic/RandomGeneration.hpp> #include <stdair/basic/RandomGenerationContext.hpp> +#include <stdair/bom/BomContent.hpp> #include <stdair/bom/BookingRequestStruct.hpp> namespace stdair { + + // Type definitions. + /** Define the smart pointer to a booking request. */ + typedef boost::shared_ptr<BookingRequestStruct> BookingRequestPtr_T; /** Class modeling a demand stream. */ - class DemandStream { - + class DemandStream : public BomContent { + friend class FacBomContent; + public: // ///////////// Getters /////////// /** Get the key */ @@ -37,13 +45,37 @@ void setKey (const DemandStreamKey_T& iKey) { _key = iKey; } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { ioOut << toString(); } + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return std::string (""); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return std::string (""); } + public: - // /////////////// Business Methods ////////// + // /////////////// Business Methods ////////////// + /** Check whether enough requests have already been generated. */ + const bool stillHavingRequestsToBeGenerated () const; + /** Generate the next request. */ - bool generateNext (BookingRequestStruct&); + BookingRequestPtr_T generateNext (); - public: + private: // ////////// Constructors and destructors ///////// /** Constructor by default */ DemandStream (const DemandStreamKey_T&, const DemandCharacteristics&, @@ -53,7 +85,6 @@ /** Destructor */ virtual ~DemandStream (); - private: /** Default constructors. */ DemandStream (); DemandStream (const DemandStream&); Modified: trunk/stdair/stdair/bom/EventStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.cpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/EventStruct.cpp 2010-02-10 10:14:09 UTC (rev 125) @@ -10,14 +10,11 @@ // ////////////////////////////////////////////////////////////////////// EventStruct:: EventStruct(const EventType_T& iEventType, const DateTime_T& iDateTime, - DemandStream& ioDemandStream, BookingRequestStruct* const iRequest) + DemandStream& ioDemandStream, BookingRequestPtr_T ioRequestPtr) : _eventType (iEventType), _eventDateTime (iDateTime), - _demandStream (&ioDemandStream), - _request (NULL) { - if (iEventType == "Request") { - _request = iRequest; - } + _demandStream (&ioDemandStream) { + _request = ioRequestPtr; } // ////////////////////////////////////////////////////////////////////// @@ -25,15 +22,15 @@ EventStruct (const EventStruct& iEventStruct) : _eventType (iEventStruct._eventType), _eventDateTime (iEventStruct._eventDateTime), - _demandStream (iEventStruct._demandStream), - _request (iEventStruct._request) { + _demandStream (iEventStruct._demandStream) { + _request = iEventStruct._request; } // ////////////////////////////////////////////////////////////////////// EventStruct::EventStruct (const DateTime_T& iDateTime) : _eventType (""), _eventDateTime (iDateTime), - _request (NULL) { + _demandStream (NULL) { } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/EventStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.hpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/bom/EventStruct.hpp 2010-02-10 10:14:09 UTC (rev 125) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// Boost +#include <boost/shared_ptr.hpp> // STDAIR #include <stdair/STDAIR_Types.hpp> @@ -12,6 +14,10 @@ /** Forward declaration */ struct BookingRequestStruct; class DemandStream; + + // Type definitions. + /** Define the smart pointer to a booking request. */ + typedef boost::shared_ptr<BookingRequestStruct> BookingRequestPtr_T; /** Event struct. */ struct EventStruct { @@ -28,9 +34,10 @@ return _eventDateTime; } - /** Get the pointer Request event. */ - const BookingRequestStruct* getPointerToRequestEvent () const { - return _request; + /** Get the Request event. */ + const BookingRequestStruct& getBookingRequest () const { + assert (_request != NULL); + return *_request; } /** Get the demand stream of the event. */ @@ -43,7 +50,7 @@ // ////////// Constructors and destructors ///////// /** Constructor. */ EventStruct (const EventType_T&, const DateTime_T&, - DemandStream&, BookingRequestStruct* const); + DemandStream&, BookingRequestPtr_T); EventStruct (const DateTime_T&); /** Copy constructor. */ @@ -70,7 +77,7 @@ DemandStream* _demandStream; /** Pointer to Request event */ - BookingRequestStruct* _request; + BookingRequestPtr_T _request; }; Modified: trunk/stdair/stdair/factory/FacBomContent.cpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.cpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/factory/FacBomContent.cpp 2010-02-10 10:14:09 UTC (rev 125) @@ -5,6 +5,7 @@ #include <cassert> // STDAIR #include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/DemandStream.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/factory/FacSupervisor.hpp> #include <stdair/factory/FacBomContent.hpp> @@ -47,4 +48,27 @@ _instance = NULL; } + // //////////////////////////////////////////////////////////////////// + DemandStream& FacBomContent:: + createDemandStream (const DemandStreamKey_T& iKey, + const DemandCharacteristics& iDemandCharacteristics, + const DemandDistribution& iDemandDistribution, + const RandomSeed_T& iNumberOfRequestsSeed, + const RandomSeed_T& iRequestDateTimeSeed, + const RandomSeed_T& iDemandCharacteristicsSeed) { + DemandStream* aDemandStream_ptr = NULL; + + aDemandStream_ptr = new DemandStream (iKey, iDemandCharacteristics, + iDemandDistribution, + iNumberOfRequestsSeed, + iRequestDateTimeSeed, + iDemandCharacteristicsSeed); + assert (aDemandStream_ptr != NULL); + + // The new object is added to the BOM pool + _contentPool.push_back (aDemandStream_ptr); + + return *aDemandStream_ptr; + } + } Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-02-08 16:32:09 UTC (rev 124) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-02-10 10:14:09 UTC (rev 125) @@ -20,7 +20,10 @@ template<typename BOM> struct BomList_T; class BomStructure; class BomContent; + class DemandStream; struct OptimizerStruct_T; + struct DemandCharacteristics; + struct DemandDistribution; /** Base class for Factory layer. */ class FacBomContent { @@ -169,6 +172,16 @@ ioOutboundPath._flightPathCode = iReferenceOutboundPath._flightPathCode; } + + // ////////////////////////////////////////////////////////////////// + // //////////////////////// Normal Factory ////////////////////////// + // ////////////////////////////////////////////////////////////////// + /** Create the DemandStream object. */ + DemandStream& createDemandStream (const DemandStreamKey_T&, + const DemandCharacteristics&, + const DemandDistribution&, + const RandomSeed_T&, + const RandomSeed_T&, const RandomSeed_T&); public: /** Provide the unique instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-02-15 19:48:46
|
Revision: 143 http://stdair.svn.sourceforge.net/stdair/?rev=143&view=rev Author: denis_arnaud Date: 2010-02-15 19:48:39 +0000 (Mon, 15 Feb 2010) Log Message: ----------- [Dev] Improved the pretty print within the BomManager class. There is still some work to perform on the segment-related branch of the BOM tree. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_General.hpp trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp Added Paths: ----------- trunk/stdair/stdair/basic/BasConst_BomManager.hpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-02-15 16:25:42 UTC (rev 142) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-02-15 19:48:39 UTC (rev 143) @@ -488,4 +488,51 @@ (Origin & Destination). */ const unsigned short MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND = 3; + + // ////////// BomManager-related constants /////////// + /** Array with the indentation spaces needed for all the BOM + hierachical levels. */ + const std::string DISPLAY_LEVEL_STRING_ARRAY[51] = + { "", " ", " ", " ", + " ", " ", " ", " ", + " ", " ", " ", + " ", " ", + " ", " ", + " ", " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " }; + + } Copied: trunk/stdair/stdair/basic/BasConst_BomManager.hpp (from rev 142, trunk/stdair/stdair/basic/BasConst_General.hpp) =================================================================== --- trunk/stdair/stdair/basic/BasConst_BomManager.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_BomManager.hpp 2010-02-15 19:48:39 UTC (rev 143) @@ -0,0 +1,16 @@ +#ifndef __STDAIR_BAS_BASCONST_BOMMANAGER_HPP +#define __STDAIR_BAS_BASCONST_BOMMANAGER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> + +namespace stdair { + + /** Array with the indentation spaces needed for all the BOM + hierachical levels. */ + extern const std::string DISPLAY_LEVEL_STRING_ARRAY[51]; +} +#endif // __STDAIR_BAS_BASCONST_BOMMANAGER_HPP Modified: trunk/stdair/stdair/basic/BasConst_General.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_General.hpp 2010-02-15 16:25:42 UTC (rev 142) +++ trunk/stdair/stdair/basic/BasConst_General.hpp 2010-02-15 19:48:39 UTC (rev 143) @@ -4,7 +4,7 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// LATUS Common +// StdAir #include <stdair/STDAIR_Types.hpp> namespace stdair { Modified: trunk/stdair/stdair/basic/sources.mk =================================================================== --- trunk/stdair/stdair/basic/sources.mk 2010-02-15 16:25:42 UTC (rev 142) +++ trunk/stdair/stdair/basic/sources.mk 2010-02-15 19:48:39 UTC (rev 143) @@ -6,6 +6,7 @@ $(top_srcdir)/stdair/basic/BasConst_Yield.hpp \ $(top_srcdir)/stdair/basic/BasConst_Period_BOM.hpp \ $(top_srcdir)/stdair/basic/BasConst_TravelSolution.hpp \ + $(top_srcdir)/stdair/basic/BasConst_BomManager.hpp \ $(top_srcdir)/stdair/basic/StructAbstract.hpp \ $(top_srcdir)/stdair/basic/BasChronometer.hpp \ $(top_srcdir)/stdair/basic/BasFileMgr.hpp \ Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-02-15 16:25:42 UTC (rev 142) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-02-15 19:48:39 UTC (rev 143) @@ -4,7 +4,8 @@ // STL #include <cassert> #include <ostream> -// STDAIR +// StdAir +#include <stdair/basic/BasConst_BomManager.hpp> #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/AirlineFeatureSet.hpp> #include <stdair/bom/AirlineFeature.hpp> @@ -21,6 +22,7 @@ #include <stdair/bom/NetworkDate.hpp> #include <stdair/bom/AirportDate.hpp> #include <stdair/bom/OutboundPath.hpp> +#include <stdair/bom/BookingRequestStruct.hpp> #include <stdair/bom/BomManager.hpp> namespace stdair { @@ -70,7 +72,7 @@ const FlightDate& lCurrentFD = *itFD; // Call recursively the display() method on the children objects - display (oStream, lCurrentFD); + csvFlightDateDisplay (oStream, lCurrentFD); } // Reset formatting flags of the given output stream @@ -78,24 +80,46 @@ } // ////////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const FlightDate& iFlightDate) { + void BomManager::csvFlightDateDisplay (std::ostream& oStream, + const FlightDate& iFlightDate) { // Store current formatting flags of the given output stream std::ios::fmtflags oldFlags = oStream.flags(); - // Flight-date level - oStream << iFlightDate.describeKey() << std::endl; + // Display FlightDate-level information + oStream << "******************************************" << std::endl; + oStream << "FlightDate: " << iFlightDate.describeKey() << std::endl + << "-----------" << std::endl; + oStream << "FlightNb (FlightDate), " + << "SS, Rev, Fare, ASK, Yield, RPK, URev, LF, " + << std::endl << std::endl; + + oStream << iFlightDate.getFlightNumber() + << " (" << iFlightDate.getFlightDate() << "), " + << iFlightDate.getBookingCounter() << ", " + << iFlightDate.getRevenue() << ", " + << iFlightDate.getAverageFare() << ", " + << iFlightDate.getASK() << ", " + << iFlightDate.getYield() << ", " + << iFlightDate.getRPK() << ", " + << iFlightDate.getUnitRevenue() << ", " + << iFlightDate.getLoadFactor() << ", " << std::endl; + oStream << "******************************************" << std::endl; - // Browse the LegDate objects - const LegDateList_T& lLDList = iFlightDate.getLegDateList(); - for (LegDateList_T::iterator itLD = lLDList.begin(); - itLD != lLDList.end(); ++itLD) { - const LegDate& lCurrentLD = *itLD; - - // Call recursively the display() method on the children objects - display (oStream, lCurrentLD); - } + // Display the leg-dates + csvLegDateDisplay (oStream, iFlightDate); + // Display the leg-cabins + csvLegCabinDisplay (oStream, iFlightDate); + + // Display the buckets + csvBPVDisplay (oStream, iFlightDate); + + // Display the segment-cabins + // csvSegmentCabinDisplay (oStream, iFlightDate); + + // Display the booking classes + // csvClassDisplay (oStream, iFlightDate); + // Browse the SegmentDate objects const SegmentDateList_T& lSDList = iFlightDate.getSegmentDateList(); for (SegmentDateList_T::iterator itSD = lSDList.begin(); @@ -111,42 +135,137 @@ } // ////////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const LegDate& iLegDate) { + void BomManager::csvLegDateDisplay (std::ostream& oStream, + const FlightDate& iFlightDate) { // Store current formatting flags of the given output stream std::ios::fmtflags oldFlags = oStream.flags(); - // Leg-date level - oStream << iLegDate.describeKey() << std::endl; + // Display the header + oStream << "******************************************" << std::endl; + oStream << "Leg-Dates:" << std::endl + << "----------" << std::endl; + oStream << "FlightNb (FlightDate), Leg, " + << "Dates, Times, Dist, Cap, ASK, SS, LF, " + << std::endl << std::endl; - // Browse the LegCabin objects - const LegCabinList_T& lLCList = iLegDate.getLegCabinList(); - for (LegCabinList_T::iterator itLC = lLCList.begin(); - itLC != lLCList.end(); ++itLC) { - const LegCabin& lCurrentLC = *itLC; - - // Call recursively the display() method on the children objects - display (oStream, lCurrentLC); + // Browse the LegDate objects + const LegDateList_T& lLDList = iFlightDate.getLegDateList(); + for (LegDateList_T::iterator itLD = lLDList.begin(); + itLD != lLDList.end(); ++itLD) { + const LegDate& lCurrentLD = *itLD; + + oStream << iFlightDate.getFlightNumber() + << " (" << iFlightDate.getFlightDate() << "), " + << lCurrentLD.getBoardingPoint() << "-" + << lCurrentLD.getOffPoint() << ", " + << lCurrentLD.getBoardingDate() << " -> " + << lCurrentLD.getOffDate() << " / " + << lCurrentLD.getDateOffSet() << ", " + << lCurrentLD.getBoardingTime() << " -> " + << lCurrentLD.getOffTime() << " (" + << lCurrentLD.getTimeOffSet() << ") / " + << lCurrentLD.getElapsedTime() << ", " + << lCurrentLD.getDistance() << ", " + << lCurrentLD.getCapacity() << ", " + << lCurrentLD.getASK() << ", " + << lCurrentLD.getSoldSeat() << ", " + << lCurrentLD.getLoadFactor() << ", " + << std::endl; } + oStream << "******************************************" << std::endl; // Reset formatting flags of the given output stream oStream.flags (oldFlags); } // ////////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const LegCabin& iLegCabin) { + void BomManager::csvLegCabinDisplay (std::ostream& oStream, + const FlightDate& iFlightDate) { // Store current formatting flags of the given output stream std::ios::fmtflags oldFlags = oStream.flags(); - // Leg-cabin level - oStream << iLegCabin.describeKey() << std::endl; - + // Display the header + oStream << "******************************************" << std::endl; + oStream << "LegCabins:" << std::endl + << "----------" << std::endl; + oStream << "FlightNb (FlightDate), Leg, Cabin, " + << "Cap, SS, CS, AvlPool, Avl, BP, " + << std::endl; + + // Browse the LegDate objects + const LegDateList_T& lLDList = iFlightDate.getLegDateList(); + for (LegDateList_T::iterator itLD = lLDList.begin(); + itLD != lLDList.end(); ++itLD) { + const LegDate& lCurrentLD = *itLD; + + // Browse the LegCabin objects + const LegCabinList_T& lLCList = lCurrentLD.getLegCabinList(); + for (LegCabinList_T::iterator itLC = lLCList.begin(); + itLC != lLCList.end(); ++itLC) { + const LegCabin& lCurrentLC = *itLC; + + oStream << iFlightDate.getFlightNumber() + << " (" << iFlightDate.getFlightDate() << "), " + << lCurrentLD.getBoardingPoint() << "-" + << lCurrentLD.getOffPoint() << ", " + << lCurrentLC.getCabinCode() << ", " + << lCurrentLC.getCapacity() << ", " + << lCurrentLC.getSoldSeat() << ", " + << lCurrentLC.getCommitedSpace() << ", " + << lCurrentLC.getAvailabilityPool() << ", " + << lCurrentLC.getAvailability() << ", " + << lCurrentLC.getCurrentBidPrice() << ", " << std::endl; + } + } + oStream << "******************************************" << std::endl; + // Reset formatting flags of the given output stream oStream.flags (oldFlags); } // ////////////////////////////////////////////////////////////////////// + void BomManager::csvBPVDisplay (std::ostream& oStream, + const FlightDate& iFlightDate) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + // Display the header + oStream << "******************************************" << std::endl; + oStream << "Bid-Price Vector:" << std::endl; + oStream << "Leg, Cabin, Yield, AV0, DSE, AV1, AV2, AV3, AV, SI" << std::endl; + + // Browse the LegDate objects + const LegDateList_T& lLDList = iFlightDate.getLegDateList(); + for (LegDateList_T::iterator itLD = lLDList.begin(); + itLD != lLDList.end(); ++itLD) { + const LegDate& lCurrentLD = *itLD; + + // Browse the LegCabin objects + const LegCabinList_T& lLCList = lCurrentLD.getLegCabinList(); + for (LegCabinList_T::iterator itLC = lLCList.begin(); + itLC != lLCList.end(); ++itLC) { + LegCabin& lCurrentLC = *itLC; + + const BidPriceVector_T& aBidPriceVector = lCurrentLC.getBidPriceVector(); + for (BidPriceVector_T::const_reverse_iterator itBidPrice = + aBidPriceVector.rbegin(); + itBidPrice != aBidPriceVector.rend(); ++itBidPrice) { + const BidPrice_T& aBidPrice = *itBidPrice; + + oStream << lCurrentLD.getBoardingPoint() << "-" + << lCurrentLD.getOffPoint() << ", " + << lCurrentLC.getCabinCode() << ", " + << aBidPrice << ", " << std::endl; + } + } + } + oStream << "******************************************" << std::endl; + + // Reset formatting flags of the given output stream + oStream.flags (oldFlags); + } + + // ////////////////////////////////////////////////////////////////////// void BomManager::display (std::ostream& oStream, const SegmentDate& iSegmentDate) { // Store current formatting flags of the given output stream @@ -292,5 +411,32 @@ // Reset formatting flags of the given output stream oStream.flags (oldFlags); } + + // ////////////////////////////////////////////////////////////////////// + void BomManager::csvDisplay (std::ostream& oStream, + const BookingRequestStruct& iBookingRequest) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + /* + #id, request_date (YYMMDD), request_time (HHMMSS), POS (three-letter code), + origin (three-letter code), destination (three-letter code), + preferred departure date (YYMMDD), preferred departure time (HHMM), + min departure time (HHMM), max departure time (HHMM), + preferred cabin (F/C/M), trip type (OW/RO/RI), duration of stay (days), + frequent flyer tier (G/S/K/N), willingness-to-pay (SGD), + disutility per stop (SGD), preferred arrival date (YYMMDD), + preferred arrival time (HHMM), value of time (SGD per hour) + + #Preferred cabin: F=First, C=Business M=Economy + #Trip type: OW=One-way, RO=Round-trip outbound portion, + RI=Round-trip inbound portion + #Duration of stay: irrelevant in case of one-way, but set to 0 + #Frequent-flyer tier: G=Gold, S=Silver, K=Basic (Krisflyer), N=None + */ + // Reset formatting flags of the given output stream + oStream.flags (oldFlags); + } + } Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-02-15 16:25:42 UTC (rev 142) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-02-15 19:48:39 UTC (rev 143) @@ -22,6 +22,7 @@ class NetworkDate; class AirportDate; class OutboundPath; + struct BookingRequestStruct; /** Utility class for StdAir objects. */ class BomManager { @@ -46,26 +47,33 @@ @param std::ostream& Output stream in which the BOM tree should be logged/dumped. @param const FlightDate& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const FlightDate&); + static void csvFlightDateDisplay (std::ostream&, const FlightDate&); /** Recursively display (dump in the underlying output log stream) the objects of the given BOM tree. @param std::ostream& Output stream in which the BOM tree should be logged/dumped. @param const LegDate& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const LegDate&); + static void csvLegDateDisplay (std::ostream&, const FlightDate&); /** Recursively display (dump in the underlying output log stream) the objects of the given BOM tree. @param std::ostream& Output stream in which the BOM tree should be logged/dumped. @param const LegCabin& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const LegCabin&); + static void csvLegCabinDisplay (std::ostream&, const FlightDate&); /** Recursively display (dump in the underlying output log stream) the objects of the given BOM tree. @param std::ostream& Output stream in which the BOM tree should be logged/dumped. + @param const LegCabin& Root of the BOM tree to be displayed. */ + static void csvBPVDisplay (std::ostream&, const FlightDate&); + + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. + @param std::ostream& Output stream in which the BOM tree should be + logged/dumped. @param const SegmentDate& Root of the BOM tree to be displayed. */ static void display (std::ostream&, const SegmentDate&); @@ -110,7 +118,15 @@ logged/dumped. @param const OutboundPath& Root of the BOM tree to be displayed. */ static void display (std::ostream&, const OutboundPath&); - }; + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. + @param std::ostream& Output stream in which the BOM tree should be + logged/dumped. + @param const LegCabin& Root of the BOM tree to be displayed. */ + static void csvDisplay (std::ostream&, + const BookingRequestStruct& iBookingRequest); + }; + } #endif // __STDAIR_BOM_BOMMANAGER_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-05-26 13:14:00
|
Revision: 190 http://stdair.svn.sourceforge.net/stdair/?rev=190&view=rev Author: quannaus Date: 2010-05-26 13:13:51 +0000 (Wed, 26 May 2010) Log Message: ----------- [Dev] Fixed a bug in the cloning process in FacBomContent.hpp Modified Paths: -------------- trunk/stdair/stdair/bom/OutboundPath.cpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/OutboundPath.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.cpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/OutboundPath.cpp 2010-05-26 13:13:51 UTC (rev 190) @@ -189,7 +189,8 @@ } // //////////////////////////////////////////////////////////////////// - const Duration_T OutboundPath::calculateElapsedTimeFromRouting () const { + const Duration_T OutboundPath:: + calculateElapsedTimeFromRouting (const SegmentDate& iSegmentDate) const { const SegmentDateList_T& lAllSegmentList = getSegmentDateList(); SegmentDateList_T::iterator itSegmentDate = lAllSegmentList.begin(); @@ -228,7 +229,15 @@ lCurrentSegmentDate_ptr->getElapsedTime(); oElapsedTime += currentElapsedTime; } - + + SegmentDateList_T::reverse_iterator itLastSegmentDate = + lAllSegmentList.rbegin(); + const SegmentDate& lLastSegmentDate = *itLastSegmentDate; + const Duration_T& lLastStop = iSegmentDate.getBoardingTime() + - lLastSegmentDate.getOffTime(); + oElapsedTime += lLastStop; + oElapsedTime += iSegmentDate.getElapsedTime(); + // Store the result return oElapsedTime; } Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -98,7 +98,7 @@ <br>Of course, in case of mono-segment outbound pathes, there is no stop-over, and the elapsed time of the outbound-path is equal to the elapsed time of the single routing segment. */ - const Duration_T calculateElapsedTimeFromRouting ()const; + const Duration_T calculateElapsedTimeFromRouting (const SegmentDate&) const; /** Update Airline Code. */ void updateAirlineCode (); Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-26 13:13:51 UTC (rev 190) @@ -79,20 +79,26 @@ bool SegmentDate:: isConnectable (const SegmentDate& iSegmentDate) const { bool oIsConnectable = false; - - const Date_T& lOffDate = getOffDate(); - const Date_T& lBoardingDate = iSegmentDate.getBoardingDate(); - const DateOffSet_T lDateOffSet = lBoardingDate - lOffDate; - const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); - - const Duration_T& lOffTime = getOffTime(); - const Duration_T& lBoardingTime = iSegmentDate.getBoardingTime(); - - const Duration_T lStopOverTime = - lBoardingTime - lOffTime + lDateOffSetInHours; - oIsConnectable = lStopOverTime >= DEFAULT_MINIMUM_CONNECTION_TIME; + const AirportCode_T lOffPoint = getOffPoint(); + const AirportCode_T lBoardingPointOfNextSegment = + iSegmentDate.getBoardingPoint(); + if (lOffPoint == lBoardingPointOfNextSegment) { + const Date_T& lOffDate = getOffDate(); + const Date_T& lBoardingDate = iSegmentDate.getBoardingDate(); + const DateOffSet_T lDateOffSet = lBoardingDate - lOffDate; + const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); + + const Duration_T& lOffTime = getOffTime(); + const Duration_T& lBoardingTime = iSegmentDate.getBoardingTime(); + + const Duration_T lStopOverTime = + lBoardingTime - lOffTime + lDateOffSetInHours; + + oIsConnectable = lStopOverTime >= DEFAULT_MINIMUM_CONNECTION_TIME; + } + return oIsConnectable; } Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -68,6 +68,9 @@ ioChild._structure); if (hasLinkBeenSuccessful == false) { + std::cout << "link with parent" << std::endl; + std::cout << ioParent.describeKey() << std::endl; + std::cout << ioChild.describeShortKey() << std::endl; throw ObjectLinkingException(); } } @@ -123,8 +126,13 @@ typedef BomChildrenHolderImp<CHILD> CHILDREN_HOLDER_T; CHILDREN_HOLDER_T*& lChildrenHolder_ptr = boost::fusion::at_key<CHILD> (ioParent._structure._holderMap); - lChildrenHolder_ptr = + CHILDREN_HOLDER_T*& lReferenceChildrenHolder_ptr = boost::fusion::at_key<CHILD> (iReferenceParent._structure._holderMap); + assert (lReferenceChildrenHolder_ptr != NULL); + + FacBomStructure:: + cloneChildrenHolder (lChildrenHolder_ptr, + *lReferenceChildrenHolder_ptr); } private: Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -161,7 +161,19 @@ return true; } - + + // ////////////////////////////////////////////////////////////////// + /** Clone the children holder.*/ + template <typename HOLDER> + static void cloneChildrenHolder (HOLDER*& ioHolder_ptr, + const HOLDER& iReferenceHolder) { + if (ioHolder_ptr == NULL) { + ioHolder_ptr = &instance().create<HOLDER> (); + } + ioHolder_ptr->_bomChildrenMap = iReferenceHolder._bomChildrenMap; + ioHolder_ptr->_bomChildrenList = iReferenceHolder._bomChildrenList; + } + protected: /** Default Constructor. <br>This constructor is protected to ensure the class is structure. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-06-28 11:19:18
|
Revision: 206 http://stdair.svn.sourceforge.net/stdair/?rev=206&view=rev Author: denis_arnaud Date: 2010-06-28 11:19:12 +0000 (Mon, 28 Jun 2010) Log Message: ----------- [Dev] Added pragma directives to support Boost versions lower than 1.35 (e.g., for RedHat/CentOS 5). Modified Paths: -------------- trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 11:05:45 UTC (rev 205) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 11:19:12 UTC (rev 206) @@ -9,7 +9,7 @@ // Boost Fusion #include <boost/version.hpp> #if BOOST_VERSION >= 103500 -#include <boost/fusion/include/map.hpp> +//#include <boost/fusion/include/map.hpp> #include <boost/fusion/include/at_key.hpp> #endif // BOOST_VERSION >= 103500 // STDAIR Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-06-28 11:05:45 UTC (rev 205) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-06-28 11:19:12 UTC (rev 206) @@ -5,8 +5,12 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <map> -// STDAIR +#include <cassert> +// Boost Fusion +#if BOOST_VERSION >= 103500 +#include <boost/fusion/include/at_key.hpp> +#endif // BOOST_VERSION >= 103500 +// StdAir #include <stdair/STDAIR_Types.hpp> #include <stdair/basic/BasConst_Inventory.hpp> #include <stdair/basic/DemandCharacteristicTypes.hpp> Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 11:05:45 UTC (rev 205) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 11:19:12 UTC (rev 206) @@ -8,11 +8,11 @@ #include <cassert> #include <string> #include <vector> -#include <iostream> +//#include <iostream> // Boost Fusion #if BOOST_VERSION >= 103500 -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> +//#include <boost/fusion/container/map.hpp> +//#include <boost/fusion/include/map.hpp> #include <boost/fusion/include/at_key.hpp> #else // BOOST_VERSION >= 103500 #include <boost/mpl/map.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-08-03 08:30:51
|
Revision: 256 http://stdair.svn.sourceforge.net/stdair/?rev=256&view=rev Author: quannaus Date: 2010-08-03 08:30:45 +0000 (Tue, 03 Aug 2010) Log Message: ----------- [dev] Added reset funtions for trademgen. Modified Paths: -------------- trunk/stdair/stdair/basic/RandomGenerationContext.cpp trunk/stdair/stdair/basic/RandomGenerationContext.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp Modified: trunk/stdair/stdair/basic/RandomGenerationContext.cpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-03 08:30:45 UTC (rev 256) @@ -29,4 +29,10 @@ ++_numberOfRequestsGeneratedSoFar; } + // ////////////////////////////////////////////////////////////////////// + void RandomGenerationContext::reset () { + _cumulativeProbabilitySoFar = 0.0; + _numberOfRequestsGeneratedSoFar = 0; + } + } Modified: trunk/stdair/stdair/basic/RandomGenerationContext.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-03 08:30:45 UTC (rev 256) @@ -26,6 +26,9 @@ /** Increment counter of requests generated so far */ void incrementGeneratedRequestsCounter (); + /** Reset the counters. */ + void reset (); + // ////////// Attributes ////////// /** Cumulative probability in arrival pattern for last request generated so far (needed for sequential generation)*/ Modified: trunk/stdair/stdair/bom/DemandStream.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.cpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/bom/DemandStream.cpp 2010-08-03 08:30:45 UTC (rev 256) @@ -46,5 +46,10 @@ // //////////////////////////////////////////////////////////////////// void DemandStream::init () { } - + + // //////////////////////////////////////////////////////////////////// + void DemandStream::reset () { + DemandStreamContent::init (); + _randomGenerationContext.reset(); + } } Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-08-03 08:30:45 UTC (rev 256) @@ -64,6 +64,11 @@ at any level). */ const std::string describeKey() const { return _key.toString(); } + public: + // ////////// Business Methods ////////// + /** Reset all the contexts of the demand stream. */ + void reset (); + protected: // ////////// Constructors and destructors ///////// /** Constructor by default */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-06 12:38:14
|
Revision: 307 http://stdair.svn.sourceforge.net/stdair/?rev=307&view=rev Author: denis_arnaud Date: 2010-09-06 12:38:03 +0000 (Mon, 06 Sep 2010) Log Message: ----------- [Conf] Fixed the variable names for installation of the header files. Modified Paths: -------------- trunk/stdair/stdair/Makefile.am trunk/stdair/stdair/basic/Makefile.am trunk/stdair/stdair/bom/Makefile.am trunk/stdair/stdair/command/Makefile.am trunk/stdair/stdair/core/Makefile.am trunk/stdair/stdair/dbadaptor/Makefile.am trunk/stdair/stdair/factory/Makefile.am trunk/stdair/stdair/service/Makefile.am Modified: trunk/stdair/stdair/Makefile.am =================================================================== --- trunk/stdair/stdair/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -15,3 +15,4 @@ # Header files #nobase_pkginclude_HEADERS = $(service_h_sources) #nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h + Modified: trunk/stdair/stdair/basic/Makefile.am =================================================================== --- trunk/stdair/stdair/basic/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/basic/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -12,4 +12,5 @@ # Header files pkgincludedir = $(includedir)/stdair/basic -pkginclude_HEADERS = $(bas_h_sources) +pkginclude_HEADERS = $(stdair_bas_h_sources) + Modified: trunk/stdair/stdair/bom/Makefile.am =================================================================== --- trunk/stdair/stdair/bom/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/bom/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -12,4 +12,5 @@ # Header files pkgincludedir = $(includedir)/stdair/bom -pkginclude_HEADERS = $(bom_h_sources) +pkginclude_HEADERS = $(stdair_bom_h_sources) + Modified: trunk/stdair/stdair/command/Makefile.am =================================================================== --- trunk/stdair/stdair/command/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/command/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -13,4 +13,5 @@ # Header files pkgincludedir = $(includedir)/stdair/command -pkginclude_HEADERS = $(cmd_h_sources) +pkginclude_HEADERS = $(stdair_cmd_h_sources) + Modified: trunk/stdair/stdair/core/Makefile.am =================================================================== --- trunk/stdair/stdair/core/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/core/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -27,4 +27,5 @@ # pkgincludedir = $(includedir)/stdair -pkginclude_HEADERS = $(service_h_sources) +pkginclude_HEADERS = $(stdair_service_h_sources) + Modified: trunk/stdair/stdair/dbadaptor/Makefile.am =================================================================== --- trunk/stdair/stdair/dbadaptor/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/dbadaptor/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -13,4 +13,5 @@ # Header files pkgincludedir = $(includedir)/stdair/dbadaptor -pkginclude_HEADERS = $(dba_h_sources) +pkginclude_HEADERS = $(stdair_dba_h_sources) + Modified: trunk/stdair/stdair/factory/Makefile.am =================================================================== --- trunk/stdair/stdair/factory/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/factory/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -11,4 +11,5 @@ # Header files pkgincludedir = $(includedir)/stdair/factory -pkginclude_HEADERS = $(fac_h_sources) +pkginclude_HEADERS = $(stdair_fac_h_sources) + Modified: trunk/stdair/stdair/service/Makefile.am =================================================================== --- trunk/stdair/stdair/service/Makefile.am 2010-09-06 10:21:00 UTC (rev 306) +++ trunk/stdair/stdair/service/Makefile.am 2010-09-06 12:38:03 UTC (rev 307) @@ -12,4 +12,5 @@ # Header files pkgincludedir = $(includedir)/stdair/service -pkginclude_HEADERS = $(svc_h_sources) +pkginclude_HEADERS = $(stdair_svc_h_sources) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-10-04 09:11:57
|
Revision: 340 http://stdair.svn.sourceforge.net/stdair/?rev=340&view=rev Author: quannaus Date: 2010-10-04 09:11:49 +0000 (Mon, 04 Oct 2010) Log Message: ----------- [dev-temporary] Added a generator of random seeds for trademgen, should be moved in trademgen module later. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/EventQueue.cpp trunk/stdair/stdair/bom/EventStruct.cpp trunk/stdair/stdair/bom/EventStruct.hpp trunk/stdair/stdair/bom/EventTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -429,6 +429,9 @@ // Date / Time /** Time duration in (integer) number of seconds */ typedef long int IntDuration_T; + + /** Time duration in (long long integer) number of milliseconds */ + typedef long long int LongDuration_T; /** Duration in (float) number of time units */ typedef float FloatDuration_T; Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -50,7 +50,7 @@ // // //////// General /////// /** Default date for the General. */ - const Date_T DEFAULT_DATE (2007, boost::gregorian::Jan, 1); + const Date_T DEFAULT_DATE (2010, boost::gregorian::Jan, 1); /** Default date&time. */ const DateTime_T DEFAULT_DATETIME (DEFAULT_DATE, NULL_BOOST_TIME_DURATION); Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -4,12 +4,15 @@ // STL #include <cassert> // STDAIR +#include <stdair/basic/BasConst_General.hpp> #include <stdair/bom/BomRoot.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - BomRoot::BomRoot (const Key_T& iKey) : _key (iKey) { + BomRoot::BomRoot (const Key_T& iKey) + : _key (iKey), _seed (DEFAULT_RANDOM_SEED), _generator (_seed), + _uniformGenerator (_generator, boost::uniform_real<> (0, 1)) { } // //////////////////////////////////////////////////////////////////// @@ -23,4 +26,11 @@ return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + RandomSeed_T BomRoot::generateSeed () { + RealNumber_T lVariateUnif = _uniformGenerator() * 1e9; + RandomSeed_T oSeed = static_cast<RandomSeed_T> (lVariateUnif); + return oSeed; + } + } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -4,6 +4,9 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// Boost Random +#include <boost/random/uniform_real.hpp> +#include <boost/random/variate_generator.hpp> // STDAIR #include <stdair/bom/BomAbstract.hpp> #include <stdair/bom/BomRootKey.hpp> @@ -51,6 +54,14 @@ // Attributes Key_T _key; HolderMap_T _holderMap; + + // TEST + stdair::RandomSeed_T _seed; + stdair::BaseGenerator_T _generator; + boost::variate_generator<stdair::BaseGenerator_T&, + boost::uniform_real<> > _uniformGenerator; + public: + RandomSeed_T generateSeed (); }; } Modified: trunk/stdair/stdair/bom/EventQueue.cpp =================================================================== --- trunk/stdair/stdair/bom/EventQueue.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventQueue.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -23,13 +23,13 @@ // ////////////////////////////////////////////////////////////////////// void EventQueue::addEvent (EventStruct& ioEventStruct) { - const DateTime_T& lEventDateTime = ioEventStruct.getEventDateTime (); const bool insertionSucceeded = - _eventList.insert (EventListElement_T (lEventDateTime, ioEventStruct)).second; + _eventList.insert (EventListElement_T (ioEventStruct._eventTimestamp, + ioEventStruct)).second; // If the insertion is not succeded. if (insertionSucceeded == false) { - ioEventStruct.moveForwardInTime(); + ++ioEventStruct._eventTimestamp; addEvent (ioEventStruct); } } Modified: trunk/stdair/stdair/bom/EventStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventStruct.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -10,36 +10,29 @@ // ////////////////////////////////////////////////////////////////////// EventStruct:: - EventStruct(const EventType_T& iEventType, const DateTime_T& iDateTime, - const DemandStreamKeyStr_T& iDemandStreamKey, - BookingRequestPtr_T ioRequestPtr) - : _eventType (iEventType), _eventDateTime (iDateTime), - _demandStreamKey (iDemandStreamKey) { + EventStruct (const EventType_T& iEventType, + const DemandStreamKeyStr_T& iDemandStreamKey, + BookingRequestPtr_T ioRequestPtr) + : _eventType (iEventType), _demandStreamKey (iDemandStreamKey) { _request = ioRequestPtr; + + // Compute the number of seconds between iDateTime and DEFAULT_DATETIME. + assert (ioRequestPtr != NULL); + Duration_T lDuration = ioRequestPtr->getRequestDateTime() - DEFAULT_DATETIME; + _eventTimestamp = lDuration.total_milliseconds(); } // ////////////////////////////////////////////////////////////////////// EventStruct:: EventStruct (const EventStruct& iEventStruct) : _eventType (iEventStruct._eventType), - _eventDateTime (iEventStruct._eventDateTime), + _eventTimestamp (iEventStruct._eventTimestamp), _demandStreamKey (iEventStruct._demandStreamKey) { _request = iEventStruct._request; } // ////////////////////////////////////////////////////////////////////// - EventStruct::EventStruct (const DateTime_T& iDateTime) - : _eventType (""), _eventDateTime (iDateTime), - _demandStreamKey ("") { - } - - // ////////////////////////////////////////////////////////////////////// EventStruct::~EventStruct () { } - // //////////////////////////////////////////////////////////////////// - void EventStruct::moveForwardInTime () { - _eventDateTime += DEFAULT_EPSILON_DURATION; - } - } Modified: trunk/stdair/stdair/bom/EventStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventStruct.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -12,7 +12,8 @@ /** Event struct. */ struct EventStruct { - + friend struct EventQueue; + public: // ///////////// Getters /////////// /** Get the event type */ @@ -20,11 +21,6 @@ return _eventType; } - /** Get the event datetime */ - const DateTime_T& getEventDateTime () const { - return _eventDateTime; - } - /** Get the Request event. */ const BookingRequestStruct& getBookingRequest () const { assert (_request != NULL); @@ -35,34 +31,28 @@ const DemandStreamKeyStr_T& getDemandStreamKey () const { return _demandStreamKey; } - - public: - // ///////////////// Business Methods ///////////////// - /** Move the event forward in time by one nanosecond. */ - void moveForwardInTime (); public: // ////////// Constructors and destructors ///////// /** Constructor. */ - EventStruct (const EventType_T&, const DateTime_T&, - const DemandStreamKeyStr_T&, BookingRequestPtr_T); - EventStruct (const DateTime_T&); + EventStruct (const EventType_T&, const DemandStreamKeyStr_T&, + BookingRequestPtr_T); /** Copy constructor. */ EventStruct (const EventStruct&); /** Destructor. */ ~EventStruct (); - private: /** Default constructors. */ EventStruct (); - private: // ////////// Attributes ////////// /** Event type */ EventType_T _eventType; - /** Event datetime */ - DateTime_T _eventDateTime; + /** Reprentative timestamp of the event, which is the number of + milliseconds between the event date-time and the default + date-time (2010-01-01 00:00:00) */ + LongDuration_T _eventTimestamp; /** The demand stream which generated this event. */ DemandStreamKeyStr_T _demandStreamKey; /** Pointer to Request event */ Modified: trunk/stdair/stdair/bom/EventTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/EventTypes.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventTypes.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -16,10 +16,10 @@ struct EventStruct; // Define a list of events. - typedef std::map<const DateTime_T, EventStruct> EventList_T; + typedef std::map<const LongDuration_T, EventStruct> EventList_T; // Define an element of a event list. - typedef std::pair<const DateTime_T, EventStruct> EventListElement_T; + typedef std::pair<const LongDuration_T, EventStruct> EventListElement_T; } #endif // __STDAIR_BOM_EVENTTYPES_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-12-02 15:54:52
|
Revision: 367 http://stdair.svn.sourceforge.net/stdair/?rev=367&view=rev Author: quannaus Date: 2010-12-02 15:54:45 +0000 (Thu, 02 Dec 2010) Log Message: ----------- [dev] Added the basic parser types and the constructor for the exceptions. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_General.hpp trunk/stdair/stdair/basic/PassengerType.cpp trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/command/DBManagerForAirlines.cpp trunk/stdair/stdair/factory/FacBomManager.hpp trunk/stdair/stdair/service/DBSessionManager.cpp trunk/stdair/stdair/service/Logger.cpp Added Paths: ----------- trunk/stdair/stdair/basic/BasParserHelperTypes.hpp trunk/stdair/stdair/basic/BasParserTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -26,44 +26,134 @@ } namespace stdair { - // Forward declarations class STDAIR_Service; - // ///////// Exceptions /////////// - class RootException : public std::exception { }; - - class FileNotFoundException : public RootException { }; - - class NonInitialisedLogServiceException : public RootException { }; - - class NonInitialisedDBSessionManagerException : public RootException { }; - - class NonInitialisedServiceException : public RootException { }; - - class NonInitialisedContainerException : public RootException { }; - - class NonInitialisedRelationShipException : public RootException { }; - - class MemoryAllocationException : public RootException { }; - - class ObjectLinkingException : public RootException { }; - - class ParserException : public RootException { }; - - class DocumentNotFoundException : public RootException { }; - - class CodeConversionException : public ParserException { }; - - class CodeDuplicationException : public ParserException { }; - - class ObjectCreationgDuplicationException : public ParserException { }; - - class ObjectNotFoundException : public RootException { }; - - class SQLDatabaseException : public RootException { }; - + // //////////////////////////////////////////////////////////////////// + // + // Exceptions + // + // //////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// + class RootException : public std::exception { + public: + /** Constructors. */ + RootException (const std::string& iWhat) : _what (iWhat) {} + RootException () : _what ("No more details") {} + /** Destructor. */ + virtual ~RootException() throw() {} + /** Give the details of the exception. */ + const char* what() const throw() { return _what.c_str(); } + protected: + /** Details for the exception. */ + std::string _what; + }; + // //////////////////////////////////////////////////////////////////// + class FileNotFoundException : public RootException { + public: + /** Constructor. */ + FileNotFoundException (const std::string& iWhat) : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class NonInitialisedLogServiceException : public RootException { + public: + /** Constructor. */ + NonInitialisedLogServiceException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class NonInitialisedDBSessionManagerException : public RootException { + public: + /** Constructor. */ + NonInitialisedDBSessionManagerException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class NonInitialisedServiceException : public RootException { + public: + /** Constructor. */ + NonInitialisedServiceException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class NonInitialisedContainerException : public RootException { + public: + /** Constructor. */ + NonInitialisedContainerException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class NonInitialisedRelationShipException : public RootException { + public: + /** Constructor. */ + NonInitialisedRelationShipException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class MemoryAllocationException : public RootException { + public: + /** Constructor. */ + MemoryAllocationException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class ObjectLinkingException : public RootException { + public: + /** Constructor. */ + ObjectLinkingException (const std::string& iWhat) : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class ParserException : public RootException { + public: + /** Constructor. */ + ParserException (const std::string& iWhat) : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class DocumentNotFoundException : public RootException { + public: + /** Constructor. */ + DocumentNotFoundException (const std::string& iWhat) + : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class CodeConversionException : public ParserException { + public: + /** Constructor. */ + CodeConversionException (const std::string& iWhat) + : ParserException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class CodeDuplicationException : public ParserException { + public: + /** Constructor. */ + CodeDuplicationException (const std::string& iWhat) + : ParserException(iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class ObjectCreationgDuplicationException : public ParserException { + public: + /** Constructor. */ + ObjectCreationgDuplicationException (const std::string& iWhat) + : ParserException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class ObjectNotFoundException : public RootException { + public: + /** Constructor. */ + ObjectNotFoundException (const std::string& iWhat) : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// + class SQLDatabaseException : public RootException { + public: + /** Constructor. */ + SQLDatabaseException (const std::string& iWhat) : RootException (iWhat) {} + }; + // //////////////////////////////////////////////////////////////////// class SQLDatabaseConnectionImpossibleException : public SQLDatabaseException { + public: + /** Constructor. */ + SQLDatabaseConnectionImpossibleException (const std::string& iWhat) + : SQLDatabaseException (iWhat) {} }; // /////////////// Log ///////////// @@ -493,81 +583,88 @@ } -#define CATCH_ALL_EXCEPTIONS \ - catch (const stdair::FileNotFoundException& ex) { \ - std::cerr << "FileNotFoundException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::NonInitialisedLogServiceException& ex) { \ - std::cerr << "NonInitialisedLogServiceException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::NonInitialisedDBSessionManagerException& ex) { \ - std::cerr << "NonInitialisedDBSessionManagerException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::NonInitialisedServiceException& ex) { \ - std::cerr << "NonInitialisedServiceException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::NonInitialisedContainerException& ex) { \ - std::cerr << "NonInitialisedContainerException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::NonInitialisedRelationShipException& ex) { \ - std::cerr << "NonInitialisedRelationShipException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::MemoryAllocationException& ex) { \ - std::cerr << "MemoryAllocationException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::ObjectLinkingException& ex) { \ - std::cerr << "ObjectLinkingException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::CodeConversionException& ex) { \ - std::cerr << "CodeConversionException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::CodeDuplicationException& ex) { \ - std::cerr << "CodeDuplicationException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::ObjectCreationgDuplicationException& ex) { \ - std::cerr << "ObjectCreationgDuplicationException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::ObjectNotFoundException& ex) { \ - std::cerr << "ObjectNotFoundException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::DocumentNotFoundException& ex) { \ - std::cerr << "DocumentNotFoundException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::SQLDatabaseConnectionImpossibleException& ex) { \ - std::cerr << "SQLDatabaseConnectionImpossibleException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::SQLDatabaseException& ex) { \ - std::cerr << "SQLDatabaseException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::ParserException& ex) { \ - std::cerr << "ParserException" << std::endl; \ - return -1; \ - \ - } catch (const stdair::RootException& ex) { \ - std::cerr << "RootException" << std::endl; \ - return -1; \ - \ - } catch (const std::exception& stde) { \ - std::cerr << "Standard exception: " << stde.what() << std::endl; \ - return -1; \ - \ - } catch (...) { \ - return -1; \ - } \ +#define CATCH_ALL_EXCEPTIONS \ + catch (const stdair::FileNotFoundException& ex) { \ + std::cerr << "FileNotFoundException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedLogServiceException& ex) { \ + std::cerr << "NonInitialisedLogServiceException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedDBSessionManagerException& ex) { \ + std::cerr << "NonInitialisedDBSessionManagerException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedServiceException& ex) { \ + std::cerr << "NonInitialisedServiceException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedContainerException& ex) { \ + std::cerr << "NonInitialisedContainerException" \ + << ex.what() <<std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedRelationShipException& ex) { \ + std::cerr << "NonInitialisedRelationShipException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::MemoryAllocationException& ex) { \ + std::cerr << "MemoryAllocationException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectLinkingException& ex) { \ + std::cerr << "ObjectLinkingException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::CodeConversionException& ex) { \ + std::cerr << "CodeConversionException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::CodeDuplicationException& ex) { \ + std::cerr << "CodeDuplicationException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectCreationgDuplicationException& ex) { \ + std::cerr << "ObjectCreationgDuplicationException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectNotFoundException& ex) { \ + std::cerr << "ObjectNotFoundException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::DocumentNotFoundException& ex) { \ + std::cerr << "DocumentNotFoundException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::SQLDatabaseConnectionImpossibleException& ex) {\ + std::cerr << "SQLDatabaseConnectionImpossibleException" \ + << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::SQLDatabaseException& ex) { \ + std::cerr << "SQLDatabaseException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::ParserException& ex) { \ + std::cerr << "ParserException" << ex.what() << std::endl; \ + return -1; \ + \ + } catch (const stdair::RootException& ex) { \ + std::cerr << "RootException" << ex.what() <<std::endl; \ + return -1; \ + \ + } catch (const std::exception& stde) { \ + std::cerr << "Standard exception: " << stde.what() << std::endl; \ + return -1; \ + \ + } catch (...) { \ + return -1; \ + } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-12-02 15:54:45 UTC (rev 367) @@ -29,6 +29,9 @@ const Duration_T NULL_BOOST_TIME_DURATION = boost::posix_time::hours(0)+ boost::posix_time::minutes (0) + boost::posix_time::seconds (0); + + /** Default number of days in a year. */ + const unsigned int DEFAULT_NB_OF_DAYS_IN_A_YEAR = 365; // //////// (Flight-)Period-related BOM /////// /** Default number of duration days. */ Modified: trunk/stdair/stdair/basic/BasConst_General.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_General.hpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/basic/BasConst_General.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -74,6 +74,9 @@ /** Default null classCode value (''). */ extern const ClassCode_T DEFAULT_NULL_CLASS_CODE; + + /** Default number of days in a year. */ + extern const unsigned int DEFAULT_NB_OF_DAYS_IN_A_YEAR; } #endif // __STDAIR_BAS_BASCONST_GENERAL_HPP Added: trunk/stdair/stdair/basic/BasParserHelperTypes.hpp =================================================================== --- trunk/stdair/stdair/basic/BasParserHelperTypes.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasParserHelperTypes.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -0,0 +1,59 @@ +#ifndef __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP +#define __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <sstream> +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/service/Logger.hpp> + +namespace stdair { + // //////////////////////////////////////////////////////////////////// + // + // Parser structure helper + // + // //////////////////////////////////////////////////////////////////// + /** Date & time element parser. */ + template <int MIN = 0, int MAX = 0> + struct date_time_element { + unsigned int _value; + + // Constructors. + date_time_element () { } + date_time_element (const date_time_element& t) + : _value (t._value) { } + date_time_element (int i) : _value (i) { } + // Checker. + void check () const { + if (_value < MIN || _value > MAX) { + std::ostringstream oMessage; + oMessage << "The value: " << _value << " is out of range (" + << MIN << ", " << MAX << ")"; + throw stdair::ParserException (oMessage.str()); + } + } + }; + + /** Operator overload. */ + template <int MIN, int MAX> + inline date_time_element<MIN, MAX> operator* (const date_time_element<MIN, MAX>& o1, const date_time_element<MIN, MAX>& o2) { + return date_time_element<MIN, MAX> (o1._value * o2._value); + } + template <int MIN, int MAX> + inline date_time_element<MIN, MAX> operator+ (const date_time_element<MIN, MAX>& o1, const date_time_element<MIN, MAX>& o2) { + return date_time_element<MIN, MAX> (o1._value + o2._value); + } + + /** Type definitions for the date & time elements. */ + typedef date_time_element<0, 23> hour_t; + typedef date_time_element<0, 59> minute_t; + typedef date_time_element<0, 59> second_t; + typedef date_time_element<1900, 2100> year_t; + typedef date_time_element<1, 12> month_t; + typedef date_time_element<1, 31> day_t; +} +#endif // __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP Added: trunk/stdair/stdair/basic/BasParserTypes.hpp =================================================================== --- trunk/stdair/stdair/basic/BasParserTypes.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasParserTypes.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -0,0 +1,54 @@ +#ifndef __STDAIR_BAS_BASCOMPARSERTYPES_HPP +#define __STDAIR_BAS_BASCOMPARSERTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// Boost Spirit (Parsing) +#include <boost/spirit/include/qi.hpp> +#include <boost/spirit/include/phoenix_core.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> +#include <boost/spirit/include/support_multi_pass.hpp> +// STDAIR +#include <stdair/basic/BasParserHelperTypes.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + // + // Definition of Basic Types + // + // //////////////////////////////////////////////////////////////////// + // The types of iterator, scanner and rule are then derived from + // the parsing unit. + typedef std::istreambuf_iterator<char> base_iterator_t; + typedef boost::spirit::multi_pass<base_iterator_t> iterator_t; + + // //////////////////////////////////////////////////////////////////// + // + // Parser related types + // + // //////////////////////////////////////////////////////////////////// + /** 1-digit-integer parser */ + typedef boost::spirit::qi::int_parser<unsigned int, 10, 1, 1> int1_p_t; + + /** 2-digit-integer parser */ + typedef boost::spirit::qi::uint_parser<int, 10, 2, 2> uint2_p_t; + + /** 4-digit-integer parser */ + typedef boost::spirit::qi::uint_parser<int, 10, 4, 4> uint4_p_t; + + /** Up-to-4-digit-integer parser */ + typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t; + + /** Date & time element parsers. */ + typedef boost::spirit::qi::uint_parser<hour_t, 10, 2, 2> hour_p_t; + typedef boost::spirit::qi::uint_parser<minute_t, 10, 2, 2> minute_p_t; + typedef boost::spirit::qi::uint_parser<second_t, 10, 2, 2> second_p_t; + typedef boost::spirit::qi::uint_parser<year_t, 10, 4, 4> year_p_t; + typedef boost::spirit::qi::uint_parser<month_t, 10, 2, 2> month_p_t; + typedef boost::spirit::qi::uint_parser<day_t, 10, 2, 2> day_p_t; +} +#endif // __STDAIR_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/stdair/stdair/basic/PassengerType.cpp =================================================================== --- trunk/stdair/stdair/basic/PassengerType.cpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/basic/PassengerType.cpp 2010-12-02 15:54:45 UTC (rev 367) @@ -35,9 +35,10 @@ if (_type == LAST_VALUE) { const std::string& lLabels = describeLabels(); - STDAIR_LOG_ERROR ("The passenger type '" << iType - << "' is not known. Known passenger types: " << lLabels); - throw CodeConversionException(); + std::ostringstream oMessage; + oMessage << "The passenger type '" << iType + << "' is not known. Known passenger types: " << lLabels; + throw CodeConversionException (oMessage.str()); } } Modified: trunk/stdair/stdair/basic/sources.mk =================================================================== --- trunk/stdair/stdair/basic/sources.mk 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/basic/sources.mk 2010-12-02 15:54:45 UTC (rev 367) @@ -1,5 +1,7 @@ stdair_bas_h_sources = \ $(top_srcdir)/stdair/basic/BasTypes.hpp \ + $(top_srcdir)/stdair/basic/BasParserTypes.hpp \ + $(top_srcdir)/stdair/basic/BasParserHelperTypes.hpp \ $(top_srcdir)/stdair/basic/BasConst_General.hpp \ $(top_srcdir)/stdair/basic/BasConst_Request.hpp \ $(top_srcdir)/stdair/basic/BasConst_Inventory.hpp \ Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -62,9 +62,10 @@ if (itHolder == lHolderMap.end()) { std::string lName (typeid (OBJECT2).name()); - STDAIR_LOG_ERROR ("Cannot find the holder of type " << lName - << " within: " << iObject1.describeKey()); - throw NonInitialisedContainerException (); + std::ostringstream oMessage; + oMessage << "Cannot find the holder of type " << lName + << " within: " << iObject1.describeKey(); + throw NonInitialisedContainerException (oMessage.str()); } const BomHolder<OBJECT2>* lBomHolder_ptr = Modified: trunk/stdair/stdair/command/DBManagerForAirlines.cpp =================================================================== --- trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-12-02 15:54:45 UTC (rev 367) @@ -42,8 +42,7 @@ ioSelectStatement.execute(); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error: " << lException.what()); - throw SQLDatabaseException(); + throw SQLDatabaseException (lException.what()); } } @@ -73,8 +72,7 @@ ioSelectStatement.execute(); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error: " << lException.what()); - throw SQLDatabaseException(); + throw SQLDatabaseException (lException.what()); } } @@ -90,8 +88,7 @@ hasStillData = ioStatement.fetch(); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error: " << lException.what()); - throw SQLDatabaseException(); + throw SQLDatabaseException (lException.what()); } return hasStillData; @@ -100,9 +97,7 @@ // ////////////////////////////////////////////////////////////////////// void DBManagerForAirlines::updateAirlineInDB (DBSession_T& ioSociSession, const AirlineStruct& iAirline) { - try { - // Begin a transaction on the database ioSociSession.begin(); @@ -130,8 +125,7 @@ // STDAIR_LOG_DEBUG ("[" << lAirlineCode << "] " << iAirline); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error: " << lException.what()); - throw SQLDatabaseException(); + throw SQLDatabaseException (lException.what()); } } @@ -142,7 +136,6 @@ bool oHasRetrievedAirline = false; try { - // Prepare the SQL request corresponding to the select statement DBRequestStatement_T lSelectStatement (ioSociSession); prepareSelectOnAirlineCodeStatement (ioSociSession, lSelectStatement, @@ -162,8 +155,7 @@ // STDAIR_LOG_DEBUG ("[" << iDocID << "] " << ioAirline); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error: " << lException.what()); - throw SQLDatabaseException(); + throw SQLDatabaseException (lException.what()); } return oHasRetrievedAirline; Modified: trunk/stdair/stdair/factory/FacBomManager.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomManager.hpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/factory/FacBomManager.hpp 2010-12-02 15:54:45 UTC (rev 367) @@ -112,7 +112,7 @@ assert (lCurrentObject_ptr != NULL); STDAIR_LOG_DEBUG (lCurrentObject_ptr->describeKey() << "; "); } - throw ObjectLinkingException (); + throw ObjectLinkingException (""); } } @@ -142,7 +142,7 @@ assert (lCurrentObject_ptr != NULL); STDAIR_LOG_DEBUG (lCurrentObject_ptr->describeKey() << "; "); } - throw ObjectLinkingException (); + throw ObjectLinkingException (""); } lBomHolder._bomList.push_back (&ioObject2); } Modified: trunk/stdair/stdair/service/DBSessionManager.cpp =================================================================== --- trunk/stdair/stdair/service/DBSessionManager.cpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/service/DBSessionManager.cpp 2010-12-02 15:54:45 UTC (rev 367) @@ -59,19 +59,19 @@ _dbSession = new DBSession_T; try { - // Open the connection to the database _dbSession->open (soci::mysql, lDBSessionConnectionString); } catch (std::exception const& lException) { - STDAIR_LOG_ERROR ("Error while opening a connection to database: " - << lException.what()); - STDAIR_LOG_ERROR ("Database parameters used:" - << " db=" << iDBParams.getDBName() - << " user=" << iDBParams.getUser() - << " port=" << iDBParams.getPort() - << " host=" << iDBParams.getHost()); - throw SQLDatabaseConnectionImpossibleException(); + std::ostringstream oMessage; + oMessage <<"Error while opening a connection to database: " + << lException.what() << std::endl + << "Database parameters used:" + << " db=" << iDBParams.getDBName() + << " user=" << iDBParams.getUser() + << " port=" << iDBParams.getPort() + << " host=" << iDBParams.getHost(); + throw SQLDatabaseConnectionImpossibleException (oMessage.str()); } } @@ -95,7 +95,7 @@ // ////////////////////////////////////////////////////////////////////// DBSessionManager& DBSessionManager::instance() { if (_instance == NULL) { - throw NonInitialisedDBSessionManagerException(); + throw NonInitialisedDBSessionManagerException(""); } assert (_instance != NULL); return *_instance; @@ -113,7 +113,7 @@ // ////////////////////////////////////////////////////////////////////// DBSession_T& DBSessionManager::getDBSession() const { if (_dbSession == NULL) { - throw NonInitialisedDBSessionManagerException(); + throw NonInitialisedDBSessionManagerException (""); } assert (_dbSession != NULL); return *_dbSession; Modified: trunk/stdair/stdair/service/Logger.cpp =================================================================== --- trunk/stdair/stdair/service/Logger.cpp 2010-11-14 16:39:38 UTC (rev 366) +++ trunk/stdair/stdair/service/Logger.cpp 2010-12-02 15:54:45 UTC (rev 367) @@ -43,7 +43,7 @@ // ////////////////////////////////////////////////////////////////////// Logger& Logger::instance() { if (_instance == NULL) { - throw NonInitialisedLogServiceException(); + throw NonInitialisedLogServiceException(""); } assert (_instance != NULL); return *_instance; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-12-03 10:04:53
|
Revision: 378 http://stdair.svn.sourceforge.net/stdair/?rev=378&view=rev Author: denis_arnaud Date: 2010-12-03 09:22:27 +0000 (Fri, 03 Dec 2010) Log Message: ----------- [API] Further specified the API. Modified Paths: -------------- trunk/stdair/stdair/sources.mk trunk/stdair/stdair/stdair_basic_types.hpp trunk/stdair/stdair/stdair_demand_types.hpp trunk/stdair/stdair/stdair_inventory_types.hpp trunk/stdair/stdair/stdair_types.hpp Added Paths: ----------- trunk/stdair/stdair/stdair_maths_types.hpp trunk/stdair/stdair/stdair_rm_types.hpp Modified: trunk/stdair/stdair/sources.mk =================================================================== --- trunk/stdair/stdair/sources.mk 2010-12-03 09:18:14 UTC (rev 377) +++ trunk/stdair/stdair/sources.mk 2010-12-03 09:22:27 UTC (rev 378) @@ -3,8 +3,10 @@ $(top_srcdir)/stdair/stdair_log.hpp \ $(top_srcdir)/stdair/stdair_db.hpp \ $(top_srcdir)/stdair/stdair_basic_types.hpp \ + $(top_srcdir)/stdair/stdair_maths_types.hpp \ $(top_srcdir)/stdair/stdair_date_time_types.hpp \ $(top_srcdir)/stdair/stdair_inventory_types.hpp \ + $(top_srcdir)/stdair/stdair_rm_types.hpp \ $(top_srcdir)/stdair/stdair_demand_types.hpp \ $(top_srcdir)/stdair/stdair_fare_types.hpp \ $(top_srcdir)/stdair/stdair_types.hpp \ Modified: trunk/stdair/stdair/stdair_basic_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_basic_types.hpp 2010-12-03 09:18:14 UTC (rev 377) +++ trunk/stdair/stdair/stdair_basic_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -66,10 +66,15 @@ /** Define the number of seats required by a demand. */ // typedef unsigned short NbOfSeats_T; - // ////////////////////////////////////////////////////////////////////// - // Probability - /** Probability */ - typedef float Probability_T; + // ///////////// Technical //////////////// + /** File or directory name. + <br>It may contain paths, relative or absolute (e.g., /foo/bar + or C:\foo\bar). */ + typedef std::string Filename_T; + + /** Define the file address type (e.g. "a_directory/a_filename"). + <br>NOTE: That type should be deprecated. */ + typedef std::string FileAddress_T; } #endif // __STDAIR_STDAIR_BASIC_TYPES_HPP Modified: trunk/stdair/stdair/stdair_demand_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_demand_types.hpp 2010-12-03 09:18:14 UTC (rev 377) +++ trunk/stdair/stdair/stdair_demand_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -66,6 +66,9 @@ /** Define a Willingness-To-Pay (WTP) (e.g., 1000.0 Euros). */ typedef double WTP_T; + /** Define the name of a WTP-component of characteristics pattern. */ + typedef boost::tuples::tuple<double, WTP_T> CharacteristicsWTP_tuple_T; + /** Number of passengers (in a group) for a booking. */ typedef unsigned short PartySize_T; @@ -85,13 +88,15 @@ (in a travel solution block). */ typedef unsigned short NbOfTravelSolutions_T; + /** Define a indicator of demand to class matching. */ + typedef double MatchingIndicator_T; + /** Define the name of an event. */ typedef std::string EventName_T; /** Define a number of events. */ typedef double NbOfEvents_T; - // ////////////////////////////////////////////////////////////////////// /** Type definition for the hashed key of the DemandStreamKey object. */ typedef std::string DemandStreamKeyStr_T; @@ -105,5 +110,12 @@ /** Type of frequent flyer (P=Platinum, G=Gold, S=Silver, M=Member, N=None).*/ typedef std::string FrequentFlyer_T; + /** Define the Request status for booking (1-letter-code, e.g., + B: booked, C: cancelled, R: Rejected). */ + typedef std::string RequestStatus_T; + + /** Define a map between a BookingID and a TravelSolutionID. */ + typedef std::map<Identity_T, Identity_T> BookingTSIDMap_T; + } #endif // __STDAIR_STDAIR_DEMAND_TYPES_HPP Modified: trunk/stdair/stdair/stdair_inventory_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_inventory_types.hpp 2010-12-03 09:18:14 UTC (rev 377) +++ trunk/stdair/stdair/stdair_inventory_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -15,6 +15,9 @@ namespace stdair { // //////// Type definitions ///////// + /** Define the type for network ID. */ + typedef std::string NetworkID_T; + /** Define the Airline Code type (2-letter-code, e.g., BA). */ typedef std::string AirlineCode_T; @@ -122,5 +125,8 @@ /** Define the current index of a Bid-Price Vector (for a given LegCabin). */ typedef unsigned int SeatIndex_T; + /** Mode of inventory control. */ + typedef std::string ControlMode_T; + } #endif // __STDAIR_STDAIR_INVENTORY_TYPES_HPP Added: trunk/stdair/stdair/stdair_maths_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_maths_types.hpp (rev 0) +++ trunk/stdair/stdair/stdair_maths_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -0,0 +1,48 @@ +#ifndef __STDAIR_STDAIR_MATHS_TYPES_HPP +#define __STDAIR_STDAIR_MATHS_TYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <vector> +#include <map> +// Boost Random +#include <boost/random/linear_congruential.hpp> +#include <boost/random/uniform_real.hpp> +#include <boost/random/variate_generator.hpp> + +namespace stdair { + + // //////// Type definitions ///////// + /** Define the replication number. */ + typedef unsigned int ReplicationNumber_T; + + /** Define the seed type of an Exponential function. */ + typedef unsigned long int ExponentialSeed_T; + + /** Define the seed type of an Uniform function. */ + typedef unsigned long int UniformSeed_T; + + /** Seed for the random generation, so that it can be reproductible. */ + typedef unsigned long int RandomSeed_T; + + /** Random number generator. */ + typedef boost::minstd_rand BaseGenerator_T; + + /** Uniform random generator. */ + typedef boost::variate_generator<stdair::BaseGenerator_T&, + boost::uniform_real<> > UniformGenerator_T; + + /** Define a mean value (e.g., 20.2). */ + typedef double MeanValue_T; + + /** Define a standard deviation value (e.g., 1.5). */ + typedef double StdDevValue_T; + + /** Probability */ + typedef float Probability_T; + +} +#endif // __STDAIR_STDAIR_MATHS_TYPES_HPP Added: trunk/stdair/stdair/stdair_rm_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_rm_types.hpp (rev 0) +++ trunk/stdair/stdair/stdair_rm_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -0,0 +1,53 @@ +#ifndef __STDAIR_STDAIR_RM_TYPES_HPP +#define __STDAIR_STDAIR_RM_TYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <vector> + +namespace stdair { + + // //////// Type definitions ///////// + /** Frequency of the Data Collection Point description (daily, monthly or + detailed). */ + typedef std::string DCPModeFrequency_T; + + /** Mode of the Data Collection Point description (Forecaster only, + Optimizer only or both of them). */ + typedef std::string DCPMode_T; + + /** Mode of the forecaster. */ + typedef std::string ForecasterMode_T; + + /** Limit of similar flight-dates used in the forecaster. */ + typedef short HistoricalDataLimit_T; + + /** Mode of the forecaster. */ + typedef std::string OptimizerMode_T; + + /** Mode of the forecaster. */ + typedef std::string DicoOptimizerMode_T; + + /** Define the name of sell-up probability flag for RMS optimizer. */ + typedef bool SellupFlagForOptimizer_T; + + /** Define the name of sell-up probability for RMS optimizer. */ + typedef double SellupProbabilityForOptimizer_T; + + /** Define the name of sell-up probability vector for RMS optimizer. */ + typedef std::vector<SellupProbabilityForOptimizer_T> SellupProbabilityVector_T; + + /** Define the demand for a policy. */ + typedef NbOfBookings_T PolicyDemand_T; + + /** Define the total revenue of an unconstrained policy. */ + typedef double PolicyRevenue_T; + + /** Define the total revenue of an unconstrained policy. */ + typedef double PolicyRevenue_T; + +} +#endif // __STDAIR_STDAIR_RM_TYPES_HPP Modified: trunk/stdair/stdair/stdair_types.hpp =================================================================== --- trunk/stdair/stdair/stdair_types.hpp 2010-12-03 09:18:14 UTC (rev 377) +++ trunk/stdair/stdair/stdair_types.hpp 2010-12-03 09:22:27 UTC (rev 378) @@ -4,147 +4,17 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <vector> -#include <map> -// Boost Random -#include <boost/random/linear_congruential.hpp> -#include <boost/random/uniform_real.hpp> -#include <boost/random/variate_generator.hpp> -// Boost (Extended STL) -#include <boost/date_time/gregorian/gregorian.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/tuple/tuple.hpp> // StdAir #include <stdair/stdair_exceptions.hpp> #include <stdair/stdair_log.hpp> #include <stdair/stdair_db.hpp> #include <stdair/stdair_basic_types.hpp> #include <stdair/stdair_demand_types.hpp> +#include <stdair/stdair_maths_types.hpp> #include <stdair/stdair_fare_types.hpp> #include <stdair/stdair_inventory_types.hpp> +#include <stdair/stdair_rm_types.hpp> #include <stdair/stdair_date_time_types.hpp> #include <stdair/stdair_service.hpp> -namespace stdair { - - // //////// Type definitions ///////// - /** Define the type for network ID. */ - typedef std::string NetworkID_T; - - /** Define the file address type (e.g. "a_directory/a_filename")*/ - typedef std::string FileAddress_T; - - /** Define the replication number. */ - typedef unsigned int ReplicationNumber_T; - - /** Define the seed type of an Exponential function. */ - typedef unsigned long int ExponentialSeed_T; - - /** Define the seed type of an Uniform function. */ - typedef unsigned long int UniformSeed_T; - - /** Define the Request status for booking (1-letter-code, e.g., - B: booked, C: cancelled, R: Rejected). */ - typedef std::string RequestStatus_T; - - /** Define a mean value (e.g., 20.2). */ - typedef double MeanValue_T; - - /** Define a standard deviation value (e.g., 1.5). */ - typedef double StdDevValue_T; - - /** Define a map between a BookingID and a TravelSolutionID. */ - typedef std::map<Identity_T, Identity_T> BookingTSIDMap_T; - - /** Define a indicator of demand to class matching. */ - typedef double MatchingIndicator_T; - - /** Frequency of the Data Collection Point description (daily, monthly or - detailed). */ - typedef std::string DCPModeFrequency_T; - - /** Mode of the Data Collection Point description (Forecaster only, - Optimizer only or both of them). */ - typedef std::string DCPMode_T; - - /** Mode of the forecaster. */ - typedef std::string ForecasterMode_T; - - /** Limit of similar flight-dates used in the forecaster. */ - typedef short HistoricalDataLimit_T; - - /** Mode of the forecaster. */ - typedef std::string OptimizerMode_T; - - /** Mode of the forecaster. */ - typedef std::string DicoOptimizerMode_T; - - /** Mode of inventory control. */ - typedef std::string ControlMode_T; - - /** Define the name of a multiplier. */ - typedef double Multiplier_T; - - /** Define the name of a WTP-component of characteristics pattern. */ - typedef boost::tuples::tuple<double, double> CharacteristicsWTP_tuple_T; - - /** Define the name of sell-up probability flag for RMS optimizer. */ - typedef bool SellupFlagForOptimizer_T; - - /** Define the name of sell-up probability for RMS optimizer. */ - typedef double SellupProbabilityForOptimizer_T; - - /** Define the name of sell-up probability vector for RMS optimizer. */ - typedef std::vector<SellupProbabilityForOptimizer_T> - SellupProbabilityVector_T; - - /** Define the demand for a policy. */ - typedef NbOfBookings_T PolicyDemand_T; - - /** Define the total revenue of an unconstrained policy. */ - typedef double PolicyRevenue_T; - - /** Define the total revenue of an unconstrained policy. */ - typedef double PolicyRevenue_T; - - // ///////////// Technical //////////////// - /** File or directory name. - <br>It may contain paths, relative or absolute (e.g., /foo/bar - or C:\foo\bar). */ - typedef std::string Filename_T; - - // ////////////////////////////////////////////////////////////////////// - // Random generation - /** Seed for the random generation, so that it can be reproductible. */ - typedef unsigned long int RandomSeed_T; - - /** Random number generator. */ - typedef boost::minstd_rand BaseGenerator_T; - - /** Uniform random generator. */ - typedef boost::variate_generator<stdair::BaseGenerator_T&, - boost::uniform_real<> > UniformGenerator_T; - - // ////////////////////////////////////////////////////////////////////// - // Probability - /** Probability */ - typedef float Probability_T; - - // ////////////////////////////////////////////////////////////////////// - /** Type definition for the hashed key of the DemandStreamKey object. */ - typedef std::string DemandStreamKeyStr_T; - - /** Type of booking channel (D=direct, I=indirect, N=oNline, F=oFfline). */ - typedef std::string ChannelLabel_T; - - /** Type of trip type (RO=outbound of round-trip, RI=inbound of round-trip, - OW=one way). */ - typedef std::string TripType_T; - - /** Type of frequent flyer (P=Platinum, G=Gold, S=Silver, M=Member, N=None). */ - typedef std::string FrequentFlyer_T; - -} #endif // __STDAIR_STDAIR_TYPES_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <qua...@us...> - 2009-10-27 16:23:46
|
Revision: 56 http://stdair.svn.sourceforge.net/stdair/?rev=56&view=rev Author: quannaus Date: 2009-10-27 16:23:33 +0000 (Tue, 27 Oct 2009) Log Message: ----------- [Dev] Added AirlineFeature. Modified Paths: -------------- trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp Added Paths: ----------- trunk/stdair/stdair/bom/AirlineFeature.cpp trunk/stdair/stdair/bom/AirlineFeature.hpp trunk/stdair/stdair/bom/AirlineFeatureContent.cpp trunk/stdair/stdair/bom/AirlineFeatureContent.hpp trunk/stdair/stdair/bom/AirlineFeatureKey.cpp trunk/stdair/stdair/bom/AirlineFeatureKey.hpp trunk/stdair/stdair/bom/AirlineFeatureList.cpp trunk/stdair/stdair/bom/AirlineFeatureList.hpp trunk/stdair/stdair/bom/AirlineFeatureMap.cpp trunk/stdair/stdair/bom/AirlineFeatureMap.hpp trunk/stdair/stdair/bom/AirlineFeatureSet.cpp trunk/stdair/stdair/bom/AirlineFeatureSet.hpp trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp trunk/stdair/stdair/bom/OptimizerStruct.cpp trunk/stdair/stdair/bom/OptimizerStruct.hpp Copied: trunk/stdair/stdair/bom/AirlineFeature.cpp (from rev 55, trunk/stdair/stdair/bom/BookingClass.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeature.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,67 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/AirlineFeatureStructure.hpp> +#include <stdair/bom/AirlineFeature.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeature:: + AirlineFeature (const BomKey_T& iKey, + const ForecasterMode_T& iForecastMode, + const HistoricalDataLimit_T& iHistoricalDataLimit, + const OptimizerStruct_T& iOptimizerStruct, + const ControlMode_T& iControlMode, + BomStructure_T& ioAirlineFeatureStructure) + : AirlineFeatureContent (iKey, iForecastMode, iHistoricalDataLimit, + iOptimizerStruct, iControlMode), + _airlineFeatureStructure (ioAirlineFeatureStructure) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeature::~AirlineFeature () { + } + + // ////////////////////////////////////////////////////////////////////// + void AirlineFeature::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void AirlineFeature::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string AirlineFeature::toString() const { + std::ostringstream oStr; + oStr << describeShortKey() << std::endl; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeature::describe() const { + std::ostringstream ostr; + ostr << describeKey() + << ", " << _forecasterMode + << ", " << _historicalDataLimit + << ", " << _optimizerStruct.describe() + << ", " << _controlMode; + return ostr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeature::describeKey() const { + return _key.toString(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeature::describeShortKey() const { + return _key.toString(); + } + +} + Copied: trunk/stdair/stdair/bom/AirlineFeature.hpp (from rev 55, trunk/stdair/stdair/bom/BookingClass.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,93 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURE_HPP +#define __STDAIR_BOM_AIRLINEFEATURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureSet.hpp> +#include <stdair/bom/AirlineFeatureStructure.hpp> +#include <stdair/bom/AirlineFeatureContent.hpp> +#include <stdair/bom/AirlineFeatureSetTypes.hpp> +#include <stdair/bom/AirlineFeatureTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + struct AirlineFeatureKey_T; + struct AirlineFeatureList_T; + struct AirlineFeatureMap_T; + + /** Class representing the actual functional/business content for a + segment-cabin. */ + class AirlineFeature : public AirlineFeatureContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef AirlineFeatureSet Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef AirlineFeatureStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirlineFeatureKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef AirlineFeature 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; + + /** Give a description of the structure (for display purposes). */ + const std::string describe() const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _airlineFeatureStructure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirlineFeature (); + AirlineFeature (const AirlineFeature&); + AirlineFeature (const BomKey_T&, const ForecasterMode_T&, + const HistoricalDataLimit_T&, const OptimizerStruct_T&, + const ControlMode_T&, BomStructure_T&); + + /** Destructor. */ + virtual ~AirlineFeature(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _airlineFeatureStructure; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURE_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureContent.cpp (from rev 55, trunk/stdair/stdair/bom/BookingClassContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,28 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/AirlineFeatureContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureContent:: + AirlineFeatureContent (const BomKey_T& iKey, + const ForecasterMode_T& iForecastMode, + const HistoricalDataLimit_T& iHistoricalDataLimit, + const OptimizerStruct_T& iOptimizerStruct, + const ControlMode_T& iControlMode) + : _key (iKey), _forecasterMode (iForecastMode), + _historicalDataLimit (iHistoricalDataLimit), + _optimizerStruct (iOptimizerStruct), _controlMode (iControlMode){ + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureContent::~AirlineFeatureContent () { + } + +} + Copied: trunk/stdair/stdair/bom/AirlineFeatureContent.hpp (from rev 55, trunk/stdair/stdair/bom/BookingClassContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,81 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURECONTENT_HPP +#define __STDAIR_BOM_AIRLINEFEATURECONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/AirlineFeatureKey.hpp> +#include <stdair/bom/OptimizerStruct.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline booking class. */ + class AirlineFeatureContent : public BomContent { + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirlineFeatureKey_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. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + + protected: + /** Default constructors. */ + AirlineFeatureContent (const BomKey_T&, const ForecasterMode_T&, + const HistoricalDataLimit_T&, + const OptimizerStruct_T&, const ControlMode_T&); + AirlineFeatureContent (const AirlineFeatureContent&); + + /** Destructor. */ + virtual ~AirlineFeatureContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + + /** The type of forecaster. */ + ForecasterMode_T _forecasterMode; + + /** The size of the moving average window. */ + HistoricalDataLimit_T _historicalDataLimit; + + /** The type of optimizer. */ + OptimizerStruct_T _optimizerStruct; + + /** The type of inventory control. */ + ControlMode_T _controlMode; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURECONTENT_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureKey.cpp (from rev 51, trunk/stdair/stdair/bom/InventoryKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureKey_T::AirlineFeatureKey_T (const AirlineCode_T& iAirlineCode) + : _airlineCode (iAirlineCode) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureKey_T::~AirlineFeatureKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void AirlineFeatureKey_T::toStream (std::ostream& ioOut) const { + ioOut << "AirlineFeatureKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void AirlineFeatureKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string AirlineFeatureKey_T::toString() const { + std::ostringstream oStr; + oStr << _airlineCode; + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/AirlineFeatureKey.hpp (from rev 51, trunk/stdair/stdair/bom/InventoryKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,50 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATUREKEY_HPP +#define __STDAIR_BOM_AIRLINEFEATUREKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + /** Key of AirlineFeature. */ + struct AirlineFeatureKey_T : public BomKey_T { + + public: + // /////////// Construction /////////// + /** Constructor. */ + AirlineFeatureKey_T (const AirlineCode_T& iAirlineCode); + + /** Destructor. */ + ~AirlineFeatureKey_T (); + + // /////////// Getters ////////// + /** Get the airline code. */ + const AirlineCode_T& getAirlineCode() const; + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + std::string toString() const; + + private: + // Attributes + /** Airline code. */ + AirlineCode_T _airlineCode; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATUREKEY_HPP Copied: trunk/stdair/stdair/bom/AirlineFeatureList.cpp (from rev 47, trunk/stdair/stdair/bom/BookingClassList.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureList.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureList.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,50 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomChildrenHolderImp.hpp> +#include <stdair/bom/AirlineFeature.hpp> +#include <stdair/bom/AirlineFeatureList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureList_T:: + AirlineFeatureList_T (const AirlineFeatureHolder_T& iAirlineFeatureHolder) + : _airlineFeatureHolder (iAirlineFeatureHolder) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureList_T:: + AirlineFeatureList_T (const AirlineFeatureList_T& iAFList) + : _airlineFeatureHolder (iAFList._airlineFeatureHolder) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureList_T::~AirlineFeatureList_T () { + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureList_T::iterator AirlineFeatureList_T::begin () const { + return _airlineFeatureHolder.listBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureList_T::iterator AirlineFeatureList_T::end () const { + return _airlineFeatureHolder.listEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureList_T::reverse_iterator AirlineFeatureList_T::rbegin () const { + return _airlineFeatureHolder.listRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureList_T::reverse_iterator AirlineFeatureList_T::rend () const { + return _airlineFeatureHolder.listREnd (); + } + +} + Copied: trunk/stdair/stdair/bom/AirlineFeatureList.hpp (from rev 47, trunk/stdair/stdair/bom/BookingClassList.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureList.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureList.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,70 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURELIST_HPP +#define __STDAIR_BOM_AIRLINEFEATURELIST_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureTypes.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + template <typename BOM_STRUCTURE> class BomChildrenHolderImp; + class AirlineFeature; + + /** Structure which handles the iterators for a booking class list. */ + struct AirlineFeatureList_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the booking class list iterators. */ + typedef BomIterator_T<AirlineFeature, + AirlineFeatureStructureList_T::const_iterator> iterator; + typedef BomIterator_T<AirlineFeature, + AirlineFeatureStructureList_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + /** Define the booking class holder. */ + typedef BomChildrenHolderImp<AirlineFeature> AirlineFeatureHolder_T; + + 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. */ + AirlineFeatureList_T (); + AirlineFeatureList_T (const AirlineFeatureList_T&); + AirlineFeatureList_T (const AirlineFeatureHolder_T&); + + /** Destructor. */ + virtual ~AirlineFeatureList_T(); + + private: + // Attributes + /** Reference structure. */ + const AirlineFeatureHolder_T& _airlineFeatureHolder; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURELIST_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureMap.cpp (from rev 47, trunk/stdair/stdair/bom/BookingClassList.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureMap.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureMap.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,56 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomChildrenHolderImp.hpp> +#include <stdair/bom/AirlineFeature.hpp> +#include <stdair/bom/AirlineFeatureMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T:: + AirlineFeatureMap_T (const AirlineFeatureHolder_T& iAirlineFeatureHolder) + : _airlineFeatureHolder (iAirlineFeatureHolder) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T:: + AirlineFeatureMap_T (const AirlineFeatureMap_T& iAFMap) + : _airlineFeatureHolder (iAFMap._airlineFeatureHolder) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::~AirlineFeatureMap_T () { + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::iterator AirlineFeatureMap_T::begin () const { + return _airlineFeatureHolder.mapBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::iterator AirlineFeatureMap_T::end () const { + return _airlineFeatureHolder.mapEnd (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::reverse_iterator AirlineFeatureMap_T::rbegin () const { + return _airlineFeatureHolder.mapRBegin (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::reverse_iterator AirlineFeatureMap_T::rend () const { + return _airlineFeatureHolder.mapREnd (); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T::iterator AirlineFeatureMap_T:: + find (const MapKey_T& iKey) const { + return _airlineFeatureHolder.find (iKey); + } + +} + Copied: trunk/stdair/stdair/bom/AirlineFeatureMap.hpp (from rev 47, trunk/stdair/stdair/bom/BookingClassList.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureMap.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureMap.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,74 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATUREMAP_HPP +#define __STDAIR_BOM_AIRLINEFEATUREMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureTypes.hpp> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + template <typename BOM_STRUCTURE> class BomChildrenHolderImp; + class AirlineFeature; + + /** Structure which handles the iterators for a booking class map. */ + struct AirlineFeatureMap_T { + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the booking class map iterators. */ + typedef BomIterator_T<AirlineFeature, + AirlineFeatureStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<AirlineFeature, + AirlineFeatureStructureMap_T::const_reverse_iterator> reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + /** Define the booking class holder. */ + typedef BomChildrenHolderImp<AirlineFeature> AirlineFeatureHolder_T; + + 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; + + /** Retrieve, if existing, the AirlineFeature corresponding to the + given key. */ + iterator find (const MapKey_T&) const; + + public: + /** Default constructors. */ + AirlineFeatureMap_T (); + AirlineFeatureMap_T (const AirlineFeatureMap_T&); + AirlineFeatureMap_T (const AirlineFeatureHolder_T&); + + /** Destructor. */ + virtual ~AirlineFeatureMap_T(); + + private: + // Attributes + /** Reference structure. */ + const AirlineFeatureHolder_T& _airlineFeatureHolder; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATUREMAP_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureSet.cpp (from rev 55, trunk/stdair/stdair/bom/BomRoot.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,76 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/AirlineFeatureSetStructure.hpp> +#include <stdair/bom/AirlineFeatureSet.hpp> +#include <stdair/bom/AirlineFeature.hpp> +#include <stdair/bom/AirlineFeatureList.hpp> +#include <stdair/bom/AirlineFeatureMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSet:: + AirlineFeatureSet (const BomKey_T& iKey, + BomStructure_T& ioAirlineFeatureSetStructure) + : AirlineFeatureSetContent (iKey), + _bomRootStructure (ioAirlineFeatureSetStructure) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSet::~AirlineFeatureSet () { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeatureSet::display() const { + // Store current formatting flags of std::cout + std::ios::fmtflags oldFlags = std::cout.flags(); + std::ostringstream ostr; + ostr << "Set of airline features" << std::endl; + + AirlineFeatureList_T lAirlineFeatureList = getAirlineFeatureList(); + for (AirlineFeatureList_T::iterator itAirlineFeature = + lAirlineFeatureList.begin(); + itAirlineFeature != lAirlineFeatureList.end(); ++itAirlineFeature) { + const AirlineFeature& lAirlineFeature = *itAirlineFeature; + + ostr << lAirlineFeature.describe (); + } + + // Reset formatting flags of std::cout + std::cout.flags (oldFlags); + + return ostr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureList_T AirlineFeatureSet::getAirlineFeatureList () const { + return _bomRootStructure.getChildrenList(); + } + + // ////////////////////////////////////////////////////////////////////// + AirlineFeatureMap_T AirlineFeatureSet::getAirlineFeatureMap () const { + return _bomRootStructure.getChildrenList(); + } + + // ////////////////////////////////////////////////////////////////////// + const AirlineFeature* AirlineFeatureSet:: + getAirlineFeature (const AirlineCode_T& iAirlineCode) const { + + AirlineFeatureMap_T lAirlineFeatureMap = getAirlineFeatureMap (); + AirlineFeatureMap_T::iterator itAirlineFeature = + lAirlineFeatureMap.find (iAirlineCode); + + if (itAirlineFeature != lAirlineFeatureMap.end()) { + const AirlineFeature* oAirlineFeature_ptr = itAirlineFeature->second; + assert (oAirlineFeature_ptr != NULL); + return oAirlineFeature_ptr; + } + + return NULL; + } + +} Copied: trunk/stdair/stdair/bom/AirlineFeatureSet.hpp (from rev 55, trunk/stdair/stdair/bom/BomRoot.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,99 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURESET_HPP +#define __STDAIR_BOM_AIRLINEFEATURESET_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureSetStructure.hpp> +#include <stdair/bom/AirlineFeatureSetContent.hpp> +#include <stdair/bom/AirlineFeatureSetTypes.hpp> +#include <stdair/bom/AirlineFeatureTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + class AirlineFeature; + struct AirlineFeatureSetKey_T; + struct AirlineFeatureList_T; + struct AirlineFeatureMap_T; + + /** Class representing the actual functional/business content + for the Bom root. */ + class AirlineFeatureSet : public AirlineFeatureSetContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef AirlineFeatureSetStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirlineFeatureSetKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef AirlineFeature 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 { ioOut << toString(); } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return std::string (""); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return std::string (""); } + + /** Display the full context of the set of airline features. */ + const std::string display() const; + + public: + // /////////// Getters ///////////// + /** Retrieve, if existing, the Airline features corresponding to the + given airline code. + <br>If not existing, return the NULL pointer. */ + const AirlineFeature* getAirlineFeature (const AirlineCode_T&) const; + + /** Get a AirlineFeatureList_T for iteration methods. */ + AirlineFeatureList_T getAirlineFeatureList () const; + + /** Get a AirlineFeatureMap_T for iteration methods. */ + AirlineFeatureMap_T getAirlineFeatureMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _bomRootStructure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirlineFeatureSet (); + AirlineFeatureSet (const AirlineFeatureSet&); + AirlineFeatureSet (const BomKey_T&, BomStructure_T&); + /** Destructor. */ + virtual ~AirlineFeatureSet(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _bomRootStructure; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESET_HPP Copied: trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp (from rev 55, trunk/stdair/stdair/bom/BomRootContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,20 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/AirlineFeatureSetContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSetContent::AirlineFeatureSetContent (const BomKey_T& iKey) + : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSetContent::~AirlineFeatureSetContent () { + } + +} Copied: trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp (from rev 55, trunk/stdair/stdair/bom/BomRootContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,68 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURESETCONTENT_HPP +#define __STDAIR_BOM_AIRLINEFEATURESETCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/AirlineFeatureSetKey.hpp> + +namespace stdair { + /** Class representing the actual attributes for the Bom root. */ + class AirlineFeatureSetContent : public BomContent { + + public: + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirlineFeatureSetKey_T BomKey_T; + + public: + // /////////// Getters ////////////// + /** Get the AirlineFeatureSet key. */ + const BomKey_T& getKey() const { + return _key; + } + + public: + // ///////// Setters ////////// + + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + protected: + /** Default constructors. */ + AirlineFeatureSetContent (); + AirlineFeatureSetContent (const AirlineFeatureSetContent&); + AirlineFeatureSetContent (const BomKey_T& iKey); + + /** Destructor. */ + virtual ~AirlineFeatureSetContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESETCONTENT_HPP Copied: trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp (from rev 51, trunk/stdair/stdair/bom/BomRootKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirlineFeatureSetKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSetKey_T::AirlineFeatureSetKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + AirlineFeatureSetKey_T::~AirlineFeatureSetKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void AirlineFeatureSetKey_T::toStream (std::ostream& ioOut) const { + ioOut << "AirlineFeatureSetStructureKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void AirlineFeatureSetKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string AirlineFeatureSetKey_T::toString() const { + std::ostringstream oStr; + oStr << " -- AIRLINE FEATURE SET -- "; + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp (from rev 51, trunk/stdair/stdair/bom/BomRootKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,46 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURESETKEY_HPP +#define __STDAIR_BOM_AIRLINEFEATURESETKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + /** Key of the BOM structure root. */ + struct AirlineFeatureSetKey_T : public BomKey_T { + + public: + // /////////// Construction /////////// + /** Constructor. */ + AirlineFeatureSetKey_T (); + + /** Destructor. */ + ~AirlineFeatureSetKey_T (); + + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + std::string toString() const; + + private: + // Attributes + // No attributes, as that class corresponds to the root of Bom structure. + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESETKEY_HPP Copied: trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp (from rev 55, trunk/stdair/stdair/bom/BomRootStructure.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,121 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURESETSTRUCTURE_HPP +#define __STDAIR_BOM_AIRLINEFEATURESETSTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStructureDummy.hpp> +#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/AirlineFeatureStructure.hpp> + +namespace stdair { + /** Wrapper class aimed at holding the actual content, modeled + by a specific AirlineFeatureSet class. */ + template <typename BOM_CONTENT> + class AirlineFeatureSetStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the children type of the + BOM_CONTENT. */ + typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef typename BOM_CONTENT::BomKey_T BomKey_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector<AirlineFeatureStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; + + /** Definition allowing to retrive the default children bom holder type. */ + typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + + /** Definition allowing to retrive the children bom holder type. */ + typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + + public: + // /////////// Getters ///////////// + /** Get the AirlineFeatureSet key. */ + const BomKey_T& getKey () const { + assert (_content != NULL); + return _content->getKey (); + } + + /** Get the list of airline features. */ + const ChildrenBomHolder_T& getChildrenList() const { + assert (_childrenList != NULL); + return *_childrenList; + } + + /** Get the list of airline features. */ + void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { + ioChildrenList = _childrenList; + } + + private: + /////////////// Setters //////////////// + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + /** Set the children list. */ + void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { + _childrenList = &ioChildrenList; + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + 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 getKey().toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirlineFeatureSetStructure () : _content (NULL), _childrenList (NULL) { }; + AirlineFeatureSetStructure (const AirlineFeatureSetStructure&); + + /** Destructor. */ + ~AirlineFeatureSetStructure () { } + + private: + // Attributes + /** The actual functional (Business Object) content. */ + BOM_CONTENT* _content; + + /** List of inventories. */ + ChildrenBomHolder_T* _childrenList; + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESETSTRUCTURE_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp (from rev 51, trunk/stdair/stdair/bom/BomRootTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,19 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_AIRLINEFEATURESETTYPES_HPP +#define __STDAIR_BOM_AIRLINEFEATURESETTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename BOM_CONTENT> class AirlineFeatureSetStructure; + class AirlineFeatureSet; + + /** Define the AirlineFeatureSetStructure. */ + typedef AirlineFeatureSetStructure<AirlineFeatureSet> AirlineFeatureSetStructure_T; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESETTYPES_HPP + Copied: trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp (from rev 55, trunk/stdair/stdair/bom/BookingClassStructure.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,112 @@ +#ifndef __STDAIR_BOM_AIRLINEFEATURESTRUCTURE_HPP +#define __STDAIR_BOM_AIRLINEFEATURESTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStructureDummy.hpp> +#include <stdair/bom/BomContentDummy.hpp> + +namespace stdair { + /** Wrapper class aimed at holding the actual content, modeled + by an external specific AirlineFeature class (for instance, + in the AIRSCHED library). */ + template <class BOM_CONTENT> + class AirlineFeatureStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef typename BOM_CONTENT::BomKey_T BomKey_T; + + /** Definition allowing to retrieve the associated parent + BOM structure type. */ + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector <BomStructureDummy, + BomStructureDummy> ChildrenBomTypeList_T; + + /** Definition allowing to retrieve the default children bom holder type. */ + typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + + public: + // /////////// Getters ///////////// + /** Get the (parent) AirlineFeatureSetStructure object. */ + ParentBomStructure_T* getAirlineFeatureSetStructurePtr() const { + return _parent; + } + + /** Get the (parent) AirlineFeatureSetStructure object. */ + ParentBomStructure_T& getAirlineFeatureSetStructure() const; + + /** Get the segment-cabin key. */ + const BomKey_T& getKey() const { + assert (_content != NULL); + return _content->getKey(); + } + + private: + // /////////// Setters ///////////// + /** Set the (parent) AirlineFeatureSetStructure object. */ + void setAirlineFeatureSetStructure (ParentBomStructure_T& ioAirlineFeatureSetStructure){ + _parent = &ioAirlineFeatureSetStructure; + } + + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + 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 getKey().toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirlineFeatureStructure () : _parent (NULL), _content (NULL) { } + AirlineFeatureStructure (const AirlineFeatureStructure&); + + /** Destructor. */ + virtual ~AirlineFeatureStructure() { } + + private: + // Attributes + /** Parent segment-cabin. */ + ParentBomStructure_T* _parent; + + /** The actual functional (Business Object) content. */ + BOM_CONTENT* _content; + + }; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURESTRUCTURE_HPP Copied: trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp (from rev 51, trunk/stdair/stdair/bom/BookingClassTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -0,0 +1,29 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_AIRLINEFEATURETYPES_HPP +#define __STDAIR_BOM_AIRLINEFEATURETYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class AirlineFeatureStructure; + class AirlineFeature; + + /** Define the AirlineFeature structure. */ + typedef AirlineFeatureStructure<AirlineFeature> AirlineFeatureStructure_T; + + /** Define the segment-cabin structure list. */ + typedef std::vector<AirlineFeatureStructure_T*> AirlineFeatureStructureList_T; + + /** Define the segment-cabin structure map. */ + typedef std::map<const std::string, AirlineFeatureStructure_T*> AirlineFeatureStructureMap_T; + +} +#endif // __STDAIR_BOM_AIRLINEFEATURETYPES_HPP + Modified: trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp =================================================================== --- trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -61,21 +61,6 @@ at the same level). */ const std::string describeShortKey() const { return std::string (""); } - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void describeFull (std::ostringstream& ioOut) const { - // Initialise the index - unsigned short lIdx = 0; - - for (typename BomChildrenOrderedList_T::const_iterator itChild = - _bomChildrenOrderedList.begin(); - itChild != _bomChildrenOrderedList.end(); ++itChild, ++lIdx) { - const BomStructure_T* lCurrentChild_ptr = *itChild; - ioOut << "[" << lIdx << "]: "; - lCurrentChild_ptr->describeFull (ioOut); - } - } - // /////////// Iteration methods ////////// /** Initialise the internal iterators on bom objects: return the iterator at the begining of the list. */ @@ -124,7 +109,12 @@ MapReverseIterator_T mapREnd () const { return _bomChildrenList.rend(); } - + + /** Retrieve, if existing, the bom corresponding to the given key. */ + MapIterator_T find (const MapKey_T& iKey) const { + return _bomChildrenList.find (iKey); + } + private: /** Constructors are private so as to force the usage of the Factory layer. */ Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -9,12 +9,6 @@ #include <stdair/bom/Inventory.hpp> #include <stdair/bom/InventoryList.hpp> #include <stdair/bom/InventoryMap.hpp> -#include <stdair/bom/FlightDate.hpp> -#include <stdair/bom/SegmentDate.hpp> -#include <stdair/bom/LegDate.hpp> -#include <stdair/bom/SegmentCabin.hpp> -#include <stdair/bom/LegCabin.hpp> -#include <stdair/bom/BookingClass.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/BookingClassStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -73,12 +73,6 @@ ioOut << toString() << std::endl; } - /** Dump a Business Object with all its children into an output stream. - @param ostream& the output stream. */ - void describeFull (std::ostringstream& ioOut) const { - ioOut << describeShortKey () << std::endl; - } - /** Read a Business Object from an input stream. @param istream& the input stream. */ void fromStream (std::istream& ioIn) { } Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -122,14 +122,6 @@ ioOut << toString() << std::endl; } - /** Dump a Business Object with all its children into an output stream. - @param ostream& the output stream. */ - void describeFull (std::ostringstream& ioOut) const { - ioOut << describeShortKey () << std::endl; - displaySegmentDateList (ioOut); - displayLegDateList (ioOut); - } - /** Read a Business Object from an input stream. @param istream& the input stream. */ void fromStream (std::istream& ioIn) { } @@ -144,23 +136,6 @@ /** Get a string describing the short key (differentiating two objects at the same level). */ const std::string describeShortKey() const { return getKey().toString(); } - - /** Dump the segment-date children list in to an output stream. - @param ostream& the output stream. */ - void displaySegmentDateList (std::ostringstream& ioOut) const { - ioOut << "SegmentDates: " << std::endl; - assert (_childrenList != NULL); - _childrenList->describeFull (ioOut); - } - - /** Dump the leg-date children list in to an output stream. - @param ostream& the output stream. */ - void displayLegDateList (std::ostringstream& ioOut) const { - ioOut << "LegDates: " << std::endl; - assert (_secondChildrenList != NULL); - _secondChildrenList->describeFull (ioOut); - } - private: /** Constructors are private so as to force the usage of the Factory Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-10-27 16:23:33 UTC (rev 56) @@ -9,11 +9,6 @@ #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> -#include <stdair/bom/SegmentCabin.hpp> -#include <stdair/bom/LegCabin.hpp> -#include <stdair/bom/BookingClass.hpp> namespace stdair { @@ -39,9 +34,6 @@ // ////////////////////////////////////////////////////////////////////// std::string Inventory::toString() const { std::ostringstream oStr; - - _inventoryStructure.describeFull (oStr); - return oStr.str(); } Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -102,13 +102,6 @@ ioOut << toString() << std::endl; } - /** Dump a Business Object with all its children into an output stream. - @param ostream& the output stream. */ - void describeFull (std::ostringstream& ioOut) const { - ioOut << describeShortKey () << std::endl; - displayFlightDateList (ioOut); - } - /** Read a Business Object from an input stream. @param istream& the input stream. */ void fromStream (std::istream& ioIn) { } @@ -124,14 +117,6 @@ at the same level). */ const std::string describeShortKey() const { return getKey().toString(); } - /** Dump the flight-date children list in to an output stream. - @param ostream& the output stream. */ - void displayFlightDateList (std::ostringstream& ioOut) const { - ioOut << "FlightDates: " << std::endl; - assert (_childrenList != NULL); - _childrenList->describeFull (ioOut); - } - private: /** Constructors are private so as to force the usage of the Factory layer. */ Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -74,12 +74,6 @@ ioOut << toString() << std::endl; } - /** Dump a Business Object with all its children into an output stream. - @param ostream& the output stream. */ - void describeFull (std::ostringstream& ioOut) const { - ioOut << describeShortKey () << std::endl; - } - /** Read a Business Object from an input stream. @param istream& the input stream. */ void fromStream (std::istream& ioIn) { } Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-26 13:08:42 UTC (rev 55) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-10-27 16:23:33 UTC (rev 56) @@ -96,13 +96,6 @@ ioOut << toString() << std::endl; } - /** Dump a Business Object with all its children into an output stream. - @param ostream& the output stream. */ - void... [truncated message content] |
From: <qua...@us...> - 2009-10-28 09:38:28
|
Revision: 57 http://stdair.svn.sourceforge.net/stdair/?rev=57&view=rev Author: quannaus Date: 2009-10-28 09:38:19 +0000 (Wed, 28 Oct 2009) Log Message: ----------- [Dev] Some changes in the constructors. Modified Paths: -------------- trunk/stdair/stdair/bom/AirlineFeature.cpp trunk/stdair/stdair/bom/AirlineFeature.hpp trunk/stdair/stdair/bom/AirlineFeatureContent.cpp trunk/stdair/stdair/bom/AirlineFeatureContent.hpp trunk/stdair/stdair/bom/BomRootContent.hpp trunk/stdair/stdair/bom/BomRootKey.hpp trunk/stdair/stdair/bom/OptimizerStruct.cpp trunk/stdair/stdair/bom/OptimizerStruct.hpp trunk/stdair/stdair/factory/FacBomContent.hpp Modified: trunk/stdair/stdair/bom/AirlineFeature.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.cpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/AirlineFeature.cpp 2009-10-28 09:38:19 UTC (rev 57) @@ -12,13 +12,8 @@ // //////////////////////////////////////////////////////////////////// AirlineFeature:: AirlineFeature (const BomKey_T& iKey, - const ForecasterMode_T& iForecastMode, - const HistoricalDataLimit_T& iHistoricalDataLimit, - const OptimizerStruct_T& iOptimizerStruct, - const ControlMode_T& iControlMode, BomStructure_T& ioAirlineFeatureStructure) - : AirlineFeatureContent (iKey, iForecastMode, iHistoricalDataLimit, - iOptimizerStruct, iControlMode), + : AirlineFeatureContent (iKey), _airlineFeatureStructure (ioAirlineFeatureStructure) { } @@ -26,6 +21,16 @@ AirlineFeature::~AirlineFeature () { } + // //////////////////////////////////////////////////////////////////// + void AirlineFeature:: + init (const ForecasterMode_T& iForecastMode, + const HistoricalDataLimit_T& iHistoricalDataLimit, + const OptimizerStruct_T& iOptimizerStruct, + const ControlMode_T& iControlMode) { + AirlineFeatureContent::init (iForecastMode, iHistoricalDataLimit, + iOptimizerStruct, iControlMode); + } + // ////////////////////////////////////////////////////////////////////// void AirlineFeature::toStream (std::ostream& ioOut) const { ioOut << toString() << std::endl; Modified: trunk/stdair/stdair/bom/AirlineFeature.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -40,6 +40,12 @@ typedef AirlineFeature ContentChild_T; public: + // //////////// Setters ////////// + /** Intialization method. */ + void init (const ForecasterMode_T&, const HistoricalDataLimit_T&, + const OptimizerStruct_T&, const ControlMode_T&); + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -75,9 +81,7 @@ /** Default constructors. */ AirlineFeature (); AirlineFeature (const AirlineFeature&); - AirlineFeature (const BomKey_T&, const ForecasterMode_T&, - const HistoricalDataLimit_T&, const OptimizerStruct_T&, - const ControlMode_T&, BomStructure_T&); + AirlineFeature (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~AirlineFeature(); Modified: trunk/stdair/stdair/bom/AirlineFeatureContent.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.cpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.cpp 2009-10-28 09:38:19 UTC (rev 57) @@ -10,19 +10,25 @@ // //////////////////////////////////////////////////////////////////// AirlineFeatureContent:: - AirlineFeatureContent (const BomKey_T& iKey, - const ForecasterMode_T& iForecastMode, - const HistoricalDataLimit_T& iHistoricalDataLimit, - const OptimizerStruct_T& iOptimizerStruct, - const ControlMode_T& iControlMode) - : _key (iKey), _forecasterMode (iForecastMode), - _historicalDataLimit (iHistoricalDataLimit), - _optimizerStruct (iOptimizerStruct), _controlMode (iControlMode){ + AirlineFeatureContent (const BomKey_T& iKey) + : _key (iKey) { } // //////////////////////////////////////////////////////////////////// AirlineFeatureContent::~AirlineFeatureContent () { } + // //////////////////////////////////////////////////////////////////// + void AirlineFeatureContent:: + init (const ForecasterMode_T& iForecastMode, + const HistoricalDataLimit_T& iHistoricalDataLimit, + const OptimizerStruct_T& iOptimizerStruct, + const ControlMode_T& iControlMode) { + _forecasterMode = iForecastMode; + _historicalDataLimit = iHistoricalDataLimit; + _optimizerStruct = iOptimizerStruct; + _controlMode = iControlMode; + } + } Modified: trunk/stdair/stdair/bom/AirlineFeatureContent.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -25,6 +25,12 @@ const BomKey_T& getKey() const { return _key; } + + public: + // //////////// Setters ////////// + /** Intialization method. */ + void init (const ForecasterMode_T&, const HistoricalDataLimit_T&, + const OptimizerStruct_T&, const ControlMode_T&); public: // /////////// Display support methods ///////// @@ -50,10 +56,9 @@ protected: /** Default constructors. */ - AirlineFeatureContent (const BomKey_T&, const ForecasterMode_T&, - const HistoricalDataLimit_T&, - const OptimizerStruct_T&, const ControlMode_T&); + AirlineFeatureContent (); AirlineFeatureContent (const AirlineFeatureContent&); + AirlineFeatureContent (const BomKey_T&); /** Destructor. */ virtual ~AirlineFeatureContent(); Modified: trunk/stdair/stdair/bom/BomRootContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/BomRootContent.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -24,11 +24,6 @@ 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; @@ -77,11 +72,6 @@ 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; @@ -147,9 +137,6 @@ /** 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; Modified: trunk/stdair/stdair/bom/BomRootKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/BomRootKey.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -16,11 +16,9 @@ // /////////// Construction /////////// /** Constructor. */ BomRootKey_T (); - /** Destructor. */ ~BomRootKey_T (); - // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -39,7 +37,6 @@ private: // Attributes - // No attributes, as that class corresponds to the root of Bom structure. }; } Modified: trunk/stdair/stdair/bom/OptimizerStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/OptimizerStruct.cpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/OptimizerStruct.cpp 2009-10-28 09:38:19 UTC (rev 57) @@ -5,8 +5,11 @@ #include <stdair/bom/OptimizerStruct.hpp> namespace stdair { - // /////////////////////////////////////////////////////////////////// + OptimizerStruct_T::OptimizerStruct_T () { + } + + // /////////////////////////////////////////////////////////////////// OptimizerStruct_T::OptimizerStruct_T (const OptimizerMode_T& iOptimizerMode, const SellupFlagForOptimizer_T& iSellupFlagForOptimizer, @@ -29,6 +32,16 @@ } // //////////////////////////////////////////////////////////////////// + void OptimizerStruct_T:: + init (const OptimizerMode_T& iOptimizerMode, + const SellupFlagForOptimizer_T& iSellupFlagForOptimizer, + const SellupProbabilityVector_T& iSellupProbabilityVectorForOptimizer) { + _optimizerMode = iOptimizerMode; + _sellupFlagForOptimizer = iSellupFlagForOptimizer; + _sellupProbabilityVectorForOptimizer = iSellupProbabilityVectorForOptimizer; + } + + // //////////////////////////////////////////////////////////////////// const std::string OptimizerStruct_T::describe() const { std::ostringstream ostr; ostr << _optimizerMode Modified: trunk/stdair/stdair/bom/OptimizerStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/OptimizerStruct.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/bom/OptimizerStruct.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -28,6 +28,11 @@ getSellupProbabilityVectorForOptimizer() const { return _sellupProbabilityVectorForOptimizer; } + + // ////////// Setters //////////// + /** Initialization method. */ + void init (const OptimizerMode_T&,const SellupFlagForOptimizer_T&, + const SellupProbabilityVector_T&); // ///////// Display Methods ////////// /** Display the structure. */ @@ -37,6 +42,8 @@ const std::string describeSellupProbabilityVector() const; public: + /** Default constructor. */ + OptimizerStruct_T (); /** Constructor. */ OptimizerStruct_T (const OptimizerMode_T&, const SellupFlagForOptimizer_T&, @@ -46,11 +53,7 @@ /** Defaut destructor. */ ~OptimizerStruct_T (); - private: - /** Default constructor. */ - OptimizerStruct_T (); - private: // /////////////// Attributes ////////// /** Attributes. */ Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-27 16:23:33 UTC (rev 56) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2009-10-28 09:38:19 UTC (rev 57) @@ -30,12 +30,8 @@ /** Create the root of the BOM tree, i.e., a pair of linked BomRootStructure and BomRoot objects. */ template <typename BOM_ROOT> - BOM_ROOT& create () { - // Define the typename for BomRootKey. - typedef typename BOM_ROOT::BomKey_T BOM_ROOT_KEY_T; - // Create the BOM root object. - BOM_ROOT_KEY_T lBomRootKey; - BOM_ROOT& lBomRoot = createInternal<BOM_ROOT>(lBomRootKey); + BOM_ROOT& create (typename BOM_ROOT::BomKey_T iKey) { + BOM_ROOT& lBomRoot = createInternal<BOM_ROOT>(iKey); return lBomRoot; } @@ -104,90 +100,7 @@ return *aBomContent_ptr; } - - // //////////////////// AirlineFeature ////////////////////////// public: - /** Create a AirlineFeature object. */ - template <typename BOM_CONTENT_CHILD> - BOM_CONTENT_CHILD& - createAirlineFeature (typename BOM_CONTENT_CHILD::Parent_T& ioContentParent, - const typename BOM_CONTENT_CHILD::BomKey_T& iKey, - const ForecasterMode_T& iForecastMode, - const HistoricalDataLimit_T& iHistoricalDataLimit, - const OptimizerStruct_T& iOptimizerStruct, - const ControlMode_T& iControlMode) { - - // Create the child structure object for the given key - BOM_CONTENT_CHILD& lBomContentChild = - createInternalAirlineFeature<BOM_CONTENT_CHILD> (iKey, iForecastMode, - iHistoricalDataLimit, - iOptimizerStruct, - iControlMode); - - // Retrieve the child structure object - typename BOM_CONTENT_CHILD::BomStructure_T& lBomStructureChild = - lBomContentChild.getBomStructure (); - - // Type for the parent Bom content - typedef typename BOM_CONTENT_CHILD::Parent_T PARENT_CONTENT_T; - - // Type for the parent Bom structure - typedef typename PARENT_CONTENT_T::BomStructure_T PARENT_STRUCTURE_T; - - // Retrieve the parent structure object - PARENT_STRUCTURE_T& lBomStructureParent = - ioContentParent.getBomStructure (); - - // Type for the child Bom structure - typedef typename BOM_CONTENT_CHILD::BomStructure_T CHILD_STRUCTURE_T; - - // Link both the parent and child structure objects - const bool hasLinkBeenSuccessful = FacBomStructure:: - linkBomParentWithBomChild<CHILD_STRUCTURE_T> (lBomStructureParent, - lBomStructureChild); - - if (hasLinkBeenSuccessful == false) { - throw new MemoryAllocationException(); - } - - return lBomContentChild; - } - - private: - /** Create a AirlineFeature object. */ - template <typename BOM_CONTENT> - BOM_CONTENT& - createInternalAirlineFeature (const typename BOM_CONTENT::BomKey_T& iKey, - const ForecasterMode_T& iForecastMode, - const HistoricalDataLimit_T& iHistoricalDataLimit, - const OptimizerStruct_T& iOptimizerStruct, - const ControlMode_T& iControlMode) { - - // Create the structure/holder object - typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; - BOM_STRUCTURE_T& lBomStructure = - 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 (iKey, - iForecastMode, - iHistoricalDataLimit, - iOptimizerStruct, - iControlMode, - lBomStructure); - assert (aBomContent_ptr != NULL); - - // The new object is added to the pool of content objects - _contentPool.push_back (aBomContent_ptr); - - // Link the structure/holder object with its corresponding content object - setContent<BOM_STRUCTURE_T, BOM_CONTENT> (lBomStructure, *aBomContent_ptr); - - return *aBomContent_ptr; - } - - public: /** Provide the unique instance. <br>The singleton is instantiated when first used. @return FacBomContent& */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2009-11-04 10:39:53
|
Revision: 59 http://stdair.svn.sourceforge.net/stdair/?rev=59&view=rev Author: quannaus Date: 2009-11-04 10:39:37 +0000 (Wed, 04 Nov 2009) Log Message: ----------- [dev] added some objects. Modified Paths: -------------- trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/bom/AirlineFeatureMap.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassContent.cpp trunk/stdair/stdair/bom/BookingClassContent.hpp trunk/stdair/stdair/bom/BookingClassMap.cpp trunk/stdair/stdair/bom/BookingClassMap.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateContent.cpp trunk/stdair/stdair/bom/FlightDateContent.hpp trunk/stdair/stdair/bom/FlightDateMap.cpp trunk/stdair/stdair/bom/FlightDateMap.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryMap.cpp trunk/stdair/stdair/bom/InventoryMap.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/LegCabinMap.cpp trunk/stdair/stdair/bom/LegCabinMap.hpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.hpp trunk/stdair/stdair/bom/LegDateMap.cpp trunk/stdair/stdair/bom/LegDateMap.hpp trunk/stdair/stdair/bom/OptimizerStruct.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinContent.cpp trunk/stdair/stdair/bom/SegmentCabinContent.hpp trunk/stdair/stdair/bom/SegmentCabinMap.cpp trunk/stdair/stdair/bom/SegmentCabinMap.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/SegmentDateMap.cpp trunk/stdair/stdair/bom/SegmentDateMap.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/core/Makefile.am trunk/stdair/stdair/factory/FacBomStructure.hpp Added Paths: ----------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_BookingClass.hpp trunk/stdair/stdair/basic/BasConst_Inventory.hpp trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp trunk/stdair/stdair/basic/BasConst_Yield.hpp trunk/stdair/stdair/bom/DoWStruct.cpp trunk/stdair/stdair/bom/DoWStruct.hpp trunk/stdair/stdair/bom/StructAbstract.hpp Property Changed: ---------------- trunk/stdair/stdair/basic/ Property changes on: trunk/stdair/stdair/basic ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in + Makefile Makefile.in .deps .libs Added: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst.cpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,482 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/BasConst_WorldSchedule.hpp> +#include <stdair/basic/BasConst_Inventory.hpp> +#include <stdair/basic/BasConst_BookingClass.hpp> +#include <stdair/basic/BasConst_Yield.hpp> +#include <stdair/basic/BasConst_Period_BOM.hpp> + +namespace stdair { + + // ///////// General ///////// + /** Default very small value. */ + const double DEFAULT_EPSILON_VALUE = 0.0001; + + /** Default flight speed (number of kilometers per hour). */ + const unsigned int DEFAULT_FLIGHT_SPEED = 900; + + /** Default number of generated flight dates . */ + const NbOfFlightDates_T DEFAULT_NB_OF_FLIGHTDATES = 0.0; + + + // // ///////// GSL ///////// + // /** Default (GSL) random generator type. */ + // const gsl_rng_type* DEFAULT_LATUS_RANDOM_GENERATOR_TYPE = gsl_rng_default; + + // /** Default seed value for Exponential distribution. */ + // const ExponentialSeed_T DEFAULT_EXPONENTIAL_SEED = 0; + + // /** Default seed value for Exponential distribution. */ + // const UniformSeed_T DEFAULT_UNIFORM_SEED = 0; + + // // ///////// Labels in General Configuration Files ///////// + // /** Default file path separator*/ + // const std::string DEFAULT_CONFIG_FILEPATH_SEPARATOR = "/"; + + // /** Default label for RDS. */ + // const std::string DEFAULT_CONFIG_RDS_LABEL = "rds"; + // /** Default label for RDS file path. */ + // const std::string DEFAULT_CONFIG_RDS_FILEPATH_LABEL = "rds_path"; + // /** Default label for RDS Id (= folder holding RDS). */ + // const std::string DEFAULT_CONFIG_RDS_ID_LABEL = "rds_id"; + // /** Default label for RDS manifest. */ + // const std::string DEFAULT_CONFIG_RDS_MANIFEST_LABEL = "rds_manifest"; + // /** Default label for RDS airline configuration file name. */ + // const std::string DEFAULT_CONFIG_RDS_AIRLINE_CONFIGURATION_LABEL = + // "airlineconfiguration"; + + // /** Default label for output files. */ + // const std::string DEFAULT_CONFIG_OUTPUT_FILE_LABEL = "output_files"; + // /** Default label for inventory output file name. */ + // const std::string DEFAULT_CONFIG_INVENTORY_OUTPUT_FILE_LABEL = + // "inventory_output"; + // /** Default label for simulation output file name. */ + // const std::string DEFAULT_CONFIG_SIMULATION_OUTPUT_FILE_LABEL = + // "simulation_output"; + + // // ///////// Lables in RDS XML file ///////// + // const std::string DEFAULT_CONFIG_RDS_DEMAND_ARRIVAL_FILENAME_LABEL = + // "demandpattern"; + // const std::string DEFAULT_CONFIG_RDS_CANCEL_FILENAME_LABEL = + // "cancelratecurve"; + // const std::string DEFAULT_CONFIG_RDS_CHARACTERISTIC_FILENAME_LABEL = + // "characteristics"; + // const std::string DEFAULT_CONFIG_RDS_DEMAND_FILENAME_LABEL = "demands"; + // const std::string DEFAULT_CONFIG_RDS_SCHEDULE_FILENAME_LABEL = "schedule"; + // const std::string DEFAULT_CONFIG_RDS_FARE_FILENAME_LABEL = "fares"; + // const std::string DEFAULT_CONFIG_RDS_YIELD_FILENAME_LABEL = "yields"; + // const std::string DEFAULT_CONFIG_RDS_AU_RULES_FILENAME_LABEL = "aurules"; + // const std::string DEFAULT_CONFIG_RDS_LFDTD_RULES_FILENAME_LABEL = "lfdtdrules"; + // const std::string DEFAULT_CONFIG_RDS_DCP_FILENAME_LABEL = + // "datacollectionpoints"; + + // // ///////// BOOST Date-Time ///////// + // // Time duration representing a full day + // // (i.e., 24h or 1,440 minutes or 86,400 seconds) + + // /** Time duration representing a full day (in boost::time_duration unit).*/ + // const Duration_T BOOST_TIME_DURATION_FOR_A_DAY = + // boost::posix_time::hours(24); + + // /** Time duration representing a full day (in seconds).*/ + // const int TIME_DURATION_FOR_A_DAY_IN_SECONDS = + // static_cast<const int> (BOOST_TIME_DURATION_FOR_A_DAY.total_seconds()); + + // /** Time duration representing a full hour (in seconds).*/ + // const int TIME_DURATION_FOR_AN_HOUR_IN_SECONDS = 3600; + + // /** Time duration representing a full minute (in seconds).*/ + // const int TIME_DURATION_FOR_A_MINUTE_IN_SECONDS = 60; + + // /** Null time duration (in boost::time_duration unit).*/ + // const Duration_T NULL_BOOST_TIME_DURATION = + // boost::posix_time::hours(0)+ boost::posix_time::minutes (0) + // + boost::posix_time::seconds (0); + + // /** Date duration representing a full day (in boost::date_duration unit).*/ + // const DateOffSet_T BOOST_DATE_DURATION_FOR_A_DAY (1); + + // /** Date duration representing the window of time used for statistical + // analysis. */ + // const DateOffSet_T DEFAULT_ANALYSIS_TIME_WINDOW (180); + + // /** Date duration representing the period of reservation for a + // typical flight. */ + // const DateOffSet_T DEFAULT_RESERVATION_PERIOD_LENGTH (365); + + + // //////// (Flight-)Period-related BOM /////// + /** Default number of duration days. */ + const DayDuration_T DEFAULT_DAY_DURATION (0); + + /** Default date period (0-length, i.e., it lasts one day).*/ + const DatePeriod_T BOOST_DEFAULT_DATE_PERIOD (Date_T (2007, 1, 1), + Date_T (2007, 1, 1)); + + const std::string DOW_STR[] = {"Mon", "Tue", "Wed", "Thu", "Fri", + "Sat", "Sun"}; + + /** Default DOW String (e.g., "1111100"). */ + const DOW_String_T DEFAULT_DOW_STRING ("1111100"); + + /** Default Date OffSet (e.g., 0). */ + const DateOffSet_T DEFAULT_DATE_OFFSET (0); + + // // //////// WorldSchedule /////// + // /** Default update date for the WorldSchedule. */ + // const Date_T DEFAULT_WORLD_SCHEDULE_UPDATE_DATE (2007, + // boost::gregorian::Jan, + // 1); + + + // // //////// WholeDemand /////// + // /** Default update date for the WholeDemand. */ + // const Date_T DEFAULT_WHOLE_DEMAND_UPDATE_DATE (2007, + // boost::gregorian::Jan, + // 1); + + // /** Default update date&time. */ + // const DateTime_T DEFAULT_DEMAND_DATETIME (DEFAULT_WHOLE_DEMAND_UPDATE_DATE, + // NULL_BOOST_TIME_DURATION); + + // // //////// Fare Rules /////// + // /** Default saturdayStay value (false). */ + // const SaturdayStay_T DEFAULT_SATURDAY_STAY = false; + + // /** Default change fees value (false). */ + // const ChangeFees_T DEFAULT_CHANGE_FEES = false; + + // /** Default non refundable value (false). */ + // const NonRefundable_T DEFAULT_NON_REFUNDABLE = false; + + // /** Default airlineCode value ('XX'). */ + // const AirlineCode_T DEFAULT_AIRLINE_CODE = "XX"; + + // /** Default airlineCode value (''). */ + // const AirlineCode_T DEFAULT_NULL_AIRLINE_CODE = ""; + + // /** Default airportCode value ('XXX'). */ + // const AirportCode_T DEFAULT_AIRPORT_CODE = "XXX"; + + // /** Default family code value ('X'). */ + // const ClassCode_T DEFAULT_FAMILY_CODE = "0"; + + // /** Default classCode value ('X'). */ + // const ClassCode_T DEFAULT_CLASS_CODE = "X"; + + // /** Default number of airlines. */ + // const NbOfAirlines_T DEFAULT_NBOFAIRLINES = 0; + + // /** Default classCode value (''). */ + // const ClassCode_T DEFAULT_NULL_CLASS_CODE = ""; + + // /** Default flightPathCode value (''). */ + // const FlightPathCode_T DEFAULT_FLIGHTPATH_CODE = ""; + + // // //////// DemandFeatures /////// + // /** Default SaturdayStay average ratio of demand (value between [0, 100]). */ + // const SaturdayStayRatio_T DEFAULT_SATURDAY_STAY_RATIO = 50; + + // /** Default Change fees average ratio (value between [0, 100]). */ + // const ChangeFeesRatio_T DEFAULT_CHANGE_FEES_RATIO = 50; + + // /** Default Non refundable average ratio (value between [0, 100]). */ + // const NonRefundableRatio_T DEFAULT_NON_REFUNDABLE_RATIO = 50; + + // /** Default passenger type (Leisure or Business). */ + // const PassengerType_T DEFAULT_PASSENGER_TYPE = "L"; + + // /** Default distribution pattern identifier. */ + // const DistributionPatternId_T DEFAULT_DISTRIBUTION_PATTERN_ID = ""; + + // /** Default cancellation rate curve identifier. */ + // const CancellationRateCurveId_T DEFAULT_CANCELLATION_RATE_CURVE_ID = ""; + + // /** Default airline preference identifier. */ + // const AirlinePreferenceId_T DEFAULT_AIRLINE_PREFERENCE_ID = ""; + + // /** Default percentage pair of cancellation and no-show. */ + // const CancellationNoShowRatePair_T DEFAULT_PERCENTAGE_PAIR (0.0, 0.0); + + // /** Default characteristics pattern identifier. */ + // const CharacteristicsPatternId_T DEFAULT_CHARACTERISTICS_PATTERN_ID = ""; + + // //////// (Segment-)Class-related BOM /////// + /** Default distance value (kilometers). */ + const Distance_T DEFAULT_DISTANCE_VALUE = 0; + + /** Default number of bookings (with counted cancellation) + for BookingClass. */ + const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS = 0; + + /** Default number of booking (without cancellation) + demands for BookingClass. */ + const NbOfBookings_T DEFAULT_CLASS_TOTAL_NB_OF_BOOKINGS = 0; + + /** Default unconstrained demand for BookingClass. */ + const NbOfBookings_T DEFAULT_CLASS_UNCONSTRAINED_DEMAND = 0; + + /** Default remaining future demand mean for BookingClass. */ + const NbOfBookings_T DEFAULT_CLASS_REMAINING_DEMAND_MEAN = 0; + + /** Default remaining futre demand standard deviation for BookingClass. */ + const NbOfBookings_T DEFAULT_CLASS_REMAINING_DEMAND_STANDARD_DEVIATION = 0; + + /** Default number of cancellations for BookingClass. */ + const NbOfCancellations_T DEFAULT_CLASS_NB_OF_CANCELLATIONS = 0; + + /** Default number of no-shows for BookingClass. */ + const NbOfNoShows_T DEFAULT_CLASS_NB_OF_NOSHOWS = 0; + + /** Default cabin capacity for Leg cabins. */ + const CabinCapacity_T DEFAULT_CABIN_CAPACITY = 0.0; + + /** Default commited space value for Leg cabins. */ + const CommitedSpace_T DEFAULT_COMMITED_SPACE = 0.0; + + /** Default commited space value for Leg cabins. */ + const BlockSpace_T DEFAULT_BLOCK_SPACE = 0.0; + + /** Default availability for BookingClass. */ + const Availability_T DEFAULT_CLASS_AVAILABILITY = 0.0; + + /** Default boolean for censorship flag given the status of + availability for BookingClass. */ + const CensorshipFlag_T DEFAULT_CLASS_CENSORSHIPFLAG = false; + + /** Default list of censorship flag given the status of + availability for BookingClass. */ + const CensorshipFlagList_T DEFAULT_CLASS_CENSORSHIPFLAG_LIST = std::vector<CensorshipFlag_T>(); + + /** Default booking limit value for BookingClass. */ + const BookingLimit_T DEFAULT_CLASS_BOOKING_LIMIT = 9999.0; + + /** Default authorization level for BookingClass. */ + const AuthorizationLevel_T DEFAULT_CLASS_AUTHORIZATION_LEVEL = 9999.0; + + /** Default MAX value of authorization level for BookingClass. */ + const AuthorizationLevel_T DEFAULT_CLASS_MAX_AUTHORIZATION_LEVEL = 9999.0; + + /** Default MIN value of authorization level for BookingClass. */ + const AuthorizationLevel_T DEFAULT_CLASS_MIN_AUTHORIZATION_LEVEL = 0.0; + + /** Default over-booking rate for BookingClass. */ + const OverbookingRate_T DEFAULT_CLASS_OVERBOOKING_RATE = 0.0; + + /** Default booking rate for OnD bookings over overall class bookings. */ + const BookingRatio_T DEFAULT_OND_BOOKING_RATE = 0.0; + + /** Default closed class code. */ + const ClassCode_T DEFAULT_CLOSED_CLASS_CODE = "CC"; + + /** Default Fare value for BookingClass. */ + const Fare_T DEFAULT_CLASS_FARE_VALUE = 0.0; + + /** Default yield value for a virtual class. */ + const Yield_T DEFAULT_CLASS_YIELD_VALUE = 0.0; + + /** Default Revenue value. */ + const Revenue_T DEFAULT_REVENUE_VALUE = 0.0; + + /** Default load factor value (100%). */ + const Percentage_T DEFAULT_LOAD_FACTOR_VALUE = 100.0; + + // //////// (Leg-)YieldRange-related BOM /////// + /** Default yield value. */ + const Yield_T DEFAULT_YIELD_VALUE = 0.0; + + /** Default yield max value. */ + const Yield_T DEFAULT_YIELD_MAX_VALUE = std::numeric_limits<double>::max(); + + /** Default number of bookings for YieldRangeStruct_T. */ + const NbOfBookings_T DEFAULT_YIELD_NB_OF_BOOKINGS = 0.0; + + /** Default booking number. */ + const Identity_T DEFAULT_BOOKING_NUMBER = 0; + + /** Default cancellation number for YieldRangeStruct_T. */ + const NbOfCancellations_T DEFAULT_YIELD_NB_OF_CANCELLATIONS = 0.0; + + /** Default no-shows number for YieldRangeStruct_T. */ + const NbOfNoShows_T DEFAULT_YIELD_NB_OF_NOSHOWS = 0.0; + + /** Default availability for YieldRangeStruct_T. */ + const Availability_T DEFAULT_YIELD_AVAILABILITY = 0.0; + + /** Default boolean for booking limit availability for + YieldRangeStruct_T. */ + const CensorshipFlag_T DEFAULT_YIELD_CENSORSHIPFLAG = false; + + /** Default booking limit value for YieldRangeStruct_T. */ + const BookingLimit_T DEFAULT_YIELD_BOOKING_LIMIT = 0.0; + + /** Default over-booking rate for YieldRangeStruct_T. */ + const OverbookingRate_T DEFAULT_YIELD_OVERBOOKING_RATE = 0.0; + + // //////// OnD-related BOM /////// + /** Default value of Fare. */ + const Fare_T DEFAULT_OND_FARE_VALUE = 0.0; + + // /** Default number of bookings. */ + // const NbOfBookings_T DEFAULT_OND_NB_OF_BOOKINGS = 0.0; + + // /** Default remaining future demand mean for OnD. */ + // const NbOfBookings_T DEFAULT_OND_REMAINING_DEMAND_MEAN = 0.0; + + // /** Default remaining futre demand standard deviation for OnD. */ + // const NbOfBookings_T DEFAULT_OND_REMAINING_DEMAND_STANDARD_DEVIATION = 0.0; + + // // //////// Travel Solutions /////// + // /** Default Minimum connection time. */ + // const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME (0, 30, 0); + + // /** Default Matching Indicator value. */ + // const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR (0.0); + + // /** Default price value (0.0). */ + // const PriceValue_T DEFAULT_PRICE_VALUE (0.0); + + // /** Default currency (euro). */ + // const PriceCurrency_T DEFAULT_CURRENCY ("EUR"); + + // /** Default availability status for a travel solution. */ + // const AvailabilityStatus_T DEFAULT_AVAILABILITY_STATUS = false; + + // // //////// Cancellation /////// + // /** Default Fare value */ + // const Fare_T DEFAULT_FARE_VALUE = 0.0; + + // /** Default number of bookings. */ + // const NbOfBookings_T DEFAULT_NB_OF_BOOKINGS = 0; + + // /** Default date&time. */ + // const DateTime_T DEFAULT_CANCELLATION_DATETIME + // (DEFAULT_WORLD_SCHEDULE_UPDATE_DATE, + // NULL_BOOST_TIME_DURATION); + + // // //////// CityPair //////// + // /** Default booking date for BookingDay. */ + // const Date_T DEFAULT_BOOKING_DATE (2007, boost::gregorian::Jan, 1); + + // /** Default departure date for CityPairDate. */ + // const Date_T DEFAULT_DEPARTURE_DATE (2008, boost::gregorian::Jan, 1); + + // /** Date duration representing the time during which a flight-date is open + // to the reservation (in boost::date_duration unit).*/ + // const DateOffSet_T DEFAULT_FLIGHT_DATE_RESERVATION_DURATION (365); + + // /** Default number of seats required whenever a demand is processed into + // the simulator. */ + // const unsigned short DEFAULT_NUMBER_OF_REQUIRED_SEATS = 1; + + // // //////// Flight Period Actions //////// + // // //////// RMS mode /////// + // /** Default forecaster mode. */ + // const ForecasterMode_T DEFAULT_FORECAST_MODE = "NoForecast"; + + // /** First forecaster mode. */ + // const ForecasterMode_T FIRST_FORECAST_MODE = "Forecaster1"; + + // /** Basic forecaster mode. */ + // const ForecasterMode_T BASIC_FORECAST_MODE = "BasicForecaster"; + + // /** Neural forecaster mode. */ + // const ForecasterMode_T NEURAL_FORECAST_MODE = "NeuralForecaster"; + + // /** Q forecaster mode. */ + // const ForecasterMode_T Q_FORECAST_MODE = "QForecaster"; + + // /** Default optimizer mode. */ + // const OptimizerMode_T DEFAULT_OPTIMIZER_MODE = "FCFS"; + + // /** Optimizer mode for rules like LF & DTD threshold. */ + // const OptimizerMode_T LF_DTD_RULES_OPTIMIZER_MODE = "LFDTDRules"; + + // /** Optimizer mode for EMSR heuristic. */ + // const OptimizerMode_T EMSR_OPTIMIZER_MODE = "EMSR"; + + // /** Optimizer mode for EMSR-a heuristic. */ + // const OptimizerMode_T EMSRA_OPTIMIZER_MODE = "EMSRa"; + + // // /** Optimizer mode for EMSR-a with sell up probability. */ + // // const OptimizerMode_T EMSRA_SELLUP_OPTIMIZER_MODE = "EMSRaSellup"; + + // /** Optimizer mode for EMSR-b heuristic. */ + // const OptimizerMode_T EMSRB_OPTIMIZER_MODE = "EMSRb"; + + // /** Optimizer mode for Optimal Optimization by Monte-Carlo. */ + // const OptimizerMode_T MC_OPTIMIZER_MODE = "MC"; + + // /** Optimizer mode for Leg-Based Iterative DAVN Optimization with + // Monte-Carlo. */ + // const OptimizerMode_T LB_ITERATIVE_DAVN_OPTIMIZER_WITH_MC_MODE = "LB_DAVN_MC"; + + // /** Optimizer mode for Leg-Based Iterative DAVN Optimization with + // EMSR. */ + // const OptimizerMode_T LB_ITERATIVE_DAVN_OPTIMIZER_WITH_EMSR_MODE = "LB_DAVN_EMSR"; + + // // /** No sell-up for optimizer by default*/ + // // const SellupFlagForOptimizer_T DEFAULT_SELLUP_FLAG_FOR_OPTIMIZER = false; + + // /** Defaut control mode. */ + // const ControlMode_T DEFAULT_CONTROL_MODE = "STD"; + + // /** Theft control mode. */ + // const ControlMode_T THEFT_CONTROL_MODE = "THEFT"; + + // /** Default number of draws for Monte-Carlo Integration method. */ + // const int DEFAULT_NUMBER_OF_RANDOM_DRAWS = 1000; + + // /** Default epsilon for convergence test. */ + // const double DEFAULT_CONVERGENCE_EPSILON = 0.1; + + // /** Default max number of iterations for Iterative DAVN. */ + // const int DEFAULT_NB_OF_ITERATIONS_DAVN = 10; + + // // //////// Characteristics /////// + // /** Default k-factor (0.3).*/ + // const Multiplier_T DEFAULT_KFACTOR = 0.3; + + // /** Default basefare [used for computing WTP] (0).*/ + // const Fare_T DEFAULT_BASEFARE = 0; + + // /** Default elasticity multiplier [used for computing WTP] (1.5). */ + // const Multiplier_T DEFAULT_EMULTIPLIER = 1.5; + + // // //////// DICO mode /////// + // /** Default DICO studied airline. */ + // const AirlineCode_T DEFAULT_DICO_AIRLINE = "AD"; + // //const AirlineCode_T DEFAULT_DICO_STUDIED_AIRLINE = "AA"; + + // /** Default second studied airline for DICO. */ + // const AirlineCode_T DEFAULT_SECOND_DICO_AIRLINE = "AL"; + // //const AirlineCode_T DEFAULT_SECOND_DICO_STUDIED_AIRLINE = "BA"; + + // /** Default DICO studied date. */ + // const Date_T DEFAULT_DICO_STUDIED_DATE (2009, boost::gregorian::Jun, 29); + // //const Date_T DEFAULT_DICO_STUDIED_DATE (2009, boost::gregorian::Jun, 27); + + // /** Default DICO optimiser (dico mode). */ + // const DicoOptimizerMode_T DEFAULT_DICO_OPTIMIZER = "dico"; + + // /** Default DICO optimiser (robust dico mode). */ + // const DicoOptimizerMode_T DEFAULT_ROBUST_DICO_OPTIMIZER = + // "robustdico"; + + // /** Default DICO optimiser (fast robust dico mode). */ + // const DicoOptimizerMode_T DEFAULT_FAST_ROBUST_DICO_OPTIMIZER = + // "fastrobustdico"; + + // //////// Inventory-related BOM /////// + /** Default Bid-Price. */ + const BidPrice_T DEFAULT_BID_PRICE = 0.0; + + /** Default Bid-Price Vector. */ + const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR = std::vector<BidPrice_T>(); + +} Added: trunk/stdair/stdair/basic/BasConst_BookingClass.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_BookingClass.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_BookingClass.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,97 @@ +#ifndef __STDAIR_BAS_BASCONST_BOOKINGCLASS_HPP +#define __STDAIR_BAS_BASCONST_BOOKINGCLASS_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // //////// (Segment-)Class-related BOM /////// + /** Default distance value (kilometers). */ + extern const Distance_T DEFAULT_DISTANCE_VALUE; + + /** Default closed class code. */ + extern const ClassCode_T DEFAULT_CLOSED_CLASS_CODE; + + /** Default number of bookings (with counted cancellation) + for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; + + /** Default number of bookings (without cancellation) + for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_TOTAL_NB_OF_BOOKINGS; + + /** Default unconstrained demand for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_UNCONSTRAINED_DEMAND; + + /** Default remaining future demand mean for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_REMAINING_DEMAND_MEAN; + + /** Default remaining futre demand standard deviation for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_REMAINING_DEMAND_STANDARD_DEVIATION; + + /** Default number of cancellations for BookingClass. */ + extern const NbOfCancellations_T DEFAULT_CLASS_NB_OF_CANCELLATIONS; + + /** Default number of no-shows for BookingClass. */ + extern const NbOfNoShows_T DEFAULT_CLASS_NB_OF_NOSHOWS; + + /** Default cabin capacity for Leg cabins. */ + extern const CabinCapacity_T DEFAULT_CABIN_CAPACITY; + + /** Default commited space value for Leg cabins. */ + extern const CommitedSpace_T DEFAULT_COMMITED_SPACE; + + /** Default commited space value for Leg cabins. */ + extern const BlockSpace_T DEFAULT_BLOCK_SPACE; + + /** Default availability for BookingClass. */ + extern const Availability_T DEFAULT_CLASS_AVAILABILITY; + + /** Default boolean for censorship flag given the status of + availability for BookingClass. */ + extern const CensorshipFlag_T DEFAULT_CLASS_CENSORSHIPFLAG; + + /** Default list of censorship flag given the status of + availability for BookingClass. */ + extern const CensorshipFlagList_T DEFAULT_CLASS_CENSORSHIPFLAG_LIST; + + /** Default booking limit value for BookingClass. */ + extern const BookingLimit_T DEFAULT_CLASS_BOOKING_LIMIT; + + /** Default authorization level for BookingClass. */ + extern const AuthorizationLevel_T DEFAULT_CLASS_AUTHORIZATION_LEVEL; + + /** Default MAX value of authorization level for BookingClass. */ + extern const AuthorizationLevel_T DEFAULT_CLASS_MAX_AUTHORIZATION_LEVEL; + + /** Default MIN value of authorization level for BookingClass. */ + extern const AuthorizationLevel_T DEFAULT_CLASS_MIN_AUTHORIZATION_LEVEL; + + /** Default over-booking rate for BookingClass. */ + extern const OverbookingRate_T DEFAULT_CLASS_OVERBOOKING_RATE; + + /** Default over-booking rate for BookingClass. */ + extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + + /** Default revenue value for BookingClass. */ + extern const Revenue_T DEFAULT_REVENUE_VALUE; + + /** Default currency (euro). */ + extern const PriceCurrency_T DEFAULT_CURRENCY; + + /** Default load factor value (100%). */ + extern const Percentage_T DEFAULT_LOAD_FACTOR_VALUE; + + /** Default number of duration days (0). */ + extern const DayDuration_T DEFAULT_DAY_DURATION; + + /** Default epsilon value between customer requirements + and a fare rule. */ + extern const double DEFAULT_EPSILON_VALUE; + +} +#endif // __STDAIR_BAS_BASCONST_BOOKINGCLASS_HPP Added: trunk/stdair/stdair/basic/BasConst_Inventory.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Inventory.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_Inventory.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,20 @@ +#ifndef __STDAIR_BAS_BASCONST_INVENTORY_HPP +#define __STDAIR_BAS_BASCONST_INVENTORY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // //////// Inventory-related BOM /////// + /** Default Bid-Price. */ + extern const BidPrice_T DEFAULT_BID_PRICE; + + /** Default Bid-Price Vector. */ + extern const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR; + +} +#endif // __STDAIR_BAS_BASCONST_INVENTORY_HPP Added: trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,29 @@ +#ifndef __STDAIR_BAS_BASCONST_PERIOD_BOM_HPP +#define __STDAIR_BAS_BASCONST_PERIOD_BOM_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // //////// (Flight-)Period-related BOM /////// + /** Default date period (0-length, i.e., it lasts one day).*/ + extern const DatePeriod_T BOOST_DEFAULT_DATE_PERIOD; + + /** Representation of Dow-Of-the-Week */ + extern const std::string DOW_STR[]; + + /** Default DOW String (e.g., "1111100"). */ + extern const DOW_String_T DEFAULT_DOW_STRING; + + /** Default Date OffSet (e.g., 0). */ + extern const DateOffSet_T DEFAULT_DATE_OFFSET; + + /** Default Duration in days (e.g., 0). */ + extern const DayDuration_T DEFAULT_DAY_DURATION; + +} +#endif // __STDAIR_BAS_BASCONST_PERIOD_BOM_HPP Added: trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,40 @@ +#ifndef __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP +#define __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// LATUS Common +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + /** Default epsilon value. */ + extern const double DEFAULT_EPSILON_VALUE; + + /** Default flight speed (number of kilometers per hour). */ + extern const unsigned int DEFAULT_FLIGHT_SPEED; + + /** Default cabin capacity for Leg cabins. */ + extern const CabinCapacity_T DEFAULT_CABIN_CAPACITY; + + /** Default number of generated flight dates . */ + extern const NbOfFlightDates_T DEFAULT_NB_OF_FLIGHTDATES; + + /** Default number of bookings for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; + + /** Default distance value (kilometers). */ + extern const Distance_T DEFAULT_DISTANCE_VALUE; + + /** Default value of Fare. */ + extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + + /** Default revenue value. */ + extern const Revenue_T DEFAULT_REVENUE_VALUE; + + /** Default booking rate for OnD bookings over overall class bookings. */ + extern const BookingRatio_T DEFAULT_OND_BOOKING_RATE; + +} +#endif // __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP Added: trunk/stdair/stdair/basic/BasConst_Yield.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Yield.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_Yield.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,20 @@ +#ifndef __STDAIR_BAS_BASCONST_YIELD_HPP +#define __STDAIR_BAS_BASCONST_YIELD_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // //////// (Leg-)Yield-related BOM /////// + /** Default yield value. */ + extern const Yield_T DEFAULT_YIELD_VALUE; + + /** Default yield max value. */ + extern const Yield_T DEFAULT_YIELD_MAX_VALUE; + +} +#endif // __STDAIR_BAS_BASCONST_YIELD_HPP Modified: trunk/stdair/stdair/basic/sources.mk =================================================================== --- trunk/stdair/stdair/basic/sources.mk 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/basic/sources.mk 2009-11-04 10:39:37 UTC (rev 59) @@ -1,3 +1,9 @@ bas_h_sources = \ - $(top_srcdir)/stdair/basic/BasTypes.hpp -bas_cc_sources = + $(top_srcdir)/stdair/basic/BasTypes.hpp \ + $(top_srcdir)/stdair/basic/BasConst_WorldSchedule.hpp \ + $(top_srcdir)/stdair/basic/BasConst_Inventory.hpp \ + $(top_srcdir)/stdair/basic/BasConst_BookingClass.hpp \ + $(top_srcdir)/stdair/basic/BasConst_Yield.hpp \ + $(top_srcdir)/stdair/basic/BasConst_Period_BOM.hpp +bas_cc_sources = \ + $(top_srcdir)/stdair/basic/BasConst.cpp Modified: trunk/stdair/stdair/bom/AirlineFeatureMap.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureMap.cpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/AirlineFeatureMap.cpp 2009-11-04 10:39:37 UTC (rev 59) @@ -47,8 +47,8 @@ } // ////////////////////////////////////////////////////////////////////// - AirlineFeatureMap_T::iterator AirlineFeatureMap_T:: - find (const MapKey_T& iKey) const { + AirlineFeatureMap_T:: + iterator AirlineFeatureMap_T::find (const MapKey_T& iKey) const { return _airlineFeatureHolder.find (iKey); } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -13,6 +13,7 @@ namespace stdair { // Forward declarations. class FacBomContent; + class AirlineFeatureSet; struct BomRootKey_T; struct InventoryList_T; struct InventoryMap_T; @@ -103,7 +104,20 @@ /** Get a InventoryMap_T for iteration methods. */ InventoryMap_T getInventoryMap () const; + + /** Get the reference of the AirlineFeatureSet object. */ + const AirlineFeatureSet& getAirlineFeatureSet() const { + assert (_airlineFeatureSet != NULL); + return *_airlineFeatureSet; + } + public: + // //////////// Setters ////////////// + /** Set the reference to the AirlineFeatureSet object. */ + void setAirlineFeatureSet (const AirlineFeatureSet* ioAirlineFeatureSet_ptr){ + _airlineFeatureSet = ioAirlineFeatureSet_ptr; + } + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { @@ -124,6 +138,9 @@ // Attributes /** Reference structure. */ BomStructure_T& _bomRootStructure; + + /** Set of all AirlineFeatures.*/ + const AirlineFeatureSet* _airlineFeatureSet; }; } Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -38,7 +38,89 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef BookingClass ContentChild_T; + + public: + // /////////// Getters ///////////// + /** Get the FareFamily (parent class). */ + // FareFamily* getFareFamily() const { +// return _fareFamily; +// } + + // ////// Getters from the parent class /////// +// /** Get the airline code (from the parent class). */ +// const AirlineCode_T& getAirlineCode() const; + +// /** Get the flight number (from the parent class). */ +// const FlightNumber_T& getFlightNumber() const; + +// /** Get the flight-date (from the parent class). */ +// const Date_T& getFlightDateDate() const; + +// /** Get the board point (from the parent class). */ +// const AirportCode_T& getBoardPoint () const; + +// /** Get the off point (from the parent class). */ +// const AirportCode_T& getOffPoint () const; + +// /** Get the board date (from the parent class). */ +// const Date_T& getBoardDate () const; + +// /** Get the cabin code (from the parent class). */ +// const CabinCode_T& getCabinCode () const; + +// /** Get the board time (from the parent class). */ +// const Duration_T& getBoardTime () const; + +// /** Get the off date (from the parent class). */ +// const Date_T& getOffDate () const; + +// /** Get the off time (from the parent class). */ +// const Duration_T& getOffTime () const; + +// /** Get the elapsed time (from the parent class). */ +// const Duration_T& getElapsedTime() const; + +// /** Get the distance (from the parent class). */ +// const Distance_T& getDistance() const; + +// /** Get the date off set (from the parent class). */ +// const DateOffSet_T getDateOffSet () const; + +// /** Get the time off set between board and off points (from the +// parent class). */ +// const Duration_T getTimeOffSet() const; + +// /** Retrieve, if existing, theOnD corresponding to the +// given OnDKey. +// <br>If not existing, return the NULL pointer. */ +// OnD* getOnD (const OnDKey_T& iOnDKey) const; + +// /** Get the size of the OnD list. */ +// const unsigned int getOnDListSize () const { +// return _onDList.size(); +// } + +// /** Get the list of OnDs related to this class. */ +// const OnDList_T& getOnDList() const { +// return _onDList; +// } + + public: + // ///////// Setters ////////// + /** Set the Fare family (parent class). */ +// void setFareFamily (FareFamily& ioFareFamily) { +// _fareFamily = &ioFareFamily; +// } + /** Reset the number of bookings to its intial state. */ + //void reset (); + +// /** Reset the booking fare. */ +// void resetFare(); + +// /** Reset the booking yield. */ +// void resetYield(); + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -60,6 +142,46 @@ at the same level). */ const std::string describeShortKey() const; + /** Give a description of the structure (for display purposes). */ + //const std::string describe() const; + + /** Get a string describing the solution (Fare, MatchIndicator...). */ + //const std::string describeSolution() const; + + public: + // ///////// Business Methods ////////// + /** Update the number of bookings. */ +// bool updateInventoryForReservation (const NbOfBookings_T&); + +// /** Update the number of cancellations. */ +// bool updateInventoryForCancellation (const NbOfCancellations_T&); + +// /** Update the number of no-shows. */ +// bool updateInventoryForNoShow (const NbOfNoShows_T&); + + +// /** Update the revenue of the booking. */ +// bool updateRevenue (const NbOfBookings_T&, const Fare_T&, +// const AnalysisStatus_T&); + +// /** Add the current censorship flag into the flag list. */ +// void addCurrentCensorshipFlagToTheFlagList(); + +// /** Build the Class-Segment code (for example:B-NCE-BKK->BNCEBKK). */ +// const std::string buildClassSegmentCode() const; + +// /** Insert a new OnD reference. */ +// void addOnD (OnD&); + +// /** Calculate the ratio of booking for this booking only +// (without OnD bookings). */ +// const BookingRatio_T calculateNetProductRatio(); + + protected: + /** Update some statistics of the SegmentCabin parent object.*/ +// void updateParentStatistics (const Revenue_T&, +// const NbOfBookings_T&) const; + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { @@ -81,6 +203,12 @@ // Attributes /** Reference structure. */ BomStructure_T& _bookingClassStructure; + + /** Parent class: FareFamily. */ +// FareFamily* _fareFamily; + +// /** List of OnD references related to this bookingClass. */ +// OnDList_T _onDList; }; } Modified: trunk/stdair/stdair/bom/BookingClassContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.cpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BookingClassContent.cpp 2009-11-04 10:39:37 UTC (rev 59) @@ -4,17 +4,54 @@ // STL #include <cassert> // STDAIR +#include <stdair/basic/BasConst_BookingClass.hpp> +#include <stdair/basic/BasConst_Yield.hpp> #include <stdair/bom/BookingClassContent.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - BookingClassContent::BookingClassContent (const BomKey_T& iKey) : _key (iKey) { + BookingClassContent::BookingClassContent (const BomKey_T& iKey) + : _key (iKey), + _nbOfBookings (DEFAULT_CLASS_NB_OF_BOOKINGS), + _totalNbOfBookings (DEFAULT_CLASS_TOTAL_NB_OF_BOOKINGS), + _lastDCPTotalNbOfBookings (DEFAULT_CLASS_TOTAL_NB_OF_BOOKINGS), + _unconstrainedDemand (DEFAULT_CLASS_UNCONSTRAINED_DEMAND), + _nbOfCancellations (DEFAULT_CLASS_NB_OF_CANCELLATIONS), + _nbOfNoShows (DEFAULT_CLASS_NB_OF_NOSHOWS), + _availability (DEFAULT_CLASS_AVAILABILITY), + _classRevenue (DEFAULT_REVENUE_VALUE), + _currentCensorshipFlag (DEFAULT_CLASS_CENSORSHIPFLAG), + _censorshipFlagList (DEFAULT_CLASS_CENSORSHIPFLAG_LIST), + _bookingLimit (DEFAULT_CLASS_BOOKING_LIMIT), + _authorizationLevel(DEFAULT_CLASS_AUTHORIZATION_LEVEL), + _MAX (DEFAULT_CLASS_MAX_AUTHORIZATION_LEVEL), + _MIN (DEFAULT_CLASS_MIN_AUTHORIZATION_LEVEL), + _overbookingRate (1 + DEFAULT_CLASS_OVERBOOKING_RATE), + _fare (DEFAULT_CLASS_FARE_VALUE), + _adjustedYield (DEFAULT_YIELD_VALUE), + _yield (DEFAULT_YIELD_VALUE), + _remainingDemandMean (DEFAULT_CLASS_REMAINING_DEMAND_MEAN), + _remainingProductDemandMean (DEFAULT_CLASS_REMAINING_DEMAND_MEAN), + _remainingDemandSD (DEFAULT_CLASS_REMAINING_DEMAND_STANDARD_DEVIATION), + _remainingProductDemandSD (DEFAULT_CLASS_REMAINING_DEMAND_STANDARD_DEVIATION) { } // //////////////////////////////////////////////////////////////////// BookingClassContent::~BookingClassContent () { } + + // ////////////////////////////////////////////////////////////////////// + void BookingClassContent::setRemainingDemandMean(NbOfBookings_T& iMean) { + _remainingDemandMean = iMean; + _remainingProductDemandMean = iMean; + } + // ////////////////////////////////////////////////////////////////////// + void BookingClassContent::setRemainingDemandSD(NbOfBookings_T& iSD) { + _remainingDemandSD = iSD; + _remainingProductDemandSD = iSD; + } + } Modified: trunk/stdair/stdair/bom/BookingClassContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.hpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BookingClassContent.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -24,7 +24,198 @@ return _key; } + /** Get the booking code (part of the primary key). */ + const ClassCode_T& getClassCode() const { + return _key.getClassCode(); + } + + /** Get the number of bookings of the bookingClass. */ + const NbOfBookings_T& getNbOfBookings() const { + return _nbOfBookings; + } + + /** Get the number of bookings (without cancellation counted) + of the bookingClass. */ + const NbOfBookings_T& getTotalNbOfBookings() const { + return _totalNbOfBookings; + } + + /** Get the number of bookings at the last DCP(without + cancellation counted) of the bookingClass. */ + const NbOfBookings_T& getLastDCPTotalNbOfBookings() const { + return _lastDCPTotalNbOfBookings; + } + + /** Get the unconstrained demand (last DCP) of the bookingClass. */ + const NbOfBookings_T& getUnconstrainedDemand () const { + return _unconstrainedDemand; + } + + /** Get the number of cancellations of the bookingClass. */ + const NbOfCancellations_T& getNbOfCancellations() const { + return _nbOfCancellations; + } + + /** Get the number of no-shows of the bookingClass. */ + const NbOfNoShows_T& getNbOfNoShows() const { + return _nbOfNoShows; + } + + /** Get the overbooking rate dedicated to the booking. */ + const OverbookingRate_T& getOverbookingRate() const { + return _overbookingRate; + } + + /** Get the list of censorship flags. */ + const CensorshipFlagList_T& getCensorshipFlagList() const { + return _censorshipFlagList; + } + + /** Get the current censorship flag. */ + const CensorshipFlag_T& getCurrentCensorshipFlag() const { + return _currentCensorshipFlag; + } + + /** Get the protection value. */ + const BookingLimit_T& getBookingLimit() const { + return _bookingLimit; + } + + /** Get the authorisation level value. */ + const AuthorizationLevel_T& getAuthorizationLevel () const { + return _authorizationLevel; + } + + /** Get the MAX value of AU. */ + const AuthorizationLevel_T& getMAX () const { + return _MAX; + } + + /** Get the MIN value of AU. */ + const AuthorizationLevel_T& getMIN () const { + return _MIN; + } + + /** Get the availability number. */ + const Availability_T& getAvailability() const { + return _availability; + } + + /** Get the revenue amount. */ + const Revenue_T& getRevenue() const { + return _classRevenue; + } + + /** Get the fare current value. */ + const Fare_T& getFare() const { + return _fare; + } + + /** Get the adjusted yield current value. */ + const Yield_T& getAdjustedYield() const { + return _adjustedYield; + } + + /** Get the yield current value. */ + const Yield_T& getYield() const { + return _yield; + } + + /** Get the remaining demand mean. */ + const NbOfBookings_T& getRemainingDemandMean() const { + return _remainingDemandMean; + } + + /** Get the remaining demand mean for the net booking product. */ + const NbOfBookings_T& getRemainingProductDemandMean() const { + return _remainingProductDemandMean; + } + + /** Get the remaining demand standard deviation. */ + const NbOfBookings_T& getRemainingDemandSD() const { + return _remainingDemandSD; + } + + /** Get the remaining demand standard deviation + for the net booking product. */ + const NbOfBookings_T& getRemainingProductDemandSD() const { + return _remainingProductDemandSD; + } + public: + // /////////// Setters //////////// + /** Set the booking limit. */ + void setBookingLimit (BookingLimit_T& iBookingLimit) { + _bookingLimit = iBookingLimit; + } + + /** Set the authorization level. */ + void setAuthorizationLevel (AuthorizationLevel_T& iAuthorizationLevel) { + _authorizationLevel = iAuthorizationLevel; + } + + /** Set the MAX value of AU. */ + void setMAX (const AuthorizationLevel_T& iMAX) { + _MAX = iMAX; + } + + /** Set the MIN value of AU. */ + void setMIN (const AuthorizationLevel_T& iMIN) { + _MIN = iMIN; + } + + /** Set the Availability number. */ + void setAvailability (Availability_T& iAvailability) { + _availability = iAvailability; + } + + /** Set the censorship flag status. */ + void setCensorshipFlagStatus (bool iFlagStatus) { + _currentCensorshipFlag = iFlagStatus; + } + + /** Set the fare value. */ + void setFare(Fare_T& iFare) { + _fare = iFare; + } + + /** Set the adjusted fare value. */ + void setAdjustedYield(Yield_T& iYield) { + _adjustedYield = iYield; + } + + /** Set the yield value. */ + void setYield(Yield_T& iYield) { + _yield = iYield; + } + + /** Set the unconstrained demand. */ + void setUnconstrainedDemand (NbOfBookings_T& iDemand) { + _unconstrainedDemand = iDemand; + } + + /** Set the total bookings for the DCP. */ + void setDCPTotalNbOfBookings (NbOfBookings_T& iBookings) { + _lastDCPTotalNbOfBookings = iBookings; + } + + /** Set the remaining demand mean. */ + void setRemainingDemandMean (NbOfBookings_T&); + + /** Set the remaining demand mean for the net booking product. */ + void setRemainingProductDemandMean (NbOfBookings_T& iMean) { + _remainingProductDemandMean = iMean; + } + + /** Set the remaining demand standard deviation. */ + void setRemainingDemandSD (NbOfBookings_T&); + + /** Set the remaining demand standard deviation. */ + void setRemainingProductDemandSD (NbOfBookings_T& iSD) { + _remainingProductDemandSD = iSD; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -58,6 +249,79 @@ // Attributes /** The key of both structure and content objects. */ BomKey_T _key; + + /** Number of current bookings in the booking. */ + NbOfBookings_T _nbOfBookings; + + /** Total number of bookings (without substraction of cancellation). */ + NbOfBookings_T _totalNbOfBookings; + + /** Total number of bookings at the last DCP (without + substraction of cancellation). */ + NbOfBookings_T _lastDCPTotalNbOfBookings; + + /** Unconstraining demnd value (last RMS Computation).*/ + NbOfBookings_T _unconstrainedDemand; + + /** Number of cancelled demands. */ + NbOfCancellations_T _nbOfCancellations; + + /** Number of no-shows. */ + NbOfNoShows_T _nbOfNoShows; + + /** Number of available seats. */ + Availability_T _availability; + + /** Total Revenue of the booking. */ + Revenue_T _classRevenue; + + /** Current Censorship flag which indicates whether the demand + is censored. */ + CensorshipFlag_T _currentCensorshipFlag; + + /** List of censorship flags which indicates whether the demand + is censored (one flag per DCP). */ + CensorshipFlagList_T _censorshipFlagList; + + /** Value of the booking limit of the booking. */ + BookingLimit_T _bookingLimit; + + /** Value of the authorization level of the booking. */ + AuthorizationLevel_T _authorizationLevel; + + /** MAX of Authorization Level (AU). */ + AuthorizationLevel_T _MAX; + + /** MIN of Authorization Level (AU). */ + AuthorizationLevel_T _MIN; + + /** Rate of allowed overbooking. */ + OverbookingRate_T _overbookingRate; + + /** Current Fare value of the booking. */ + Fare_T _fare; + + /** Current Adjusted Fare value of the booking. */ + Yield_T _adjustedYield; + + /** Current Yield value of the booking. */ + Yield_T _yield; + + /** Temporary attributes just for the forecaster prototype. */ + /** Remaining demand mean for the whole booking. */ + NbOfBookings_T _remainingDemandMean; + + /** Remaining demand mean for the product corresponding to this booking + (excluding (OnDs)). */ + NbOfBookings_T _remainingProductDemandMean; + + /** Remaining demand standrad deviation for the whole booking. */ + NbOfBookings_T _remainingDemandSD; + + /** Remaining demand standard deviation for the product + corresponding to this booking (excluding (OnDs)). */ + NbOfBookings_T _remainingProductDemandSD; + }; } Modified: trunk/stdair/stdair/bom/BookingClassMap.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassMap.cpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BookingClassMap.cpp 2009-11-04 10:39:37 UTC (rev 59) @@ -45,6 +45,12 @@ BookingClassMap_T::reverse_iterator BookingClassMap_T::rend () const { return _bookingClassHolder.mapREnd (); } - + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T:: + iterator BookingClassMap_T::find (const MapKey_T& iKey) const { + return _bookingClassHolder.find (iKey); + } + } Modified: trunk/stdair/stdair/bom/BookingClassMap.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassMap.hpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/BookingClassMap.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -50,6 +50,10 @@ return the reverse iterator at the end of the map. */ reverse_iterator rend () const; + /** Retrieve, if existing, the BookingClass corresponding to the + given key. */ + iterator find (const MapKey_T&) const; + public: /** Default constructors. */ BookingClassMap_T (); Added: trunk/stdair/stdair/bom/DoWStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.cpp (rev 0) +++ trunk/stdair/stdair/bom/DoWStruct.cpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,75 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STL +#include <sstream> +// STDAIR +#include <stdair/basic/BasConst_Period_BOM.hpp> +#include <stdair/bom/DoWStruct.hpp> + +namespace stdair { + + // ////////////////////////////////////////////////////////////////////// + DoWStruct_T::DoWStruct_T (const std::string& iDowString) { + const unsigned short lDowStringSize = iDowString.size(); + assert (lDowStringSize == 7); + + _dowList.reserve (lDowStringSize); + for (std::string::const_iterator itChar = iDowString.begin(); + itChar != iDowString.end(); ++itChar) { + const bool isDoWSet = (*itChar == '1')?true:false; + _dowList.push_back (isDoWSet); + } + } + + // ////////////////////////////////////////////////////////////////////// + DoWStruct_T::DoWStruct_T (const DoWStruct_T& iDowStruct) : + _dowList (iDowStruct._dowList) { + + } + + // ////////////////////////////////////////////////////////////////////// + const std::string DoWStruct_T::describeShort() const { + std::ostringstream ostr; + short i = 0; + for (BooleanList_T::const_iterator itDoW = _dowList.begin(); + itDoW != _dowList.end(); ++itDoW, ++i) { + const char lDoW = (*itDoW == true)?'1':'0'; + ostr << lDoW; + } + return ostr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string DoWStruct_T::describe() const { + std::ostringstream ostr; + short i = 0; + for (BooleanList_T::const_iterator itDoW = _dowList.begin(); + itDoW != _dowList.end(); ++itDoW, ++i) { + const bool lDoW = *itDoW; + if (lDoW == true) { + ostr << DOW_STR[i] << "."; + } + } + return ostr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + bool DoWStruct_T::getDayOfWeek (const unsigned short i) const { + return _dowList.at (i); + } + + // ////////////////////////////////////////////////////////////////////// + bool DoWStruct_T::getStandardDayOfWeek (const unsigned short i) const { + unsigned short iStd = i; + if (iStd == 0) { + iStd = 6; + } else { + --iStd; + } + return _dowList.at (iStd); + } + +} Added: trunk/stdair/stdair/bom/DoWStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.hpp (rev 0) +++ trunk/stdair/stdair/bom/DoWStruct.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -0,0 +1,51 @@ +#ifndef __STDAIR_BOM_DOWSTRUCT_HPP +#define __STDAIR_BOM_DOWSTRUCT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <vector> +// STDAIR +#include <stdair/bom/StructAbstract.hpp> + +namespace stdair { + + /** Define a Day Of the Week (DoW) sequence. + <br>For instance, 1..11.1 means that the period is active on + Mon., Thu., Fri. and Sun. */ + struct DoWStruct_T : public StructAbstract { + public: + /** Define the bit set representing the DoW. */ + typedef std::vector<bool> BooleanList_T; + + /** Attributes. */ + BooleanList_T _dowList; + + /** Get the i-th day of the week (Monday being the first one). */ + bool getDayOfWeek (const unsigned short i) const; + + /** Get the i-th day of the week (Sunday being the first one). */ + bool getStandardDayOfWeek (const unsigned short i) const; + + /** Display explicitly (e.g., "Mon.Tue.Wed.Thu.Fri."). */ + const std::string describe() const; + + /** Display as a bit set (e.g., "1111100"). */ + const std::string describeShort() const; + + public: + /** Constructor from a given bit set (e.g., "0000011" for the + week-ends). */ + DoWStruct_T (const std::string& iDowString); + + /** Default constructor. */ + DoWStruct_T (); + + /** Default constructor. */ + DoWStruct_T (const DoWStruct_T&); + }; + +} +#endif // __STDAIR_BOM_DOWSTRUCT_HPP Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-10-28 10:05:59 UTC (rev 58) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-11-04 10:39:37 UTC (rev 59) @@ -51,6 +51,56 @@ typedef LegDate SecondContentChild_T; 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; + + /** Get the list of class structures */ + // BookingClassMap_T getClassList() const { +// return _bookingClassList; +// } + + /** Get the airline code (from the parent class). */ + // const AirlineCode_T& getAirlineCode() const; + +// /** Retrieve, if existing, the LegDate corresponding to the +// given board point (LegDate key). +// <br>If not existing, return the NULL pointer. */ +// LegDate* getLegDate (const AirportCode_T& iBoardPoint) const; + +// /** Retrieve, if existing, the SegmentDate corresponding to the +// given (board point, off point) pair (SegmentDate key). +// <br>If not existing, return the NULL pointer. */ +// SegmentDate* getSegmentDate (const AirportCode_T& iBoardPoint, +// const AirportCode_T& iOffPoint) const; + +// /** Return the BookingClass corresponding to a given key. +// <br>When no BookingClass, matching the given key, can be found, +// the NULL pointer is returned. +// <br>Otherwise, a pointer is returned on the BookingClass object. */ +// BookingClass* getBookingClass (const std::string&) const; + +// /** Retrieve, if existing, theOnD corresponding to the +// given OnDKey. +// <br>If not existing, return the NULL pointer. */ +// OnD* getOnD (const OnDKey_T& iOnDKey) const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _flightDateStructure; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -71,26 +121,9 @@ at the same level). */ const std::string describeShortKey() const; - public: - // /////////// Getters ///////////// - /** Get a SegmentDateList_T for iteration methods. */ - SegmentDateList_T getSegmentDateList () const; + /** Display the full FlightDate context. */ + //const std::string display() con... [truncated message content] |
From: <qua...@us...> - 2009-11-12 16:44:56
|
Revision: 62 http://stdair.svn.sourceforge.net/stdair/?rev=62&view=rev Author: quannaus Date: 2009-11-12 16:44:45 +0000 (Thu, 12 Nov 2009) Log Message: ----------- [Dev] Migrated some more functions from LATUS_COM. Modified Paths: -------------- trunk/stdair/stdair/bom/AirlineFeatureKey.cpp trunk/stdair/stdair/bom/AirlineFeatureKey.hpp trunk/stdair/stdair/bom/AirlineFeatureSet.cpp trunk/stdair/stdair/bom/AirlineFeatureSet.hpp trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomList.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomRootContent.hpp trunk/stdair/stdair/bom/BomRootKey.cpp trunk/stdair/stdair/bom/BomRootKey.hpp trunk/stdair/stdair/bom/BookingClassKey.cpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateKey.cpp trunk/stdair/stdair/bom/FlightDateKey.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryKey.cpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabinKey.cpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/LegDateKey.cpp trunk/stdair/stdair/bom/LegDateKey.hpp trunk/stdair/stdair/bom/SegmentCabinKey.cpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/SegmentDateKey.cpp trunk/stdair/stdair/bom/SegmentDateKey.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/AirlineFeatureKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -25,10 +25,15 @@ } // //////////////////////////////////////////////////////////////////// - std::string AirlineFeatureKey_T::toString() const { + const std::string AirlineFeatureKey_T::toString() const { std::ostringstream oStr; oStr << _airlineCode; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string AirlineFeatureKey_T::describe() const { + return toString(); + } + } Modified: trunk/stdair/stdair/bom/AirlineFeatureKey.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,12 +7,18 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/AirlineFeatureSetKey.hpp> namespace stdair { /** Key of AirlineFeature. */ struct AirlineFeatureKey_T : public BomKey_T { - + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef AirlineFeatureSetKey_T ParentKey_T; + + public: // /////////// Construction /////////// /** Constructor. */ AirlineFeatureKey_T (const AirlineCode_T& iAirlineCode); @@ -22,8 +28,11 @@ // /////////// Getters ////////// /** Get the airline code. */ - const AirlineCode_T& getAirlineCode() const; + const AirlineCode_T& getAirlineCode() const { return _airlineCode; } + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { } + // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -38,8 +47,11 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes /** Airline code. */ Modified: trunk/stdair/stdair/bom/AirlineFeatureSet.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -17,7 +17,7 @@ AirlineFeatureSet (const BomKey_T& iKey, BomStructure_T& ioAirlineFeatureSetStructure) : AirlineFeatureSetContent (iKey), - _bomRootStructure (ioAirlineFeatureSetStructure) { + _bomStructure (ioAirlineFeatureSetStructure) { } // //////////////////////////////////////////////////////////////////// @@ -48,29 +48,18 @@ // ////////////////////////////////////////////////////////////////////// AirlineFeatureList_T AirlineFeatureSet::getAirlineFeatureList () const { - return _bomRootStructure.getChildrenList(); + return _bomStructure.getChildrenList(); } // ////////////////////////////////////////////////////////////////////// AirlineFeatureMap_T AirlineFeatureSet::getAirlineFeatureMap () const { - return _bomRootStructure.getChildrenList(); + return _bomStructure.getChildrenList(); } // ////////////////////////////////////////////////////////////////////// - const AirlineFeature* AirlineFeatureSet:: - getAirlineFeature (const AirlineCode_T& iAirlineCode) const { - - AirlineFeatureMap_T lAirlineFeatureMap = getAirlineFeatureMap (); - AirlineFeatureMap_T::iterator itAirlineFeature = - lAirlineFeatureMap.find (iAirlineCode); - - if (itAirlineFeature != lAirlineFeatureMap.end()) { - const AirlineFeature* oAirlineFeature_ptr = itAirlineFeature->second; - assert (oAirlineFeature_ptr != NULL); - return oAirlineFeature_ptr; - } - - return NULL; + AirlineFeature* AirlineFeatureSet:: + getAirlineFeature (const AirlineFeatureKey_T& iKey) const { + return _bomStructure.getContentChild (iKey); } } Modified: trunk/stdair/stdair/bom/AirlineFeatureSet.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -14,6 +14,7 @@ // Forward declarations. class FacBomContent; class AirlineFeature; + struct AirlineFeatureKey_T; struct AirlineFeatureSetKey_T; /** Class representing the actual functional/business content @@ -63,7 +64,7 @@ /** Retrieve, if existing, the Airline features corresponding to the given airline code. <br>If not existing, return the NULL pointer. */ - const AirlineFeature* getAirlineFeature (const AirlineCode_T&) const; + AirlineFeature* getAirlineFeature (const AirlineFeatureKey_T&) const; /** Get a AirlineFeatureList_T for iteration methods. */ AirlineFeatureList_T getAirlineFeatureList () const; @@ -74,7 +75,7 @@ private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { - return _bomRootStructure; + return _bomStructure; } protected: @@ -90,7 +91,7 @@ private: // Attributes /** Reference structure. */ - BomStructure_T& _bomRootStructure; + BomStructure_T& _bomStructure; }; } Modified: trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -24,10 +24,15 @@ } // //////////////////////////////////////////////////////////////////// - std::string AirlineFeatureSetKey_T::toString() const { + const std::string AirlineFeatureSetKey_T::toString() const { std::ostringstream oStr; oStr << " -- AIRLINE FEATURE SET -- "; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string AirlineFeatureSetKey_T::describe() const { + return toString(); + } + } Modified: trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -35,8 +35,11 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes // No attributes, as that class corresponds to the root of Bom structure. Modified: trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -12,8 +12,12 @@ #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> #include <stdair/bom/AirlineFeatureStructure.hpp> +#include <stdair/bom/AirlineFeatureKey.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by a specific AirlineFeatureSet class. */ template <typename BOM_CONTENT> @@ -31,6 +35,13 @@ BOM_CONTENT. */ typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + /** Definition allowing to retrieve the key type of the + ContentChild_T. */ + typedef AirlineFeatureKey_T ChildKey_T; + + /** Define the map of ContentChild_T. */ + typedef BomMap_T<ContentChild_T> ChildrenMap_T; + private: // Type definitions /** Definition allowing to retrieve the associated BOM key type. */ @@ -63,7 +74,27 @@ void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _childrenList; } - + + /** Retrieve, if existing, the airline feature corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + ContentChild_T* getContentChild (const ChildKey_T& iKey) const { + ContentChild_T* oContentChild_ptr = NULL; + + ChildrenMap_T lChildrenMap (getChildrenList()); + const MapKey_T lMapKey = iKey.toString(); + + typename ChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + return oContentChild_ptr; + } + + assert (oContentChild_ptr != NULL); + } + private: /////////////// Setters //////////////// /** Default children list setter. */ Modified: trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp =================================================================== --- trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -109,7 +109,14 @@ MapReverseIterator_T mapREnd () const { return _bomChildrenList.rend(); } + + // /////////// Other operators ///////////// + /** Get the size of the list. */ + const unsigned int size () const { + return _bomChildrenOrderedList.size(); + } + /** Retrieve, if existing, the bom corresponding to the given key. */ MapIterator_T find (const MapKey_T& iKey) const { return _bomChildrenList.find (iKey); Modified: trunk/stdair/stdair/bom/BomKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -34,7 +34,12 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - virtual std::string toString() const { return std::string("Hello!"); } + virtual const std::string toString() const { return std::string("Hello!"); } + + /** Display of the key. + <br>That string is unique at all levels. + */ + virtual const std::string describe() const { return toString(); } }; } Modified: trunk/stdair/stdair/bom/BomList.hpp =================================================================== --- trunk/stdair/stdair/bom/BomList.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomList.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -50,6 +50,10 @@ return the reverse iterator at the end of the list. */ reverse_iterator rend () const { return _bomHolder.listREnd(); } + // /////////// Other operators ///////////// + /** Get the size of the list. */ + const unsigned int size () const { return _bomHolder.size(); } + public: /** Default constructors. */ BomList_T (); Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -21,13 +21,27 @@ BomRoot::~BomRoot () { } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// InventoryList_T BomRoot::getInventoryList () const { return _bomRootStructure.getChildrenList(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// InventoryMap_T BomRoot::getInventoryMap () const { return _bomRootStructure.getChildrenList(); } + + Inventory* BomRoot::getInventory (const AirlineCode_T& iAirlineCode) const { + Inventory* oInventory_ptr = NULL; + + InventoryMap_T lInventoryMap = getInventoryMap (); + InventoryMap_T::iterator itInv = lInventoryMap.find (iAirlineCode); + + if (itInv != lInventoryMap.end()) { + oInventory_ptr = itInv->second; + } + + return oInventory_ptr; + } + } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -109,6 +109,11 @@ return *_airlineFeatureSet; } + /** Retrieve, if existing, the Inventory corresponding to the + given airline code (Inventory key). + <br>If not existing, return the NULL pointer. */ + Inventory* getInventory (const AirlineCode_T&) const; + public: // //////////// Setters ////////////// /** Set the reference to the AirlineFeatureSet object. */ Modified: trunk/stdair/stdair/bom/BomRootContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootContent.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomRootContent.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -101,6 +101,13 @@ void setLoadFactor (const Revenue_T& iWSLF) { _wScheduleLoadFactor = iWSLF; } + + public: + // /////////// Business methods /////////// + /** Update the counter of flight-dates. */ + void updateFlightDateCounter() { + _flightDateCounter++; + } public: // /////////// Display support methods ///////// Modified: trunk/stdair/stdair/bom/BomRootKey.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomRootKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -24,10 +24,15 @@ } // //////////////////////////////////////////////////////////////////// - std::string BomRootKey_T::toString() const { + const std::string BomRootKey_T::toString() const { std::ostringstream oStr; oStr << " -- ROOT -- "; return oStr.str(); } + + // //////////////////////////////////////////////////////////////////// + const std::string BomRootKey_T::describe() const { + return toString(); + } } Modified: trunk/stdair/stdair/bom/BomRootKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BomRootKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -33,8 +33,11 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes }; Modified: trunk/stdair/stdair/bom/BookingClassKey.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BookingClassKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -25,10 +25,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string BookingClassKey_T::toString() const { + const std::string BookingClassKey_T::toString() const { std::ostringstream oStr; oStr << _classCode; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string BookingClassKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + } Modified: trunk/stdair/stdair/bom/BookingClassKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/BookingClassKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,12 +7,18 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/SegmentCabinKey.hpp> namespace stdair { /** Key of segment-cabin. */ struct BookingClassKey_T : public BomKey_T { - + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef SegmentCabinKey_T ParentKey_T; + + public: // /////////// Construction /////////// /** Constructor. */ BookingClassKey_T (const ClassCode_T& iClassCode); @@ -24,6 +30,11 @@ /** Get the cabin code. */ const ClassCode_T& getClassCode () const; + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } + // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -38,10 +49,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-cabin. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Segment-cabin key.*/ + ParentKey_T _parentKey; + /** Cabin code. */ ClassCode_T _classCode; }; Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -46,6 +46,9 @@ BOM content child type. */ typedef LegDate SecondContentChild_T; + /** Definition allowing to retrieve the specific BookingClass type. */ + typedef BookingClass BookingClassContent_T; + public: // /////////// Getters ///////////// /** Get a SegmentDateList_T for iteration methods. */ Modified: trunk/stdair/stdair/bom/FlightDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/FlightDateKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -13,6 +13,12 @@ } // //////////////////////////////////////////////////////////////////// + FlightDateKey_T::FlightDateKey_T (const FlightDateKey_T& iKey) + : _parentKey (iKey._parentKey), + _flightNumber (iKey._flightNumber), _flightDate (iKey._flightDate) { + } + + // //////////////////////////////////////////////////////////////////// FlightDateKey_T::~FlightDateKey_T () { } @@ -26,10 +32,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string FlightDateKey_T::toString() const { + const std::string FlightDateKey_T::toString() const { std::ostringstream oStr; oStr << _flightNumber << ", " << _flightDate; return oStr.str(); } + + // //////////////////////////////////////////////////////////////////// + const std::string FlightDateKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } } Modified: trunk/stdair/stdair/bom/FlightDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/FlightDateKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,28 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/InventoryKey.hpp> namespace stdair { /** Key of flight-date. */ struct FlightDateKey_T : public BomKey_T { + friend struct SegmentDateKey_T; + friend struct LegDateKey_T; public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef InventoryKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + FlightDateKey_T () { }; + + public: // /////////// Construction /////////// - /** Constructor. */ + /** Constructors. */ FlightDateKey_T (const FlightNumber_T&, const Date_T&); + FlightDateKey_T (const FlightDateKey_T&); /** Destructor. */ ~FlightDateKey_T (); @@ -31,6 +44,12 @@ return _flightDate; } + // /////////// Setters ///////////// + /** Set the parent key. */ + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } + // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -45,10 +64,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Inventory Key.*/ + ParentKey_T _parentKey; + /** Flight number. */ FlightNumber_T _flightNumber; Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -55,6 +55,9 @@ /** Definition allowing to retrive the second children bom holder type. */ typedef BomChildrenHolderImp<SecondContentChild_T> SecondChildrenBomHolder_T; + /** Define the children booking class holder type. */ + typedef BomChildrenHolderImp<typename BOM_CONTENT::BookingClassContent_T> BookingClassHolder_T; + public: // /////////// Getters ///////////// /** Get the (parent) InventoryStructure object. */ @@ -113,6 +116,11 @@ void setChildrenList (SecondChildrenBomHolder_T& ioChildrenList) { _secondChildrenList = &ioChildrenList; } + + /** Set the booking class list. */ + void setBookingClassHolder (BookingClassHolder_T& ioBookingClassHolder) { + _bookingClassHolder = &ioBookingClassHolder; + } public: // /////////// Display support methods ///////// @@ -142,8 +150,8 @@ layer. */ /** Default constructors. */ FlightDateStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL), - _secondChildrenList (NULL) { } + _childrenList (NULL), _secondChildrenList (NULL), + _bookingClassHolder (NULL) { } FlightDateStructure (const FlightDateStructure&); /** Destructor. */ @@ -163,6 +171,9 @@ /** List of leg-dates. */ SecondChildrenBomHolder_T* _secondChildrenList; + /** List of booking classes. */ + BookingClassHolder_T* _bookingClassHolder; + }; } Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -58,10 +58,12 @@ return _inventoryStructure.getChildrenList(); } + // ////////////////////////////////////////////////////////////////////// + FlightDate* Inventory:: + getFlightDate (const FlightDateKey_T& iKey) const { + return _inventoryStructure.getContentChild (iKey); + } -// FlightDate* getFlightDate (const FlightNumber_T& iFlightNumber, -// const Date_T& iFlightDate) const; - // BookingClass* getBookingClass (const std::string&) const; // /** Clean the list of classes. */ Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -16,6 +16,7 @@ class FacBomContent; class AirlineFeature; class BookingClass; + struct FlightDateKey_T; struct InventoryKey_T; /** Class representing the actual functional/business content for @@ -83,8 +84,7 @@ /** Retrieve, if existing, the FlightDate corresponding to the given flight number and flight date (FlightDate key). <br>If not existing, return the NULL pointer. */ - // FlightDate* getFlightDate (const FlightNumber_T& iFlightNumber, -// const Date_T& iFlightDate) const; + FlightDate* getFlightDate (const FlightDateKey_T&) const; public: // /////////// Setters //////////// @@ -137,9 +137,6 @@ /** The feature set of the correspondent airline. */ const AirlineFeature* _airlineFeature; - - /** List of booking classes. */ - //BookingClassHolder_T _bookingClassList; }; } Modified: trunk/stdair/stdair/bom/InventoryKey.cpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/InventoryKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -10,6 +10,10 @@ InventoryKey_T::InventoryKey_T (const AirlineCode_T& iAirlineCode) : _airlineCode (iAirlineCode) { } + // //////////////////////////////////////////////////////////////////// + InventoryKey_T::InventoryKey_T (const InventoryKey_T& iKey) + : _airlineCode (iKey._airlineCode) { + } // //////////////////////////////////////////////////////////////////// InventoryKey_T::~InventoryKey_T () { @@ -25,10 +29,15 @@ } // //////////////////////////////////////////////////////////////////// - std::string InventoryKey_T::toString() const { + const std::string InventoryKey_T::toString() const { std::ostringstream oStr; oStr << _airlineCode; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string InventoryKey_T::describe() const { + return toString(); + } + } Modified: trunk/stdair/stdair/bom/InventoryKey.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/InventoryKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,27 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/BomRootKey.hpp> namespace stdair { /** Key of inventory. */ struct InventoryKey_T : public BomKey_T { + friend struct FlightDateKey_T; public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef BomRootKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + InventoryKey_T () { }; + + public: // /////////// Construction /////////// - /** Constructor. */ + /** Constructors. */ InventoryKey_T (const AirlineCode_T& iAirlineCode); + InventoryKey_T (const InventoryKey_T&); /** Destructor. */ ~InventoryKey_T (); @@ -38,8 +50,15 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; - + const std::string toString() const; + + /** Display of the key. */ + const std::string describe() const; + + // /////////// Setters ///////////// + /** Set the parent key. */ + void setParentKey (const ParentKey_T& iParentKey) const { } + private: // Attributes /** Airline code. */ Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -12,8 +12,12 @@ #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> #include <stdair/bom/FlightDateStructure.hpp> +#include <stdair/bom/FlightDateKey.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific Inventory class (for instance, in the AIRSCHED library). */ @@ -34,7 +38,14 @@ /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + /** Definition allowing to retrieve the key type of the + ContentChild_T. */ + typedef FlightDateKey_T ChildKey_T; + /** Define the map of ContentChild_T. */ + typedef BomMap_T<ContentChild_T> ChildrenMap_T; + /** Definition allowing to retrieve the associated parent BOM structure type. */ typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; @@ -76,11 +87,31 @@ assert (_childrenList != NULL); return *_childrenList; } - - /** Get the list of flight-dates. */ + + /** Get the list of flight-dates. */ void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _childrenList; } + + /** Retrieve, if existing, the flight-date corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + ContentChild_T* getContentChild (const ChildKey_T& iKey) const { + ContentChild_T* oContentChild_ptr= NULL; + + ChildrenMap_T lChildrenMap (getChildrenList()); + const MapKey_T lMapKey = iKey.toString(); + + typename ChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + assert (oContentChild_ptr != NULL); + } + + return oContentChild_ptr; + } private: // /////////// Setters ///////////// @@ -96,6 +127,11 @@ void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { _childrenList = &ioChildrenList; } + + /** Set the booking class list. */ + void setBookingClassHolder (BookingClassHolder_T& ioBookingClassHolder) { + _bookingClassHolder = &ioBookingClassHolder; + } public: // /////////// Display support methods ///////// @@ -125,7 +161,7 @@ layer. */ /** Default constructors. */ InventoryStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL) { } + _childrenList (NULL), _bookingClassHolder (NULL) { } InventoryStructure (const InventoryStructure&); /** Destructor. */ Modified: trunk/stdair/stdair/bom/LegCabinKey.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/LegCabinKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -12,6 +12,11 @@ } // //////////////////////////////////////////////////////////////////// + LegCabinKey_T::LegCabinKey_T (const LegCabinKey_T& iKey) + : _parentKey (iKey._parentKey), _cabinCode (iKey._cabinCode) { + } + + // //////////////////////////////////////////////////////////////////// LegCabinKey_T::~LegCabinKey_T () { } @@ -25,10 +30,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string LegCabinKey_T::toString() const { + const std::string LegCabinKey_T::toString() const { std::ostringstream oStr; oStr << _cabinCode; return oStr.str(); } + + // //////////////////////////////////////////////////////////////////// + const std::string LegCabinKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } } Modified: trunk/stdair/stdair/bom/LegCabinKey.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/LegCabinKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,27 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/LegDateKey.hpp> namespace stdair { /** Key of leg-cabin. */ struct LegCabinKey_T : public BomKey_T { + friend struct BookingClassKey_T; public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef LegDateKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + LegCabinKey_T () { }; + + public: // /////////// Construction /////////// - /** Constructor. */ + /** Constructors. */ LegCabinKey_T (const CabinCode_T& iCabinCode); + LegCabinKey_T (const LegCabinKey_T&); /** Destructor. */ ~LegCabinKey_T (); @@ -25,6 +37,11 @@ const CabinCode_T& getCabinCode () const { return _cabinCode; } + + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @@ -40,10 +57,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same leg-cabin. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Leg-date Key.*/ + ParentKey_T _parentKey; + /** Cabin code. */ CabinCode_T _cabinCode; }; Modified: trunk/stdair/stdair/bom/LegDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/LegDateKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -10,6 +10,10 @@ LegDateKey_T::LegDateKey_T (const AirportCode_T& iBoardPoint) : _boardPoint (iBoardPoint) { } + // //////////////////////////////////////////////////////////////////// + LegDateKey_T::LegDateKey_T (const LegDateKey_T& iKey) + : _parentKey (iKey._parentKey), _boardPoint (iKey._boardPoint) { + } // //////////////////////////////////////////////////////////////////// LegDateKey_T::~LegDateKey_T () { @@ -25,10 +29,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string LegDateKey_T::toString() const { + const std::string LegDateKey_T::toString() const { std::ostringstream oStr; oStr << _boardPoint; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string LegDateKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + } Modified: trunk/stdair/stdair/bom/LegDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/LegDateKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,27 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/FlightDateKey.hpp> namespace stdair { /** Key of leg-date. */ struct LegDateKey_T : public BomKey_T { - + friend struct LegCabinKey_T; + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef FlightDateKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + LegDateKey_T () { }; + + public: // /////////// Construction /////////// - /** Constructor. */ + /** Constructors. */ LegDateKey_T (const AirportCode_T& iBoardPoint); + LegDateKey_T (const LegDateKey_T&); /** Destructor. */ ~LegDateKey_T (); @@ -26,6 +38,11 @@ return _boardPoint; } + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } + // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -40,10 +57,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same leg-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Flight-date Key.*/ + ParentKey_T _parentKey; + /** Boarding airport. */ AirportCode_T _boardPoint; }; Modified: trunk/stdair/stdair/bom/SegmentCabinKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/SegmentCabinKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -12,6 +12,11 @@ } // //////////////////////////////////////////////////////////////////// + SegmentCabinKey_T::SegmentCabinKey_T (const SegmentCabinKey_T& iKey) + : _parentKey (iKey._parentKey), _cabinCode (iKey._cabinCode) { + } + + // //////////////////////////////////////////////////////////////////// SegmentCabinKey_T::~SegmentCabinKey_T () { } @@ -25,10 +30,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string SegmentCabinKey_T::toString() const { + const std::string SegmentCabinKey_T::toString() const { std::ostringstream oStr; oStr << _cabinCode; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string SegmentCabinKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + } Modified: trunk/stdair/stdair/bom/SegmentCabinKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/SegmentCabinKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,27 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/SegmentDateKey.hpp> namespace stdair { /** Key of segment-cabin. */ struct SegmentCabinKey_T : public BomKey_T { + friend struct BookingClassKey_T; public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef SegmentDateKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + SegmentCabinKey_T () { }; + + public: // /////////// Construction /////////// /** Constructor. */ SegmentCabinKey_T (const CabinCode_T& iCabinCode); + SegmentCabinKey_T (const SegmentCabinKey_T&); /** Destructor. */ ~SegmentCabinKey_T (); @@ -25,6 +37,11 @@ const CabinCode_T& getCabinCode () const { return _cabinCode; } + + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @@ -40,10 +57,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-cabin. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Segment-date Key.*/ + ParentKey_T _parentKey; + /** Cabin code. */ CabinCode_T _cabinCode; }; Modified: trunk/stdair/stdair/bom/SegmentDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateKey.cpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/SegmentDateKey.cpp 2009-11-12 16:44:45 UTC (rev 62) @@ -13,6 +13,12 @@ } // //////////////////////////////////////////////////////////////////// + SegmentDateKey_T::SegmentDateKey_T (const SegmentDateKey_T& iKey) + : _parentKey (iKey._parentKey), + _boardPoint (iKey._boardPoint), _offPoint (iKey._offPoint) { + } + + // //////////////////////////////////////////////////////////////////// SegmentDateKey_T::~SegmentDateKey_T () { } @@ -26,10 +32,17 @@ } // //////////////////////////////////////////////////////////////////// - std::string SegmentDateKey_T::toString() const { + const std::string SegmentDateKey_T::toString() const { std::ostringstream oStr; oStr << _boardPoint << "-" << _offPoint; return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + const std::string SegmentDateKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + } Modified: trunk/stdair/stdair/bom/SegmentDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/bom/SegmentDateKey.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -7,15 +7,27 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> +#include <stdair/bom/FlightDateKey.hpp> namespace stdair { /** Key of segment-date. */ struct SegmentDateKey_T : public BomKey_T { + friend struct SegmentCabinKey_T; + + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef FlightDateKey_T ParentKey_T; + private: + // /////////// Default constructor ////////// + SegmentDateKey_T () { }; + public: // /////////// Construction /////////// - /** Constructor. */ + /** Constructors. */ SegmentDateKey_T (const AirportCode_T&, const AirportCode_T&); + SegmentDateKey_T (const SegmentDateKey_T&); /** Destructor. */ ~SegmentDateKey_T (); @@ -30,6 +42,11 @@ const AirportCode_T& getOffPoint() const { return _offPoint; } + + // /////////// Setters ///////////// + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @@ -45,10 +62,16 @@ when among children of a given parent Business Object. <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-date. */ - std::string toString() const; + const std::string toString() const; + /** Display of the key. */ + const std::string describe() const; + private: // Attributes + /** Flight-date Key.*/ + ParentKey_T _parentKey; + /** Boarding airport. */ AirportCode_T _boardPoint; Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -16,6 +16,7 @@ namespace stdair { // Forward declarations + template<typename BOM> struct BomList_T; class BomStructure; class BomContent; struct OptimizerStruct_T; @@ -43,11 +44,18 @@ <br>A structure object is created, under the hood, with the given key. That structure object then gets a pointer on the content object. */ template <typename BOM_CONTENT_CHILD> - BOM_CONTENT_CHILD& create (typename BOM_CONTENT_CHILD::Parent_T& ioContentParent, const typename BOM_CONTENT_CHILD::BomKey_T& iKey) { + BOM_CONTENT_CHILD& create (typename BOM_CONTENT_CHILD::Parent_T& ioContentParent, typename BOM_CONTENT_CHILD::BomKey_T& ioKey) { + + // Define the parent key type. + typedef typename BOM_CONTENT_CHILD::Parent_T::BomKey_T ParentKey_T; + + // Finish the construction of the child key by setting its parent. + const ParentKey_T& lParentKey = ioContentParent.getKey(); + ioKey.setParentKey (lParentKey); // Create the child structure object for the given key BOM_CONTENT_CHILD& lBomContentChild = - createInternal<BOM_CONTENT_CHILD> (iKey); + createInternal<BOM_CONTENT_CHILD> (ioKey); // Retrieve the child structure object typename BOM_CONTENT_CHILD::BomStructure_T& lBomStructureChild = @@ -104,7 +112,83 @@ return *aBomContent_ptr; } + // ////////////////////////////////////////////////////////////////// + // Section reserved for the building the direct accesses such as + // booking class holder directly in inventory or flight-date, ect. + // ////////////////////////////////////////////////////////////////// public: + template <typename BOM_ROOT> + static void createDirectAccesses (const BOM_ROOT& iBomRoot) { + // Retrieve the inventory type. + typedef typename BOM_ROOT::ContentChild_T INVENTORY_T; + // Define the list of inventories. + typedef BomList_T<INVENTORY_T> INVENTORY_LIST_T; + + // Browse the BomRoot and build direct accesses within each inventory. + const INVENTORY_LIST_T lInventoryList = iBomRoot.getInventoryList(); + for (typename INVENTORY_LIST_T::iterator itInv = lInventoryList.begin(); + itInv != lInventoryList.end(); ++itInv) { + INVENTORY_T& lCurrentInv = *itInv; + + createDirectAccessesWithinInventory (lCurrentInv); + } + } + + private: + /** Create a holder of all booking classes within the given inventory. */ + template <typename INVENTORY> + static void createDirectAccessesWithinInventory (INVENTORY& ioInventory){ + // Retrieve the flight-date type. + typedef typename INVENTORY::ContentChild_T FLIGHT_DATE_T; + // Define the list of flight-dates. + typedef BomList_T<FLIGHT_DATE_T> FLIGHT_DATE_LIST_T; + // Retrieve the booking class type. + typedef typename INVENTORY::BookingClassContent_T BOOKING_CLASS_T; + // Define the bom holder of booking classes. + typedef BomChildrenHolderImp<BOOKING_CLASS_T> BOOKING_CLASS_HOLDER_T; + + // Initialize the booking class holder within the inventory. + BOOKING_CLASS_HOLDER_T& lBookingClassHolder = + FacBomStructure::instance().createBomHolder<BOOKING_CLASS_T> (); + ioInventory._inventoryStructure.setBookingClassHolder(lBookingClassHolder); + + // Browse the inventory and build direct accesses within each + // flight-date, then build the booking class holder within the + // inventory. + const FLIGHT_DATE_LIST_T lFlightDateList = ioInventory.getFlightDateList(); + for (typename FLIGHT_DATE_LIST_T::iterator itFlightDate = + lFlightDateList.begin(); itFlightDate != lFlightDateList.end(); + ++itFlightDate) { + FLIGHT_DATE_T& lCurrentFlightDate = *itFlightDate; + createDirectAccessesWithinFlightDate (lCurrentFlightDate); + } + } + + /** Create the direct acceeses within the given flight-date, and, at the + same time, build the class holder for the parent inventory. */ + template <typename FLIGHT_DATE> + static void createDirectAccessesWithinFlightDate (const FLIGHT_DATE& ioFlightDate) { + // Retrieve the booking class type. + typedef typename FLIGHT_DATE::BookingClassContent_T BOOKING_CLASS_T; + // Define the bom holder of booking classes. + typedef BomChildrenHolderImp<BOOKING_CLASS_T> BOOKING_CLASS_HOLDER_T; + + typename FLIGHT_DATE::BomStructure_T::ParentBomStructure_T& lInvStructure = + ioFlightDate._flightDateStructure.getInventoryStructure(); + + BOOKING_CLASS_HOLDER_T* lInvBookingClassHolder_ptr = + lInvStructure._bookingClassHolder; + assert (lInvBookingClassHolder_ptr != NULL); + + // Retrieve the segment-date type. + typedef typename FLIGHT_DATE::ContentChild_T SEGMENT_DATE_T; + // Define the list of segment-dates. + typedef BomList_T<SEGMENT_DATE_T> SEGMENT_DATE_LIST_T; + + + } + + public: /** Provide the unique instance. <br>The singleton is instantiated when first used. @return FacBomContent& */ Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-11-06 23:55:05 UTC (rev 61) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-11-12 16:44:45 UTC (rev 62) @@ -89,25 +89,68 @@ ioBomParent.getChildrenList (lBomChildrenHolder_ptr); assert (lBomChildrenHolder_ptr != NULL); + bool hasInsertBeenSuccessful = + addBomObjecdToBomHolder <typename BOM_STRUCTURE_CHILD::Content_T> + (*lBomChildrenHolder_ptr, ioBomChild); + + return hasInsertBeenSuccessful; + } + + /** Add a BOM object into a dedicated BOM holder by using the + short key of the object. */ + template <typename BOM_CONTENT> + static bool addBomObjecdToBomHolder (BomChildrenHolderImp<BOM_CONTENT>& ioBomHolder, typename BOM_CONTENT::BomStructure_T& ioBomStructure) { + // Retrieve the bom structure type. + typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; + // Define the bom holder type. + typedef BomChildrenHolderImp<BOM_CONTENT> BOM_HOLDER_T; + // Retrieve the short key - const typename BOM_STRUCTURE_CHILD::BomKey_T& lBomChildKey = - ioBomChild.getKey(); - const std::string& lBomChildKeyStr = lBomChildKey.toString(); + const typename BOM_STRUCTURE_T::BomKey_T& lBomKey = ioBomStructure.getKey(); + const std::string& lBomKeyStr = lBomKey.toString(); - // Insert the child structure object in the dedicated lists - typedef typename BOM_CHILDREN_HOLDER_T::BomChildrenList_T BOM_CHILDREN_LIST_T; + // Insert the structure object in the dedicated lists + typedef typename BOM_HOLDER_T::BomChildrenList_T BOM_LIST_T; const bool hasInsertBeenSuccessful = - lBomChildrenHolder_ptr->_bomChildrenList. - insert (typename BOM_CHILDREN_LIST_T::value_type (lBomChildKeyStr, - &ioBomChild)).second; + ioBomHolder._bomChildrenList. + insert (typename BOM_LIST_T::value_type (lBomKeyStr, + &ioBomStructure)).second; if (hasInsertBeenSuccessful == false) { return hasInsertBeenSuccessful; } - - lBomChildrenHolder_ptr->_bomChildrenOrderedList.push_back (&ioBomChild); + ioBomHolder._bomChildrenOrderedList.push_back (&ioBomStructure); + return true; } + + /** Add a BOM object into a dedicated BOM holder by using the + full key of the object. */ + template <typename BOM_CONTENT> + static bool addFullBomObjecdToBomHolder (BomChildrenHolderImp<BOM_CONTENT> ioBomHolder, typename BOM_CONTENT::BomStructure_T& ioBomStructure) { + // Retrieve the bom structure type. + typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; + // Define the bom holder type. + typedef BomChildrenHolderImp<BOM_CONTENT> BOM_HOLDER_T; + + // Retrieve the short key + const typename BOM_STRUCTURE_T::BomKey_T& lBomKey = ioBomStructure.getKey(); + const std::string& lBomKeyStr = lBomKey.describe(); + + // Insert the structure object in the dedicated lists + typedef typename BOM_HOLDER_T::BomChildrenList_T BOM_LIST_T; + const bool hasInsertBeenSuccessful = + ioBomHolder._bomChildrenList. + insert (typename BOM_LIST_T::value_type (lBomKeyStr, + &ioBomStructure)).second; + if (hasInsertBeenSuccessful == false) { + return hasInsertBeenSuccessful; + } + + ioBomHolder._bomChildrenOrderedList.push_back (&ioBomStructure); + + return true; + } private: /** Create a bom children holder object with the given children type. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2009-11-13 08:52:49
|
Revision: 64 http://stdair.svn.sourceforge.net/stdair/?rev=64&view=rev Author: quannaus Date: 2009-11-13 08:52:41 +0000 (Fri, 13 Nov 2009) Log Message: ----------- [Dev] implemented the creation of direct accesses. Still have one uncomphensible bug. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_Inventory.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/basic/BasConst.cpp 2009-11-13 08:52:41 UTC (rev 64) @@ -479,4 +479,13 @@ /** Default Bid-Price Vector. */ const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR = std::vector<BidPrice_T>(); + /** Maximum number of legs linked to a single flight-date. + <br>Note that the number of derived segments is n*(n+1)/2 if n + is the number of legs. */ + const unsigned short MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT = 7; + + /** Maximum number of segments linked to a single O&D + (Origin & Destination). */ + const unsigned short MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND = 3; + } Modified: trunk/stdair/stdair/basic/BasConst_Inventory.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Inventory.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/basic/BasConst_Inventory.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -15,6 +15,15 @@ /** Default Bid-Price Vector. */ extern const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR; + + /** Maximum number of legs linked to a single flight-date. + <br>Note that the number of derived segments is n*(n+1)/2 if n + is the number of legs. */ + extern const unsigned short MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT; + + /** Maximum number of segments linked to a single O&D + (Origin & Destination). */ + extern const unsigned short MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND; } #endif // __STDAIR_BAS_BASCONST_INVENTORY_HPP Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2009-11-13 08:52:41 UTC (rev 64) @@ -11,6 +11,7 @@ #include <stdair/bom/FlightDate.hpp> #include <stdair/bom/SegmentDate.hpp> #include <stdair/bom/LegDate.hpp> +#include <stdair/bom/BookingClass.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> @@ -74,6 +75,21 @@ LegDateMap_T FlightDate::getLegDateMap () const { return _flightDateStructure.getSecondChildrenList(); } - + + // ////////////////////////////////////////////////////////////////////// + LegDate* FlightDate::getLegDate (const LegDateKey_T& iKey) const { + return _flightDateStructure.getSecondContentChild (iKey); + } + + // ////////////////////////////////////////////////////////////////////// + SegmentDate* FlightDate::getSegmentDate (const SegmentDateKey_T& iKey) const { + return _flightDateStructure.getContentChild (iKey); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClass* FlightDate:: + getBookingClass (const BookingClassKey_T& iKey) const { + return _flightDateStructure.getBookingClass (iKey); + } } Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -62,31 +62,25 @@ /** Get a LegDateMap_T for iteration methods. */ LegDateMap_T getLegDateMap () const; - - /** Get the list of class structures */ - // BookingClassMap_T getClassList() const { -// return _bookingClassList; -// } - + /** Get the airline code (from the parent class). */ // const AirlineCode_T& getAirlineCode() const; -// /** Retrieve, if existing, the LegDate corresponding to the -// given board point (LegDate key). -// <br>If not existing, return the NULL pointer. */ -// LegDate* getLegDate (const AirportCode_T& iBoardPoint) const; + /** Retrieve, if existing, the LegDate corresponding to the + given LegDate key. + <br>If not existing, return the NULL pointer. */ + LegDate* getLegDate (const LegDateKey_T&) const; -// /** Retrieve, if existing, the SegmentDate corresponding to the -// given (board point, off point) pair (SegmentDate key). -// <br>If not existing, return the NULL pointer. */ -// SegmentDate* getSegmentDate (const AirportCode_T& iBoardPoint, -// const AirportCode_T& iOffPoint) const; + /** Retrieve, if existing, the SegmentDate corresponding to the + given SegmentDate key. + <br>If not existing, return the NULL pointer. */ + SegmentDate* getSegmentDate (const SegmentDateKey_T&) const; -// /** Return the BookingClass corresponding to a given key. -// <br>When no BookingClass, matching the given key, can be found, -// the NULL pointer is returned. -// <br>Otherwise, a pointer is returned on the BookingClass object. */ -// BookingClass* getBookingClass (const std::string&) const; + /** Return the BookingClass corresponding to a given key. + <br>When no BookingClass, matching the given key, can be found, + the NULL pointer is returned. + <br>Otherwise, a pointer is returned on the BookingClass object. */ + BookingClass* getBookingClass (const BookingClassKey_T&) const; // /** Retrieve, if existing, theOnD corresponding to the // given OnDKey. Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -11,8 +11,14 @@ #include <stdair/bom/BomContentDummy.hpp> #include <stdair/bom/SegmentDateStructure.hpp> #include <stdair/bom/LegDateStructure.hpp> +#include <stdair/bom/SegmentDateKey.hpp> +#include <stdair/bom/LegDateKey.hpp> +#include <stdair/bom/BookingClassKey.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific FlightDate class (for instance, in the AIRSCHED library). */ @@ -30,6 +36,14 @@ /** Definition allowing to retrieve the associated BOM key type. */ typedef typename BOM_CONTENT::BomKey_T BomKey_T; + /** Definition allowing to retrieve the key type of the + ContentChild_T. */ + typedef SegmentDateKey_T ChildKey_T; + + /** Definition allowing to retrieve the key type of the + SecondContentChild_T. */ + typedef LegDateKey_T SecondChildKey_T; + /** Definition allowing to retrieve the associated parent BOM structure type. */ typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; @@ -38,9 +52,15 @@ BOM_CONTENT. */ typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + /** Define the map of ContentChild_T. */ + typedef BomMap_T<ContentChild_T> ChildrenMap_T; + /** Definition allowing to retrieve the second children type of the BOM_CONTENT. */ typedef typename BOM_CONTENT::SecondContentChild_T SecondContentChild_T; + + /** Define the map of SecondContentChild_T. */ + typedef BomMap_T<SecondContentChild_T> SecondChildrenMap_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<SegmentDateStructure<ContentChild_T>, @@ -55,8 +75,14 @@ /** Definition allowing to retrive the second children bom holder type. */ typedef BomChildrenHolderImp<SecondContentChild_T> SecondChildrenBomHolder_T; - /** Define the children booking class holder type. */ - typedef BomChildrenHolderImp<typename BOM_CONTENT::BookingClassContent_T> BookingClassHolder_T; + /** Define the children booking class type. */ + typedef typename BOM_CONTENT::BookingClassContent_T BookingClass_T; + + /** Define the children booking class holder type. */ + typedef BomChildrenHolderImp<BookingClass_T> BookingClassHolder_T; + + /** Define the map of ContentChild_T. */ + typedef BomMap_T<BookingClass_T> BookingClassMap_T; public: // /////////// Getters ///////////// @@ -79,14 +105,22 @@ /** Get the list of segment-dates. */ const ChildrenBomHolder_T& getChildrenList() const { + assert (_childrenList != NULL); return *_childrenList; } /** Get the list of leg-dates. */ const SecondChildrenBomHolder_T& getSecondChildrenList() const { + assert (_secondChildrenList != NULL); return *_secondChildrenList; } + /** Get the holder of booking classes. */ + BookingClassHolder_T& getBookingClassHolder() const { + assert (_bookingClassHolder); + return *_bookingClassHolder; + } + /** Get the list of segment-dates. */ void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _childrenList; @@ -96,7 +130,67 @@ void getChildrenList (SecondChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _secondChildrenList; } + + /** Retrieve, if existing, the segment-date corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + ContentChild_T* getContentChild (const ChildKey_T& iKey) const { + ContentChild_T* oContentChild_ptr = NULL; + + ChildrenMap_T lChildrenMap (getChildrenList()); + const MapKey_T lMapKey = iKey.toString(); + + typename ChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + assert (oContentChild_ptr != NULL); + } + + return oContentChild_ptr; + } + /** Retrieve, if existing, the leg-date corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + SecondContentChild_T* getSecondContentChild (const SecondChildKey_T& iKey) const { + SecondContentChild_T* oContentChild_ptr = NULL; + + SecondChildrenMap_T lChildrenMap (getSecondChildrenList()); + const MapKey_T lMapKey = iKey.toString(); + + typename SecondChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + assert (oContentChild_ptr != NULL); + } + + return oContentChild_ptr; + } + + /** Retrieve, if existing, the booking class corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + BookingClass_T* getBookingClass (const BookingClassKey_T& iKey) const { + BookingClass_T* oBookingClass_ptr = NULL; + + BookingClassMap_T lBookingClassMap (getBookingClassHolder()); + const MapKey_T lMapKey = iKey.toString(); + + typename BookingClassMap_T::iterator itBookingClass = + lBookingClassMap.find (lMapKey); + + if (itBookingClass != lBookingClassMap.end()) { + oBookingClass_ptr = itBookingClass->second; + assert (oBookingClass_ptr != NULL); + } + + return oBookingClass_ptr; + } + private: // /////////// Setters ///////////// /** Set the (parent) FlightDate object. */ Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -60,8 +60,14 @@ /** Define the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; - /** Define the children booking class holder type. */ - typedef BomChildrenHolderImp<typename BOM_CONTENT::BookingClassContent_T> BookingClassHolder_T; + /** Define the children booking class type. */ + typedef typename BOM_CONTENT::BookingClassContent_T BookingClass_T; + + /** Define the children booking class holder type. */ + typedef BomChildrenHolderImp<BookingClass_T> BookingClassHolder_T; + + /** Define the map of ContentChild_T. */ + typedef BomMap_T<BookingClass_T> BookingClassMap_T; public: // /////////// Getters ///////////// @@ -93,6 +99,12 @@ ioChildrenList = _childrenList; } + /** Get the holder of booking classes. */ + BookingClassHolder_T& getBookingClassHolder() const { + assert (_bookingClassHolder); + return *_bookingClassHolder; + } + /** Retrieve, if existing, the flight-date corresponding to the given key. <br>If not exissting, return the NULL pointer. */ Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -13,6 +13,7 @@ namespace stdair { // Forward declarations class FacBomContent; + class SegmentCabin; struct LegCabinKey_T; /** Class representing the actual functional/business content for a @@ -31,6 +32,9 @@ /** Definition allowing to retrieve the associated BOM key type. */ typedef LegCabinKey_T BomKey_T; + + /** Definition allowing to retrieve the specific SegmentCabin type. */ + typedef SegmentCabin SegmentCabinContent_T; public: // // ////// Getters from the parent class /////// Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -40,6 +40,9 @@ /** Definition allowing to retrieve the default children bom holder type. */ typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + /** Define the associated segment-cabin holder type. */ + typedef BomChildrenHolderImp<typename BOM_CONTENT::SegmentCabinContent_T> SegmentCabinHolder_T; + public: // /////////// Getters ///////////// /** Get the (parent) LegDateStructure object. */ @@ -66,6 +69,11 @@ /** Default children list setter. */ void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Set the segment-cabin holder. */ + void setSegmentCabinHolder (SegmentCabinHolder_T& ioSegmentCabinHolder) { + _segmentCabinHolder = &ioSegmentCabinHolder; + } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -93,7 +101,8 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - LegCabinStructure () : _parent (NULL), _content (NULL) { } + LegCabinStructure () : _parent (NULL), _content (NULL), + _segmentCabinHolder (NULL) { } LegCabinStructure (const LegCabinStructure&); /** Destructor. */ @@ -106,6 +115,9 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; + + /** Holder of the associated segment-cabins. */ + SegmentCabinHolder_T* _segmentCabinHolder; }; } Modified: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/LegDate.cpp 2009-11-13 08:52:41 UTC (rev 64) @@ -21,16 +21,16 @@ 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; @@ -43,25 +43,30 @@ return oStr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string LegDate::describeKey() const { return _legDateStructure.describeKey(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string LegDate::describeShortKey() const { return _legDateStructure.describeShortKey(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// LegCabinList_T LegDate::getLegCabinList () const { return _legDateStructure.getChildrenList(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// LegCabinMap_T LegDate::getLegCabinMap () const { return _legDateStructure.getChildrenList(); } + + // //////////////////////////////////////////////////////////////////// + LegCabin* LegDate::getLegCabin (const LegCabinKey_T& iKey) const { + return _legDateStructure.getContentChild (iKey); + } } Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -15,6 +15,7 @@ // Forward declarations class FacBomContent; struct LegDateKey_T; + struct LegCabinKey_T; /** Class representing the actual functional/business content for a leg-date. */ @@ -36,25 +37,28 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef LegCabin ContentChild_T; + + /** Definition allowing to retrieve the specific SegmentDate type. */ + typedef SegmentDate SegmentDateContent_T; public: // /////////// Getters //////////// -// /** Get the airline code (from the parent class). */ -// const AirlineCode_T& getAirlineCode() const; - -// /** Get the flight number (from the parent class). */ -// const FlightNumber_T& getFlightNumber() const; - -// /** Get the flight-date (from the parent class). */ -// const Date_T& getFlightDateDate() const; - -// /** Retrieve, if existing, the LegCabin corresponding to the -// given cabin code (LegCabin key). -// <br>If not existing, return the NULL pointer. */ -// LegCabin* getLegCabin (const CabinCode_T& iCabinCode) const; + // /** Get the airline code (from the parent class). */ + // const AirlineCode_T& getAirlineCode() const; - // // ///////// Counting methods ////////// -// /** Update the counters of booked seats. */ + // /** Get the flight number (from the parent class). */ + // const FlightNumber_T& getFlightNumber() const; + + // /** Get the flight-date (from the parent class). */ + // const Date_T& getFlightDateDate() const; + + /** Retrieve, if existing, the LegCabin corresponding to the + given LegCabin key. + <br>If not existing, return the NULL pointer. */ + LegCabin* getLegCabin (const LegCabinKey_T&) const; + + // // ///////// Counting methods ////////// + // /** Update the counters of booked seats. */ // void updateBookingsAndSeatCounters(); // /** Update the values of commited spaces. */ Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -10,8 +10,12 @@ #include <stdair/bom/BomStructureDummy.hpp> #include <stdair/bom/BomContentDummy.hpp> #include <stdair/bom/LegCabinStructure.hpp> +#include <stdair/bom/LegCabinKey.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific LegDate class (for instance, in the AIRSCHED library). */ @@ -36,6 +40,12 @@ /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + /** Definition allowing to retrieve the child key type. */ + typedef LegCabinKey_T ChildKey_T; + + /** Define the map of ContentChild_T. */ + typedef BomMap_T<ContentChild_T> ChildrenMap_T; /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <LegCabinStructure<ContentChild_T>, @@ -47,6 +57,9 @@ /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + /** Define the associated segment-date holder type.*/ + typedef BomChildrenHolderImp<typename BOM_CONTENT::SegmentDateContent_T> SegmentDateHolder_T; + public: // /////////// Getters ///////////// /** Get the (parent) FlightDateStructure object. */ @@ -72,6 +85,26 @@ void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _childrenList; } + + /** Retrieve, if existing, the leg-cabin corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + ContentChild_T* getContentChild (const ChildKey_T& iKey) const { + ContentChild_T* oContentChild_ptr = NULL; + + ChildrenMap_T lChildrenMap (getChildrenList()); + const MapKey_T lMapKey = iKey.toString(); + + typename ChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + assert (oContentChild_ptr != NULL); + } + + return oContentChild_ptr; + } private: // /////////// Setters ///////////// @@ -87,6 +120,11 @@ void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { _childrenList = &ioChildrenList; } + + /** Set the segment-date holder. */ + void setSegmentDateHolder (SegmentDateHolder_T& ioSegmentDateHolder) { + _segmentDateHolder = &ioSegmentDateHolder; + } public: // /////////// Display support methods ///////// @@ -116,7 +154,7 @@ layer. */ /** Default constructors. */ LegDateStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL) { } + _childrenList (NULL), _segmentDateHolder (NULL) { } LegDateStructure (const LegDateStructure&); /** Destructor. */ @@ -132,6 +170,9 @@ /** List of leg-cabins. */ ChildrenBomHolder_T* _childrenList; + + /** Holder of associated segment-dates. */ + SegmentDateHolder_T* _segmentDateHolder; }; } Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -14,6 +14,7 @@ namespace stdair { // Forward declarations class FacBomContent; + class LegCabin; struct SegmentCabinKey_T; /** Class representing the actual functional/business content for a @@ -36,6 +37,9 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef BookingClass ContentChild_T; + + /** Definition allowing to retrieve the specific LegCabin type. */ + typedef LegCabin LegCabinContent_T; public: // /////////// Getters ///////////// Modified: trunk/stdair/stdair/bom/SegmentCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -47,6 +47,9 @@ /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + /** Define the associated leg-cabin holder type. */ + typedef BomChildrenHolderImp<typename BOM_CONTENT::LegCabinContent_T> LegCabinHolder_T; + public: // /////////// Getters ///////////// /** Get the (parent) SegmentDateStructure object. */ @@ -55,7 +58,10 @@ } /** Get the (parent) SegmentDateStructure object. */ - ParentBomStructure_T& getSegmentDateStructure() const; + ParentBomStructure_T& getSegmentDateStructure() const { + assert (_parent != NULL); + return *_parent; + } /** Get the segment-date key. */ const BomKey_T& getKey() const { @@ -87,6 +93,11 @@ void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { _childrenList = &ioChildrenList; } + + /** Set the leg-cabin holder. */ + void setLegCabinHolder (LegCabinHolder_T& ioLegCabinHolder) { + _legCabinHolder = &ioLegCabinHolder; + } public: // /////////// Display support methods ///////// @@ -116,7 +127,7 @@ layer. */ /** Default constructors. */ SegmentCabinStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL) { } + _childrenList (NULL), _legCabinHolder (NULL) { } SegmentCabinStructure (const SegmentCabinStructure&); /** Destructor. */ @@ -132,6 +143,9 @@ /** List of segment-cabins. */ ChildrenBomHolder_T* _childrenList; + + /** Holder of associated leg-cabins. */ + LegCabinHolder_T* _legCabinHolder; }; } Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2009-11-13 08:52:41 UTC (rev 64) @@ -7,6 +7,7 @@ #include <stdair/bom/SegmentDateStructure.hpp> #include <stdair/bom/SegmentDate.hpp> #include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/LegDate.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> @@ -63,6 +64,11 @@ SegmentCabinMap_T SegmentDate::getSegmentCabinMap () const { return _segmentDateStructure.getChildrenList(); } + + // ////////////////////////////////////////////////////////////////////// + LegDateList_T SegmentDate::getLegDateList () const { + return _segmentDateStructure.getLegDateHolder(); + } // ///////// /////////////////////////////////////////////////////////////// // bool SegmentDate:: Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -8,6 +8,7 @@ #include <stdair/bom/FlightDate.hpp> #include <stdair/bom/SegmentDateStructure.hpp> #include <stdair/bom/SegmentDateTypes.hpp> +#include <stdair/bom/LegDateTypes.hpp> #include <stdair/bom/SegmentCabinTypes.hpp> #include <stdair/bom/SegmentDateContent.hpp> @@ -36,6 +37,9 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef SegmentCabin ContentChild_T; + + /** Definition allowing to retrieve the specific LegDate type. */ + typedef LegDate LegDateContent_T; public: // /////////// Getters ///////////// @@ -45,6 +49,9 @@ /** Get a SegmentCabinMap_T for iteration methods. */ SegmentCabinMap_T getSegmentCabinMap () const; + /** Get a LegDateList_T for iteration methods. */ + LegDateList_T getLegDateList () const; + // /** Get the airline code (from the parent class). */ // const AirlineCode_T& getAirlineCode() const; Modified: trunk/stdair/stdair/bom/SegmentDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -47,6 +47,9 @@ /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + /** Define the associated leg-date holder type. */ + typedef BomChildrenHolderImp<typename BOM_CONTENT::LegDateContent_T> LegDateHolder_T; + public: // /////////// Getters ///////////// /** Get the (parent) FlightDateStructure object. */ @@ -55,7 +58,10 @@ } /** Get the (parent) FlightDateStructure object. */ - ParentBomStructure_T& getFlightDateStructure() const; + ParentBomStructure_T& getFlightDateStructure() const { + assert (_parent != NULL); + return *_parent; + } /** Get the segment-date key. */ const BomKey_T& getKey() const { @@ -65,9 +71,16 @@ /** Get the list of segment-cabins. */ const ChildrenBomHolder_T& getChildrenList() const { + assert (_childrenList != NULL); return *_childrenList; } + /** Get the list of leg-dates. */ + const LegDateHolder_T& getLegDateHolder() const { + assert (_legDateHolder != NULL); + return *_legDateHolder; + } + /** Get the list of segment-cabins. */ void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { ioChildrenList = _childrenList; @@ -87,6 +100,11 @@ void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { _childrenList = &ioChildrenList; } + + /** Set the leg-date holder.*/ + void setLegDateHolder (LegDateHolder_T& ioLegDateHolder) { + _legDateHolder = &ioLegDateHolder; + } public: // /////////// Display support methods ///////// @@ -116,7 +134,7 @@ layer. */ /** Default constructors. */ SegmentDateStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL) { } + _childrenList (NULL), _legDateHolder (NULL) { } SegmentDateStructure (const SegmentDateStructure&); /** Destructor. */ @@ -132,6 +150,9 @@ /** List of segment-cabins. */ ChildrenBomHolder_T* _childrenList; + + /** Holder of associated leg-dates. */ + LegDateHolder_T* _legDateHolder; }; } Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -10,6 +10,7 @@ #include <boost/mpl/vector.hpp> // STDAIR #include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/BasConst_Inventory.hpp> #include <stdair/bom/BomStructure.hpp> #include <stdair/factory/FacBomStructure.hpp> @@ -137,7 +138,7 @@ private: /** Create a holder of all booking classes within the given inventory. */ template <typename INVENTORY> - static void createDirectAccessesWithinInventory (INVENTORY& ioInventory){ + static void createDirectAccessesWithinInventory(const INVENTORY& iInventory){ // Retrieve the flight-date type. typedef typename INVENTORY::ContentChild_T FLIGHT_DATE_T; // Define the list of flight-dates. @@ -150,12 +151,12 @@ // Initialize the booking class holder within the inventory. BOOKING_CLASS_HOLDER_T& lBookingClassHolder = FacBomStructure::instance().createBomHolder<BOOKING_CLASS_T> (); - ioInventory._inventoryStructure.setBookingClassHolder(lBookingClassHolder); + iInventory._inventoryStructure.setBookingClassHolder(lBookingClassHolder); // Browse the inventory and build direct accesses within each // flight-date, then build the booking class holder within the // inventory. - const FLIGHT_DATE_LIST_T lFlightDateList = ioInventory.getFlightDateList(); + const FLIGHT_DATE_LIST_T lFlightDateList = iInventory.getFlightDateList(); for (typename FLIGHT_DATE_LIST_T::iterator itFlightDate = lFlightDateList.begin(); itFlightDate != lFlightDateList.end(); ++itFlightDate) { @@ -167,27 +168,251 @@ /** Create the direct acceeses within the given flight-date, and, at the same time, build the class holder for the parent inventory. */ template <typename FLIGHT_DATE> - static void createDirectAccessesWithinFlightDate (const FLIGHT_DATE& ioFlightDate) { + static void createDirectAccessesWithinFlightDate (const FLIGHT_DATE& iFlightDate) { // Retrieve the booking class type. typedef typename FLIGHT_DATE::BookingClassContent_T BOOKING_CLASS_T; // Define the bom holder of booking classes. typedef BomChildrenHolderImp<BOOKING_CLASS_T> BOOKING_CLASS_HOLDER_T; - - typename FLIGHT_DATE::BomStructure_T::ParentBomStructure_T& lInvStructure = - ioFlightDate._flightDateStructure.getInventoryStructure(); - - BOOKING_CLASS_HOLDER_T* lInvBookingClassHolder_ptr = - lInvStructure._bookingClassHolder; - assert (lInvBookingClassHolder_ptr != NULL); - + + // Initialize the booking class holder within the flight-date. + BOOKING_CLASS_HOLDER_T& lBookingClassHolder = + FacBomStructure::instance().createBomHolder<BOOKING_CLASS_T> (); + iFlightDate._flightDateStructure.setBookingClassHolder(lBookingClassHolder); + // Retrieve the leg-date type. + typedef typename FLIGHT_DATE::SecondContentChild_T LEG_DATE_T; + // Define the holder of leg-dates. + typedef BomChildrenHolderImp<LEG_DATE_T> LEG_DATE_HOLDER_T; + // Retrieve the leg-date key type. + typedef typename LEG_DATE_T::BomKey_T LEG_DATE_KEY_T; // Retrieve the segment-date type. typedef typename FLIGHT_DATE::ContentChild_T SEGMENT_DATE_T; // Define the list of segment-dates. typedef BomList_T<SEGMENT_DATE_T> SEGMENT_DATE_LIST_T; + SEGMENT_DATE_LIST_T lSegmentDateList = iFlightDate.getSegmentDateList(); + for (typename SEGMENT_DATE_LIST_T::iterator itSegmentDate = + lSegmentDateList.begin(); + itSegmentDate != lSegmentDateList.end(); ++itSegmentDate) { + SEGMENT_DATE_T& lCurrentSegmentDate = *itSegmentDate; - + // Initialize the leg-date holder within the segment-date. + LEG_DATE_HOLDER_T& lLegDateHolder = + FacBomStructure::instance().createBomHolder<LEG_DATE_T> (); + lCurrentSegmentDate._segmentDateStructure.setLegDateHolder(lLegDateHolder); + + const AirportCode_T& lBoardPoint = + lCurrentSegmentDate.getBoardPoint(); + AirportCode_T currentBoardPoint = lBoardPoint; + const AirportCode_T& lOffPoint = lCurrentSegmentDate.getOffPoint(); + AirportCode_T currentOffPoint = lBoardPoint; + + // Add a sanity check so as to ensure that the loop stops. If + // there are more than MAXIMUM_NUMBER_OF_LEGS legs, there is + // an issue somewhere in the code (not in the parser, as the + // segments are derived from the legs thanks to the + // FlightPeriodStruct::buildSegments() method). + unsigned short i = 1; + while (currentOffPoint != lOffPoint + && i <= MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT) { + // Retrieve the (unique) LegDate getting that Board Point + const LEG_DATE_KEY_T lLegDateKey (currentOffPoint); + LEG_DATE_T* lLegDate_ptr = iFlightDate.getLegDate (lLegDateKey); + assert (lLegDate_ptr != NULL); + + // Link the SegmentDate and LegDate together + initLinkSegmentDateWithLegDate<SEGMENT_DATE_T> (lCurrentSegmentDate, *lLegDate_ptr); + + // Prepare the next iteration + currentBoardPoint = lLegDate_ptr->getOffPoint(); + currentOffPoint = lLegDate_ptr->getOffPoint(); + ++i; + } + assert (i <= MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT); + + // Create the routing for the leg- and segment-cabins. + // At the same time, set the SegmentDate attributes derived from + // its routing legs (e.g., board and off dates). + createDirectAccessesWithinSegmentDate (lCurrentSegmentDate); + } } + + /** Create the direct acceeses within the given segment-date, and, at the + same time, build the class holder for the corresponding flight-date + and inventory. */ + template <typename SEGMENT_DATE> + static void createDirectAccessesWithinSegmentDate (const SEGMENT_DATE& iSegmentDate) { + // Retrieve the segment-cabin type. + typedef typename SEGMENT_DATE::ContentChild_T SEGMENT_CABIN_T; + // Define the list of sement-cabin. + typedef BomList_T<SEGMENT_CABIN_T> SEGMENT_CABIN_LIST_T; + // Retrieve the leg-date type. + typedef typename SEGMENT_DATE::LegDateContent_T LEG_DATE_T; + // Define the list of leg-date. + typedef BomList_T<LEG_DATE_T> LEG_DATE_LIST_T; + // Retrieve the leg-cabin type. + typedef typename LEG_DATE_T::ContentChild_T LEG_CABIN_T; + // Define the leg-cabin holder. + typedef BomChildrenHolderImp<LEG_CABIN_T> LEG_CABIN_HOLDER_T; + // Retrieve the type of leg-cabin key. + typedef typename LEG_CABIN_T::BomKey_T LEG_CABIN_KEY_T; + + // Browse the segment-cabin list. + const SEGMENT_CABIN_LIST_T lSegmentCabinList = + iSegmentDate.getSegmentCabinList(); + for (typename SEGMENT_CABIN_LIST_T::iterator itSegmentCabin = + lSegmentCabinList.begin(); + itSegmentCabin != lSegmentCabinList.end(); ++itSegmentCabin) { + SEGMENT_CABIN_T& lSegmentCabin = *itSegmentCabin; + + // Initialize the leg-cabin holder for the current segment-cabin. + LEG_CABIN_HOLDER_T& lLegCabinHolder = FacBomStructure:: + instance().createBomHolder<LEG_CABIN_T> (); + lSegmentCabin._segmentCabinStructure.setLegCabinHolder (lLegCabinHolder); + + // Iterate on the routing legs + const LEG_DATE_LIST_T& lLegDateList = iSegmentDate.getLegDateList(); + for (typename LEG_DATE_LIST_T::iterator itLegDate = + lLegDateList.begin(); + itLegDate != lLegDateList.end(); ++itLegDate) { + const LEG_DATE_T& lLegDate = *itLegDate; + + // Retrieve the LegCabin getting the same class of service + // (cabin code) as the SegmentCabin. + const CabinCode_T& lCabinCode = lSegmentCabin.getCabinCode(); + const LEG_CABIN_KEY_T lLegCabinKey (lCabinCode); + + LEG_CABIN_T* lLegCabin_ptr = lLegDate.getLegCabin (lLegCabinKey); + + // In fact, the following assertion corresponds to the assumption + // that the cabins are the same on the segments AND on their routing + // legs. For some actual airline, that is not always true. If needed, + // we may implement the cabin mapping feature. + /* + if (lLegCabin_ptr == NULL) { + STDAIR_LOG_ERROR ("The cabin of the Segment: " + << lSegmentCabin._key.describe() + << " can not be found on the routing Legs." + << " The mapping of Segment-Cabins onto " + << "distinct Leg-Cabins is a feature not " + << "supported by LATUS."); + } + */ + assert (lLegCabin_ptr != NULL); + + // Link the SegmentCabin and LegCabin together + initLinkSegmentCabinWithLegCabin<SEGMENT_CABIN_T> (lSegmentCabin, *lLegCabin_ptr); + + // Build the class holders for the corresponding flight-date and + // inventory. + buildBookingClassHolders (lSegmentCabin); + } + } + } + + /** Build the booking class holders of the corresponding inventory + and flight-date of the given segment-cabin. */ + template <typename SEGMENT_CABIN> + static void buildBookingClassHolders (const SEGMENT_CABIN& iSegmentCabin) { + // Retrieve the flight-date structure type. + typedef typename SEGMENT_CABIN::Parent_T::Parent_T::BomStructure_T FLIGHT_DATE_STRUCTURE_T; + // Retrieve the booking class type. + typedef typename SEGMENT_CABIN::ContentChild_T BOOKING_CLASS_T; + + FLIGHT_DATE_STRUCTURE_T& lFDStructure = + iSegmentCabin._segmentCabinStructure.getSegmentDateStructure(). + getFlightDateStructure(); + + // Define the holder of booking classes. + typedef BomChildrenHolderImp<BOOKING_CLASS_T> BOOKING_CLASS_HOLDER_T; + + // Retrieve the booking class holders of the flight-date and the + // inventory. + BOOKING_CLASS_HOLDER_T& lFDBookingClassHolder = + lFDStructure.getBookingClassHolder(); + BOOKING_CLASS_HOLDER_T& lInvBookingClassHolder = + lFDStructure.getInventoryStructure().getBookingClassHolder(); + + // Define the list of booking classes. + typedef BomList_T<BOOKING_CLASS_T> BOOKING_CLASS_LIST_T; + BOOKING_CLASS_LIST_T lBookingClassList=iSegmentCabin.getBookingClassList(); + for (typename BOOKING_CLASS_LIST_T::iterator itBookingClass = + lBookingClassList.begin(); + itBookingClass != lBookingClassList.end(); ++itBookingClass) { + BOOKING_CLASS_T& lBookingClass = *itBookingClass; + + // bool addingSucceeded = FacBomStructure:: +// addFullBomObjecdToBomHolder<BOOKING_CLASS_T> (lFDBookingClassHolder, +// lBookingClass); +// assert (addingSucceeded == true); +// addingSucceeded = FacBomStructure:: +// addFullBomObjecdToBomHolder<BOOKING_CLASS_T> (lInvBookingClassHolder, +// lBookingClass); +// assert (addingSucceeded == true); + } + } + /** Build the link between the given segment-date and the given leg-date. */ + template <typename SEGMENT_DATE> + static void initLinkSegmentDateWithLegDate (SEGMENT_DATE& ioSegmentDate, + typename SEGMENT_DATE::LegDateContent_T& ioLegDate) { + // Retrieve the leg-date type. + typedef typename SEGMENT_DATE::LegDateContent_T LEG_DATE_T; + // Define the segment-date holder type. + typedef BomChildrenHolderImp<SEGMENT_DATE> SEGMENT_DATE_HOLDER_T; + // Define the leg-date holder type. + typedef BomChildrenHolderImp<LEG_DATE_T> LEG_DATE_HOLDER_T; + + LEG_DATE_HOLDER_T* lLegDateHolder_ptr = + ioSegmentDate._segmentDateStructure._legDateHolder; + assert (lLegDateHolder_ptr != NULL); + + // bool addingSucceeded = FacBomStructure:: +// addBomObjecdToBomHolder<LEG_DATE_T> (*lLegDateHolder_ptr, ioLegDate); +// assert (addingSucceeded == true); + + SEGMENT_DATE_HOLDER_T* lSegmentDateHolder_ptr = + ioLegDate._legDateStructure._segmentDateHolder; + if (lSegmentDateHolder_ptr == NULL) { + lSegmentDateHolder_ptr = &FacBomStructure:: + instance().createBomHolder<SEGMENT_DATE> (); + } + // addingSucceeded = FacBomStructure:: +// addBomObjecdToBomHolder<SEGMENT_DATE> (*lSegmentDateHolder_ptr, +// ioSegmentDate); +// assert (addingSucceeded == true); + } + + /** Build the link between the given segment-cabin and the given + leg-cabin. */ + template <typename SEGMENT_CABIN> + static void initLinkSegmentCabinWithLegCabin (SEGMENT_CABIN& ioSegmentCabin, + typename SEGMENT_CABIN::LegCabinContent_T& ioLegCabin) { + // Retrieve the leg-cabin type. + typedef typename SEGMENT_CABIN::LegCabinContent_T LEG_CABIN_T; + // Define the segment-cabin holder type. + typedef BomChildrenHolderImp<SEGMENT_CABIN> SEGMENT_CABIN_HOLDER_T; + // Define the leg-cabin holder type. + typedef BomChildrenHolderImp<LEG_CABIN_T> LEG_CABIN_HOLDER_T; + + LEG_CABIN_HOLDER_T* lLegCabinHolder_ptr = + ioSegmentCabin._segmentCabinStructure._legCabinHolder; + assert (lLegCabinHolder_ptr != NULL); + + // bool addingSucceeded = FacBomStructure:: +// addBomObjecdToBomHolder<LEG_CABIN_T>(*lLegCabinHolder_ptr, ioLegCabin); +// assert (addingSucceeded == true); + + SEGMENT_CABIN_HOLDER_T* lSegmentCabinHolder_ptr = + ioLegCabin._legCabinStructure._segmentCabinHolder; + if (lSegmentCabinHolder_ptr == NULL) { + lSegmentCabinHolder_ptr = &FacBomStructure:: + instance().createBomHolder<SEGMENT_CABIN> (); + } + // addingSucceeded = FacBomStructure:: +// addBomObjecdToBomHolder<SEGMENT_CABIN> (*lSegmentCabinHolder_ptr, +// ioSegmentCabin); +// assert (addingSucceeded == true); + } + public: /** Provide the unique instance. <br>The singleton is instantiated when first used. Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-11-12 18:11:55 UTC (rev 63) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) @@ -127,7 +127,7 @@ /** Add a BOM object into a dedicated BOM holder by using the full key of the object. */ template <typename BOM_CONTENT> - static bool addFullBomObjecdToBomHolder (BomChildrenHolderImp<BOM_CONTENT> ioBomHolder, typename BOM_CONTENT::BomStructure_T& ioBomStructure) { + static bool addFullBomObjecdToBomHolder (BomChildrenHolderImp<BOM_CONTENT>& ioBomHolder, typename BOM_CONTENT::BomStructure_T& ioBomStructure) { // Retrieve the bom structure type. typedef typename BOM_CONTENT::BomStructure_T BOM_STRUCTURE_T; // Define the bom holder type. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2009-11-16 15:53:31
|
Revision: 65 http://stdair.svn.sourceforge.net/stdair/?rev=65&view=rev Author: quannaus Date: 2009-11-16 15:53:21 +0000 (Mon, 16 Nov 2009) Log Message: ----------- [Dev] Build the routing. Modified Paths: -------------- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRootStructure.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Added Paths: ----------- trunk/stdair/stdair/bom/BomStopContent.hpp trunk/stdair/stdair/bom/BomStopStructure.hpp Removed Paths: ------------- trunk/stdair/stdair/bom/BomContentDummy.hpp trunk/stdair/stdair/bom/BomStructureDummy.hpp Modified: trunk/stdair/stdair/bom/AirlineFeatureSet.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -48,12 +48,12 @@ // ////////////////////////////////////////////////////////////////////// AirlineFeatureList_T AirlineFeatureSet::getAirlineFeatureList () const { - return _bomStructure.getChildrenList(); + return _bomStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// AirlineFeatureMap_T AirlineFeatureSet::getAirlineFeatureMap () const { - return _bomStructure.getChildrenList(); + return _bomStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -9,8 +9,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/AirlineFeatureStructure.hpp> #include <stdair/bom/AirlineFeatureKey.hpp> @@ -48,10 +48,10 @@ typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<AirlineFeatureStructure<ContentChild_T>, BomStructureDummy> ChildrenBomTypeList_T; + typedef boost::mpl::vector<AirlineFeatureStructure<ContentChild_T>, BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrive the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; @@ -64,15 +64,15 @@ return _content->getKey (); } - /** Get the list of airline features. */ - const ChildrenBomHolder_T& getChildrenList() const { - assert (_childrenList != NULL); - return *_childrenList; + /** Get the holder of airline features. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + assert (_childrenHolder != NULL); + return *_childrenHolder; } - /** Get the list of airline features. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of airline features. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } /** Retrieve, if existing, the airline feature corresponding to the @@ -81,7 +81,7 @@ ContentChild_T* getContentChild (const ChildKey_T& iKey) const { ContentChild_T* oContentChild_ptr = NULL; - ChildrenMap_T lChildrenMap (getChildrenList()); + ChildrenMap_T lChildrenMap (getChildrenHolder()); const MapKey_T lMapKey = iKey.toString(); typename ChildrenMap_T::iterator itContentChild = @@ -97,12 +97,12 @@ private: /////////////// Setters //////////////// - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } public: @@ -132,7 +132,7 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - AirlineFeatureSetStructure () : _content (NULL), _childrenList (NULL) { }; + AirlineFeatureSetStructure () : _content (NULL), _childrenHolder (NULL) { }; AirlineFeatureSetStructure (const AirlineFeatureSetStructure&); /** Destructor. */ @@ -143,8 +143,8 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of inventories. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of inventories. */ + ChildrenBomHolder_T* _childrenHolder; }; } Modified: trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,8 +7,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> namespace stdair { /** Wrapper class aimed at holding the actual content, modeled @@ -33,11 +33,11 @@ typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector <BomStructureDummy, - BomStructureDummy> ChildrenBomTypeList_T; + typedef boost::mpl::vector <BomStopStructure, + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; public: // /////////// Getters ///////////// @@ -62,8 +62,8 @@ _parent = &ioAirlineFeatureSetStructure; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } public: // /////////// Display support methods ///////// Modified: trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp =================================================================== --- trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -27,18 +27,18 @@ public: /** Define lists of children BOM structures. */ - typedef std::vector<BomStructure_T*> BomChildrenOrderedList_T; - typedef std::map<const std::string, BomStructure_T*> BomChildrenList_T; + typedef std::vector<BomStructure_T*> BomChildrenList_T; + typedef std::map<const std::string, BomStructure_T*> BomChildrenMap_T; /** Define the different types of iterators. */ typedef BomIterator_T<BOM_CONTENT_CHILD, - typename BomChildrenOrderedList_T::const_iterator> ListIterator_T; + typename BomChildrenList_T::const_iterator> ListIterator_T; typedef BomIterator_T<BOM_CONTENT_CHILD, - typename BomChildrenOrderedList_T::const_reverse_iterator> ListReverseIterator_T; + typename BomChildrenList_T::const_reverse_iterator> ListReverseIterator_T; typedef BomIterator_T<BOM_CONTENT_CHILD, - typename BomChildrenList_T::const_iterator> MapIterator_T; + typename BomChildrenMap_T::const_iterator> MapIterator_T; typedef BomIterator_T<BOM_CONTENT_CHILD, - typename BomChildrenList_T::const_reverse_iterator> MapReverseIterator_T; + typename BomChildrenMap_T::const_reverse_iterator> MapReverseIterator_T; public: // /////////// Display support methods ///////// @@ -65,61 +65,61 @@ /** Initialise the internal iterators on bom objects: return the iterator at the begining of the list. */ ListIterator_T listBegin () const { - return ListIterator_T(_bomChildrenOrderedList.begin()); + return ListIterator_T(_bomChildrenList.begin()); } /** Initialise the internal iterators on bom objects: return the iterator past the end of the list. */ ListIterator_T listEnd () const { - return _bomChildrenOrderedList.end(); + return _bomChildrenList.end(); } /** Initialise the internal reverse iterators on bom objects: return the reverse iterator at the rbegining of the list. */ ListReverseIterator_T listRBegin () const { - return _bomChildrenOrderedList.rbegin(); + return _bomChildrenList.rbegin(); } /** Initialise the internal reverse iterators on bom objects: return the reverse iterator past the rend of the list. */ ListReverseIterator_T listREnd () const { - return _bomChildrenOrderedList.rend(); + return _bomChildrenList.rend(); } /** Initialise the internal iterators on bom objects: return the iterator at the begining of the map. */ MapIterator_T mapBegin () const { - return _bomChildrenList.begin(); + return _bomChildrenMap.begin(); } /** Initialise the internal iterators on bom objects: return the iterator past the end of the map. */ MapIterator_T mapEnd () const { - return _bomChildrenList.end(); + return _bomChildrenMap.end(); } /** Initialise the internal reverse iterators on bom objects: return the reverse iterator at the rbegining of the map. */ MapReverseIterator_T mapRBegin () const { - return _bomChildrenList.rbegin(); + return _bomChildrenMap.rbegin(); } /** Initialise the internal reverse iterators on bom objects: return the reverse iterator past the rend of the map. */ MapReverseIterator_T mapREnd () const { - return _bomChildrenList.rend(); + return _bomChildrenMap.rend(); } // /////////// Other operators ///////////// /** Get the size of the list. */ const unsigned int size () const { - return _bomChildrenOrderedList.size(); + return _bomChildrenList.size(); } /** Retrieve, if existing, the bom corresponding to the given key. */ MapIterator_T find (const MapKey_T& iKey) const { - return _bomChildrenList.find (iKey); + return _bomChildrenMap.find (iKey); } private: @@ -135,10 +135,10 @@ private: ///////////// Attributes ////////////// /** List of children BOM structures. */ - BomChildrenList_T _bomChildrenList; + BomChildrenMap_T _bomChildrenMap; /** Map of children BOM structures with their key. */ - BomChildrenOrderedList_T _bomChildrenOrderedList; + BomChildrenList_T _bomChildrenList; }; } Deleted: trunk/stdair/stdair/bom/BomContentDummy.hpp =================================================================== --- trunk/stdair/stdair/bom/BomContentDummy.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BomContentDummy.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -1,70 +0,0 @@ -#ifndef __STDAIR_BOM_BOMCONTENTDUMMY_HPP -#define __STDAIR_BOM_BOMCONTENTDUMMY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomContent.hpp> - -namespace stdair { - // Forward declarations. - class BomStructureDummy; - class BomKey; - - /** Class representing the actual functional/business content - for the Bom dummy. - <br>That class is just an utility tool to mark the dummy - of the Bom tree. */ - class BomContentDummy : public BomContent { - friend class FacBomContent; - - public: - // Type definitions - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BomStructureDummy BomStructure_T; - - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BomKey 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 { ioOut << toString(); } - - /** 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 { return describeKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return std::string (""); } - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return std::string (""); } - - private: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Default constructors. */ - BomContentDummy (); - BomContentDummy (const BomContentDummy&); - BomContentDummy (const BomStructure_T& iBomStructure) - : _bomStructure (iBomStructure) { } - - /** Destructor. */ - virtual ~BomContentDummy() { } - - private: - // Attributes - /** Reference structure. */ - const BomStructure_T& _bomStructure; - }; - -} -#endif // __STDAIR_BOM_BOMCONTENTDUMMY_HPP Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -23,12 +23,12 @@ // //////////////////////////////////////////////////////////////////// InventoryList_T BomRoot::getInventoryList () const { - return _bomRootStructure.getChildrenList(); + return _bomRootStructure.getChildrenHolder(); } // //////////////////////////////////////////////////////////////////// InventoryMap_T BomRoot::getInventoryMap () const { - return _bomRootStructure.getChildrenList(); + return _bomRootStructure.getChildrenHolder(); } Inventory* BomRoot::getInventory (const AirlineCode_T& iAirlineCode) const { Modified: trunk/stdair/stdair/bom/BomRootStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BomRootStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -9,8 +9,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/InventoryStructure.hpp> namespace stdair { @@ -37,10 +37,10 @@ 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; + typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrive the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; @@ -53,25 +53,25 @@ return _content->getKey (); } - /** Get the list of inventories. */ - const ChildrenBomHolder_T& getChildrenList() const { - assert (_childrenList != NULL); - return *_childrenList; + /** Get the holder of inventories. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + assert (_childrenHolder != NULL); + return *_childrenHolder; } - /** Get the list of inventories. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of inventories. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } private: /////////////// Setters //////////////// - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } public: @@ -101,7 +101,7 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - BomRootStructure () : _content (NULL), _childrenList (NULL) { }; + BomRootStructure () : _content (NULL), _childrenHolder (NULL) { }; BomRootStructure (const BomRootStructure&); /** Destructor. */ @@ -112,8 +112,8 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of inventories. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of inventories. */ + ChildrenBomHolder_T* _childrenHolder; }; } Copied: trunk/stdair/stdair/bom/BomStopContent.hpp (from rev 63, trunk/stdair/stdair/bom/BomContentDummy.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomStopContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomStopContent.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -0,0 +1,70 @@ +#ifndef __STDAIR_BOM_BOMSTOPCONTENT_HPP +#define __STDAIR_BOM_BOMSTOPCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> + +namespace stdair { + // Forward declarations. + class BomStopStructure; + class BomKey; + + /** Class representing the actual functional/business content + for the Bom stop. + <br>That class is just an utility tool to mark the stop + of the Bom tree. */ + class BomStopContent : public BomContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BomStopStructure BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BomKey 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 { ioOut << toString(); } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return std::string (""); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return std::string (""); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BomStopContent (); + BomStopContent (const BomStopContent&); + BomStopContent (const BomStructure_T& iBomStructure) + : _bomStructure (iBomStructure) { } + + /** Destructor. */ + virtual ~BomStopContent() { } + + private: + // Attributes + /** Reference structure. */ + const BomStructure_T& _bomStructure; + }; + +} +#endif // __STDAIR_BOM_BOMSTOPCONTENT_HPP Copied: trunk/stdair/stdair/bom/BomStopStructure.hpp (from rev 63, trunk/stdair/stdair/bom/BomStructureDummy.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomStopStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomStopStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -0,0 +1,94 @@ +#ifndef __STDAIR_BOM_BOMSTOPSTRUCTURE_HPP +#define __STDAIR_BOM_BOMSTOPSTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/BomChildrenHolderImp.hpp> +// MPL +#include <boost/mpl/vector.hpp> + +namespace stdair { + // Forward declarations. + class BomStopContent; + + /** Wrapper class aimed at holding the actual content, modeled + by a specific BomStopContent class. */ + class BomStopStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + + private: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BomStopContent Content_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector<> ChildrenBomTypeList_T; + + /** Definition allowing to retrive the default children bom holder type. */ + typedef BomChildrenHolderImp<mpl_::void_> DefaultChildrenBomHolder_T; + + public: + + // /////////// Getters ///////////// + /** Get the BomStopStructure key. */ + const BomKey_T& getKey() const { + return _key; + } + + private: + /////////////// Setters //////////////// + /** Default children list setter. */ + void setChildrenList (DefaultChildrenBomHolder_T&) { } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BomStopStructure (); + BomStopStructure (const BomStopStructure&); + BomStopStructure (const BomKey_T& iKey) { _key = iKey; } + + /** Destructor. */ + ~BomStopStructure () { } + + private: + // Attributes + /** The key of both the structure and content objects. */ + BomKey_T _key; + + /** The actual functional (Business Object) content. */ + Content_T* _content; + }; + +} +#endif // __STDAIR_BOM_BOMSTOPSTRUCTURE_HPP + Deleted: trunk/stdair/stdair/bom/BomStructureDummy.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BomStructureDummy.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -1,94 +0,0 @@ -#ifndef __STDAIR_BOM_BOMSTRUCTUREDUMMY_HPP -#define __STDAIR_BOM_BOMSTRUCTUREDUMMY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomStructure.hpp> -#include <stdair/bom/BomKey.hpp> -#include <stdair/bom/BomChildrenHolderImp.hpp> -// MPL -#include <boost/mpl/vector.hpp> - -namespace stdair { - // Forward declarations. - class BomContentDummy; - - /** Wrapper class aimed at holding the actual content, modeled - by a specific BomContentDummy class. */ - class BomStructureDummy : public BomStructure { - friend class FacBomStructure; - friend class FacBomContent; - - private: - // Type definitions - /** Definition allowing to retrieve the associated BOM content type. */ - typedef BomContentDummy Content_T; - - /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<> ChildrenBomTypeList_T; - - /** Definition allowing to retrive the default children bom holder type. */ - typedef BomChildrenHolderImp<mpl_::void_> DefaultChildrenBomHolder_T; - - public: - - // /////////// Getters ///////////// - /** Get the BomStructureDummy key. */ - const BomKey_T& getKey() const { - return _key; - } - - private: - /////////////// Setters //////////////// - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << toString() << std::endl; - } - - /** 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 { return describeKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return _key.toString(); } - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } - - - private: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Default constructors. */ - BomStructureDummy (); - BomStructureDummy (const BomStructureDummy&); - BomStructureDummy (const BomKey_T& iKey) { _key = iKey; } - - /** Destructor. */ - ~BomStructureDummy () { } - - private: - // Attributes - /** The key of both the structure and content objects. */ - BomKey_T _key; - - /** The actual functional (Business Object) content. */ - Content_T* _content; - }; - -} -#endif // __STDAIR_BOM_BOMSTRUCTUREDUMMY_HPP - Modified: trunk/stdair/stdair/bom/BookingClassStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/BookingClassStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,8 +7,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> namespace stdair { /** Wrapper class aimed at holding the actual content, modeled @@ -33,11 +33,11 @@ typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector <BomStructureDummy, - BomStructureDummy> ChildrenBomTypeList_T; + typedef boost::mpl::vector <BomStopStructure, + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; public: // /////////// Getters ///////////// @@ -62,8 +62,8 @@ _parent = &ioSegmentCabinStructure; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } public: // /////////// Display support methods ///////// Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -58,22 +58,22 @@ // ////////////////////////////////////////////////////////////////////// SegmentDateList_T FlightDate::getSegmentDateList () const { - return _flightDateStructure.getChildrenList(); + return _flightDateStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// SegmentDateMap_T FlightDate::getSegmentDateMap () const { - return _flightDateStructure.getChildrenList(); + return _flightDateStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// LegDateList_T FlightDate::getLegDateList () const { - return _flightDateStructure.getSecondChildrenList(); + return _flightDateStructure.getSecondChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// LegDateMap_T FlightDate::getLegDateMap () const { - return _flightDateStructure.getSecondChildrenList(); + return _flightDateStructure.getSecondChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/FlightDateStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,8 +7,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/SegmentDateStructure.hpp> #include <stdair/bom/LegDateStructure.hpp> #include <stdair/bom/SegmentDateKey.hpp> @@ -67,7 +67,7 @@ LegDateStructure<SecondContentChild_T> > ChildrenBomTypeList_T; /** Definition allowing to retrive the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; @@ -81,7 +81,7 @@ /** Define the children booking class holder type. */ typedef BomChildrenHolderImp<BookingClass_T> BookingClassHolder_T; - /** Define the map of ContentChild_T. */ + /** Define the map of booking class. */ typedef BomMap_T<BookingClass_T> BookingClassMap_T; public: @@ -103,16 +103,16 @@ return _content->getKey(); } - /** Get the list of segment-dates. */ - const ChildrenBomHolder_T& getChildrenList() const { - assert (_childrenList != NULL); - return *_childrenList; + /** Get the holder of segment-dates. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + assert (_childrenHolder != NULL); + return *_childrenHolder; } - /** Get the list of leg-dates. */ - const SecondChildrenBomHolder_T& getSecondChildrenList() const { - assert (_secondChildrenList != NULL); - return *_secondChildrenList; + /** Get the holder of leg-dates. */ + const SecondChildrenBomHolder_T& getSecondChildrenHolder() const { + assert (_secondChildrenHolder != NULL); + return *_secondChildrenHolder; } /** Get the holder of booking classes. */ @@ -121,14 +121,14 @@ return *_bookingClassHolder; } - /** Get the list of segment-dates. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of segment-dates. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } - /** Get the list of leg-dates. */ - void getChildrenList (SecondChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _secondChildrenList; + /** Get the holder of leg-dates. */ + void getChildrenHolder (SecondChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _secondChildrenHolder; } /** Retrieve, if existing, the segment-date corresponding to the @@ -137,7 +137,7 @@ ContentChild_T* getContentChild (const ChildKey_T& iKey) const { ContentChild_T* oContentChild_ptr = NULL; - ChildrenMap_T lChildrenMap (getChildrenList()); + ChildrenMap_T lChildrenMap (getChildrenHolder()); const MapKey_T lMapKey = iKey.toString(); typename ChildrenMap_T::iterator itContentChild = @@ -157,7 +157,7 @@ SecondContentChild_T* getSecondContentChild (const SecondChildKey_T& iKey) const { SecondContentChild_T* oContentChild_ptr = NULL; - SecondChildrenMap_T lChildrenMap (getSecondChildrenList()); + SecondChildrenMap_T lChildrenMap (getSecondChildrenHolder()); const MapKey_T lMapKey = iKey.toString(); typename SecondChildrenMap_T::iterator itContentChild = @@ -198,20 +198,20 @@ _parent = &ioParent; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the segment-date children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the segment-date children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } - /** Set the leg-date children list. */ - void setChildrenList (SecondChildrenBomHolder_T& ioChildrenList) { - _secondChildrenList = &ioChildrenList; + /** Set the leg-date children holder. */ + void setChildrenHolder (SecondChildrenBomHolder_T& ioChildrenHolder) { + _secondChildrenHolder = &ioChildrenHolder; } - /** Set the booking class list. */ + /** Set the booking class holder. */ void setBookingClassHolder (BookingClassHolder_T& ioBookingClassHolder) { _bookingClassHolder = &ioBookingClassHolder; } @@ -244,7 +244,8 @@ layer. */ /** Default constructors. */ FlightDateStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL), _secondChildrenList (NULL), + _childrenHolder (NULL), + _secondChildrenHolder (NULL), _bookingClassHolder (NULL) { } FlightDateStructure (const FlightDateStructure&); @@ -259,13 +260,13 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of segment-dates. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of segment-dates. */ + ChildrenBomHolder_T* _childrenHolder; - /** List of leg-dates. */ - SecondChildrenBomHolder_T* _secondChildrenList; + /** Holder of leg-dates. */ + SecondChildrenBomHolder_T* _secondChildrenHolder; - /** List of booking classes. */ + /** Holder of booking classes. */ BookingClassHolder_T* _bookingClassHolder; }; Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/Inventory.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,6 +7,7 @@ #include <stdair/bom/InventoryStructure.hpp> #include <stdair/bom/Inventory.hpp> #include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/BookingClass.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> @@ -50,15 +51,25 @@ // ////////////////////////////////////////////////////////////////////// FlightDateList_T Inventory::getFlightDateList () const { - return _inventoryStructure.getChildrenList(); + return _inventoryStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// FlightDateMap_T Inventory::getFlightDateMap () const { - return _inventoryStructure.getChildrenList(); + return _inventoryStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// + BookingClassList_T Inventory::getBookingClassList () const { + return _inventoryStructure.getBookingClassHolder(); + } + + // ////////////////////////////////////////////////////////////////////// + BookingClassMap_T Inventory::getBookingClassMap () const { + return _inventoryStructure.getBookingClassHolder(); + } + + // ////////////////////////////////////////////////////////////////////// FlightDate* Inventory:: getFlightDate (const FlightDateKey_T& iKey) const { return _inventoryStructure.getContentChild (iKey); Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/Inventory.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -9,6 +9,7 @@ #include <stdair/bom/InventoryStructure.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/BookingClassTypes.hpp> #include <stdair/bom/InventoryContent.hpp> namespace stdair { @@ -75,6 +76,12 @@ /** Get a FlightDateMap_T for iteration methods. */ FlightDateMap_T getFlightDateMap () const; + + /** Get a BookingClassList_T for iteration methods. */ + BookingClassList_T getBookingClassList () const; + + /** Get a BookingClassMap_T for iteration methods. */ + BookingClassMap_T getBookingClassMap () const; /** Get the airline feature. */ const AirlineFeature* getAirlineFeature () const { Modified: trunk/stdair/stdair/bom/InventoryStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/InventoryStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -9,8 +9,8 @@ // (Boost) MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/FlightDateStructure.hpp> #include <stdair/bom/FlightDateKey.hpp> @@ -52,10 +52,10 @@ /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector<FlightDateStructure<ContentChild_T>, - BomStructureDummy> ChildrenBomTypeList_T; + BomStopStructure> ChildrenBomTypeList_T; /** Define the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Define the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; @@ -66,7 +66,7 @@ /** Define the children booking class holder type. */ typedef BomChildrenHolderImp<BookingClass_T> BookingClassHolder_T; - /** Define the map of ContentChild_T. */ + /** Define the map of booking class. */ typedef BomMap_T<BookingClass_T> BookingClassMap_T; public: @@ -88,15 +88,15 @@ return _content->getKey (); } - /** Get the list of flight-dates. */ - const ChildrenBomHolder_T& getChildrenList() const { - assert (_childrenList != NULL); - return *_childrenList; + /** Get the holder of flight-dates. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + assert (_childrenHolder != NULL); + return *_childrenHolder; } - /** Get the list of flight-dates. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of flight-dates. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } /** Get the holder of booking classes. */ @@ -111,7 +111,7 @@ ContentChild_T* getContentChild (const ChildKey_T& iKey) const { ContentChild_T* oContentChild_ptr= NULL; - ChildrenMap_T lChildrenMap (getChildrenList()); + ChildrenMap_T lChildrenMap (getChildrenHolder()); const MapKey_T lMapKey = iKey.toString(); typename ChildrenMap_T::iterator itContentChild = @@ -132,15 +132,15 @@ _parent = &ioParent; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } - /** Set the booking class list. */ + /** Set the booking class holder. */ void setBookingClassHolder (BookingClassHolder_T& ioBookingClassHolder) { _bookingClassHolder = &ioBookingClassHolder; } @@ -173,7 +173,8 @@ layer. */ /** Default constructors. */ InventoryStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL), _bookingClassHolder (NULL) { } + _childrenHolder (NULL), + _bookingClassHolder (NULL) { } InventoryStructure (const InventoryStructure&); /** Destructor. */ @@ -187,10 +188,10 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of flight-dates. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of flight-dates. */ + ChildrenBomHolder_T* _childrenHolder; - /** List of booking classes. */ + /** Holder of booking classes. */ BookingClassHolder_T* _bookingClassHolder; }; Modified: trunk/stdair/stdair/bom/LegCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/LegCabinStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,11 +7,14 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/BookingClassStructure.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific LegCabin class (for instance, in the AIRSCHED library). */ @@ -34,14 +37,20 @@ typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector <BomStructureDummy, - BomStructureDummy> ChildrenBomTypeList_T; + typedef boost::mpl::vector <BomStopStructure, + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; + /** Define the associated segment-cabin type. */ + typedef typename BOM_CONTENT::SegmentCabinContent_T SegmentCabin_T; + /** Define the associated segment-cabin holder type. */ - typedef BomChildrenHolderImp<typename BOM_CONTENT::SegmentCabinContent_T> SegmentCabinHolder_T; + typedef BomChildrenHolderImp<SegmentCabin_T> SegmentCabinHolder_T; + + /** Define the map of segment-cabin. */ + typedef BomMap_T<SegmentCabin_T> SegmentCabinMap_T; public: // /////////// Getters ///////////// @@ -66,8 +75,8 @@ _parent = &ioLegDateStructure; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } /** Set the segment-cabin holder. */ void setSegmentCabinHolder (SegmentCabinHolder_T& ioSegmentCabinHolder) { Modified: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/LegDate.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -55,12 +55,12 @@ // //////////////////////////////////////////////////////////////////// LegCabinList_T LegDate::getLegCabinList () const { - return _legDateStructure.getChildrenList(); + return _legDateStructure.getChildrenHolder(); } // //////////////////////////////////////////////////////////////////// LegCabinMap_T LegDate::getLegCabinMap () const { - return _legDateStructure.getChildrenList(); + return _legDateStructure.getChildrenHolder(); } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/LegDate.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -40,7 +40,7 @@ /** Definition allowing to retrieve the specific SegmentDate type. */ typedef SegmentDate SegmentDateContent_T; - + public: // /////////// Getters //////////// // /** Get the airline code (from the parent class). */ Modified: trunk/stdair/stdair/bom/LegDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/LegDateStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,8 +7,8 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/LegCabinStructure.hpp> #include <stdair/bom/LegCabinKey.hpp> @@ -49,17 +49,23 @@ /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <LegCabinStructure<ContentChild_T>, - BomStructureDummy> ChildrenBomTypeList_T; + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + + /** Define the associated segment-date type. */ + typedef typename BOM_CONTENT::SegmentDateContent_T SegmentDate_T; + + /** Define the associated segment-date holder type. */ + typedef BomChildrenHolderImp<SegmentDate_T> SegmentDateHolder_T; + + /** Define the map of segment-date. */ + typedef BomMap_T<SegmentDate_T> SegmentDateMap_T; - /** Define the associated segment-date holder type.*/ - typedef BomChildrenHolderImp<typename BOM_CONTENT::SegmentDateContent_T> SegmentDateHolder_T; - public: // /////////// Getters ///////////// /** Get the (parent) FlightDateStructure object. */ @@ -76,14 +82,14 @@ return _content->getKey(); } - /** Get the list of leg-cabins. */ - const ChildrenBomHolder_T& getChildrenList() const { - return *_childrenList; + /** Get the holder of leg-cabins. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + return *_childrenHolder; } - /** Get the list of leg-cabins. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of leg-cabins. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } /** Retrieve, if existing, the leg-cabin corresponding to the @@ -92,7 +98,7 @@ ContentChild_T* getContentChild (const ChildKey_T& iKey) const { ContentChild_T* oContentChild_ptr = NULL; - ChildrenMap_T lChildrenMap (getChildrenList()); + ChildrenMap_T lChildrenMap (getChildrenHolder()); const MapKey_T lMapKey = iKey.toString(); typename ChildrenMap_T::iterator itContentChild = @@ -113,12 +119,12 @@ _parent = &ioFlightDateStructure; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the leg-cabin children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the leg-cabin children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } /** Set the segment-date holder. */ @@ -154,7 +160,7 @@ layer. */ /** Default constructors. */ LegDateStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL), _segmentDateHolder (NULL) { } + _childrenHolder (NULL), _segmentDateHolder (NULL) { } LegDateStructure (const LegDateStructure&); /** Destructor. */ @@ -168,8 +174,8 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of leg-cabins. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of leg-cabins. */ + ChildrenBomHolder_T* _childrenHolder; /** Holder of associated segment-dates. */ SegmentDateHolder_T* _segmentDateHolder; Modified: trunk/stdair/stdair/bom/SegmentCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/SegmentCabin.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -56,12 +56,12 @@ // ////////////////////////////////////////////////////////////////////// BookingClassList_T SegmentCabin::getBookingClassList () const { - return _segmentCabinStructure.getChildrenList(); + return _segmentCabinStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// BookingClassMap_T SegmentCabin::getBookingClassMap () const { - return _segmentCabinStructure.getChildrenList(); + return _segmentCabinStructure.getChildrenHolder(); } } Modified: trunk/stdair/stdair/bom/SegmentCabinStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/SegmentCabinStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,11 +7,14 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/BookingClassStructure.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific SegmentCabin class (for instance, in the AIRSCHED library). */ @@ -39,16 +42,22 @@ /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <BookingClassStructure<ContentChild_T>, - BomStructureDummy> ChildrenBomTypeList_T; + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomContentDummy> DefaultChildrenBomHolder_T; + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + /** Define the associated leg-cabin type. */ + typedef typename BOM_CONTENT::LegCabinContent_T LegCabin_T; + /** Define the associated leg-cabin holder type. */ - typedef BomChildrenHolderImp<typename BOM_CONTENT::LegCabinContent_T> LegCabinHolder_T; + typedef BomChildrenHolderImp<LegCabin_T> LegCabinHolder_T; + + /** Define the map of leg-cabin. */ + typedef BomMap_T<LegCabin_T> LegCabinMap_T; public: // /////////// Getters ///////////// @@ -69,14 +78,14 @@ return _content->getKey(); } - /** Get the list of segment-cabins. */ - const ChildrenBomHolder_T& getChildrenList() const { - return *_childrenList; + /** Get the holder of segment-cabins. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + return *_childrenHolder; } - /** Get the list of segment-cabins. */ - void getChildrenList (ChildrenBomHolder_T*& ioChildrenList) { - ioChildrenList = _childrenList; + /** Get the holder of segment-cabins. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; } private: @@ -86,12 +95,12 @@ _parent = &ioSegmentDateStructure; } - /** Default children list setter. */ - void setChildrenList (DefaultChildrenBomHolder_T&) { } + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - /** Set the segment-cabin children list. */ - void setChildrenList (ChildrenBomHolder_T& ioChildrenList) { - _childrenList = &ioChildrenList; + /** Set the segment-cabin children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; } /** Set the leg-cabin holder. */ @@ -127,7 +136,7 @@ layer. */ /** Default constructors. */ SegmentCabinStructure () : _parent (NULL), _content (NULL), - _childrenList (NULL), _legCabinHolder (NULL) { } + _childrenHolder (NULL), _legCabinHolder (NULL) { } SegmentCabinStructure (const SegmentCabinStructure&); /** Destructor. */ @@ -141,8 +150,8 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - /** List of segment-cabins. */ - ChildrenBomHolder_T* _childrenList; + /** Holder of segment-cabins. */ + ChildrenBomHolder_T* _childrenHolder; /** Holder of associated leg-cabins. */ LegCabinHolder_T* _legCabinHolder; Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2009-11-16 15:53:21 UTC (rev 65) @@ -57,12 +57,12 @@ // ////////////////////////////////////////////////////////////////////// SegmentCabinList_T SegmentDate::getSegmentCabinList () const { - return _segmentDateStructure.getChildrenList(); + return _segmentDateStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// SegmentCabinMap_T SegmentDate::getSegmentCabinMap () const { - return _segmentDateStructure.getChildrenList(); + return _segmentDateStructure.getChildrenHolder(); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentDateStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-11-13 08:52:41 UTC (rev 64) +++ trunk/stdair/stdair/bom/SegmentDateStructure.hpp 2009-11-16 15:53:21 UTC (rev 65) @@ -7,11 +7,14 @@ // MPL #include <boost/mpl/vector.hpp> // STDAIR -#include <stdair/bom/BomStructureDummy.hpp> -#include <stdair/bom/BomContentDummy.hpp> +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/SegmentCabinStructure.hpp> namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + /** Wrapper class aimed at holding the actual content, modeled by an external specific SegmentDate class (for instance, in the AIRSCHED library). */ @@ -39,16 +42,22 @@ /** Definition allowing to retrieve the associated children type. */ typedef boost::mpl::vector <SegmentCabinStructure<ContentChild_T>, - BomStructureDummy> ChildrenBomTypeList_T; + BomStopStructure> ChildrenBomTypeList_T; /** Definition allowing to retrieve the default children bom holder type. */ - ... [truncated message content] |
From: <qua...@us...> - 2009-11-20 10:57:04
|
Revision: 66 http://stdair.svn.sourceforge.net/stdair/?rev=66&view=rev Author: quannaus Date: 2009-11-20 10:56:57 +0000 (Fri, 20 Nov 2009) Log Message: ----------- [dev] Some small changes. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/bom/BomList.hpp trunk/stdair/stdair/bom/BomMap.hpp trunk/stdair/stdair/bom/FlightDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/SegmentDateContent.hpp Added Paths: ----------- trunk/stdair/stdair/basic/BasConst_General.hpp Removed Paths: ------------- trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/basic/BasConst.cpp 2009-11-20 10:56:57 UTC (rev 66) @@ -5,7 +5,7 @@ #include <string> // STDAIR #include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/BasConst_WorldSchedule.hpp> +#include <stdair/basic/BasConst_General.hpp> #include <stdair/basic/BasConst_Inventory.hpp> #include <stdair/basic/BasConst_BookingClass.hpp> #include <stdair/basic/BasConst_Yield.hpp> @@ -127,8 +127,8 @@ /** Default Date OffSet (e.g., 0). */ const DateOffSet_T DEFAULT_DATE_OFFSET (0); - // // //////// WorldSchedule /////// - // /** Default update date for the WorldSchedule. */ + // // //////// General /////// + // /** Default update date for the General. */ // const Date_T DEFAULT_WORLD_SCHEDULE_UPDATE_DATE (2007, // boost::gregorian::Jan, // 1); Copied: trunk/stdair/stdair/basic/BasConst_General.hpp (from rev 63, trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp) =================================================================== --- trunk/stdair/stdair/basic/BasConst_General.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_General.hpp 2009-11-20 10:56:57 UTC (rev 66) @@ -0,0 +1,40 @@ +#ifndef __STDAIR_BAS_BASCONST_GENERAL_HPP +#define __STDAIR_BAS_BASCONST_GENERAL_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// LATUS Common +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + /** Default epsilon value. */ + extern const double DEFAULT_EPSILON_VALUE; + + /** Default flight speed (number of kilometers per hour). */ + extern const unsigned int DEFAULT_FLIGHT_SPEED; + + /** Default cabin capacity for Leg cabins. */ + extern const CabinCapacity_T DEFAULT_CABIN_CAPACITY; + + /** Default number of generated flight dates . */ + extern const NbOfFlightDates_T DEFAULT_NB_OF_FLIGHTDATES; + + /** Default number of bookings for BookingClass. */ + extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; + + /** Default distance value (kilometers). */ + extern const Distance_T DEFAULT_DISTANCE_VALUE; + + /** Default value of Fare. */ + extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + + /** Default revenue value. */ + extern const Revenue_T DEFAULT_REVENUE_VALUE; + + /** Default booking rate for OnD bookings over overall class bookings. */ + extern const BookingRatio_T DEFAULT_OND_BOOKING_RATE; + +} +#endif // __STDAIR_BAS_BASCONST_GENERAL_HPP Deleted: trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/basic/BasConst_WorldSchedule.hpp 2009-11-20 10:56:57 UTC (rev 66) @@ -1,40 +0,0 @@ -#ifndef __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP -#define __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// LATUS Common -#include <stdair/STDAIR_Types.hpp> - -namespace stdair { - - /** Default epsilon value. */ - extern const double DEFAULT_EPSILON_VALUE; - - /** Default flight speed (number of kilometers per hour). */ - extern const unsigned int DEFAULT_FLIGHT_SPEED; - - /** Default cabin capacity for Leg cabins. */ - extern const CabinCapacity_T DEFAULT_CABIN_CAPACITY; - - /** Default number of generated flight dates . */ - extern const NbOfFlightDates_T DEFAULT_NB_OF_FLIGHTDATES; - - /** Default number of bookings for BookingClass. */ - extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; - - /** Default distance value (kilometers). */ - extern const Distance_T DEFAULT_DISTANCE_VALUE; - - /** Default value of Fare. */ - extern const Fare_T DEFAULT_CLASS_FARE_VALUE; - - /** Default revenue value. */ - extern const Revenue_T DEFAULT_REVENUE_VALUE; - - /** Default booking rate for OnD bookings over overall class bookings. */ - extern const BookingRatio_T DEFAULT_OND_BOOKING_RATE; - -} -#endif // __STDAIR_BAS_BASCONST_WORLDSCHEDULE_HPP Modified: trunk/stdair/stdair/bom/BomList.hpp =================================================================== --- trunk/stdair/stdair/bom/BomList.hpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/bom/BomList.hpp 2009-11-20 10:56:57 UTC (rev 66) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <vector> namespace stdair { Modified: trunk/stdair/stdair/bom/BomMap.hpp =================================================================== --- trunk/stdair/stdair/bom/BomMap.hpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/bom/BomMap.hpp 2009-11-20 10:56:57 UTC (rev 66) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <map> namespace stdair { Modified: trunk/stdair/stdair/bom/FlightDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateContent.cpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/bom/FlightDateContent.cpp 2009-11-20 10:56:57 UTC (rev 66) @@ -4,7 +4,7 @@ // STL #include <cassert> // STDAIR -#include <stdair/basic/BasConst_WorldSchedule.hpp> +#include <stdair/basic/BasConst_General.hpp> #include <stdair/bom/FlightDateContent.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/LegDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.cpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/bom/LegDateContent.cpp 2009-11-20 10:56:57 UTC (rev 66) @@ -4,7 +4,7 @@ // STL #include <cassert> // STDAIR -#include <stdair/basic/BasConst_WorldSchedule.hpp> +#include <stdair/basic/BasConst_General.hpp> #include <stdair/bom/LegDateContent.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/SegmentDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateContent.hpp 2009-11-16 15:53:21 UTC (rev 65) +++ trunk/stdair/stdair/bom/SegmentDateContent.hpp 2009-11-20 10:56:57 UTC (rev 66) @@ -152,6 +152,11 @@ _segmentUnitRevenue = iSegmentURevenue; } + /** Set the distance. */ + void setDistance (const Distance_T& iDistance) { + _distance = iDistance; + } + public: // /////////// Display support methods ///////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-01-01 19:42:49
|
Revision: 81 http://stdair.svn.sourceforge.net/stdair/?rev=81&view=rev Author: denis_arnaud Date: 2010-01-01 19:02:08 +0000 (Fri, 01 Jan 2010) Log Message: ----------- [Struct] Added the BomManager, BookingRequestStruct and TravelSolutionStruct structures. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/AirlineFeature.cpp trunk/stdair/stdair/bom/AirlineFeature.hpp trunk/stdair/stdair/bom/AirlineFeatureSet.cpp trunk/stdair/stdair/bom/AirlineFeatureSet.hpp trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp trunk/stdair/stdair/bom/BomContent.hpp trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomStopStructure.hpp trunk/stdair/stdair/bom/BomStructure.hpp trunk/stdair/stdair/bom/StructAbstract.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BookingRequestStruct.hpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -342,6 +342,12 @@ /** Define the total revenue of an unconstrained policy. */ typedef double PolicyRevenue_T; + + // ///////////// Technical //////////////// + /** File or directory name. + <br>It may contain paths, relative or absolute (e.g., /foo/bar + or C:\foo\bar). */ + typedef std::string Filename_T; } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/bom/AirlineFeature.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.cpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/AirlineFeature.cpp 2010-01-01 19:02:08 UTC (rev 81) @@ -1,8 +1,11 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> +// STL +#include <cassert> +#include <istream> +#include <ostream> +#include <sstream> // STDAIR #include <stdair/bom/AirlineFeatureStructure.hpp> #include <stdair/bom/AirlineFeature.hpp> Modified: trunk/stdair/stdair/bom/AirlineFeature.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,6 +4,9 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +#include <string> // STDAIR #include <stdair/bom/AirlineFeatureSet.hpp> #include <stdair/bom/AirlineFeatureStructure.hpp> @@ -12,17 +15,20 @@ #include <stdair/bom/AirlineFeatureTypes.hpp> namespace stdair { + // Forward declarations class FacBomContent; struct AirlineFeatureKey_T; + /** Class representing the actual functional/business content for a segment-cabin. */ class AirlineFeature : public AirlineFeatureContent { friend class FacBomContent; + public: - // Type definitions + // //////////// Type definitions ////////////// /** Definition allowing to retrieve the associated parent BOM content type. */ typedef AirlineFeatureSet Parent_T; @@ -36,15 +42,17 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef AirlineFeature ContentChild_T; + public: - // //////////// Setters ////////// - /** Intialization method. */ + // //////////// Setters ///////////// + /** Intialisation method. */ void init (const ForecasterMode_T&, const HistoricalDataLimit_T&, const OptimizerStruct_T&, const ControlMode_T&); + public: - // /////////// Display support methods ///////// + // /////////// Display support methods ///////////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ void toStream (std::ostream& ioOut) const; @@ -67,13 +75,16 @@ /** Give a description of the structure (for display purposes). */ const std::string describe() const; + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { return _airlineFeatureStructure; } + protected: + // ///////////////// Constructors and destructors ///////////////// /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ @@ -84,8 +95,9 @@ /** Destructor. */ virtual ~AirlineFeature(); + protected: - // Attributes + // ////////////////////// Attributes /////////////////////////// /** Reference structure. */ BomStructure_T& _airlineFeatureStructure; }; Modified: trunk/stdair/stdair/bom/AirlineFeatureSet.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2010-01-01 19:02:08 UTC (rev 81) @@ -3,6 +3,9 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> +#include <istream> +#include <ostream> +#include <sstream> // STDAIR #include <stdair/bom/AirlineFeatureSetStructure.hpp> #include <stdair/bom/AirlineFeatureSet.hpp> @@ -25,6 +28,30 @@ } // ////////////////////////////////////////////////////////////////////// + void AirlineFeatureSet::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void AirlineFeatureSet::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string AirlineFeatureSet::toString() const { + return describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeatureSet::describeKey() const { + return std::string (""); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string AirlineFeatureSet::describeShortKey() const { + return std::string (""); + } + + // ////////////////////////////////////////////////////////////////////// const std::string AirlineFeatureSet::display() const { // Store current formatting flags of std::cout std::ios::fmtflags oldFlags = std::cout.flags(); Modified: trunk/stdair/stdair/bom/AirlineFeatureSet.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,6 +4,9 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +#include <string> // STDAIR #include <stdair/bom/AirlineFeatureSetStructure.hpp> #include <stdair/bom/AirlineFeatureSetContent.hpp> @@ -11,16 +14,19 @@ #include <stdair/bom/AirlineFeatureTypes.hpp> namespace stdair { + // Forward declarations. class FacBomContent; class AirlineFeature; struct AirlineFeatureKey_T; struct AirlineFeatureSetKey_T; + /** Class representing the actual functional/business content for the Bom root. */ class AirlineFeatureSet : public AirlineFeatureSetContent { friend class FacBomContent; + public: // ///////////////////////////////////////////////////////////////////////// @@ -35,29 +41,31 @@ typedef AirlineFeature ContentChild_T; // ///////////////////////////////////////////////////////////////////////// + public: - // /////////// Display support methods ///////// + // /////////// Display support methods ///////////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { ioOut << toString(); } + void toStream (std::ostream& ioOut) const; /** Read a Business Object from an input stream. @param istream& the input stream. */ - void fromStream (std::istream& ioIn) { } + void fromStream (std::istream& ioIn); - /** Get the serialised version of the Business Object. */ - std::string toString() const { return describeKey(); } + /** 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 { return std::string (""); } + const std::string describeKey() const; /** Get a string describing the short key (differentiating two objects at the same level). */ - const std::string describeShortKey() const { return std::string (""); } + const std::string describeShortKey() const; /** Display the full context of the set of airline features. */ const std::string display() const; + public: // /////////// Getters ///////////// @@ -72,13 +80,16 @@ /** Get a AirlineFeatureMap_T for iteration methods. */ AirlineFeatureMap_T getAirlineFeatureMap () const; + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { return _bomStructure; } - + + protected: + // ///////////////// Constructors and destructors ///////////////// /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ @@ -88,8 +99,9 @@ /** Destructor. */ virtual ~AirlineFeatureSet(); + private: - // Attributes + // ////////////////////// Attributes /////////////////////////// /** Reference structure. */ BomStructure_T& _bomStructure; }; Modified: trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> // MPL #include <boost/mpl/vector.hpp> // STDAIR @@ -105,7 +107,6 @@ /** The actual functional (Business Object) content. */ BOM_CONTENT* _content; - }; } Modified: trunk/stdair/stdair/bom/BomContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BomContent.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/BomContent.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -5,9 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <istream> -#include <ostream> -#include <sstream> +#include <iosfwd> #include <string> namespace stdair { Modified: trunk/stdair/stdair/bom/BomKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomKey.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/BomKey.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -5,9 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <istream> -#include <ostream> -#include <sstream> +#include <iosfwd> #include <string> namespace stdair { Added: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp (rev 0) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-01-01 19:02:08 UTC (rev 81) @@ -0,0 +1,88 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <ostream> +// STDAIR +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/BookingClass.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> +#include <stdair/bom/AirlineFeatureSet.hpp> +#include <stdair/bom/AirlineFeature.hpp> +#include <stdair/bom/BomManager.hpp> + +namespace stdair { + + // ////////////////////////////////////////////////////////////////////// + void BomManager::display (std::ostream& oStream, const BomRoot& iBomRoot) { + + // Browse the Inventory objects + const InventoryList_T lInventoryList= iBomRoot.getInventoryList (); + for (InventoryList_T::iterator itInv = lInventoryList.begin(); + itInv != lInventoryList.end(); ++itInv) { + const Inventory& lCurrentInventory = *itInv; + oStream << "Inventory: " << lCurrentInventory.toString(); + + // Browse the FlightDate objects + const FlightDateList_T lFDList = + lCurrentInventory.getFlightDateList (); + for (FlightDateList_T::iterator itFD = lFDList.begin(); + itFD != lFDList.end(); ++itFD) { + const FlightDate& lCurrentFD = *itFD; + oStream << "Flight-date: " << lCurrentFD.toString(); + + // Browse the LegDate objects + const LegDateList_T lLDList = lCurrentFD.getLegDateList(); + for (LegDateList_T::iterator itLD = lLDList.begin(); + itLD != lLDList.end(); ++itLD) { + const LegDate& lCurrentLD = *itLD; + oStream << "Leg-date: " << lCurrentLD.toString(); + + // Browse the LegCabin objects + const LegCabinList_T lLCList = lCurrentLD.getLegCabinList(); + for (LegCabinList_T::iterator itLC = lLCList.begin(); + itLC != lLCList.end(); ++itLC) { + const LegCabin& lCurrentLC = *itLC; + oStream << "Leg-cabin: " << lCurrentLC.toString(); + } + } + + // Browse the SegmentDate objects + const SegmentDateList_T lSDList = + lCurrentFD.getSegmentDateList(); + for (SegmentDateList_T::iterator itSD = lSDList.begin(); + itSD != lSDList.end(); ++itSD) { + const SegmentDate& lCurrentSD = *itSD; + oStream << "Segment-date: " << lCurrentSD.toString(); + + // Browse the SegmentCabin objects + const SegmentCabinList_T lSCList = + lCurrentSD.getSegmentCabinList(); + for (SegmentCabinList_T::iterator itSC = lSCList.begin(); + itSC != lSCList.end(); ++itSC) { + const SegmentCabin& lCurrentSC = *itSC; + oStream << "Segment-cabin: " << lCurrentSC.toString(); + + // Browse the BookingClass objects + const BookingClassList_T lBCList = + lCurrentSC.getBookingClassList (); + for (BookingClassList_T::iterator itBC = lBCList.begin(); + itBC != lBCList.end(); ++itBC) { + const BookingClass& lCurrentBC = *itBC; + oStream << "Booking class: " << lCurrentBC.toString(); + } + } + } + } + } + } + +} Added: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -0,0 +1,28 @@ +#ifndef __STDAIR_BOM_BOMMANAGER_HPP +#define __STDAIR_BOM_BOMMANAGER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> + +namespace stdair { + + // Forward declarations + class BomRoot; + + + /** Utility class for StdAir objects. */ + class BomManager { + public: + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. + @param std::ostream& Output stream in which the BOM tree should be + logged/dumped. + @param const BomRoot& Root of the BOM tree to be displayed. */ + static void display (std::ostream&, const BomRoot&); + }; + +} +#endif // __STDAIR_BOM_BOMMANAGER_HPP Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> // STDAIR #include <stdair/bom/BomRootStructure.hpp> #include <stdair/bom/BomRootContent.hpp> Modified: trunk/stdair/stdair/bom/BomStopStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStopStructure.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/BomStopStructure.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <iostream> // STDAIR #include <stdair/bom/BomStructure.hpp> #include <stdair/bom/BomKey.hpp> Modified: trunk/stdair/stdair/bom/BomStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructure.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/BomStructure.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -4,12 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> // STL -#include <istream> -#include <ostream> -#include <sstream> +#include <iosfwd> #include <string> namespace stdair { Added: trunk/stdair/stdair/bom/BookingRequestStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.hpp (rev 0) +++ trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -0,0 +1,42 @@ +#ifndef __STDAIR_BOM_BOOKINGREQUESTSTRUCT_HPP +#define __STDAIR_BOM_BOOKINGREQUESTSTRUCT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +#include <string> +// StdAir +#include <stdair/bom/StructAbstract.hpp> + +namespace stdair { + + /** Structure holding the elements of a booking request. */ + struct BookingRequestStruct : public StructAbstract { + public: + + // /////////// Display support method ///////////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << describe(); + } + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { + } + + /** Display of the structure. */ + const std::string describe() const { + return ""; + } + + + private: + + }; + +} +#endif // __STDAIR_BOM_BOOKINGREQUESTSTRUCT_HPP Modified: trunk/stdair/stdair/bom/StructAbstract.hpp =================================================================== --- trunk/stdair/stdair/bom/StructAbstract.hpp 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/StructAbstract.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -5,8 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <iostream> -#include <sstream> +#include <iosfwd> namespace stdair { Added: trunk/stdair/stdair/bom/TravelSolutionStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.hpp (rev 0) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-01-01 19:02:08 UTC (rev 81) @@ -0,0 +1,42 @@ +#ifndef __STDAIR_BOM_TRAVELSOLUTIONSTRUCT_HPP +#define __STDAIR_BOM_TRAVELSOLUTIONSTRUCT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +#include <string> +// StdAir +#include <stdair/bom/StructAbstract.hpp> + +namespace stdair { + + /** Structure holding the elements of a travel solution. */ + struct TravelSolutionStruct : public StructAbstract { + public: + + // /////////// Display support method ///////////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << describe(); + } + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { + } + + /** Display of the structure. */ + const std::string describe() const { + return ""; + } + + + private: + + }; + +} +#endif // __STDAIR_BOM_TRAVELSOLUTIONSTRUCT_HPP Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-01-01 18:55:41 UTC (rev 80) +++ trunk/stdair/stdair/bom/sources.mk 2010-01-01 19:02:08 UTC (rev 81) @@ -61,7 +61,10 @@ $(top_srcdir)/stdair/bom/BomChildrenHolderImp.hpp \ $(top_srcdir)/stdair/bom/BomIterator.hpp \ $(top_srcdir)/stdair/bom/OptimizerStruct.hpp \ - $(top_srcdir)/stdair/bom/DoWStruct.hpp + $(top_srcdir)/stdair/bom/DoWStruct.hpp \ + $(top_srcdir)/stdair/bom/TravelSolutionStruct.hpp \ + $(top_srcdir)/stdair/bom/BookingRequestStruct.hpp \ + $(top_srcdir)/stdair/bom/BomManager.hpp bom_cc_sources = \ $(top_srcdir)/stdair/bom/BomRootKey.cpp \ $(top_srcdir)/stdair/bom/InventoryKey.cpp \ @@ -94,5 +97,6 @@ $(top_srcdir)/stdair/bom/AirlineFeature.cpp \ $(top_srcdir)/stdair/bom/AirlineFeatureContent.cpp \ $(top_srcdir)/stdair/bom/OptimizerStruct.cpp \ - $(top_srcdir)/stdair/bom/DoWStruct.cpp + $(top_srcdir)/stdair/bom/DoWStruct.cpp \ + $(top_srcdir)/stdair/bom/BomManager.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-01-06 16:53:59
|
Revision: 88 http://stdair.svn.sourceforge.net/stdair/?rev=88&view=rev Author: quannaus Date: 2010-01-06 16:53:49 +0000 (Wed, 06 Jan 2010) Log Message: ----------- [Dev] Added Network, NetworkDate, AirportDate and OutboundPath. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomRootStructure.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp trunk/stdair/stdair/bom/AirportDate.cpp trunk/stdair/stdair/bom/AirportDate.hpp trunk/stdair/stdair/bom/AirportDateContent.cpp trunk/stdair/stdair/bom/AirportDateContent.hpp trunk/stdair/stdair/bom/AirportDateKey.cpp trunk/stdair/stdair/bom/AirportDateKey.hpp trunk/stdair/stdair/bom/AirportDateStructure.hpp trunk/stdair/stdair/bom/AirportDateTypes.hpp trunk/stdair/stdair/bom/Network.cpp trunk/stdair/stdair/bom/Network.hpp trunk/stdair/stdair/bom/NetworkContent.cpp trunk/stdair/stdair/bom/NetworkContent.hpp trunk/stdair/stdair/bom/NetworkDate.cpp trunk/stdair/stdair/bom/NetworkDate.hpp trunk/stdair/stdair/bom/NetworkDateContent.cpp trunk/stdair/stdair/bom/NetworkDateContent.hpp trunk/stdair/stdair/bom/NetworkDateKey.cpp trunk/stdair/stdair/bom/NetworkDateKey.hpp trunk/stdair/stdair/bom/NetworkDateStructure.hpp trunk/stdair/stdair/bom/NetworkDateTypes.hpp trunk/stdair/stdair/bom/NetworkKey.cpp trunk/stdair/stdair/bom/NetworkKey.hpp trunk/stdair/stdair/bom/NetworkStructure.hpp trunk/stdair/stdair/bom/NetworkTypes.hpp trunk/stdair/stdair/bom/OutboundPath.cpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/OutboundPathContent.cpp trunk/stdair/stdair/bom/OutboundPathContent.hpp trunk/stdair/stdair/bom/OutboundPathKey.cpp trunk/stdair/stdair/bom/OutboundPathKey.hpp trunk/stdair/stdair/bom/OutboundPathStructure.hpp trunk/stdair/stdair/bom/OutboundPathTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -55,6 +55,9 @@ /** Define the type for date (e.g., departure date of a flight). */ typedef boost::gregorian::date Date_T; + /** Define the type for network ID. */ + typedef std::string NetworkID_T; + /** Define the type for airport codes. */ typedef std::string AirportCode_T; Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -93,10 +93,10 @@ // /** Time duration representing a full minute (in seconds).*/ // const int TIME_DURATION_FOR_A_MINUTE_IN_SECONDS = 60; - // /** Null time duration (in boost::time_duration unit).*/ - // const Duration_T NULL_BOOST_TIME_DURATION = - // boost::posix_time::hours(0)+ boost::posix_time::minutes (0) - // + boost::posix_time::seconds (0); + /** Null time duration (in boost::time_duration unit).*/ + const Duration_T NULL_BOOST_TIME_DURATION = + boost::posix_time::hours(0)+ boost::posix_time::minutes (0) + + boost::posix_time::seconds (0); // /** Date duration representing a full day (in boost::date_duration unit).*/ // const DateOffSet_T BOOST_DATE_DURATION_FOR_A_DAY (1); @@ -144,40 +144,40 @@ // const DateTime_T DEFAULT_DEMAND_DATETIME (DEFAULT_WHOLE_DEMAND_UPDATE_DATE, // NULL_BOOST_TIME_DURATION); - // // //////// Fare Rules /////// - // /** Default saturdayStay value (false). */ - // const SaturdayStay_T DEFAULT_SATURDAY_STAY = false; + // //////// Fare Rules /////// + /** Default saturdayStay value (false). */ + const SaturdayStay_T DEFAULT_SATURDAY_STAY = false; + + /** Default change fees value (false). */ + const ChangeFees_T DEFAULT_CHANGE_FEES = false; + + /** Default non refundable value (false). */ + const NonRefundable_T DEFAULT_NON_REFUNDABLE = false; + + /** Default airlineCode value ('XX'). */ + const AirlineCode_T DEFAULT_AIRLINE_CODE = "XX"; - // /** Default change fees value (false). */ - // const ChangeFees_T DEFAULT_CHANGE_FEES = false; + /** Default airlineCode value (''). */ + const AirlineCode_T DEFAULT_NULL_AIRLINE_CODE = ""; - // /** Default non refundable value (false). */ - // const NonRefundable_T DEFAULT_NON_REFUNDABLE = false; + /** Default airportCode value ('XXX'). */ + const AirportCode_T DEFAULT_AIRPORT_CODE = "XXX"; - // /** Default airlineCode value ('XX'). */ - // const AirlineCode_T DEFAULT_AIRLINE_CODE = "XX"; + /** Default family code value ('X'). */ + const ClassCode_T DEFAULT_FAMILY_CODE = "0"; - // /** Default airlineCode value (''). */ - // const AirlineCode_T DEFAULT_NULL_AIRLINE_CODE = ""; + /** Default classCode value ('X'). */ + const ClassCode_T DEFAULT_CLASS_CODE = "X"; - // /** Default airportCode value ('XXX'). */ - // const AirportCode_T DEFAULT_AIRPORT_CODE = "XXX"; + /** Default number of airlines. */ + const NbOfAirlines_T DEFAULT_NBOFAIRLINES = 0; - // /** Default family code value ('X'). */ - // const ClassCode_T DEFAULT_FAMILY_CODE = "0"; + /** Default classCode value (''). */ + const ClassCode_T DEFAULT_NULL_CLASS_CODE = ""; - // /** Default classCode value ('X'). */ - // const ClassCode_T DEFAULT_CLASS_CODE = "X"; + /** Default flightPathCode value (''). */ + const FlightPathCode_T DEFAULT_FLIGHTPATH_CODE = ""; - // /** Default number of airlines. */ - // const NbOfAirlines_T DEFAULT_NBOFAIRLINES = 0; - - // /** Default classCode value (''). */ - // const ClassCode_T DEFAULT_NULL_CLASS_CODE = ""; - - // /** Default flightPathCode value (''). */ - // const FlightPathCode_T DEFAULT_FLIGHTPATH_CODE = ""; - // // //////// DemandFeatures /////// // /** Default SaturdayStay average ratio of demand (value between [0, 100]). */ // const SaturdayStayRatio_T DEFAULT_SATURDAY_STAY_RATIO = 50; @@ -331,21 +331,21 @@ // /** Default remaining futre demand standard deviation for OnD. */ // const NbOfBookings_T DEFAULT_OND_REMAINING_DEMAND_STANDARD_DEVIATION = 0.0; - // // //////// Travel Solutions /////// - // /** Default Minimum connection time. */ - // const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME (0, 30, 0); + // //////// Travel Solutions /////// + /** Default Minimum connection time. */ + const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME (0, 30, 0); - // /** Default Matching Indicator value. */ - // const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR (0.0); + /** Default Matching Indicator value. */ + const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR (0.0); - // /** Default price value (0.0). */ + /** Default price value (0.0). */ // const PriceValue_T DEFAULT_PRICE_VALUE (0.0); - // /** Default currency (euro). */ - // const PriceCurrency_T DEFAULT_CURRENCY ("EUR"); + /** Default currency (euro). */ + const PriceCurrency_T DEFAULT_CURRENCY ("EUR"); - // /** Default availability status for a travel solution. */ - // const AvailabilityStatus_T DEFAULT_AVAILABILITY_STATUS = false; + /** Default availability status for a travel solution. */ + const AvailabilityStatus_T DEFAULT_AVAILABILITY_STATUS = false; // // //////// Cancellation /////// // /** Default Fare value */ Added: trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp (rev 0) +++ trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,73 @@ +#ifndef __STDAIR_BAS_BASCONST_TRAVELSOLUTION_HPP +#define __STDAIR_BAS_BASCONST_TRAVELSOLUTION_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// LATUS Common +#include <stdair/basic/BasComTypes.hpp> + +namespace stdair { + + /** Default flight speed (number of kilometers per hour). */ + extern const unsigned int DEFAULT_FLIGHT_SPEED; + + // //////// Travel Solutions /////// + /** Default distance value (kilometers). */ + extern const Distance_T DEFAULT_DISTANCE_VALUE; + + /** Default Minimum connection time. */ + extern const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME; + + /** Null time duration (in boost::time_duration unit).*/ + extern const Duration_T NULL_BOOST_TIME_DURATION; + + /** Default airlineCode value ('XX'). */ + extern const AirlineCode_T DEFAULT_AIRLINE_CODE; + + /** Default epsilon value. */ + extern const double DEFAULT_EPSILON_VALUE; + + /** Default classCode value ('X'). */ + extern const ClassCode_T DEFAULT_CLASS_CODE; + + /** Default flightPathCode value (''). */ + extern const FlightPathCode_T DEFAULT_FLIGHTPATH_CODE; + + /** Default value of Availability. */ + extern const Availability_T DEFAULT_CLASS_AVAILABILITY; + + /** Default availability status for a travel solution. */ + extern const AvailabilityStatus_T DEFAULT_AVAILABILITY_STATUS; + + /** Default number of bookings. */ + extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; + + /** Default value of Fare. */ + extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + + /** Default nember of required seats by the demand. */ + extern const unsigned short DEFAULT_NUMBER_OF_REQUIRED_SEATS; + + /** Default Matching Indicator value between customer requirements + and a fare rule. */ + extern const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR; + + /** Default epsilon value between customer requirements + and a fare rule. */ + extern const double DEFAULT_EPSILON_VALUE; + + /** Default revenue value. */ + extern const Revenue_T DEFAULT_REVENUE_VALUE; + + /** Default currency (euro). */ + extern const PriceCurrency_T DEFAULT_CURRENCY; + + /** Default DICO studied airline. */ + extern const AirlineCode_T DEFAULT_DICO_STUDIED_AIRLINE; + + /** Default DICO studied date. */ + extern const Date_T DEFAULT_DICO_STUDIED_DATE; + +} +#endif // __STDAIR_BAS_BASCONST_TRAVELSOLUTION_HPP Modified: trunk/stdair/stdair/basic/sources.mk =================================================================== --- trunk/stdair/stdair/basic/sources.mk 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/basic/sources.mk 2010-01-06 16:53:49 UTC (rev 88) @@ -4,6 +4,7 @@ $(top_srcdir)/stdair/basic/BasConst_Inventory.hpp \ $(top_srcdir)/stdair/basic/BasConst_BookingClass.hpp \ $(top_srcdir)/stdair/basic/BasConst_Yield.hpp \ - $(top_srcdir)/stdair/basic/BasConst_Period_BOM.hpp + $(top_srcdir)/stdair/basic/BasConst_Period_BOM.hpp \ + $(top_srcdir)/stdair/basic/BasConst_TravelSolution.hpp bas_cc_sources = \ $(top_srcdir)/stdair/basic/BasConst.cpp Copied: trunk/stdair/stdair/bom/AirportDate.cpp (from rev 87, trunk/stdair/stdair/bom/LegDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDate.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDate.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,74 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// STDAIR +#include <stdair/bom/AirportDateStructure.hpp> +#include <stdair/bom/AirportDate.hpp> +#include <stdair/bom/OutboundPath.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirportDate::AirportDate (const BomKey_T& iKey, + BomStructure_T& ioAirportStructure) + : AirportDateContent (iKey), _airportDateStructure (ioAirportStructure) { + } + + // //////////////////////////////////////////////////////////////////// + AirportDate::~AirportDate () { + } + + // //////////////////////////////////////////////////////////////////// + void AirportDate::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void AirportDate::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string AirportDate::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 AirportDate::describeKey() const { + return _airportDateStructure.describeKey(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string AirportDate::describeShortKey() const { + return _airportDateStructure.describeShortKey(); + } + + // //////////////////////////////////////////////////////////////////// + OutboundPathList_T AirportDate::getOutboundPathList () const { + return _airportDateStructure.getChildrenHolder(); + } + + // //////////////////////////////////////////////////////////////////// + OutboundPathMap_T AirportDate::getOutboundPathMap () const { + return _airportDateStructure.getChildrenHolder(); + } + + // //////////////////////////////////////////////////////////////////// + OutboundPath* AirportDate:: + getOutboundPath (const OutboundPathKey_T& iKey) const { + return _airportDateStructure.getContentChild (iKey); + } + +} + Copied: trunk/stdair/stdair/bom/AirportDate.hpp (from rev 87, trunk/stdair/stdair/bom/LegDate.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDate.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDate.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,98 @@ +#ifndef __STDAIR_BOM_AIRPORTDATE_HPP +#define __STDAIR_BOM_AIRPORTDATE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/AirportDateStructure.hpp> +#include <stdair/bom/AirportDateContent.hpp> +#include <stdair/bom/AirportDateTypes.hpp> +#include <stdair/bom/OutboundPathTypes.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + struct AirportDateKey_T; + struct OutboundPathKey_T; + + /** Class representing the actual functional/business content for a + airport-date. */ + class AirportDate : public AirportDateContent { + friend class FacBomContent; + + public: + // Type definitions + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef FlightDate Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef AirportDateStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirportDateKey_T BomKey_T; + + /** Definition allowing to retrieve the associated + BOM content child type. */ + typedef OutboundPath 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 OutboundPathList_T for iteration methods. */ + OutboundPathList_T getOutboundPathList () const; + + /** Get a OutboundPathMap_T for iteration methods. */ + OutboundPathMap_T getOutboundPathMap () const; + + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _airportDateStructure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirportDate (); + AirportDate (const AirportDate&); + AirportDate (const BomKey_T&, BomStructure_T&); + + /** Destructor. */ + virtual ~AirportDate(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _airportDateStructure; + + }; + +} +#endif // __STDAIR_BOM_AIRPORTDATE_HPP + Copied: trunk/stdair/stdair/bom/AirportDateContent.cpp (from rev 87, trunk/stdair/stdair/bom/LegDateContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateContent.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/AirportDateContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirportDateContent::AirportDateContent (const BomKey_T& iKey) \ + : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + AirportDateContent::~AirportDateContent () { + } + +} + Copied: trunk/stdair/stdair/bom/AirportDateContent.hpp (from rev 87, trunk/stdair/stdair/bom/LegDateContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateContent.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,66 @@ +#ifndef __STDAIR_BOM_AIRPORTDATECONTENT_HPP +#define __STDAIR_BOM_AIRPORTDATECONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/AirportDateKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airport-date. */ + class AirportDateContent : public BomContent { + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef AirportDateKey_T BomKey_T; + + public: + // /////////// Getters ///////////// + /** Get the airport-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. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + + protected: + /** Default constructors. */ + AirportDateContent (const BomKey_T&); + AirportDateContent (const AirportDateContent&); + + /** Destructor. */ + virtual ~AirportDateContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + + }; + +} +#endif // __STDAIR_BOM_AIRPORTDATECONTENT_HPP + Added: trunk/stdair/stdair/bom/AirportDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateKey.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,49 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/AirportDateKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + AirportDateKey_T::AirportDateKey_T () : _origin ("ZZZ") { + } + + // //////////////////////////////////////////////////////////////////// + AirportDateKey_T::AirportDateKey_T (const AirportCode_T& iAirportCode) + : _origin (iAirportCode) { + } + + // //////////////////////////////////////////////////////////////////// + AirportDateKey_T::~AirportDateKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void AirportDateKey_T::toStream (std::ostream& ioOut) const { + ioOut << "AirportDateKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void AirportDateKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string AirportDateKey_T::toString() const { + std::ostringstream oStr; + oStr << _origin; + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string AirportDateKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const Date_T& AirportDateKey_T::getBoardingDate() const { + return _parentKey.getReferenceDate(); + } +} Added: trunk/stdair/stdair/bom/AirportDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateKey.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,80 @@ +#ifndef __STDAIR_BOM_AIRPORTDATEKEY_HPP +#define __STDAIR_BOM_AIRPORTDATEKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/NetworkDateKey.hpp> + +namespace stdair { + /** Key of airport-date. */ + struct AirportDateKey_T : public BomKey_T { + friend struct OutboundPathKey_T; + + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef NetworkDateKey_T ParentKey_T; + + private: + // /////////// Default constructor ////////// + AirportDateKey_T () { }; + + public: + // /////////// Construction /////////// + /** Constructors. */ + AirportDateKey_T (const AirportCode_T& iAirportCode); + AirportDateKey_T (const AirportDateKey_T&); + + /** Destructor. */ + ~AirportDateKey_T (); + + // /////////// Getters ////////// + /** Get boarding date. */ + const Date_T& getBoardingDate() const; + + /** Get boarding airport. */ + const AirportCode_T& getBoardingPoint() const { + return _origin; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + const std::string toString() const; + + /** Display of the key. */ + const std::string describe() const; + + // /////////// Setters ///////////// + /** Set the parent key. */ + void setParentKey (const ParentKey_T& iParentKey) { + _parentKey = iParentKey; + } + + private: + // Attributes + /** Network-date key.*/ + ParentKey_T _parentKey; + + /** The boarding airport. */ + AirportCode_T _origin; + }; + +} + +#endif // __STDAIR_BOM_NETWORKDATEKEY_HPP Copied: trunk/stdair/stdair/bom/AirportDateStructure.hpp (from rev 87, trunk/stdair/stdair/bom/LegDateStructure.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDateStructure.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateStructure.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,169 @@ +#ifndef __STDAIR_BOM_AIRPORTDATESTRUCTURE_HPP +#define __STDAIR_BOM_AIRPORTDATESTRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// MPL +#include <boost/mpl/vector.hpp> +// STDAIR +#include <stdair/bom/BomStopStructure.hpp> +#include <stdair/bom/BomStopContent.hpp> +#include <stdair/bom/OutboundPathStructure.hpp> +#include <stdair/bom/OutboundPathKey.hpp> + +namespace stdair { + // Forward declarations. + template <typename BOM> struct BomMap_T; + + /** Wrapper class aimed at holding the actual content, modeled + by an external specific AirportDate class (for instance, + in the AIRSCHED library). */ + template <class BOM_CONTENT> + class AirportDateStructure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated BOM content type. */ + typedef BOM_CONTENT Content_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef typename BOM_CONTENT::BomKey_T BomKey_T; + + /** Definition allowing to retrieve the associated parent + BOM structure type. */ + typedef typename BOM_CONTENT::Parent_T::BomStructure_T ParentBomStructure_T; + + /** Definition allowing to retrieve the children type of the + BOM_CONTENT. */ + typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; + + /** Definition allowing to retrieve the child key type. */ + typedef OutboundPathKey_T ChildKey_T; + + /** Define the map of ContentChild_T. */ + typedef BomMap_T<ContentChild_T> ChildrenMap_T; + + /** Definition allowing to retrieve the associated children type. */ + typedef boost::mpl::vector <OutboundPathStructure<ContentChild_T>, + BomStopStructure> ChildrenBomTypeList_T; + + /** Definition allowing to retrieve the default children bom holder type. */ + typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; + + /** Definition allowing to retrive the children bom holder type. */ + typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + + + public: + // /////////// Getters ///////////// + /** Get the (parent) NetworkDateStructure object. */ + ParentBomStructure_T* getNetworkDateStructurePtr() const { + return _parent; + } + + /** Get the (parent) NetworkDateStructure object. */ + ParentBomStructure_T& getNetworkDateStructure() const; + + /** Get the airport-date key. */ + const BomKey_T& getKey() const { + assert (_content != NULL); + return _content->getKey(); + } + + /** Get the holder of outbound paths. */ + const ChildrenBomHolder_T& getChildrenHolder() const { + return *_childrenHolder; + } + + /** Get the holder of outbound paths. */ + void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _childrenHolder; + } + + /** Retrieve, if existing, the outbound path corresponding to the + given key. + <br>If not exissting, return the NULL pointer. */ + ContentChild_T* getContentChild (const ChildKey_T& iKey) const { + ContentChild_T* oContentChild_ptr = NULL; + + ChildrenMap_T lChildrenMap (getChildrenHolder()); + const MapKey_T lMapKey = iKey.toString(); + + typename ChildrenMap_T::iterator itContentChild = + lChildrenMap.find (lMapKey); + + if (itContentChild != lChildrenMap.end()) { + oContentChild_ptr = itContentChild->second; + assert (oContentChild_ptr != NULL); + } + + return oContentChild_ptr; + } + + private: + // /////////// Setters ///////////// + /** Set the (parent) NetworkDateStructure object. */ + void setNetworkDateStructure (ParentBomStructure_T& ioNetworkDateStructure) { + _parent = &ioNetworkDateStructure; + } + + /** Default children holder setter. */ + void setChildrenHolder (DefaultChildrenBomHolder_T&) { } + + /** Set the outbound path children holder. */ + void setChildrenHolder (ChildrenBomHolder_T& ioChildrenHolder) { + _childrenHolder = &ioChildrenHolder; + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + /** 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 { return describeKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + 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 getKey().toString(); } + + private: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + AirportDateStructure () : _parent (NULL), _content (NULL), + _childrenHolder (NULL) { } + AirportDateStructure (const AirportDateStructure&); + + /** Destructor. */ + virtual ~AirportDateStructure() { } + + private: + // Attributes + /** Parent network-date. */ + ParentBomStructure_T* _parent; + + /** The actual functional (Business Object) content. */ + BOM_CONTENT* _content; + + /** Holder of outbound paths. */ + ChildrenBomHolder_T* _childrenHolder; + }; + +} +#endif // __STDAIR_BOM_AIRPORTDATESTRUCTURE_HPP Copied: trunk/stdair/stdair/bom/AirportDateTypes.hpp (from rev 87, trunk/stdair/stdair/bom/LegDateTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/AirportDateTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/AirportDateTypes.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,36 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_AIRPORTDATETYPES_HPP +#define __STDAIR_BOM_AIRPORTDATETYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename BOM_CONTENT> class AirportDateStructure; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class AirportDate; + + /** Define the AirportDate structure. */ + typedef AirportDateStructure<AirportDate> AirportDateStructure_T; + + /** Define the airport-date structure list. */ + typedef std::vector<AirportDateStructure_T*> AirportDateStructureList_T; + + /** Define the airport-date structure map. */ + typedef std::map<const std::string, AirportDateStructure_T*> AirportDateStructureMap_T; + + /** Define the airport-date list. */ + typedef BomList_T<AirportDate> AirportDateList_T; + + /** Define the airport-date map. */ + typedef BomMap_T<AirportDate> AirportDateMap_T; +} +#endif // __STDAIR_BOM_AIRPORTDATETYPES_HPP + Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -9,6 +9,7 @@ #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> #include <stdair/bom/Inventory.hpp> +#include <stdair/bom/Network.hpp> namespace stdair { @@ -31,6 +32,17 @@ return _bomRootStructure.getChildrenHolder(); } + // //////////////////////////////////////////////////////////////////// + NetworkList_T BomRoot::getNetworkList () const { + return _bomRootStructure.getSecondChildrenHolder(); + } + + // //////////////////////////////////////////////////////////////////// + NetworkMap_T BomRoot::getNetworkMap () const { + return _bomRootStructure.getSecondChildrenHolder(); + } + + // //////////////////////////////////////////////////////////////////// Inventory* BomRoot::getInventory (const AirlineCode_T& iAirlineCode) const { Inventory* oInventory_ptr = NULL; @@ -43,5 +55,19 @@ return oInventory_ptr; } + + // //////////////////////////////////////////////////////////////////// + Network* BomRoot::getNetwork (const NetworkID_T& iNetworkID) const { + Network* oNetwork_ptr = NULL; + + NetworkMap_T lNetworkMap = getNetworkMap (); + NetworkMap_T::iterator itNetwork = lNetworkMap.find (iNetworkID); + + if (itNetwork != lNetworkMap.end()) { + oNetwork_ptr = itNetwork->second; + } + + return oNetwork_ptr; + } } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -11,6 +11,7 @@ #include <stdair/bom/BomRootContent.hpp> #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/NetworkTypes.hpp> namespace stdair { // Forward declarations. @@ -60,6 +61,10 @@ /** Definition allowing to retrieve the associated BOM content child type. */ typedef Inventory ContentChild_T; + + /** Definition allowing to retrieve the associated second + BOM content child type. */ + typedef Network SecondContentChild_T; // ///////////////////////////////////////////////////////////////////////// @@ -104,6 +109,12 @@ /** Get a InventoryMap_T for iteration methods. */ InventoryMap_T getInventoryMap () const; + + /** Get a NetworkList_T for iteration methods. */ + NetworkList_T getNetworkList () const; + + /** Get a NetworkMap_T for iteration methods. */ + NetworkMap_T getNetworkMap () const; /** Get the reference of the AirlineFeatureSet object. */ const AirlineFeatureSet& getAirlineFeatureSet() const { @@ -115,6 +126,11 @@ given airline code (Inventory key). <br>If not existing, return the NULL pointer. */ Inventory* getInventory (const AirlineCode_T&) const; + + /** Retrieve, if existing, the Network corresponding to the + given airline code (Network key). + <br>If not existing, return the NULL pointer. */ + Network* getNetwork (const NetworkID_T&) const; public: // //////////// Setters ////////////// Modified: trunk/stdair/stdair/bom/BomRootStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRootStructure.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/BomRootStructure.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -12,6 +12,7 @@ #include <stdair/bom/BomStopStructure.hpp> #include <stdair/bom/BomStopContent.hpp> #include <stdair/bom/InventoryStructure.hpp> +#include <stdair/bom/NetworkStructure.hpp> namespace stdair { /** Wrapper class aimed at holding the actual content, modeled @@ -30,21 +31,30 @@ /** Definition allowing to retrieve the children type of the BOM_CONTENT. */ typedef typename BOM_CONTENT::ContentChild_T ContentChild_T; - + + /** Definition allowing to retrieve the second children type of the + BOM_CONTENT. */ + typedef typename BOM_CONTENT::SecondContentChild_T SecondContentChild_T; + private: // Type definitions /** Definition allowing to retrieve the associated BOM key type. */ typedef typename BOM_CONTENT::BomKey_T BomKey_T; /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, BomStopStructure> ChildrenBomTypeList_T; - + typedef boost::mpl::vector<InventoryStructure<ContentChild_T>, + NetworkStructure<SecondContentChild_T> > ChildrenBomTypeList_T; + /** Definition allowing to retrive the default children bom holder type. */ typedef BomChildrenHolderImp<BomStopContent> DefaultChildrenBomHolder_T; - + /** Definition allowing to retrive the children bom holder type. */ typedef BomChildrenHolderImp<ContentChild_T> ChildrenBomHolder_T; + /** Definition allowing to retrive the second children bom holder type. */ + typedef BomChildrenHolderImp<SecondContentChild_T> SecondChildrenBomHolder_T; + + public: // /////////// Getters ///////////// /** Get the BomRootStructure key. */ @@ -59,11 +69,22 @@ return *_childrenHolder; } + /** Get the holder of networks. */ + const SecondChildrenBomHolder_T& getSecondChildrenHolder() const { + assert (_secondChildrenHolder != NULL); + return *_secondChildrenHolder; + } + /** Get the holder of inventories. */ void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { ioChildrenHolder = _childrenHolder; } + /** Get the holder of networks. */ + void getChildrenHolder (SecondChildrenBomHolder_T*& ioChildrenHolder) { + ioChildrenHolder = _secondChildrenHolder; + } + private: /////////////// Setters //////////////// /** Default children holder setter. */ @@ -74,6 +95,11 @@ _childrenHolder = &ioChildrenHolder; } + /** Set the network children holder. */ + void setChildrenHolder (SecondChildrenBomHolder_T& ioChildrenHolder) { + _secondChildrenHolder = &ioChildrenHolder; + } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -101,7 +127,8 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - BomRootStructure () : _content (NULL), _childrenHolder (NULL) { }; + BomRootStructure () : _content (NULL), _childrenHolder (NULL), + _secondChildrenHolder (NULL) { }; BomRootStructure (const BomRootStructure&); /** Destructor. */ @@ -114,6 +141,9 @@ /** Holder of inventories. */ ChildrenBomHolder_T* _childrenHolder; + + /** Holder of networks. */ + SecondChildrenBomHolder_T* _secondChildrenHolder; }; } Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -17,7 +17,7 @@ struct BookingClassKey_T; /** Class representing the actual functional/business content for a - segment-cabin. */ + booking class. */ class BookingClass : public BookingClassContent { friend class FacBomContent; Modified: trunk/stdair/stdair/bom/BookingClassKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassKey.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/BookingClassKey.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -10,7 +10,7 @@ #include <stdair/bom/SegmentCabinKey.hpp> namespace stdair { - /** Key of segment-cabin. */ + /** Key of booking-class. */ struct BookingClassKey_T : public BomKey_T { public: Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2010-01-04 20:06:45 UTC (rev 87) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -42,8 +42,8 @@ BOM content child type. */ typedef SegmentDate ContentChild_T; - /** Definition allowing to retrieve the associated second - BOM content child type. */ + /** Definition allowing to retrieve the associated second + BOM content child type. */ typedef LegDate SecondContentChild_T; /** Definition allowing to retrieve the specific BookingClass type. */ Added: trunk/stdair/stdair/bom/Network.cpp =================================================================== --- trunk/stdair/stdair/bom/Network.cpp (rev 0) +++ trunk/stdair/stdair/bom/Network.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,68 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/NetworkStructure.hpp> +#include <stdair/bom/Network.hpp> +#include <stdair/bom/NetworkDate.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + Network::Network (const BomKey_T& iKey, + BomStructure_T& ioNetworkStructure) + : NetworkContent (iKey), _networkStructure (ioNetworkStructure) { + } + + // //////////////////////////////////////////////////////////////////// + Network::~Network () { + } + + // ////////////////////////////////////////////////////////////////////// + void Network::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void Network::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string Network::toString() const { + std::ostringstream oStr; + oStr << _key.toString(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Network::describeKey() const { + return _networkStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Network::describeShortKey() const { + return _networkStructure.describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + NetworkDateList_T Network::getNetworkDateList () const { + return _networkStructure.getChildrenHolder(); + } + + // ////////////////////////////////////////////////////////////////////// + NetworkDateMap_T Network::getNetworkDateMap () const { + return _networkStructure.getChildrenHolder(); + } + + // ////////////////////////////////////////////////////////////////////// + NetworkDate* Network:: + getNetworkDate (const NetworkDateKey_T& iKey) const { + return _networkStructure.getContentChild (iKey); + } + +} + Added: trunk/stdair/stdair/bom/Network.hpp =================================================================== --- trunk/stdair/stdair/bom/Network.hpp (rev 0) +++ trunk/stdair/stdair/bom/Network.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,109 @@ +#ifndef __STDAIR_BOM_NETWORK_HPP +#define __STDAIR_BOM_NETWORK_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/NetworkStructure.hpp> +#include <stdair/bom/NetworkTypes.hpp> +#include <stdair/bom/NetworkDateTypes.hpp> +#include <stdair/bom/NetworkContent.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + struct NetworkDateKey_T; + struct NetworkKey_T; + + /** Class representing the actual functional/business content for + a network. */ + class Network : public NetworkContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef BomRoot Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef NetworkStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef NetworkKey_T BomKey_T; + + /** Definition allowing to retrieve the associated BOM content child + type. */ + typedef NetworkDate ContentChild_T; + + /** Definition allowing to retrieve the specific BookingClass type. */ + typedef BookingClass BookingClassContent_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 NetworkDateList_T for iteration methods. */ + NetworkDateList_T getNetworkDateList () const; + + /** Get a NetworkDateMap_T for iteration methods. */ + NetworkDateMap_T getNetworkDateMap () const; + + /** Retrieve, if existing, the NetworkDate corresponding to the + given network number and network date (NetworkDate key). + <br>If not existing, return the NULL pointer. */ + NetworkDate* getNetworkDate (const NetworkDateKey_T&) const; + + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _networkStructure; + } + + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + Network (); + Network (const Network&); + Network (const BomKey_T&, BomStructure_T&); + + /** Destructor. */ + virtual ~Network(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _networkStructure; + }; + +} +#endif // __STDAIR_BOM_NETWORK_HPP + Copied: trunk/stdair/stdair/bom/NetworkContent.cpp (from rev 87, trunk/stdair/stdair/bom/InventoryContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/NetworkContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkContent.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,20 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/NetworkContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + NetworkContent::NetworkContent (const BomKey_T& iKey) : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + NetworkContent::~NetworkContent () { + } + +} + Copied: trunk/stdair/stdair/bom/NetworkContent.hpp (from rev 87, trunk/stdair/stdair/bom/InventoryContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/NetworkContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkContent.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,66 @@ +#ifndef __STDAIR_BOM_NETWORKCONTENT_HPP +#define __STDAIR_BOM_NETWORKCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/NetworkKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline network. */ + class NetworkContent : public BomContent { + public : + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef NetworkKey_T BomKey_T; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + public: + // ////////// Getters //////////// + /** Get the network key. */ + const BomKey_T& getKey() const { + return _key; + } + + + protected: + /** Default constructors. */ + NetworkContent (const BomKey_T&); + NetworkContent (const NetworkContent&); + + /** Destructor. */ + virtual ~NetworkContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + }; + +} +#endif // __STDAIR_BOM_NETWORKCONTENT_HPP + Copied: trunk/stdair/stdair/bom/NetworkDate.cpp (from rev 87, trunk/stdair/stdair/bom/Inventory.cpp) =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.cpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkDate.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,62 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/NetworkDateStructure.hpp> +#include <stdair/bom/NetworkDate.hpp> +#include <stdair/bom/AirportDate.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + NetworkDate::NetworkDate (const BomKey_T& iKey, + BomStructure_T& ioNetworkDateStructure) + : NetworkDateContent (iKey), _networkDateStructure (ioNetworkDateStructure) { + } + + // //////////////////////////////////////////////////////////////////// + NetworkDate::~NetworkDate () { + } + + // ////////////////////////////////////////////////////////////////////// + void NetworkDate::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // ////////////////////////////////////////////////////////////////////// + void NetworkDate::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + std::string NetworkDate::toString() const { + std::ostringstream oStr; + oStr << _key.toString(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string NetworkDate::describeKey() const { + return _networkDateStructure.describeKey(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string NetworkDate::describeShortKey() const { + return _networkDateStructure.describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + AirportDateList_T NetworkDate::getAirportDateList () const { + return _networkDateStructure.getChildrenHolder(); + } + + // ////////////////////////////////////////////////////////////////////// + AirportDateMap_T NetworkDate::getAirportDateMap () const { + return _networkDateStructure.getChildrenHolder(); + } + +} + Added: trunk/stdair/stdair/bom/NetworkDate.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.hpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkDate.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,104 @@ +#ifndef __STDAIR_BOM_NETWORKDATE_HPP +#define __STDAIR_BOM_NETWORKDATE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/NetworkDateStructure.hpp> +#include <stdair/bom/NetworkDateTypes.hpp> +#include <stdair/bom/AirportDateTypes.hpp> +#include <stdair/bom/BookingClassTypes.hpp> +#include <stdair/bom/NetworkDateContent.hpp> + +namespace stdair { + // Forward declarations + class FacBomContent; + struct AirportDateKey_T; + struct NetworkDateKey_T; + + /** Class representing the actual functional/business content for + a network-date. */ + class NetworkDate : public NetworkDateContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef BomRoot Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef NetworkDateStructure_T BomStructure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef NetworkDateKey_T BomKey_T; + + /** Definition allowing to retrieve the associated BOM content child + type. */ + typedef AirportDate ContentChild_T; + + /** Definition allowing to retrieve the specific BookingClass type. */ + typedef BookingClass BookingClassContent_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 AirportDateList_T for iteration methods. */ + AirportDateList_T getAirportDateList () const; + + /** Get a AirportDateMap_T for iteration methods. */ + AirportDateMap_T getAirportDateMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getBomStructure () { + return _networkDateStructure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + NetworkDate (); + NetworkDate (const NetworkDate&); + NetworkDate (const BomKey_T&, BomStructure_T&); + + /** Destructor. */ + virtual ~NetworkDate(); + + protected: + // Attributes + /** Reference structure. */ + BomStructure_T& _networkDateStructure; + + }; + +} +#endif // __STDAIR_BOM_NETWORKDATE_HPP + Copied: trunk/stdair/stdair/bom/NetworkDateContent.cpp (from rev 87, trunk/stdair/stdair/bom/InventoryContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/NetworkDateContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkDateContent.cpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,20 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/NetworkDateContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + NetworkDateContent::NetworkDateContent (const BomKey_T& iKey) : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + NetworkDateContent::~NetworkDateContent () { + } + +} + Copied: trunk/stdair/stdair/bom/NetworkDateContent.hpp (from rev 87, trunk/stdair/stdair/bom/InventoryContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/NetworkDateContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/NetworkDateContent.hpp 2010-01-06 16:53:49 UTC (rev 88) @@ -0,0 +1,66 @@ +#ifndef __STDAIR_BOM_NETWORKDATECONTENT_HPP +#define __STDAIR_BOM_NETWORKDATECONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/NetworkDateKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for a network-date. */ + class NetworkDateContent : public ... [truncated message content] |