From: <qua...@us...> - 2010-04-06 12:47:33
|
Revision: 165 http://stdair.svn.sourceforge.net/stdair/?rev=165&view=rev Author: quannaus Date: 2010-04-06 12:47:26 +0000 (Tue, 06 Apr 2010) Log Message: ----------- [dev] test new implementation. Modified Paths: -------------- trunk/stdair/stdair/Makefile.am trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Added Paths: ----------- trunk/stdair/stdair/batches/Makefile.am trunk/stdair/stdair/batches/sources.mk trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BRKey.hpp trunk/stdair/stdair/bom/BRTypes.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/INKey.hpp trunk/stdair/stdair/bom/INTypes.hpp trunk/stdair/stdair/bom/Structure.hpp Modified: trunk/stdair/stdair/Makefile.am =================================================================== --- trunk/stdair/stdair/Makefile.am 2010-03-27 18:17:00 UTC (rev 164) +++ trunk/stdair/stdair/Makefile.am 2010-04-06 12:47:26 UTC (rev 165) @@ -6,7 +6,7 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = basic bom dbadaptor factory command config service core +SUBDIRS = basic bom dbadaptor factory command config service core batches #EXTRA_DIST = config_msvc.h EXTRA_DIST = Added: trunk/stdair/stdair/batches/Makefile.am =================================================================== --- trunk/stdair/stdair/batches/Makefile.am (rev 0) +++ trunk/stdair/stdair/batches/Makefile.am 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,18 @@ +# batches +include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk + +## Source directory + +MAINTAINERCLEANFILES = Makefile.in + + +# Binaries (batches) +bin_PROGRAMS = stdair + +stdair_SOURCES = $(batches_h_sources) $(batches_cc_sources) +stdair_CXXFLAGS = $(BOOST_CFLAGS) +stdair_LDADD = +stdair_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(top_builddir)/stdair/core/libstdair.la \ + $(top_builddir)/stdair/core/libstdair.la Added: trunk/stdair/stdair/batches/sources.mk =================================================================== --- trunk/stdair/stdair/batches/sources.mk (rev 0) +++ trunk/stdair/stdair/batches/sources.mk 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,2 @@ +batches_h_sources = +batches_cc_sources = $(top_srcdir)/stdair/batches/stdair.cpp Added: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp (rev 0) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,37 @@ +// STL +#include <cassert> +#include <iostream> +#include <sstream> +#include <fstream> +#include <string> +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/STDAIR_Service.hpp> +#include <stdair/bom/BR.hpp> +#include <stdair/bom/BRKey.hpp> +#include <stdair/bom/BRTypes.hpp> +#include <stdair/bom/IN.hpp> +#include <stdair/bom/INKey.hpp> +#include <stdair/bom/INTypes.hpp> +#include <stdair/factory/FacBomContent.hpp> + + +// ///////// M A I N //////////// +int main (int argc, char* argv[]) { + try { + + stdair::BRKey_T lBRKey (); + stdair::BR& lBR = + stdair::FacBomContent::instance().testCreate<stdair::BR> (lBRKey); + + + } catch (const std::exception& stde) { + std::cerr << "Standard exception: " << stde.what() << std::endl; + return -1; + + } catch (...) { + return -1; + } + + return 0; +} Added: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp (rev 0) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,97 @@ +#ifndef __STDAIR_BOM_BR_HPP +#define __STDAIR_BOM_BR_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BRKey.hpp> +#include <stdair/bom/BRTypes.hpp> +#include <stdair/bom/INTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + class IN; + + /** Class representing the actual functional/business content + for the Bom root. */ + class BR : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BRStructure_T Structure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BRKey_T Key_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map<boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_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 ///////////// + + + public: + // //////////// Setters ////////////// + + private: + /** Retrieve the BOM structure object. */ + Structure_T& getStructure () { + return _structure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BR (); + BR (const BR&); + BR (const Key_T&, Structure_T&); + /** Destructor. */ + virtual ~BR(); + + private: + // Attributes + /** Key. */ + Key_T _key; + + /** Reference structure. */ + Structure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_BR_HPP Added: trunk/stdair/stdair/bom/BRKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BRKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BRKey.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,10 @@ +#ifndef __STDAIR_BOM_BRKEY_HPP +#define __STDAIR_BOM_BRKEY_HPP + +namespace stdair { + struct BRKey_T { + + }; +} + +#endif // __STDAIR_BOM_BRKEY_HPP Added: trunk/stdair/stdair/bom/BRTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BRTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BRTypes.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,19 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BRTYPES_HPP +#define __STDAIR_BOM_BRTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + class BR; + + /** Define the BomRootStructure. */ + typedef Structure<BR> BRStructure_T; + +} +#endif // __STDAIR_BOM_BRTYPES_HPP + Added: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp (rev 0) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,91 @@ +#ifndef __STDAIR_BOM_IN_HPP +#define __STDAIR_BOM_IN_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/INTypes.hpp> +#include <stdair/bom/INKey.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + + /** Class representing the actual functional/business content + for the Bom root. */ + class IN : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef INStructure_T Structure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef INKey_T Key_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 ///////////// + + + public: + // //////////// Setters ////////////// + + private: + /** Retrieve the BOM structure object. */ + Structure_T& getStructure () { + return _structure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + IN (); + IN (const IN&); + IN (const Key_T&, Structure_T&); + /** Destructor. */ + virtual ~IN(); + + private: + // Attributes + /** Key. */ + Key_T _key; + + /** Reference structure. */ + Structure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_IN_HPP Added: trunk/stdair/stdair/bom/INKey.hpp =================================================================== --- trunk/stdair/stdair/bom/INKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/INKey.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,10 @@ +#ifndef __STDAIR_BOM_INKEY_HPP +#define __STDAIR_BOM_INKEY_HPP + +namespace stdair { + struct INKey_T { + + }; +} + +#endif // __STDAIR_BOM_INKEY_HPP Added: trunk/stdair/stdair/bom/INTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/INTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/INTypes.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,23 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_INTYPES_HPP +#define __STDAIR_BOM_INTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + class IN; + + /** Define the BomRootStructure. */ + typedef Structure<IN> INStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<IN> INHolder_T; + +} +#endif // __STDAIR_BOM_INTYPES_HPP + Added: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp (rev 0) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -0,0 +1,81 @@ +#ifndef __STDAIR_BOM_STRUCTURE_HPP +#define __STDAIR_BOM_STRUCTURE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomStructure.hpp> + +namespace stdair { + /** Wrapper class aimed at holding the actual content, modeled + by a specific BomContentRoot class. */ + template <typename CONTENT> + class Structure : public BomStructure { + friend class FacBomStructure; + friend class FacBomContent; + friend class BomStructure; + + public: + // Type definitions + /** Definition allowing to retrieve the associated key type. */ + typedef typename CONTENT::Key_T Key_T; + + /** Definition allowing to retrieve the map of children holder type. */ + typedef typename CONTENT::ChildrenHolderTypeMap_T ChildrenHolderTypeMap_T; + + public: + // ////////// GETTERS //////////// + const Key_T& getKey () { + assert (_content != NULL); + return _content->getKey(); + } + + private: + 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 describeShortKey(); } + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const { return getKey().describe(); } + + /** 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. */ + Structure () : _content (NULL) { }; + Structure (const Structure&); + + /** Destructor. */ + ~Structure () { } + + private: + // Attributes + /** The actual functional (Business Object) content. */ + CONTENT* _content; + + /** The map of children holders. */ + ChildrenHolderTypeMap_T _holderMap; + }; + +} +#endif // __STDAIR_BOM_STRUCTURE_HPP + Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-03-27 18:17:00 UTC (rev 164) +++ trunk/stdair/stdair/bom/sources.mk 2010-04-06 12:47:26 UTC (rev 165) @@ -93,7 +93,14 @@ $(top_srcdir)/stdair/bom/EventStruct.hpp \ $(top_srcdir)/stdair/bom/EventQueue.hpp \ $(top_srcdir)/stdair/bom/EventTypes.hpp \ - $(top_srcdir)/stdair/bom/BomManager.hpp + $(top_srcdir)/stdair/bom/BomManager.hpp \ + $(top_srcdir)/stdair/bom/Structure.hpp \ + $(top_srcdir)/stdair/bom/BR.hpp \ + $(top_srcdir)/stdair/bom/BRKey.hpp \ + $(top_srcdir)/stdair/bom/BRTypes.hpp \ + $(top_srcdir)/stdair/bom/IN.hpp \ + $(top_srcdir)/stdair/bom/INKey.hpp \ + $(top_srcdir)/stdair/bom/INTypes.hpp bom_cc_sources = \ $(top_srcdir)/stdair/bom/BomRootKey.cpp \ $(top_srcdir)/stdair/bom/InventoryKey.cpp \ Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-03-27 18:17:00 UTC (rev 164) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -33,7 +33,55 @@ public: /** Define the list (pool) of Bom objects. */ typedef std::vector<BomContent*> BomContentPool_T; + + + + + + + // ////////////////////////////////////////////////////////////////// public: + template <typename CONTENT> + CONTENT& testCreate (const typename CONTENT::Key_T& iKey) { + typedef typename CONTENT::Key_T KEY_T; + + // Create the structure/holder object + typedef typename CONTENT::Structure_T STRUCTURE_T; + STRUCTURE_T& lStructure = + FacBomStructure::instance().testCreate<STRUCTURE_T> (); + + + CONTENT* aContent_ptr = new CONTENT (iKey, lStructure); + assert (aContent_ptr != NULL); + + // The new object is added to the pool of content objects + _contentPool.push_back (aContent_ptr); + + // Link the structure/holder object with its corresponding content object + testSetContent<STRUCTURE_T, CONTENT> (lStructure, *aContent_ptr); + + return *aContent_ptr; + } + + private: + /** Link the structure/holder object with its corresponding content + object. */ + template<typename STRUCTURE, typename CONTENT> + static void testSetContent (STRUCTURE& ioStructure, + CONTENT& ioContent) { + ioStructure._content = &ioContent; + } + + + + + + + + + // ////////////////////////////////////////////////////////////////// + + public: /** Create the root of the BOM tree, i.e., a pair of linked BomRootStructure and BomRoot objects. */ template <typename BOM_ROOT> Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-03-27 18:17:00 UTC (rev 164) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-06 12:47:26 UTC (rev 165) @@ -62,8 +62,38 @@ <br>The singleton is instantiated when first used. @return FacBomStructure& */ static FacBomStructure& instance(); + + + // ////////////////////////////////////////////////////////////////// + + public: /** Create a structure object with the given key. */ + template <typename STRUCTURE> + STRUCTURE& testCreate () { + STRUCTURE* aStructure_ptr = NULL; + + aStructure_ptr = new STRUCTURE (); + assert (aStructure_ptr != NULL); + + // The new object is added to the pool of structure objects + _structurePool.push_back (aStructure_ptr); + + return *aStructure_ptr; + } + + + + + + + + + + // ////////////////////////////////////////////////////////////////// + + + /** Create a structure object with the given key. */ template <typename BOM_STRUCTURE> BOM_STRUCTURE& create () { BOM_STRUCTURE* aBomStructure_ptr = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-06 14:19:06
|
Revision: 166 http://stdair.svn.sourceforge.net/stdair/?rev=166&view=rev Author: quannaus Date: 2010-04-06 14:19:00 +0000 (Tue, 06 Apr 2010) Log Message: ----------- [dev] test new implementation. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BRKey.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/INKey.hpp trunk/stdair/stdair/bom/INTypes.hpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp Added Paths: ----------- trunk/stdair/stdair/bom/BS.hpp trunk/stdair/stdair/bom/BSKey.hpp trunk/stdair/stdair/bom/BSTypes.hpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/FDKey.hpp trunk/stdair/stdair/bom/FDTypes.hpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/NDKey.hpp trunk/stdair/stdair/bom/NDTypes.hpp Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 14:19:00 UTC (rev 166) @@ -6,24 +6,32 @@ #include <string> // StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/STDAIR_Service.hpp> #include <stdair/bom/BR.hpp> #include <stdair/bom/BRKey.hpp> #include <stdair/bom/BRTypes.hpp> #include <stdair/bom/IN.hpp> #include <stdair/bom/INKey.hpp> #include <stdair/bom/INTypes.hpp> +#include <stdair/bom/FD.hpp> +#include <stdair/bom/FDKey.hpp> +#include <stdair/bom/FDTypes.hpp> +#include <stdair/bom/ND.hpp> +#include <stdair/bom/NDKey.hpp> +#include <stdair/bom/NDTypes.hpp> #include <stdair/factory/FacBomContent.hpp> // ///////// M A I N //////////// int main (int argc, char* argv[]) { try { - - stdair::BRKey_T lBRKey (); + stdair::BRKey_T lBRKey; stdair::BR& lBR = stdair::FacBomContent::instance().testCreate<stdair::BR> (lBRKey); + stdair::INKey_T lINKey ("BA"); + stdair::IN& lIN = + stdair::FacBomContent::instance().testCreate<stdair::IN> (lINKey); + } catch (const std::exception& stde) { std::cerr << "Standard exception: " << stde.what() << std::endl; Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -35,7 +35,8 @@ typedef BRKey_T Key_T; /** Define the list of children holder types. */ - typedef boost::fusion::map<boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_T; + typedef boost::fusion::map< + boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_T; // ///////////////////////////////////////////////////////////////////////// public: @@ -62,7 +63,9 @@ public: // /////////// Getters ///////////// - + const Key_T& getKey () const { + return _key; + } public: // //////////// Setters ////////////// @@ -79,9 +82,10 @@ /** Default constructors. */ BR (); BR (const BR&); - BR (const Key_T&, Structure_T&); + BR (const Key_T& iKey, Structure_T& ioStructure) + : _key (iKey), _structure (ioStructure) { } /** Destructor. */ - virtual ~BR(); + virtual ~BR() { } private: // Attributes Modified: trunk/stdair/stdair/bom/BRKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BRKey.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/BRKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -4,6 +4,24 @@ namespace stdair { struct BRKey_T { + // /////////// Display support methods ///////// + void toStream (std::ostream& ioOut) const { + ioOut << "BRKey: " << toString() << std::endl; + } + + void fromStream (std::istream& ioIn) { + } + + const std::string toString() const { + std::ostringstream oStr; + oStr << " -- ROOT -- "; + return oStr.str(); + } + + const std::string describe() const { + return toString(); + } + }; } Copied: trunk/stdair/stdair/bom/BS.hpp (from rev 165, trunk/stdair/stdair/bom/BR.hpp) =================================================================== --- trunk/stdair/stdair/bom/BS.hpp (rev 0) +++ trunk/stdair/stdair/bom/BS.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,99 @@ +#ifndef __STDAIR_BOM_BS_HPP +#define __STDAIR_BOM_BS_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BSKey.hpp> +#include <stdair/bom/BSTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + + /** Class representing the actual functional/business content + for the Bom root. */ + class BS : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BSStructure_T Structure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BSKey_T Key_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<BS, BSHolder_T*> > ChildrenHolderTypeMap_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 ///////////// + const Key_T& getKey () const { + return _key; + } + + public: + // //////////// Setters ////////////// + + private: + /** Retrieve the BOM structure object. */ + Structure_T& getStructure () { + return _structure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BS (); + BS (const BS&); + BS (const Key_T& iKey, Structure_T& ioStructure) + : _key (iKey), _structure (ioStructure) { } + /** Destructor. */ + virtual ~BS() { } + + private: + // Attributes + /** Key. */ + Key_T _key; + + /** Reference structure. */ + Structure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_BS_HPP Copied: trunk/stdair/stdair/bom/BSKey.hpp (from rev 165, trunk/stdair/stdair/bom/BRKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/BSKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BSKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,28 @@ +#ifndef __STDAIR_BOM_BSKEY_HPP +#define __STDAIR_BOM_BSKEY_HPP + +namespace stdair { + struct BSKey_T { + + // /////////// Display support methods ///////// + void toStream (std::ostream& ioOut) const { + ioOut << "BSKey: " << toString() << std::endl; + } + + void fromStream (std::istream& ioIn) { + } + + const std::string toString() const { + std::ostringstream oStr; + oStr << " -- STOP -- "; + return oStr.str(); + } + + const std::string describe() const { + return toString(); + } + + }; +} + +#endif // __STDAIR_BOM_BSKEY_HPP Copied: trunk/stdair/stdair/bom/BSTypes.hpp (from rev 165, trunk/stdair/stdair/bom/BRTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/BSTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BSTypes.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,23 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BSTYPES_HPP +#define __STDAIR_BOM_BSTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + class BS; + + /** Define the BomRootStructure. */ + typedef Structure<BS> BSStructure_T; + + /** Define the BS holder type. */ + typedef BomChildrenHolderImp<BS> BSHolder_T; + +} +#endif // __STDAIR_BOM_BSTYPES_HPP + Copied: trunk/stdair/stdair/bom/FD.hpp (from rev 165, trunk/stdair/stdair/bom/IN.hpp) =================================================================== --- trunk/stdair/stdair/bom/FD.hpp (rev 0) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,98 @@ +#ifndef __STDAIR_BOM_FD_HPP +#define __STDAIR_BOM_FD_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/FDKey.hpp> +#include <stdair/bom/FDTypes.hpp> +#include <stdair/bom/BSTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + + /** Class representing the actual functional/business content + for the Bom root. */ + class FD : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef FDStructure_T Structure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FDKey_T Key_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<BS, BSHolder_T*> > ChildrenHolderTypeMap_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 _key.describe(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.describe(); } + + + public: + // /////////// Getters ///////////// + const Key_T& getKey () const { + return _key; + } + + public: + // //////////// Setters ////////////// + + private: + /** Retrieve the BOM structure object. */ + Structure_T& getStructure () { + return _structure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + FD (); + FD (const FD&); + FD (const Key_T& iKey, Structure_T& ioStructure) + : _key (iKey), _structure (ioStructure) { } + /** Destructor. */ + virtual ~FD() { } + + private: + // Attributes + /** Key. */ + Key_T _key; + + /** Reference structure. */ + Structure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_FD_HPP Copied: trunk/stdair/stdair/bom/FDKey.hpp (from rev 165, trunk/stdair/stdair/bom/INKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/FDKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/FDKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,50 @@ +#ifndef __STDAIR_BOM_FDKEY_HPP +#define __STDAIR_BOM_FDKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + + +namespace stdair { + struct FDKey_T : public BomKey_T { + + // /////////// Display support methods ///////// + void toStream (std::ostream& ioOut) const { + ioOut << "FDKey: " << toString() << std::endl; + } + + void fromStream (std::istream& ioIn) { + } + + const std::string toString() const { + std::ostringstream oStr; + oStr << _flightNumber; + return oStr.str(); + } + + const std::string describe() const { + return toString(); + } + + public: + // /////////// Construction /////////// + /** Constructors. */ + FDKey_T (const int& iFlightNumber) : _flightNumber (iFlightNumber) { } + FDKey_T (const FDKey_T& iKey) + : _flightNumber (iKey._flightNumber) { } + /** Destructor. */ + ~FDKey_T () { } + + private: + // Attributes + /** Flight number. */ + int _flightNumber; + + }; +} + +#endif // __STDAIR_BOM_FDKEY_HPP Copied: trunk/stdair/stdair/bom/FDTypes.hpp (from rev 165, trunk/stdair/stdair/bom/INTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/FDTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FDTypes.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FDTYPES_HPP +#define __STDAIR_BOM_FDTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class FD; + + /** Define the BomRootStructure. */ + typedef Structure<FD> FDStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<FD> FDHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<FD> FDList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<FD> FDMap_T; + +} +#endif // __STDAIR_BOM_FDTYPES_HPP + Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -9,8 +9,10 @@ // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> +#include <stdair/bom/INKey.hpp> #include <stdair/bom/INTypes.hpp> -#include <stdair/bom/INKey.hpp> +#include <stdair/bom/FDTypes.hpp> +#include <stdair/bom/NDTypes.hpp> namespace stdair { // Forward declarations. @@ -29,8 +31,11 @@ /** Definition allowing to retrieve the associated BOM key type. */ typedef INKey_T Key_T; +/** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<FD, FDHolder_T*>, + boost::fusion::pair<ND, NDHolder_T*> > ChildrenHolderTypeMap_T; // ///////////////////////////////////////////////////////////////////////// - public: // /////////// Display support methods ///////// @@ -47,16 +52,18 @@ /** 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 { return _key.describe(); } /** 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 { return _key.describe(); } public: // /////////// Getters ///////////// - + const Key_T& getKey () const { + return _key; + } public: // //////////// Setters ////////////// @@ -73,9 +80,10 @@ /** Default constructors. */ IN (); IN (const IN&); - IN (const Key_T&, Structure_T&); + IN (const Key_T& iKey, Structure_T& ioStructure) + : _key (iKey), _structure (ioStructure) { } /** Destructor. */ - virtual ~IN(); + virtual ~IN() { } private: // Attributes Modified: trunk/stdair/stdair/bom/INKey.hpp =================================================================== --- trunk/stdair/stdair/bom/INKey.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/INKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -1,9 +1,49 @@ #ifndef __STDAIR_BOM_INKEY_HPP #define __STDAIR_BOM_INKEY_HPP +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + + namespace stdair { - struct INKey_T { + struct INKey_T : public BomKey_T { + // /////////// Display support methods ///////// + void toStream (std::ostream& ioOut) const { + ioOut << "INKey: " << toString() << std::endl; + } + + void fromStream (std::istream& ioIn) { + } + + const std::string toString() const { + std::ostringstream oStr; + oStr << _airlineCode; + return oStr.str(); + } + + const std::string describe() const { + return toString(); + } + + public: + // /////////// Construction /////////// + /** Constructors. */ + INKey_T (const AirlineCode_T& iAirlineCode) : _airlineCode (iAirlineCode) { } + INKey_T (const INKey_T& iKey) + : _airlineCode (iKey._airlineCode) { } + /** Destructor. */ + ~INKey_T () { } + + private: + // Attributes + /** Airline code. */ + AirlineCode_T _airlineCode; + }; } Modified: trunk/stdair/stdair/bom/INTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/INTypes.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/INTypes.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -10,6 +10,8 @@ // Forward declarations. template <typename CONTENT> class Structure; template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; class IN; /** Define the BomRootStructure. */ @@ -18,6 +20,12 @@ /** Define the Inventory holder type. */ typedef BomChildrenHolderImp<IN> INHolder_T; + /** Define the Inventory list. */ + typedef BomList_T<IN> INList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<IN> INMap_T; + } #endif // __STDAIR_BOM_INTYPES_HPP Modified: trunk/stdair/stdair/bom/InventoryKey.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/InventoryKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -10,7 +10,6 @@ #include <stdair/bom/BomRootKey.hpp> namespace stdair { - /** Key of inventory. */ struct InventoryKey_T : public BomKey_T { friend struct FlightDateKey_T; @@ -28,7 +27,6 @@ /** Constructors. */ InventoryKey_T (const AirlineCode_T& iAirlineCode); InventoryKey_T (const InventoryKey_T&); - /** Destructor. */ ~InventoryKey_T (); Copied: trunk/stdair/stdair/bom/ND.hpp (from rev 165, trunk/stdair/stdair/bom/IN.hpp) =================================================================== --- trunk/stdair/stdair/bom/ND.hpp (rev 0) +++ trunk/stdair/stdair/bom/ND.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,96 @@ +#ifndef __STDAIR_BOM_ND_HPP +#define __STDAIR_BOM_ND_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/NDKey.hpp> +#include <stdair/bom/NDTypes.hpp> + +namespace stdair { + // Forward declarations. + class FacBomContent; + + /** Class representing the actual functional/business content + for the Bom root. */ + class ND : public BomContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef NDStructure_T Structure_T; + + /** Definition allowing to retrieve the associated BOM key type. */ + typedef NDKey_T Key_T; + +/** Define the list of children holder types. */ + typedef boost::fusion::map< > ChildrenHolderTypeMap_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 _key.describe(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.describe(); } + + + public: + // /////////// Getters ///////////// + const Key_T& getKey () const { + return _key; + } + + public: + // //////////// Setters ////////////// + + private: + /** Retrieve the BOM structure object. */ + Structure_T& getStructure () { + return _structure; + } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + ND (); + ND (const ND&); + ND (const Key_T& iKey, Structure_T& ioStructure) + : _key (iKey), _structure (ioStructure) { } + /** Destructor. */ + virtual ~ND() { } + + private: + // Attributes + /** Key. */ + Key_T _key; + + /** Reference structure. */ + Structure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_ND_HPP Copied: trunk/stdair/stdair/bom/NDKey.hpp (from rev 165, trunk/stdair/stdair/bom/INKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/NDKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/NDKey.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,50 @@ +#ifndef __STDAIR_BOM_NDKEY_HPP +#define __STDAIR_BOM_NDKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + + +namespace stdair { + struct NDKey_T : public BomKey_T { + + // /////////// Display support methods ///////// + void toStream (std::ostream& ioOut) const { + ioOut << "NDKey: " << toString() << std::endl; + } + + void fromStream (std::istream& ioIn) { + } + + const std::string toString() const { + std::ostringstream oStr; + oStr << _networkNumber; + return oStr.str(); + } + + const std::string describe() const { + return toString(); + } + + public: + // /////////// Construction /////////// + /** Constructors. */ + NDKey_T (const int& iNetworkNumber) : _networkNumber (iNetworkNumber) { } + NDKey_T (const NDKey_T& iKey) + : _networkNumber (iKey._networkNumber) { } + /** Destructor. */ + ~NDKey_T () { } + + private: + // Attributes + /** Network number. */ + int _networkNumber; + + }; +} + +#endif // __STDAIR_BOM_NDKEY_HPP Copied: trunk/stdair/stdair/bom/NDTypes.hpp (from rev 165, trunk/stdair/stdair/bom/INTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/NDTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/NDTypes.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_NDTYPES_HPP +#define __STDAIR_BOM_NDTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class ND; + + /** Define the BomRootStructure. */ + typedef Structure<ND> NDStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<ND> NDHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<ND> NDList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<ND> NDMap_T; + +} +#endif // __STDAIR_BOM_NDTYPES_HPP + Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -28,7 +28,7 @@ public: // ////////// GETTERS //////////// - const Key_T& getKey () { + const Key_T& getKey () const { assert (_content != NULL); return _content->getKey(); } Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/bom/sources.mk 2010-04-06 14:19:00 UTC (rev 166) @@ -1,157 +1,163 @@ bom_h_sources = \ - $(top_srcdir)/stdair/bom/BomList.hpp \ - $(top_srcdir)/stdair/bom/BomMap.hpp \ - $(top_srcdir)/stdair/bom/BomKey.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 \ - $(top_srcdir)/stdair/bom/LegCabinKey.hpp \ - $(top_srcdir)/stdair/bom/SegmentDateKey.hpp \ - $(top_srcdir)/stdair/bom/SegmentCabinKey.hpp \ - $(top_srcdir)/stdair/bom/BookingClassKey.hpp \ - $(top_srcdir)/stdair/bom/NetworkKey.hpp \ - $(top_srcdir)/stdair/bom/NetworkDateKey.hpp \ - $(top_srcdir)/stdair/bom/AirportDateKey.hpp \ - $(top_srcdir)/stdair/bom/OutboundPathKey.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureKey.hpp \ - $(top_srcdir)/stdair/bom/DemandStreamKey.hpp \ - $(top_srcdir)/stdair/bom/BomRootTypes.hpp \ - $(top_srcdir)/stdair/bom/BomRoot.hpp \ - $(top_srcdir)/stdair/bom/BomContent.hpp \ - $(top_srcdir)/stdair/bom/BomRootContent.hpp \ - $(top_srcdir)/stdair/bom/BomStopContent.hpp \ - $(top_srcdir)/stdair/bom/BomStructure.hpp \ - $(top_srcdir)/stdair/bom/BomRootStructure.hpp \ - $(top_srcdir)/stdair/bom/BomStopStructure.hpp \ - $(top_srcdir)/stdair/bom/Inventory.hpp \ - $(top_srcdir)/stdair/bom/InventoryContent.hpp \ - $(top_srcdir)/stdair/bom/InventoryTypes.hpp \ - $(top_srcdir)/stdair/bom/InventoryStructure.hpp \ - $(top_srcdir)/stdair/bom/FlightDate.hpp \ - $(top_srcdir)/stdair/bom/FlightDateContent.hpp \ - $(top_srcdir)/stdair/bom/FlightDateTypes.hpp \ - $(top_srcdir)/stdair/bom/FlightDateStructure.hpp \ - $(top_srcdir)/stdair/bom/SegmentDate.hpp \ - $(top_srcdir)/stdair/bom/SegmentDateContent.hpp \ - $(top_srcdir)/stdair/bom/SegmentDateTypes.hpp \ - $(top_srcdir)/stdair/bom/SegmentDateStructure.hpp \ - $(top_srcdir)/stdair/bom/LegDate.hpp \ - $(top_srcdir)/stdair/bom/LegDateContent.hpp \ - $(top_srcdir)/stdair/bom/LegDateTypes.hpp \ - $(top_srcdir)/stdair/bom/LegDateStructure.hpp \ - $(top_srcdir)/stdair/bom/SegmentCabin.hpp \ - $(top_srcdir)/stdair/bom/SegmentCabinContent.hpp \ - $(top_srcdir)/stdair/bom/SegmentCabinTypes.hpp \ - $(top_srcdir)/stdair/bom/SegmentCabinStructure.hpp \ - $(top_srcdir)/stdair/bom/LegCabin.hpp \ - $(top_srcdir)/stdair/bom/LegCabinContent.hpp \ - $(top_srcdir)/stdair/bom/LegCabinTypes.hpp \ - $(top_srcdir)/stdair/bom/LegCabinStructure.hpp \ - $(top_srcdir)/stdair/bom/BookingClass.hpp \ - $(top_srcdir)/stdair/bom/BookingClassContent.hpp \ - $(top_srcdir)/stdair/bom/BookingClassTypes.hpp \ - $(top_srcdir)/stdair/bom/BookingClassStructure.hpp \ - $(top_srcdir)/stdair/bom/Network.hpp \ - $(top_srcdir)/stdair/bom/NetworkContent.hpp \ - $(top_srcdir)/stdair/bom/NetworkTypes.hpp \ - $(top_srcdir)/stdair/bom/NetworkStructure.hpp \ - $(top_srcdir)/stdair/bom/NetworkDate.hpp \ - $(top_srcdir)/stdair/bom/NetworkDateContent.hpp \ - $(top_srcdir)/stdair/bom/NetworkDateTypes.hpp \ - $(top_srcdir)/stdair/bom/NetworkDateStructure.hpp \ - $(top_srcdir)/stdair/bom/AirportDate.hpp \ - $(top_srcdir)/stdair/bom/AirportDateContent.hpp \ - $(top_srcdir)/stdair/bom/AirportDateTypes.hpp \ - $(top_srcdir)/stdair/bom/AirportDateStructure.hpp \ - $(top_srcdir)/stdair/bom/OutboundPath.hpp \ - $(top_srcdir)/stdair/bom/OutboundPathContent.hpp \ - $(top_srcdir)/stdair/bom/OutboundPathTypes.hpp \ - $(top_srcdir)/stdair/bom/OutboundPathStructure.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSet.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetContent.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetTypes.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetStructure.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeature.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureContent.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureTypes.hpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureStructure.hpp \ - $(top_srcdir)/stdair/bom/BomChildrenHolder.hpp \ - $(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/TravelSolutionStruct.hpp \ - $(top_srcdir)/stdair/bom/TravelSolutionTypes.hpp \ - $(top_srcdir)/stdair/bom/BookingRequestStruct.hpp \ - $(top_srcdir)/stdair/bom/AirlineStruct.hpp \ - $(top_srcdir)/stdair/bom/DemandStreamStructure.hpp \ - $(top_srcdir)/stdair/bom/DemandStreamContent.hpp \ - $(top_srcdir)/stdair/bom/DemandStream.hpp \ - $(top_srcdir)/stdair/bom/DemandStreamTypes.hpp \ - $(top_srcdir)/stdair/bom/EventStruct.hpp \ - $(top_srcdir)/stdair/bom/EventQueue.hpp \ - $(top_srcdir)/stdair/bom/EventTypes.hpp \ - $(top_srcdir)/stdair/bom/BomManager.hpp \ - $(top_srcdir)/stdair/bom/Structure.hpp \ - $(top_srcdir)/stdair/bom/BR.hpp \ - $(top_srcdir)/stdair/bom/BRKey.hpp \ - $(top_srcdir)/stdair/bom/BRTypes.hpp \ - $(top_srcdir)/stdair/bom/IN.hpp \ - $(top_srcdir)/stdair/bom/INKey.hpp \ - $(top_srcdir)/stdair/bom/INTypes.hpp + $(top_srcdir)/stdair/bom/BomList.hpp \ + $(top_srcdir)/stdair/bom/BomMap.hpp \ + $(top_srcdir)/stdair/bom/BomKey.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 \ + $(top_srcdir)/stdair/bom/LegCabinKey.hpp \ + $(top_srcdir)/stdair/bom/SegmentDateKey.hpp \ + $(top_srcdir)/stdair/bom/SegmentCabinKey.hpp \ + $(top_srcdir)/stdair/bom/BookingClassKey.hpp \ + $(top_srcdir)/stdair/bom/NetworkKey.hpp \ + $(top_srcdir)/stdair/bom/NetworkDateKey.hpp \ + $(top_srcdir)/stdair/bom/AirportDateKey.hpp \ + $(top_srcdir)/stdair/bom/OutboundPathKey.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureKey.hpp \ + $(top_srcdir)/stdair/bom/DemandStreamKey.hpp \ + $(top_srcdir)/stdair/bom/BomRootTypes.hpp \ + $(top_srcdir)/stdair/bom/BomRoot.hpp \ + $(top_srcdir)/stdair/bom/BomContent.hpp \ + $(top_srcdir)/stdair/bom/BomRootContent.hpp \ + $(top_srcdir)/stdair/bom/BomStopContent.hpp \ + $(top_srcdir)/stdair/bom/BomStructure.hpp \ + $(top_srcdir)/stdair/bom/BomRootStructure.hpp \ + $(top_srcdir)/stdair/bom/BomStopStructure.hpp \ + $(top_srcdir)/stdair/bom/Inventory.hpp \ + $(top_srcdir)/stdair/bom/InventoryContent.hpp \ + $(top_srcdir)/stdair/bom/InventoryTypes.hpp \ + $(top_srcdir)/stdair/bom/InventoryStructure.hpp \ + $(top_srcdir)/stdair/bom/FlightDate.hpp \ + $(top_srcdir)/stdair/bom/FlightDateContent.hpp \ + $(top_srcdir)/stdair/bom/FlightDateTypes.hpp \ + $(top_srcdir)/stdair/bom/FlightDateStructure.hpp \ + $(top_srcdir)/stdair/bom/SegmentDate.hpp \ + $(top_srcdir)/stdair/bom/SegmentDateContent.hpp \ + $(top_srcdir)/stdair/bom/SegmentDateTypes.hpp \ + $(top_srcdir)/stdair/bom/SegmentDateStructure.hpp \ + $(top_srcdir)/stdair/bom/LegDate.hpp \ + $(top_srcdir)/stdair/bom/LegDateContent.hpp \ + $(top_srcdir)/stdair/bom/LegDateTypes.hpp \ + $(top_srcdir)/stdair/bom/LegDateStructure.hpp \ + $(top_srcdir)/stdair/bom/SegmentCabin.hpp \ + $(top_srcdir)/stdair/bom/SegmentCabinContent.hpp \ + $(top_srcdir)/stdair/bom/SegmentCabinTypes.hpp \ + $(top_srcdir)/stdair/bom/SegmentCabinStructure.hpp \ + $(top_srcdir)/stdair/bom/LegCabin.hpp \ + $(top_srcdir)/stdair/bom/LegCabinContent.hpp \ + $(top_srcdir)/stdair/bom/LegCabinTypes.hpp \ + $(top_srcdir)/stdair/bom/LegCabinStructure.hpp \ + $(top_srcdir)/stdair/bom/BookingClass.hpp \ + $(top_srcdir)/stdair/bom/BookingClassContent.hpp \ + $(top_srcdir)/stdair/bom/BookingClassTypes.hpp \ + $(top_srcdir)/stdair/bom/BookingClassStructure.hpp \ + $(top_srcdir)/stdair/bom/Network.hpp \ + $(top_srcdir)/stdair/bom/NetworkContent.hpp \ + $(top_srcdir)/stdair/bom/NetworkTypes.hpp \ + $(top_srcdir)/stdair/bom/NetworkStructure.hpp \ + $(top_srcdir)/stdair/bom/NetworkDate.hpp \ + $(top_srcdir)/stdair/bom/NetworkDateContent.hpp \ + $(top_srcdir)/stdair/bom/NetworkDateTypes.hpp \ + $(top_srcdir)/stdair/bom/NetworkDateStructure.hpp \ + $(top_srcdir)/stdair/bom/AirportDate.hpp \ + $(top_srcdir)/stdair/bom/AirportDateContent.hpp \ + $(top_srcdir)/stdair/bom/AirportDateTypes.hpp \ + $(top_srcdir)/stdair/bom/AirportDateStructure.hpp \ + $(top_srcdir)/stdair/bom/OutboundPath.hpp \ + $(top_srcdir)/stdair/bom/OutboundPathContent.hpp \ + $(top_srcdir)/stdair/bom/OutboundPathTypes.hpp \ + $(top_srcdir)/stdair/bom/OutboundPathStructure.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSet.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetContent.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetTypes.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetStructure.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeature.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureContent.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureTypes.hpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureStructure.hpp \ + $(top_srcdir)/stdair/bom/BomChildrenHolder.hpp \ + $(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/TravelSolutionStruct.hpp \ + $(top_srcdir)/stdair/bom/TravelSolutionTypes.hpp \ + $(top_srcdir)/stdair/bom/BookingRequestStruct.hpp \ + $(top_srcdir)/stdair/bom/AirlineStruct.hpp \ + $(top_srcdir)/stdair/bom/DemandStreamStructure.hpp \ + $(top_srcdir)/stdair/bom/DemandStreamContent.hpp \ + $(top_srcdir)/stdair/bom/DemandStream.hpp \ + $(top_srcdir)/stdair/bom/DemandStreamTypes.hpp \ + $(top_srcdir)/stdair/bom/EventStruct.hpp \ + $(top_srcdir)/stdair/bom/EventQueue.hpp \ + $(top_srcdir)/stdair/bom/EventTypes.hpp \ + $(top_srcdir)/stdair/bom/BomManager.hpp \ + $(top_srcdir)/stdair/bom/Structure.hpp \ + $(top_srcdir)/stdair/bom/BS.hpp \ + $(top_srcdir)/stdair/bom/BSKey.hpp \ + $(top_srcdir)/stdair/bom/BSTypes.hpp \ + $(top_srcdir)/stdair/bom/BRKey.hpp \ + $(top_srcdir)/stdair/bom/BRTypes.hpp \ + $(top_srcdir)/stdair/bom/IN.hpp \ + $(top_srcdir)/stdair/bom/INKey.hpp \ + $(top_srcdir)/stdair/bom/FDTypes.hpp \ + $(top_srcdir)/stdair/bom/FDKey.hpp \ + $(top_srcdir)/stdair/bom/NDTypes.hpp \ + $(top_srcdir)/stdair/bom/NDKey.hpp \ + $(top_srcdir)/stdair/bom/NDTypes.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/LegCabinKey.cpp \ - $(top_srcdir)/stdair/bom/SegmentDateKey.cpp \ - $(top_srcdir)/stdair/bom/SegmentCabinKey.cpp \ - $(top_srcdir)/stdair/bom/BookingClassKey.cpp \ - $(top_srcdir)/stdair/bom/NetworkKey.cpp \ - $(top_srcdir)/stdair/bom/NetworkDateKey.cpp \ - $(top_srcdir)/stdair/bom/AirportDateKey.cpp \ - $(top_srcdir)/stdair/bom/OutboundPathKey.cpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.cpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureKey.cpp \ - $(top_srcdir)/stdair/bom/DemandStreamKey.cpp \ - $(top_srcdir)/stdair/bom/BomRoot.cpp \ - $(top_srcdir)/stdair/bom/BomRootContent.cpp \ - $(top_srcdir)/stdair/bom/Inventory.cpp \ - $(top_srcdir)/stdair/bom/InventoryContent.cpp \ - $(top_srcdir)/stdair/bom/FlightDate.cpp \ - $(top_srcdir)/stdair/bom/FlightDateContent.cpp \ - $(top_srcdir)/stdair/bom/SegmentDate.cpp \ - $(top_srcdir)/stdair/bom/SegmentDateContent.cpp \ - $(top_srcdir)/stdair/bom/LegDate.cpp \ - $(top_srcdir)/stdair/bom/LegDateContent.cpp \ - $(top_srcdir)/stdair/bom/SegmentCabin.cpp \ - $(top_srcdir)/stdair/bom/SegmentCabinContent.cpp \ - $(top_srcdir)/stdair/bom/LegCabin.cpp \ - $(top_srcdir)/stdair/bom/LegCabinContent.cpp \ - $(top_srcdir)/stdair/bom/BookingClass.cpp \ - $(top_srcdir)/stdair/bom/BookingClassContent.cpp \ - $(top_srcdir)/stdair/bom/Network.cpp \ - $(top_srcdir)/stdair/bom/NetworkContent.cpp \ - $(top_srcdir)/stdair/bom/NetworkDate.cpp \ - $(top_srcdir)/stdair/bom/NetworkDateContent.cpp \ - $(top_srcdir)/stdair/bom/AirportDate.cpp \ - $(top_srcdir)/stdair/bom/AirportDateContent.cpp \ - $(top_srcdir)/stdair/bom/OutboundPath.cpp \ - $(top_srcdir)/stdair/bom/OutboundPathContent.cpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSet.cpp \ - $(top_srcdir)/stdair/bom/AirlineFeatureSetContent.cpp \ - $(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/TravelSolutionStruct.cpp \ - $(top_srcdir)/stdair/bom/BookingRequestStruct.cpp \ - $(top_srcdir)/stdair/bom/AirlineStruct.cpp \ - $(top_srcdir)/stdair/bom/DemandStreamContent.cpp \ - $(top_srcdir)/stdair/bom/DemandStream.cpp \ - $(top_srcdir)/stdair/bom/EventStruct.cpp \ - $(top_srcdir)/stdair/bom/EventQueue.cpp \ - $(top_srcdir)/stdair/bom/BomManager.cpp + $(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/LegCabinKey.cpp \ + $(top_srcdir)/stdair/bom/SegmentDateKey.cpp \ + $(top_srcdir)/stdair/bom/SegmentCabinKey.cpp \ + $(top_srcdir)/stdair/bom/BookingClassKey.cpp \ + $(top_srcdir)/stdair/bom/NetworkKey.cpp \ + $(top_srcdir)/stdair/bom/NetworkDateKey.cpp \ + $(top_srcdir)/stdair/bom/AirportDateKey.cpp \ + $(top_srcdir)/stdair/bom/OutboundPathKey.cpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.cpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureKey.cpp \ + $(top_srcdir)/stdair/bom/DemandStreamKey.cpp \ + $(top_srcdir)/stdair/bom/BomRoot.cpp \ + $(top_srcdir)/stdair/bom/BomRootContent.cpp \ + $(top_srcdir)/stdair/bom/Inventory.cpp \ + $(top_srcdir)/stdair/bom/InventoryContent.cpp \ + $(top_srcdir)/stdair/bom/FlightDate.cpp \ + $(top_srcdir)/stdair/bom/FlightDateContent.cpp \ + $(top_srcdir)/stdair/bom/SegmentDate.cpp \ + $(top_srcdir)/stdair/bom/SegmentDateContent.cpp \ + $(top_srcdir)/stdair/bom/LegDate.cpp \ + $(top_srcdir)/stdair/bom/LegDateContent.cpp \ + $(top_srcdir)/stdair/bom/SegmentCabin.cpp \ + $(top_srcdir)/stdair/bom/SegmentCabinContent.cpp \ + $(top_srcdir)/stdair/bom/LegCabin.cpp \ + $(top_srcdir)/stdair/bom/LegCabinContent.cpp \ + $(top_srcdir)/stdair/bom/BookingClass.cpp \ + $(top_srcdir)/stdair/bom/BookingClassContent.cpp \ + $(top_srcdir)/stdair/bom/Network.cpp \ + $(top_srcdir)/stdair/bom/NetworkContent.cpp \ + $(top_srcdir)/stdair/bom/NetworkDate.cpp \ + $(top_srcdir)/stdair/bom/NetworkDateContent.cpp \ + $(top_srcdir)/stdair/bom/AirportDate.cpp \ + $(top_srcdir)/stdair/bom/AirportDateContent.cpp \ + $(top_srcdir)/stdair/bom/OutboundPath.cpp \ + $(top_srcdir)/stdair/bom/OutboundPathContent.cpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSet.cpp \ + $(top_srcdir)/stdair/bom/AirlineFeatureSetContent.cpp \ + $(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/TravelSolutionStruct.cpp \ + $(top_srcdir)/stdair/bom/BookingRequestStruct.cpp \ + $(top_srcdir)/stdair/bom/AirlineStruct.cpp \ + $(top_srcdir)/stdair/bom/DemandStreamContent.cpp \ + $(top_srcdir)/stdair/bom/DemandStream.cpp \ + $(top_srcdir)/stdair/bom/EventStruct.cpp \ + $(top_srcdir)/stdair/bom/EventQueue.cpp \ + $(top_srcdir)/stdair/bom/BomManager.cpp Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-06 12:47:26 UTC (rev 165) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-06 14:19:00 UTC (rev 166) @@ -40,6 +40,7 @@ // ////////////////////////////////////////////////////////////////// + public: template <typename CONTENT> CONTENT& testCreate (const typename CONTENT::Key_T& iKey) { @@ -72,6 +73,7 @@ ioStructure._content = &ioContent; } + // ////////////////////////////////////////////////////////////////// @@ -79,7 +81,8 @@ - // ////////////////////////////////////////////////////////////////// + + public: /** Create the root of the BOM tree, i.e., a pair of linked This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-06 15:34:27
|
Revision: 169 http://stdair.svn.sourceforge.net/stdair/?rev=169&view=rev Author: quannaus Date: 2010-04-06 15:34:20 +0000 (Tue, 06 Apr 2010) Log Message: ----------- [dev] test new implementation. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Removed Paths: ------------- trunk/stdair/stdair/bom/BS.hpp trunk/stdair/stdair/bom/BSKey.hpp trunk/stdair/stdair/bom/BSTypes.hpp Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 15:34:20 UTC (rev 169) @@ -18,6 +18,7 @@ #include <stdair/bom/ND.hpp> #include <stdair/bom/NDKey.hpp> #include <stdair/bom/NDTypes.hpp> +#include <stdair/bom/BomList.hpp> #include <stdair/factory/FacBomContent.hpp> @@ -31,7 +32,40 @@ stdair::INKey_T lINKey ("BA"); stdair::IN& lIN = stdair::FacBomContent::instance().testCreate<stdair::IN> (lINKey); - + stdair::FacBomContent::testLink<stdair::IN> (lIN, lBR); + + stdair::FDKey_T lFDKey (17); + stdair::FD& lFD = + stdair::FacBomContent::instance().testCreate<stdair::FD> (lFDKey); + stdair::FacBomContent::testLink<stdair::FD> (lFD, lIN); + + stdair::NDKey_T lNDKey (1); + stdair::ND& lND = + stdair::FacBomContent::instance().testCreate<stdair::ND> (lNDKey); + stdair::FacBomContent::testLink<stdair::ND> (lND, lIN); + + + // Browse + stdair::INList_T lINList = lBR.getINList(); + for (stdair::INList_T::iterator it = lINList.begin(); + it != lINList.end(); ++it) { + const stdair::IN& lCurrentIN = *it; + std::cout << "Current IN: " << lCurrentIN.toString() << std::endl; + + stdair::FDList_T lFDList = lIN.getFDList(); + for (stdair::FDList_T::iterator it = lFDList.begin(); + it != lFDList.end(); ++it) { + const stdair::FD& lCurrentFD = *it; + std::cout << "Current FD: " << lCurrentFD.toString() << std::endl; + } + stdair::NDList_T lNDList = lIN.getNDList(); + for (stdair::NDList_T::iterator it = lNDList.begin(); + it != lNDList.end(); ++it) { + const stdair::ND& lCurrentND = *it; + std::cout << "Current ND: " << lCurrentND.toString() << std::endl; + } + + } } catch (const std::exception& stde) { std::cerr << "Standard exception: " << stde.what() << std::endl; Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -15,6 +15,8 @@ #include <stdair/bom/BRKey.hpp> #include <stdair/bom/BRTypes.hpp> #include <stdair/bom/INTypes.hpp> +#include <stdair/bom/IN.hpp> +#include <stdair/bom/BomList.hpp> namespace stdair { // Forward declarations. @@ -29,7 +31,7 @@ public: // ///////////////////////////////////////////////////////////////////////// /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BRStructure_T Structure_T; + typedef BRStructure_T BomStructure_T; /** Definition allowing to retrieve the associated BOM key type. */ typedef BRKey_T Key_T; @@ -66,13 +68,17 @@ const Key_T& getKey () const { return _key; } + + const INList_T getINList () const { + return _structure.getChildrenHolder<IN> (); + } public: // //////////// Setters ////////////// private: /** Retrieve the BOM structure object. */ - Structure_T& getStructure () { + BomStructure_T& getStructure () { return _structure; } @@ -82,7 +88,7 @@ /** Default constructors. */ BR (); BR (const BR&); - BR (const Key_T& iKey, Structure_T& ioStructure) + BR (const Key_T& iKey, BomStructure_T& ioStructure) : _key (iKey), _structure (ioStructure) { } /** Destructor. */ virtual ~BR() { } @@ -93,8 +99,7 @@ Key_T _key; /** Reference structure. */ - Structure_T& _structure; - + BomStructure_T& _structure; }; } Deleted: trunk/stdair/stdair/bom/BS.hpp =================================================================== --- trunk/stdair/stdair/bom/BS.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/BS.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -1,99 +0,0 @@ -#ifndef __STDAIR_BOM_BS_HPP -#define __STDAIR_BOM_BS_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -// BOOST Fusion -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> -// STDAIR -#include <stdair/bom/Structure.hpp> -#include <stdair/bom/BomContent.hpp> -#include <stdair/bom/BSKey.hpp> -#include <stdair/bom/BSTypes.hpp> - -namespace stdair { - // Forward declarations. - class FacBomContent; - - /** Class representing the actual functional/business content - for the Bom root. */ - class BS : public BomContent { - friend class FacBomContent; - - public: - // ///////////////////////////////////////////////////////////////////////// - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef BSStructure_T Structure_T; - - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BSKey_T Key_T; - - /** Define the list of children holder types. */ - typedef boost::fusion::map< - boost::fusion::pair<BS, BSHolder_T*> > ChildrenHolderTypeMap_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 ///////////// - const Key_T& getKey () const { - return _key; - } - - public: - // //////////// Setters ////////////// - - private: - /** Retrieve the BOM structure object. */ - Structure_T& getStructure () { - return _structure; - } - - protected: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Default constructors. */ - BS (); - BS (const BS&); - BS (const Key_T& iKey, Structure_T& ioStructure) - : _key (iKey), _structure (ioStructure) { } - /** Destructor. */ - virtual ~BS() { } - - private: - // Attributes - /** Key. */ - Key_T _key; - - /** Reference structure. */ - Structure_T& _structure; - - }; - -} -#endif // __STDAIR_BOM_BS_HPP Deleted: trunk/stdair/stdair/bom/BSKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BSKey.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/BSKey.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -1,28 +0,0 @@ -#ifndef __STDAIR_BOM_BSKEY_HPP -#define __STDAIR_BOM_BSKEY_HPP - -namespace stdair { - struct BSKey_T { - - // /////////// Display support methods ///////// - void toStream (std::ostream& ioOut) const { - ioOut << "BSKey: " << toString() << std::endl; - } - - void fromStream (std::istream& ioIn) { - } - - const std::string toString() const { - std::ostringstream oStr; - oStr << " -- STOP -- "; - return oStr.str(); - } - - const std::string describe() const { - return toString(); - } - - }; -} - -#endif // __STDAIR_BOM_BSKEY_HPP Deleted: trunk/stdair/stdair/bom/BSTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BSTypes.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/BSTypes.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -1,23 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -#ifndef __STDAIR_BOM_BSTYPES_HPP -#define __STDAIR_BOM_BSTYPES_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// - -namespace stdair { - // Forward declarations. - template <typename CONTENT> class Structure; - template <typename CONTENT> class BomChildrenHolderImp; - class BS; - - /** Define the BomRootStructure. */ - typedef Structure<BS> BSStructure_T; - - /** Define the BS holder type. */ - typedef BomChildrenHolderImp<BS> BSHolder_T; - -} -#endif // __STDAIR_BOM_BSTYPES_HPP - Modified: trunk/stdair/stdair/bom/FD.hpp =================================================================== --- trunk/stdair/stdair/bom/FD.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -6,15 +6,18 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/FDKey.hpp> #include <stdair/bom/FDTypes.hpp> -#include <stdair/bom/BSTypes.hpp> namespace stdair { // Forward declarations. + class IN; class FacBomContent; /** Class representing the actual functional/business content @@ -24,15 +27,17 @@ public: // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef IN Parent_T; + /** Definition allowing to retrieve the associated BOM structure type. */ - typedef FDStructure_T Structure_T; + typedef FDStructure_T BomStructure_T; /** Definition allowing to retrieve the associated BOM key type. */ typedef FDKey_T Key_T; /** Define the list of children holder types. */ - typedef boost::fusion::map< - boost::fusion::pair<BS, BSHolder_T*> > ChildrenHolderTypeMap_T; + typedef boost::fusion::map< > ChildrenHolderTypeMap_T; // ///////////////////////////////////////////////////////////////////////// @@ -69,7 +74,7 @@ private: /** Retrieve the BOM structure object. */ - Structure_T& getStructure () { + BomStructure_T& getStructure () { return _structure; } @@ -79,7 +84,7 @@ /** Default constructors. */ FD (); FD (const FD&); - FD (const Key_T& iKey, Structure_T& ioStructure) + FD (const Key_T& iKey, BomStructure_T& ioStructure) : _key (iKey), _structure (ioStructure) { } /** Destructor. */ virtual ~FD() { } @@ -90,7 +95,7 @@ Key_T _key; /** Reference structure. */ - Structure_T& _structure; + BomStructure_T& _structure; }; Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -6,6 +6,9 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> @@ -13,9 +16,13 @@ #include <stdair/bom/INTypes.hpp> #include <stdair/bom/FDTypes.hpp> #include <stdair/bom/NDTypes.hpp> +#include <stdair/bom/FD.hpp> +#include <stdair/bom/ND.hpp> +#include <stdair/bom/BomList.hpp> namespace stdair { // Forward declarations. + class BR; class FacBomContent; /** Class representing the actual functional/business content @@ -25,8 +32,11 @@ public: // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef BR Parent_T; + /** Definition allowing to retrieve the associated BOM structure type. */ - typedef INStructure_T Structure_T; + typedef INStructure_T BomStructure_T; /** Definition allowing to retrieve the associated BOM key type. */ typedef INKey_T Key_T; @@ -64,13 +74,21 @@ const Key_T& getKey () const { return _key; } + + const FDList_T getFDList () const { + return _structure.getChildrenHolder<FD> (); + } + + const NDList_T getNDList () const { + return _structure.getChildrenHolder<ND> (); + } public: // //////////// Setters ////////////// private: /** Retrieve the BOM structure object. */ - Structure_T& getStructure () { + BomStructure_T& getStructure () { return _structure; } @@ -80,7 +98,7 @@ /** Default constructors. */ IN (); IN (const IN&); - IN (const Key_T& iKey, Structure_T& ioStructure) + IN (const Key_T& iKey, BomStructure_T& ioStructure) : _key (iKey), _structure (ioStructure) { } /** Destructor. */ virtual ~IN() { } @@ -91,7 +109,7 @@ Key_T _key; /** Reference structure. */ - Structure_T& _structure; + BomStructure_T& _structure; }; Modified: trunk/stdair/stdair/bom/ND.hpp =================================================================== --- trunk/stdair/stdair/bom/ND.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/ND.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -6,6 +6,9 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> @@ -14,6 +17,7 @@ namespace stdair { // Forward declarations. + class IN; class FacBomContent; /** Class representing the actual functional/business content @@ -23,8 +27,11 @@ public: // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef IN Parent_T; + /** Definition allowing to retrieve the associated BOM structure type. */ - typedef NDStructure_T Structure_T; + typedef NDStructure_T BomStructure_T; /** Definition allowing to retrieve the associated BOM key type. */ typedef NDKey_T Key_T; @@ -67,7 +74,7 @@ private: /** Retrieve the BOM structure object. */ - Structure_T& getStructure () { + BomStructure_T& getStructure () { return _structure; } @@ -77,7 +84,7 @@ /** Default constructors. */ ND (); ND (const ND&); - ND (const Key_T& iKey, Structure_T& ioStructure) + ND (const Key_T& iKey, BomStructure_T& ioStructure) : _key (iKey), _structure (ioStructure) { } /** Destructor. */ virtual ~ND() { } @@ -88,7 +95,7 @@ Key_T _key; /** Reference structure. */ - Structure_T& _structure; + BomStructure_T& _structure; }; Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -6,10 +6,17 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> +#include <boost/fusion/sequence/intrinsic/at_key.hpp> // STDAIR #include <stdair/bom/BomStructure.hpp> namespace stdair { + // Forward declarations. + template <typename CONTENT> class BomChildrenHolderImp; + /** Wrapper class aimed at holding the actual content, modeled by a specific BomContentRoot class. */ template <typename CONTENT> @@ -20,6 +27,9 @@ public: // Type definitions + /** Definition allowing to retrieve the associated content. */ + typedef CONTENT Content_T; + /** Definition allowing to retrieve the associated key type. */ typedef typename CONTENT::Key_T Key_T; @@ -33,6 +43,15 @@ return _content->getKey(); } + template <typename CHILD> + BomChildrenHolderImp<CHILD>& getChildrenHolder () { + BomChildrenHolderImp<CHILD>* lHolder_ptr = + boost::fusion::at_key<CHILD> (_holderMap); + assert (lHolder_ptr != NULL); + + return *lHolder_ptr; + } + private: public: // /////////// Display support methods ///////// Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/bom/sources.mk 2010-04-06 15:34:20 UTC (rev 169) @@ -95,9 +95,6 @@ $(top_srcdir)/stdair/bom/EventTypes.hpp \ $(top_srcdir)/stdair/bom/BomManager.hpp \ $(top_srcdir)/stdair/bom/Structure.hpp \ - $(top_srcdir)/stdair/bom/BS.hpp \ - $(top_srcdir)/stdair/bom/BSKey.hpp \ - $(top_srcdir)/stdair/bom/BSTypes.hpp \ $(top_srcdir)/stdair/bom/BRKey.hpp \ $(top_srcdir)/stdair/bom/BRTypes.hpp \ $(top_srcdir)/stdair/bom/IN.hpp \ Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -13,6 +13,7 @@ #include <stdair/basic/BasConst_Inventory.hpp> #include <stdair/basic/DemandCharacteristicTypes.hpp> #include <stdair/bom/BomStructure.hpp> +#include <stdair/bom/Structure.hpp> #include <stdair/factory/FacBomStructure.hpp> namespace stdair { @@ -47,7 +48,7 @@ typedef typename CONTENT::Key_T KEY_T; // Create the structure/holder object - typedef typename CONTENT::Structure_T STRUCTURE_T; + typedef typename CONTENT::BomStructure_T STRUCTURE_T; STRUCTURE_T& lStructure = FacBomStructure::instance().testCreate<STRUCTURE_T> (); @@ -64,11 +65,41 @@ return *aContent_ptr; } + /** Link a child content objet with his parent. */ + template <typename CHILD> + static void testLink (CHILD& ioChild, typename CHILD::Parent_T& ioParent) { + // Type for the child Bom structure + typedef typename CHILD::BomStructure_T CHILD_STRUCTURE_T; + + // Type for the parent Bom content + typedef typename CHILD::Parent_T PARENT_T; + + // Type for the parent Bom structure + typedef typename PARENT_T::BomStructure_T PARENT_STRUCTURE_T; + + + // Retrieve the child structure object + CHILD_STRUCTURE_T& lStructureChild = ioChild.getStructure (); + + // Retrieve the parent structure object + PARENT_STRUCTURE_T& lStructureParent = ioParent.getStructure (); + + // Link both the parent and child structure objects + const bool hasLinkBeenSuccessful = FacBomStructure:: + testLinkParentWithChild<CHILD_STRUCTURE_T> (lStructureParent, + lStructureChild); + + if (hasLinkBeenSuccessful == false) { + throw ObjectLinkingException(); + } + } + private: /** Link the structure/holder object with its corresponding content object. */ template<typename STRUCTURE, typename CONTENT> static void testSetContent (STRUCTURE& ioStructure, + CONTENT& ioContent) { ioStructure._content = &ioContent; } Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-06 14:33:30 UTC (rev 168) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-06 15:34:20 UTC (rev 169) @@ -17,6 +17,10 @@ #include <boost/mpl/erase.hpp> #include <boost/mpl/begin_end.hpp> #include <boost/type_traits/is_same.hpp> +// BOOST Fusion +#include <boost/fusion/container/map.hpp> +#include <boost/fusion/include/map.hpp> +#include <boost/fusion/sequence/intrinsic/at_key.hpp> // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/basic/BasConst_Inventory.hpp> @@ -83,13 +87,66 @@ } + + template <typename STRUCTURE_CHILD> + static bool testLinkParentWithChild + (typename STRUCTURE_CHILD::Content_T::Parent_T::BomStructure_T& ioParent, + STRUCTURE_CHILD& ioChild) { + typedef typename STRUCTURE_CHILD::Content_T CHILD_CONTENT_T; + + // Retrive the bom children holder corresponding the the children type. + typedef BomChildrenHolderImp<CHILD_CONTENT_T> CHILDREN_HOLDER_T; + + CHILDREN_HOLDER_T*& lChildrenHolder_ptr = + boost::fusion::at_key<CHILD_CONTENT_T> (ioParent._holderMap); + if (lChildrenHolder_ptr == NULL) { + lChildrenHolder_ptr = &instance().createBomHolder<CHILD_CONTENT_T> (); + } + + bool hasInsertBeenSuccessful = + testAddObjectToHolder <CHILD_CONTENT_T> (*lChildrenHolder_ptr, + ioChild); + + return hasInsertBeenSuccessful; + } + /** Add a BOM object into a dedicated BOM holder by using the + short key of the object. */ + template <typename CONTENT> + static bool testAddObjectToHolder (BomChildrenHolderImp<CONTENT>& ioHolder, + typename CONTENT::BomStructure_T& ioStructure) { + // Retrieve the bom structure type. + typedef typename CONTENT::BomStructure_T STRUCTURE_T; + // Define the bom holder type. + typedef BomChildrenHolderImp<CONTENT> HOLDER_T; + + // Retrieve the short key + const typename STRUCTURE_T::Key_T& lKey = ioStructure.getKey(); + const std::string& lKeyStr = lKey.toString(); + + // Insert the structure object in the dedicated lists + typedef typename HOLDER_T::BomChildrenMap_T BOM_MAP_T; + const bool hasInsertBeenSuccessful = + ioHolder._bomChildrenMap. + insert (typename BOM_MAP_T::value_type (lKeyStr, + &ioStructure)).second; + + if (hasInsertBeenSuccessful == false) { + return hasInsertBeenSuccessful; + } + + ioHolder._bomChildrenList.push_back (&ioStructure); + + return true; + } + + // ////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-07 14:59:24
|
Revision: 170 http://stdair.svn.sourceforge.net/stdair/?rev=170&view=rev Author: quannaus Date: 2010-04-07 14:59:18 +0000 (Wed, 07 Apr 2010) Log Message: ----------- [dev] Removed the template argument for 'testLink' function. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/Structure.hpp Property Changed: ---------------- trunk/stdair/stdair/batches/ Property changes on: trunk/stdair/stdair/batches ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile stdair + Makefile.in Makefile stdair .libs .deps Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-07 14:59:18 UTC (rev 170) @@ -32,17 +32,17 @@ stdair::INKey_T lINKey ("BA"); stdair::IN& lIN = stdair::FacBomContent::instance().testCreate<stdair::IN> (lINKey); - stdair::FacBomContent::testLink<stdair::IN> (lIN, lBR); + stdair::FacBomContent::testLink (lIN, lBR); stdair::FDKey_T lFDKey (17); stdair::FD& lFD = stdair::FacBomContent::instance().testCreate<stdair::FD> (lFDKey); - stdair::FacBomContent::testLink<stdair::FD> (lFD, lIN); + stdair::FacBomContent::testLink (lFD, lIN); stdair::NDKey_T lNDKey (1); stdair::ND& lND = stdair::FacBomContent::instance().testCreate<stdair::ND> (lNDKey); - stdair::FacBomContent::testLink<stdair::ND> (lND, lIN); + stdair::FacBomContent::testLink (lND, lIN); // Browse Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-07 14:59:18 UTC (rev 170) @@ -6,9 +6,6 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> -// BOOST Fusion -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> Modified: trunk/stdair/stdair/bom/FD.hpp =================================================================== --- trunk/stdair/stdair/bom/FD.hpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-07 14:59:18 UTC (rev 170) @@ -6,9 +6,6 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> -// BOOST Fusion -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-07 14:59:18 UTC (rev 170) @@ -6,9 +6,6 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> -// BOOST Fusion -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> Modified: trunk/stdair/stdair/bom/ND.hpp =================================================================== --- trunk/stdair/stdair/bom/ND.hpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/bom/ND.hpp 2010-04-07 14:59:18 UTC (rev 170) @@ -6,9 +6,6 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> -// BOOST Fusion -#include <boost/fusion/container/map.hpp> -#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> @@ -36,7 +33,7 @@ /** Definition allowing to retrieve the associated BOM key type. */ typedef NDKey_T Key_T; -/** Define the list of children holder types. */ + /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderTypeMap_T; // ///////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-04-06 15:34:20 UTC (rev 169) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-04-07 14:59:18 UTC (rev 170) @@ -52,7 +52,6 @@ return *lHolder_ptr; } - private: public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-08 12:00:47
|
Revision: 171 http://stdair.svn.sourceforge.net/stdair/?rev=171&view=rev Author: quannaus Date: 2010-04-08 12:00:36 +0000 (Thu, 08 Apr 2010) Log Message: ----------- [Dev] Added the pointer of parent to the bom structure. Modified Paths: -------------- trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BRKey.hpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/factory/FacBomStructure.hpp Added Paths: ----------- trunk/stdair/stdair/bom/BR.cpp trunk/stdair/stdair/bom/FD.cpp trunk/stdair/stdair/bom/IN.cpp trunk/stdair/stdair/bom/ND.cpp Copied: trunk/stdair/stdair/bom/BR.cpp (from rev 169, trunk/stdair/stdair/bom/BomRoot.cpp) =================================================================== --- trunk/stdair/stdair/bom/BR.cpp (rev 0) +++ trunk/stdair/stdair/bom/BR.cpp 2010-04-08 12:00:36 UTC (rev 171) @@ -0,0 +1,29 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BR.hpp> +#include <stdair/bom/IN.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/Structure.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BR::BR (const Key_T& iKey, BomStructure_T& ioBRStructure) + : _key (iKey), _structure (ioBRStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BR::~BR () { + } + + // //////////////////////////////////////////////////////////////////// + const INList_T BR::getINList () const { + return _structure.getChildrenHolder<IN>(); + } + +} Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -6,14 +6,13 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> // STDAIR -#include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/BRKey.hpp> #include <stdair/bom/BRTypes.hpp> #include <stdair/bom/INTypes.hpp> -#include <stdair/bom/IN.hpp> -#include <stdair/bom/BomList.hpp> namespace stdair { // Forward declarations. @@ -36,6 +35,9 @@ /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_T; + + /** Definition allowing to retrieve the parent type. */ + typedef BR Parent_T; // ///////////////////////////////////////////////////////////////////////// public: @@ -66,9 +68,7 @@ return _key; } - const INList_T getINList () const { - return _structure.getChildrenHolder<IN> (); - } + const INList_T getINList () const; public: // //////////// Setters ////////////// @@ -85,10 +85,9 @@ /** Default constructors. */ BR (); BR (const BR&); - BR (const Key_T& iKey, BomStructure_T& ioStructure) - : _key (iKey), _structure (ioStructure) { } + BR (const Key_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ - virtual ~BR() { } + virtual ~BR(); private: // Attributes Modified: trunk/stdair/stdair/bom/BRKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BRKey.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/BRKey.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -1,6 +1,8 @@ #ifndef __STDAIR_BOM_BRKEY_HPP #define __STDAIR_BOM_BRKEY_HPP +#include <sstream> + namespace stdair { struct BRKey_T { Copied: trunk/stdair/stdair/bom/FD.cpp (from rev 169, trunk/stdair/stdair/bom/BomRoot.cpp) =================================================================== --- trunk/stdair/stdair/bom/FD.cpp (rev 0) +++ trunk/stdair/stdair/bom/FD.cpp 2010-04-08 12:00:36 UTC (rev 171) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/FD.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FD::FD (const Key_T& iKey, BomStructure_T& ioFDStructure) + : _key (iKey), _structure (ioFDStructure) { + } + + // //////////////////////////////////////////////////////////////////// + FD::~FD () { + } + +} Modified: trunk/stdair/stdair/bom/FD.hpp =================================================================== --- trunk/stdair/stdair/bom/FD.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -6,6 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> @@ -81,10 +83,9 @@ /** Default constructors. */ FD (); FD (const FD&); - FD (const Key_T& iKey, BomStructure_T& ioStructure) - : _key (iKey), _structure (ioStructure) { } + FD (const Key_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ - virtual ~FD() { } + virtual ~FD(); private: // Attributes Copied: trunk/stdair/stdair/bom/IN.cpp (from rev 169, trunk/stdair/stdair/bom/BomRoot.cpp) =================================================================== --- trunk/stdair/stdair/bom/IN.cpp (rev 0) +++ trunk/stdair/stdair/bom/IN.cpp 2010-04-08 12:00:36 UTC (rev 171) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BR.hpp> +#include <stdair/bom/IN.hpp> +#include <stdair/bom/FD.hpp> +#include <stdair/bom/ND.hpp> +#include <stdair/bom/BomList.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + IN::IN (const Key_T& iKey, BomStructure_T& ioINStructure) + : _key (iKey), _structure (ioINStructure) { + } + + // //////////////////////////////////////////////////////////////////// + IN::~IN () { + } + + // //////////////////////////////////////////////////////////////////// + const NDList_T IN::getNDList () const { + return _structure.getChildrenHolder<ND>(); + } + + // //////////////////////////////////////////////////////////////////// + const FDList_T IN::getFDList () const { + return _structure.getChildrenHolder<FD>(); + } + +} Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -6,20 +6,20 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> // STDAIR -#include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/INKey.hpp> #include <stdair/bom/INTypes.hpp> #include <stdair/bom/FDTypes.hpp> #include <stdair/bom/NDTypes.hpp> -#include <stdair/bom/FD.hpp> -#include <stdair/bom/ND.hpp> -#include <stdair/bom/BomList.hpp> namespace stdair { // Forward declarations. class BR; + class FD; + class ND; class FacBomContent; /** Class representing the actual functional/business content @@ -72,13 +72,9 @@ return _key; } - const FDList_T getFDList () const { - return _structure.getChildrenHolder<FD> (); - } + const FDList_T getFDList () const; - const NDList_T getNDList () const { - return _structure.getChildrenHolder<ND> (); - } + const NDList_T getNDList () const; public: // //////////// Setters ////////////// @@ -95,10 +91,9 @@ /** Default constructors. */ IN (); IN (const IN&); - IN (const Key_T& iKey, BomStructure_T& ioStructure) - : _key (iKey), _structure (ioStructure) { } + IN (const Key_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ - virtual ~IN() { } + virtual ~IN(); private: // Attributes Copied: trunk/stdair/stdair/bom/ND.cpp (from rev 169, trunk/stdair/stdair/bom/BomRoot.cpp) =================================================================== --- trunk/stdair/stdair/bom/ND.cpp (rev 0) +++ trunk/stdair/stdair/bom/ND.cpp 2010-04-08 12:00:36 UTC (rev 171) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/ND.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + ND::ND (const Key_T& iKey, BomStructure_T& ioNDStructure) + : _key (iKey), _structure (ioNDStructure) { + } + + // //////////////////////////////////////////////////////////////////// + ND::~ND () { + } + +} Modified: trunk/stdair/stdair/bom/ND.hpp =================================================================== --- trunk/stdair/stdair/bom/ND.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/ND.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -6,6 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomContent.hpp> @@ -81,10 +83,9 @@ /** Default constructors. */ ND (); ND (const ND&); - ND (const Key_T& iKey, BomStructure_T& ioStructure) - : _key (iKey), _structure (ioStructure) { } + ND (const Key_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ - virtual ~ND() { } + virtual ~ND(); private: // Attributes Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -6,8 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> +#include <iostream> // BOOST Fusion -#include <boost/fusion/container/map.hpp> #include <boost/fusion/include/map.hpp> #include <boost/fusion/sequence/intrinsic/at_key.hpp> // STDAIR @@ -31,11 +31,14 @@ typedef CONTENT Content_T; /** Definition allowing to retrieve the associated key type. */ - typedef typename CONTENT::Key_T Key_T; + typedef typename Content_T::Key_T Key_T; /** Definition allowing to retrieve the map of children holder type. */ - typedef typename CONTENT::ChildrenHolderTypeMap_T ChildrenHolderTypeMap_T; + typedef typename Content_T::ChildrenHolderTypeMap_T ChildrenHolderTypeMap_T; + /** Definition allowing to retrieve the parent structure type. */ + typedef typename Content_T::Parent_T::BomStructure_T Parent_T; + public: // ////////// GETTERS //////////// const Key_T& getKey () const { @@ -79,7 +82,7 @@ /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ - Structure () : _content (NULL) { }; + Structure () : _parent (NULL), _content (NULL) { }; Structure (const Structure&); /** Destructor. */ @@ -87,8 +90,11 @@ private: // Attributes + /** The parent structure. */ + Parent_T* _parent; + /** The actual functional (Business Object) content. */ - CONTENT* _content; + Content_T* _content; /** The map of children holders. */ ChildrenHolderTypeMap_T _holderMap; Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/bom/sources.mk 2010-04-08 12:00:36 UTC (rev 171) @@ -157,4 +157,8 @@ $(top_srcdir)/stdair/bom/DemandStream.cpp \ $(top_srcdir)/stdair/bom/EventStruct.cpp \ $(top_srcdir)/stdair/bom/EventQueue.cpp \ - $(top_srcdir)/stdair/bom/BomManager.cpp + $(top_srcdir)/stdair/bom/BomManager.cpp \ + $(top_srcdir)/stdair/bom/BR.cpp \ + $(top_srcdir)/stdair/bom/IN.cpp \ + $(top_srcdir)/stdair/bom/FD.cpp \ + $(top_srcdir)/stdair/bom/ND.cpp Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-07 14:59:18 UTC (rev 170) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-08 12:00:36 UTC (rev 171) @@ -92,6 +92,8 @@ static bool testLinkParentWithChild (typename STRUCTURE_CHILD::Content_T::Parent_T::BomStructure_T& ioParent, STRUCTURE_CHILD& ioChild) { + ioChild._parent = &ioParent; + typedef typename STRUCTURE_CHILD::Content_T CHILD_CONTENT_T; // Retrive the bom children holder corresponding the the children type. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-09 15:07:29
|
Revision: 172 http://stdair.svn.sourceforge.net/stdair/?rev=172&view=rev Author: quannaus Date: 2010-04-09 15:07:22 +0000 (Fri, 09 Apr 2010) Log Message: ----------- [Dev] Added several inventory objects. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BomMap.hpp trunk/stdair/stdair/bom/FD.cpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/IN.cpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/ND.cpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/Structure.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/BC.cpp trunk/stdair/stdair/bom/BC.hpp trunk/stdair/stdair/bom/BCTypes.hpp trunk/stdair/stdair/bom/BK.cpp trunk/stdair/stdair/bom/BK.hpp trunk/stdair/stdair/bom/BKTypes.hpp trunk/stdair/stdair/bom/BucketContent.cpp trunk/stdair/stdair/bom/BucketContent.hpp trunk/stdair/stdair/bom/BucketKey.cpp trunk/stdair/stdair/bom/BucketKey.hpp trunk/stdair/stdair/bom/LC.cpp trunk/stdair/stdair/bom/LC.hpp trunk/stdair/stdair/bom/LCTypes.hpp trunk/stdair/stdair/bom/LD.cpp trunk/stdair/stdair/bom/LD.hpp trunk/stdair/stdair/bom/LDTypes.hpp trunk/stdair/stdair/bom/SC.cpp trunk/stdair/stdair/bom/SC.hpp trunk/stdair/stdair/bom/SCTypes.hpp trunk/stdair/stdair/bom/SD.cpp trunk/stdair/stdair/bom/SD.hpp trunk/stdair/stdair/bom/SDTypes.hpp Removed Paths: ------------- trunk/stdair/stdair/bom/BRKey.hpp trunk/stdair/stdair/bom/FDKey.hpp trunk/stdair/stdair/bom/INKey.hpp trunk/stdair/stdair/bom/NDKey.hpp Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -7,16 +7,15 @@ // StdAir #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BR.hpp> -#include <stdair/bom/BRKey.hpp> #include <stdair/bom/BRTypes.hpp> #include <stdair/bom/IN.hpp> -#include <stdair/bom/INKey.hpp> +#include <stdair/bom/InventoryKey.hpp> #include <stdair/bom/INTypes.hpp> #include <stdair/bom/FD.hpp> -#include <stdair/bom/FDKey.hpp> +#include <stdair/bom/FlightDateKey.hpp> #include <stdair/bom/FDTypes.hpp> #include <stdair/bom/ND.hpp> -#include <stdair/bom/NDKey.hpp> +#include <stdair/bom/NetworkDateKey.hpp> #include <stdair/bom/NDTypes.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/factory/FacBomContent.hpp> @@ -25,21 +24,20 @@ // ///////// M A I N //////////// int main (int argc, char* argv[]) { try { - stdair::BRKey_T lBRKey; stdair::BR& lBR = - stdair::FacBomContent::instance().testCreate<stdair::BR> (lBRKey); + stdair::FacBomContent::instance().testCreate<stdair::BR> (); - stdair::INKey_T lINKey ("BA"); + stdair::InventoryKey_T lINKey ("BA"); stdair::IN& lIN = stdair::FacBomContent::instance().testCreate<stdair::IN> (lINKey); stdair::FacBomContent::testLink (lIN, lBR); - stdair::FDKey_T lFDKey (17); + stdair::FlightDateKey_T lFDKey (17, stdair::Date_T (2010, 02, 14)); stdair::FD& lFD = stdair::FacBomContent::instance().testCreate<stdair::FD> (lFDKey); stdair::FacBomContent::testLink (lFD, lIN); - stdair::NDKey_T lNDKey (1); + stdair::NetworkDateKey_T lNDKey (stdair::Date_T (2010, 02, 14)); stdair::ND& lND = stdair::FacBomContent::instance().testCreate<stdair::ND> (lNDKey); stdair::FacBomContent::testLink (lND, lIN); Copied: trunk/stdair/stdair/bom/BC.cpp (from rev 171, trunk/stdair/stdair/bom/FD.cpp) =================================================================== --- trunk/stdair/stdair/bom/BC.cpp (rev 0) +++ trunk/stdair/stdair/bom/BC.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BC.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BC::BC (const BomKey_T& iKey, BomStructure_T& ioBCStructure) + : BookingClassContent (iKey), _structure (ioBCStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BC::~BC () { + } + +} Copied: trunk/stdair/stdair/bom/BC.hpp (from rev 171, trunk/stdair/stdair/bom/FD.hpp) =================================================================== --- trunk/stdair/stdair/bom/BC.hpp (rev 0) +++ trunk/stdair/stdair/bom/BC.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,83 @@ +#ifndef __STDAIR_BOM_BC_HPP +#define __STDAIR_BOM_BC_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BookingClassContent.hpp> +#include <stdair/bom/BCTypes.hpp> +#include <stdair/bom/BCTypes.hpp> + +namespace stdair { + // Forward declarations. + class SC; + + /** Class representing the actual functional/business content + for the Bom root. */ + class BC : public BookingClassContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef SC Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BCStructure_T BomStructure_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< > ChildrenHolderTypeMap_T; + // ///////////////////////////////////////////////////////////////////////// + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + 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 _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BC (); + BC (const BC&); + BC (const BomKey_T& iKey, BomStructure_T& ioStructure); + /** Destructor. */ + virtual ~BC(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_BC_HPP Copied: trunk/stdair/stdair/bom/BCTypes.hpp (from rev 169, trunk/stdair/stdair/bom/FDTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/BCTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BCTypes.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BCTYPES_HPP +#define __STDAIR_BOM_BCTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class BC; + + /** Define the BomRootStructure. */ + typedef Structure<BC> BCStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<BC> BCHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<BC> BCList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<BC> BCMap_T; + +} +#endif // __STDAIR_BOM_BCTYPES_HPP + Copied: trunk/stdair/stdair/bom/BK.cpp (from rev 171, trunk/stdair/stdair/bom/FD.cpp) =================================================================== --- trunk/stdair/stdair/bom/BK.cpp (rev 0) +++ trunk/stdair/stdair/bom/BK.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BK.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BK::BK (const BomKey_T& iKey, BomStructure_T& ioBKStructure) + : BucketContent (iKey), _structure (ioBKStructure) { + } + + // //////////////////////////////////////////////////////////////////// + BK::~BK () { + } + +} Copied: trunk/stdair/stdair/bom/BK.hpp (from rev 171, trunk/stdair/stdair/bom/FD.hpp) =================================================================== --- trunk/stdair/stdair/bom/BK.hpp (rev 0) +++ trunk/stdair/stdair/bom/BK.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,83 @@ +#ifndef __STDAIR_BOM_BK_HPP +#define __STDAIR_BOM_BK_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BucketContent.hpp> +#include <stdair/bom/BKTypes.hpp> +#include <stdair/bom/BKTypes.hpp> + +namespace stdair { + // Forward declarations. + class LC; + + /** Class representing the actual functional/business content + for the Bom root. */ + class BK : public BucketContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef LC Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef BKStructure_T BomStructure_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< > ChildrenHolderTypeMap_T; + // ///////////////////////////////////////////////////////////////////////// + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + 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 _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + BK (); + BK (const BK&); + BK (const BomKey_T& iKey, BomStructure_T& ioStructure); + /** Destructor. */ + virtual ~BK(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_BK_HPP Copied: trunk/stdair/stdair/bom/BKTypes.hpp (from rev 169, trunk/stdair/stdair/bom/FDTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/BKTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/BKTypes.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_BKTYPES_HPP +#define __STDAIR_BOM_BKTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class BK; + + /** Define the BomRootStructure. */ + typedef Structure<BK> BKStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<BK> BKHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<BK> BKList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<BK> BKMap_T; + +} +#endif // __STDAIR_BOM_BKTYPES_HPP + Modified: trunk/stdair/stdair/bom/BR.cpp =================================================================== --- trunk/stdair/stdair/bom/BR.cpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/BR.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -8,13 +8,13 @@ #include <stdair/bom/BR.hpp> #include <stdair/bom/IN.hpp> #include <stdair/bom/BomList.hpp> -#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BomMap.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - BR::BR (const Key_T& iKey, BomStructure_T& ioBRStructure) - : _key (iKey), _structure (ioBRStructure) { + BR::BR (const BomKey_T& iKey, BomStructure_T& ioBRStructure) + : BomRootContent (iKey), _structure (ioBRStructure) { } // //////////////////////////////////////////////////////////////////// @@ -26,4 +26,8 @@ return _structure.getChildrenHolder<IN>(); } + // //////////////////////////////////////////////////////////////////// + const INMap_T BR::getINMap () const { + return _structure.getChildrenHolder<IN>(); + } } Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -9,19 +9,17 @@ // BOOST Fusion #include <boost/fusion/include/map.hpp> // STDAIR -#include <stdair/bom/BomContent.hpp> -#include <stdair/bom/BRKey.hpp> +#include <stdair/bom/BomRootContent.hpp> #include <stdair/bom/BRTypes.hpp> #include <stdair/bom/INTypes.hpp> namespace stdair { // Forward declarations. - class FacBomContent; class IN; /** Class representing the actual functional/business content for the Bom root. */ - class BR : public BomContent { + class BR : public BomRootContent { friend class FacBomContent; public: @@ -29,9 +27,6 @@ /** Definition allowing to retrieve the associated BOM structure type. */ typedef BRStructure_T BomStructure_T; - /** Definition allowing to retrieve the associated BOM key type. */ - typedef BRKey_T Key_T; - /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_T; @@ -64,15 +59,9 @@ public: // /////////// Getters ///////////// - const Key_T& getKey () const { - return _key; - } - const INList_T getINList () const; + const INMap_T getINMap () const; - public: - // //////////// Setters ////////////// - private: /** Retrieve the BOM structure object. */ BomStructure_T& getStructure () { @@ -85,15 +74,12 @@ /** Default constructors. */ BR (); BR (const BR&); - BR (const Key_T& iKey, BomStructure_T& ioStructure); + BR (const BomKey_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ virtual ~BR(); private: // Attributes - /** Key. */ - Key_T _key; - /** Reference structure. */ BomStructure_T& _structure; }; Deleted: trunk/stdair/stdair/bom/BRKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BRKey.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/BRKey.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -1,30 +0,0 @@ -#ifndef __STDAIR_BOM_BRKEY_HPP -#define __STDAIR_BOM_BRKEY_HPP - -#include <sstream> - -namespace stdair { - struct BRKey_T { - - // /////////// Display support methods ///////// - void toStream (std::ostream& ioOut) const { - ioOut << "BRKey: " << toString() << std::endl; - } - - void fromStream (std::istream& ioIn) { - } - - const std::string toString() const { - std::ostringstream oStr; - oStr << " -- ROOT -- "; - return oStr.str(); - } - - const std::string describe() const { - return toString(); - } - - }; -} - -#endif // __STDAIR_BOM_BRKEY_HPP Modified: trunk/stdair/stdair/bom/BomMap.hpp =================================================================== --- trunk/stdair/stdair/bom/BomMap.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/BomMap.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -6,6 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <map> +// STDAIR +#include <stdair/basic/BasTypes.hpp> namespace stdair { @@ -30,8 +32,11 @@ // the iterator types specified below // ///////////////////////////////////////////////////////////////////////// /** Define the bom map iterators. */ - typedef BomIterator_T<BOM, typename BomStructureMap_T::const_iterator> iterator; - typedef BomIterator_T<BOM, typename BomStructureMap_T::const_reverse_iterator> reverse_iterator; + typedef BomIterator_T<BOM, + typename BomStructureMap_T::const_iterator> iterator; + typedef BomIterator_T<BOM, + typename BomStructureMap_T::const_reverse_iterator + > reverse_iterator; // ///////////////////////////////////////////////////////////////////////// public: Copied: trunk/stdair/stdair/bom/BucketContent.cpp (from rev 169, trunk/stdair/stdair/bom/BookingClassContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/BucketContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/BucketContent.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,57 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_BookingClass.hpp> +#include <stdair/basic/BasConst_Yield.hpp> +#include <stdair/bom/BucketContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BucketContent::BucketContent (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) { + } + + // //////////////////////////////////////////////////////////////////// + BucketContent::~BucketContent () { + } + + // //////////////////////////////////////////////////////////////////// + void BucketContent::setRemainingDemandMean(NbOfBookings_T& iMean) { + _remainingDemandMean = iMean; + _remainingProductDemandMean = iMean; + } + + // //////////////////////////////////////////////////////////////////// + void BucketContent::setRemainingDemandSD(NbOfBookings_T& iSD) { + _remainingDemandSD = iSD; + _remainingProductDemandSD = iSD; + } + +} + Copied: trunk/stdair/stdair/bom/BucketContent.hpp (from rev 169, trunk/stdair/stdair/bom/BookingClassContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/BucketContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/BucketContent.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,329 @@ +#ifndef __STDAIR_BOM_BUCKETCONTENT_HPP +#define __STDAIR_BOM_BUCKETCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/BucketKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline booking class. */ + class BucketContent : public BomContent { + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef BucketKey_T BomKey_T; + + public: + // /////////// Getters //////////// + /** Get the booking class key. */ + const BomKey_T& getKey() const { + 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. */ + 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. */ + BucketContent (const BomKey_T&); + BucketContent (const BucketContent&); + + /** Destructor. */ + virtual ~BucketContent(); + + protected: + // 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; + + }; + +} +#endif // __STDAIR_BOM_BUCKETCONTENT_HPP + Copied: trunk/stdair/stdair/bom/BucketKey.cpp (from rev 169, trunk/stdair/stdair/bom/BookingClassKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/BucketKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/BucketKey.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,41 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BucketKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BucketKey_T::BucketKey_T (const ClassCode_T& iClassCode) + : _classCode (iClassCode) { + } + + // //////////////////////////////////////////////////////////////////// + BucketKey_T::~BucketKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void BucketKey_T::toStream (std::ostream& ioOut) const { + ioOut << "BucketKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void BucketKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string BucketKey_T::toString() const { + std::ostringstream oStr; + oStr << _classCode; + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string BucketKey_T::describe() const { + std::ostringstream oStr; + oStr << _parentKey.describe() << ", " << toString(); + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/BucketKey.hpp (from rev 169, trunk/stdair/stdair/bom/BookingClassKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/BucketKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BucketKey.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,69 @@ +#ifndef __STDAIR_BOM_BUCKETKEY_HPP +#define __STDAIR_BOM_BUCKETKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/LegCabinKey.hpp> + +namespace stdair { + /** Key of booking-class. */ + struct BucketKey_T : public BomKey_T { + + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef LegCabinKey_T ParentKey_T; + + public: + // /////////// Construction /////////// + /** Constructor. */ + BucketKey_T (const ClassCode_T& iClassCode); + + /** Destructor. */ + ~BucketKey_T (); + + // /////////// Getters ////////// + /** Get the class code. */ + const ClassCode_T& getClassCode () const { + return _classCode; + } + + // /////////// 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. */ + 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-cabin. */ + const std::string toString() const; + + /** Display of the key. */ + const std::string describe() const; + + private: + // Attributes + /** Leg-cabin key.*/ + ParentKey_T _parentKey; + + /** Cabin code. */ + ClassCode_T _classCode; + }; + +} +#endif // __STDAIR_BOM_BUCKETKEY_HPP Modified: trunk/stdair/stdair/bom/FD.cpp =================================================================== --- trunk/stdair/stdair/bom/FD.cpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/FD.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -5,17 +5,42 @@ #include <cassert> // STDAIR #include <stdair/bom/Structure.hpp> +#include <stdair/bom/IN.hpp> #include <stdair/bom/FD.hpp> +#include <stdair/bom/LD.hpp> +#include <stdair/bom/SD.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - FD::FD (const Key_T& iKey, BomStructure_T& ioFDStructure) - : _key (iKey), _structure (ioFDStructure) { + FD::FD (const BomKey_T& iKey, BomStructure_T& ioFDStructure) + : FlightDateContent (iKey), _structure (ioFDStructure) { } // //////////////////////////////////////////////////////////////////// FD::~FD () { } + + // //////////////////////////////////////////////////////////////////// + const LDList_T FD::getLDList () const { + return _structure.getChildrenHolder<LD>(); + } + + // //////////////////////////////////////////////////////////////////// + const LDMap_T FD::getLDMap () const { + return _structure.getChildrenHolder<LD>(); + } + + // //////////////////////////////////////////////////////////////////// + const SDList_T FD::getSDList () const { + return _structure.getChildrenHolder<SD>(); + } + + // //////////////////////////////////////////////////////////////////// + const SDMap_T FD::getSDMap () const { + return _structure.getChildrenHolder<SD>(); + } } Modified: trunk/stdair/stdair/bom/FD.hpp =================================================================== --- trunk/stdair/stdair/bom/FD.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -10,18 +10,20 @@ #include <boost/fusion/include/map.hpp> // STDAIR #include <stdair/bom/Structure.hpp> -#include <stdair/bom/BomContent.hpp> -#include <stdair/bom/FDKey.hpp> +#include <stdair/bom/FlightDateContent.hpp> #include <stdair/bom/FDTypes.hpp> +#include <stdair/bom/SDTypes.hpp> +#include <stdair/bom/LDTypes.hpp> namespace stdair { // Forward declarations. class IN; - class FacBomContent; + class SD; + class LD; /** Class representing the actual functional/business content for the Bom root. */ - class FD : public BomContent { + class FD : public FlightDateContent { friend class FacBomContent; public: @@ -31,15 +33,26 @@ /** Definition allowing to retrieve the associated BOM structure type. */ typedef FDStructure_T BomStructure_T; - - /** Definition allowing to retrieve the associated BOM key type. */ - typedef FDKey_T Key_T; /** Define the list of children holder types. */ - typedef boost::fusion::map< > ChildrenHolderTypeMap_T; + typedef boost::fusion::map< + boost::fusion::pair<SD, SDHolder_T*>, + boost::fusion::pair<LD, LDHolder_T*> > ChildrenHolderTypeMap_T; // ///////////////////////////////////////////////////////////////////////// + public: + // /////////// Getters ///////////// + const SDList_T getSDList () const; + const SDMap_T getSDMap () const; + const LDList_T getLDList () const; + const LDMap_T getLDMap () const; + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -55,43 +68,24 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.describe(); } + 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.describe(); } + const std::string describeShortKey() const { return _key.toString(); } - - public: - // /////////// Getters ///////////// - const Key_T& getKey () const { - return _key; - } - - public: - // //////////// Setters ////////////// - - private: - /** Retrieve the BOM structure object. */ - BomStructure_T& getStructure () { - return _structure; - } - protected: /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ FD (); FD (const FD&); - FD (const Key_T& iKey, BomStructure_T& ioStructure); + FD (const BomKey_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ virtual ~FD(); private: // Attributes - /** Key. */ - Key_T _key; - /** Reference structure. */ BomStructure_T& _structure; Deleted: trunk/stdair/stdair/bom/FDKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FDKey.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/FDKey.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -1,50 +0,0 @@ -#ifndef __STDAIR_BOM_FDKEY_HPP -#define __STDAIR_BOM_FDKEY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/BomKey.hpp> - - -namespace stdair { - struct FDKey_T : public BomKey_T { - - // /////////// Display support methods ///////// - void toStream (std::ostream& ioOut) const { - ioOut << "FDKey: " << toString() << std::endl; - } - - void fromStream (std::istream& ioIn) { - } - - const std::string toString() const { - std::ostringstream oStr; - oStr << _flightNumber; - return oStr.str(); - } - - const std::string describe() const { - return toString(); - } - - public: - // /////////// Construction /////////// - /** Constructors. */ - FDKey_T (const int& iFlightNumber) : _flightNumber (iFlightNumber) { } - FDKey_T (const FDKey_T& iKey) - : _flightNumber (iKey._flightNumber) { } - /** Destructor. */ - ~FDKey_T () { } - - private: - // Attributes - /** Flight number. */ - int _flightNumber; - - }; -} - -#endif // __STDAIR_BOM_FDKEY_HPP Modified: trunk/stdair/stdair/bom/IN.cpp =================================================================== --- trunk/stdair/stdair/bom/IN.cpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/IN.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -10,12 +10,13 @@ #include <stdair/bom/FD.hpp> #include <stdair/bom/ND.hpp> #include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - IN::IN (const Key_T& iKey, BomStructure_T& ioINStructure) - : _key (iKey), _structure (ioINStructure) { + IN::IN (const BomKey_T& iKey, BomStructure_T& ioINStructure) + : InventoryContent (iKey), _structure (ioINStructure) { } // //////////////////////////////////////////////////////////////////// @@ -28,8 +29,18 @@ } // //////////////////////////////////////////////////////////////////// + const NDMap_T IN::getNDMap () const { + return _structure.getChildrenHolder<ND>(); + } + + // //////////////////////////////////////////////////////////////////// const FDList_T IN::getFDList () const { return _structure.getChildrenHolder<FD>(); } + + // //////////////////////////////////////////////////////////////////// + const FDMap_T IN::getFDMap () const { + return _structure.getChildrenHolder<FD>(); + } } Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -9,8 +9,7 @@ // BOOST Fusion #include <boost/fusion/include/map.hpp> // STDAIR -#include <stdair/bom/BomContent.hpp> -#include <stdair/bom/INKey.hpp> +#include <stdair/bom/InventoryContent.hpp> #include <stdair/bom/INTypes.hpp> #include <stdair/bom/FDTypes.hpp> #include <stdair/bom/NDTypes.hpp> @@ -20,11 +19,10 @@ class BR; class FD; class ND; - class FacBomContent; /** Class representing the actual functional/business content for the Bom root. */ - class IN : public BomContent { + class IN : public InventoryContent { friend class FacBomContent; public: @@ -34,9 +32,6 @@ /** Definition allowing to retrieve the associated BOM structure type. */ typedef INStructure_T BomStructure_T; - - /** Definition allowing to retrieve the associated BOM key type. */ - typedef INKey_T Key_T; /** Define the list of children holder types. */ typedef boost::fusion::map< @@ -45,6 +40,19 @@ // ///////////////////////////////////////////////////////////////////////// public: + // /////////// Getters ///////////// + const FDList_T getFDList () const; + const FDMap_T getFDMap () const; + const NDList_T getNDList () const; + const NDMap_T getNDMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -59,47 +67,25 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ - const std::string describeKey() const { return _key.describe(); } + 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.describe(); } + const std::string describeShortKey() const { return _key.toString(); } - public: - // /////////// Getters ///////////// - const Key_T& getKey () const { - return _key; - } - - const FDList_T getFDList () const; - - const NDList_T getNDList () const; - - public: - // //////////// Setters ////////////// - - private: - /** Retrieve the BOM structure object. */ - BomStructure_T& getStructure () { - return _structure; - } - protected: /** Constructors are private so as to force the usage of the Factory layer. */ /** Default constructors. */ IN (); IN (const IN&); - IN (const Key_T& iKey, BomStructure_T& ioStructure); + IN (const BomKey_T& iKey, BomStructure_T& ioStructure); /** Destructor. */ virtual ~IN(); private: // Attributes - /** Key. */ - Key_T _key; - /** Reference structure. */ BomStructure_T& _structure; Deleted: trunk/stdair/stdair/bom/INKey.hpp =================================================================== --- trunk/stdair/stdair/bom/INKey.hpp 2010-04-08 12:00:36 UTC (rev 171) +++ trunk/stdair/stdair/bom/INKey.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -1,50 +0,0 @@ -#ifndef __STDAIR_BOM_INKEY_HPP -#define __STDAIR_BOM_INKEY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/BomKey.hpp> - - -namespace stdair { - struct INKey_T : public BomKey_T { - - // /////////// Display support methods ///////// - void toStream (std::ostream& ioOut) const { - ioOut << "INKey: " << toString() << std::endl; - } - - void fromStream (std::istream& ioIn) { - } - - const std::string toString() const { - std::ostringstream oStr; - oStr << _airlineCode; - return oStr.str(); - } - - const std::string describe() const { - return toString(); - } - - public: - // /////////// Construction /////////// - /** Constructors. */ - INKey_T (const AirlineCode_T& iAirlineCode) : _airlineCode (iAirlineCode) { } - INKey_T (const INKey_T& iKey) - : _airlineCode (iKey._airlineCode) { } - /** Destructor. */ - ~INKey_T () { } - - private: - // Attributes - /** Airline code. */ - AirlineCode_T _airlineCode; - - }; -} - -#endif // __STDAIR_BOM_INKEY_HPP Copied: trunk/stdair/stdair/bom/LC.cpp (from rev 171, trunk/stdair/stdair/bom/FD.cpp) =================================================================== --- trunk/stdair/stdair/bom/LC.cpp (rev 0) +++ trunk/stdair/stdair/bom/LC.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/LD.hpp> +#include <stdair/bom/LC.hpp> +#include <stdair/bom/BK.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LC::LC (const BomKey_T& iKey, BomStructure_T& ioLCStructure) + : LegCabinContent (iKey), _structure (ioLCStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LC::~LC () { + } + + // //////////////////////////////////////////////////////////////////// + const BKList_T LC::getBKList () const { + return _structure.getChildrenHolder<BK>(); + } + + // //////////////////////////////////////////////////////////////////// + const BKMap_T LC::getBKMap () const { + return _structure.getChildrenHolder<BK>(); + } + +} Copied: trunk/stdair/stdair/bom/LC.hpp (from rev 171, trunk/stdair/stdair/bom/FD.hpp) =================================================================== --- trunk/stdair/stdair/bom/LC.hpp (rev 0) +++ trunk/stdair/stdair/bom/LC.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,90 @@ +#ifndef __STDAIR_BOM_LC_HPP +#define __STDAIR_BOM_LC_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/LegCabinContent.hpp> +#include <stdair/bom/LCTypes.hpp> +#include <stdair/bom/BKTypes.hpp> + +namespace stdair { + // Forward declarations. + class LD; + class BK; + + /** Class representing the actual functional/business content + for the Bom root. */ + class LC : public LegCabinContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef LD Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef LCStructure_T BomStructure_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<BK, BKHolder_T*> > ChildrenHolderTypeMap_T; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + const BKList_T getBKList () const; + const BKMap_T getBKMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + 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 _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + LC (); + LC (const LC&); + LC (const BomKey_T& iKey, BomStructure_T& ioStructure); + /** Destructor. */ + virtual ~LC(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_LC_HPP Copied: trunk/stdair/stdair/bom/LCTypes.hpp (from rev 169, trunk/stdair/stdair/bom/FDTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/LCTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/LCTypes.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_LCTYPES_HPP +#define __STDAIR_BOM_LCTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class LC; + + /** Define the BomRootStructure. */ + typedef Structure<LC> LCStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<LC> LCHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<LC> LCList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<LC> LCMap_T; + +} +#endif // __STDAIR_BOM_LCTYPES_HPP + Copied: trunk/stdair/stdair/bom/LD.cpp (from rev 171, trunk/stdair/stdair/bom/FD.cpp) =================================================================== --- trunk/stdair/stdair/bom/LD.cpp (rev 0) +++ trunk/stdair/stdair/bom/LD.cpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/FD.hpp> +#include <stdair/bom/LD.hpp> +#include <stdair/bom/LC.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + LD::LD (const BomKey_T& iKey, BomStructure_T& ioLDStructure) + : LegDateContent (iKey), _structure (ioLDStructure) { + } + + // //////////////////////////////////////////////////////////////////// + LD::~LD () { + } + + // //////////////////////////////////////////////////////////////////// + const LCList_T LD::getLCList () const { + return _structure.getChildrenHolder<LC>(); + } + + // //////////////////////////////////////////////////////////////////// + const LCMap_T LD::getLCMap () const { + return _structure.getChildrenHolder<LC>(); + } + +} Copied: trunk/stdair/stdair/bom/LD.hpp (from rev 171, trunk/stdair/stdair/bom/FD.hpp) =================================================================== --- trunk/stdair/stdair/bom/LD.hpp (rev 0) +++ trunk/stdair/stdair/bom/LD.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,90 @@ +#ifndef __STDAIR_BOM_LD_HPP +#define __STDAIR_BOM_LD_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/LegDateContent.hpp> +#include <stdair/bom/LDTypes.hpp> +#include <stdair/bom/LCTypes.hpp> + +namespace stdair { + // Forward declarations. + class FD; + class LC; + + /** Class representing the actual functional/business content + for the Bom root. */ + class LD : public LegDateContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef FD Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef LDStructure_T BomStructure_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<LC, LCHolder_T*> > ChildrenHolderTypeMap_T; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + const LCList_T getLCList () const; + const LCMap_T getLCMap () const; + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + 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 _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + LD (); + LD (const LD&); + LD (const BomKey_T& iKey, BomStructure_T& ioStructure); + /** Destructor. */ + virtual ~LD(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _structure; + + }; + +} +#endif // __STDAIR_BOM_LD_HPP Copied: trunk/stdair/stdair/bom/LDTypes.hpp (from rev 169, trunk/stdair/stdair/bom/FDTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/LDTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/LDTypes.hpp 2010-04-09 15:07:22 UTC (rev 172) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_LDTYPES_HPP +#define __STDAIR_BOM_LDTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class LD; + + /** Define the BomRootStructure. */ + typedef Structure<LD> LDStructure... [truncated message content] |
From: <den...@us...> - 2010-04-18 00:01:48
|
Revision: 174 http://stdair.svn.sourceforge.net/stdair/?rev=174&view=rev Author: denis_arnaud Date: 2010-04-18 00:01:41 +0000 (Sun, 18 Apr 2010) Log Message: ----------- [Yield] Added YieldStore BOM object (there is some work in CmdBomManager to switch BomRoot and BR). Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BR.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Added Paths: ----------- trunk/stdair/stdair/bom/YieldStore.cpp trunk/stdair/stdair/bom/YieldStore.hpp trunk/stdair/stdair/bom/YieldStoreContent.cpp trunk/stdair/stdair/bom/YieldStoreContent.hpp trunk/stdair/stdair/bom/YieldStoreKey.cpp trunk/stdair/stdair/bom/YieldStoreKey.hpp trunk/stdair/stdair/bom/YieldStoreTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -14,6 +14,7 @@ // Forward declarations class BomRoot; + class YieldStore; class Inventory; /** Interface for the STDAIR Services. */ @@ -48,6 +49,11 @@ <br>If not existing, a ObjectNotFoundException exception is thrown. */ Inventory& getInventory (const AirlineCode_T& iAirlineCode) const; + /** Retrieve the Yield Store corresponding to the given airline code + (YieldStore key). + <br>If not existing, a ObjectNotFoundException exception is thrown. */ + YieldStore& getYieldStore (const AirlineCode_T& iAirlineCode) const; + // ///////////////// Getters /////////////////// /** Get a reference on the BomRoot object. @@ -64,6 +70,11 @@ <br>If not existing, a ObjectNotFoundException exception is thrown. */ Inventory& createInventory (const AirlineCode_T& iAirlineCode) const; + /** Retrieve the YieldStore corresponding to the given airline code + (YieldStore key). + <br>If not existing, a ObjectNotFoundException exception is thrown. */ + YieldStore& createYieldStore (const AirlineCode_T& iAirlineCode) const; + /** Add the airline-specific AirlineFeature object to its AirlineFeatureSet parent. */ void addAirlineFeature (const AirlineCode_T& iAirlineCode) const; Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -23,7 +23,9 @@ // ///////// M A I N //////////// int main (int argc, char* argv[]) { + try { + stdair::BR& lBR = stdair::FacBomContent::instance().testCreate<stdair::BR> (); Modified: trunk/stdair/stdair/bom/BR.cpp =================================================================== --- trunk/stdair/stdair/bom/BR.cpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/BR.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -6,6 +6,7 @@ // STDAIR #include <stdair/bom/Structure.hpp> #include <stdair/bom/BR.hpp> +#include <stdair/bom/YieldStore.hpp> #include <stdair/bom/IN.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> @@ -22,6 +23,16 @@ } // //////////////////////////////////////////////////////////////////// + const YieldStoreList_T BR::getYieldStoreList () const { + return _structure.getChildrenHolder<YieldStore>(); + } + + // //////////////////////////////////////////////////////////////////// + const YieldStoreMap_T BR::getYieldStoreMap () const { + return _structure.getChildrenHolder<YieldStore>(); + } + + // //////////////////////////////////////////////////////////////////// const INList_T BR::getINList () const { return _structure.getChildrenHolder<IN>(); } @@ -30,4 +41,5 @@ const INMap_T BR::getINMap () const { return _structure.getChildrenHolder<IN>(); } + } Modified: trunk/stdair/stdair/bom/BR.hpp =================================================================== --- trunk/stdair/stdair/bom/BR.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/BR.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -11,10 +11,12 @@ // STDAIR #include <stdair/bom/BomRootContent.hpp> #include <stdair/bom/BRTypes.hpp> +#include <stdair/bom/YieldStoreTypes.hpp> #include <stdair/bom/INTypes.hpp> namespace stdair { // Forward declarations. + class YieldStore; class IN; /** Class representing the actual functional/business content @@ -29,6 +31,7 @@ /** Define the list of children holder types. */ typedef boost::fusion::map< + boost::fusion::pair<YieldStore, YieldStoreHolder_T*>, boost::fusion::pair<IN, INHolder_T*> > ChildrenHolderTypeMap_T; /** Definition allowing to retrieve the parent type. */ @@ -59,8 +62,11 @@ public: // /////////// Getters ///////////// + const YieldStoreList_T getYieldStoreList () const; + const YieldStoreMap_T getYieldStoreMap () const; const INList_T getINList () const; const INMap_T getINMap () const; + private: /** Retrieve the BOM structure object. */ @@ -74,7 +80,7 @@ /** Default constructors. */ BR (); BR (const BR&); - BR (const BomKey_T& iKey, BomStructure_T& ioStructure); + BR (const BomKey_T&, BomStructure_T&); /** Destructor. */ virtual ~BR(); Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -8,6 +8,7 @@ #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomMap.hpp> +#include <stdair/bom/YieldStore.hpp> #include <stdair/bom/Inventory.hpp> #include <stdair/bom/Network.hpp> #include <stdair/bom/DemandStream.hpp> @@ -56,6 +57,23 @@ } // //////////////////////////////////////////////////////////////////// + YieldStore* BomRoot::getYieldStore (const AirlineCode_T& iAirlineCode) const { + YieldStore* oYieldStore_ptr = NULL; + + // TODO: migrate to the new StdAir structure (e.g., IN, FD, etc.) + /* + YieldStoreMap_T lYieldStoreMap = getYieldStoreMap (); + YieldStoreMap_T::iterator itInv = lYieldStoreMap.find (iAirlineCode); + + if (itInv != lYieldStoreMap.end()) { + oYieldStore_ptr = itInv->second; + } + */ + + return oYieldStore_ptr; + } + + // //////////////////////////////////////////////////////////////////// Inventory* BomRoot::getInventory (const AirlineCode_T& iAirlineCode) const { Inventory* oInventory_ptr = NULL; Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -15,9 +15,11 @@ #include <stdair/bom/DemandStreamTypes.hpp> namespace stdair { + // Forward declarations. class FacBomContent; class AirlineFeatureSet; + class YieldStore; class DemandStream; struct BomRootKey_T; @@ -141,6 +143,11 @@ <br>If not existing, return the NULL pointer. */ Network* getNetwork (const NetworkID_T&) const; + /** Retrieve, if existing, the YieldStore corresponding to the + given airline code (YieldStore key). + <br>If not existing, return the NULL pointer. */ + YieldStore* getYieldStore (const AirlineCode_T&) const; + /** Retrieve the DemandStream which corresponds to the given key. */ DemandStream& getDemandStream (const DemandStreamKeyStr_T&) const; Modified: trunk/stdair/stdair/bom/FD.hpp =================================================================== --- trunk/stdair/stdair/bom/FD.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/FD.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -16,6 +16,7 @@ #include <stdair/bom/LDTypes.hpp> namespace stdair { + // Forward declarations. class IN; class SD; Modified: trunk/stdair/stdair/bom/IN.hpp =================================================================== --- trunk/stdair/stdair/bom/IN.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/IN.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -15,6 +15,7 @@ #include <stdair/bom/NDTypes.hpp> namespace stdair { + // Forward declarations. class BR; class FD; Added: trunk/stdair/stdair/bom/YieldStore.cpp =================================================================== --- trunk/stdair/stdair/bom/YieldStore.cpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStore.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,25 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/Structure.hpp> +#include <stdair/bom/BR.hpp> +#include <stdair/bom/YieldStore.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomMap.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + YieldStore::YieldStore (const BomKey_T& iKey, + BomStructure_T& ioYieldStoreStructure) + : YieldStoreContent (iKey), _structure (ioYieldStoreStructure) { + } + + // //////////////////////////////////////////////////////////////////// + YieldStore::~YieldStore () { + } + +} Added: trunk/stdair/stdair/bom/YieldStore.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStore.hpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStore.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,87 @@ +#ifndef __STDAIR_BOM_YIELDSTORE_HPP +#define __STDAIR_BOM_YIELDSTORE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iosfwd> +// BOOST Fusion +#include <boost/fusion/include/map.hpp> +// STDAIR +#include <stdair/bom/YieldStoreContent.hpp> +#include <stdair/bom/YieldStoreTypes.hpp> + +namespace stdair { + + // Forward declarations. + class BR; + + /** Class representing the actual functional/business content + for the Bom root. */ + class YieldStore : public YieldStoreContent { + friend class FacBomContent; + + public: + // ///////////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated parent. */ + typedef BR Parent_T; + + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef YieldStoreStructure_T BomStructure_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< > ChildrenHolderTypeMap_T; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + + + private: + /** Retrieve the BOM structure object. */ + BomStructure_T& getStructure () { + return _structure; + } + + + 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 _key.toString(); } + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Default constructors. */ + YieldStore (); + YieldStore (const YieldStore&); + YieldStore (const BomKey_T& iKey, BomStructure_T& ioStructure); + /** Destructor. */ + virtual ~YieldStore(); + + private: + // Attributes + /** Reference structure. */ + BomStructure_T& _structure; + }; + +} +#endif // __STDAIR_BOM_YIELDSTORE_HPP Added: trunk/stdair/stdair/bom/YieldStoreContent.cpp =================================================================== --- trunk/stdair/stdair/bom/YieldStoreContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStoreContent.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,20 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/YieldStoreContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + YieldStoreContent::YieldStoreContent (const BomKey_T& iKey) : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + YieldStoreContent::~YieldStoreContent () { + } + +} + Added: trunk/stdair/stdair/bom/YieldStoreContent.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStoreContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStoreContent.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,75 @@ +#ifndef __STDAIR_BOM_YIELDSTORECONTENT_HPP +#define __STDAIR_BOM_YIELDSTORECONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/YieldStoreKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline YieldStore. */ + class YieldStoreContent : public BomContent { + public : + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef YieldStoreKey_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 airline code. */ + const AirlineCode_T& getAirlineCode () const { + return _key.getAirlineCode(); + } + + /** Get the YieldStore key. */ + const BomKey_T& getKey() const { + return _key; + } + + + public: + // ///////// Setters ////////// + + + protected: + /** Default constructors. */ + YieldStoreContent (const BomKey_T&); + YieldStoreContent (const YieldStoreContent&); + + /** Destructor. */ + virtual ~YieldStoreContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + BomKey_T _key; + }; + +} +#endif // __STDAIR_BOM_YIELDSTORECONTENT_HPP + Added: trunk/stdair/stdair/bom/YieldStoreKey.cpp =================================================================== --- trunk/stdair/stdair/bom/YieldStoreKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStoreKey.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,43 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/YieldStoreKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + YieldStoreKey_T::YieldStoreKey_T (const AirlineCode_T& iAirlineCode) + : _airlineCode (iAirlineCode) { + } + // //////////////////////////////////////////////////////////////////// + YieldStoreKey_T::YieldStoreKey_T (const YieldStoreKey_T& iKey) + : _airlineCode (iKey._airlineCode) { + } + + // //////////////////////////////////////////////////////////////////// + YieldStoreKey_T::~YieldStoreKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void YieldStoreKey_T::toStream (std::ostream& ioOut) const { + ioOut << "YieldStoreKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void YieldStoreKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string YieldStoreKey_T::toString() const { + std::ostringstream oStr; + oStr << _airlineCode; + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string YieldStoreKey_T::describe() const { + return toString(); + } + +} Added: trunk/stdair/stdair/bom/YieldStoreKey.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStoreKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStoreKey.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,70 @@ +#ifndef __STDAIR_BOM_YIELDSTOREKEY_HPP +#define __STDAIR_BOM_YIELDSTOREKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/BomRootKey.hpp> + +namespace stdair { + + /** Key of YieldStore. */ + struct YieldStoreKey_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 ////////// + YieldStoreKey_T () { }; + + public: + // /////////// Construction /////////// + /** Constructors. */ + YieldStoreKey_T (const AirlineCode_T& iAirlineCode); + YieldStoreKey_T (const YieldStoreKey_T&); + /** Destructor. */ + ~YieldStoreKey_T (); + + // /////////// Getters ////////// + /** Get the airline code. */ + const AirlineCode_T& getAirlineCode() const { + return _airlineCode; + } + + // /////////// 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) const { } + + private: + // Attributes + /** Airline code. */ + AirlineCode_T _airlineCode; + }; + +} +#endif // __STDAIR_BOM_YIELDSTOREKEY_HPP Added: trunk/stdair/stdair/bom/YieldStoreTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStoreTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/YieldStoreTypes.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -0,0 +1,32 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_YIELDSTORETYPES_HPP +#define __STDAIR_BOM_YIELDSTORETYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class YieldStore; + + /** Define the BomRootStructure. */ + typedef Structure<YieldStore> YieldStoreStructure_T; + + /** Define the Inventory holder type. */ + typedef BomChildrenHolderImp<YieldStore> YieldStoreHolder_T; + + /** Define the Inventory list. */ + typedef BomList_T<YieldStore> YieldStoreList_T; + + /** Define the Inventory map. */ + typedef BomMap_T<YieldStore> YieldStoreMap_T; + +} +#endif // __STDAIR_BOM_YIELDSTORETYPES_HPP + Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/bom/sources.mk 2010-04-18 00:01:41 UTC (rev 174) @@ -3,6 +3,7 @@ $(top_srcdir)/stdair/bom/BomMap.hpp \ $(top_srcdir)/stdair/bom/BomKey.hpp \ $(top_srcdir)/stdair/bom/BomRootKey.hpp \ + $(top_srcdir)/stdair/bom/YieldStoreKey.hpp \ $(top_srcdir)/stdair/bom/InventoryKey.hpp \ $(top_srcdir)/stdair/bom/FlightDateKey.hpp \ $(top_srcdir)/stdair/bom/LegDateKey.hpp \ @@ -98,6 +99,9 @@ $(top_srcdir)/stdair/bom/BomManager.hpp \ $(top_srcdir)/stdair/bom/Structure.hpp \ $(top_srcdir)/stdair/bom/BRTypes.hpp \ + $(top_srcdir)/stdair/bom/YieldStore.hpp \ + $(top_srcdir)/stdair/bom/YieldStoreTypes.hpp \ + $(top_srcdir)/stdair/bom/YieldStoreContent.hpp \ $(top_srcdir)/stdair/bom/IN.hpp \ $(top_srcdir)/stdair/bom/FD.hpp \ $(top_srcdir)/stdair/bom/FDTypes.hpp \ @@ -117,6 +121,7 @@ $(top_srcdir)/stdair/bom/NDTypes.hpp bom_cc_sources = \ $(top_srcdir)/stdair/bom/BomRootKey.cpp \ + $(top_srcdir)/stdair/bom/YieldStoreKey.cpp \ $(top_srcdir)/stdair/bom/InventoryKey.cpp \ $(top_srcdir)/stdair/bom/FlightDateKey.cpp \ $(top_srcdir)/stdair/bom/LegDateKey.cpp \ @@ -171,6 +176,8 @@ $(top_srcdir)/stdair/bom/EventStruct.cpp \ $(top_srcdir)/stdair/bom/EventQueue.cpp \ $(top_srcdir)/stdair/bom/BomManager.cpp \ + $(top_srcdir)/stdair/bom/YieldStore.cpp \ + $(top_srcdir)/stdair/bom/YieldStoreContent.cpp \ $(top_srcdir)/stdair/bom/BR.cpp \ $(top_srcdir)/stdair/bom/IN.cpp \ $(top_srcdir)/stdair/bom/FD.cpp \ Modified: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -6,6 +6,8 @@ // Boost #include <boost/make_shared.hpp> // StdAir +#include <stdair/bom/BR.hpp> +#include <stdair/bom/YieldStore.hpp> #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/AirlineFeatureSet.hpp> #include <stdair/bom/AirlineFeature.hpp> @@ -79,7 +81,6 @@ 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); @@ -109,4 +110,40 @@ return *lInventory_ptr; } + // ////////////////////////////////////////////////////////////////////// + YieldStore& CmdBomManager:: + createYieldStoreInternal (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { + YieldStoreKey_T lYieldStoreKey (iAirlineCode); + + // Instantiate an YieldStore object with the given airline code + YieldStore& lYieldStore = + stdair::FacBomContent::instance().testCreate<YieldStore> (lYieldStoreKey); + + // TODO: migrate to the new StdAir structure (e.g., IN, FD, etc.) + // Link the created YieldStore with the bom root. + // FacBomContent::testLink<YieldStore> (lYieldStore, ioBomRoot); + + return lYieldStore; + } + + // ////////////////////////////////////////////////////////////////////// + YieldStore& CmdBomManager:: + getOrCreateYieldStore (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { + YieldStore* lYieldStore_ptr = ioBomRoot.getYieldStore (iAirlineCode); + + // If there is no YieldStore object for that airline already, create one + if (lYieldStore_ptr == NULL) { + const YieldStoreKey_T lYieldStoreKey (iAirlineCode); + + // Instantiate a YieldStore object with the given airline code + lYieldStore_ptr = &createYieldStoreInternal (ioBomRoot, iAirlineCode); + assert (lYieldStore_ptr != NULL); + } + assert (lYieldStore_ptr != NULL); + + return *lYieldStore_ptr; + } + } Modified: trunk/stdair/stdair/command/CmdBomManager.hpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.hpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/command/CmdBomManager.hpp 2010-04-18 00:01:41 UTC (rev 174) @@ -30,6 +30,18 @@ created . */ static Inventory& getOrCreateInventory (BomRoot&, const AirlineCode_T&); + /** If needed, create the YieldStore corresponding to the given airline code + (YieldStore 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 YieldStore 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 YieldStore to be + created . */ + static YieldStore& getOrCreateYieldStore (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&); @@ -54,6 +66,14 @@ @param const AirlineCode_T& Airline code for the inventory to be created . */ static Inventory& createInventoryInternal (BomRoot&, const AirlineCode_T&); + + /** Create the YieldStore corresponding to the given airline code + (YieldStore key). + @param BomRoot& Root of the BOM tree. + @param const AirlineCode_T& Airline code for the YieldStore to be + created . */ + static YieldStore& createYieldStoreInternal (BomRoot&, + const AirlineCode_T&); }; } Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-04-09 15:31:37 UTC (rev 173) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-04-18 00:01:41 UTC (rev 174) @@ -9,6 +9,7 @@ #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/Network.hpp> #include <stdair/bom/Inventory.hpp> +#include <stdair/bom/YieldStore.hpp> #include <stdair/factory/FacSupervisor.hpp> #include <stdair/factory/FacBomContent.hpp> #include <stdair/command/CmdBomManager.hpp> @@ -129,6 +130,19 @@ return *lInventory_ptr; } + // ////////////////////////////////////////////////////////////////////// + YieldStore& STDAIR_Service:: + getYieldStore (const AirlineCode_T& iAirlineCode) const { + + YieldStore* lYieldStore_ptr = _bomRoot.getYieldStore (iAirlineCode); + if (lYieldStore_ptr == NULL) { + throw ObjectNotFoundException(); + } + assert (lYieldStore_ptr != NULL); + + return *lYieldStore_ptr; + } + /** Note that the AirlineFeature is linked both to the Inventory and to the AirlineFeatureSet, which in turn is linked to the BomRoot. @@ -144,4 +158,13 @@ return oInventory; } + // ////////////////////////////////////////////////////////////////////// + YieldStore& STDAIR_Service:: + createYieldStore (const AirlineCode_T& iAirlineCode) const { + // Delegate to the dedicated command + YieldStore& oYieldStore = + CmdBomManager::getOrCreateYieldStore (_bomRoot, iAirlineCode); + return oYieldStore; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-04-22 11:03:19
|
Revision: 177 http://stdair.svn.sourceforge.net/stdair/?rev=177&view=rev Author: quannaus Date: 2010-04-22 11:03:11 +0000 (Thu, 22 Apr 2010) Log Message: ----------- [Dev] New version of stdair. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasTypes.hpp trunk/stdair/stdair/basic/DemandCharacteristics.hpp trunk/stdair/stdair/batches/stdair.cpp 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/AirlineFeatureTypes.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/AirportDateTypes.hpp trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomContent.hpp trunk/stdair/stdair/bom/BomIterator.hpp trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomList.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BomMap.hpp 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.cpp trunk/stdair/stdair/bom/BomRootKey.hpp trunk/stdair/stdair/bom/BomRootTypes.hpp trunk/stdair/stdair/bom/BomStructure.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/BookingClassKey.cpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/BucketContent.cpp trunk/stdair/stdair/bom/BucketContent.hpp trunk/stdair/stdair/bom/BucketKey.cpp trunk/stdair/stdair/bom/BucketKey.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/DemandStreamContent.cpp trunk/stdair/stdair/bom/DemandStreamContent.hpp trunk/stdair/stdair/bom/DemandStreamKey.cpp trunk/stdair/stdair/bom/DemandStreamKey.hpp trunk/stdair/stdair/bom/DemandStreamTypes.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/FlightDateKey.cpp trunk/stdair/stdair/bom/FlightDateKey.hpp trunk/stdair/stdair/bom/FlightDateTypes.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/InventoryKey.cpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/InventoryTypes.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/LegCabinKey.cpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/LegCabinTypes.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/LegDateKey.cpp trunk/stdair/stdair/bom/LegDateKey.hpp trunk/stdair/stdair/bom/LegDateTypes.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/NetworkDateTypes.hpp trunk/stdair/stdair/bom/NetworkKey.cpp trunk/stdair/stdair/bom/NetworkKey.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/OutboundPathTypes.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/SegmentCabinKey.cpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/SegmentCabinTypes.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/SegmentDateKey.cpp trunk/stdair/stdair/bom/SegmentDateKey.hpp trunk/stdair/stdair/bom/SegmentDateTypes.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/YieldStore.cpp trunk/stdair/stdair/bom/YieldStore.hpp trunk/stdair/stdair/bom/YieldStoreContent.cpp trunk/stdair/stdair/bom/YieldStoreContent.hpp trunk/stdair/stdair/bom/YieldStoreKey.cpp trunk/stdair/stdair/bom/YieldStoreKey.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Added Paths: ----------- trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/BomTypes.hpp trunk/stdair/stdair/bom/Bucket.cpp trunk/stdair/stdair/bom/Bucket.hpp trunk/stdair/stdair/bom/BucketTypes.hpp Removed Paths: ------------- 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/AirportDateStructure.hpp trunk/stdair/stdair/bom/BC.cpp trunk/stdair/stdair/bom/BC.hpp trunk/stdair/stdair/bom/BCTypes.hpp trunk/stdair/stdair/bom/BK.cpp trunk/stdair/stdair/bom/BK.hpp trunk/stdair/stdair/bom/BKTypes.hpp trunk/stdair/stdair/bom/BR.cpp trunk/stdair/stdair/bom/BR.hpp trunk/stdair/stdair/bom/BRTypes.hpp trunk/stdair/stdair/bom/BomRootStructure.hpp trunk/stdair/stdair/bom/BomStopStructure.hpp trunk/stdair/stdair/bom/BookingClassStructure.hpp trunk/stdair/stdair/bom/DemandStreamStructure.hpp trunk/stdair/stdair/bom/FD.cpp trunk/stdair/stdair/bom/FD.hpp trunk/stdair/stdair/bom/FDTypes.hpp trunk/stdair/stdair/bom/FlightDateStructure.hpp trunk/stdair/stdair/bom/IN.cpp trunk/stdair/stdair/bom/IN.hpp trunk/stdair/stdair/bom/INTypes.hpp trunk/stdair/stdair/bom/InventoryStructure.hpp trunk/stdair/stdair/bom/LC.cpp trunk/stdair/stdair/bom/LC.hpp trunk/stdair/stdair/bom/LCTypes.hpp trunk/stdair/stdair/bom/LD.cpp trunk/stdair/stdair/bom/LD.hpp trunk/stdair/stdair/bom/LDTypes.hpp trunk/stdair/stdair/bom/LegCabinStructure.hpp trunk/stdair/stdair/bom/LegDateStructure.hpp trunk/stdair/stdair/bom/ND.cpp trunk/stdair/stdair/bom/ND.hpp trunk/stdair/stdair/bom/NDTypes.hpp trunk/stdair/stdair/bom/NetworkDateStructure.hpp trunk/stdair/stdair/bom/NetworkStructure.hpp trunk/stdair/stdair/bom/OutboundPathStructure.hpp trunk/stdair/stdair/bom/SC.cpp trunk/stdair/stdair/bom/SC.hpp trunk/stdair/stdair/bom/SCTypes.hpp trunk/stdair/stdair/bom/SD.cpp trunk/stdair/stdair/bom/SD.hpp trunk/stdair/stdair/bom/SDTypes.hpp trunk/stdair/stdair/bom/SegmentCabinStructure.hpp trunk/stdair/stdair/bom/SegmentDateStructure.hpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -104,14 +104,6 @@ in order to secure the access to the corresponding resources. */ void init (); - /** Initialise the AirlineFeatureSet object, and attach it to the - BomRoot. */ - void initAirlineFeatureSet (); - - /** Initialise the DemandStreamList object, and attach it to the - BomRoot. */ - void initDemandStreamList (); - /** Finalise. */ void finalise (); Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -478,6 +478,9 @@ /** Type of frequent flyer (P=Platinum, G=Gold, S=Silver, M=Member, N=None). */ typedef std::string FrequentFlyer_T; + + /** Key of a STL map. */ + typedef std::string MapKey_T; } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/basic/BasTypes.hpp =================================================================== --- trunk/stdair/stdair/basic/BasTypes.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/basic/BasTypes.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -10,7 +10,5 @@ namespace stdair { - /** Key of a STL map. */ - typedef std::string MapKey_T; } #endif // __STDAIR_BAS_BASTYPES_HPP Modified: trunk/stdair/stdair/basic/DemandCharacteristics.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -15,8 +15,8 @@ /** Class modeling the characteristics of a demand type. */ struct DemandCharacteristics { - public: + public: // ///////////// Getters /////////// /** Get the arrival pattern. */ const ContinuousFloatDuration_T& getArrivalPattern() const { @@ -83,8 +83,7 @@ const ValueOfTimeContinuousDistribution_T&); /** Destructor */ - virtual ~DemandCharacteristics (); - + ~DemandCharacteristics (); private: /** Default constructor. */ DemandCharacteristics (); Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -6,17 +6,6 @@ #include <string> // StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/BR.hpp> -#include <stdair/bom/BRTypes.hpp> -#include <stdair/bom/IN.hpp> -#include <stdair/bom/InventoryKey.hpp> -#include <stdair/bom/INTypes.hpp> -#include <stdair/bom/FD.hpp> -#include <stdair/bom/FlightDateKey.hpp> -#include <stdair/bom/FDTypes.hpp> -#include <stdair/bom/ND.hpp> -#include <stdair/bom/NetworkDateKey.hpp> -#include <stdair/bom/NDTypes.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/factory/FacBomContent.hpp> @@ -26,47 +15,6 @@ try { - stdair::BR& lBR = - stdair::FacBomContent::instance().testCreate<stdair::BR> (); - - stdair::InventoryKey_T lINKey ("BA"); - stdair::IN& lIN = - stdair::FacBomContent::instance().testCreate<stdair::IN> (lINKey); - stdair::FacBomContent::testLink (lIN, lBR); - - stdair::FlightDateKey_T lFDKey (17, stdair::Date_T (2010, 02, 14)); - stdair::FD& lFD = - stdair::FacBomContent::instance().testCreate<stdair::FD> (lFDKey); - stdair::FacBomContent::testLink (lFD, lIN); - - stdair::NetworkDateKey_T lNDKey (stdair::Date_T (2010, 02, 14)); - stdair::ND& lND = - stdair::FacBomContent::instance().testCreate<stdair::ND> (lNDKey); - stdair::FacBomContent::testLink (lND, lIN); - - - // Browse - stdair::INList_T lINList = lBR.getINList(); - for (stdair::INList_T::iterator it = lINList.begin(); - it != lINList.end(); ++it) { - const stdair::IN& lCurrentIN = *it; - std::cout << "Current IN: " << lCurrentIN.toString() << std::endl; - - stdair::FDList_T lFDList = lIN.getFDList(); - for (stdair::FDList_T::iterator it = lFDList.begin(); - it != lFDList.end(); ++it) { - const stdair::FD& lCurrentFD = *it; - std::cout << "Current FD: " << lCurrentFD.toString() << std::endl; - } - stdair::NDList_T lNDList = lIN.getNDList(); - for (stdair::NDList_T::iterator it = lNDList.begin(); - it != lNDList.end(); ++it) { - const stdair::ND& lCurrentND = *it; - std::cout << "Current ND: " << lCurrentND.toString() << std::endl; - } - - } - } catch (const std::exception& stde) { std::cerr << "Standard exception: " << stde.what() << std::endl; return -1; Modified: trunk/stdair/stdair/bom/AirlineFeature.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeature.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -7,17 +7,16 @@ #include <ostream> #include <sstream> // STDAIR -#include <stdair/bom/AirlineFeatureStructure.hpp> #include <stdair/bom/AirlineFeature.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// AirlineFeature:: - AirlineFeature (const BomKey_T& iKey, - BomStructure_T& ioAirlineFeatureStructure) + AirlineFeature (const Key_T& iKey, + Structure_T& ioAirlineFeatureStructure) : AirlineFeatureContent (iKey), - _airlineFeatureStructure (ioAirlineFeatureStructure) { + _structure (ioAirlineFeatureStructure) { } // //////////////////////////////////////////////////////////////////// @@ -34,23 +33,23 @@ iOptimizerStruct, iControlMode); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// 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; + oStr << describeKey() << std::endl; return oStr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string AirlineFeature::describe() const { std::ostringstream ostr; ostr << describeKey() @@ -61,13 +60,8 @@ return ostr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string AirlineFeature::describeKey() const { - return _key.describe(); - } - - // ////////////////////////////////////////////////////////////////////// - const std::string AirlineFeature::describeShortKey() const { return _key.toString(); } Modified: trunk/stdair/stdair/bom/AirlineFeature.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -4,51 +4,40 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -#include <string> // 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 - struct AirlineFeatureKey_T; + class BomRoot; - /** Class representing the actual functional/business content for a segment-cabin. */ class AirlineFeature : public AirlineFeatureContent { friend class FacBomContent; - public: - // //////////// Type definitions ////////////// + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef AirlineFeatureStructure_T Structure_T; + /** Definition allowing to retrieve the associated parent BOM content type. */ - typedef AirlineFeatureSet Parent_T; + typedef BomRoot Parent_T; - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef AirlineFeatureStructure_T BomStructure_T; + /** Define the list of children holder types. */ + typedef boost::fusion::map< > ChildrenHolderMap_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: // //////////// Setters ///////////// /** Intialisation method. */ void init (const ForecasterMode_T&, const HistoricalDataLimit_T&, const OptimizerStruct_T&, const ControlMode_T&); - public: // /////////// Display support methods ///////////// @@ -67,21 +56,9 @@ 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 and destructors ///////////////// /** Constructors are private so as to force the usage of the Factory @@ -89,8 +66,7 @@ /** Default constructors. */ AirlineFeature (); AirlineFeature (const AirlineFeature&); - AirlineFeature (const BomKey_T&, BomStructure_T&); - + AirlineFeature (const Key_T&, Structure_T&); /** Destructor. */ virtual ~AirlineFeature(); @@ -98,7 +74,7 @@ protected: // ////////////////////// Attributes /////////////////////////// /** Reference structure. */ - BomStructure_T& _airlineFeatureStructure; + Structure_T& _structure; }; } Modified: trunk/stdair/stdair/bom/AirlineFeatureContent.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -10,7 +10,7 @@ // //////////////////////////////////////////////////////////////////// AirlineFeatureContent:: - AirlineFeatureContent (const BomKey_T& iKey) + AirlineFeatureContent (const Key_T& iKey) : _key (iKey) { } Modified: trunk/stdair/stdair/bom/AirlineFeatureContent.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureContent.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureContent.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -5,7 +5,6 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STDAIR -#include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/AirlineFeatureKey.hpp> #include <stdair/bom/OptimizerStruct.hpp> @@ -17,12 +16,12 @@ public: // Type definitions. /** Definition allowing to retrieve the associated BOM key type. */ - typedef AirlineFeatureKey_T BomKey_T; + typedef AirlineFeatureKey_T Key_T; public: // /////////// Getters //////////// /** Get the airline feature key. */ - const BomKey_T& getKey() const { + const Key_T& getKey() const { return _key; } @@ -44,29 +43,23 @@ /** 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; - + const std::string describeShortKey() const { return _key.toString(); } protected: /** Default constructors. */ AirlineFeatureContent (); AirlineFeatureContent (const AirlineFeatureContent&); - AirlineFeatureContent (const BomKey_T&); - + AirlineFeatureContent (const Key_T&); /** Destructor. */ virtual ~AirlineFeatureContent(); protected: // Attributes /** The key of both structure and content objects. */ - BomKey_T _key; + Key_T _key; /** The type of forecaster. */ ForecasterMode_T _forecasterMode; Modified: trunk/stdair/stdair/bom/AirlineFeatureKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureKey.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -31,9 +31,4 @@ 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 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureKey.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -5,20 +5,13 @@ // Import section // ////////////////////////////////////////////////////////////////////// // 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); @@ -30,9 +23,6 @@ /** Get the airline code. */ 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. */ @@ -49,9 +39,6 @@ marketing classes for the same segment-date. */ const std::string toString() const; - /** Display of the key. */ - const std::string describe() const; - private: // Attributes /** Airline code. */ Deleted: trunk/stdair/stdair/bom/AirlineFeatureSet.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,92 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -#include <istream> -#include <ostream> -#include <sstream> -// STDAIR -#include <stdair/bom/AirlineFeatureSetStructure.hpp> -#include <stdair/bom/AirlineFeatureSet.hpp> -#include <stdair/bom/AirlineFeature.hpp> -#include <stdair/bom/BomList.hpp> -#include <stdair/bom/BomMap.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - AirlineFeatureSet:: - AirlineFeatureSet (const BomKey_T& iKey, - BomStructure_T& ioAirlineFeatureSetStructure) - : AirlineFeatureSetContent (iKey), - _bomStructure (ioAirlineFeatureSetStructure) { - } - - // //////////////////////////////////////////////////////////////////// - AirlineFeatureSet::~AirlineFeatureSet () { - } - - // ////////////////////////////////////////////////////////////////////// - void AirlineFeatureSet::toStream (std::ostream& ioOut) const { - ioOut << toString(); - } - - // ////////////////////////////////////////////////////////////////////// - void AirlineFeatureSet::fromStream (std::istream& ioIn) { - } - - // ////////////////////////////////////////////////////////////////////// - std::string AirlineFeatureSet::toString() const { - return describeShortKey(); - } - - // ////////////////////////////////////////////////////////////////////// - const std::string AirlineFeatureSet::describeKey() const { - return _key.describe(); - } - - // ////////////////////////////////////////////////////////////////////// - const std::string AirlineFeatureSet::describeShortKey() const { - return _key.toString(); - } - - // ////////////////////////////////////////////////////////////////////// - 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 _bomStructure.getChildrenHolder(); - } - - // ////////////////////////////////////////////////////////////////////// - AirlineFeatureMap_T AirlineFeatureSet::getAirlineFeatureMap () const { - return _bomStructure.getChildrenHolder(); - } - - // ////////////////////////////////////////////////////////////////////// - AirlineFeature* AirlineFeatureSet:: - getAirlineFeature (const AirlineFeatureKey_T& iKey) const { - return _bomStructure.getContentChild (iKey); - } - -} Deleted: trunk/stdair/stdair/bom/AirlineFeatureSet.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSet.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,110 +0,0 @@ -#ifndef __STDAIR_BOM_AIRLINEFEATURESET_HPP -#define __STDAIR_BOM_AIRLINEFEATURESET_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -#include <string> -// 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 AirlineFeatureKey_T; - struct AirlineFeatureSetKey_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; - - /** 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; - - /** 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. */ - AirlineFeature* getAirlineFeature (const AirlineFeatureKey_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 _bomStructure; - } - - - protected: - // ///////////////// Constructors and destructors ///////////////// - /** 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& _bomStructure; - }; - -} -#endif // __STDAIR_BOM_AIRLINEFEATURESET_HPP Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetContent.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,20 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/AirlineFeatureSetContent.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - AirlineFeatureSetContent::AirlineFeatureSetContent (const BomKey_T& iKey) - : _key (iKey) { - } - - // //////////////////////////////////////////////////////////////////// - AirlineFeatureSetContent::~AirlineFeatureSetContent () { - } - -} Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetContent.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,68 +0,0 @@ -#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 Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,38 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// 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) { - } - - // //////////////////////////////////////////////////////////////////// - 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(); - } - -} Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetKey.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,49 +0,0 @@ -#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. */ - 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. - }; - -} -#endif // __STDAIR_BOM_AIRLINEFEATURESETKEY_HPP Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetStructure.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,152 +0,0 @@ -#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/BomStopStructure.hpp> -#include <stdair/bom/BomStopContent.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> - 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; - - /** 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. */ - typedef typename BOM_CONTENT::BomKey_T BomKey_T; - - /** Definition allowing to retrieve the associated children type. */ - typedef boost::mpl::vector<AirlineFeatureStructure<ContentChild_T>, BomStopStructure> 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; - - public: - // /////////// Getters ///////////// - /** Get the AirlineFeatureSet key. */ - const BomKey_T& getKey () const { - assert (_content != NULL); - return _content->getKey (); - } - - /** Get the holder of airline features. */ - const ChildrenBomHolder_T& getChildrenHolder() const { - assert (_childrenHolder != NULL); - return *_childrenHolder; - } - - /** Get the holder of airline features. */ - void getChildrenHolder (ChildrenBomHolder_T*& ioChildrenHolder) { - ioChildrenHolder = _childrenHolder; - } - - /** 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 (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 //////////////// - /** Default children holder setter. */ - void setChildrenHolder (DefaultChildrenBomHolder_T&) { } - - /** Set the 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 describeShortKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return getKey().describe(); } - - /** 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), _childrenHolder (NULL) { }; - AirlineFeatureSetStructure (const AirlineFeatureSetStructure&); - - /** Destructor. */ - ~AirlineFeatureSetStructure () { } - - private: - // Attributes - /** The actual functional (Business Object) content. */ - BOM_CONTENT* _content; - - /** Holder of inventories. */ - ChildrenBomHolder_T* _childrenHolder; - }; - -} -#endif // __STDAIR_BOM_AIRLINEFEATURESETSTRUCTURE_HPP - Deleted: trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureSetTypes.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,19 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -#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 - Deleted: trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureStructure.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,113 +0,0 @@ -#ifndef __STDAIR_BOM_AIRLINEFEATURESTRUCTURE_HPP -#define __STDAIR_BOM_AIRLINEFEATURESTRUCTURE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -// MPL -#include <boost/mpl/vector.hpp> -// STDAIR -#include <stdair/bom/BomStopStructure.hpp> -#include <stdair/bom/BomStopContent.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 <BomStopStructure, - BomStopStructure> ChildrenBomTypeList_T; - - /** Definition allowing to retrieve the default children bom holder type. */ - typedef BomChildrenHolderImp<BomStopContent> 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 holder setter. */ - void setChildrenHolder (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 describeShortKey(); } - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const { return getKey().describe(); } - - /** 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 Modified: trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -12,19 +12,17 @@ namespace stdair { // Forward declarations. - template <typename BOM_CONTENT> class AirlineFeatureStructure; + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; template <typename BOM> struct BomList_T; template <typename BOM> struct BomMap_T; class AirlineFeature; /** Define the airline feature structure. */ - typedef AirlineFeatureStructure<AirlineFeature> AirlineFeatureStructure_T; - - /** Define the airline feature structure list. */ - typedef std::vector<AirlineFeatureStructure_T*> AirlineFeatureStructureList_T; + typedef Structure<AirlineFeature> AirlineFeatureStructure_T; - /** Define the airline feature structure map. */ - typedef std::map<const std::string, AirlineFeatureStructure_T*> AirlineFeatureStructureMap_T; + /** Define the airline feature holder. */ + typedef BomChildrenHolderImp<AirlineFeature> AirlineFeatureHolder_T; /** Define the airline feature list. */ typedef BomList_T<AirlineFeature> AirlineFeatureList_T; Modified: trunk/stdair/stdair/bom/AirportDate.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirportDate.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -1,22 +1,18 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> +// STL +#include <cassert> // STDAIR #include <stdair/basic/BasConst_Inventory.hpp> -#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> +#include <stdair/bom/BomSource.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - AirportDate::AirportDate (const BomKey_T& iKey, - BomStructure_T& ioAirportStructure) - : AirportDateContent (iKey), _airportDateStructure (ioAirportStructure) { + AirportDate::AirportDate (const Key_T& iKey, + Structure_T& ioAirportStructure) + : AirportDateContent (iKey), _structure (ioAirportStructure) { } // //////////////////////////////////////////////////////////////////// @@ -35,34 +31,25 @@ // //////////////////////////////////////////////////////////////////// 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 _key.describe(); + std::ostringstream oStr; + oStr << _structure.describeParentKey() << ", " << describeShortKey(); + return oStr.str(); } // //////////////////////////////////////////////////////////////////// - const std::string AirportDate::describeShortKey() const { - return _key.toString(); - } - - // //////////////////////////////////////////////////////////////////// OutboundPathList_T AirportDate::getOutboundPathList () const { - return _airportDateStructure.getChildrenHolder(); + return _structure.getChildrenHolder<OutboundPath>(); } // //////////////////////////////////////////////////////////////////// OutboundPathMap_T AirportDate::getOutboundPathMap () const { - return _airportDateStructure.getChildrenHolder(); + return _structure.getChildrenHolder<OutboundPath>(); } Modified: trunk/stdair/stdair/bom/AirportDate.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirportDate.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -5,17 +5,14 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STDAIR -#include <stdair/bom/NetworkDate.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 NetworkDate; + class OutboundPath; /** Class representing the actual functional/business content for a airport-date. */ @@ -23,21 +20,38 @@ friend class FacBomContent; public: - // Type definitions + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef AirportDateStructure_T Structure_T; + /** Definition allowing to retrieve the associated parent BOM content type. */ typedef NetworkDate Parent_T; - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef AirportDateStructure_T BomStructure_T; + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<OutboundPath, OutboundPathHolder_T*> + > ChildrenHolderMap_T; + // ////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + /** Get a list or map of a children type for iteration methods. */ + OutboundPathList_T getOutboundPathList () const; + OutboundPathMap_T getOutboundPathMap () const; - /** 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; + /** Get the OutboundPathListList. */ + const OutboundPathListList_T& getOutboundPathListList () const { + return _outboundPathListList; + } + public: + // //////////// Business Methods ////////////// + /** Build the list of lists of outbound paths. **/ + void buildOutboundPathListList (stdair::OutboundPath&); public: // /////////// Display support methods ///////// @@ -56,49 +70,21 @@ 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; - - /** Get the OutboundPathListList. */ - const OutboundPathListList_T& getOutboundPathListList () const { - return _outboundPathListList; - } - - private: - /** Retrieve the BOM structure object. */ - BomStructure_T& getBomStructure () { - return _airportDateStructure; - } - - public: - // //////////// Business Methods ////////////// - /** Build the list of lists of outbound paths. **/ - void buildOutboundPathListList (stdair::OutboundPath&); - protected: /** Constructors are private so as to force the usage of the Factory layer. */ + /** Constructors. */ + AirportDate (const Key_T&, Structure_T&); + /** Destructor. */ + virtual ~AirportDate(); /** Default constructors. */ AirportDate (); AirportDate (const AirportDate&); - AirportDate (const BomKey_T&, BomStructure_T&); - /** Destructor. */ - virtual ~AirportDate(); - protected: // Attributes /** Reference structure. */ - BomStructure_T& _airportDateStructure; + Structure_T& _structure; /** The list of lists of OutboundPaths, used uniquement for the construction of the main list of OutboundPaths in Modified: trunk/stdair/stdair/bom/AirportDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.cpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirportDateContent.cpp 2010-04-22 11:03:11 UTC (rev 177) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - AirportDateContent::AirportDateContent (const BomKey_T& iKey) \ + AirportDateContent::AirportDateContent (const Key_T& iKey) \ : _key (iKey) { } Modified: trunk/stdair/stdair/bom/AirportDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.hpp 2010-04-18 10:44:47 UTC (rev 176) +++ trunk/stdair/stdair/bom/AirportDateContent.hpp 2010-04-22 11:03:11 UTC (rev 177) @@ -15,12 +15,12 @@ public: // Type definitions. /** Definition allowing to retrieve the associated BOM key type. */ - typedef AirportDateKey_T BomKey_T; + typedef AirportDateKey_T Key_T; public: // /////////// Getters ///////////// /** Get the airport-date key. */ - const BomKey_T& getKey() const { + const Key_T& getKey() const { return _key; } @@ -42... [truncated message content] |
From: <qua...@us...> - 2010-04-22 14:02:37
|
Revision: 181 http://stdair.svn.sourceforge.net/stdair/?rev=181&view=rev Author: quannaus Date: 2010-04-22 14:02:30 +0000 (Thu, 22 Apr 2010) Log Message: ----------- [dev] 'linkTwoObjects' in FacBomContent now uses the full keys. Modified Paths: -------------- trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-22 12:25:56 UTC (rev 180) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-22 14:02:30 UTC (rev 181) @@ -48,15 +48,6 @@ // Link the created inventory with the bom root. FacBomContent::linkWithParent (lInventory, ioBomRoot); - - // DEBUG - STDAIR_LOG_DEBUG ("Generated inventory: " << iAirlineCode); - const InventoryList_T lInvList = ioBomRoot.getInventoryList(); - for (InventoryList_T::iterator itInv = lInvList.begin(); - itInv != lInvList.end(); ++itInv) { - const Inventory& lCurrentInv = *itInv; - STDAIR_LOG_DEBUG ("Current inventory: " << lCurrentInv.describeKey()); - } return lInventory; } Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-22 12:25:56 UTC (rev 180) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-04-22 14:02:30 UTC (rev 181) @@ -73,7 +73,8 @@ } // ////////////////////////////////////////////////////////////////// - /** Link two child content objects, the second one into the first one. */ + /** Link two child content objects, the second one into the first one, + using the short key. */ template <typename PARENT, typename CHILD> static void addObjectToTheDedicatedList (PARENT& ioParent, const CHILD& iChild) { @@ -89,11 +90,28 @@ } // ////////////////////////////////////////////////////////////////// + /** Link two child content objects, the second one into the first one, + using the full key. */ + template <typename PARENT, typename CHILD> + static void addFullObjectToTheDedicatedList (PARENT& ioParent, + const CHILD& iChild) { + + // Link both the parent and child structure objects + const bool hasLinkBeenSuccessful = + FacBomStructure::addFullObjectToTheDedicatedList (ioParent._structure, + iChild._structure); + + if (hasLinkBeenSuccessful == false) { + throw ObjectLinkingException(); + } + } + + // ////////////////////////////////////////////////////////////////// /** Link two child content objects. */ template <typename OBJECT1, typename OBJECT2> static void linkTwoObjects (OBJECT1& ioObject1, OBJECT2& ioObject2) { - addObjectToTheDedicatedList (ioObject1, ioObject2); - addObjectToTheDedicatedList (ioObject2, ioObject1); + addFullObjectToTheDedicatedList (ioObject1, ioObject2); + addFullObjectToTheDedicatedList (ioObject2, ioObject1); } // ////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-22 12:25:56 UTC (rev 180) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-04-22 14:02:30 UTC (rev 181) @@ -49,7 +49,8 @@ } // ////////////////////////////////////////////////////////////////// - /** Link two child structure objects, the second one into the first one. */ + /** Link two child structure objects, the second one into the first one, + using the short key. */ template <typename PARENT, typename CHILD> static bool addObjectToTheDedicatedList (PARENT& ioParent, const CHILD& iChild) { @@ -69,6 +70,28 @@ } // ////////////////////////////////////////////////////////////////// + /** Link two child structure objects, the second one into the first one, + using the full key. */ + template <typename PARENT, typename CHILD> + static bool addFullObjectToTheDedicatedList (PARENT& ioParent, + const CHILD& iChild) { + // Retrive the bom children holder corresponding the the children type. + typedef typename CHILD::Content_T CHILD_CONTENT_T; + typedef BomChildrenHolderImp<CHILD_CONTENT_T> CHILDREN_HOLDER_T; + + CHILDREN_HOLDER_T*& lChildrenHolder_ptr = + boost::fusion::at_key<CHILD_CONTENT_T> (ioParent._holderMap); + + // If the holder does not existe, then create it. + if (lChildrenHolder_ptr == NULL) { + lChildrenHolder_ptr = &instance().create<CHILDREN_HOLDER_T> (); + } + + return addFullObjectToHolder<CHILD_CONTENT_T> (*lChildrenHolder_ptr, + iChild); + } + + // ////////////////////////////////////////////////////////////////// /** Link a child structure object with its parent. <br>For instance, link a SegmentDate structure object with its parent FlightDate structure object. @@ -111,6 +134,34 @@ return true; } + // ////////////////////////////////////////////////////////////////// + /** Add a BOM object into a dedicated BOM holder by using the + full key of the object. */ + template <typename CONTENT> + static bool addFullObjectToHolder (BomChildrenHolderImp<CONTENT>& ioHolder, + const typename CONTENT::Structure_T& iStructure) { + // Retrieve the bom structure type. + typedef typename CONTENT::Structure_T STRUCTURE_T; + // Define the bom holder type. + typedef BomChildrenHolderImp<CONTENT> HOLDER_T; + + // Retrieve the short key + const std::string& lKeyStr = iStructure.getContent().describeKey(); + + // Insert the structure object in the dedicated lists + typedef typename HOLDER_T::BomChildrenMap_T BOM_MAP_T; + const bool hasInsertBeenSuccessful = ioHolder._bomChildrenMap. + insert (typename BOM_MAP_T::value_type (lKeyStr, &iStructure)).second; + + if (hasInsertBeenSuccessful == false) { + return hasInsertBeenSuccessful; + } + + ioHolder._bomChildrenList.push_back (&iStructure); + + return true; + } + 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: <qua...@us...> - 2010-04-23 08:53:40
|
Revision: 183 http://stdair.svn.sourceforge.net/stdair/?rev=183&view=rev Author: quannaus Date: 2010-04-23 08:53:34 +0000 (Fri, 23 Apr 2010) Log Message: ----------- [dev] Implemented some functions within CmdBomManager. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-22 14:41:11 UTC (rev 182) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-04-23 08:53:34 UTC (rev 183) @@ -14,8 +14,6 @@ // Forward declarations class BomRoot; - class YieldStore; - class Inventory; /** Interface for the STDAIR Services. */ class STDAIR_Service { @@ -42,19 +40,7 @@ /** Destructor. */ ~STDAIR_Service(); - - /** Retrieve the Inventory corresponding to the given airline code - (Inventory key). - <br>If not existing, a ObjectNotFoundException exception is thrown. */ - Inventory& getInventory (const AirlineCode_T& iAirlineCode) const; - - /** Retrieve the Yield Store corresponding to the given airline code - (YieldStore key). - <br>If not existing, a ObjectNotFoundException exception is thrown. */ - YieldStore& getYieldStore (const AirlineCode_T& iAirlineCode) const; - - // ///////////////// Getters /////////////////// /** Get a reference on the BomRoot object. <br>If the service context has not been initialised, that @@ -62,23 +48,6 @@ BomRoot& getBomRoot () const { return _bomRoot; } - - public: - // /////// Construction and Destruction helper methods /////// - /** Retrieve the Inventory corresponding to the given airline code - (Inventory key). - <br>If not existing, a ObjectNotFoundException exception is thrown. */ - Inventory& createInventory (const AirlineCode_T& iAirlineCode) const; - - /** Retrieve the YieldStore corresponding to the given airline code - (YieldStore key). - <br>If not existing, a ObjectNotFoundException exception is thrown. */ - YieldStore& createYieldStore (const AirlineCode_T& iAirlineCode) const; - - /** Add the airline-specific AirlineFeature object to its AirlineFeatureSet - parent. */ - void addAirlineFeature (const AirlineCode_T& iAirlineCode) const; - private: // /////// Construction and Destruction helper methods /////// @@ -86,13 +55,10 @@ STDAIR_Service (); /** Default copy constructor. */ STDAIR_Service (const STDAIR_Service&); - /** Initialise the log. */ void logInit (const BasLogParams&); - /** Initialise the database session. */ void dbInit (const BasDBParams&); - /** Initialise. <br>The static instance of the log service (Logger object) is created. <br>The static instance of the database session manager @@ -103,10 +69,8 @@ in any service context. However, some lock mechanism may be needed in order to secure the access to the corresponding resources. */ void init (); - /** Finalise. */ void finalise (); - private: // /////////////// Attributes /////////////// Modified: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-22 14:41:11 UTC (rev 182) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-04-23 08:53:34 UTC (rev 183) @@ -3,13 +3,7 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> -// Boost -#include <boost/make_shared.hpp> // StdAir -#include <stdair/bom/BomRoot.hpp> -#include <stdair/bom/Inventory.hpp> -#include <stdair/bom/YieldStore.hpp> -#include <stdair/bom/AirlineFeature.hpp> #include <stdair/bom/BomSource.hpp> #include <stdair/factory/FacBomContent.hpp> #include <stdair/command/CmdBomManager.hpp> @@ -18,8 +12,8 @@ namespace stdair { // ////////////////////////////////////////////////////////////////////// - void CmdBomManager::addAirlineFeature (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { + void CmdBomManager::createAirlineFeature (const BomRoot& iBomRoot, + const AirlineCode_T& iAirlineCode) { // Initialise an AirlineFeature object AirlineFeatureKey_T lAirlineFeatureKey (iAirlineCode); @@ -27,84 +21,175 @@ instance().create<AirlineFeature> (lAirlineFeatureKey); // Add the AirlineFeature object to its AirlineFeatureSet parent - FacBomContent::linkWithParent (lAirlineFeature, ioBomRoot); + FacBomContent::linkWithParent (lAirlineFeature, iBomRoot); // Link the AirlineFeature with its corresponding inventory (if exist) - Inventory* lInventory_ptr = ioBomRoot.getInventory (iAirlineCode); + Inventory* lInventory_ptr = iBomRoot.getInventory (iAirlineCode); if (lInventory_ptr != NULL) { lInventory_ptr->setAirlineFeature (&lAirlineFeature); } } - + // ////////////////////////////////////////////////////////////////////// + YieldStore& CmdBomManager:: + createYieldStore (const BomRoot& iBomRoot, + const AirlineCode_T& iAirlineCode) { + // Instantiate an YieldStore object with the given airline code + YieldStoreKey_T lYieldStoreKey (iAirlineCode); + YieldStore& oYieldStore = + stdair::FacBomContent::instance().create<YieldStore> (lYieldStoreKey); + // Link the created YieldStore with the bom root. + FacBomContent::linkWithParent (oYieldStore, iBomRoot); + + return oYieldStore; + } + + // ////////////////////////////////////////////////////////////////////// Inventory& CmdBomManager:: - createInventoryInternal (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { + createInventory (const BomRoot& iBomRoot, + const AirlineCode_T& iAirlineCode) { + // Instantiate an inventory object with the given airline code InventoryKey_T lInventoryKey (iAirlineCode); - - // Instantiate an Inventory object with the given airline code - Inventory& lInventory = + Inventory& oInventory = FacBomContent::instance().create<Inventory> (lInventoryKey); + // Link the created inventory with the bom root. + FacBomContent::linkWithParent (oInventory, iBomRoot); - // Link the created inventory with the bom root. - FacBomContent::linkWithParent (lInventory, ioBomRoot); + // Create the AirlineFeature for the inventory. + createAirlineFeature (iBomRoot, iAirlineCode); - return lInventory; + return oInventory; } + + // ////////////////////////////////////////////////////////////////////// + FlightDate& CmdBomManager:: + createFlightDate (const Inventory& iInventory, + const FlightDateKey_T& iFlightDateKey) { + // Instantiate a flight-date object with the given key. + FlightDate& oFlightDate = + FacBomContent::instance().create<FlightDate> (iFlightDateKey); + // Link the created inventory with the inventory. + FacBomContent::linkWithParent (oFlightDate, iInventory); + + return oFlightDate; + } // ////////////////////////////////////////////////////////////////////// - Inventory& CmdBomManager:: - getOrCreateInventory (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { - Inventory* lInventory_ptr = ioBomRoot.getInventory (iAirlineCode); + LegDate& CmdBomManager:: + createLegDate (const FlightDate& iFlightDate, + const AirportCode_T& iBoardingPoint) { + // Instantiate a leg-date object with the given boarding point + LegDateKey_T lLegDateKey (iBoardingPoint); + LegDate& oLegDate = FacBomContent::instance().create<LegDate> (lLegDateKey); + // Link the created leg-date with the flight-date. + FacBomContent::linkWithParent (oLegDate, iFlightDate); + + return oLegDate; + } - // If there is no Inventory object for that airline already, create one - if (lInventory_ptr == NULL) { - // 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); - } - assert (lInventory_ptr != NULL); - - return *lInventory_ptr; + // ////////////////////////////////////////////////////////////////////// + LegCabin& CmdBomManager:: + createLegCabin (const LegDate& iLegDate, + const CabinCode_T& iCabinCode) { + // Instantiate a leg-cabin object with the given cabin code + LegCabinKey_T lLegCabinKey (iCabinCode); + LegCabin& oLegCabin = + FacBomContent::instance().create<LegCabin> (lLegCabinKey); + // Link the created leg-cabin with the leg-date. + FacBomContent::linkWithParent (oLegCabin, iLegDate); + + return oLegCabin; } // ////////////////////////////////////////////////////////////////////// - YieldStore& CmdBomManager:: - createYieldStoreInternal (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { - YieldStoreKey_T lYieldStoreKey (iAirlineCode); - - // Instantiate an YieldStore object with the given airline code - YieldStore& lYieldStore = - stdair::FacBomContent::instance().create<YieldStore> (lYieldStoreKey); - - // Link the created YieldStore with the bom root. - FacBomContent::linkWithParent (lYieldStore, ioBomRoot); - - return lYieldStore; + SegmentDate& CmdBomManager:: + createSegmentDate (const FlightDate& iFlightDate, + const SegmentDateKey_T& iSegmentDateKey) { + // Instantiate a segment-date object with the given key. + SegmentDate& oSegmentDate = + FacBomContent::instance().create<SegmentDate> (iSegmentDateKey); + // Link the created segment-date with the flight-date. + FacBomContent::linkWithParent (oSegmentDate, iFlightDate); + + return oSegmentDate; } // ////////////////////////////////////////////////////////////////////// - YieldStore& CmdBomManager:: - getOrCreateYieldStore (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { - YieldStore* lYieldStore_ptr = ioBomRoot.getYieldStore (iAirlineCode); + SegmentCabin& CmdBomManager:: + createSegmentCabin (const SegmentDate& iSegmentDate, + const CabinCode_T& iCabinCode) { + // Instantiate a segment-cabin object with the given cabin code + SegmentCabinKey_T lSegmentCabinKey (iCabinCode); + SegmentCabin& oSegmentCabin = + FacBomContent::instance().create<SegmentCabin> (lSegmentCabinKey); + // Link the created segment-cabin with the segment-date. + FacBomContent::linkWithParent (oSegmentCabin, iSegmentDate); + + return oSegmentCabin; + } - // If there is no YieldStore object for that airline already, create one - if (lYieldStore_ptr == NULL) { - const YieldStoreKey_T lYieldStoreKey (iAirlineCode); + // //////////////////////////////////////////////////////////////////// + void CmdBomManager::createBookingClass (const SegmentCabin& iSegmentCabin, + const ClassCode_T& iClassCode) { + // Instantiate a booking class object with the given class code + const BookingClassKey_T lClassKey (iClassCode); + BookingClass& lClass = + FacBomContent::instance().create<BookingClass> (lClassKey); + // Link the created booking-class with its parent segment-cabin. + FacBomContent::linkWithParent (lClass, iSegmentCabin); + } - // Instantiate a YieldStore object with the given airline code - lYieldStore_ptr = &createYieldStoreInternal (ioBomRoot, iAirlineCode); - assert (lYieldStore_ptr != NULL); - } - assert (lYieldStore_ptr != NULL); + // ////////////////////////////////////////////////////////////////////// + Network& CmdBomManager:: + createNetwork (const BomRoot& iBomRoot, + const NetworkKey_T& iNetworkKey) { + // Instantiate an network object with the given key + Network& oNetwork = + FacBomContent::instance().create<Network> (iNetworkKey); + // Link the created inventory with the bom root. + FacBomContent::linkWithParent (oNetwork, iBomRoot); + + return oNetwork; + } + + // ////////////////////////////////////////////////////////////////////// + NetworkDate& CmdBomManager:: + createNetworkDate (const Network& iNetwork, const Date_T& iDate) { + // Instantiate a network-date object with the given date. + const NetworkDateKey_T lNetworkDateKey (iDate); + NetworkDate& oNetworkDate = + FacBomContent::instance().create<NetworkDate> (lNetworkDateKey); + // Link the created network with the bom root + FacBomContent::linkWithParent (oNetworkDate, iNetwork); + + return oNetworkDate; + } - return *lYieldStore_ptr; + // ////////////////////////////////////////////////////////////////////// + AirportDate& CmdBomManager:: + createAirportDate (const NetworkDate& iNetworkDate, + const AirportCode_T& iBoardingPoint) { + // Instantiate a airport-date object with the given boarding point + AirportDateKey_T lAirportDateKey (iBoardingPoint); + AirportDate& oAirportDate = + FacBomContent::instance().create<AirportDate> (lAirportDateKey); + // Link the created airport-date with the network-date. + FacBomContent::linkWithParent (oAirportDate, iNetworkDate); + + return oAirportDate; } + // ////////////////////////////////////////////////////////////////////// + OutboundPath& CmdBomManager:: + createOutboundPath (const AirportDate& iAirportDate, + const OutboundPathKey_T& iOutboundPathKey) { + // Instantiate a outbound path object with the given key. + OutboundPath& oOutboundPath = + FacBomContent::instance().create<OutboundPath> (iOutboundPathKey); + // Link the created outbound path with the airport-date + FacBomContent::linkWithParent (oOutboundPath, iAirportDate); + + return oOutboundPath; + } + } Modified: trunk/stdair/stdair/command/CmdBomManager.hpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.hpp 2010-04-22 14:41:11 UTC (rev 182) +++ trunk/stdair/stdair/command/CmdBomManager.hpp 2010-04-23 08:53:34 UTC (rev 183) @@ -13,58 +13,79 @@ // Forward declarations class BomRoot; class Inventory; + class FlightDate; + class SegmentDate; + class SegmentCabin; + class LegDate; + class LegCabin; + class Bucket; + class Network; + class NetworkDate; + class AirportDate; + class OutboundPath; + class YieldStore; + class DemandStream; + struct FlightDateKey_T; + struct SegmentDateKey_T; + struct NetworkKey_T; + struct OutboundPathKey_T; /** 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. + + /** Create the airline-specific AirlineFeature object to the BomRoot + and its corresponding Inventory. @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&); + static void createAirlineFeature (const BomRoot&, const AirlineCode_T&); - /** If needed, create the YieldStore corresponding to the given airline code - (YieldStore 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 YieldStore 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 YieldStore to be - created . */ - static YieldStore& getOrCreateYieldStore (BomRoot&, const AirlineCode_T&); - - /** 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); + /** Create the YieldStore corresponding to the given airline code + (YieldStore key). */ + static YieldStore& createYieldStore (const BomRoot&, const AirlineCode_T&); + + /** Create the inventory corresponding to the given airline code + (Inventory key), link it to the BomRoot object and to the + associated AirlineFeature object. */ + static Inventory& createInventory (const BomRoot&, const AirlineCode_T&); + + /** Create the flight-date corresponding to the given key. */ + static FlightDate& createFlightDate (const Inventory&, + const FlightDateKey_T&); + + /** Create the leg-date corresponding to the given boarding point. */ + static LegDate& createLegDate (const FlightDate&, const AirportCode_T&); + + /** Create the leg-cabin corresponding to the given cabin code. */ + static LegCabin& createLegCabin (const LegDate&, const CabinCode_T&); - 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&); + /** Create the segment-date corresponding to the given key. */ + static SegmentDate& createSegmentDate (const FlightDate&, + const SegmentDateKey_T&); - /** Create the YieldStore corresponding to the given airline code - (YieldStore key). - @param BomRoot& Root of the BOM tree. - @param const AirlineCode_T& Airline code for the YieldStore to be - created . */ - static YieldStore& createYieldStoreInternal (BomRoot&, - const AirlineCode_T&); + /** Create the segment-cabin corresponding to the given cabin code. */ + static SegmentCabin& createSegmentCabin (const SegmentDate&, + const CabinCode_T&); + + /** Create the booking class corresponding to the given class code. */ + static void createBookingClass (const SegmentCabin&, const ClassCode_T&); + + /** Create the inventory corresponding to the given network key, + then link it to the BomRoot object. */ + static Network& createNetwork (const BomRoot&, const NetworkKey_T&); + + /** Create the network-date corresponding to the given date. */ + static NetworkDate& createNetworkDate (const Network&, const Date_T&); + + /** Create the airport-date corresponding to the given boarding point. */ + static AirportDate& createAirportDate (const NetworkDate&, + const AirportCode_T&); + + /** Create the outbound path corresponding to the given key. */ + static OutboundPath& createOutboundPath (const AirportDate&, + const OutboundPathKey_T&); + }; } Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-04-22 14:41:11 UTC (rev 182) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-04-23 08:53:34 UTC (rev 183) @@ -82,67 +82,10 @@ } // ////////////////////////////////////////////////////////////////////// - void STDAIR_Service:: - addAirlineFeature (const AirlineCode_T& iAirlineCode) const { - // Delegate to the dedicated command - CmdBomManager::addAirlineFeature (_bomRoot, iAirlineCode); - } - - // ////////////////////////////////////////////////////////////////////// void STDAIR_Service::finalise () { //std::cout << "In STDAIR_Service destructor, before cleaning" << std::endl; FacSupervisor::cleanAll(); //std::cout << "In STDAIR_Service destructor, after cleaning" << std::endl; } - // ////////////////////////////////////////////////////////////////////// - Inventory& STDAIR_Service:: - getInventory (const AirlineCode_T& iAirlineCode) const { - - Inventory* lInventory_ptr = _bomRoot.getInventory (iAirlineCode); - if (lInventory_ptr == NULL) { - throw ObjectNotFoundException(); - } - assert (lInventory_ptr != NULL); - - return *lInventory_ptr; - } - - // ////////////////////////////////////////////////////////////////////// - YieldStore& STDAIR_Service:: - getYieldStore (const AirlineCode_T& iAirlineCode) const { - - YieldStore* lYieldStore_ptr = _bomRoot.getYieldStore (iAirlineCode); - if (lYieldStore_ptr == NULL) { - throw ObjectNotFoundException(); - } - assert (lYieldStore_ptr != NULL); - - return *lYieldStore_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 { - // Delegate to the dedicated command - Inventory& oInventory = - CmdBomManager::getOrCreateInventory (_bomRoot, iAirlineCode); - return oInventory; - } - - // ////////////////////////////////////////////////////////////////////// - YieldStore& STDAIR_Service:: - createYieldStore (const AirlineCode_T& iAirlineCode) const { - // Delegate to the dedicated command - YieldStore& oYieldStore = - CmdBomManager::getOrCreateYieldStore (_bomRoot, iAirlineCode); - return oYieldStore; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-05-03 08:42:06
|
Revision: 186 http://stdair.svn.sourceforge.net/stdair/?rev=186&view=rev Author: quannaus Date: 2010-05-03 08:42:00 +0000 (Mon, 03 May 2010) Log Message: ----------- [dev] Removed some getters and setters from the structures. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_BookingClass.hpp trunk/stdair/stdair/basic/BasConst_General.hpp trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp trunk/stdair/stdair/basic/DemandCharacteristics.hpp trunk/stdair/stdair/basic/DemandDistribution.hpp trunk/stdair/stdair/basic/RandomGeneration.hpp trunk/stdair/stdair/basic/RandomGenerationContext.hpp trunk/stdair/stdair/bom/BookingClassContent.cpp trunk/stdair/stdair/bom/BookingClassContent.hpp trunk/stdair/stdair/bom/DemandStreamContent.cpp trunk/stdair/stdair/bom/DemandStreamContent.hpp trunk/stdair/stdair/bom/FlightDateContent.cpp trunk/stdair/stdair/bom/LegCabinContent.cpp trunk/stdair/stdair/bom/SegmentCabinContent.cpp trunk/stdair/stdair/bom/SegmentDateContent.cpp trunk/stdair/stdair/bom/TravelSolutionStruct.cpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp trunk/stdair/stdair/bom/TravelSolutionTypes.hpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -136,8 +136,8 @@ /** 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 availability. */ + const Availability_T DEFAULT_AVAILABILITY = 0.0; /** Default boolean for censorship flag given the status of availability for BookingClass. */ @@ -168,8 +168,8 @@ /** 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 Fare value. */ + const Fare_T DEFAULT_FARE_VALUE = 0.0; /** Default yield value for a virtual class. */ const Yield_T DEFAULT_CLASS_YIELD_VALUE = 0.0; Modified: trunk/stdair/stdair/basic/BasConst_BookingClass.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_BookingClass.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/BasConst_BookingClass.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -48,8 +48,8 @@ /** 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 availability. */ + extern const Availability_T DEFAULT_AVAILABILITY; /** Default boolean for censorship flag given the status of availability for BookingClass. */ @@ -74,8 +74,8 @@ /** 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 fare. */ + extern const Fare_T DEFAULT_FARE_VALUE; /** Default revenue value for BookingClass. */ extern const Revenue_T DEFAULT_REVENUE_VALUE; Modified: trunk/stdair/stdair/basic/BasConst_General.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_General.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/BasConst_General.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -28,7 +28,7 @@ extern const Distance_T DEFAULT_DISTANCE_VALUE; /** Default value of Fare. */ - extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + extern const Fare_T DEFAULT_FARE_VALUE; /** Default revenue value. */ extern const Revenue_T DEFAULT_REVENUE_VALUE; Modified: trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -44,7 +44,7 @@ extern const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS; /** Default value of Fare. */ - extern const Fare_T DEFAULT_CLASS_FARE_VALUE; + extern const Fare_T DEFAULT_FARE_VALUE; /** Default nember of required seats by the demand. */ extern const unsigned short DEFAULT_NUMBER_OF_REQUIRED_SEATS; Modified: trunk/stdair/stdair/basic/DemandCharacteristics.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -15,55 +15,8 @@ /** Class modeling the characteristics of a demand type. */ struct DemandCharacteristics { - + public: - // ///////////// Getters /////////// - /** Get the arrival pattern. */ - const ContinuousFloatDuration_T& getArrivalPattern() const { - return _arrivalPattern; - } - - /** Get the point-of-sale probability mass. */ - const POSProbabilityMass_T& getPOSProbabilityMass() const { - return _posProbabilityMass; - } - - /** Get the channel probability mass. */ - const ChannelProbabilityMass_T& getChannelProbabilityMass() const { - return _channelProbabilityMass; - } - - /** Get the trip type probability mass. */ - const TripTypeProbabilityMass_T& getTripTypeProbabilityMass() const { - return _tripTypeProbabilityMass; - } - - /** Get the stay duration probability mass. */ - const StayDurationProbabilityMass_T& getStayDurationProbabilityMass() const { - return _stayDurationProbabilityMass; - } - - /** Get the frequent flyer probability mass. */ - const FrequentFlyerProbabilityMass_T& getFrequentFlyerProbabilityMass() const { - return _frequentFlyerProbabilityMass; - } - - /** Get the preferred departure time cumulative distribution. */ - const PreferredDepartureTimeCumulativeDistribution_T& getPreferredDepartureTimeCumulativeDistribution () const { - return _preferredDepartureTimeCumulativeDistribution; - } - - /** Get the WTP cumulative distribution. */ - const WTPCumulativeDistribution_T& getWTPCumulativeDistribution() const { - return _wtpCumulativeDistribution; - } - - /** Get the value of time cumulative distribution. */ - const ValueOfTimeCumulativeDistribution_T& getValueOfTimeCumulativeDistribution () const { - return _valueOfTimeCumulativeDistribution; - } - - public: // ////////////// Display Support Methods ////////// /** Display demand characteristics */ std::string display() const; @@ -90,7 +43,7 @@ /** Copy constructor. */ DemandCharacteristics (const DemandCharacteristics&); - private: + public: // //////////////////// Attributes ///////////////////// /** Arrival pattern (cumulative distribution of timing of arrival of requests (negative number of days between departure date Modified: trunk/stdair/stdair/basic/DemandDistribution.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -14,56 +14,24 @@ /** Class modeling the distribution of a demand type. */ struct DemandDistribution { - public: - // ///////////// Getters /////////// - /** Get the mean number of requests. */ - const NbOfRequests_T& getMeanNumberOfRequests() const { - return _meanNumberOfRequests; - } - - /** Get the standard deviation of number of requests. */ - const StandardDeviationValue_T& getStandardDeviationNumberOfRequests() const { - return _standardDeviationNumberOfRequests; - } - - public: - // ///////////// Setters /////////// - /** Set the mean number of requests. */ - void setMeanNumberOfRequests (const NbOfRequests_T& iMean) { - _meanNumberOfRequests = iMean; - } - - /** Set the standard deviation of number of requests. */ - void setStandardDeviationNumberOfRequests (const StandardDeviationValue_T& iStandardDeviation) { - _standardDeviationNumberOfRequests = iStandardDeviation; - } - - public: // ////////////// Display Support Methods ////////// /** Display demand distribution */ std::string display() const; - public: // ////////// Constructors and destructors ///////// /** Constructor. */ DemandDistribution (const NbOfRequests_T& iMean, const StandardDeviationValue_T& iStandardDeviation); - /** Default constructor. */ - // TODO: That constructor should be private DemandDistribution (); - /** Copy constructor. */ - // TODO: That constructor should be private DemandDistribution (const DemandDistribution&); - /** Destructor. */ - virtual ~DemandDistribution (); + ~DemandDistribution (); - private: // ////////// Attributes ////////// /** Mean number of requests */ NbOfRequests_T _meanNumberOfRequests; Modified: trunk/stdair/stdair/basic/RandomGeneration.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGeneration.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/RandomGeneration.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -14,13 +14,6 @@ /** Random generator. */ struct RandomGeneration { - public: - // ///////////// Getters /////////// - /** Get the seed of the random generator. */ - const RandomSeed_T& getSeed () const { - return _seed; - } - // //////////// Business Methods ///////////// /** Generate a randomized number following a uniform distribution between 0 (included) and 1 (excluded). */ @@ -35,25 +28,20 @@ specified by a mean and a standard deviation. */ RealNumber_T generateNormal (const RealNumber_T&, const RealNumber_T&); - public: // ////////// Constructors and destructors ///////// /** Constructor. */ RandomGeneration (const RandomSeed_T&); /** Default constructors. */ RandomGeneration (); RandomGeneration (const RandomGeneration&); - /** Destructor. */ - virtual ~RandomGeneration (); - + ~RandomGeneration (); /** Initialize the random generator. <br>A uniform random number distribution is defined, which produces "real" values between 0 and 1 (0 inclusive, 1 exclusive). */ void init (); - - private: // ////////// Attributes ////////// /** The seed of the random generator. <br>The seed is unsigned, otherwise the wrong overload may be Modified: trunk/stdair/stdair/basic/RandomGenerationContext.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -13,49 +13,20 @@ /** Structure holding the context necessary for demand random generation. */ struct RandomGenerationContext { - - public: - // ///////////// Getters /////////// - /** Get the cumulative probability of arrival pattern for last - request generated so far. */ - const Probability_T& getCumulativeProbabilitySoFar () const { - return _cumulativeProbabilitySoFar; - } - /** Get the number of requests generated so far. */ - const Count_T& getNumberOfRequestsGeneratedSoFar () const { - return _numberOfRequestsGeneratedSoFar; - } - - /** Set the cumulative probability of arrival pattern for last - request generated so far. */ - void setCumulativeProbabilitySoFar (const Probability_T& iCumulativeProbability) { - _cumulativeProbabilitySoFar = iCumulativeProbability; - } - - /** Set the number of requests generated so far. */ - void setNumberOfRequestsGeneratedSoFar (const Count_T& iNumberOfRequests) { - _numberOfRequestsGeneratedSoFar = iNumberOfRequests; - } - - public: // ////////// Constructors and destructors ///////// /** Constructor by default */ RandomGenerationContext (); /** Default constructors. */ RandomGenerationContext (const RandomGenerationContext&); - /** Destructor */ - virtual ~RandomGenerationContext (); + ~RandomGenerationContext (); - public: // /////////////// Business Methods ////////// /** Increment counter of requests generated so far */ void incrementGeneratedRequestsCounter (); - - - private: - // ////////// Attributes ////////// + + // ////////// Attributes ////////// /** Cumulative probability in arrival pattern for last request generated so far (needed for sequential generation)*/ Probability_T _cumulativeProbabilitySoFar; Modified: trunk/stdair/stdair/bom/BookingClassContent.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/BookingClassContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -11,47 +11,12 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BookingClassContent::BookingClassContent (const Key_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 (const Key_T& iKey) : _key (iKey) { } // //////////////////////////////////////////////////////////////////// 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 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/BookingClassContent.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -29,193 +29,7 @@ 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. */ @@ -241,98 +55,24 @@ ~BookingClassContent(); public: - // for AIRINV Test - stdair::SubclassCode_T _subclassCode; - stdair::AuthorizationLevel_T _cumulatedProtection; - stdair::AuthorizationLevel_T _protection; - stdair::OverbookingRate_T _noShowPercentage; - stdair::OverbookingRate_T _overbookingPercentage; - stdair::NbOfBookings_T _groupNbOfBookings; - stdair::NbOfBookings_T _groupPendingNbOfBookings; - stdair::NbOfBookings_T _staffNbOfBookings; - stdair::NbOfBookings_T _wlNbOfBookings; - stdair::NbOfBookings_T _etb; - stdair::Availability_T _netClassAvailability; - stdair::Availability_T _segmentAvailability; - stdair::Availability_T _netRevenueAvailability; - - protected: // Attributes - /** The key of both structure and content objects. */ Key_T _key; - - /** Number of current bookings in the booking. */ + SubclassCode_T _subclassCode; + AuthorizationLevel_T _cumulatedProtection; + AuthorizationLevel_T _protection; + NbOfSeats_T _nego; + OverbookingRate_T _noShowPercentage; + OverbookingRate_T _overbookingPercentage; 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; - + NbOfBookings_T _groupNbOfBookings; + NbOfBookings_T _groupPendingNbOfBookings; + NbOfBookings_T _staffNbOfBookings; + NbOfBookings_T _wlNbOfBookings; + NbOfBookings_T _etb; + Availability_T _netClassAvailability; + Availability_T _segmentAvailability; + Availability_T _netRevenueAvailability; + }; } Modified: trunk/stdair/stdair/bom/DemandStreamContent.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStreamContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/DemandStreamContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -56,9 +56,9 @@ // //////////////////////////////////////////////////////////////////// void DemandStreamContent::init() { // Generate the number of requests - const RealNumber_T lMu = _demandDistribution.getMeanNumberOfRequests (); + const RealNumber_T lMu = _demandDistribution._meanNumberOfRequests; const RealNumber_T lSigma = - _demandDistribution.getStandardDeviationNumberOfRequests (); + _demandDistribution._standardDeviationNumberOfRequests; const RealNumber_T lRealNumberOfRequestsToBeGenerated = _numberOfRequestsRandomGenerator.generateNormal (lMu, lSigma); Modified: trunk/stdair/stdair/bom/DemandStreamContent.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStreamContent.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/DemandStreamContent.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -56,83 +56,83 @@ /** Get the arrival pattern. */ const ContinuousFloatDuration_T& getArrivalPattern() const { - return _demandCharacteristics.getArrivalPattern(); + return _demandCharacteristics._arrivalPattern; } /** Get the POS probability mass. */ const POSProbabilityMass_T& getPOSProbabilityMass() const { - return _demandCharacteristics.getPOSProbabilityMass(); + return _demandCharacteristics._posProbabilityMass; } /** Get the channel probability mass. */ const ChannelProbabilityMass_T& getChannelProbabilityMass() const { - return _demandCharacteristics.getChannelProbabilityMass(); + return _demandCharacteristics._channelProbabilityMass; } /** Get the trip type probability mass. */ const TripTypeProbabilityMass_T& getTripTypeProbabilityMass() const { - return _demandCharacteristics.getTripTypeProbabilityMass(); + return _demandCharacteristics._tripTypeProbabilityMass; } /** Get the stay duration probability mass. */ const StayDurationProbabilityMass_T& getStayDurationProbabilityMass() const { - return _demandCharacteristics.getStayDurationProbabilityMass(); + return _demandCharacteristics._stayDurationProbabilityMass; } /** Get the frequent flyer probability mass. */ const FrequentFlyerProbabilityMass_T& getFrequentFlyerProbabilityMass() const { - return _demandCharacteristics.getFrequentFlyerProbabilityMass(); + return _demandCharacteristics._frequentFlyerProbabilityMass; } /** Get the preferred departure time cumulative distribution. */ const PreferredDepartureTimeCumulativeDistribution_T& getPreferredDepartureTimeCumulativeDistribution () const { - return _demandCharacteristics.getPreferredDepartureTimeCumulativeDistribution(); + return _demandCharacteristics._preferredDepartureTimeCumulativeDistribution; } /** Get the WTP cumulative distribution. */ const WTPCumulativeDistribution_T& getWTPCumulativeDistribution() const { - return _demandCharacteristics.getWTPCumulativeDistribution(); + return _demandCharacteristics._wtpCumulativeDistribution; } /** Get the value of time cumulative distribution. */ const ValueOfTimeCumulativeDistribution_T& getValueOfTimeCumulativeDistribution() const { - return _demandCharacteristics.getValueOfTimeCumulativeDistribution(); + return _demandCharacteristics._valueOfTimeCumulativeDistribution; } /** Get the mean number of requests. */ const NbOfRequests_T& getMeanNumberOfRequests() const { - return _demandDistribution.getMeanNumberOfRequests(); + return _demandDistribution._meanNumberOfRequests; } /** Get the standard deviation of number of requests. */ const StandardDeviationValue_T& getStandardDeviationNumberOfRequests() const { - return _demandDistribution.getStandardDeviationNumberOfRequests(); + return _demandDistribution._standardDeviationNumberOfRequests; } /** Get the cumulative probability of arrival pattern for last request generated so far. */ const Probability_T& getCumulativeProbabilitySoFar () const { - return _randomGenerationContext.getCumulativeProbabilitySoFar(); + return _randomGenerationContext._cumulativeProbabilitySoFar; } /** Get the number of requests generated so far. */ const Count_T& getNumberOfRequestsGeneratedSoFar() const { - return _randomGenerationContext.getNumberOfRequestsGeneratedSoFar(); + return _randomGenerationContext._numberOfRequestsGeneratedSoFar; } /** Get the seed of the random generator for the number of requests. */ const RandomSeed_T& getNumberOfRequestsRandomGeneratorSeed () const { - return _numberOfRequestsRandomGenerator.getSeed(); + return _numberOfRequestsRandomGenerator._seed; } /** Get the seed of the random generator for the request datetime. */ const RandomSeed_T& getRequestDateTimeRandomGeneratorSeed () const { - return _requestDateTimeRandomGenerator.getSeed(); + return _requestDateTimeRandomGenerator._seed; } /** Get the seed of the random generator for the demand characteristics. */ const RandomSeed_T& getDemandCharacteristicsRandomGeneratorSeed () const { - return _demandCharacteristicsRandomGenerator.getSeed(); + return _demandCharacteristicsRandomGenerator._seed; } /** Get the demand characteristics. */ @@ -150,14 +150,14 @@ /** Set the cumulative probability of arrival pattern for last request generated so far. */ void setCumulativeProbabilitySoFar (const Probability_T& iCumulativeProbability) { - _randomGenerationContext. - setCumulativeProbabilitySoFar (iCumulativeProbability); + _randomGenerationContext._cumulativeProbabilitySoFar = + iCumulativeProbability; } /** Set the number of requests generated so far. */ void setNumberOfRequestsGeneratedSoFar (const Count_T& iNumberOfRequests) { - _randomGenerationContext. - setNumberOfRequestsGeneratedSoFar (iNumberOfRequests); + _randomGenerationContext._numberOfRequestsGeneratedSoFar = + iNumberOfRequests; } public: Modified: trunk/stdair/stdair/bom/FlightDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDateContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/FlightDateContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -14,7 +14,7 @@ : _key (iKey), _bookingCounter (DEFAULT_CLASS_NB_OF_BOOKINGS), _flightRevenue (DEFAULT_REVENUE_VALUE), - _flightAverageFare (DEFAULT_CLASS_FARE_VALUE), + _flightAverageFare (DEFAULT_FARE_VALUE), _flightASK (DEFAULT_DISTANCE_VALUE), _flightYield (DEFAULT_REVENUE_VALUE), _flightRPK (DEFAULT_DISTANCE_VALUE), Modified: trunk/stdair/stdair/bom/LegCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/LegCabinContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -16,8 +16,8 @@ _capacity (DEFAULT_CABIN_CAPACITY), _soldSeat (DEFAULT_CLASS_NB_OF_BOOKINGS), _commitedSpace (DEFAULT_COMMITED_SPACE), - _availabilityPool (DEFAULT_CLASS_AVAILABILITY), - _availability (DEFAULT_CLASS_AVAILABILITY), + _availabilityPool (DEFAULT_AVAILABILITY), + _availability (DEFAULT_AVAILABILITY), _bidPriceVector (DEFAULT_BID_PRICE_VECTOR), _currentBidPrice (DEFAULT_BID_PRICE) { } Modified: trunk/stdair/stdair/bom/SegmentCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -17,11 +17,11 @@ _blockSpace (DEFAULT_BLOCK_SPACE), _bookingCounter (DEFAULT_CLASS_NB_OF_BOOKINGS), _commitedSpace (DEFAULT_COMMITED_SPACE), - _availabilityPool (DEFAULT_CLASS_AVAILABILITY), + _availabilityPool (DEFAULT_AVAILABILITY), _bidPriceVector (DEFAULT_BID_PRICE_VECTOR), _currentBidPrice (DEFAULT_BID_PRICE), _cabinRevenue (DEFAULT_REVENUE_VALUE), - _cabinAverageFare (DEFAULT_CLASS_FARE_VALUE), + _cabinAverageFare (DEFAULT_FARE_VALUE), _cabinUnitRevenue (DEFAULT_REVENUE_VALUE), _cabinRPK (DEFAULT_DISTANCE_VALUE) { } Modified: trunk/stdair/stdair/bom/SegmentDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDateContent.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/SegmentDateContent.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -14,7 +14,7 @@ : _key (iKey), _bookingCounter (DEFAULT_CLASS_NB_OF_BOOKINGS), _segmentRevenue (DEFAULT_REVENUE_VALUE), - _segmentAverageFare (DEFAULT_CLASS_FARE_VALUE), + _segmentAverageFare (DEFAULT_FARE_VALUE), _segmentUnitRevenue (DEFAULT_REVENUE_VALUE), _segmentRPK (DEFAULT_DISTANCE_VALUE) { } Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-05-03 08:42:00 UTC (rev 186) @@ -7,6 +7,7 @@ #include <ostream> #include <sstream> // StdAir +#include <stdair/basic/BasConst_BookingClass.hpp> #include <stdair/bom/OutboundPath.hpp> #include <stdair/bom/TravelSolutionStruct.hpp> @@ -22,26 +23,22 @@ TravelSolutionStruct:: TravelSolutionStruct (const TravelSolutionStruct& iTravelSolutionStruct) : _outboundPath_ptr (iTravelSolutionStruct._outboundPath_ptr), - _bookingClassList (iTravelSolutionStruct._bookingClassList) { + _bookingClassList (iTravelSolutionStruct._bookingClassList), + _fare (iTravelSolutionStruct._fare), + _availability (iTravelSolutionStruct._availability) { } // //////////////////////////////////////////////////////////////////// TravelSolutionStruct:: TravelSolutionStruct (OutboundPath& ioOutboundPath, const BookingClassSTLList_T& iBookingClassList) - : _outboundPath_ptr (&ioOutboundPath), - _bookingClassList (iBookingClassList) { + : _outboundPath_ptr (&ioOutboundPath), _bookingClassList (iBookingClassList), + _fare (DEFAULT_FARE_VALUE), _availability (DEFAULT_AVAILABILITY) { } // //////////////////////////////////////////////////////////////////// TravelSolutionStruct::~TravelSolutionStruct () { } - - // ////////////////////////////////////////////////////////////////////// - OutboundPath& TravelSolutionStruct::getOutboundPath() const { - assert (_outboundPath_ptr != NULL); - return *_outboundPath_ptr; - } // ////////////////////////////////////////////////////////////////////// void TravelSolutionStruct::toStream (std::ostream& ioOut) const { Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -9,6 +9,7 @@ #include <string> #include <vector> // StdAir +#include <stdair/STDAIR_Types.hpp> #include <stdair/basic/StructAbstract.hpp> #include <stdair/bom/BookingClassTypes.hpp> @@ -21,15 +22,24 @@ struct TravelSolutionStruct : public StructAbstract { public: // /////////// Getters /////////////// - /** Get the OutboundPath. */ - OutboundPath& getOutboundPath() const; - - /** Get the list of booking classes. */ + /** Retrieve the attributes of the object. */ + OutboundPath& getOutboundPath() const { + assert (_outboundPath_ptr != NULL); + return *_outboundPath_ptr; + } const BookingClassSTLList_T& getBookingClassList () const { return _bookingClassList; } + const Fare_T getFare() const { return _fare; } + const Availability_T getAvailability() const { return _availability; } public: + // /////////// Setters /////////////// + /** Setter for some attributes. */ + void setFare (const Fare_T& iFare) { _fare = iFare; } + void setAvailability (const Availability_T& iAvail) { _availability=iAvail; } + + public: // /////////// Display support method ///////////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ @@ -69,6 +79,12 @@ /** The list of booking classes which make the travel solution. */ BookingClassSTLList_T _bookingClassList; + + /** The fare of the travel solution. */ + Fare_T _fare; + + /** The availability of the travel solution. */ + Availability_T _availability; }; } Modified: trunk/stdair/stdair/bom/TravelSolutionTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionTypes.hpp 2010-05-01 17:32:23 UTC (rev 185) +++ trunk/stdair/stdair/bom/TravelSolutionTypes.hpp 2010-05-03 08:42:00 UTC (rev 186) @@ -6,8 +6,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <map> -#include <vector> +#include <list> namespace stdair { @@ -15,7 +14,7 @@ struct TravelSolutionStruct; /** Define the booking class list. */ - typedef std::vector<TravelSolutionStruct> TravelSolutionList_T; + typedef std::list<TravelSolutionStruct> TravelSolutionList_T; } #endif // __STDAIR_BOM_TRAVELSOLUTIONTYPES_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-05-03 11:50:23
|
Revision: 188 http://stdair.svn.sourceforge.net/stdair/?rev=188&view=rev Author: quannaus Date: 2010-05-03 11:50:17 +0000 (Mon, 03 May 2010) Log Message: ----------- [dev] Removed StatStatus and StartAnalysisDate. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinContent.cpp trunk/stdair/stdair/bom/LegCabinContent.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-05-03 11:50:17 UTC (rev 188) @@ -385,9 +385,6 @@ /** 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; Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-05-03 11:50:17 UTC (rev 188) @@ -191,7 +191,8 @@ << lCurrentLD.getBoardingPoint() << "-" << lCurrentLD.getOffPoint() << ", " << lCurrentLC.getCabinCode() << ", " - << lCurrentLC.getCapacity() << ", " + << lCurrentLC.getOfferedCapacity() << ", " + << lCurrentLC.getPhysicalCapacity() << ", " << lCurrentLC.getSoldSeat() << ", " << lCurrentLC.getCommitedSpace() << ", " << lCurrentLC.getAvailabilityPool() << ", " Modified: trunk/stdair/stdair/bom/LegCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.cpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/bom/LegCabin.cpp 2010-05-03 11:50:17 UTC (rev 188) @@ -53,14 +53,5 @@ return oStr.str(); } - // //////////////////////////////////////////////////////////////////// - void LegCabin::setCapacity(const CabinCapacity_T& iCapacity, - const AnalysisStatus_T& iAnalysisStatus) { - _capacity = iCapacity; - // LegDate* lLegDate = getParent(); -// assert (lLegDate!= NULL); -// lLegDate->updateCapacityAndLegASK(iCapacity, iAnalysisStatus); - } - } Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2010-05-03 11:50:17 UTC (rev 188) @@ -41,11 +41,6 @@ // ////////////////////////////////////////////////////////////////// public: - // ///////// Setters ////////// - /** Set the off cabin. */ - void setCapacity (const CabinCapacity_T&, const AnalysisStatus_T&); - - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ Modified: trunk/stdair/stdair/bom/LegCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinContent.cpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/bom/LegCabinContent.cpp 2010-05-03 11:50:17 UTC (rev 188) @@ -13,7 +13,8 @@ // //////////////////////////////////////////////////////////////////// LegCabinContent::LegCabinContent (const Key_T& iKey) : _key (iKey), - _capacity (DEFAULT_CABIN_CAPACITY), + _offeredCapacity (DEFAULT_CABIN_CAPACITY), + _physicalCapacity (DEFAULT_CABIN_CAPACITY), _soldSeat (DEFAULT_CLASS_NB_OF_BOOKINGS), _commitedSpace (DEFAULT_COMMITED_SPACE), _availabilityPool (DEFAULT_AVAILABILITY), Modified: trunk/stdair/stdair/bom/LegCabinContent.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabinContent.hpp 2010-05-03 09:13:50 UTC (rev 187) +++ trunk/stdair/stdair/bom/LegCabinContent.hpp 2010-05-03 11:50:17 UTC (rev 188) @@ -29,11 +29,16 @@ return _key.getCabinCode(); } - /** Get the cabin capacity. */ - const CabinCapacity_T& getCapacity () const { - return _capacity; + /** Get the cabin offered capacity. */ + const CabinCapacity_T& getOfferedCapacity () const { + return _offeredCapacity; } + /** Get the cabin physical capacity. */ + const CabinCapacity_T& getPhysicalCapacity () const { + return _physicalCapacity; + } + /** Get the number of sold seat. */ const NbOfBookings_T& getSoldSeat () const { return _soldSeat; @@ -66,6 +71,12 @@ public: // ///////////// Setters /////////////// + /** Set the offered and physical capacities. */ + void setCapacities (const CabinCapacity_T& iCapacity) { + _offeredCapacity = iCapacity; + _physicalCapacity = iCapacity; + } + /** Set the number of sold seat. */ void setSoldSeat (const NbOfBookings_T& iSoldSeat) { _soldSeat = iSoldSeat; @@ -117,11 +128,9 @@ public: // Test AIRINV - stdair::CapacityAdjustment_T _adjustment; stdair::CapacityAdjustment_T _dcsRegrade; stdair::AuthorizationLevel_T _au; stdair::UPR_T _upr; - stdair::NbOfBookings_T _nbOfBookings; stdair::Availability_T _nav; stdair::Availability_T _gav; stdair::OverbookingRate_T _acp; @@ -135,9 +144,12 @@ /** The key of both structure and content objects. */ Key_T _key; - /** Capacity of the cabin. */ - CabinCapacity_T _capacity; + /** Offered capacity of the cabin. */ + CabinCapacity_T _offeredCapacity; + /** Physical capacity of the cabin. */ + CabinCapacity_T _physicalCapacity; + /** Sold seat into the cabin. */ NbOfBookings_T _soldSeat; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-05-03 14:57:14
|
Revision: 189 http://stdair.svn.sourceforge.net/stdair/?rev=189&view=rev Author: quannaus Date: 2010-05-03 14:57:07 +0000 (Mon, 03 May 2010) Log Message: ----------- [dev] added some getters. Modified Paths: -------------- trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp Modified: trunk/stdair/stdair/bom/SegmentCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.cpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/bom/SegmentCabin.cpp 2010-05-03 14:57:07 UTC (rev 189) @@ -63,6 +63,12 @@ BookingClassMap_T SegmentCabin::getBookingClassMap () const { return _structure.getChildrenHolder<BookingClass>(); } + + // //////////////////////////////////////////////////////////////////// + BookingClass* SegmentCabin:: + getBookingClass (const ClassCode_T& iClassCode) const { + return _structure.getChildPtr<BookingClass> (iClassCode); + } } Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-05-03 14:57:07 UTC (rev 189) @@ -46,6 +46,11 @@ BookingClassList_T getBookingClassList () const; BookingClassMap_T getBookingClassMap () const; + /** Retrieve, if existing, the BookingClass corresponding to the + given class code. + <br>If not existing, return the NULL pointer. */ + BookingClass* getBookingClass (const ClassCode_T&) const; + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-03 14:57:07 UTC (rev 189) @@ -105,6 +105,12 @@ const FlightNumber_T& SegmentDate::getFlightNumber () const { return _structure.getParent().getKey().getFlightNumber(); } + + // //////////////////////////////////////////////////////////////////// + SegmentCabin* SegmentDate:: + getSegmentCabin (const CabinCode_T& iCabinCode) const { + return _structure.getChildPtr<SegmentCabin> (iCabinCode); + } } Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2010-05-03 14:57:07 UTC (rev 189) @@ -54,6 +54,11 @@ /** Get the airline code of the segment. */ const AirlineCode_T& getAirlineCode () const; + /** Retrieve, if existing, the SegmentCabin corresponding to the + given cabin code. + <br>If not existing, return the NULL pointer. */ + SegmentCabin* getSegmentCabin (const CabinCode_T&) const; + public: // /////////// Business Methods ////////////// /** States whether or not the given SegmentDate may connect with the Modified: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-05-03 14:57:07 UTC (rev 189) @@ -129,14 +129,17 @@ } // //////////////////////////////////////////////////////////////////// - void CmdBomManager::createBookingClass (const SegmentCabin& iSegmentCabin, - const ClassCode_T& iClassCode) { + BookingClass& CmdBomManager:: + createBookingClass (const SegmentCabin& iSegmentCabin, + const ClassCode_T& iClassCode) { // Instantiate a booking class object with the given class code const BookingClassKey_T lClassKey (iClassCode); - BookingClass& lClass = + BookingClass& oClass = FacBomContent::instance().create<BookingClass> (lClassKey); // Link the created booking-class with its parent segment-cabin. - FacBomContent::linkWithParent (lClass, iSegmentCabin); + FacBomContent::linkWithParent (oClass, iSegmentCabin); + + return oClass; } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/command/CmdBomManager.hpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.hpp 2010-05-03 11:50:17 UTC (rev 188) +++ trunk/stdair/stdair/command/CmdBomManager.hpp 2010-05-03 14:57:07 UTC (rev 189) @@ -16,9 +16,9 @@ class FlightDate; class SegmentDate; class SegmentCabin; + class BookingClass; class LegDate; class LegCabin; - class Bucket; class Network; class NetworkDate; class AirportDate; @@ -69,7 +69,8 @@ const CabinCode_T&); /** Create the booking class corresponding to the given class code. */ - static void createBookingClass (const SegmentCabin&, const ClassCode_T&); + static BookingClass& createBookingClass (const SegmentCabin&, + const ClassCode_T&); /** Create the inventory corresponding to the given network key, then link it to the BomRoot object. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-06-08 09:07:46
|
Revision: 191 http://stdair.svn.sourceforge.net/stdair/?rev=191&view=rev Author: quannaus Date: 2010-06-08 09:07:39 +0000 (Tue, 08 Jun 2010) Log Message: ----------- [Dev] Add multimap into BomChildrenHolder. Modified Paths: -------------- trunk/stdair/stdair/bom/AirlineFeature.hpp trunk/stdair/stdair/bom/AirportDate.cpp trunk/stdair/stdair/bom/AirportDate.hpp trunk/stdair/stdair/bom/BomChildrenHolder.hpp trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomList.hpp trunk/stdair/stdair/bom/BomMap.hpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/Bucket.hpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/Network.hpp trunk/stdair/stdair/bom/NetworkDate.hpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/OutboundPathTypes.hpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/YieldStore.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/BomMultimap.hpp Modified: trunk/stdair/stdair/bom/AirlineFeature.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -29,6 +29,10 @@ BOM content type. */ typedef BomRoot Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderMap_T; // ////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/AirportDate.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.cpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/AirportDate.cpp 2010-06-08 09:07:39 UTC (rev 191) @@ -54,7 +54,7 @@ } // //////////////////////////////////////////////////////////////////// - OutboundPathMap_T AirportDate::getOutboundPathMap () const { + OutboundPathMultimap_T AirportDate::getOutboundPathMultimap () const { return _structure.getChildrenHolder<OutboundPath>(); } Modified: trunk/stdair/stdair/bom/AirportDate.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/AirportDate.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -31,6 +31,10 @@ BOM content type. */ typedef NetworkDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<OutboundPath, OutboundPathHolder_T*> @@ -41,7 +45,7 @@ // /////////// Getters ///////////// /** Get a list or map of a children type for iteration methods. */ OutboundPathList_T getOutboundPathList () const; - OutboundPathMap_T getOutboundPathMap () const; + OutboundPathMultimap_T getOutboundPathMultimap () const; /** Get the OutboundPathListList. */ const OutboundPathListList_T& getOutboundPathListList () const { Modified: trunk/stdair/stdair/bom/BomChildrenHolder.hpp =================================================================== --- trunk/stdair/stdair/bom/BomChildrenHolder.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomChildrenHolder.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -47,7 +47,6 @@ /** Default constructors. */ BomChildrenHolder () { } BomChildrenHolder (const BomChildrenHolder&); - /** Destructor. */ ~BomChildrenHolder() { } Modified: trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp =================================================================== --- trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -27,7 +27,8 @@ public: /** Define lists of children BOM structures. */ typedef std::vector<const Structure_T*> BomChildrenList_T; - typedef std::map<const std::string, const Structure_T*> BomChildrenMap_T; + /** Retrieve the map type of children BOM structures. */ + typedef typename CONTENT::Map_T BomChildrenMap_T; /** Define the different types of iterators. */ typedef BomIterator_T<CONTENT, @@ -115,18 +116,44 @@ MapReverseIterator_T mapREnd () const { return _bomChildrenMap.rend(); } - // /////////// Other operators ///////////// /** Get the size of the list. */ const unsigned int size () const { - return _bomChildrenMap.size(); + return _bomChildrenList.size(); } /** Retrieve, if existing, the bom corresponding to the given key. */ MapIterator_T find (const MapKey_T& iKey) const { return _bomChildrenMap.find (iKey); } + + private: + /** Insert an element to the list and the map. */ + const bool insert (const MapKey_T& iKey, const Structure_T& iStructure) { + const bool hasInsertionSuccessful = insert (iKey, iStructure, + _bomChildrenMap); + if (hasInsertionSuccessful == true) { + _bomChildrenList.push_back (&iStructure); + } + + return hasInsertionSuccessful; + } + + /** Internal insertion function into a map. */ + const bool insert (const MapKey_T& iKey, const Structure_T& iStructure, + std::map<const MapKey_T, const Structure_T*>& ioMap) { + return ioMap.insert (typename std::map<const MapKey_T,const Structure_T*>:: + value_type (iKey, &iStructure)).second; + } + + /** Internal insertion function into a multimap. */ + const bool insert (const MapKey_T& iKey, const Structure_T& iStructure, + std::multimap<const MapKey_T, const Structure_T*>& ioMap){ + ioMap.insert (typename std::multimap<const MapKey_T, const Structure_T*>:: + value_type (iKey, &iStructure)); + return true; + } private: /** Constructors are private so as to force the usage of the Factory @@ -140,10 +167,10 @@ private: ///////////// Attributes ////////////// /** List of children BOM structures. */ - BomChildrenMap_T _bomChildrenMap; + BomChildrenList_T _bomChildrenList; /** Map of children BOM structures with their key. */ - BomChildrenList_T _bomChildrenList; + BomChildrenMap_T _bomChildrenMap; }; } Modified: trunk/stdair/stdair/bom/BomList.hpp =================================================================== --- trunk/stdair/stdair/bom/BomList.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomList.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -61,7 +61,6 @@ BomList_T (); BomList_T (const BomList_T& iBomList) : _bomHolder (iBomList._bomHolder) { } BomList_T (const BomHolder_T& iBomHolder) : _bomHolder (iBomHolder) { } - /** Destructor. */ ~BomList_T() { } Modified: trunk/stdair/stdair/bom/BomMap.hpp =================================================================== --- trunk/stdair/stdair/bom/BomMap.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomMap.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -57,14 +57,15 @@ /** Retrieve, if existing, the Inventory corresponding to the given key. */ - iterator find (const MapKey_T& iKey) const { return _bomHolder.find (iKey); } + iterator find (const MapKey_T& iKey) const { + return _bomHolder.find (iKey); + } public: /** Default constructors. */ BomMap_T (); BomMap_T (const BomMap_T& iBomMap) : _bomHolder (iBomMap._bomHolder) { } BomMap_T (const BomHolder_T& iBomHolder) : _bomHolder (iBomHolder) { } - /** Destructor. */ ~BomMap_T() { } Copied: trunk/stdair/stdair/bom/BomMultimap.hpp (from rev 190, trunk/stdair/stdair/bom/BomMap.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomMultimap.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomMultimap.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -0,0 +1,82 @@ +#ifndef __STDAIR_BOM_BOMMULTIMAP_HPP +#define __STDAIR_BOM_BOMMULTIMAP_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> + +namespace stdair { + + // Forward declarations + template <typename BOM_CONTENT, typename ITERATOR> struct BomIterator_T; + template <typename BOM_CONTENT> class BomChildrenHolderImp; + + /** Structure which handles the iterators for a bom multimap. */ + template <typename BOM> struct BomMultimap_T { + + public: + /** Definition that allows to retrieve the corresponding Structure + associated to the BOM. */ + typedef typename BOM::Structure_T Structure_T; + /** Define the multimap of bom objects. */ + typedef std::multimap<const MapKey_T, + const Structure_T*> StructureMultimap_T; + /** Define the bom holder. */ + typedef BomChildrenHolderImp<BOM> BomHolder_T; + + // ///////////////////////////////////////////////////////////////////////// + // See the explanations, within the stdair::BomContentRoot class, for all + // the iterator types specified below + // ///////////////////////////////////////////////////////////////////////// + /** Define the bom multimap iterators. */ + typedef BomIterator_T<BOM, + typename StructureMultimap_T::const_iterator> iterator; + typedef BomIterator_T<BOM, + typename StructureMultimap_T::const_reverse_iterator + > reverse_iterator; + // ///////////////////////////////////////////////////////////////////////// + + public: + // /////////// Iteration methods ////////// + /** Initialise the internal iterator on flight date: + return the iterator at the begining of the multimap. */ + iterator begin () const { return _bomHolder.mapBegin(); } + + /** Initialise the internal iterator on flight date: + return the iterator at the end of the multimap. */ + iterator end () const { return _bomHolder.mapEnd(); } + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the rbegining of the multimap. */ + reverse_iterator rbegin () const { return _bomHolder.mapRBegin(); } + + /** Initialise the internal reverse iterator on flight date: + return the reverse iterator at the end of the multimap. */ + reverse_iterator rend () const { return _bomHolder.mapREnd(); } + + /** Retrieve, if existing, the Inventory corresponding to the + given key. */ + iterator find (const MapKey_T& iKey) const { + return _bomHolder.find (iKey); + } + + public: + /** Default constructors. */ + BomMultimap_T (); + BomMultimap_T (const BomMultimap_T& iBomMultimap) + : _bomHolder (iBomMultimap._bomHolder) { } + BomMultimap_T (const BomHolder_T& iBomHolder) : _bomHolder (iBomHolder) { } + /** Destructor. */ + ~BomMultimap_T() { } + + private: + // Attributes + /** Reference structure. */ + const BomHolder_T& _bomHolder; + }; + +} +#endif // __STDAIR_BOM_BOMMULTIMULTIMAP_HPP + Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -29,6 +29,8 @@ the stdair namespace</li> <li>Parent_T: Type corresponding to the parent BOM class within that namespace (e.g., AIRSCHED here)</li> + <li>Map_T: Type corresponding to the map/multimap type using by the + corresponding BomChildrenHolder <li>ChildrenHolderMap_T: The map between the type of children and a pointer to the bom holder of this type (e.g., AIRSCHED here). All the pointers to the bom holder should be initialised to @@ -46,6 +48,10 @@ /** Definition allowing to retrieve the parent type. */ typedef BomRoot Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<Inventory, InventoryHolder_T*>, Modified: trunk/stdair/stdair/bom/BomSource.hpp =================================================================== --- trunk/stdair/stdair/bom/BomSource.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BomSource.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -7,6 +7,7 @@ #include <stdair/bom/Structure.hpp> #include <stdair/bom/BomChildrenHolderImp.hpp> #include <stdair/bom/BomMap.hpp> +#include <stdair/bom/BomMultimap.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/Network.hpp> Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -29,6 +29,10 @@ BOM content type. */ typedef SegmentCabin Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderMap_T; // ////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Bucket.hpp =================================================================== --- trunk/stdair/stdair/bom/Bucket.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/Bucket.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -27,6 +27,10 @@ /** Definition allowing to retrieve the associated parent. */ typedef LegCabin Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderMap_T; Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -28,6 +28,10 @@ BOM content type. */ typedef BomRoot Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderMap_T; // ////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -35,6 +35,10 @@ BOM content type. */ typedef Inventory Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<LegDate, LegDateHolder_T*>, Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -33,6 +33,10 @@ BOM content type. */ typedef BomRoot Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<FlightDate, FlightDateHolder_T*> Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -33,6 +33,10 @@ BOM content type. */ typedef LegDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<Bucket, BucketHolder_T*>, Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/LegDate.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -33,6 +33,10 @@ BOM content type. */ typedef FlightDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<LegCabin, LegCabinHolder_T*>, Modified: trunk/stdair/stdair/bom/Network.hpp =================================================================== --- trunk/stdair/stdair/bom/Network.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/Network.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -31,6 +31,10 @@ BOM content type. */ typedef BomRoot Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<NetworkDate, NetworkDateHolder_T*> Modified: trunk/stdair/stdair/bom/NetworkDate.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/NetworkDate.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -31,6 +31,10 @@ BOM content type. */ typedef Network Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<AirportDate, AirportDateHolder_T*> Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -31,6 +31,10 @@ BOM content type. */ typedef AirportDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::multimap<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<SegmentDate, SegmentDateHolder_T*> Modified: trunk/stdair/stdair/bom/OutboundPathTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPathTypes.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/OutboundPathTypes.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -15,7 +15,7 @@ template <typename CONTENT> class Structure; template <typename CONTENT> class BomChildrenHolderImp; template <typename BOM> struct BomList_T; - template <typename BOM> struct BomMap_T; + template <typename BOM> struct BomMultimap_T; class OutboundPath; /** Define the outbound path structure. */ @@ -28,7 +28,7 @@ typedef BomList_T<OutboundPath> OutboundPathList_T; /** Define the outbound path map. */ - typedef BomMap_T<OutboundPath> OutboundPathMap_T; + typedef BomMultimap_T<OutboundPath> OutboundPathMultimap_T; typedef std::vector<std::vector<stdair::OutboundPath*> >OutboundPathListList_T; typedef std::vector<stdair::OutboundPath*> OutboundPathLightList_T; Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -33,6 +33,10 @@ BOM content type. */ typedef SegmentDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<BookingClass, BookingClassHolder_T*>, Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -33,6 +33,10 @@ BOM content type. */ typedef FlightDate Parent_T; + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + /** Define the list of children holder types. */ typedef boost::fusion::map< boost::fusion::pair<SegmentCabin, SegmentCabinHolder_T*>, Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -16,6 +16,7 @@ // Forward declarations. template <typename CONTENT> class BomChildrenHolderImp; template <typename CONTENT> class BomMap_T; + template <typename CONTENT> class BomMultimap_T; template <typename CONTENT> class BomList_T; /** Wrapper class aimed at holding the actual content, modeled @@ -80,9 +81,10 @@ boost::fusion::at_key<CHILD> (_holderMap); if (lHolder_ptr != NULL) { + // Look for the child in the map, then in the multimap BomMap_T<CHILD> lChildrenMap (*lHolder_ptr); typename BomMap_T<CHILD>::iterator itContentChild = - lChildrenMap.find (iKey); + lChildrenMap.find (iKey); if (itContentChild != lChildrenMap.end()) { oContentChild_ptr = itContentChild->second; } @@ -95,15 +97,17 @@ template <typename CHILD> CHILD& getChild (const MapKey_T& iKey) const { CHILD* lChild_ptr = NULL; - - BomMap_T<CHILD> lChildrenMap (getChildrenHolder<CHILD>()); + const BomChildrenHolderImp<CHILD>& lHolder = getChildrenHolder<CHILD>(); + BomMap_T<CHILD> lChildrenMap (lHolder); + typename BomMap_T<CHILD>::iterator itContentChild = lChildrenMap.find (iKey); if (itContentChild != lChildrenMap.end()) { lChild_ptr = itContentChild->second; } + assert (lChild_ptr != NULL); return *lChild_ptr; } Modified: trunk/stdair/stdair/bom/YieldStore.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStore.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/YieldStore.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -28,6 +28,10 @@ /** Definition allowing to retrieve the associated parent. */ typedef BomRoot Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; /** Define the list of children holder types. */ typedef boost::fusion::map< > ChildrenHolderMap_T; Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/bom/sources.mk 2010-06-08 09:07:39 UTC (rev 191) @@ -10,6 +10,7 @@ $(top_srcdir)/stdair/bom/BomChildrenHolderImp.hpp \ $(top_srcdir)/stdair/bom/BomList.hpp \ $(top_srcdir)/stdair/bom/BomMap.hpp \ + $(top_srcdir)/stdair/bom/BomMultimap.hpp \ $(top_srcdir)/stdair/bom/BomIterator.hpp \ $(top_srcdir)/stdair/bom/BomRootKey.hpp \ $(top_srcdir)/stdair/bom/YieldStoreKey.hpp \ Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -68,9 +68,6 @@ 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(); } } @@ -173,7 +170,7 @@ <br>This constructor is protected to ensure the class is content. */ FacBomContent() {} /** Destructor. */ - virtual ~FacBomContent(); + ~FacBomContent(); /** Destroyed all the object instantiated by this factory. */ void clean(); Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-05-26 13:13:51 UTC (rev 190) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-08 09:07:39 UTC (rev 191) @@ -122,16 +122,9 @@ // Insert the structure object in the dedicated lists typedef typename HOLDER_T::BomChildrenMap_T BOM_MAP_T; - const bool hasInsertBeenSuccessful = ioHolder._bomChildrenMap. - insert (typename BOM_MAP_T::value_type (lKeyStr, &iStructure)).second; - - if (hasInsertBeenSuccessful == false) { - return hasInsertBeenSuccessful; - } - - ioHolder._bomChildrenList.push_back (&iStructure); - - return true; + const bool hasInsertBeenSuccessful = ioHolder.insert (lKeyStr, iStructure); + + return hasInsertBeenSuccessful; } // ////////////////////////////////////////////////////////////////// @@ -150,16 +143,9 @@ // Insert the structure object in the dedicated lists typedef typename HOLDER_T::BomChildrenMap_T BOM_MAP_T; - const bool hasInsertBeenSuccessful = ioHolder._bomChildrenMap. - insert (typename BOM_MAP_T::value_type (lKeyStr, &iStructure)).second; - - if (hasInsertBeenSuccessful == false) { - return hasInsertBeenSuccessful; - } - - ioHolder._bomChildrenList.push_back (&iStructure); - - return true; + const bool hasInsertBeenSuccessful = ioHolder.insert (lKeyStr, iStructure); + + return hasInsertBeenSuccessful; } // ////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-06-28 08:53:31
|
Revision: 200 http://stdair.svn.sourceforge.net/stdair/?rev=200&view=rev Author: quannaus Date: 2010-06-28 08:53:24 +0000 (Mon, 28 Jun 2010) Log Message: ----------- [dev] Added ReachableUniverse, OriginDestinationSet, SegmentPathPeriod, FlightPeriod, SegmentPeriod Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/DoWStruct.cpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.hpp trunk/stdair/stdair/bom/OutboundPath.cpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/OutboundPathContent.cpp trunk/stdair/stdair/bom/OutboundPathContent.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateContent.cpp trunk/stdair/stdair/bom/SegmentDateContent.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp Added Paths: ----------- trunk/stdair/stdair/bom/FlightPeriod.cpp trunk/stdair/stdair/bom/FlightPeriod.hpp trunk/stdair/stdair/bom/FlightPeriodContent.cpp trunk/stdair/stdair/bom/FlightPeriodContent.hpp trunk/stdair/stdair/bom/FlightPeriodKey.cpp trunk/stdair/stdair/bom/FlightPeriodKey.hpp trunk/stdair/stdair/bom/FlightPeriodTypes.hpp trunk/stdair/stdair/bom/OriginDestinationSet.cpp trunk/stdair/stdair/bom/OriginDestinationSet.hpp trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp trunk/stdair/stdair/bom/ReachableUniverse.cpp trunk/stdair/stdair/bom/ReachableUniverse.hpp trunk/stdair/stdair/bom/ReachableUniverseContent.cpp trunk/stdair/stdair/bom/ReachableUniverseContent.hpp trunk/stdair/stdair/bom/ReachableUniverseKey.cpp trunk/stdair/stdair/bom/ReachableUniverseKey.hpp trunk/stdair/stdair/bom/ReachableUniverseTypes.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp trunk/stdair/stdair/bom/SegmentPeriod.cpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/SegmentPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPeriodTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -29,47 +29,36 @@ class STDAIR_Service; // ///////// Exceptions /////////// - class RootException : public std::exception { - }; + class RootException : public std::exception { }; - class FileNotFoundException : public RootException { - }; + class FileNotFoundException : public RootException { }; - class NonInitialisedLogServiceException : public RootException { - }; + class NonInitialisedLogServiceException : public RootException { }; - class NonInitialisedDBSessionManagerException : public RootException { - }; + class NonInitialisedDBSessionManagerException : public RootException { }; - class NonInitialisedServiceException : public RootException { - }; + class NonInitialisedServiceException : public RootException { }; - class MemoryAllocationException : public RootException { - }; + class MemoryAllocationException : public RootException { }; - class ObjectLinkingException : public RootException { - }; + class ObjectLinkingException : public RootException { }; - class ParserException : public RootException { - }; + class ParserException : public RootException { }; - class CodeConversionException : public ParserException { - }; + class CodeConversionException : public ParserException { }; - class CodeDuplicationException : public ParserException { - }; + class CodeDuplicationException : public ParserException { }; - class ObjectNotFoundException : public RootException { - }; + class ObjectCreationgDuplicationException : public ParserException { }; - class SQLDatabaseException : public RootException { - }; + class ObjectNotFoundException : public RootException { }; + class SQLDatabaseException : public RootException { }; + class SQLDatabaseConnectionImpossibleException : public SQLDatabaseException { }; - class DocumentNotFoundException : public RootException { - }; + class DocumentNotFoundException : public RootException { }; // /////////////// Log ///////////// /** Level of logs. */ @@ -147,8 +136,8 @@ /** Define the Day-Of-the-Week as a string. */ typedef std::string DOW_String_T; - /** Define the Date Off-Set (e.g., -1 ). */ - typedef boost::gregorian::date_duration DateOffSet_T; + /** Define the Date Offset (e.g., -1 ). */ + typedef boost::gregorian::date_duration DateOffset_T; /** Define a duration in number of days. */ typedef unsigned int DayDuration_T; Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -42,11 +42,11 @@ const std::string DOW_STR[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; - /** Default DOW String (e.g., "1111100"). */ - const DOW_String_T DEFAULT_DOW_STRING ("1111100"); + /** Default DOW String (e.g., "0000000"). */ + const DOW_String_T DEFAULT_DOW_STRING ("0000000"); - /** Default Date OffSet (e.g., 0). */ - const DateOffSet_T DEFAULT_DATE_OFFSET (0); + /** Default Date Offset (e.g., 0). */ + const DateOffset_T DEFAULT_DATE_OFFSET (0); // // //////// General /////// /** Default date for the General. */ Modified: trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/basic/BasConst_Period_BOM.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -19,8 +19,8 @@ /** Default DOW String (e.g., "1111100"). */ extern const DOW_String_T DEFAULT_DOW_STRING; - /** Default Date OffSet (e.g., 0). */ - extern const DateOffSet_T DEFAULT_DATE_OFFSET; + /** Default Date Offset (e.g., 0). */ + extern const DateOffset_T DEFAULT_DATE_OFFSET; /** Default Duration in days (e.g., 0). */ extern const DayDuration_T DEFAULT_DAY_DURATION; Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -6,25 +6,7 @@ #include <ostream> // StdAir #include <stdair/basic/BasConst_BomManager.hpp> -#include <stdair/bom/BomChildrenHolderImp.hpp> -#include <stdair/bom/Structure.hpp> -#include <stdair/bom/BomList.hpp> -#include <stdair/bom/BomMap.hpp> -#include <stdair/bom/BomRoot.hpp> -#include <stdair/bom/AirlineFeature.hpp> -#include <stdair/bom/BomList.hpp> -#include <stdair/bom/BomMap.hpp> -#include <stdair/bom/Inventory.hpp> -#include <stdair/bom/FlightDate.hpp> -#include <stdair/bom/SegmentDate.hpp> -#include <stdair/bom/LegDate.hpp> -#include <stdair/bom/SegmentCabin.hpp> -#include <stdair/bom/LegCabin.hpp> -#include <stdair/bom/BookingClass.hpp> -#include <stdair/bom/Network.hpp> -#include <stdair/bom/NetworkDate.hpp> -#include <stdair/bom/AirportDate.hpp> -#include <stdair/bom/OutboundPath.hpp> +#include <stdair/bom/BomSource.hpp> #include <stdair/bom/BookingRequestStruct.hpp> #include <stdair/bom/BomManager.hpp> @@ -145,10 +127,10 @@ << lCurrentLD.getOffPoint() << ", " << lCurrentLD.getBoardingDate() << " -> " << lCurrentLD.getOffDate() << " / " - << lCurrentLD.getDateOffSet() << ", " + << lCurrentLD.getDateOffset() << ", " << lCurrentLD.getBoardingTime() << " -> " << lCurrentLD.getOffTime() << " (" - << lCurrentLD.getTimeOffSet() << ") / " + << lCurrentLD.getTimeOffset() << ") / " << lCurrentLD.getElapsedTime() << ", " << lCurrentLD.getDistance() << ", " << lCurrentLD.getCapacity() << ", " @@ -278,10 +260,10 @@ << lCurrentSC.getCabinCode() << ", " << lCurrentSD.getBoardingDate() << " -> " << lCurrentSD.getOffDate() << " / " - << lCurrentSD.getDateOffSet() << ", " + << lCurrentSD.getDateOffset() << ", " << lCurrentSD.getBoardingTime() << " -> " << lCurrentSD.getOffTime() << " (" - << lCurrentSD.getTimeOffSet() << ") / " + << lCurrentSD.getTimeOffset() << ") / " << lCurrentSD.getElapsedTime() << ", " << lCurrentSD.getDistance() << ", " << std::endl; Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -21,6 +21,7 @@ // //////////////////////////////////////////////////////////////////// void BomRoot::init() { _structure.initChildrenHolder<Inventory>(); + _structure.initChildrenHolder<ReachableUniverse>(); _structure.initChildrenHolder<Network>(); _structure.initChildrenHolder<AirlineFeature>(); _structure.initChildrenHolder<DemandStream>(); @@ -38,6 +39,16 @@ } // //////////////////////////////////////////////////////////////////// + ReachableUniverseList_T BomRoot::getReachableUniverseList () const { + return _structure.getChildrenHolder<ReachableUniverse>(); + } + + // //////////////////////////////////////////////////////////////////// + ReachableUniverseMap_T BomRoot::getReachableUniverseMap () const { + return _structure.getChildrenHolder<ReachableUniverse>(); + } + + // //////////////////////////////////////////////////////////////////// NetworkList_T BomRoot::getNetworkList () const { return _structure.getChildrenHolder<Network>(); } @@ -83,6 +94,12 @@ } // //////////////////////////////////////////////////////////////////// + ReachableUniverse* BomRoot:: + getReachableUniverse (const AirportCode_T& iAirportCode) const { + return _structure.getChildPtr<ReachableUniverse> (iAirportCode); + } + + // //////////////////////////////////////////////////////////////////// Network* BomRoot::getNetwork (const NetworkID_T& iNetworkID) const { return _structure.getChildPtr<Network> (iNetworkID); } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -14,6 +14,7 @@ #include <stdair/bom/BomRootContent.hpp> #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/ReachableUniverseTypes.hpp> #include <stdair/bom/NetworkTypes.hpp> #include <stdair/bom/DemandStreamTypes.hpp> #include <stdair/bom/AirlineFeatureTypes.hpp> @@ -62,6 +63,7 @@ #if BOOST_VERSION >= 103500 typedef boost::fusion::map< boost::fusion::pair<Inventory, InventoryHolder_T*>, + boost::fusion::pair<ReachableUniverse, ReachableUniverseHolder_T*>, boost::fusion::pair<Network, NetworkHolder_T*>, boost::fusion::pair<AirlineFeature, AirlineFeatureHolder_T*>, boost::fusion::pair<DemandStream, DemandStreamHolder_T*>, @@ -77,6 +79,8 @@ /** Get a list or map of a children type for iteration methods. */ InventoryList_T getInventoryList () const; InventoryMap_T getInventoryMap () const; + ReachableUniverseList_T getReachableUniverseList () const; + ReachableUniverseMap_T getReachableUniverseMap () const; NetworkList_T getNetworkList () const; NetworkMap_T getNetworkMap () const; DemandStreamList_T getDemandStreamList () const; @@ -91,6 +95,11 @@ <br>If not existing, return the NULL pointer. */ Inventory* getInventory (const AirlineCode_T&) const; + /** Retrieve, if existing, the ReachableUniverse corresponding to the + given airport. + <br>If not existing, return the NULL pointer. */ + ReachableUniverse* getReachableUniverse (const AirportCode_T&) const; + /** Retrieve, if existing, the Network corresponding to the given airline code (Network key). <br>If not existing, return the NULL pointer. */ Modified: trunk/stdair/stdair/bom/BomSource.hpp =================================================================== --- trunk/stdair/stdair/bom/BomSource.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/BomSource.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -22,6 +22,11 @@ #include <stdair/bom/LegDate.hpp> #include <stdair/bom/LegCabin.hpp> #include <stdair/bom/Bucket.hpp> +#include <stdair/bom/FlightPeriod.hpp> +#include <stdair/bom/SegmentPeriod.hpp> +#include <stdair/bom/ReachableUniverse.hpp> +#include <stdair/bom/OriginDestinationSet.hpp> +#include <stdair/bom/SegmentPathPeriod.hpp> #include <stdair/bom/DemandStream.hpp> #include <stdair/bom/AirlineFeature.hpp> #include <stdair/bom/YieldStore.hpp> Modified: trunk/stdair/stdair/bom/DoWStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -1,17 +1,16 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> // STL #include <sstream> +#include <cassert> // STDAIR #include <stdair/basic/BasConst_Period_BOM.hpp> #include <stdair/bom/DoWStruct.hpp> namespace stdair { - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// DoWStruct_T::DoWStruct_T (const std::string& iDowString) { const unsigned short lDowStringSize = iDowString.size(); assert (lDowStringSize == 7); @@ -24,13 +23,13 @@ } } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// DoWStruct_T::DoWStruct_T (const DoWStruct_T& iDowStruct) : _dowList (iDowStruct._dowList) { } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string DoWStruct_T::describeShort() const { std::ostringstream ostr; short i = 0; @@ -42,7 +41,7 @@ return ostr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// const std::string DoWStruct_T::describe() const { std::ostringstream ostr; short i = 0; @@ -56,12 +55,12 @@ return ostr.str(); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// bool DoWStruct_T::getDayOfWeek (const unsigned short i) const { return _dowList.at (i); } - // ////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////// bool DoWStruct_T::getStandardDayOfWeek (const unsigned short i) const { unsigned short iStd = i; if (iStd == 0) { Copied: trunk/stdair/stdair/bom/FlightPeriod.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriod.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,75 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iostream> +#include <algorithm> +// STDAIR +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriod::FlightPeriod (const Key_T& iKey, + Structure_T& ioFlightStructure) + : FlightPeriodContent (iKey), _structure (ioFlightStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriod::~FlightPeriod () { + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::init() { + _structure.initChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriod::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string FlightPeriod::toString() const { + std::ostringstream oStr; + + // First, put the key of that level + oStr << describeShortKey() << std::endl; + + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string FlightPeriod::describeKey() const { + std::ostringstream oStr; + oStr << _structure.describeParentKey() << ", " << describeShortKey(); + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const FlightPeriod::Parent_T& FlightPeriod::getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriodList_T FlightPeriod::getSegmentPeriodList () const { + return _structure.getChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriodMap_T FlightPeriod::getSegmentPeriodMap () const { + return _structure.getChildrenHolder<SegmentPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPeriod* FlightPeriod::getSegmentPeriod (const SegmentPeriodKey_T& iKey) const { + return _structure.getChildPtr<SegmentPeriod> (iKey.toString() ); + } +} + Copied: trunk/stdair/stdair/bom/FlightPeriod.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDate.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,98 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIOD_HPP +#define __STDAIR_BOM_FLIGHTPERIOD_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightPeriodContent.hpp> +#include <stdair/bom/FlightPeriodTypes.hpp> +#include <stdair/bom/SegmentPeriodTypes.hpp> + +namespace stdair { + // Forward declarations + class Inventory; + class SegmentPeriod; + struct SegmentPeriodKey_T; + + /** Class representing the actual functional/business content for a + flight-period. */ + class FlightPeriod : public FlightPeriodContent { + friend class FacBomContent; + + public: + // Type definitions + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef FlightPeriodStructure_T Structure_T; + + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef Inventory Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<SegmentPeriod, SegmentPeriodHolder_T*> + > ChildrenHolderMap_T; + // ////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + + /** Get a list or map of a children type for iteration methods. */ + SegmentPeriodList_T getSegmentPeriodList () const; + SegmentPeriodMap_T getSegmentPeriodMap () const; + + /** Retrieve, if existing, the SegmentPeriod corresponding to the + given SegmentPeriod key. + <br>If not existing, return the NULL pointer. */ + SegmentPeriod* getSegmentPeriod (const SegmentPeriodKey_T&) const; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Constructors. */ + FlightPeriod (const Key_T&, Structure_T&); + /** Destructor. */ + ~FlightPeriod(); + /** Initialise all the pointers of children holder to NULL. */ + void init(); + /** Default constructors. */ + FlightPeriod (); + FlightPeriod (const FlightPeriod&); + + protected: + // Attributes + /** Reference structure. */ + Structure_T& _structure; + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIOD_HPP + Copied: trunk/stdair/stdair/bom/FlightPeriodContent.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDateContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/FlightPeriodContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriodContent::FlightPeriodContent (const Key_T& iKey) + : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodContent::~FlightPeriodContent () { + } + +} + Copied: trunk/stdair/stdair/bom/FlightPeriodContent.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,74 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP +#define __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/FlightPeriodKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline flight-period. */ + class FlightPeriodContent : public BomContent { + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FlightPeriodKey_T Key_T; + + public: + // /////////// Getters /////////////// + /** Get the flight-period key. */ + const Key_T& getKey () const { + return _key; + } + + /** Get the flight number (part of the primary key). */ + const FlightNumber_T& getFlightNumber () const { + return _key.getFlightNumber(); + } + + /** Get the departure date range. */ + const DatePeriod_T& getDeparturePeriod () const { + return _key.getDeparturePeriod(); + } + + /** Get the active days-of-week. */ + const DoWStruct_T& getDoW () const { + return _key.getDoW(); + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + FlightPeriodContent (const Key_T&); + FlightPeriodContent (const FlightPeriodContent&); + /** Destructor. */ + virtual ~FlightPeriodContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + Key_T _key; + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIODCONTENT_HPP + Copied: trunk/stdair/stdair/bom/FlightPeriodKey.cpp (from rev 195, trunk/stdair/stdair/bom/FlightDateKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodKey.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,43 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FlightPeriodKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::FlightPeriodKey_T (const FlightNumber_T& iFlightNumber, + const DatePeriod_T& iDatePeriod, + const DoWStruct_T& iDoW) + : _flightNumber (iFlightNumber), _dateRange (iDatePeriod), _dow (iDoW) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::FlightPeriodKey_T (const FlightPeriodKey_T& iKey) + : _flightNumber (iKey._flightNumber), _dateRange (iKey._dateRange), + _dow (iKey._dow) { + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodKey_T::~FlightPeriodKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriodKey_T::toStream (std::ostream& ioOut) const { + ioOut << "FlightPeriodKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FlightPeriodKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string FlightPeriodKey_T::toString() const { + std::ostringstream oStr; + oStr << _flightNumber << ", " << _dateRange << ", " + << _dow.describeShort(); + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/FlightPeriodKey.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodKey.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,73 @@ +#ifndef __STDAIR_BOM_FLIGHTPERIODKEY_HPP +#define __STDAIR_BOM_FLIGHTPERIODKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/DoWStruct.hpp> + +namespace stdair { + /** Key of flight-period. */ + struct FlightPeriodKey_T : public BomKey_T { + + private: + // /////////// Default constructor ////////// + FlightPeriodKey_T (); + public: + // /////////// Construction /////////// + /** Constructors. */ + FlightPeriodKey_T (const FlightNumber_T&, const DatePeriod_T&, + const DoWStruct_T&); + FlightPeriodKey_T (const FlightPeriodKey_T&); + /** Destructor. */ + ~FlightPeriodKey_T (); + + // /////////// Getters ////////// + /** Get the flight number. */ + const FlightNumber_T& getFlightNumber() const { + return _flightNumber; + } + + /** Get the departure date range. */ + const DatePeriod_T& getDeparturePeriod () const { + return _dateRange; + } + + /** Get the active days-of-week. */ + const DoWStruct_T& getDoW () const { + return _dow; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-period. */ + const std::string toString() const; + + private: + // Attributes + /** Flight number. */ + FlightNumber_T _flightNumber; + + /** Departure period of the (first leg of the) flight. */ + DatePeriod_T _dateRange; + + /** DoW during the departure period. */ + DoWStruct_T _dow; + + }; + +} +#endif // __STDAIR_BOM_FLIGHTPERIODKEY_HPP Copied: trunk/stdair/stdair/bom/FlightPeriodTypes.hpp (from rev 195, trunk/stdair/stdair/bom/FlightDateTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FlightPeriodTypes.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FLIGHTPERIODTYPES_HPP +#define __STDAIR_BOM_FLIGHTPERIODTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class FlightPeriod; + + /** Define the FlightPeriod structure. */ + typedef Structure<FlightPeriod> FlightPeriodStructure_T; + + /** Define the FlightPeriod holder. */ + typedef BomChildrenHolderImp<FlightPeriod> FlightPeriodHolder_T; + + /** Define the flight-period list. */ + typedef BomList_T<FlightPeriod> FlightPeriodList_T; + + /** Define the flight-period map. */ + typedef BomMap_T<FlightPeriod> FlightPeriodMap_T; +} +#endif // __STDAIR_BOM_FLIGHTPERIODTYPES_HPP + Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/Inventory.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -22,6 +22,7 @@ // //////////////////////////////////////////////////////////////////// void Inventory::init () { _structure.initChildrenHolder<FlightDate> (); + _structure.initChildrenHolder<FlightPeriod> (); } // //////////////////////////////////////////////////////////////////// @@ -46,6 +47,11 @@ } // //////////////////////////////////////////////////////////////////// + const Inventory::Parent_T& Inventory::getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// FlightDateList_T Inventory::getFlightDateList () const { return _structure.getChildrenHolder<FlightDate>(); } @@ -56,9 +62,25 @@ } // //////////////////////////////////////////////////////////////////// + FlightPeriodList_T Inventory::getFlightPeriodList () const { + return _structure.getChildrenHolder<FlightPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + FlightPeriodMap_T Inventory::getFlightPeriodMap () const { + return _structure.getChildrenHolder<FlightPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// FlightDate* Inventory:: getFlightDate (const FlightDateKey_T& iKey) const { return _structure.getChildPtr<FlightDate> (iKey.toString()); } + + // //////////////////////////////////////////////////////////////////// + FlightPeriod* Inventory:: + getFlightPeriod (const FlightPeriodKey_T& iKey) const { + return _structure.getChildPtr<FlightPeriod> (iKey.toString()); + } } Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -14,13 +14,16 @@ #include <stdair/bom/InventoryContent.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/FlightPeriodTypes.hpp> namespace stdair { // Forward declarations class BomRoot; class FlightDate; + class FlightPeriod; class AirlineFeature; struct FlightDateKey_T; + struct FlightPeriodKey_T; /** Class representing the actual functional/business content for an airline inventory. */ @@ -46,7 +49,8 @@ /** Define the list of children holder types. */ #if BOOST_VERSION >= 103500 typedef boost::fusion::map< - boost::fusion::pair<FlightDate, FlightDateHolder_T*> + boost::fusion::pair<FlightDate, FlightDateHolder_T*>, + boost::fusion::pair<FlightPeriod, FlightPeriodHolder_T*> > ChildrenHolderMap_T; #else // BOOST_VERSION >= 103500 typedef boost::mpl::map< > ChildrenHolderMap_T; @@ -72,9 +76,14 @@ public: // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + /** Get a list or map of a children type for iteration methods. */ FlightDateList_T getFlightDateList () const; FlightDateMap_T getFlightDateMap () const; + FlightPeriodList_T getFlightPeriodList () const; + FlightPeriodMap_T getFlightPeriodMap () const; /** Get the airline feature. */ const AirlineFeature* getAirlineFeature () const { @@ -85,6 +94,11 @@ given flight number and flight date (FlightDate key). <br>If not existing, return the NULL pointer. */ FlightDate* getFlightDate (const FlightDateKey_T&) const; + + /** Retrieve, if existing, the FlightPeriod corresponding to the + given flight number and flight period (FlightPeriod key). + <br>If not existing, return the NULL pointer. */ + FlightPeriod* getFlightPeriod (const FlightPeriodKey_T&) const; public: // /////////// Setters //////////// Modified: trunk/stdair/stdair/bom/LegDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/LegDateContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -21,14 +21,14 @@ } // //////////////////////////////////////////////////////////////////// - const Duration_T LegDateContent::getTimeOffSet() const { - // TimeOffSet = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 + const Duration_T LegDateContent::getTimeOffset() const { + // TimeOffset = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 // - ElapsedTime - Duration_T oTimeOffSet = (_offTime - _boardingTime); - const DateOffSet_T& lDateOffSet = getDateOffSet(); - const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); - oTimeOffSet += lDateOffSetInHours - _elapsedTime; - return oTimeOffSet; + Duration_T oTimeOffset = (_offTime - _boardingTime); + const DateOffset_T& lDateOffset = getDateOffset(); + const Duration_T lDateOffsetInHours (lDateOffset.days() * 24, 0, 0); + oTimeOffset += lDateOffsetInHours - _elapsedTime; + return oTimeOffset; } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDateContent.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/LegDateContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -69,16 +69,16 @@ return _capacity; } - /** Get the date off set (off date - boarding date). */ - const DateOffSet_T getDateOffSet () const { + /** Get the date offset (off date - boarding date). */ + const DateOffset_T getDateOffset () const { return _offDate - _boardingDate; } /** Get the time off set between boarding and off points. <br>It is defined as being: - TimeOffSet = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 + TimeOffset = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 - ElapsedTime. */ - const Duration_T getTimeOffSet() const; + const Duration_T getTimeOffset() const; public: // ///////// Setters ////////// Copied: trunk/stdair/stdair/bom/OriginDestinationSet.cpp (from rev 195, trunk/stdair/stdair/bom/Network.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSet.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSet.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,68 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSet::OriginDestinationSet (const Key_T& iKey, + Structure_T& ioOriginDestinationSetStructure) + : OriginDestinationSetContent (iKey), + _structure (ioOriginDestinationSetStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSet::~OriginDestinationSet () { + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::init () { + _structure.initChildrenHolder<SegmentPathPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::toStream (std::ostream& ioOut) const { + ioOut << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSet::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + std::string OriginDestinationSet::toString() const { + std::ostringstream oStr; + oStr << _key.toString(); + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string OriginDestinationSet::describeKey() const { + return _key.toString(); + } + + // //////////////////////////////////////////////////////////////////// + const OriginDestinationSet::Parent_T& OriginDestinationSet:: + getParent () const { + return _structure.getParent().getContent(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPathPeriodList_T OriginDestinationSet:: + getSegmentPathPeriodList () const { + return _structure.getChildrenHolder<SegmentPathPeriod>(); + } + + // //////////////////////////////////////////////////////////////////// + SegmentPathPeriodMultimap_T OriginDestinationSet:: + getSegmentPathPeriodMultimap () const { + return _structure.getChildrenHolder<SegmentPathPeriod>(); + } + +} + Copied: trunk/stdair/stdair/bom/OriginDestinationSet.hpp (from rev 195, trunk/stdair/stdair/bom/Network.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSet.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSet.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,91 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSET_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSET_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/OriginDestinationSetContent.hpp> +#include <stdair/bom/OriginDestinationSetTypes.hpp> +#include <stdair/bom/SegmentPathPeriodTypes.hpp> + +namespace stdair { + // Forward declarations + class ReachableUniverse; + class SegmentPathPeriod; + + /** Class representing the actual functional/business content for + a network. */ + class OriginDestinationSet : public OriginDestinationSetContent { + friend class FacBomContent; + + public: + // ////////////////////////////////////////////////////////////////// + // See the explanations, within the BomRoot class, for all + // the types which require to be specified below + // ////////////////////////////////////////////////////////////////// + /** Definition allowing to retrieve the associated BOM structure type. */ + typedef OriginDestinationSetStructure_T Structure_T; + + /** Definition allowing to retrieve the associated parent + BOM content type. */ + typedef ReachableUniverse Parent_T; + + /** Definition allowing to retrieve the map/multimap type using by + BomChildrenHolder. */ + typedef std::map<const MapKey_T, const Structure_T*> Map_T; + + /** Define the list of children holder types. */ + typedef boost::fusion::map< + boost::fusion::pair<SegmentPathPeriod, SegmentPathPeriodHolder_T*> + > ChildrenHolderMap_T; + // ////////////////////////////////////////////////////////////////// + + public: + // /////////// Getters ///////////// + /** Get the parent object. */ + const Parent_T& getParent () const; + + /** Get a list or map of a children type for iteration methods. */ + SegmentPathPeriodList_T getSegmentPathPeriodList () const; + SegmentPathPeriodMultimap_T getSegmentPathPeriodMultimap () const; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + protected: + /** Constructors are private so as to force the usage of the Factory + layer. */ + /** Constructors. */ + OriginDestinationSet (const Key_T&, Structure_T&); + /** Destructor. */ + ~OriginDestinationSet(); + /** Initialise all the pointers of children holder to NULL. */ + void init(); + /** Default constructors. */ + OriginDestinationSet (); + OriginDestinationSet (const OriginDestinationSet&); + + protected: + // Attributes + /** Reference structure. */ + Structure_T& _structure; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSET_HPP + Copied: trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp (from rev 195, trunk/stdair/stdair/bom/NetworkContent.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,21 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/bom/OriginDestinationSetContent.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetContent:: + OriginDestinationSetContent (const Key_T& iKey) : _key (iKey) { + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetContent::~OriginDestinationSetContent () { + } + +} + Copied: trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkContent.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,59 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomContent.hpp> +#include <stdair/bom/OriginDestinationSetKey.hpp> + +namespace stdair { + + /** Class representing the actual attributes for an airline network. */ + class OriginDestinationSetContent : public BomContent { + public : + // Type definitions + /** Definition allowing to retrieve the associated BOM key type. */ + typedef OriginDestinationSetKey_T Key_T; + + public: + // ////////// Getters //////////// + /** Get the network key. */ + const Key_T& getKey() const { + return _key; + } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + virtual void toStream (std::ostream& ioOut) const = 0; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + virtual void fromStream (std::istream& ioIn) = 0; + + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + OriginDestinationSetContent (const Key_T&); + OriginDestinationSetContent (const OriginDestinationSetContent&); + /** Destructor. */ + virtual ~OriginDestinationSetContent(); + + protected: + // Attributes + /** The key of both structure and content objects. */ + Key_T _key; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETCONTENT_HPP + Copied: trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp (from rev 195, trunk/stdair/stdair/bom/NetworkKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,40 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/OriginDestinationSetKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T:: + OriginDestinationSetKey_T (const AirportCode_T& iDestination) + : _destination (iDestination) { + } + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T:: + OriginDestinationSetKey_T (const OriginDestinationSetKey_T& iKey) + : _destination (iKey._destination) { + } + + // //////////////////////////////////////////////////////////////////// + OriginDestinationSetKey_T::~OriginDestinationSetKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSetKey_T::toStream (std::ostream& ioOut) const { + ioOut << "OriginDestinationSetKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void OriginDestinationSetKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string OriginDestinationSetKey_T::toString() const { + std::ostringstream oStr; + oStr << _destination; + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,57 @@ +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomKey.hpp> + +namespace stdair { + /** Key of network. */ + struct OriginDestinationSetKey_T : public BomKey_T { + + private: + // /////////// Default constructor ////////// + OriginDestinationSetKey_T (); + + public: + // /////////// Construction /////////// + /** Constructors. */ + OriginDestinationSetKey_T (const AirportCode_T& ); + OriginDestinationSetKey_T (const OriginDestinationSetKey_T&); + /** Destructor. */ + ~OriginDestinationSetKey_T (); + + // /////////// Getters ////////// + /** Get the destination airport code. */ + const AirportCode_T& getOffPoint () const { + return _destination; + } + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-date. */ + const std::string toString() const; + + + private: + // Attributes + /** OriginDestinationSet ID. */ + AirportCode_T _destination; + }; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETKEY_HPP Copied: trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp (from rev 195, trunk/stdair/stdair/bom/NetworkTypes.hpp) =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,35 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP +#define __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <vector> + +namespace stdair { + + // Forward declarations. + template <typename CONTENT> class Structure; + template <typename CONTENT> class BomChildrenHolderImp; + template <typename BOM> struct BomList_T; + template <typename BOM> struct BomMap_T; + class OriginDestinationSet; + + /** Define the OriginDestinationSet structure. */ + typedef Structure<OriginDestinationSet> OriginDestinationSetStructure_T; + + /** Define the OriginDestinationSet holder. */ + typedef BomChildrenHolderImp<OriginDestinationSet> OriginDestinationSetHolder_T; + + /** Define the OriginDestinationSet list. */ + typedef BomList_T<OriginDestinationSet> OriginDestinationSetList_T; + + /** Define the OriginDestinationSet map. */ + typedef BomMap_T<OriginDestinationSet> OriginDestinationSetMap_T; + +} +#endif // __STDAIR_BOM_ORIGINDESTINATIONSETTYPES_HPP + Modified: trunk/stdair/stdair/bom/OutboundPath.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPath.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -108,11 +108,6 @@ } // //////////////////////////////////////////////////////////////////// - void OutboundPath::incrementTotalFlightTime (const Duration_T& iElapsed) { - _flightTime += iElapsed; - } - - // //////////////////////////////////////////////////////////////////// void OutboundPath::updateAirlineCode() { // TODO: to be optimised. std::ostringstream ostr; @@ -163,7 +158,8 @@ iOutboundPath.getFirstSegmentDate(); assert (lBoardingSegment_ptr != NULL); - return lOffSegment_ptr->isConnectable (*lBoardingSegment_ptr); + //return lOffSegment_ptr->isConnectable (*lBoardingSegment_ptr); + return true; } // //////////////////////////////////////////////////////////////////// @@ -245,9 +241,6 @@ // //////////////////////////////////////////////////////////////////// void OutboundPath:: updateAfterAddingSegmentDate (const SegmentDate& iSegmentDate) { - // Increment the total flight time of the outbound path - const Duration_T lElapsed = iSegmentDate.getElapsedTime(); - incrementTotalFlightTime (lElapsed); // Increment the flight path code std::ostringstream ostr; FlightPathCode_T lPreviousFPCode = getCurrentFlightPathCode(); Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -68,11 +68,6 @@ <br>Return a NULL pointer if the list is empty. */ const SegmentDate* getFirstSegmentDate () const; - private: - // ////////////// Business methods ////////////// - /** Increments the total flight time of the outbound path.*/ - void incrementTotalFlightTime (const Duration_T&); - public: /** Get the AirportDate corresponding to the destination of the outbound-path, i.e., the off point of the last segment-date Modified: trunk/stdair/stdair/bom/OutboundPathContent.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPathContent.cpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPathContent.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -12,8 +12,7 @@ // //////////////////////////////////////////////////////////////////// OutboundPathContent::OutboundPathContent (const Key_T& iKey) : _key (iKey), _airlineCode (DEFAULT_AIRLINE_CODE), - _flightPathCode (DEFAULT_FLIGHTPATH_CODE), - _flightTime (NULL_BOOST_TIME_DURATION) { + _flightPathCode (DEFAULT_FLIGHTPATH_CODE) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/OutboundPathContent.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPathContent.hpp 2010-06-27 14:27:11 UTC (rev 199) +++ trunk/stdair/stdair/bom/OutboundPathContent.hpp 2010-06-28 08:53:24 UTC (rev 200) @@ -38,11 +38,6 @@ return _flightPathCode; } - /** Get the total flight time. */ - const Duration_T& getTotalFlightTime () const { - return _flightTime; - } - /** Get the number of segments (part of the primary key). */ const NbOfSegments_T& getNbOfSegments() const { return _key.getNbOfSegments(); @@ -115,9 +110,6 @@ /** FlightPathCode (AirlineCode + flight numbers of all segments). */ FlightPathCode_T _flightPathCode; - - /** Total flight time (without stop time).*/ - Duration_T _flightTime; }; } Copied: trunk/stdair/stdair/bom/ReachableUniverse.cpp (from rev 195, trunk/stdair/stdair/bom/AirportDate.cpp) =================================================================== --- trunk/stdair/stdair/bom/ReachableUniverse.cpp (rev 0) +++ trunk/stdair/stdair/bom/ReachableUniverse.cpp 2010-06-28 08:53:24 UTC (rev 200) @@ -0,0 +1,98 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_Inventory.hpp> +#include <stdair/bom/BomSource.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + ReachableUniverse::ReachableUniverse (const Key_T& iKey, + Structure_T& ioAirportStructure) + : ReachableUniverseContent (iKey), _structure (ioAirportStructure) { + init (); + } + + // //////////////////////////////////////////////////////////////////// + ReachableUniverse::~ReachableUniverse () { + } + + // //////////////////////////////////////////////////////////////////// + void ReachableUniverse::init () { + _structure.initChildrenHolder<OriginDestinationSet>(); + } + + // //////////////////////////////////////////////////////////////////// + voi... [truncated message content] |
From: <den...@us...> - 2010-06-28 11:05:51
|
Revision: 205 http://stdair.svn.sourceforge.net/stdair/?rev=205&view=rev Author: denis_arnaud Date: 2010-06-28 11:05:45 +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/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 10:35:53 UTC (rev 204) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 11:05:45 UTC (rev 205) @@ -10,7 +10,7 @@ #include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> -#include <boost/fusion/sequence/intrinsic/at_key.hpp> +#include <boost/fusion/include/at_key.hpp> #endif // BOOST_VERSION >= 103500 // STDAIR #include <stdair/bom/BomStructure.hpp> Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 10:35:53 UTC (rev 204) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 11:05:45 UTC (rev 205) @@ -13,7 +13,7 @@ #if BOOST_VERSION >= 103500 #include <boost/fusion/container/map.hpp> #include <boost/fusion/include/map.hpp> -#include <boost/fusion/sequence/intrinsic/at_key.hpp> +#include <boost/fusion/include/at_key.hpp> #else // BOOST_VERSION >= 103500 #include <boost/mpl/map.hpp> #endif // BOOST_VERSION >= 103500 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-06-28 12:49:59
|
Revision: 207 http://stdair.svn.sourceforge.net/stdair/?rev=207&view=rev Author: denis_arnaud Date: 2010-06-28 12:49:47 +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/AirlineFeature.hpp trunk/stdair/stdair/bom/AirportDate.hpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/Bucket.hpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightPeriod.hpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/Network.hpp trunk/stdair/stdair/bom/NetworkDate.hpp trunk/stdair/stdair/bom/OriginDestinationSet.hpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/ReachableUniverse.hpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/YieldStore.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/AirlineFeature.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/AirlineFeature.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/AirportDate.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/AirportDate.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/Bucket.hpp =================================================================== --- trunk/stdair/stdair/bom/Bucket.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/Bucket.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/FlightPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/LegDate.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/Network.hpp =================================================================== --- trunk/stdair/stdair/bom/Network.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/Network.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/NetworkDate.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/NetworkDate.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/OriginDestinationSet.hpp =================================================================== --- trunk/stdair/stdair/bom/OriginDestinationSet.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/OriginDestinationSet.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/ReachableUniverse.hpp =================================================================== --- trunk/stdair/stdair/bom/ReachableUniverse.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/ReachableUniverse.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/SegmentDate.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/SegmentDate.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/bom/SegmentPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriod.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/SegmentPeriod.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -4,7 +4,14 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STDAIR +// Boost Fusion +#include <boost/version.hpp> +#if BOOST_VERSION >= 103500 +#include <boost/fusion/include/map.hpp> +#else // BOOST_VERSION >= 103500 +#include <boost/mpl/map.hpp> +#endif // BOOST_VERSION >= 103500 +// StdAir #include <stdair/bom/SegmentPeriodContent.hpp> #include <stdair/bom/SegmentPeriodTypes.hpp> @@ -35,7 +42,11 @@ typedef std::map<const MapKey_T, const Structure_T*> Map_T; /** Define the list of children holder types. */ +#if BOOST_VERSION >= 103500 typedef boost::fusion::map< > ChildrenHolderMap_T; +#else // BOOST_VERSION >= 103500 + typedef boost::mpl::map< > ChildrenHolderMap_T; +#endif // BOOST_VERSION >= 103500 // ////////////////////////////////////////////////////////////////// public: Modified: trunk/stdair/stdair/bom/Structure.hpp =================================================================== --- trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/Structure.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -9,7 +9,6 @@ // Boost Fusion #include <boost/version.hpp> #if BOOST_VERSION >= 103500 -//#include <boost/fusion/include/map.hpp> #include <boost/fusion/include/at_key.hpp> #endif // BOOST_VERSION >= 103500 // STDAIR Modified: trunk/stdair/stdair/bom/YieldStore.hpp =================================================================== --- trunk/stdair/stdair/bom/YieldStore.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/bom/YieldStore.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/map.hpp> #else // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -7,6 +7,7 @@ // STL #include <cassert> // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/at_key.hpp> #endif // BOOST_VERSION >= 103500 Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 11:19:12 UTC (rev 206) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-06-28 12:49:47 UTC (rev 207) @@ -8,11 +8,9 @@ #include <cassert> #include <string> #include <vector> -//#include <iostream> // Boost Fusion +#include <boost/version.hpp> #if BOOST_VERSION >= 103500 -//#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-06-30 15:59:25
|
Revision: 209 http://stdair.svn.sourceforge.net/stdair/?rev=209&view=rev Author: quannaus Date: 2010-06-30 15:59:19 +0000 (Wed, 30 Jun 2010) Log Message: ----------- [dev] Implemented the new network generator. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp trunk/stdair/stdair/bom/DoWStruct.cpp trunk/stdair/stdair/bom/DoWStruct.hpp trunk/stdair/stdair/bom/FlightPeriodContent.hpp trunk/stdair/stdair/bom/FlightPeriodKey.cpp trunk/stdair/stdair/bom/FlightPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp trunk/stdair/stdair/bom/SegmentPeriod.cpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/PeriodStruct.cpp trunk/stdair/stdair/bom/PeriodStruct.hpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -226,6 +226,9 @@ /** Default Minimum connection time. */ const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME (0, 30, 0); + /** Default maximum connection time. */ + const Duration_T DEFAULT_MAXIMUM_CONNECTION_TIME (24, 0, 0); + /** Default Matching Indicator value. */ const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR (0.0); Modified: trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -18,6 +18,9 @@ /** Default Minimum connection time. */ extern const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME; + + /** Default maximum connection time. */ + extern const Duration_T DEFAULT_MAXIMUM_CONNECTION_TIME; /** Null time duration (in boost::time_duration unit).*/ extern const Duration_T NULL_BOOST_TIME_DURATION; Modified: trunk/stdair/stdair/bom/DoWStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/DoWStruct.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -9,6 +9,13 @@ #include <stdair/bom/DoWStruct.hpp> namespace stdair { + + // //////////////////////////////////////////////////////////////////// + DoWStruct_T::DoWStruct_T () { + for (unsigned short i = 0; i < 7; ++i) { + _dowList.push_back (false); + } + } // //////////////////////////////////////////////////////////////////// DoWStruct_T::DoWStruct_T (const std::string& iDowString) { @@ -71,4 +78,49 @@ return _dowList.at (iStd); } + // //////////////////////////////////////////////////////////////////// + void DoWStruct_T::setDayOfWeek (const unsigned short i, const bool iBool) { + assert (i >= 0 && i < 7); + _dowList.at (i) = iBool; + } + + // //////////////////////////////////////////////////////////////////// + DoWStruct_T DoWStruct_T::shift (const long& iNbOfDays) const { + DoWStruct_T oDoW (DEFAULT_DOW_STRING); + + for (short i = 0; i < 7; ++i) { + const bool lDoWBool = _dowList.at (i); + short lIndex = (i + iNbOfDays) % 7; + if (lIndex < 0) { + lIndex += 7; + } + oDoW.setDayOfWeek (lIndex, lDoWBool); + } + + return oDoW; + } + + // //////////////////////////////////////////////////////////////////// + DoWStruct_T DoWStruct_T::intersection (const DoWStruct_T& iDoW) const { + DoWStruct_T oDoW (DEFAULT_DOW_STRING); + for (unsigned short i = 0; i < 7; ++i) { + if (getDayOfWeek(i) && iDoW.getDayOfWeek(i)) { + oDoW.setDayOfWeek (i, true); + } else { + oDoW.setDayOfWeek (i, false); + } + } + return oDoW; + } + + // //////////////////////////////////////////////////////////////////// + const bool DoWStruct_T::isValid () const { + for (unsigned short i = 0; i < 7; ++i) { + if (getDayOfWeek(i)) { + return true; + } + } + return false; + } + } Modified: trunk/stdair/stdair/bom/DoWStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/DoWStruct.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -19,16 +19,22 @@ public: /** Define the bit set representing the DoW. */ typedef std::vector<bool> BooleanList_T; - - /** Attributes. */ - BooleanList_T _dowList; + public: + // //////////////// Getters /////////////// /** 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; - + + public: + // //////////////// Setters /////////////// + /** Set the new value for the i-th day-of-week. */ + void setDayOfWeek (const unsigned short, const bool); + + public: + // //////////////// Display methods /////////////// /** Display explicitly (e.g., "Mon.Tue.Wed.Thu.Fri."). */ const std::string describe() const; @@ -36,15 +42,29 @@ const std::string describeShort() const; public: + // ///////////////// Business Methods //////////////// + /** Build a new DoW struct by shifting the current DoW by a given number. */ + DoWStruct_T shift (const long&) const; + + /** Build a new DoW struct by intersecting two DoW structs. */ + DoWStruct_T intersection (const DoWStruct_T&) const; + + /** Return if the DoW struct is valid (i.e., has at least one "true"). */ + const bool isValid () const; + + public: /** Constructor from a given bit set (e.g., "0000011" for the week-ends). */ DoWStruct_T (const std::string& iDowString); - - /** Default constructor. */ + /** Default constructors. */ DoWStruct_T (); - - /** Default constructor. */ DoWStruct_T (const DoWStruct_T&); + /** Default destructor. */ + ~DoWStruct_T () { } + + private: + /** Attributes. */ + BooleanList_T _dowList; }; } Modified: trunk/stdair/stdair/bom/FlightPeriodContent.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodContent.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/FlightPeriodContent.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -29,16 +29,11 @@ return _key.getFlightNumber(); } - /** Get the departure date range. */ - const DatePeriod_T& getDeparturePeriod () const { - return _key.getDeparturePeriod(); + /** Get the departure period (part of the key). */ + const PeriodStruct_T& getPeriod () const { + return _key.getPeriod(); } - /** Get the active days-of-week. */ - const DoWStruct_T& getDoW () const { - return _key.getDoW(); - } - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. Modified: trunk/stdair/stdair/bom/FlightPeriodKey.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/FlightPeriodKey.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -8,15 +8,13 @@ // //////////////////////////////////////////////////////////////////// FlightPeriodKey_T::FlightPeriodKey_T (const FlightNumber_T& iFlightNumber, - const DatePeriod_T& iDatePeriod, - const DoWStruct_T& iDoW) - : _flightNumber (iFlightNumber), _dateRange (iDatePeriod), _dow (iDoW) { + const PeriodStruct_T& iPeriod) + : _flightNumber (iFlightNumber), _period (iPeriod) { } // //////////////////////////////////////////////////////////////////// FlightPeriodKey_T::FlightPeriodKey_T (const FlightPeriodKey_T& iKey) - : _flightNumber (iKey._flightNumber), _dateRange (iKey._dateRange), - _dow (iKey._dow) { + : _flightNumber (iKey._flightNumber), _period (iKey._period) { } // //////////////////////////////////////////////////////////////////// @@ -35,8 +33,7 @@ // //////////////////////////////////////////////////////////////////// const std::string FlightPeriodKey_T::toString() const { std::ostringstream oStr; - oStr << _flightNumber << ", " << _dateRange << ", " - << _dow.describeShort(); + oStr << _flightNumber << ", " << _period.describeShort(); return oStr.str(); } Modified: trunk/stdair/stdair/bom/FlightPeriodKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriodKey.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/FlightPeriodKey.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -6,7 +6,7 @@ // ////////////////////////////////////////////////////////////////////// // STDAIR #include <stdair/bom/BomKey.hpp> -#include <stdair/bom/DoWStruct.hpp> +#include <stdair/bom/PeriodStruct.hpp> namespace stdair { /** Key of flight-period. */ @@ -18,8 +18,7 @@ public: // /////////// Construction /////////// /** Constructors. */ - FlightPeriodKey_T (const FlightNumber_T&, const DatePeriod_T&, - const DoWStruct_T&); + FlightPeriodKey_T (const FlightNumber_T&, const PeriodStruct_T&); FlightPeriodKey_T (const FlightPeriodKey_T&); /** Destructor. */ ~FlightPeriodKey_T (); @@ -30,14 +29,9 @@ return _flightNumber; } - /** Get the departure date range. */ - const DatePeriod_T& getDeparturePeriod () const { - return _dateRange; - } - /** Get the active days-of-week. */ - const DoWStruct_T& getDoW () const { - return _dow; + const PeriodStruct_T& getPeriod () const { + return _period; } // /////////// Display support methods ///////// @@ -61,11 +55,8 @@ /** Flight number. */ FlightNumber_T _flightNumber; - /** Departure period of the (first leg of the) flight. */ - DatePeriod_T _dateRange; - - /** DoW during the departure period. */ - DoWStruct_T _dow; + /** Period during the departure period. */ + PeriodStruct_T _period; }; Added: trunk/stdair/stdair/bom/PeriodStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/PeriodStruct.cpp (rev 0) +++ trunk/stdair/stdair/bom/PeriodStruct.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -0,0 +1,78 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <sstream> +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_Period_BOM.hpp> +#include <stdair/bom/PeriodStruct.hpp> + +namespace stdair { + // //////////////////////////////////////////////////////////////////// + PeriodStruct_T::PeriodStruct_T () + : _dateRange (BOOST_DEFAULT_DATE_PERIOD), _dow () { + } + + // //////////////////////////////////////////////////////////////////// + PeriodStruct_T::PeriodStruct_T (const DatePeriod_T& iDateRange, + const DoWStruct_T& iDoW) + : _dateRange (iDateRange), _dow (iDoW) { + } + + // //////////////////////////////////////////////////////////////////// + PeriodStruct_T::PeriodStruct_T (const PeriodStruct_T& iPeriodStruct) + : _dateRange (iPeriodStruct._dateRange), _dow (iPeriodStruct._dow) { + + } + + // //////////////////////////////////////////////////////////////////// + const std::string PeriodStruct_T::describeShort() const { + std::ostringstream ostr; + ostr << _dateRange << ", " << _dow.describeShort (); + return ostr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string PeriodStruct_T::describe() const { + std::ostringstream ostr; + ostr << _dateRange << ", " << _dow.describe (); + return ostr.str(); + } + + // //////////////////////////////////////////////////////////////////// + PeriodStruct_T PeriodStruct_T:: + addDateOffset (const DateOffset_T& iDateOffset) const { + // Create a new date range by shifting the date range of this object with + // iDateOffset. + DatePeriod_T lNewDateRange = getDateRange(); + lNewDateRange.shift (iDateOffset); + + // Create a new DoWStruct by shifting the DoWStruct of this object with + // iDateOffset. + const long lNbOfDaysOffset = iDateOffset.days(); + const DoWStruct_T& lDoW = getDoW(); + const DoWStruct_T lNewDoW = lDoW.shift (lNbOfDaysOffset); + + return PeriodStruct_T (lNewDateRange, lNewDoW); + } + + // //////////////////////////////////////////////////////////////////// + PeriodStruct_T PeriodStruct_T:: + intersection (const PeriodStruct_T& iPeriodStruct) const { + const DatePeriod_T lNewDateRange = + _dateRange.intersection (iPeriodStruct._dateRange); + const DoWStruct_T lNewDoW = _dow.intersection (iPeriodStruct._dow); + + return PeriodStruct_T (lNewDateRange, lNewDoW); + } + + // //////////////////////////////////////////////////////////////////// + const bool PeriodStruct_T::isValid () const { + if (_dateRange.is_null() == false && _dow.isValid()) { + return true; + } + return false; + } + +} Added: trunk/stdair/stdair/bom/PeriodStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/PeriodStruct.hpp (rev 0) +++ trunk/stdair/stdair/bom/PeriodStruct.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -0,0 +1,72 @@ +#ifndef __STDAIR_BOM_PERIODSTRUCT_HPP +#define __STDAIR_BOM_PERIODSTRUCT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <vector> +// STDAIR +#include <stdair/basic/StructAbstract.hpp> +#include <stdair/bom/DoWStruct.hpp> + +namespace stdair { + + /** Define a departure period + <br> A period is defined by a date range and a day-of-week struct. */ + struct PeriodStruct_T : public StructAbstract { + public: + // ////////// Getters ///////////// + /** Retrieve the attributes. */ + const DatePeriod_T& getDateRange () const { + return _dateRange; + } + const DoWStruct_T& getDoW () const { + return _dow; + } + + public: + // /////////// Setters //////////// + /** Set the new value for the attributes. */ + void setDateRange (const DatePeriod_T& iDateRange) { + _dateRange = iDateRange; + } + void setDoW (const DoWStruct_T& iDoW) { _dow = iDoW; } + + public: + /** 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: + // /////////// Business Methods ///////////// + /** Build a period struct from this period struct by adding a date offset. */ + PeriodStruct_T addDateOffset (const DateOffset_T&) const; + + /** Build a new period struct which is the intersection of two + period structs. */ + PeriodStruct_T intersection (const PeriodStruct_T&) const; + + /** Return if the period is valid (i.e., valid date range and valid DoW). */ + const bool isValid () const; + + public: + /** Constructor. */ + PeriodStruct_T (const DatePeriod_T&, const DoWStruct_T&); + /** Default constructors. */ + PeriodStruct_T (); + PeriodStruct_T (const PeriodStruct_T&); + /** Default destructor. */ + ~PeriodStruct_T () { } + + private: + // Attributes + DatePeriod_T _dateRange; + DoWStruct_T _dow; + }; + +} +#endif // __STDAIR_BOM_PERIODSTRUCT_HPP Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -4,6 +4,7 @@ // STL #include <cassert> // STDAIR +#include <stdair/basic/BasConst_TravelSolution.hpp> #include <stdair/bom/BomSource.hpp> namespace stdair { @@ -112,91 +113,143 @@ assert (lLastSegment_ptr != NULL); return lLastSegment_ptr->getOffPoint(); } - - // //////////////////////////////////////////////////////////////////// - void SegmentPathPeriod::updateAirlineCode() { - // TODO: to be optimised. - // std::ostringstream ostr; - // SegmentPeriodList_T lSegmentPeriodList = getSegmentPeriodList(); - - // for (SegmentPeriodList_T::iterator itSegmentPeriod = - // lSegmentPeriodList.begin(); - // itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) { - // const SegmentPeriod& lSegmentPeriod = *itSegmentPeriod; - // ostr << lSegmentPeriod.getAirlineCode(); - // } - - // const AirlineCode_T lAirlineCode (ostr.str()); - // setAirlineCode(lAirlineCode); - } // //////////////////////////////////////////////////////////////////// bool SegmentPathPeriod:: isAirlineFlown (const AirlineCode_T& iAirlineCode) const { bool oAirlineFlown = false; - // const SegmentPeriodList_T& lSegmentPeriodList = getSegmentPeriodList (); - // for (SegmentPeriodList_T::iterator itSegmentPeriod = - // lSegmentPeriodList.begin(); - // itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) { - // const SegmentPeriod& lSegmentPeriod = *itSegmentPeriod; + const SegmentPeriodList_T& lSegmentPeriodList = getSegmentPeriodList (); + for (SegmentPeriodList_T::iterator itSegmentPeriod = + lSegmentPeriodList.begin(); + itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) { + const SegmentPeriod& lSegmentPeriod = *itSegmentPeriod; - // const AirlineCode_T& lSegmentAirlineCode = - // lSegmentPeriod.getAirlineCode(); - // if (lSegmentAirlineCode == iAirlineCode) { - // oAirlineFlown = true; - // break; - // } - // } + const AirlineCode_T& lSegmentAirlineCode = + lSegmentPeriod.getParent().getParent().getAirlineCode(); + if (lSegmentAirlineCode == iAirlineCode) { + oAirlineFlown = true; + break; + } + } return oAirlineFlown; } // //////////////////////////////////////////////////////////////////// - void SegmentPathPeriod:: - updateAfterAddingSegmentPeriod (const SegmentPeriod& iSegmentPeriod) { - // Increment the flight path code - // std::ostringstream ostr; - // FlightPathCode_T lPreviousFPCode = getCurrentFlightPathCode(); - // ostr << lPreviousFPCode - // << iSegmentPeriod.getFlightNumber(); - // setFlightPathCode(ostr.str()); - } - - // //////////////////////////////////////////////////////////////////// - const SegmentPathPeriodKey_T SegmentPathPeriod:: + SegmentPathPeriodKey_T SegmentPathPeriod:: connectWithAnotherSegment(const SegmentPathPeriod& iSingleSegmentPath) const { SegmentPathPeriodKey_T oSegmentPathPeriodKey; // Retrieve the (only) segment period of the single segment path. - const SegmentPeriod* lSegmentPeriod_ptr = getFirstSegmentPeriod (); - assert (lSegmentPeriod_ptr != NULL); + const SegmentPeriod* lNextSegmentPeriod_ptr = + iSingleSegmentPath.getFirstSegmentPeriod (); + assert (lNextSegmentPeriod_ptr != NULL); + // Retrive the last segment period of the current segment path and check + // if the combination of the last segment and the next segment that we + // want to add to the current segment path will create a new segment + // (i.e., the two segment period belongs to the same flight number). + const SegmentPeriod* lLastSegmentPeriod_ptr = getLastSegmentPeriod (); + assert (lLastSegmentPeriod_ptr != NULL); + const FlightPeriod& lLastFlightPeriod = lLastSegmentPeriod_ptr->getParent(); + const FlightPeriod& lNextFlightPeriod = lNextSegmentPeriod_ptr->getParent(); + if (lLastFlightPeriod.getFlightNumber()==lNextFlightPeriod.getFlightNumber() + && lLastFlightPeriod.getParent().getAirlineCode() == + lNextFlightPeriod.getParent().getAirlineCode()) { + return oSegmentPathPeriodKey; + } + // Check if the new segment period will create a circle. - const AirportCode_T& lDestination = lSegmentPeriod_ptr->getOffPoint(); + const AirportCode_T& lDestination = lNextSegmentPeriod_ptr->getOffPoint(); if (checkCircle (lDestination) == true) { return oSegmentPathPeriodKey; } - - return oSegmentPathPeriodKey; - } + // Check if a passenger can connect from the last segment of the + // current segment path to the first segment of the to-be-added + // segment path. If yes, build a new departure period for the new + // segment path. + DateOffsetList_T lBoardingDateOffsetList = + getBoardingDateOffsetList(); + const PeriodStruct_T& lCurrentDeparturePeriod = getDeparturePeriod(); + const PeriodStruct_T& lNextDeparturePeriod = + iSingleSegmentPath.getDeparturePeriod(); + const Duration_T& lLastOffTime = lLastSegmentPeriod_ptr->getOffTime(); + const Duration_T& lNextBoardingTime = + lNextSegmentPeriod_ptr->getBoardingTime(); + // If the next boarding time is later than the last off time, check if + // the passengers will have enough time for the transfer. If the next + // boarding time is earlier than the last off time, check if the passengers + // can connect to a flight in the next day. + if (lNextBoardingTime >= lLastOffTime) { + const Duration_T lStopTime = lNextBoardingTime - lLastOffTime; + if (lStopTime < DEFAULT_MINIMUM_CONNECTION_TIME) { + return oSegmentPathPeriodKey; + } else { + // Calulcate the date offset of the next segment compare to + // the first one. In this case, this value is equal to the offset + // of the off date of the last segment compare to the boarding date + // of the first segment. + const DateOffset_T& lLastBoardingDateOffset = + lBoardingDateOffsetList.at (getNbOfSegments() - 1); + const DateOffset_T lNextBoardingDateOffset = + lLastBoardingDateOffset + lNextSegmentPeriod_ptr->getOffDateOffset() + - lNextSegmentPeriod_ptr->getBoardingDateOffset(); + const DateOffset_T lNegativeNextBoardingDateOffset = + DateOffset_T (0) - lNextBoardingDateOffset; - // //////////////////////////////////////////////////////////////////// - bool SegmentPathPeriod:: - isConnectable (const SegmentPathPeriod& iSegmentPathPeriod) const { - // Delegate the check on the two (potentially) connecting SegmentPeriod - // objects, i.e., the last SegmentPeriod of the current SegmentPathPeriod, - // and the first SegmentPeriod of the given SegmentPathPeriod. - const SegmentPeriod* lOffSegment_ptr = getLastSegmentPeriod(); - assert (lOffSegment_ptr != NULL); + // Compute the adjusted departure period of the next segment by + // substracting the origin one with the boarding date offset. + const PeriodStruct_T lAdjustedNextDeparturePeriod = + lNextDeparturePeriod.addDateOffset (lNegativeNextBoardingDateOffset); - const SegmentPeriod* lBoardingSegment_ptr = - iSegmentPathPeriod.getFirstSegmentPeriod(); - assert (lBoardingSegment_ptr != NULL); - - return lOffSegment_ptr->isConnectable (*lBoardingSegment_ptr); - // TODO + // Build the intersection of the two periods. + const PeriodStruct_T lNewDeparturePeriod = + lCurrentDeparturePeriod.intersection (lAdjustedNextDeparturePeriod); + Duration_T lNewElapsed = getElapsedTime() + lStopTime + + lNextSegmentPeriod_ptr->getElapsedTime(); + lBoardingDateOffsetList.push_back (lNextBoardingDateOffset); + oSegmentPathPeriodKey.setPeriod (lNewDeparturePeriod); + oSegmentPathPeriodKey.setElapsedTime (lNewElapsed); + } + } else { + const Duration_T lStopTime = + lNextBoardingTime - lLastOffTime + Duration_T (24, 0, 0); + if (lStopTime < DEFAULT_MINIMUM_CONNECTION_TIME) { + return oSegmentPathPeriodKey; + } else { + // Calulcate the date offset of the next segment compare to + // the first one. + const DateOffset_T& lLastBoardingDateOffset = + lBoardingDateOffsetList.at (getNbOfSegments() - 1); + const DateOffset_T lNextBoardingDateOffset = + lLastBoardingDateOffset + lNextSegmentPeriod_ptr->getOffDateOffset() + - lNextSegmentPeriod_ptr->getBoardingDateOffset() + DateOffset_T (1); + const DateOffset_T lNegativeNextBoardingDateOffset = + DateOffset_T (0) - lNextBoardingDateOffset; + + // Compute the adjusted departure period of the next segment by + // substracting the origin one with the boarding date offset. + const PeriodStruct_T lAdjustedNextDeparturePeriod = + lNextDeparturePeriod.addDateOffset (lNegativeNextBoardingDateOffset); + + // Build the intersection of the two periods. + const PeriodStruct_T lNewDeparturePeriod = + lCurrentDeparturePeriod.intersection (lAdjustedNextDeparturePeriod); + Duration_T lNewElapsed = getElapsedTime() + lStopTime + + lNextSegmentPeriod_ptr->getElapsedTime(); + lBoardingDateOffsetList.push_back (lNextBoardingDateOffset); + oSegmentPathPeriodKey.setPeriod (lNewDeparturePeriod); + oSegmentPathPeriodKey.setElapsedTime (lNewElapsed); + } + } + + const Duration_T& lBoardingTime = getBoardingTime(); + oSegmentPathPeriodKey.setBoardingTime (lBoardingTime); + oSegmentPathPeriodKey.setBoardingDateOffsetList (lBoardingDateOffsetList); + + return oSegmentPathPeriodKey; } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -86,17 +86,7 @@ 2. There is no circle within the new segment path. 3. The intersection of the two periods is non-empty. */ - const SegmentPathPeriodKey_T connectWithAnotherSegment (const SegmentPathPeriod&) const; - - /** States whether or not the given SegmentPathPeriod may connect with the - current one. - <br>Basically, the board time of the given SegmentPathPeriod should be - such as to allow the passenger connecting from the previous flight - (current SegmentPathPeriod object) to the next one - (given SegmentPathPeriod). - <br>Note that this method relies on the eponym method of the - SegmentPeriod class. */ - bool isConnectable (const SegmentPathPeriod&) const; + SegmentPathPeriodKey_T connectWithAnotherSegment (const SegmentPathPeriod&) const; /** Check if the given destination airport the departure point of one of the segment member. If yes, a circle exists. */ @@ -105,14 +95,7 @@ /** State whether or not the given airline is flown by (at least) one of the segments of the internal list. */ bool isAirlineFlown (const AirlineCode_T&) const; - - /** Update Airline Code. */ - void updateAirlineCode (); - /** Update the total flight time and the flight path code after - adding a segment-date. */ - void updateAfterAddingSegmentPeriod (const SegmentPeriod&); - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. Modified: trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -11,8 +11,7 @@ // //////////////////////////////////////////////////////////////////// SegmentPathPeriodContent::SegmentPathPeriodContent (const Key_T& iKey) - : _key (iKey), _airlineCode (DEFAULT_AIRLINE_CODE), - _flightPathCode (DEFAULT_FLIGHTPATH_CODE) { + : _key (iKey) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -23,26 +23,17 @@ const Key_T& getKey() const { return _key; } - /** Get the airline code (from the whole outbound path). */ - const AirlineCode_T& getAirlineCode() const { - return _airlineCode; - } - /** Get the flightPathCode (from the whole outbound path). */ - const FlightPathCode_T& getFlightPathCode() const { - return _flightPathCode; - } - - /** Get the current flightPathCode (from the whole outbound path). */ - FlightPathCode_T getCurrentFlightPathCode() { - return _flightPathCode; - } - /** Get the number of segments (part of the primary key). */ - const NbOfSegments_T& getNbOfSegments() const { + const NbOfSegments_T getNbOfSegments() const { return _key.getNbOfSegments(); } + /** Get the boarding date offset list. */ + const DateOffsetList_T& getBoardingDateOffsetList () const { + return _key.getBoardingDateOffsetList(); + } + /** Get the elapsed time (part of the primary key). */ const Duration_T& getElapsedTime() const { return _key.getElapsedTime(); @@ -57,19 +48,12 @@ const Duration_T& getBoardingTime() const { return _key.getBoardingTime(); } - - public: - // /////////// Setters //////////// - /** Set Airline Code. */ - void setAirlineCode (const AirlineCode_T& iAirlineCode) { - _airlineCode = iAirlineCode; + + /** Get the departure period. */ + const PeriodStruct_T& getDeparturePeriod () const { + return _key.getPeriod(); } - /** Set the flight path Code. */ - void setFlightPathCode (const FlightPathCode_T& iFPCode) { - _flightPathCode = iFPCode; - } - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -99,12 +83,6 @@ // Attributes /** The key of both structure and content objects. */ Key_T _key; - - /** AirlineCode for the whole outboundPath.*/ - AirlineCode_T _airlineCode; - - /** FlightPathCode (AirlineCode + flight numbers of all segments). */ - FlightPathCode_T _flightPathCode; }; } Modified: trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -10,27 +10,23 @@ // //////////////////////////////////////////////////////////////////// SegmentPathPeriodKey_T::SegmentPathPeriodKey_T () - : _dateRange (BOOST_DEFAULT_DATE_PERIOD), - _dow (DEFAULT_DOW_STRING), + : _period (), _boardingTime (NULL_BOOST_TIME_DURATION), _elapsed (NULL_BOOST_TIME_DURATION), - _nbOfSegments (0), _nbOfAirlines (0){ } // //////////////////////////////////////////////////////////////////// SegmentPathPeriodKey_T:: - SegmentPathPeriodKey_T (const DatePeriod_T& iDeparturePeriod, - const DoWStruct_T& iDoW, + SegmentPathPeriodKey_T (const PeriodStruct_T& iPeriod, const Duration_T& iBoardingTime, const Duration_T& iElapsedTime, - const NbOfSegments_T& iNbOfSegments, + const DateOffsetList_T& iBoardingDateOffsetList, const NbOfAirlines_T& iNbOfAirlines) - : _dateRange (iDeparturePeriod), - _dow (iDoW), + : _period (iPeriod), _boardingTime (iBoardingTime), _elapsed (iElapsedTime), - _nbOfSegments (iNbOfSegments), + _boardingDateOffsetList (iBoardingDateOffsetList), _nbOfAirlines (iNbOfAirlines){ } @@ -50,9 +46,15 @@ // //////////////////////////////////////////////////////////////////// const std::string SegmentPathPeriodKey_T::toString() const { std::ostringstream oStr; - oStr << _dateRange << ", " << _dow.describeShort () << ", " - << _boardingTime << ", " << _elapsed << ", " - << _nbOfSegments << ", " << _nbOfAirlines ; + oStr << _period.describeShort () << ", " + << _boardingTime << ", " << _elapsed << ", "; + for (DateOffsetList_T::const_iterator itOffset = + _boardingDateOffsetList.begin(); + itOffset != _boardingDateOffsetList.end(); ++itOffset) { + oStr << *itOffset << ", "; + } + + oStr << _nbOfAirlines ; return oStr.str(); } Modified: trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -7,7 +7,8 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomKey.hpp> -#include <stdair/bom/DoWStruct.hpp> +#include <stdair/bom/PeriodStruct.hpp> +#include <stdair/bom/SegmentPathPeriodTypes.hpp> namespace stdair { /** Key of SegmentPathPeriod. */ @@ -17,27 +18,26 @@ // /////////// Construction /////////// /** Constructors. */ SegmentPathPeriodKey_T (); - SegmentPathPeriodKey_T (const DatePeriod_T&, const DoWStruct_T&, + SegmentPathPeriodKey_T (const PeriodStruct_T&, const Duration_T&, const Duration_T&, - const NbOfSegments_T&, const NbOfAirlines_T&); + const DateOffsetList_T&, const NbOfAirlines_T&); /** Destructor. */ ~SegmentPathPeriodKey_T (); // /////////// Getters ////////// - /** Get the departure period. */ - const DatePeriod_T& getDeparturePeriod () const { - return _dateRange; + /** Get the active days-of-week. */ + const PeriodStruct_T& getPeriod () const { + return _period; } - /** Get the active days-of-week. */ - const DoWStruct_T& getDoW () const { - return _dow; + const DateOffsetList_T& getBoardingDateOffsetList () const { + return _boardingDateOffsetList; } /** Get the number of segments. */ - const NbOfSegments_T& getNbOfSegments() const { - return _nbOfSegments; + const NbOfSegments_T getNbOfSegments() const { + return _boardingDateOffsetList.size(); } /** Get the number of airlines. */ @@ -54,7 +54,32 @@ const Duration_T& getBoardingTime () const { return _boardingTime; } + + // /////////// Setters ////////// + /** Set the active days-of-week. */ + void setPeriod (const PeriodStruct_T& iPeriod) { + _period = iPeriod; + } + + void setBoardingDateOffsetList (const DateOffsetList_T& iList) { + _boardingDateOffsetList = iList; + } + /** Set the number of airlines. */ + void setNbOfAirlines (const NbOfAirlines_T& iNbOfAirlines) { + _nbOfAirlines = iNbOfAirlines; + } + + /** Set the elapsed time. */ + void setElapsedTime (const Duration_T& iElapsed) { + _elapsed = iElapsed; + } + + /** Set the boarding time. */ + void setBoardingTime (const Duration_T& iBoardingTime) { + _boardingTime = iBoardingTime; + } + // /////////// Display support methods ///////// /** Dump a Business Object Key into an output stream. @param ostream& the output stream. */ @@ -70,14 +95,17 @@ <br>For instance, "H" and "K" allow to differentiate among two marketing classes for the same segment-cabin. */ const std::string toString() const; + + // /////////// Business methods //////////// + /** Check if the key is valid (i.e. the departure period is valid). */ + const bool isValid () const { + return _period.isValid (); + } private: // Attributes /** Departure peiod. */ - DatePeriod_T _dateRange; - - /** Active days-of-week. */ - DoWStruct_T _dow; + PeriodStruct_T _period; /** The boarding time. */ Duration_T _boardingTime; @@ -85,8 +113,9 @@ /** The elapsed time of the path. */ Duration_T _elapsed; - /** Number of segments included in the path. */ - NbOfSegments_T _nbOfSegments; + /** The list of boarding date offsets of the segments compare to + the first one. */ + DateOffsetList_T _boardingDateOffsetList; /** Number of airlines included in the path. */ NbOfAirlines_T _nbOfAirlines; Modified: trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -8,6 +8,8 @@ // STL #include <map> #include <vector> +// STDAIR +#include <stdair/STDAIR_Types.hpp> namespace stdair { @@ -32,6 +34,10 @@ typedef std::vector<const SegmentPathPeriod*> SegmentPathPeriodLightList_T; typedef std::vector<SegmentPathPeriodLightList_T>SegmentPathPeriodListList_T; + + /** Define the vector of boarding date offsets of the member segments of + a segment path compare to the boarding date of the first segment. */ + typedef std::vector <DateOffset_T> DateOffsetList_T; } #endif // __STDAIR_BOM_SEGMENTPATHPERIODTYPES_HPP Modified: trunk/stdair/stdair/bom/SegmentPeriod.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriod.cpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPeriod.cpp 2010-06-30 15:59:19 UTC (rev 209) @@ -50,14 +50,6 @@ oStr << _structure.describeParentKey() << ", " << describeShortKey(); return oStr.str(); } - - // //////////////////////////////////////////////////////////////////// - bool SegmentPeriod:: - isConnectable (const SegmentPeriod& iSegmentPeriod) const { - bool oIsConnectable = false; - - return oIsConnectable; - } // //////////////////////////////////////////////////////////////////// const SegmentPeriod::Parent_T& SegmentPeriod::getParent () const { @@ -65,14 +57,9 @@ } // //////////////////////////////////////////////////////////////////// - const DatePeriod_T& SegmentPeriod::getDeparturePeriod () const { - return getParent().getDeparturePeriod(); + const PeriodStruct_T& SegmentPeriod::getPeriod () const { + return getParent().getPeriod(); } - - // //////////////////////////////////////////////////////////////////// - const DoWStruct_T& SegmentPeriod::getDoW () const { - return getParent().getDoW(); - } } Modified: trunk/stdair/stdair/bom/SegmentPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriod.hpp 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/SegmentPeriod.hpp 2010-06-30 15:59:19 UTC (rev 209) @@ -54,23 +54,10 @@ /** Get the parent object. */ const Parent_T& getParent () const; - /** Get the departure date range. */ - const DatePeriod_T& getDeparturePeriod () const; + /** Get the departure period of the flight-date parent. */ + const PeriodStruct_T& getPeriod () const; - /** Get the active days-of-week. */ - const DoWStruct_T& getDoW () const; - public: - // /////////// Business Methods ////////////// - /** States whether or not the given SegmentPeriod may connect with the - current one. - <br>Basically, the board time of the given SegmentPeriod should be - such as to allow the passenger connecting from the previous flight - (current SegmentPeriod object) to the next one (given SegmentPeriod). */ - bool isConnectable (const SegmentPeriod&) const; - - - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-06-28 15:24:10 UTC (rev 208) +++ trunk/stdair/stdair/bom/sources.mk 2010-06-30 15:59:19 UTC (rev 209) @@ -100,6 +100,7 @@ $(top_srcdir)/stdair/bom/YieldStore.hpp \ $(top_srcdir)/stdair/bom/OptimizerStruct.hpp \ $(top_srcdir)/stdair/bom/DoWStruct.hpp \ + $(top_srcdir)/stdair/bom/PeriodStruct.hpp \ $(top_srcdir)/stdair/bom/TravelSolutionStruct.hpp \ $(top_srcdir)/stdair/bom/BookingRequestStruct.hpp \ $(top_srcdir)/stdair/bom/AirlineStruct.hpp \ @@ -172,6 +173,7 @@ $(top_srcdir)/stdair/bom/YieldStore.cpp \ $(top_srcdir)/stdair/bom/OptimizerStruct.cpp \ $(top_srcdir)/stdair/bom/DoWStruct.cpp \ + $(top_srcdir)/stdair/bom/PeriodStruct.cpp \ $(top_srcdir)/stdair/bom/TravelSolutionStruct.cpp \ $(top_srcdir)/stdair/bom/BookingRequestStruct.cpp \ $(top_srcdir)/stdair/bom/AirlineStruct.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-07-07 14:07:49
|
Revision: 210 http://stdair.svn.sourceforge.net/stdair/?rev=210&view=rev Author: quannaus Date: 2010-07-07 14:07:43 +0000 (Wed, 07 Jul 2010) Log Message: ----------- [dev] Added functions for getting travel solution list. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPeriodContent.hpp trunk/stdair/stdair/bom/TravelSolutionStruct.cpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -467,6 +467,13 @@ /** Key of a STL map. */ typedef std::string MapKey_T; + + /** List of keys. */ + typedef std::vector<std::string> KeyList_T; + + /** Map between the cabin codes and the booking class codes within + each cabin. */ + typedef std::map<CabinCode_T, ClassList_String_T> CabinBookingClassMap_T; } #endif // __STDAIR_STDAIR_TYPES_HPP Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-07-07 14:07:43 UTC (rev 210) @@ -492,5 +492,97 @@ oStream << dInt; } } + + // //////////////////////////////////////////////////////////////////// + void BomManager::displaySegmentPathNetwork (std::ostream& oStream, + const BomRoot& iBomRoot) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + oStream << std::endl; + + // Browse the reachable universe objects. + const ReachableUniverseList_T& lRUList = iBomRoot.getReachableUniverseList(); + for (ReachableUniverseList_T::iterator itRU = lRUList.begin(); + itRU != lRUList.end(); ++itRU) { + const ReachableUniverse& lCurrentRU = *itRU; + + display (oStream, lCurrentRU); + } + + // Reset formatting flags of the given output stream + oStream.flags (oldFlags); + } + + // //////////////////////////////////////////////////////////////////// + void BomManager::display (std::ostream& oStream, + const ReachableUniverse& iReachableUniverse) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + oStream << std::endl << "Reachable Universe level: " + << iReachableUniverse.describeShortKey() << std::endl; + + // Browse the origin-destination set objects. + const OriginDestinationSetList_T& lODSetList = + iReachableUniverse.getOriginDestinationSetList (); + for (OriginDestinationSetList_T::iterator itODS = lODSetList.begin(); + itODS != lODSetList.end(); ++itODS) { + const OriginDestinationSet& lCurrentODS = *itODS; + + display (oStream, lCurrentODS); + } + + // Reset formatting flags of the given output stream + oStream.flags (oldFlags); + } + + // //////////////////////////////////////////////////////////////////// + void BomManager::display (std::ostream& oStream, + const OriginDestinationSet& iOriginDestinationSet) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + oStream << "Origine-Destination Set level: " + << iOriginDestinationSet.describeShortKey () << std::endl; + + // Browse the segment path period objects. + const SegmentPathPeriodList_T& lSegmentPathPeriodList = + iOriginDestinationSet.getSegmentPathPeriodList (); + for (SegmentPathPeriodList_T::iterator itSegmentPath = + lSegmentPathPeriodList.begin(); + itSegmentPath != lSegmentPathPeriodList.end(); ++itSegmentPath) { + const SegmentPathPeriod& lCurrentSegmentPath = *itSegmentPath; + + display (oStream, lCurrentSegmentPath); + } + + // Reset formatting flags of the given output stream + oStream.flags (oldFlags); + } + + // //////////////////////////////////////////////////////////////////// + void BomManager::display (std::ostream& oStream, + const SegmentPathPeriod& iSegmentPathPeriod) { + // Store current formatting flags of the given output stream + std::ios::fmtflags oldFlags = oStream.flags(); + + oStream << "Segment Path Period level: " + << iSegmentPathPeriod.describeShortKey () << std::endl; + + // Browse the segment period objects. + const SegmentPeriodList_T& lSegmentPeriodList = + iSegmentPathPeriod.getSegmentPeriodList(); + for (SegmentPeriodList_T::iterator itSegmentPeriod = + lSegmentPeriodList.begin(); + itSegmentPeriod != lSegmentPeriodList.end(); ++itSegmentPeriod) { + const SegmentPeriod& lCurrentSegmentPeriod = *itSegmentPeriod; + oStream << "Segment Period details: " + << lCurrentSegmentPeriod.describeKey() << std::endl; + } + + // 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-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -18,6 +18,11 @@ class SegmentDate; class SegmentCabin; class BookingClass; + class ReachableUniverse; + class OriginDestinationSet; + class SegmentPathPeriod; + class FlightPeriod; + class SegmentPeriod; class Network; class NetworkDate; class AirportDate; @@ -128,6 +133,25 @@ const BookingRequestStruct& iBookingRequest); /** Helper fuction to display an interger. */ static void intDisplay (std::ostream&, const int&); + + /** 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 displaySegmentPathNetwork (std::ostream&, const BomRoot&); + + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. */ + static void display (std::ostream&, const ReachableUniverse&); + + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. */ + static void display (std::ostream&, const OriginDestinationSet&); + + /** Recursively display (dump in the underlying output log stream) + the objects of the given BOM tree. */ + static void display (std::ostream&, const SegmentPathPeriod&); }; } Modified: trunk/stdair/stdair/bom/BookingClassTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClassTypes.hpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/BookingClassTypes.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -28,11 +28,7 @@ typedef BomList_T<BookingClass> BookingClassList_T; /** Define the booking class map. */ - typedef BomMap_T<BookingClass> BookingClassMap_T; - - /** Define the STL list of booking classes. */ - typedef std::vector<BookingClass*> BookingClassSTLList_T; - + typedef BomMap_T<BookingClass> BookingClassMap_T; } #endif // __STDAIR_BOM_BOOKINGCLASSTYPES_HPP Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-07-07 14:07:43 UTC (rev 210) @@ -194,8 +194,8 @@ const DateOffset_T& lLastBoardingDateOffset = lBoardingDateOffsetList.at (getNbOfSegments() - 1); const DateOffset_T lNextBoardingDateOffset = - lLastBoardingDateOffset + lNextSegmentPeriod_ptr->getOffDateOffset() - - lNextSegmentPeriod_ptr->getBoardingDateOffset(); + lLastBoardingDateOffset + lLastSegmentPeriod_ptr->getOffDateOffset() + - lLastSegmentPeriod_ptr->getBoardingDateOffset(); const DateOffset_T lNegativeNextBoardingDateOffset = DateOffset_T (0) - lNextBoardingDateOffset; @@ -224,8 +224,8 @@ const DateOffset_T& lLastBoardingDateOffset = lBoardingDateOffsetList.at (getNbOfSegments() - 1); const DateOffset_T lNextBoardingDateOffset = - lLastBoardingDateOffset + lNextSegmentPeriod_ptr->getOffDateOffset() - - lNextSegmentPeriod_ptr->getBoardingDateOffset() + DateOffset_T (1); + lLastBoardingDateOffset + lLastSegmentPeriod_ptr->getOffDateOffset() + - lLastSegmentPeriod_ptr->getBoardingDateOffset() + DateOffset_T (1); const DateOffset_T lNegativeNextBoardingDateOffset = DateOffset_T (0) - lNextBoardingDateOffset; @@ -267,6 +267,28 @@ } return false; } + + // //////////////////////////////////////////////////////////////////// + bool SegmentPathPeriod:: + isDepartureDateValid (const Date_T& iDepartureDate) const { + const PeriodStruct_T& lPeriod = getDeparturePeriod (); + + // Check if the departure date is within the date range. + const DatePeriod_T& lDeparturePeriod = lPeriod.getDateRange (); + if (lDeparturePeriod.contains (iDepartureDate) == false) { + return false; + } + + // Check if the departure date is valid within the DOW. + // 0 = Sunday, 1 = Monday, etc. + const short lDay = iDepartureDate.day_of_week (); + const DoWStruct_T& lDoW = lPeriod.getDoW (); + if (lDoW.getStandardDayOfWeek (lDay) == false) { + return false; + } + + return true; + } } Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -73,7 +73,25 @@ of the last segment. */ const AirportCode_T& getDestination () const; + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + public: + // ////////////// Busniess methods //////////////// /** Check if the (i-1)-length segment path period can be fused with the single segment segment path period in order to create an i-length segment path period. The function will return a valid or non-valid @@ -96,23 +114,11 @@ the segments of the internal list. */ bool isAirlineFlown (const AirlineCode_T&) const; - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; + /** Check if the given departure date is included in the departure period + of the segment path. */ + bool isDepartureDateValid (const Date_T&) const; - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - void fromStream (std::istream& ioIn); - /** Get the serialised version of the Business Object. */ - std::string toString() const; - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const; - protected: /** Constructors are private so as to force the usage of the Factory layer. */ Modified: trunk/stdair/stdair/bom/SegmentPeriodContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriodContent.cpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/SegmentPeriodContent.cpp 2010-07-07 14:07:43 UTC (rev 210) @@ -18,5 +18,14 @@ SegmentPeriodContent::~SegmentPeriodContent () { } + // //////////////////////////////////////////////////////////////////// + void SegmentPeriodContent:: + addCabinBookingClassList (const CabinCode_T& iCabinCode, + const ClassList_String_T& iClassCodeList) { + const bool insert = _cabinBookingClassMap. + insert (CabinBookingClassMap_T::value_type (iCabinCode, iClassCodeList)).second; + assert (insert == true); + } + } Modified: trunk/stdair/stdair/bom/SegmentPeriodContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriodContent.hpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/SegmentPeriodContent.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -59,6 +59,11 @@ return _elapsedTime; } + /** Get the cabin booking class map. */ + const CabinBookingClassMap_T& getCabinBookingClassMap () const { + return _cabinBookingClassMap; + } + public: // ///////// Setters ////////// /** Set the boarding time. */ @@ -86,6 +91,11 @@ _elapsedTime = iElapsedTime; } + /** Add a pair cabin code and list of class codes within the cabin to the + cabin booking class map. */ + void addCabinBookingClassList (const CabinCode_T&, + const ClassList_String_T&); + public: // /////////// Display support methods ///////// @@ -120,6 +130,7 @@ DateOffset_T _boardingDateOffset; DateOffset_T _offDateOffset; Duration_T _elapsedTime; + CabinBookingClassMap_T _cabinBookingClassMap; }; } Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.cpp 2010-07-07 14:07:43 UTC (rev 210) @@ -8,33 +8,22 @@ #include <sstream> // StdAir #include <stdair/basic/BasConst_BookingClass.hpp> -#include <stdair/bom/OutboundPath.hpp> #include <stdair/bom/TravelSolutionStruct.hpp> namespace stdair { - // //////////////////////////////////////////////////////////////////// - TravelSolutionStruct::TravelSolutionStruct () - : _outboundPath_ptr (NULL) { - assert (false); + TravelSolutionStruct::TravelSolutionStruct () + : _fare (DEFAULT_FARE_VALUE), _availability (DEFAULT_AVAILABILITY) { } // //////////////////////////////////////////////////////////////////// TravelSolutionStruct:: TravelSolutionStruct (const TravelSolutionStruct& iTravelSolutionStruct) - : _outboundPath_ptr (iTravelSolutionStruct._outboundPath_ptr), - _bookingClassList (iTravelSolutionStruct._bookingClassList), + : _segmentDateKeyList (iTravelSolutionStruct._segmentDateKeyList), + _bookingClassKeyList (iTravelSolutionStruct._bookingClassKeyList), _fare (iTravelSolutionStruct._fare), _availability (iTravelSolutionStruct._availability) { } - - // //////////////////////////////////////////////////////////////////// - TravelSolutionStruct:: - TravelSolutionStruct (OutboundPath& ioOutboundPath, - const BookingClassSTLList_T& iBookingClassList) - : _outboundPath_ptr (&ioOutboundPath), _bookingClassList (iBookingClassList), - _fare (DEFAULT_FARE_VALUE), _availability (DEFAULT_AVAILABILITY) { - } // //////////////////////////////////////////////////////////////////// TravelSolutionStruct::~TravelSolutionStruct () { @@ -52,29 +41,21 @@ // ////////////////////////////////////////////////////////////////////// const std::string TravelSolutionStruct::describe() const { std::ostringstream oStr; - if (_outboundPath_ptr != NULL) { - oStr << *_outboundPath_ptr; + + ClassList_String_T::const_iterator itClass = _bookingClassKeyList.begin(); + + for (KeyList_T::const_iterator itSegmentKey = _segmentDateKeyList.begin (); + itSegmentKey != _segmentDateKeyList.end(); ++itSegmentKey) { + oStr << *itSegmentKey << ", "; + if (itClass != _bookingClassKeyList.end()) { + oStr << *itClass << ", "; + ++itClass; + } } + + oStr << _fare << ", " << _availability; return oStr.str(); } - - // ////////////////////////////////////////////////////////////////////// - const std::string TravelSolutionStruct::describeKey() const { - std::string oString; - if (_outboundPath_ptr != NULL) { - oString = _outboundPath_ptr->describeKey(); - } - return oString; - } - - // ////////////////////////////////////////////////////////////////////// - const std::string TravelSolutionStruct::describeShortKey() const { - std::string oString; - if (_outboundPath_ptr != NULL) { - oString = _outboundPath_ptr->describeShortKey(); - } - return oString; - } } Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-06-30 15:59:19 UTC (rev 209) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-07-07 14:07:43 UTC (rev 210) @@ -14,21 +14,15 @@ #include <stdair/bom/BookingClassTypes.hpp> namespace stdair { - - // Forward declarations - class OutboundPath; - /** Structure holding the elements of a travel solution. */ struct TravelSolutionStruct : public StructAbstract { public: // /////////// Getters /////////////// - /** Retrieve the attributes of the object. */ - OutboundPath& getOutboundPath() const { - assert (_outboundPath_ptr != NULL); - return *_outboundPath_ptr; + const KeyList_T& getSegmentDateKeyList () { + return _segmentDateKeyList; } - const BookingClassSTLList_T& getBookingClassList () const { - return _bookingClassList; + const ClassList_String_T& getBookingClassKeyList () const { + return _bookingClassKeyList; } const Fare_T getFare() const { return _fare; } const Availability_T getAvailability() const { return _availability; } @@ -38,6 +32,12 @@ /** Setter for some attributes. */ void setFare (const Fare_T& iFare) { _fare = iFare; } void setAvailability (const Availability_T& iAvail) { _availability=iAvail; } + void addSegmentDateKey (const std::string& iKey) { + _segmentDateKeyList.push_back (iKey); + } + void addBookingClassKey (const char iKey) { + _bookingClassKeyList.push_back (iKey); + } public: // /////////// Display support method ///////////// @@ -51,35 +51,24 @@ /** Display of the structure. */ const std::string describe() 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: // //////////// Constructors & Destructor /////////////// /** Main constructor. */ - TravelSolutionStruct (OutboundPath&, const BookingClassSTLList_T&); + TravelSolutionStruct (); /** Destructor. */ ~TravelSolutionStruct (); /** Default copy constructor. */ TravelSolutionStruct (const TravelSolutionStruct&); - /** Default constructor, not to be used. */ - TravelSolutionStruct (); private: // ///////////////////// Attributes ////////////////////// - /** The outbound path associated to this solution.*/ - OutboundPath* _outboundPath_ptr; - - /** The list of booking classes which make the travel solution. */ - BookingClassSTLList_T _bookingClassList; - + /** The list of segment-date whole keys which make the travel solution. */ + KeyList_T _segmentDateKeyList; + + /** The list of booking class keys which make the travel solution. */ + ClassList_String_T _bookingClassKeyList; + /** The fare of the travel solution. */ Fare_T _fare; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-07-07 15:10:20
|
Revision: 211 http://stdair.svn.sourceforge.net/stdair/?rev=211&view=rev Author: quannaus Date: 2010-07-07 15:10:13 +0000 (Wed, 07 Jul 2010) Log Message: ----------- [dev] Removed Network. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/BomTypes.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Removed Paths: ------------- 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/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/NetworkDateTypes.hpp trunk/stdair/stdair/bom/NetworkKey.cpp trunk/stdair/stdair/bom/NetworkKey.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/OutboundPathTypes.hpp Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -7,14 +7,217 @@ // StdAir #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomSource.hpp> #include <stdair/factory/FacBomContent.hpp> +#include <stdair/service/Logger.hpp> +#include <stdair/STDAIR_Service.hpp> // ///////// M A I N //////////// int main (int argc, char* argv[]) { - try { + try { + + // Test create objects. + + // Output log File + std::string lLogFilename ("stdair.log"); + + // Set the log parameters + std::ofstream logOutputFile; + // open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + stdair::STDAIR_Service stdairService (lLogParams); + + // DEBUG + STDAIR_LOG_DEBUG ("Welcome to stdair"); + + // Step 0.0: initialisation + // Create the root of the Bom tree (i.e., a BomRoot object) + stdair::BomRoot& lBomRoot = + stdair::FacBomContent::instance().create<stdair::BomRoot>(); + + + // Step 0.1: Inventory level + // Create an Inventory (BA) + const stdair::AirlineCode_T lAirlineCode ("BA"); + stdair::InventoryKey_T lInventoryKey (lAirlineCode); + + stdair::Inventory& lInventory = + stdair::FacBomContent::instance().create<stdair::Inventory>(lInventoryKey); + stdair::FacBomContent::linkWithParent (lInventory, lBomRoot); + + // Display the inventory + STDAIR_LOG_DEBUG ("Inventory: " << lInventory.toString()); + + // Step 0.2: Flight-date level + // Create a FlightDate (BA15/10-JUN-2010) + const stdair::FlightNumber_T lFlightNumber = 15; + const stdair::Date_T lDate (2010, 6, 10); + stdair::FlightDateKey_T lFlightDateKey (lFlightNumber, lDate); + + stdair::FlightDate& lFlightDate = stdair::FacBomContent:: + instance().create<stdair::FlightDate> (lFlightDateKey); + stdair::FacBomContent::linkWithParent (lFlightDate, lInventory); + + // Display the flight-date + STDAIR_LOG_DEBUG ("FlightDate: " << lFlightDate.toString()); + + // Step 0.3: Segment-date level + // Create a first SegmentDate (LHR-SYD) + const stdair::AirportCode_T lLHR ("LHR"); + const stdair::AirportCode_T lSYD ("SYD"); + stdair::SegmentDateKey_T lSegmentDateKey (lLHR, lSYD); + + stdair::SegmentDate& lLHRSYDSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lLHRSYDSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment.toString()); + + + // Create a second SegmentDate (LHR-BKK) + const stdair::AirportCode_T lBKK ("BKK"); + lSegmentDateKey = stdair::SegmentDateKey_T (lLHR, lBKK); + + stdair::SegmentDate& lLHRBKKSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lLHRBKKSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment.toString()); + + + // Create a third SegmentDate (BKK-SYD) + lSegmentDateKey = stdair::SegmentDateKey_T (lBKK, lSYD); + + stdair::SegmentDate& lBKKSYDSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lBKKSYDSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment.toString()); + + + // Step 0.4: Leg-date level + // Create a first LegDate (LHR) + stdair::LegDateKey_T lLegDateKey (lLHR); + + stdair::LegDate& lLHRLeg = + stdair::FacBomContent::instance().create<stdair::LegDate> (lLegDateKey); + stdair::FacBomContent::linkWithParent<stdair::LegDate>(lLHRLeg, lFlightDate); + + // Display the leg-date + STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString()); + + // Create a second LegDate (BKK) + lLegDateKey = stdair::LegDateKey_T (lBKK); + + stdair::LegDate& lBKKLeg = + stdair::FacBomContent::instance().create<stdair::LegDate> (lLegDateKey); + stdair::FacBomContent::linkWithParent (lBKKLeg, lFlightDate); + + // Display the leg-date + STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString()); + + // Step 0.5: segment-cabin level + // Create a SegmentCabin (Y) of the Segment LHR-BKK; + const stdair::CabinCode_T lY ("Y"); + stdair::SegmentCabinKey_T lYSegmentCabinKey (lY); + + stdair::SegmentCabin& lLHRBKKSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lLHRBKKSegmentYCabin, lLHRBKKSegment); + + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString()); + + // Create a SegmentCabin (Y) of the Segment BKK-SYD; + stdair::SegmentCabin& lBKKSYDSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lBKKSYDSegmentYCabin, lBKKSYDSegment); + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString()); + + // Create a SegmentCabin (Y) of the Segment LHR-SYD; + stdair::SegmentCabin& lLHRSYDSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lLHRSYDSegmentYCabin, lLHRSYDSegment); + + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString()); + + + // Step 0.6: leg-cabin level + // Create a LegCabin (Y) of the Leg LHR-BKK; + stdair::LegCabinKey_T lYLegCabinKey (lY); + + stdair::LegCabin& lLHRLegYCabin = + stdair::FacBomContent::instance().create<stdair::LegCabin> (lYLegCabinKey); + stdair::FacBomContent::linkWithParent (lLHRLegYCabin, lLHRLeg); + + // Display the leg-cabin + STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString()); + + // Create a LegCabin (Y) of the Leg BKK-SYD; + stdair::LegCabin& lBKKLegYCabin = + stdair::FacBomContent::instance().create<stdair::LegCabin> (lYLegCabinKey); + stdair::FacBomContent::linkWithParent (lBKKLegYCabin, lBKKLeg); + + // Display the leg-cabin + STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString()); + + // Step 0.7: booking class level + // Create a BookingClass (Q) of the Segment LHR-BKK, cabin Y; + const stdair::ClassCode_T lQ ("Q"); + stdair::BookingClassKey_T lQBookingClassKey (lQ); + + stdair::BookingClass& lLHRBKKSegmentYCabinQClass = + stdair::FacBomContent:: + instance().create<stdair::BookingClass> (lQBookingClassKey); + stdair::FacBomContent:: + linkWithParent (lLHRBKKSegmentYCabinQClass, lLHRBKKSegmentYCabin); + + // Display the booking class + STDAIR_LOG_DEBUG ("BookingClass: " + << lLHRBKKSegmentYCabinQClass.toString()); + + // Browse the BomRoot and display the created objects. + STDAIR_LOG_DEBUG ("Browse the BomRoot"); + + const stdair::InventoryList_T& lInventoryList = lBomRoot.getInventoryList(); + for (stdair::InventoryList_T::iterator itInv = lInventoryList.begin(); + itInv != lInventoryList.end(); ++itInv) { + const stdair::Inventory& lCurrentInventory = *itInv; + STDAIR_LOG_DEBUG ("Inventory: " << lCurrentInventory.toString()); + + const stdair::FlightDateList_T& lFlightDateList = + lCurrentInventory.getFlightDateList (); + for (stdair::FlightDateList_T::iterator itFlightDate = + lFlightDateList.begin(); + itFlightDate != lFlightDateList.end(); ++itFlightDate) { + const stdair::FlightDate& lCurrentFlightDate = *itFlightDate; + STDAIR_LOG_DEBUG ("FlightDate: " << lCurrentFlightDate.describeKey()); + } + } + + // Close the Log outputFile + logOutputFile.close(); + } catch (const std::exception& stde) { std::cerr << "Standard exception: " << stde.what() << std::endl; return -1; Deleted: trunk/stdair/stdair/bom/AirportDate.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDate.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,90 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/basic/BasConst_Inventory.hpp> -#include <stdair/bom/BomSource.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - AirportDate::AirportDate (const Key_T& iKey, - Structure_T& ioAirportStructure) - : AirportDateContent (iKey), _structure (ioAirportStructure) { - init (); - } - - // //////////////////////////////////////////////////////////////////// - AirportDate::~AirportDate () { - } - - // //////////////////////////////////////////////////////////////////// - void AirportDate::init () { - _structure.initChildrenHolder<OutboundPath>(); - } - - // //////////////////////////////////////////////////////////////////// - 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; - oStr << describeShortKey() << std::endl; - return oStr.str(); - } - - // //////////////////////////////////////////////////////////////////// - const std::string AirportDate::describeKey() const { - std::ostringstream oStr; - oStr << _structure.describeParentKey() << ", " << describeShortKey(); - return oStr.str(); - } - - // //////////////////////////////////////////////////////////////////// - OutboundPathList_T AirportDate::getOutboundPathList () const { - return _structure.getChildrenHolder<OutboundPath>(); - } - - // //////////////////////////////////////////////////////////////////// - OutboundPathMultimap_T AirportDate::getOutboundPathMultimap () const { - return _structure.getChildrenHolder<OutboundPath>(); - } - - - // //////////////////////////////////////////////////////////////////// - void AirportDate:: - buildOutboundPathListList (OutboundPath& ioOutboundPath) { - const OutboundPathKey_T& lOutboundPathKey = ioOutboundPath.getKey(); - const NbOfSegments_T& lNbOfSegments = - lOutboundPathKey.getNbOfSegments (); - assert (lNbOfSegments > 0 - && lNbOfSegments <= MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND); - const NbOfSegments_T lNbOfSegments_m1 = - static_cast<const NbOfSegments_T> (lNbOfSegments - 1); - - // If needed, initialise the list of lists with empty fixed-length - // outbound-path lists. - while (_outboundPathListList.size() <= lNbOfSegments_m1) { - OutboundPathLightList_T lOutboundPathLightList; - _outboundPathListList.push_back (lOutboundPathLightList); - } - - // Retrieve the i-fixed-length Outbound-Path list (i = number of - // segments). - OutboundPathLightList_T& lOutboundPathLightList = - _outboundPathListList.at (lNbOfSegments-1); - - // Add the OutboundPath to that fixed-length-path list. - lOutboundPathLightList.push_back (&ioOutboundPath); - } - -} - Deleted: trunk/stdair/stdair/bom/AirportDate.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDate.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDate.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,115 +0,0 @@ -#ifndef __STDAIR_BOM_AIRPORTDATE_HPP -#define __STDAIR_BOM_AIRPORTDATE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// Boost Fusion -#include <boost/version.hpp> -#if BOOST_VERSION >= 103500 -#include <boost/fusion/include/map.hpp> -#else // BOOST_VERSION >= 103500 -#include <boost/mpl/map.hpp> -#endif // BOOST_VERSION >= 103500 -// StdAir -#include <stdair/bom/AirportDateContent.hpp> -#include <stdair/bom/AirportDateTypes.hpp> -#include <stdair/bom/OutboundPathTypes.hpp> - -namespace stdair { - // Forward declarations - class NetworkDate; - class OutboundPath; - - /** Class representing the actual functional/business content for a - airport-date. */ - class AirportDate : public AirportDateContent { - friend class FacBomContent; - - public: - // ////////////////////////////////////////////////////////////////// - // See the explanations, within the BomRoot class, for all - // the types which require to be specified below - // ////////////////////////////////////////////////////////////////// - /** Definition allowing to retrieve the associated BOM structure type. */ - typedef AirportDateStructure_T Structure_T; - - /** Definition allowing to retrieve the associated parent - BOM content type. */ - typedef NetworkDate Parent_T; - - /** Definition allowing to retrieve the map/multimap type using by - BomChildrenHolder. */ - typedef std::map<const MapKey_T, const Structure_T*> Map_T; - - /** Define the list of children holder types. */ -#if BOOST_VERSION >= 103500 - typedef boost::fusion::map< - boost::fusion::pair<OutboundPath, OutboundPathHolder_T*> - > ChildrenHolderMap_T; -#else // BOOST_VERSION >= 103500 - typedef boost::mpl::map< > ChildrenHolderMap_T; -#endif // BOOST_VERSION >= 103500 - // ////////////////////////////////////////////////////////////////// - - public: - // /////////// Getters ///////////// - /** Get a list or map of a children type for iteration methods. */ - OutboundPathList_T getOutboundPathList () const; - OutboundPathMultimap_T getOutboundPathMultimap () const; - - /** Get the OutboundPathListList. */ - const OutboundPathListList_T& getOutboundPathListList () const { - return _outboundPathListList; - } - - public: - // //////////// Business Methods ////////////// - /** Build the list of lists of outbound paths. **/ - void buildOutboundPathListList (stdair::OutboundPath&); - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - void fromStream (std::istream& ioIn); - - /** Get the serialised version of the Business Object. */ - std::string toString() const; - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const; - - protected: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Constructors. */ - AirportDate (const Key_T&, Structure_T&); - /** Destructor. */ - ~AirportDate(); - /** Initialise all the pointers of children holder to NULL. */ - void init(); - /** Default constructors. */ - AirportDate (); - AirportDate (const AirportDate&); - - protected: - // Attributes - /** Reference structure. */ - Structure_T& _structure; - - /** The list of lists of OutboundPaths, used uniquement for the - construction of the main list of OutboundPaths in - AirportDateStructure. */ - OutboundPathListList_T _outboundPathListList; - - }; - -} -#endif // __STDAIR_BOM_AIRPORTDATE_HPP - Deleted: trunk/stdair/stdair/bom/AirportDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDateContent.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,21 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/AirportDateContent.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - AirportDateContent::AirportDateContent (const Key_T& iKey) \ - : _key (iKey) { - } - - // //////////////////////////////////////////////////////////////////// - AirportDateContent::~AirportDateContent () { - } - -} - Deleted: trunk/stdair/stdair/bom/AirportDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateContent.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDateContent.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,66 +0,0 @@ -#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 Key_T; - - public: - // /////////// Getters ///////////// - /** Get the airport-date key. */ - const Key_T& getKey() const { - return _key; - } - - /** Get the (origin) airport (part of the primary key). */ - const AirportCode_T& getOrigin() const { - return _key.getBoardingPoint(); - } - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - virtual void toStream (std::ostream& ioOut) const = 0; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) = 0; - - /** Get the serialised version of the Business Object. */ - virtual std::string toString() const = 0; - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } - - - protected: - /** Default constructors. */ - AirportDateContent (const Key_T&); - AirportDateContent (const AirportDateContent&); - /** Destructor. */ - virtual ~AirportDateContent(); - - protected: - // Attributes - /** The key of both structure and content objects. */ - Key_T _key; - - }; - -} -#endif // __STDAIR_BOM_AIRPORTDATECONTENT_HPP - Deleted: trunk/stdair/stdair/bom/AirportDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateKey.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDateKey.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,43 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// 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 (const AirportDateKey_T& iKey) - : _origin (iKey._origin) { - } - - // //////////////////////////////////////////////////////////////////// - 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(); - } - -} Deleted: trunk/stdair/stdair/bom/AirportDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateKey.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDateKey.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,56 +0,0 @@ -#ifndef __STDAIR_BOM_AIRPORTDATEKEY_HPP -#define __STDAIR_BOM_AIRPORTDATEKEY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomKey.hpp> - -namespace stdair { - /** Key of airport-date. */ - struct AirportDateKey_T : public BomKey_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 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; - - private: - // Attributes - /** The boarding airport. */ - AirportCode_T _origin; - }; - -} - -#endif // __STDAIR_BOM_NETWORKDATEKEY_HPP Deleted: trunk/stdair/stdair/bom/AirportDateTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/AirportDateTypes.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/AirportDateTypes.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,34 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -#ifndef __STDAIR_BOM_AIRPORTDATETYPES_HPP -#define __STDAIR_BOM_AIRPORTDATETYPES_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <map> -#include <vector> - -namespace stdair { - - // Forward declarations. - template <typename CONTENT> class Structure; - template <typename CONTENT> class BomChildrenHolderImp; - template <typename BOM> struct BomList_T; - template <typename BOM> struct BomMap_T; - class AirportDate; - - /** Define the AirportDate structure. */ - typedef Structure<AirportDate> AirportDateStructure_T; - - /** Define the AirportDate holder. */ - typedef BomChildrenHolderImp<AirportDate> AirportDateHolder_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/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -25,19 +25,8 @@ // Call recursively the display() method on the children objects display (oStream, lCurrentInventory); - } + } - // Browse the Network objects - const NetworkList_T& lNetworkList= iBomRoot.getNetworkList (); - for (NetworkList_T::iterator itInv = lNetworkList.begin(); - itInv != lNetworkList.end(); ++itInv) { - const Network& lCurrentNetwork = *itInv; - - // Call recursively the display() method on the children objects - oStream << std::endl; - display (oStream, lCurrentNetwork); - } - // Reset formatting flags of the given output stream oStream.flags (oldFlags); } @@ -312,94 +301,6 @@ } // //////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const Network& iNetwork) { - // Store current formatting flags of the given output stream - std::ios::fmtflags oldFlags = oStream.flags(); - - oStream << "Network: " << std::endl; - - int j = 1; - const NetworkDateList_T& lNetworkDateList = iNetwork.getNetworkDateList(); - for (NetworkDateList_T::iterator itNetworkDate = - lNetworkDateList.begin(); - itNetworkDate != lNetworkDateList.end(); ++itNetworkDate, ++j) { - const NetworkDate& lCurrentNetworkDate = *itNetworkDate; - - - // Call recursively the display() method on the children objects - display (oStream, lCurrentNetworkDate); - } - - // Reset formatting flags of the given output stream - oStream.flags (oldFlags); - } - - // //////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const NetworkDate& iNetworkDate) { - // Store current formatting flags of the given output stream - std::ios::fmtflags oldFlags = oStream.flags(); - - oStream << iNetworkDate.describeKey() << std::endl; - - const AirportDateList_T& lAirportDateList= iNetworkDate.getAirportDateList(); - for (AirportDateList_T::iterator itAirportDate = lAirportDateList.begin(); - itAirportDate != lAirportDateList.end(); ++itAirportDate) { - const AirportDate& lCurrentAirportDate = *itAirportDate; - - // Call recursively the display() method on the children objects - display (oStream, lCurrentAirportDate); - } - - // Reset formatting flags of the given output stream - oStream.flags (oldFlags); - } - - // //////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const AirportDate& iAirportDate) { - // Store current formatting flags of the given output stream - std::ios::fmtflags oldFlags = oStream.flags(); - - oStream << iAirportDate.describeKey() << std::endl; - - const OutboundPathList_T& lOutboundPathList = - iAirportDate.getOutboundPathList(); - for (OutboundPathList_T::iterator itPath = lOutboundPathList.begin(); - itPath != lOutboundPathList.end(); ++itPath) { - const OutboundPath& lCurrentOutboundPath = *itPath; - - // Call recursively the display() method on the children objects - display (oStream, lCurrentOutboundPath); - } - - // Reset formatting flags of the given output stream - oStream.flags (oldFlags); - } - - // //////////////////////////////////////////////////////////////////// - void BomManager::display (std::ostream& oStream, - const OutboundPath& iOutboundPath) { - // Store current formatting flags of the given output stream - std::ios::fmtflags oldFlags = oStream.flags(); - - oStream << iOutboundPath.describeKey() << std::endl; - - const SegmentDateList_T& lSegmentDateList = - iOutboundPath.getSegmentDateList(); - for (SegmentDateList_T::iterator itSegmentDate = lSegmentDateList.begin(); - itSegmentDate != lSegmentDateList.end(); ++itSegmentDate) { - const SegmentDate& lCurrentSegmentDate = *itSegmentDate; - - oStream << lCurrentSegmentDate.describeKey() << std::endl; - } - - // 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 Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -23,10 +23,6 @@ class SegmentPathPeriod; class FlightPeriod; class SegmentPeriod; - class Network; - class NetworkDate; - class AirportDate; - class OutboundPath; struct BookingRequestStruct; /** Utility class for StdAir objects. */ @@ -100,34 +96,6 @@ the objects of the given BOM tree. @param std::ostream& Output stream in which the BOM tree should be logged/dumped. - @param const Network& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const Network&); - - /** 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 NetworkDate& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const NetworkDate&); - - /** 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 AirportDate& Root of the BOM tree to be displayed. */ - static void display (std::ostream&, const AirportDate&); - - /** 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 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); Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -22,7 +22,6 @@ void BomRoot::init() { _structure.initChildrenHolder<Inventory>(); _structure.initChildrenHolder<ReachableUniverse>(); - _structure.initChildrenHolder<Network>(); _structure.initChildrenHolder<AirlineFeature>(); _structure.initChildrenHolder<DemandStream>(); _structure.initChildrenHolder<YieldStore>(); @@ -47,16 +46,6 @@ ReachableUniverseMap_T BomRoot::getReachableUniverseMap () const { return _structure.getChildrenHolder<ReachableUniverse>(); } - - // //////////////////////////////////////////////////////////////////// - NetworkList_T BomRoot::getNetworkList () const { - return _structure.getChildrenHolder<Network>(); - } - - // //////////////////////////////////////////////////////////////////// - NetworkMap_T BomRoot::getNetworkMap () const { - return _structure.getChildrenHolder<Network>(); - } // //////////////////////////////////////////////////////////////////// DemandStreamList_T BomRoot::getDemandStreamList () const { @@ -100,11 +89,6 @@ } // //////////////////////////////////////////////////////////////////// - Network* BomRoot::getNetwork (const NetworkID_T& iNetworkID) const { - return _structure.getChildPtr<Network> (iNetworkID); - } - - // //////////////////////////////////////////////////////////////////// YieldStore* BomRoot::getYieldStore (const AirlineCode_T& iAirlineCode) const { return _structure.getChildPtr<YieldStore> (iAirlineCode); } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -16,7 +16,6 @@ #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/ReachableUniverseTypes.hpp> -#include <stdair/bom/NetworkTypes.hpp> #include <stdair/bom/DemandStreamTypes.hpp> #include <stdair/bom/AirlineFeatureTypes.hpp> #include <stdair/bom/YieldStoreTypes.hpp> @@ -65,7 +64,6 @@ typedef boost::fusion::map< boost::fusion::pair<Inventory, InventoryHolder_T*>, boost::fusion::pair<ReachableUniverse, ReachableUniverseHolder_T*>, - boost::fusion::pair<Network, NetworkHolder_T*>, boost::fusion::pair<AirlineFeature, AirlineFeatureHolder_T*>, boost::fusion::pair<DemandStream, DemandStreamHolder_T*>, boost::fusion::pair<YieldStore, YieldStoreHolder_T*> @@ -82,8 +80,6 @@ InventoryMap_T getInventoryMap () const; ReachableUniverseList_T getReachableUniverseList () const; ReachableUniverseMap_T getReachableUniverseMap () const; - NetworkList_T getNetworkList () const; - NetworkMap_T getNetworkMap () const; DemandStreamList_T getDemandStreamList () const; DemandStreamMap_T getDemandStreamMap () const; AirlineFeatureList_T getAirlineFeatureList () const; @@ -101,11 +97,6 @@ <br>If not existing, return the NULL pointer. */ ReachableUniverse* getReachableUniverse (const AirportCode_T&) const; - /** Retrieve, if existing, the Network corresponding to the - given airline code (Network key). - <br>If not existing, return the NULL pointer. */ - Network* getNetwork (const NetworkID_T&) const; - /** Retrieve, if existing, the YieldStore corresponding to the given airline code (YieldStore key). <br>If not existing, return the NULL pointer. */ Modified: trunk/stdair/stdair/bom/BomSource.hpp =================================================================== --- trunk/stdair/stdair/bom/BomSource.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomSource.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -10,10 +10,6 @@ #include <stdair/bom/BomMultimap.hpp> #include <stdair/bom/BomList.hpp> #include <stdair/bom/BomRoot.hpp> -#include <stdair/bom/Network.hpp> -#include <stdair/bom/NetworkDate.hpp> -#include <stdair/bom/AirportDate.hpp> -#include <stdair/bom/OutboundPath.hpp> #include <stdair/bom/Inventory.hpp> #include <stdair/bom/FlightDate.hpp> #include <stdair/bom/SegmentDate.hpp> Modified: trunk/stdair/stdair/bom/BomTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/BomTypes.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/BomTypes.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -5,10 +5,6 @@ // Import section // ////////////////////////////////////////////////////////////////////// #include <stdair/bom/BomRootTypes.hpp> -#include <stdair/bom/NetworkTypes.hpp> -#include <stdair/bom/NetworkDateTypes.hpp> -#include <stdair/bom/AirportDateTypes.hpp> -#include <stdair/bom/OutboundPathTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/FlightDateTypes.hpp> #include <stdair/bom/SegmentDateTypes.hpp> Deleted: trunk/stdair/stdair/bom/Network.cpp =================================================================== --- trunk/stdair/stdair/bom/Network.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/Network.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,66 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/BomSource.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - Network::Network (const Key_T& iKey, - Structure_T& ioNetworkStructure) - : NetworkContent (iKey), _structure (ioNetworkStructure) { - init (); - } - - // //////////////////////////////////////////////////////////////////// - Network::~Network () { - } - - // //////////////////////////////////////////////////////////////////// - void Network::init () { - _structure.initChildrenHolder<NetworkDate>(); - } - - // //////////////////////////////////////////////////////////////////// - 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 _key.toString(); - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateList_T Network::getNetworkDateList () const { - return _structure.getChildrenHolder<NetworkDate>(); - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateMap_T Network::getNetworkDateMap () const { - return _structure.getChildrenHolder<NetworkDate>(); - } - - // //////////////////////////////////////////////////////////////////// - NetworkDate* Network::getNetworkDate (const Date_T& iDate) const { - std::ostringstream ostr; - ostr << iDate; - return _structure.getChildPtr<NetworkDate> (ostr.str()); - } - -} - Deleted: trunk/stdair/stdair/bom/Network.hpp =================================================================== --- trunk/stdair/stdair/bom/Network.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/Network.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,104 +0,0 @@ -#ifndef __STDAIR_BOM_NETWORK_HPP -#define __STDAIR_BOM_NETWORK_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// Boost Fusion -#include <boost/version.hpp> -#if BOOST_VERSION >= 103500 -#include <boost/fusion/include/map.hpp> -#else // BOOST_VERSION >= 103500 -#include <boost/mpl/map.hpp> -#endif // BOOST_VERSION >= 103500 -// StdAir -#include <stdair/bom/NetworkContent.hpp> -#include <stdair/bom/NetworkTypes.hpp> -#include <stdair/bom/NetworkDateTypes.hpp> - -namespace stdair { - // Forward declarations - class BomRoot; - class NetworkDate; - - /** 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 BOM structure type. */ - typedef NetworkStructure_T Structure_T; - - /** Definition allowing to retrieve the associated parent - BOM content type. */ - typedef BomRoot Parent_T; - - /** Definition allowing to retrieve the map/multimap type using by - BomChildrenHolder. */ - typedef std::map<const MapKey_T, const Structure_T*> Map_T; - - /** Define the list of children holder types. */ -#if BOOST_VERSION >= 103500 - typedef boost::fusion::map< - boost::fusion::pair<NetworkDate, NetworkDateHolder_T*> - > ChildrenHolderMap_T; -#else // BOOST_VERSION >= 103500 - typedef boost::mpl::map< > ChildrenHolderMap_T; -#endif // BOOST_VERSION >= 103500 - // ////////////////////////////////////////////////////////////////// - - public: - // /////////// Getters ///////////// - /** Get a list or map of a children type for iteration methods. */ - NetworkDateList_T getNetworkDateList () const; - NetworkDateMap_T getNetworkDateMap () const; - - /** Retrieve, if existing, the NetworkDate corresponding to the - given Date . - <br>If not existing, return the NULL pointer. */ - NetworkDate* getNetworkDate (const Date_T&) const; - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - void fromStream (std::istream& ioIn); - - /** Get the serialised version of the Business Object. */ - std::string toString() const; - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const; - - protected: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Constructors. */ - Network (const Key_T&, Structure_T&); - /** Destructor. */ - ~Network(); - /** Initialise all the pointers of children holder to NULL. */ - void init(); - /** Default constructors. */ - Network (); - Network (const Network&); - - protected: - // Attributes - /** Reference structure. */ - Structure_T& _structure; - }; - -} -#endif // __STDAIR_BOM_NETWORK_HPP - Deleted: trunk/stdair/stdair/bom/NetworkContent.cpp =================================================================== --- trunk/stdair/stdair/bom/NetworkContent.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkContent.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,20 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/NetworkContent.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - NetworkContent::NetworkContent (const Key_T& iKey) : _key (iKey) { - } - - // //////////////////////////////////////////////////////////////////// - NetworkContent::~NetworkContent () { - } - -} - Deleted: trunk/stdair/stdair/bom/NetworkContent.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkContent.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkContent.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,59 +0,0 @@ -#ifndef __STDAIR_BOM_NETWORKCONTENT_HPP -#define __STDAIR_BOM_NETWORKCONTENT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#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 Key_T; - - public: - // ////////// Getters //////////// - /** Get the network key. */ - const Key_T& getKey() const { - return _key; - } - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - virtual void toStream (std::ostream& ioOut) const = 0; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) = 0; - - /** Get the serialised version of the Business Object. */ - virtual std::string toString() const = 0; - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } - - protected: - /** Default constructors. */ - NetworkContent (const Key_T&); - NetworkContent (const NetworkContent&); - /** Destructor. */ - virtual ~NetworkContent(); - - protected: - // Attributes - /** The key of both structure and content objects. */ - Key_T _key; - }; - -} -#endif // __STDAIR_BOM_NETWORKCONTENT_HPP - Deleted: trunk/stdair/stdair/bom/NetworkDate.cpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDate.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,66 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/BomSource.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - NetworkDate::NetworkDate (const Key_T& iKey, - Structure_T& ioNetworkDateStructure) - : NetworkDateContent (iKey), _structure (ioNetworkDateStructure) { - init (); - } - - // //////////////////////////////////////////////////////////////////// - NetworkDate::~NetworkDate () { - } - - // //////////////////////////////////////////////////////////////////// - void NetworkDate::init () { - _structure.initChildrenHolder<AirportDate>(); - } - - // //////////////////////////////////////////////////////////////////// - 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 { - std::ostringstream oStr; - oStr << _structure.describeParentKey() << ", " << describeShortKey(); - return oStr.str(); - } - - // //////////////////////////////////////////////////////////////////// - AirportDateList_T NetworkDate::getAirportDateList () const { - return _structure.getChildrenHolder<AirportDate>(); - } - - // //////////////////////////////////////////////////////////////////// - AirportDateMap_T NetworkDate::getAirportDateMap () const { - return _structure.getChildrenHolder<AirportDate>(); - } - - // //////////////////////////////////////////////////////////////////// - AirportDate* NetworkDate::getAirportDate (const AirportCode_T& iCode) const { - return _structure.getChildPtr<AirportDate> (iCode); - } - -} - Deleted: trunk/stdair/stdair/bom/NetworkDate.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDate.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDate.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,105 +0,0 @@ -#ifndef __STDAIR_BOM_NETWORKDATE_HPP -#define __STDAIR_BOM_NETWORKDATE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// Boost Fusion -#include <boost/version.hpp> -#if BOOST_VERSION >= 103500 -#include <boost/fusion/include/map.hpp> -#else // BOOST_VERSION >= 103500 -#include <boost/mpl/map.hpp> -#endif // BOOST_VERSION >= 103500 -// StdAir -#include <stdair/bom/NetworkDateContent.hpp> -#include <stdair/bom/NetworkDateTypes.hpp> -#include <stdair/bom/AirportDateTypes.hpp> - -namespace stdair { - // Forward declarations - class Network; - class AirportDate; - - /** 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 BOM structure type. */ - typedef NetworkDateStructure_T Structure_T; - - /** Definition allowing to retrieve the associated parent - BOM content type. */ - typedef Network Parent_T; - - /** Definition allowing to retrieve the map/multimap type using by - BomChildrenHolder. */ - typedef std::map<const MapKey_T, const Structure_T*> Map_T; - - /** Define the list of children holder types. */ -#if BOOST_VERSION >= 103500 - typedef boost::fusion::map< - boost::fusion::pair<AirportDate, AirportDateHolder_T*> - > ChildrenHolderMap_T; -#else // BOOST_VERSION >= 103500 - typedef boost::mpl::map< > ChildrenHolderMap_T; -#endif // BOOST_VERSION >= 103500 - // ////////////////////////////////////////////////////////////////// - - public: - // /////////// Getters ///////////// - /** Get a list or map of a children type for iteration methods. */ - AirportDateList_T getAirportDateList () const; - AirportDateMap_T getAirportDateMap () const; - - /** Retrieve, if existing, the AirportDate corresponding to the - given airport-code. - <br>If not existing, return the NULL pointer. */ - AirportDate* getAirportDate (const AirportCode_T&) const; - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - void fromStream (std::istream& ioIn); - - /** Get the serialised version of the Business Object. */ - std::string toString() const; - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - const std::string describeKey() const; - - protected: - /** Constructors are private so as to force the usage of the Factory - layer. */ - /** Constructors. */ - NetworkDate (const Key_T&, Structure_T&); - /** Destructor. */ - ~NetworkDate(); - /** Initialise all the pointers of children holder to NULL. */ - void init(); - /** Default constructors. */ - NetworkDate (); - NetworkDate (const NetworkDate&); - - protected: - // Attributes - /** Reference structure. */ - Structure_T& _structure; - - }; - -} -#endif // __STDAIR_BOM_NETWORKDATE_HPP - Deleted: trunk/stdair/stdair/bom/NetworkDateContent.cpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDateContent.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDateContent.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,20 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -// STDAIR -#include <stdair/bom/NetworkDateContent.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - NetworkDateContent::NetworkDateContent (const Key_T& iKey) : _key (iKey) { - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateContent::~NetworkDateContent () { - } - -} - Deleted: trunk/stdair/stdair/bom/NetworkDateContent.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDateContent.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDateContent.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,59 +0,0 @@ -#ifndef __STDAIR_BOM_NETWORKDATECONTENT_HPP -#define __STDAIR_BOM_NETWORKDATECONTENT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomContent.hpp> -#include <stdair/bom/NetworkDateKey.hpp> - -namespace stdair { - - /** Class representing the actual attributes for a network-date. */ - class NetworkDateContent : public BomContent { - public : - // Type definitions - /** Definition allowing to retrieve the associated BOM key type. */ - typedef NetworkDateKey_T Key_T; - - public: - // ////////// Getters //////////// - /** Get the network-date key. */ - const Key_T& getKey() const { - return _key; - } - - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - virtual void toStream (std::ostream& ioOut) const = 0; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) = 0; - - /** Get the serialised version of the Business Object. */ - virtual std::string toString() const = 0; - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - const std::string describeShortKey() const { return _key.toString(); } - - protected: - /** Default constructors. */ - NetworkDateContent (const Key_T&); - NetworkDateContent (const NetworkDateContent&); - /** Destructor. */ - virtual ~NetworkDateContent(); - - protected: - // Attributes - /** The key of both structure and content objects. */ - Key_T _key; - }; - -} -#endif // __STDAIR_BOM_NETWORKDATECONTENT_HPP - Deleted: trunk/stdair/stdair/bom/NetworkDateKey.cpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDateKey.cpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDateKey.cpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,44 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/NetworkDateKey.hpp> - -namespace stdair { - - // //////////////////////////////////////////////////////////////////// - NetworkDateKey_T::NetworkDateKey_T () - : _referenceDate (Date_T (1970, 01, 01)) { - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateKey_T::NetworkDateKey_T (const Date_T& iReferenceDate) - : _referenceDate (iReferenceDate) { - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateKey_T::NetworkDateKey_T (const NetworkDateKey_T& iKey) - : _referenceDate (iKey._referenceDate) { - } - - // //////////////////////////////////////////////////////////////////// - NetworkDateKey_T::~NetworkDateKey_T () { - } - - // //////////////////////////////////////////////////////////////////// - void NetworkDateKey_T::toStream (std::ostream& ioOut) const { - ioOut << "NetworkDateKey: " << toString() << std::endl; - } - - // //////////////////////////////////////////////////////////////////// - void NetworkDateKey_T::fromStream (std::istream& ioIn) { - } - - // //////////////////////////////////////////////////////////////////// - const std::string NetworkDateKey_T::toString() const { - std::ostringstream oStr; - oStr << _referenceDate; - return oStr.str(); - } - -} Deleted: trunk/stdair/stdair/bom/NetworkDateKey.hpp =================================================================== --- trunk/stdair/stdair/bom/NetworkDateKey.hpp 2010-07-07 14:07:43 UTC (rev 210) +++ trunk/stdair/stdair/bom/NetworkDateKey.hpp 2010-07-07 15:10:13 UTC (rev 211) @@ -1,61 +0,0 @@ -#ifndef __STDAIR_BOM_NETWORKDATEKEY_HPP -#define __STDAIR_BOM_NETWORKDATEKEY_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/bom/BomKey.hpp> - -namespace stdair { - /** Key of network-date. */ - struct NetworkDateKey_T : public BomKey_T { - - private: - // /////////// Default constructor ////////// - NetworkDateKey_T (); - - public: - // /////////// Construction /////////// - /** Constructors. */ - NetworkDateKey_T (const Date_T& iReferenceDate); - NetworkDateKey_T (const NetworkDateKey_T&); - - /** Destructor. */ - ~NetworkDat... [truncated message content] |
From: <qua...@us...> - 2010-07-12 13:57:52
|
Revision: 215 http://stdair.svn.sourceforge.net/stdair/?rev=215&view=rev Author: quannaus Date: 2010-07-12 13:57:46 +0000 (Mon, 12 Jul 2010) Log Message: ----------- [dev] Removed the _intermediateValue in BomIterator which may core and replace it with a boost shared pointer. Modified Paths: -------------- trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/BomIterator.hpp Modified: trunk/stdair/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/stdair/batches/stdair.cpp 2010-07-12 08:34:56 UTC (rev 214) +++ trunk/stdair/stdair/batches/stdair.cpp 2010-07-12 13:57:46 UTC (rev 215) @@ -204,14 +204,14 @@ itInv != lInventoryList.end(); ++itInv) { const stdair::Inventory& lCurrentInventory = *itInv; STDAIR_LOG_DEBUG ("Inventory: " << lCurrentInventory.toString()); - - const stdair::FlightDateList_T& lFlightDateList = - lCurrentInventory.getFlightDateList (); - for (stdair::FlightDateList_T::iterator itFlightDate = - lFlightDateList.begin(); - itFlightDate != lFlightDateList.end(); ++itFlightDate) { - const stdair::FlightDate& lCurrentFlightDate = *itFlightDate; - STDAIR_LOG_DEBUG ("FlightDate: " << lCurrentFlightDate.describeKey()); + + const stdair::FlightDateMap_T& lFlightDateMap = + lCurrentInventory.getFlightDateMap (); + for (stdair::FlightDateMap_T::iterator itFlightDate = + lFlightDateMap.begin(); + itFlightDate != lFlightDateMap.end(); ++itFlightDate) { + const stdair::FlightDate* lCurrentFlightDate = itFlightDate->second; + STDAIR_LOG_DEBUG ("FlightDate: " << lCurrentFlightDate->describeKey()); } } Modified: trunk/stdair/stdair/bom/BomIterator.hpp =================================================================== --- trunk/stdair/stdair/bom/BomIterator.hpp 2010-07-12 08:34:56 UTC (rev 214) +++ trunk/stdair/stdair/bom/BomIterator.hpp 2010-07-12 13:57:46 UTC (rev 215) @@ -8,6 +8,9 @@ #include <cassert> #include <vector> #include <map> +// BOOST +#include <boost/shared_ptr.hpp> +#include <boost/make_shared.hpp> namespace stdair { @@ -25,6 +28,7 @@ // Define the pair of string and pointer of CONTENT. typedef typename std::pair<std::string, CONTENT*> value_type; + typedef boost::shared_ptr<value_type> value_type_shared_ptr; // Definition allowing the retrieve the ITERATOR type. typedef ITERATOR iterator_type; @@ -111,7 +115,7 @@ } /** Dereferencing operator for iterators on a map. */ - value_type* operator-> () { + value_type_shared_ptr operator-> () { const MapKey_T& lKey = _itStructureObject->first; const Structure_T* lBomStruct_ptr = _itStructureObject->second; @@ -119,28 +123,14 @@ CONTENT* lBomContent_ptr = BomStructure::getContentPtr<CONTENT> (*lBomStruct_ptr); assert (lBomContent_ptr != NULL); - - // See the comment below, at the definition of the _intermediateValue - // attribute - _intermediateValue.first = lKey; - _intermediateValue.second = lBomContent_ptr; - return &_intermediateValue; + return boost::make_shared<value_type> (lKey, lBomContent_ptr); } private: ///////////// Attributes ////////////// /** Iterator for the current BOM structure on the non-ordered list. */ iterator_type _itStructureObject; - - /** Helper attribute. - <br>It is necessary to define that value at the attribute - level, because the operator->() method needs to return a - pointer on it. If that value be temporary, i.e., created at - the fly when the operator->() method returns, we would return - a pointer on a temporary value, which is not good. */ - value_type _intermediateValue; - }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-07-12 15:21:35
|
Revision: 216 http://stdair.svn.sourceforge.net/stdair/?rev=216&view=rev Author: denis_arnaud Date: 2010-07-12 15:21:29 +0000 (Mon, 12 Jul 2010) Log Message: ----------- [Dev] Made private the type for a temporary return type. Modified Paths: -------------- trunk/stdair/stdair/bom/BomIterator.hpp Property Changed: ---------------- trunk/stdair/stdair/batches/ Property changes on: trunk/stdair/stdair/batches ___________________________________________________________________ Modified: svn:ignore - Makefile.in Makefile stdair .libs .deps + .deps .libs Makefile.in Makefile stdair stdair.log Modified: trunk/stdair/stdair/bom/BomIterator.hpp =================================================================== --- trunk/stdair/stdair/bom/BomIterator.hpp 2010-07-12 13:57:46 UTC (rev 215) +++ trunk/stdair/stdair/bom/BomIterator.hpp 2010-07-12 15:21:29 UTC (rev 216) @@ -28,7 +28,6 @@ // Define the pair of string and pointer of CONTENT. typedef typename std::pair<std::string, CONTENT*> value_type; - typedef boost::shared_ptr<value_type> value_type_shared_ptr; // Definition allowing the retrieve the ITERATOR type. typedef ITERATOR iterator_type; @@ -36,6 +35,10 @@ // Definition allowing the retrieve the difference type of the ITERATOR. typedef typename ITERATOR::difference_type difference_type; + private: + // Define the pair of string and pointer of CONTENT. + typedef boost::shared_ptr<value_type> value_type_shared_ptr; + public: /** Normal constructor. */ BomIterator_T (iterator_type iIterator) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-07-26 14:49:11
|
Revision: 245 http://stdair.svn.sourceforge.net/stdair/?rev=245&view=rev Author: denis_arnaud Date: 2010-07-26 14:49:05 +0000 (Mon, 26 Jul 2010) Log Message: ----------- [Doc] Set up the comments in a few classes so that Doxygen better gets them. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/bom/BomContent.hpp trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomStructure.hpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryContent.hpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,13 @@ +/** + * @brief Handle on the StdAir library context + * @author Anh Quan Nguyen <qua...@us...> + * @date 20/01/2010 + * @detail StdAir aims at providing a clean API, and the corresponding + * C++ implementation, for the basis of Airline IT Business Object + * Model (BOM), that is, to be used by several other Open Source + * projects, such as RMOL and OpenTREP<br> + * Install the StdAir library for Airline IT Standard C++ fundaments. + */ #ifndef __STDAIR_SVC_STDAIR_SERVICE_HPP #define __STDAIR_SVC_STDAIR_SERVICE_HPP @@ -12,69 +22,103 @@ namespace stdair { - // Forward declarations + /// Forward declarations class BomRoot; - /** Interface for the STDAIR Services. */ + /** + * @brief Interface for the STDAIR Services + */ class STDAIR_Service { public: // ////////// Constructors and destructors ////////// - /** Constructor. - <br>The init() method is called; see the corresponding documentation - for more details. - <br>Moreover, a reference on an output stream is given, so - that log outputs can be directed onto that stream. - @param const BasLogParams& Parameters for the output log stream. */ + /** + * @brief Constructor. + * <br>The init() method is called; see the corresponding + * documentation for more details. + * <br>Moreover, a reference on an output stream is given, so + * that log outputs can be directed onto that stream. + * @param[in] const BasLogParams& Parameters for the output log stream. + */ STDAIR_Service (const BasLogParams&); - /** Constructor. - <br>The init() method is called; see the corresponding documentation - for more details. - <br>A reference on an output stream is given, so - that log outputs can be directed onto that stream. - <br>Moreover, database connection parameters are given, so - that database requests can use the corresponding access. - @param const BasLogParams& Parameters for the output log stream. - @param const BasDBParams& Parameters for the database session. */ + /** + * @brief Constructor. + * <br>The init() method is called; see the corresponding + * documentation for more details. + * <br>A reference on an output stream is given, so + * that log outputs can be directed onto that stream. + * <br>Moreover, database connection parameters are given, so + * that database requests can use the corresponding access. + * @param[in] const BasLogParams& Parameters for the output log stream. + * @param[in] const BasDBParams& Parameters for the database session. + */ STDAIR_Service (const BasLogParams&, const BasDBParams&); - /** Destructor. */ + /** + * @brief Destructor. + */ ~STDAIR_Service(); // ///////////////// Getters /////////////////// - /** Get a reference on the BomRoot object. - <br>If the service context has not been initialised, that - method throws an exception (failing assertion). */ + /** + * @brief Get a reference on the BomRoot object. + * <br>If the service context has not been initialised, that + * method throws an exception (failing assertion). + * @param[out] BomRoot& Reference on the BomRoot. + */ BomRoot& getBomRoot () const { return _bomRoot; } private: // /////// Construction and Destruction helper methods /////// - /** Default constructor. */ + /** + * @brief Default constructor. + */ STDAIR_Service (); - /** Default copy constructor. */ + + /** + * @brief Default copy constructor. + * @param[in] const STDAIR_Service& Reference on the STDAIR_Service handler + * to be copied. + */ STDAIR_Service (const STDAIR_Service&); - /** Initialise the log. */ + + /** + * @brief Initialise the log. + * @param[in] const BasLogParams& Parameters for the output log stream. + */ void logInit (const BasLogParams&); - /** Initialise the database session. */ + + /** + * @brief Initialise the database session. + * @param[in] const BasDBParams& Parameters for the database session. + */ void dbInit (const BasDBParams&); - /** Initialise. - <br>The static instance of the log service (Logger object) is created. - <br>The static instance of the database session manager - (DBSessionManager object) is created. - <br>The static instance of the FacSupervisor object, itself referencing - all the other objects (factories and BOM), is created. - <br>As those three objects are static, there is no need to store them - in any service context. However, some lock mechanism may be needed - in order to secure the access to the corresponding resources. */ + + /** + * @brief Initialise. + * <br>The static instance of the log service (Logger object) is created. + * <br>The static instance of the database session manager + * (DBSessionManager object) is created. + * <br>The static instance of the FacSupervisor object, itself referencing + * all the other objects (factories and BOM), is created. + * <br>As those three objects are static, there is no need to store them + * in any service context. However, some lock mechanism may be needed + * in order to secure the access to the corresponding resources. + */ void init (); - /** Finalise. */ + + /** + * @brief Finalise. + */ void finalise (); private: // /////////////// Attributes /////////////// - /** Root of the BOM tree. */ + /** + * @brief Root of the BOM tree. + */ BomRoot& _bomRoot; }; } Modified: trunk/stdair/stdair/bom/BomContent.hpp =================================================================== --- trunk/stdair/stdair/bom/BomContent.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/bom/BomContent.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,8 @@ +/** + * @defgroup BomContent Content part of the Business Object Model (BOM) + * @author Anh Quan Nguyen <qua...@us...> + * @date 20/01/2010 + */ #ifndef __STDAIR_BOM_BOMCONTENT_HPP #define __STDAIR_BOM_BOMCONTENT_HPP @@ -7,12 +12,14 @@ // STL #include <iosfwd> #include <string> -// STDAIR +// StdAir #include <stdair/STDAIR_Types.hpp> namespace stdair { - /** Base class for the Business Object Model (BOM) layer. */ + /** + * @brief Base class for the Business Object Model (BOM) layer + */ class BomContent { friend class FacBomContent; public: Modified: trunk/stdair/stdair/bom/BomKey.hpp =================================================================== --- trunk/stdair/stdair/bom/BomKey.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/bom/BomKey.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,9 @@ +/** + * @defgroup BomKey Part of the Business Object Model (BOM) handling + * (hash-like )keys + * @author Anh Quan Nguyen <qua...@us...> + * @date 20/01/2010 + */ #ifndef __STDAIR_BOM_BOMKEY_HPP #define __STDAIR_BOM_BOMKEY_HPP @@ -12,31 +18,43 @@ namespace stdair { - /** Base class for the keys of Business Object Model (BOM) layer. - <br>Note that that key allows to differentiate two objects - 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. */ + /** + * @brief Base class for the keys of Business Object Model (BOM) layer. + * <br>Note that that key allows to differentiate two objects + * 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. + */ struct BomKey_T { public: // /////////// Display support methods ///////// - /** Dump a Business Object Key into an output stream. - @param ostream& the output stream. */ + /** + * @brief Dump a Business Object Key into an output stream. + * @param[inout] ostream& the output stream. + */ virtual void toStream (std::ostream& ioOut) const {} - /** Read a Business Object Key from an input stream. - @param istream& the input stream. */ + /** + * @brief Read a Business Object Key from an input stream. + * @param[inout] istream& the input stream. + */ virtual 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. */ + /** + * @brief 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. + * @param[out] const std::string The serialised version of the Business + * Object Key. + */ virtual const std::string toString() const { return std::string("Hello!"); } - /** Default destructor. */ + /** + * @brief Default destructor. + */ virtual ~BomKey_T() {} }; Modified: trunk/stdair/stdair/bom/BomStructure.hpp =================================================================== --- trunk/stdair/stdair/bom/BomStructure.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/bom/BomStructure.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,8 @@ +/** + * @defgroup BomStructure Structure part of the Business Object Model (BOM) + * @author Anh Quan Nguyen <qua...@us...> + * @date 20/01/2010 + */ #ifndef __STDAIR_BOM_BOMSTRUCTURE_HPP #define __STDAIR_BOM_BOMSTRUCTURE_HPP @@ -12,7 +17,9 @@ namespace stdair { - /** Base class for the Business Object Model (BOM) tree structure. */ + /** + * @brief Base class for the Business Object Model (BOM) tree structure. + */ class BomStructure { friend class FacBomStructure; friend class FacBomContent; Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,6 @@ +/** + * @ingroup BomStructure + */ #ifndef __STDAIR_BOM_INVENTORY_HPP #define __STDAIR_BOM_INVENTORY_HPP @@ -18,6 +21,7 @@ #include <stdair/bom/FlightPeriodTypes.hpp> namespace stdair { + // Forward declarations class BomRoot; class FlightDate; @@ -26,8 +30,10 @@ struct FlightDateKey_T; struct FlightPeriodKey_T; - /** Class representing the actual functional/business content for - an airline inventory. */ + /** + * @brief Class representing the actual functional/business content for + * an airline inventory. + */ class Inventory : public InventoryContent { friend class FacBomContent; Modified: trunk/stdair/stdair/bom/InventoryContent.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryContent.hpp 2010-07-26 12:09:21 UTC (rev 244) +++ trunk/stdair/stdair/bom/InventoryContent.hpp 2010-07-26 14:49:05 UTC (rev 245) @@ -1,3 +1,6 @@ +/** + * @ingroup BomContent + */ #ifndef __STDAIR_BOM_INVENTORYCONTENT_HPP #define __STDAIR_BOM_INVENTORYCONTENT_HPP @@ -4,15 +7,18 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STDAIR +// StdAir #include <stdair/bom/BomContent.hpp> #include <stdair/bom/InventoryKey.hpp> namespace stdair { - /** Class representing the actual attributes for an airline inventory. */ + /** + * @brief 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 Key_T; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-08-08 16:01:14
|
Revision: 262 http://stdair.svn.sourceforge.net/stdair/?rev=262&view=rev Author: denis_arnaud Date: 2010-08-08 16:01:06 +0000 (Sun, 08 Aug 2010) Log Message: ----------- [Dev] Made the code compatible with g++ 4.1 and Boost 1.33 compilation (though, there is still some work to replace the corresponding Boost features). Modified Paths: -------------- trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/DemandStreamContent.cpp trunk/stdair/stdair/bom/DoWStruct.cpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPeriodContent.cpp trunk/stdair/stdair/factory/FacBomContent.hpp Modified: trunk/stdair/stdair/bom/BomManager.cpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.cpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/bom/BomManager.cpp 2010-08-08 16:01:06 UTC (rev 262) @@ -5,6 +5,7 @@ #include <cassert> #include <ostream> // StdAir +#include <stdair/STDAIR_Types.hpp> #include <stdair/basic/BasConst_BomManager.hpp> #include <stdair/bom/BomSource.hpp> #include <stdair/bom/BookingRequestStruct.hpp> @@ -109,20 +110,20 @@ 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() << ", " + const DateOffset_T lDateOffset = lCurrentLD.getDateOffset(); + oStream << iFlightDate.getFlightNumber(); + oStream << " (" << iFlightDate.getFlightDate() << "), "; + oStream << lCurrentLD.getBoardingPoint() << "-"; + oStream << lCurrentLD.getOffPoint() << ", "; + oStream << lCurrentLD.getBoardingDate() << " -> "; + oStream << lCurrentLD.getOffDate() << " / "; + oStream << lDateOffset.days() << ", "; + oStream << lCurrentLD.getBoardingTime() << " -> "; + oStream << lCurrentLD.getOffTime() << " ("; + oStream << lCurrentLD.getTimeOffset() << ") / "; + oStream << lCurrentLD.getElapsedTime() << ", "; + oStream << lCurrentLD.getDistance() << ", "; + oStream << lCurrentLD.getCapacity() << ", " << std::endl; } oStream << "******************************************" << std::endl; @@ -243,13 +244,14 @@ for (SegmentCabinList_T::iterator itSC = lSCList.begin(); itSC != lSCList.end(); ++itSC) { const SegmentCabin& lCurrentSC = *itSC; + const DateOffset_T lDateOffset = lCurrentSD.getDateOffset(); oStream << lCurrentSD.getBoardingPoint() << "-" << lCurrentSD.getOffPoint() << ", " << lCurrentSC.getCabinCode() << ", " << lCurrentSD.getBoardingDate() << " -> " << lCurrentSD.getOffDate() << " / " - << lCurrentSD.getDateOffset() << ", " + << lDateOffset.days() << ", " << lCurrentSD.getBoardingTime() << " -> " << lCurrentSD.getOffTime() << " (" << lCurrentSD.getTimeOffset() << ") / " Modified: trunk/stdair/stdair/bom/DemandStreamContent.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStreamContent.cpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/bom/DemandStreamContent.cpp 2010-08-08 16:01:06 UTC (rev 262) @@ -6,10 +6,8 @@ #include <iosfwd> #include <ostream> #include <sstream> -// Boost -#include <boost/math/distributions/normal.hpp> // Math -#include <math.h> +#include <cmath> // STDAIR #include <stdair/basic/BasConst_General.hpp> #include <stdair/bom/DemandStreamContent.hpp> Modified: trunk/stdair/stdair/bom/DoWStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.cpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/bom/DoWStruct.cpp 2010-08-08 16:01:06 UTC (rev 262) @@ -80,7 +80,7 @@ // //////////////////////////////////////////////////////////////////// void DoWStruct_T::setDayOfWeek (const unsigned short i, const bool iBool) { - assert (i >= 0 && i < 7); + assert (i < 7); _dowList.at (i) = iBool; } Modified: trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp 2010-08-08 16:01:06 UTC (rev 262) @@ -51,7 +51,8 @@ for (DateOffsetList_T::const_iterator itOffset = _boardingDateOffsetList.begin(); itOffset != _boardingDateOffsetList.end(); ++itOffset) { - oStr << *itOffset << ", "; + const DateOffset_T& lDateOffset = *itOffset; + oStr << lDateOffset.days() << ", "; } oStr << _nbOfAirlines ; Modified: trunk/stdair/stdair/bom/SegmentPeriodContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPeriodContent.cpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/bom/SegmentPeriodContent.cpp 2010-08-08 16:01:06 UTC (rev 262) @@ -11,7 +11,7 @@ // //////////////////////////////////////////////////////////////////// SegmentPeriodContent::SegmentPeriodContent (const Key_T& iKey) - : _key (iKey) { + : _key (iKey), _boardingDateOffset (0), _offDateOffset (0) { } // //////////////////////////////////////////////////////////////////// @@ -23,9 +23,9 @@ addCabinBookingClassList (const CabinCode_T& iCabinCode, const ClassList_String_T& iClassCodeList) { const bool insert = _cabinBookingClassMap. - insert (CabinBookingClassMap_T::value_type (iCabinCode, iClassCodeList)).second; - assert (insert == true); + insert (CabinBookingClassMap_T::value_type (iCabinCode, + iClassCodeList)).second; + assert (insert == true); } } - Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-08-07 19:21:59 UTC (rev 261) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-08-08 16:01:06 UTC (rev 262) @@ -10,6 +10,10 @@ #include <boost/version.hpp> #if BOOST_VERSION >= 103500 #include <boost/fusion/include/at_key.hpp> +#else // BOOST_VERSION >= 103500 +/** \todo Find a better alternative for boost::fusion::at_key() + for Boost 1.33 */ +#include <boost/spirit/fusion/iterator/next.hpp> #endif // BOOST_VERSION >= 103500 // StdAir #include <stdair/STDAIR_Types.hpp> @@ -124,6 +128,7 @@ template <typename PARENT, typename CHILD> static void cloneChildrenHolder (PARENT& ioParent, const PARENT& iReferenceParent) { +#if BOOST_VERSION >= 103500 // Clone the list of children. typedef BomChildrenHolderImp<CHILD> CHILDREN_HOLDER_T; CHILDREN_HOLDER_T*& lChildrenHolder_ptr = @@ -135,6 +140,7 @@ FacBomStructure:: cloneChildrenHolder (lChildrenHolder_ptr, *lReferenceChildrenHolder_ptr); +#endif // BOOST_VERSION >= 103500 } private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-08-13 14:41:28
|
Revision: 265 http://stdair.svn.sourceforge.net/stdair/?rev=265&view=rev Author: denis_arnaud Date: 2010-08-13 14:41:22 +0000 (Fri, 13 Aug 2010) Log Message: ----------- [Dev] Added a pragma check for non-Fedora SOCI distributions. Modified Paths: -------------- trunk/stdair/stdair/dbadaptor/DbaAirline.hpp trunk/stdair/stdair/service/DBSessionManager.cpp Modified: trunk/stdair/stdair/dbadaptor/DbaAirline.hpp =================================================================== --- trunk/stdair/stdair/dbadaptor/DbaAirline.hpp 2010-08-13 14:37:26 UTC (rev 264) +++ trunk/stdair/stdair/dbadaptor/DbaAirline.hpp 2010-08-13 14:41:22 UTC (rev 265) @@ -5,7 +5,11 @@ // Import section // ////////////////////////////////////////////////////////////////////// // SOCI +#if defined(SOCI_HEADERS_BURIED) #include <soci/core/soci.h> +#else // SOCI_HEADERS_BURIED +#include <soci.h> +#endif // SOCI_HEADERS_BURIED // Forward declarations namespace stdair { Modified: trunk/stdair/stdair/service/DBSessionManager.cpp =================================================================== --- trunk/stdair/stdair/service/DBSessionManager.cpp 2010-08-13 14:37:26 UTC (rev 264) +++ trunk/stdair/stdair/service/DBSessionManager.cpp 2010-08-13 14:41:22 UTC (rev 265) @@ -6,8 +6,13 @@ #include <string> #include <sstream> // SOCI +#if defined(SOCI_HEADERS_BURIED) #include <soci/core/soci.h> #include <soci/backends/mysql/soci-mysql.h> +#else // SOCI_HEADERS_BURIED +#include <soci.h> +#include <soci-mysql.h> +#endif // SOCI_HEADERS_BURIED // StdAir #include <stdair/basic/BasDBParams.hpp> #include <stdair/service/DBSessionManager.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |