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] |