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