From: <den...@us...> - 2010-09-12 22:29:31
|
Revision: 327 http://stdair.svn.sourceforge.net/stdair/?rev=327&view=rev Author: denis_arnaud Date: 2010-09-12 22:29:25 +0000 (Sun, 12 Sep 2010) Log Message: ----------- [Test] Added a test sub-directory for Boost.Intrusive-based architecture (there is still some work to do). Modified Paths: -------------- trunk/stdair/test/archi_intru/RelationShipHolder.hpp trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp trunk/stdair/test/archi_intru/TestBomUsage.cpp trunk/stdair/test/archi_intru/sources.mk Added Paths: ----------- trunk/stdair/test/archi_intru/BomManager.cpp trunk/stdair/test/archi_intru/BomManager.hpp Added: trunk/stdair/test/archi_intru/BomManager.cpp =================================================================== --- trunk/stdair/test/archi_intru/BomManager.cpp (rev 0) +++ trunk/stdair/test/archi_intru/BomManager.cpp 2010-09-12 22:29:25 UTC (rev 327) @@ -0,0 +1,29 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <sstream> +// Boost.Intrusive +#include <boost/intrusive/list.hpp> +// Local +#include <test/archi_intru/BomRoot.hpp> +#include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/FacRelationShipRoot.hpp> +#include <test/archi_intru/BomManager.hpp> + +namespace stdair { + + // ////////////////////////////////////////////////////////////////////// + std::string BomManager::display (const BomRoot& iBomRoot) { + std::ostringstream oStr; + + // 0. BomRoot level + oStr << "BR[" << iBomRoot << "]" << std::endl; + + // 1. FlightDate level + + return oStr.str(); + } + +} Added: trunk/stdair/test/archi_intru/BomManager.hpp =================================================================== --- trunk/stdair/test/archi_intru/BomManager.hpp (rev 0) +++ trunk/stdair/test/archi_intru/BomManager.hpp 2010-09-12 22:29:25 UTC (rev 327) @@ -0,0 +1,23 @@ +#ifndef __INTRUSIVE_BOM_BOMMANAGER_HPP +#define __INTRUSIVE_BOM_BOMMANAGER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> + +namespace stdair { + + /** Utility class. */ + class BomManager { + public: + /** Display the full BOM tree. */ + static std::string display (const BomRoot&); + + private: + + }; + +} +#endif // __INTRUSIVE_BOM_BOMMANAGER_HPP Modified: trunk/stdair/test/archi_intru/RelationShipHolder.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 22:03:20 UTC (rev 326) +++ trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 22:29:25 UTC (rev 327) @@ -32,9 +32,16 @@ // /////////////////////////////////////////// public: + /** Key calculator. */ + static std::string keyCalculator (const std::string& iKey1, + const std::string& iKey2) { + return (iKey1 + "," + iKey2); + } + + /** Constructor. */ RelationShipHolder (FIRST_BOM& ioFirstBom, SECOND_BOM& ioSecondBom) - : RelationShipHolderAbstract (ioFirstBom.getKey() + "," - + ioSecondBom.getKey()), + : RelationShipHolderAbstract (keyCalculator (ioFirstBom.getKey(), + ioSecondBom.getKey())), _firstBom (ioFirstBom) { } Modified: trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp 2010-09-12 22:03:20 UTC (rev 326) +++ trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp 2010-09-12 22:29:25 UTC (rev 327) @@ -73,9 +73,12 @@ return oSecondBom_ptr; } oRSH_ptr = &*itRSH; - - oSecondBom_ptr = oRSH_ptr->find (iSecondBomKey); + // Calculate the RelationShipHolder key (usually, it is "key1,key2") + const std::string& lRSHKey = + RelationShipHolder_T::keyCalculator (iFirstBom.getKey(), iSecondBomKey); + oSecondBom_ptr = oRSH_ptr->find (lRSHKey); + return oSecondBom_ptr; } Modified: trunk/stdair/test/archi_intru/TestBomUsage.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 22:03:20 UTC (rev 326) +++ trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 22:29:25 UTC (rev 327) @@ -7,13 +7,12 @@ #include <sstream> #include <string> #include <vector> -// 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/BomManager.hpp> #include <test/archi_intru/TestBomUsage.hpp> /** Alias for the boost::intrusive namespace. */ @@ -64,6 +63,9 @@ stdair::FlightDate>::addToList (*_bomRoot, lFDLH434); + // DEBUG + std::cout << stdair::BomManager::display (*_bomRoot); + return oTestSuccessfull; } Modified: trunk/stdair/test/archi_intru/sources.mk =================================================================== --- trunk/stdair/test/archi_intru/sources.mk 2010-09-12 22:03:20 UTC (rev 326) +++ trunk/stdair/test/archi_intru/sources.mk 2010-09-12 22:29:25 UTC (rev 327) @@ -13,9 +13,11 @@ $(top_srcdir)/test/archi_intru/FlightDate.hpp \ $(top_srcdir)/test/archi_intru/LegDate.hpp \ $(top_srcdir)/test/archi_intru/SegmentDate.hpp \ + $(top_srcdir)/test/archi_intru/BomManager.hpp \ $(top_srcdir)/test/archi_intru/TestIntrusive.hpp \ $(top_srcdir)/test/archi_intru/TestBomUsage.hpp archi_intru_cc_sources = \ $(top_srcdir)/test/archi_intru/FacSupervisor.cpp \ + $(top_srcdir)/test/archi_intru/BomManager.cpp \ $(top_srcdir)/test/archi_intru/TestIntrusive.cpp \ $(top_srcdir)/test/archi_intru/TestBomUsage.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |