From: <den...@us...> - 2010-09-12 19:11:50
|
Revision: 324 http://stdair.svn.sourceforge.net/stdair/?rev=324&view=rev Author: denis_arnaud Date: 2010-09-12 19:11:43 +0000 (Sun, 12 Sep 2010) Log Message: ----------- [Test] Added a test sub-directory for Boost.Intrusive-based architecture. Modified Paths: -------------- trunk/stdair/test/archi_intru/BomAbstract.hpp trunk/stdair/test/archi_intru/BomRoot.hpp trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp trunk/stdair/test/archi_intru/FacRelationShipRootAbstract.hpp trunk/stdair/test/archi_intru/FacSupervisor.cpp trunk/stdair/test/archi_intru/FacSupervisor.hpp trunk/stdair/test/archi_intru/RelationShipHolder.hpp trunk/stdair/test/archi_intru/TestBomUsage.cpp trunk/stdair/test/archi_intru/TestBomUsage.hpp trunk/stdair/test/archi_intru/TestIntrusive.cpp trunk/stdair/test/archi_intru/sources.mk Added Paths: ----------- trunk/stdair/test/archi_intru/FacAbstract.hpp trunk/stdair/test/archi_intru/FacBom.hpp trunk/stdair/test/archi_intru/IntrusiveHelper.hpp trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp Modified: trunk/stdair/test/archi_intru/BomAbstract.hpp =================================================================== --- trunk/stdair/test/archi_intru/BomAbstract.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/BomAbstract.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -121,36 +121,4 @@ return ioIn; } - -/** The disposer object function. */ -template <typename BOM> -struct delete_disposer { - void operator() (BOM* oBOM_ptr) { - delete oBOM_ptr; oBOM_ptr = NULL; - } -}; - -// These compare (STL strings) keys of BOM objects -template <typename BOM> -struct StrExpComp { - bool operator() (const std::string& iKey, const BOM& iBom) const { - return (iKey < iBom.getKey()); - } - - bool operator() (const BOM& iBom, const std::string& iKey) const { - return (iBom.getKey() < iKey); - } -}; - -template <typename BOM> -struct StrExpEqual { - bool operator() (const std::string& iKey, const BOM& iBom) const { - return (iKey == iBom.getKey()); - } - - bool operator() (const BOM& iBom, const std::string& iKey) const { - return (iBom.getKey() == iKey); - } -}; - #endif // __INTRUSIVE_BOM_BOMABSTRACT_HPP Modified: trunk/stdair/test/archi_intru/BomRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -7,9 +7,15 @@ // STL #include <cassert> #include <string> -// +// Boost.Intrusive +#include <boost/intrusive/list.hpp> +#include <boost/intrusive/set.hpp> +// Local #include <test/archi_intru/BomAbstract.hpp> +/** Alias for the boost::intrusive namespace. */ +namespace bi = boost::intrusive; + namespace stdair { /** BomRoot. */ @@ -19,6 +25,10 @@ BomRoot (const int idx) : BomAbstract (idx) {} public: + bi::list_member_hook<> _childListHook; + bi::set_member_hook<> _childSetHook; + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ Added: trunk/stdair/test/archi_intru/FacAbstract.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacAbstract.hpp (rev 0) +++ trunk/stdair/test/archi_intru/FacAbstract.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -0,0 +1,22 @@ +#ifndef __INTRUSIVE_FAC_FACABSTRACT_HPP +#define __INTRUSIVE_FAC_FACABSTRACT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +namespace stdair { + + /** Base class for Factory layer. */ + class FacAbstract { + public: + /** Destructor. */ + virtual ~FacAbstract() {} + + protected: + /** Default Constructor. + <br>This constructor is protected to ensure the class is abstract. */ + FacAbstract() {} + }; +} +#endif // __INTRUSIVE_FAC_FACABSTRACT_HPP Added: trunk/stdair/test/archi_intru/FacBom.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacBom.hpp (rev 0) +++ trunk/stdair/test/archi_intru/FacBom.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -0,0 +1,90 @@ +#ifndef __INTRUSIVE_FAC_FACBOM_HPP +#define __INTRUSIVE_FAC_FACBOM_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <string> +// StdAir +#include <test/archi_intru/FacAbstract.hpp> +#include <test/archi_intru/FacSupervisor.hpp> + +namespace stdair { + + /** Class for handling the memory related to BOM objects. */ + template <typename BOM> + class FacBom : public FacAbstract { + // Internal type definitions. + typedef std::list<BOM*> BomPool_T; + + public: + // ///////////// Business methods. //////////// + /** Provide the unique instance. + <br>The singleton is instantiated when first used. + @return FacBom& */ + static FacBom& instance() { + if (_instance == NULL) { + _instance = new FacBom (); + assert (_instance != NULL); + + FacSupervisor::instance().registerFacBom (_instance); + } + return *_instance; + } + + /** Create a BOM object for a given key. */ + BOM& create (const std::string& iKey) { + BOM* oBom_ptr = new BOM (iKey); + assert (oBom_ptr != NULL); + _pool.push_back (oBom_ptr); + return *oBom_ptr; + } + + /** Create a BOM object for a given key. */ + BOM& create (const int& idx) { + BOM* oBom_ptr = new BOM (idx); + assert (oBom_ptr != NULL); + _pool.push_back (oBom_ptr); + return *oBom_ptr; + } + + protected: + /** Default Constructor. + <br>This constructor is protected to ensure the class is . */ + FacBom() {} + + public: + /** Destructor. */ + ~FacBom() { clean(); } + + /** Destroyed all the object instantiated by this factory. */ + void clean() { + // Destroy all the objects + for (typename BomPool_T::iterator itBom = _pool.begin(); + itBom != _pool.end(); ++itBom) { + BOM* currentBom_ptr = *itBom; + assert (currentBom_ptr != NULL); + delete currentBom_ptr; currentBom_ptr = NULL; + } + + // Empty the pool. + _pool.clear(); + + // Reset the static instance. + _instance = NULL; + } + + private: + /** The unique instance.*/ + static FacBom* _instance; + /** List of instantiated Business Objects*/ + BomPool_T _pool; + }; + + // //////////////////////////////////////////////////////////////////// + template <typename BOM> FacBom<BOM>* FacBom<BOM>::_instance = NULL; + +} +#endif // __INTRUSIVE_FAC_FACBOM_HPP Modified: trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -9,6 +9,7 @@ #include <boost/intrusive/set.hpp> // Local #include <test/archi_intru/FacSupervisor.hpp> +#include <test/archi_intru/FacRelationShipRootAbstract.hpp> #include <test/archi_intru/RelationShipHolder.hpp> /** Alias for the boost::intrusive namespace. */ @@ -18,15 +19,24 @@ /** Class holding the list of all the relationship objects of a given type. */ template <typename FIRST_BOM, typename SECOND_BOM> - class FacRelationShipRoot { + class FacRelationShipRoot : public FacRelationShipRootAbstract { public: // /////////////////////////////////////////// + /** Type definition for the specific relationship. */ + typedef RelationShipHolder<FIRST_BOM, SECOND_BOM> RelationShipHolder_T; + /** Type definition for a list of relationship holder objects. */ - typedef bi::list<RelationShipHolder<FIRST_BOM, - SECOND_BOM> > RelationShipHolderList_T; + typedef bi::member_hook <RelationShipHolder_T, + bi::list_member_hook<>, + &RelationShipHolder_T::_childListHook> RSHolderListMemberOption; + typedef bi::list<RelationShipHolder_T, + RSHolderListMemberOption> RelationShipHolderList_T; /** Type definition for a set of relationship holder objects. */ - typedef bi::set<RelationShipHolder<FIRST_BOM, - SECOND_BOM> > RelationShipHolderSet_T; + typedef bi::member_hook <RelationShipHolder_T, + bi::set_member_hook<>, + &RelationShipHolder_T::_childSetHook> RSHolderSetMemberOption; + typedef bi::set<RelationShipHolder_T, + RSHolderSetMemberOption> RelationShipHolderSet_T; // /////////////////////////////////////////// public: @@ -51,8 +61,10 @@ /** Add a child/sibling to the dedicated list of the parent/sibling. */ void addToListImpl (FIRST_BOM& ioFirstBom, SECOND_BOM& ioSecondBom) { - _relationShipHolderList.push_back (ioFirstBom, ioSecondBom); - _relationShipHolderSet.insert (ioFirstBom, ioSecondBom); + RelationShipHolder_T* lRS_ptr = new RelationShipHolder_T (ioFirstBom, + ioSecondBom); + _relationShipHolderList.push_back (*lRS_ptr); + _relationShipHolderSet.insert (*lRS_ptr); } private: Modified: trunk/stdair/test/archi_intru/FacRelationShipRootAbstract.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRootAbstract.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/FacRelationShipRootAbstract.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -1,5 +1,5 @@ -#ifndef __INTRUSIVE_BOM_RELATIONSHIPABSTRACT_HPP -#define __INTRUSIVE_BOM_RELATIONSHIPABSTRACT_HPP +#ifndef __INTRUSIVE_BOM_FACRELATIONSHIPROOTABSTRACT_HPP +#define __INTRUSIVE_BOM_FACRELATIONSHIPROOTABSTRACT_HPP // ////////////////////////////////////////////////////////////////////// // Import section @@ -7,8 +7,6 @@ // STL #include <iosfwd> #include <string> -// StdAir -#include <stdair/STDAIR_Types.hpp> namespace stdair { @@ -26,4 +24,4 @@ }; } -#endif // __INTRUSIVE_BOM_RELATIONSHIPABSTRACT_HPP +#endif // __INTRUSIVE_BOM_FACRELATIONSHIPROOTABSTRACT_HPP Modified: trunk/stdair/test/archi_intru/FacSupervisor.cpp =================================================================== --- trunk/stdair/test/archi_intru/FacSupervisor.cpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/FacSupervisor.cpp 2010-09-12 19:11:43 UTC (rev 324) @@ -5,6 +5,7 @@ #include <cassert> // Local #include <test/archi_intru/FacRelationShipRootAbstract.hpp> +#include <test/archi_intru/FacAbstract.hpp> #include <test/archi_intru/FacSupervisor.hpp> namespace stdair { @@ -22,16 +23,38 @@ // ////////////////////////////////////////////////////////////////////// FacSupervisor::~FacSupervisor() { + cleanBomLayer(); cleanFacRelationShipRoots(); } // ////////////////////////////////////////////////////////////////////// void FacSupervisor:: + registerFacBom (FacAbstract* ioFac_ptr) { + _facPool.push_back (ioFac_ptr); + } + + // ////////////////////////////////////////////////////////////////////// + void FacSupervisor:: registerFacRelationShipRoot (FacRelationShipRootAbstract* ioFacRelationShipRoot_ptr) { _facRelationShipRootPool.push_back (ioFacRelationShipRoot_ptr); } // ////////////////////////////////////////////////////////////////////// + void FacSupervisor::cleanBomLayer() { + for (FactoryPool_T::const_iterator itFactory = + _facPool.begin(); + itFactory != _facPool.end(); itFactory++) { + const FacAbstract* currentFactory_ptr = *itFactory; + assert (currentFactory_ptr != NULL); + + delete (currentFactory_ptr); currentFactory_ptr = NULL; + } + + // Empty the pool of factories + _facPool.clear(); + } + + // ////////////////////////////////////////////////////////////////////// void FacSupervisor::cleanFacRelationShipRoots() { for (FacRelationShipRootPool_T::const_iterator itRS = _facRelationShipRootPool.begin(); Modified: trunk/stdair/test/archi_intru/FacSupervisor.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacSupervisor.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/FacSupervisor.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -10,12 +10,14 @@ namespace stdair { // Forward declarations + class FacAbstract; class FacRelationShipRootAbstract; /** Singleton class to register and clean all Factories. */ class FacSupervisor { public: /** Define the pool (list) of factories. */ + typedef std::list<FacAbstract*> FactoryPool_T; typedef std::list<FacRelationShipRootAbstract*> FacRelationShipRootPool_T; /** Provide the unique (static) instance of the FacSupervisor object. @@ -23,9 +25,21 @@ @return FacSupervisor& */ static FacSupervisor& instance(); + /** Register a newly instantiated concrete factory for the + Bom layer. + <br>When a concrete Factory is firstly instantiated + this factory have to register itself to the FacSupervisor + @param FacBom* The concrete Factory to register. */ + void registerFacBom (FacAbstract*); + /** Register a newly instantiated concrete relation ship factory. */ void registerFacRelationShipRoot (FacRelationShipRootAbstract*); + /** Clean all registered object. + <br>Call the clean method of all the instantiated factories + for the BomStructure layer. */ + void cleanBomLayer(); + /** Clean all registered relation ships. */ void cleanFacRelationShipRoots(); @@ -50,6 +64,8 @@ private: /** The unique instance.*/ static FacSupervisor* _instance; + /** List of instantiated factories for the BOM layer. */ + FactoryPool_T _facPool; /** List of instantiated relation ships. */ FacRelationShipRootPool_T _facRelationShipRootPool; }; Added: trunk/stdair/test/archi_intru/IntrusiveHelper.hpp =================================================================== --- trunk/stdair/test/archi_intru/IntrusiveHelper.hpp (rev 0) +++ trunk/stdair/test/archi_intru/IntrusiveHelper.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -0,0 +1,44 @@ +#ifndef __INTRUSIVE_BOM_INTRUSIVEHELPER_HPP +#define __INTRUSIVE_BOM_INTRUSIVEHELPER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iosfwd> +#include <sstream> +#include <string> + +/** The disposer object function. */ +template <typename NODE> +struct delete_disposer { + void operator() (NODE* oNODE_ptr) { + delete oNODE_ptr; oNODE_ptr = NULL; + } +}; + +// These compare (STL strings) keys of NODE objects +template <typename NODE> +struct StrExpComp { + bool operator() (const std::string& iKey, const NODE& iBom) const { + return (iKey < iBom.getKey()); + } + + bool operator() (const NODE& iBom, const std::string& iKey) const { + return (iBom.getKey() < iKey); + } +}; + +template <typename NODE> +struct StrExpEqual { + bool operator() (const std::string& iKey, const NODE& iBom) const { + return (iKey == iBom.getKey()); + } + + bool operator() (const NODE& iBom, const std::string& iKey) const { + return (iBom.getKey() == iKey); + } +}; + +#endif // __INTRUSIVE_BOM_INTRUSIVEHELPER_HPP Modified: trunk/stdair/test/archi_intru/RelationShipHolder.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -4,8 +4,10 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// Boost.Intrusive -#include <boost/intrusive/list.hpp> +// STL +#include <string> +// Local +#include <test/archi_intru/RelationShipHolderAbstract.hpp> /** Alias for the boost::intrusive namespace. */ namespace bi = boost::intrusive; @@ -15,23 +17,43 @@ /** Class holding relationship objects between either a parent Bom and its children or a Bom object and its siblings. */ template <typename FIRST_BOM, typename SECOND_BOM> - class RelationShipHolder { + class RelationShipHolder : public RelationShipHolderAbstract { public: // /////////////////////////////////////////// /** Type definition for a list of either children or siblings. */ - typedef bi::list<SECOND_BOM> SecondBomList_T; - - /** Type definition for a relationship, holding a list of children - or siblings for a given parent/Bom object. - <br>The list has got only two elements. A list is used only because - the pair does not exist (yet?) within boost::intrusive. */ - typedef bi::list<FIRST_BOM, SecondBomList_T> RelationShip_T; + typedef bi::member_hook <SECOND_BOM, + bi::list_member_hook<>, + &SECOND_BOM::_childListHook> SecondBomListMemberOption; + typedef bi::list<SECOND_BOM, SecondBomListMemberOption> SecondBomList_T; // /////////////////////////////////////////// + public: + RelationShipHolder (FIRST_BOM& ioFirstBom, SECOND_BOM& ioSecondBom) + : _firstBom (ioFirstBom) { + } + + public: + bi::list_member_hook<> _childListHook; + bi::set_member_hook<> _childSetHook; + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { 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 _key; }; + private: /** Relationship, holding a list of children or siblings for a given parent/Bom object. */ - RelationShip_T _relationShip; + FIRST_BOM& _firstBom; + SecondBomList_T _secondBomList; }; } Copied: trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp (from rev 318, trunk/stdair/test/archi_intru/BomAbstract.hpp) =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp (rev 0) +++ trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -0,0 +1,128 @@ +#ifndef __INTRUSIVE_BOM_RELATIONSHIPHOLDERABSTRACT_HPP +#define __INTRUSIVE_BOM_RELATIONSHIPHOLDERABSTRACT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iosfwd> +#include <sstream> +#include <string> +// Boost.Intrusive +#include <boost/functional/hash.hpp> + +namespace stdair { + + /** RelationShipHolderAbstract. */ + class RelationShipHolderAbstract { + public: + /** Constructors. */ + RelationShipHolderAbstract (const std::string& iKey) : _key (iKey) {} + RelationShipHolderAbstract (const int idx) { + std::ostringstream oStr; + oStr << idx; + _key = oStr.str(); + } + /** Get the key. */ + const std::string& getKey() const { + return _key; + } + + protected: + /** Default constructors. + <br>They are kept private, so as to forbid their use (only the + public constructors should be used). */ + RelationShipHolderAbstract () {} + RelationShipHolderAbstract (const RelationShipHolderAbstract&) {} + + public: + // Comparison operators + friend bool operator< (const RelationShipHolderAbstract& a, + const RelationShipHolderAbstract& b) { + return a._key < b._key; + } + + friend bool operator> (const RelationShipHolderAbstract& a, + const RelationShipHolderAbstract& b) { + return a._key > b._key; + } + + friend bool operator== (const RelationShipHolderAbstract& a, + const RelationShipHolderAbstract& b) { + return a._key == b._key; + } + + friend bool operator!= (const RelationShipHolderAbstract& a, + const RelationShipHolderAbstract& b) { + return a._key != b._key; + } + + // The hash function + friend std::size_t hash_value (const RelationShipHolderAbstract& iRelationShipHolder) { + return boost::hash<std::string>() (iRelationShipHolder._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; + + protected: + std::string _key; + }; + +} + +/** + Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing + Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial + and Reference", published by Addison-Wesley. + */ +template <class charT, class traits> +inline +std::basic_ostream<charT, traits>& +operator<< (std::basic_ostream<charT, traits>& ioOut, + const stdair::RelationShipHolderAbstract& iRelationShipHolder) { + /** + string stream: + - with same format + - without special field width + */ + std::basic_ostringstream<charT,traits> ostr; + ostr.copyfmt (ioOut); + ostr.width (0); + + // Fill string stream + iRelationShipHolder.toStream (ostr); + + // Print string stream + ioOut << ostr.str(); + + return ioOut; +} + +/** + Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing + Output Operators" (pp655-657) of his book "The C++ Standard Library: + A Tutorial and Reference", published by Addison-Wesley. + */ +template <class charT, class traits> +inline +std::basic_istream<charT, traits>& +operator>> (std::basic_istream<charT, traits>& ioIn, + stdair::RelationShipHolderAbstract& ioRelationShipHolder) { + // Fill RelationShipHolder object with input stream + ioRelationShipHolder.fromStream (ioIn); + return ioIn; +} + +#endif // __INTRUSIVE_BOM_RELATIONSHIPHOLDERABSTRACT_HPP Modified: trunk/stdair/test/archi_intru/TestBomUsage.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 19:11:43 UTC (rev 324) @@ -10,7 +10,10 @@ // Boost #include <boost/intrusive/list.hpp> // Local +#include <test/archi_intru/BomRoot.hpp> #include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/FacBom.hpp> +#include <test/archi_intru/FacRelationShipRoot.hpp> #include <test/archi_intru/TestBomUsage.hpp> /** Alias for the boost::intrusive namespace. */ @@ -30,6 +33,24 @@ } // ////////////////////////////////////////////////////////////////////// +bool TestBomUsage::testBomBuilding() { + bool oTestSuccessfull = true; + + const std::string br0 ("BR"); + stdair::BomRoot& lBomRoot = + stdair::FacBom<stdair::BomRoot>::instance().create (br0); + + const std::string fdba117 ("BA117"); + stdair::FlightDate& lFDBA117 = + stdair::FacBom<stdair::FlightDate>::instance().create (fdba117); + + stdair::FacRelationShipRoot<stdair::BomRoot, + stdair::FlightDate>::addToList(lBomRoot,lFDBA117); + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// bool TestBomUsage::test() { bool oTestSuccessfull = true; Modified: trunk/stdair/test/archi_intru/TestBomUsage.hpp =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.hpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/TestBomUsage.hpp 2010-09-12 19:11:43 UTC (rev 324) @@ -18,6 +18,10 @@ public: /** Perform the full test set. */ static bool test(); + +private: + /** Test the building of the BOM tree. */ + bool testBomBuilding(); private: /** Initialise. */ Modified: trunk/stdair/test/archi_intru/TestIntrusive.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestIntrusive.cpp 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/TestIntrusive.cpp 2010-09-12 19:11:43 UTC (rev 324) @@ -10,7 +10,9 @@ // Boost #include <boost/intrusive/list.hpp> // Local +#include <test/archi_intru/FacBom.hpp> #include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/IntrusiveHelper.hpp> #include <test/archi_intru/TestIntrusive.hpp> /** Alias for the boost::intrusive namespace. */ @@ -31,10 +33,10 @@ void TestIntrusive::initStandard() { // Create several FlightDate objects, each one with a different value for (int idx = 0; idx < 100; ++idx) { - stdair::FlightDate* lFlightDate_ptr = new stdair::FlightDate (idx); - assert (lFlightDate_ptr != NULL); - - _flightDateVector.push_back (lFlightDate_ptr); + stdair::FlightDate& lFlightDate = + stdair::FacBom<stdair::FlightDate>::instance().create (idx); + + _flightDateVector.push_back (&lFlightDate); } } Modified: trunk/stdair/test/archi_intru/sources.mk =================================================================== --- trunk/stdair/test/archi_intru/sources.mk 2010-09-12 17:23:08 UTC (rev 323) +++ trunk/stdair/test/archi_intru/sources.mk 2010-09-12 19:11:43 UTC (rev 324) @@ -1,7 +1,11 @@ archi_intru_h_sources = \ $(top_srcdir)/test/archi_intru/FacSupervisor.hpp \ + $(top_srcdir)/test/archi_intru/FacAbstract.hpp \ + $(top_srcdir)/test/archi_intru/FacBom.hpp \ $(top_srcdir)/test/archi_intru/FacRelationShipRoot.hpp \ $(top_srcdir)/test/archi_intru/FacRelationShipRootAbstract.hpp \ + $(top_srcdir)/test/archi_intru/IntrusiveHelper.hpp \ + $(top_srcdir)/test/archi_intru/RelationShipHolderAbstract.hpp \ $(top_srcdir)/test/archi_intru/RelationShipHolder.hpp \ $(top_srcdir)/test/archi_intru/BomAbstract.hpp \ $(top_srcdir)/test/archi_intru/BomRoot.hpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |