You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(51) |
Nov
(8) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(32) |
Feb
(47) |
Mar
(6) |
Apr
(19) |
May
(7) |
Jun
(19) |
Jul
(39) |
Aug
(51) |
Sep
(39) |
Oct
(18) |
Nov
(10) |
Dec
(27) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <den...@us...> - 2010-10-14 11:14:17
|
Revision: 345 http://stdair.svn.sourceforge.net/stdair/?rev=345&view=rev Author: denis_arnaud Date: 2010-10-14 11:14:11 +0000 (Thu, 14 Oct 2010) Log Message: ----------- [Release] Back to working version (99.99.99). Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/stdair.spec Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2010-10-14 11:13:10 UTC (rev 344) +++ trunk/stdair/configure.ac 2010-10-14 11:14:11 UTC (rev 345) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>]) -AC_INIT([STDAIR],[0.6.0],[den...@us...],[stdair]) +AC_INIT([STDAIR],[99.99.99],[den...@us...],[stdair]) AC_CONFIG_HEADER([stdair/config.h]) AC_CONFIG_SRCDIR([stdair/bom/BomRoot.hpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # Shared library versioning -GENERIC_LIBRARY_VERSION="0:6:0" +GENERIC_LIBRARY_VERSION="99:99:99" # | | | # +------+ | +---+ # | | | Modified: trunk/stdair/stdair.spec =================================================================== --- trunk/stdair/stdair.spec 2010-10-14 11:13:10 UTC (rev 344) +++ trunk/stdair/stdair.spec 2010-10-14 11:14:11 UTC (rev 345) @@ -2,7 +2,7 @@ %global mydocs __tmp_docdir # Name: stdair -Version: 0.6.0 +Version: 99.99.99 Release: 1%{?dist} Summary: C++ Standard Airline IT Object Library This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-10-14 11:13:16
|
Revision: 344 http://stdair.svn.sourceforge.net/stdair/?rev=344&view=rev Author: denis_arnaud Date: 2010-10-14 11:13:10 +0000 (Thu, 14 Oct 2010) Log Message: ----------- [Release 0.6.0] Release of version 0.6.0. Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/stdair.spec Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2010-10-14 11:10:10 UTC (rev 343) +++ trunk/stdair/configure.ac 2010-10-14 11:13:10 UTC (rev 344) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>]) -AC_INIT([STDAIR],[99.99.99],[den...@us...],[stdair]) +AC_INIT([STDAIR],[0.6.0],[den...@us...],[stdair]) AC_CONFIG_HEADER([stdair/config.h]) AC_CONFIG_SRCDIR([stdair/bom/BomRoot.hpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # Shared library versioning -GENERIC_LIBRARY_VERSION="99:99:99" +GENERIC_LIBRARY_VERSION="0:6:0" # | | | # +------+ | +---+ # | | | Modified: trunk/stdair/stdair.spec =================================================================== --- trunk/stdair/stdair.spec 2010-10-14 11:10:10 UTC (rev 343) +++ trunk/stdair/stdair.spec 2010-10-14 11:13:10 UTC (rev 344) @@ -2,7 +2,7 @@ %global mydocs __tmp_docdir # Name: stdair -Version: 99.99.99 +Version: 0.6.0 Release: 1%{?dist} Summary: C++ Standard Airline IT Object Library @@ -111,9 +111,12 @@ %changelog -* Sun Sep 19 2010 Son Nguyen Kim <ngu...@gm...> 99.99.99-1 +* Thu Oct 21 2010 Son Nguyen Kim <ngu...@gm...> 99.99.99-1 - Upstream update +* Thu Oct 14 2010 Son Nguyen Kim <ngu...@gm...> 0.6.0-1 +- Upstream update + * Thu Sep 16 2010 Son Nguyen Kim <ngu...@gm...> 0.5.0-1 - Upstream update This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-10-14 11:10:17
|
Revision: 343 http://stdair.svn.sourceforge.net/stdair/?rev=343&view=rev Author: denis_arnaud Date: 2010-10-14 11:10:10 +0000 (Thu, 14 Oct 2010) Log Message: ----------- [Branch 0.6.0] Prepared the branch 0.6.0 to be copied from head of the trunk. Added Paths: ----------- branches/stdair/0.6.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gsa...@us...> - 2010-10-13 16:04:06
|
Revision: 342 http://stdair.svn.sourceforge.net/stdair/?rev=342&view=rev Author: gsabatier Date: 2010-10-13 16:04:00 +0000 (Wed, 13 Oct 2010) Log Message: ----------- Added the FareFamily class Modified Paths: -------------- trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/FareFamily.cpp trunk/stdair/stdair/bom/FareFamily.hpp trunk/stdair/stdair/bom/FareFamilyKey.cpp trunk/stdair/stdair/bom/FareFamilyKey.hpp trunk/stdair/stdair/bom/FareFamilyTypes.hpp Added: trunk/stdair/stdair/bom/FareFamily.cpp =================================================================== --- trunk/stdair/stdair/bom/FareFamily.cpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamily.cpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,30 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_Yield.hpp> +#include <stdair/bom/FareFamily.hpp> + +namespace stdair { + + + // //////////////////////////////////////////////////////////////////// + FareFamily::FareFamily (const Key_T& iKey) : _key (iKey), _parent (NULL) { + } + + // //////////////////////////////////////////////////////////////////// + FareFamily::~FareFamily () { + } + + // //////////////////////////////////////////////////////////////////// + std::string FareFamily::toString() const { + std::ostringstream oStr; + oStr << describeKey(); + return oStr.str(); + } + +} + + Added: trunk/stdair/stdair/bom/FareFamily.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamily.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamily.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,71 @@ +#ifndef __STDAIR_BOM_FAREFAMILY_HPP +#define __STDAIR_BOM_FAREFAMILY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomAbstract.hpp> +#include <stdair/bom/FareFamilyKey.hpp> +#include <stdair/bom/FareFamilyTypes.hpp> + +namespace stdair { + + /** Class representing the actual attributes for a family fare. */ + class FareFamily : public BomAbstract { + template <typename BOM> friend class FacBom; + friend class FacBomManager; + + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FareFamilyKey Key_T; + + public: + // /////////// Getters //////////// + /** Get the family fare key. */ + const Key_T& getKey() const { return _key; } + + /** Get the family fare code (part of the primary key). */ + const FamilyCode_T& getFamilyCode() const { return _key.getFamilyCode(); } + + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } + + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + + 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; + + /** Get a string describing the key. */ + const std::string describeKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + FareFamily (const Key_T&); + FareFamily (const FareFamily&); + /** Destructor. */ + ~FareFamily(); + + public: + // Attributes + Key_T _key; + BomAbstract* _parent; + HolderMap_T _holderMap; + + }; + +} +#endif // __STDAIR_BOM_FAREFAMILY_HPP + Added: trunk/stdair/stdair/bom/FareFamilyKey.cpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyKey.cpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FareFamilyKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FareFamilyKey::FareFamilyKey (const FamilyCode_T& iFamilyCode) + : _familyCode (iFamilyCode) { + } + + // //////////////////////////////////////////////////////////////////// + FareFamilyKey::~FareFamilyKey () { + } + + // //////////////////////////////////////////////////////////////////// + void FareFamilyKey::toStream (std::ostream& ioOut) const { + ioOut << "FareFamilyKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FareFamilyKey::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string FareFamilyKey::toString() const { + std::ostringstream oStr; + oStr << _familyCode; + return oStr.str(); + } + +} Added: trunk/stdair/stdair/bom/FareFamilyKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyKey.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,49 @@ +#ifndef __STDAIR_BOM_FAREFAMILYKEY_HPP +#define __STDAIR_BOM_FAREFAMILYKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/KeyAbstract.hpp> + +namespace stdair { + /** Key of fare family. */ + struct FareFamilyKey : public KeyAbstract { + + public: + // /////////// Construction /////////// + /** Constructor. */ + FareFamilyKey (const FamilyCode_T& iFamilyCode); + /** Destructor. */ + ~FareFamilyKey (); + + // /////////// Getters ////////// + /** Get the family code. */ + const FamilyCode_T& getFamilyCode () const { + return _familyCode; + } + + // /////////// 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. + */ + const std::string toString() const; + + private: + // Attributes + /** Family code. */ + FamilyCode_T _familyCode; + }; + +} +#endif // __STDAIR_BOM_FAREFAMILYKEY_HPP Added: trunk/stdair/stdair/bom/FareFamilyTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyTypes.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,25 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FAREFAMILYTYPES_HPP +#define __STDAIR_BOM_FAREFAMILYTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <list> +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // Forward declarations. + class FareFamily; + + /** Define the fare family list. */ + typedef std::list<FareFamily*> FareFamilyList_T; + + /** Define the fare family map. */ + typedef std::map<const MapKey_T, FareFamily*> FareFamilyMap_T; +} +#endif // __STDAIR_BOM_FAREFAMILYTYPES_HPP Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-10-13 13:28:20 UTC (rev 341) +++ trunk/stdair/stdair/bom/sources.mk 2010-10-13 16:04:00 UTC (rev 342) @@ -11,6 +11,7 @@ $(top_srcdir)/stdair/bom/LegCabinKey.hpp \ $(top_srcdir)/stdair/bom/SegmentDateKey.hpp \ $(top_srcdir)/stdair/bom/SegmentCabinKey.hpp \ + $(top_srcdir)/stdair/bom/FareFamilyKey.hpp \ $(top_srcdir)/stdair/bom/BookingClassKey.hpp \ $(top_srcdir)/stdair/bom/BucketKey.hpp \ $(top_srcdir)/stdair/bom/FlightPeriodKey.hpp \ @@ -21,6 +22,7 @@ $(top_srcdir)/stdair/bom/SegmentDateTypes.hpp \ $(top_srcdir)/stdair/bom/LegDateTypes.hpp \ $(top_srcdir)/stdair/bom/SegmentCabinTypes.hpp \ + $(top_srcdir)/stdair/bom/FareFamilyTypes.hpp \ $(top_srcdir)/stdair/bom/LegCabinTypes.hpp \ $(top_srcdir)/stdair/bom/BookingClassTypes.hpp \ $(top_srcdir)/stdair/bom/BucketTypes.hpp \ @@ -38,6 +40,7 @@ $(top_srcdir)/stdair/bom/SegmentDate.hpp \ $(top_srcdir)/stdair/bom/LegDate.hpp \ $(top_srcdir)/stdair/bom/SegmentCabin.hpp \ + $(top_srcdir)/stdair/bom/FareFamily.hpp \ $(top_srcdir)/stdair/bom/LegCabin.hpp \ $(top_srcdir)/stdair/bom/BookingClass.hpp \ $(top_srcdir)/stdair/bom/Bucket.hpp \ @@ -64,6 +67,7 @@ $(top_srcdir)/stdair/bom/LegCabinKey.cpp \ $(top_srcdir)/stdair/bom/SegmentDateKey.cpp \ $(top_srcdir)/stdair/bom/SegmentCabinKey.cpp \ + $(top_srcdir)/stdair/bom/FareFamilyKey.cpp \ $(top_srcdir)/stdair/bom/BookingClassKey.cpp \ $(top_srcdir)/stdair/bom/BucketKey.cpp \ $(top_srcdir)/stdair/bom/FlightPeriodKey.cpp \ @@ -75,6 +79,7 @@ $(top_srcdir)/stdair/bom/SegmentDate.cpp \ $(top_srcdir)/stdair/bom/LegDate.cpp \ $(top_srcdir)/stdair/bom/SegmentCabin.cpp \ + $(top_srcdir)/stdair/bom/FareFamily.cpp \ $(top_srcdir)/stdair/bom/LegCabin.cpp \ $(top_srcdir)/stdair/bom/BookingClass.cpp \ $(top_srcdir)/stdair/bom/Bucket.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-10-13 13:28:27
|
Revision: 341 http://stdair.svn.sourceforge.net/stdair/?rev=341&view=rev Author: quannaus Date: 2010-10-13 13:28:20 +0000 (Wed, 13 Oct 2010) Log Message: ----------- [dev] Added the default constructor for STDAIR_Service (with out logger and dbssession initialisation). Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-10-04 09:11:49 UTC (rev 340) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-10-13 13:28:20 UTC (rev 341) @@ -32,6 +32,11 @@ public: // ////////// Constructors and destructors ////////// /** + * @brief Default constructor. + */ + STDAIR_Service (); + + /** * @brief Constructor. * <br>The init() method is called; see the corresponding * documentation for more details. @@ -73,11 +78,6 @@ private: // /////// Construction and Destruction helper methods /////// /** - * @brief Default constructor. - */ - STDAIR_Service (); - - /** * @brief Default copy constructor. * @param[in] const STDAIR_Service& Reference on the STDAIR_Service handler * to be copied. Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-10-04 09:11:49 UTC (rev 340) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-10-13 13:28:20 UTC (rev 341) @@ -21,7 +21,6 @@ // ////////////////////////////////////////////////////////////////////// STDAIR_Service::STDAIR_Service () : _bomRoot (FacBom<BomRoot>::instance().create()) { - assert (false); } // ////////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-10-04 09:11:57
|
Revision: 340 http://stdair.svn.sourceforge.net/stdair/?rev=340&view=rev Author: quannaus Date: 2010-10-04 09:11:49 +0000 (Mon, 04 Oct 2010) Log Message: ----------- [dev-temporary] Added a generator of random seeds for trademgen, should be moved in trademgen module later. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/EventQueue.cpp trunk/stdair/stdair/bom/EventStruct.cpp trunk/stdair/stdair/bom/EventStruct.hpp trunk/stdair/stdair/bom/EventTypes.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -429,6 +429,9 @@ // Date / Time /** Time duration in (integer) number of seconds */ typedef long int IntDuration_T; + + /** Time duration in (long long integer) number of milliseconds */ + typedef long long int LongDuration_T; /** Duration in (float) number of time units */ typedef float FloatDuration_T; Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -50,7 +50,7 @@ // // //////// General /////// /** Default date for the General. */ - const Date_T DEFAULT_DATE (2007, boost::gregorian::Jan, 1); + const Date_T DEFAULT_DATE (2010, boost::gregorian::Jan, 1); /** Default date&time. */ const DateTime_T DEFAULT_DATETIME (DEFAULT_DATE, NULL_BOOST_TIME_DURATION); Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -4,12 +4,15 @@ // STL #include <cassert> // STDAIR +#include <stdair/basic/BasConst_General.hpp> #include <stdair/bom/BomRoot.hpp> namespace stdair { // //////////////////////////////////////////////////////////////////// - BomRoot::BomRoot (const Key_T& iKey) : _key (iKey) { + BomRoot::BomRoot (const Key_T& iKey) + : _key (iKey), _seed (DEFAULT_RANDOM_SEED), _generator (_seed), + _uniformGenerator (_generator, boost::uniform_real<> (0, 1)) { } // //////////////////////////////////////////////////////////////////// @@ -23,4 +26,11 @@ return oStr.str(); } + // //////////////////////////////////////////////////////////////////// + RandomSeed_T BomRoot::generateSeed () { + RealNumber_T lVariateUnif = _uniformGenerator() * 1e9; + RandomSeed_T oSeed = static_cast<RandomSeed_T> (lVariateUnif); + return oSeed; + } + } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -4,6 +4,9 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// Boost Random +#include <boost/random/uniform_real.hpp> +#include <boost/random/variate_generator.hpp> // STDAIR #include <stdair/bom/BomAbstract.hpp> #include <stdair/bom/BomRootKey.hpp> @@ -51,6 +54,14 @@ // Attributes Key_T _key; HolderMap_T _holderMap; + + // TEST + stdair::RandomSeed_T _seed; + stdair::BaseGenerator_T _generator; + boost::variate_generator<stdair::BaseGenerator_T&, + boost::uniform_real<> > _uniformGenerator; + public: + RandomSeed_T generateSeed (); }; } Modified: trunk/stdair/stdair/bom/EventQueue.cpp =================================================================== --- trunk/stdair/stdair/bom/EventQueue.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventQueue.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -23,13 +23,13 @@ // ////////////////////////////////////////////////////////////////////// void EventQueue::addEvent (EventStruct& ioEventStruct) { - const DateTime_T& lEventDateTime = ioEventStruct.getEventDateTime (); const bool insertionSucceeded = - _eventList.insert (EventListElement_T (lEventDateTime, ioEventStruct)).second; + _eventList.insert (EventListElement_T (ioEventStruct._eventTimestamp, + ioEventStruct)).second; // If the insertion is not succeded. if (insertionSucceeded == false) { - ioEventStruct.moveForwardInTime(); + ++ioEventStruct._eventTimestamp; addEvent (ioEventStruct); } } Modified: trunk/stdair/stdair/bom/EventStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.cpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventStruct.cpp 2010-10-04 09:11:49 UTC (rev 340) @@ -10,36 +10,29 @@ // ////////////////////////////////////////////////////////////////////// EventStruct:: - EventStruct(const EventType_T& iEventType, const DateTime_T& iDateTime, - const DemandStreamKeyStr_T& iDemandStreamKey, - BookingRequestPtr_T ioRequestPtr) - : _eventType (iEventType), _eventDateTime (iDateTime), - _demandStreamKey (iDemandStreamKey) { + EventStruct (const EventType_T& iEventType, + const DemandStreamKeyStr_T& iDemandStreamKey, + BookingRequestPtr_T ioRequestPtr) + : _eventType (iEventType), _demandStreamKey (iDemandStreamKey) { _request = ioRequestPtr; + + // Compute the number of seconds between iDateTime and DEFAULT_DATETIME. + assert (ioRequestPtr != NULL); + Duration_T lDuration = ioRequestPtr->getRequestDateTime() - DEFAULT_DATETIME; + _eventTimestamp = lDuration.total_milliseconds(); } // ////////////////////////////////////////////////////////////////////// EventStruct:: EventStruct (const EventStruct& iEventStruct) : _eventType (iEventStruct._eventType), - _eventDateTime (iEventStruct._eventDateTime), + _eventTimestamp (iEventStruct._eventTimestamp), _demandStreamKey (iEventStruct._demandStreamKey) { _request = iEventStruct._request; } // ////////////////////////////////////////////////////////////////////// - EventStruct::EventStruct (const DateTime_T& iDateTime) - : _eventType (""), _eventDateTime (iDateTime), - _demandStreamKey ("") { - } - - // ////////////////////////////////////////////////////////////////////// EventStruct::~EventStruct () { } - // //////////////////////////////////////////////////////////////////// - void EventStruct::moveForwardInTime () { - _eventDateTime += DEFAULT_EPSILON_DURATION; - } - } Modified: trunk/stdair/stdair/bom/EventStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventStruct.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -12,7 +12,8 @@ /** Event struct. */ struct EventStruct { - + friend struct EventQueue; + public: // ///////////// Getters /////////// /** Get the event type */ @@ -20,11 +21,6 @@ return _eventType; } - /** Get the event datetime */ - const DateTime_T& getEventDateTime () const { - return _eventDateTime; - } - /** Get the Request event. */ const BookingRequestStruct& getBookingRequest () const { assert (_request != NULL); @@ -35,34 +31,28 @@ const DemandStreamKeyStr_T& getDemandStreamKey () const { return _demandStreamKey; } - - public: - // ///////////////// Business Methods ///////////////// - /** Move the event forward in time by one nanosecond. */ - void moveForwardInTime (); public: // ////////// Constructors and destructors ///////// /** Constructor. */ - EventStruct (const EventType_T&, const DateTime_T&, - const DemandStreamKeyStr_T&, BookingRequestPtr_T); - EventStruct (const DateTime_T&); + EventStruct (const EventType_T&, const DemandStreamKeyStr_T&, + BookingRequestPtr_T); /** Copy constructor. */ EventStruct (const EventStruct&); /** Destructor. */ ~EventStruct (); - private: /** Default constructors. */ EventStruct (); - private: // ////////// Attributes ////////// /** Event type */ EventType_T _eventType; - /** Event datetime */ - DateTime_T _eventDateTime; + /** Reprentative timestamp of the event, which is the number of + milliseconds between the event date-time and the default + date-time (2010-01-01 00:00:00) */ + LongDuration_T _eventTimestamp; /** The demand stream which generated this event. */ DemandStreamKeyStr_T _demandStreamKey; /** Pointer to Request event */ Modified: trunk/stdair/stdair/bom/EventTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/EventTypes.hpp 2010-10-03 19:51:11 UTC (rev 339) +++ trunk/stdair/stdair/bom/EventTypes.hpp 2010-10-04 09:11:49 UTC (rev 340) @@ -16,10 +16,10 @@ struct EventStruct; // Define a list of events. - typedef std::map<const DateTime_T, EventStruct> EventList_T; + typedef std::map<const LongDuration_T, EventStruct> EventList_T; // Define an element of a event list. - typedef std::pair<const DateTime_T, EventStruct> EventListElement_T; + typedef std::pair<const LongDuration_T, EventStruct> EventListElement_T; } #endif // __STDAIR_BOM_EVENTTYPES_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-10-03 19:51:17
|
Revision: 339 http://stdair.svn.sourceforge.net/stdair/?rev=339&view=rev Author: denis_arnaud Date: 2010-10-03 19:51:11 +0000 (Sun, 03 Oct 2010) Log Message: ----------- [Batch] Fixed the sanity checks of the batch. Modified Paths: -------------- trunk/stdair/batches/stdair.cpp Modified: trunk/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/batches/stdair.cpp 2010-09-27 11:37:56 UTC (rev 338) +++ trunk/stdair/batches/stdair.cpp 2010-10-03 19:51:11 UTC (rev 339) @@ -433,7 +433,7 @@ lLegDateList.begin(); itLD != lLegDateList.end(); ++itLD) { const stdair::LegDate* lLD_ptr = *itLD; - assert (lFD_ptr != NULL); + assert (lLD_ptr != NULL); // STDAIR_LOG_DEBUG ("LegDate: " << lLD_ptr->toString()); STDAIR_LOG_DEBUG (" " << lLD_ptr->toString()); @@ -445,7 +445,7 @@ lLegCabinList.begin(); itLC != lLegCabinList.end(); ++itLC) { const stdair::LegCabin* lLC_ptr = *itLC; - assert (lFD_ptr != NULL); + assert (lLC_ptr != NULL); // STDAIR_LOG_DEBUG ("LegCabin: " << lLC_ptr->toString()); STDAIR_LOG_DEBUG (" " << lLC_ptr->toString()); @@ -459,7 +459,7 @@ lSegmentDateList.begin(); itSD != lSegmentDateList.end(); ++itSD) { const stdair::SegmentDate* lSD_ptr = *itSD; - assert (lFD_ptr != NULL); + assert (lSD_ptr != NULL); // STDAIR_LOG_DEBUG ("SegmentDate: " << lSD_ptr->toString()); STDAIR_LOG_DEBUG (" " << lSD_ptr->toString()); @@ -471,7 +471,7 @@ lSegmentCabinList.begin(); itSC != lSegmentCabinList.end(); ++itSC) { const stdair::SegmentCabin* lSC_ptr = *itSC; - assert (lFD_ptr != NULL); + assert (lSC_ptr != NULL); // STDAIR_LOG_DEBUG ("SegmentCabin: " << lSC_ptr->toString()); STDAIR_LOG_DEBUG (" " << lSC_ptr->toString()); @@ -483,7 +483,7 @@ lBookingClassList.begin(); itBC != lBookingClassList.end(); ++itBC) { const stdair::BookingClass* lBC_ptr = *itBC; - assert (lFD_ptr != NULL); + assert (lBC_ptr != NULL); // STDAIR_LOG_DEBUG ("BookingClass: " << lBC_ptr->toString()); STDAIR_LOG_DEBUG (" " << lBC_ptr->toString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-27 11:38:05
|
Revision: 338 http://stdair.svn.sourceforge.net/stdair/?rev=338&view=rev Author: denis_arnaud Date: 2010-09-27 11:37:56 +0000 (Mon, 27 Sep 2010) Log Message: ----------- [Dev] Replaced calls to the GSL (GNU Scientific Library) by Boost.Math. Modified Paths: -------------- trunk/stdair/config/stdair.m4 Modified: trunk/stdair/config/stdair.m4 =================================================================== --- trunk/stdair/config/stdair.m4 2010-09-16 14:26:51 UTC (rev 337) +++ trunk/stdair/config/stdair.m4 2010-09-27 11:37:56 UTC (rev 338) @@ -2,10 +2,8 @@ # Configure path for the STDAIR library. # Denis Arnaud <den...@us...>, July 2008 # -# Note: as the STDAIR library depends upon GSL (and -# potentially BOOST) to build. Your configure.ac must define -# appropriately the GSL_CFLAGS (and potentially BOOST_CFLAGS) -# variables. +# Note: as the STDAIR library depends upon BOOST to build. +# Your configure.ac must therefore define appropriately the BOOST variables. # @@ -28,36 +26,21 @@ AC_PATH_PROG(STDAIR_CONFIG, stdair-config, no) # Check whether Boost flags and libraries are defined - AC_MSG_CHECKING(for GSL_CFLAGS environment variable) - if test x"${GSL_CFLAGS}" = x; then - AC_MSG_RESULT([Warning: STDAIR needs the GSL, and the GSL_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if GSL is installed in /usr/local. Otherwise, the STDAIR will fail to compile.]) - else - AC_MSG_RESULT([ok (set to ${GSL_CFLAGS})]) + AC_MSG_CHECKING(for BOOST_CFLAGS environment variable) + if test x"${BOOST_CFLAGS}" = x; then + AC_MSG_RESULT([Warning: STDAIR needs Boost, and the BOOST_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if Boost is installed in /usr/local. Otherwise, the STDAIR will fail to compile.]) + else + AC_MSG_RESULT([ok (set to ${BOOST_CFLAGS})]) fi - AC_MSG_CHECKING(for GSL_LIBS environment variable) - if test x"${GSL_LIBS}" = x; then - AC_MSG_RESULT([Warning: STDAIR needs the GSL library, and the GSL_LIBS environment variable does not appears to be set. The STDAIR may fail to link.]) - else - AC_MSG_RESULT([ok (set to ${GSL_LIBS})]) + AC_MSG_CHECKING(for BOOST_DATE_TIME_LIB environment variable) + if test x"${BOOST_DATE_TIME_LIB}" = x; then + AC_MSG_RESULT([Warning: STDAIR needs Boost Date-Time library, and the BOOST_DATE_TIME_LIB environment variable does not appears to be set. The STDAIR may fail to link.]) + else + AC_MSG_RESULT([ok (set to ${BOOST_DATE_TIME_LIB})]) fi - # Check whether Boost flags and libraries are defined -# AC_MSG_CHECKING(for BOOST_CFLAGS environment variable) -# if test x"${BOOST_CFLAGS}" = x; then -# AC_MSG_RESULT([Warning: STDAIR needs Boost, and the BOOST_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if Boost is installed in /usr/local. Otherwise, the STDAIR will fail to compile.]) -# else -# AC_MSG_RESULT([ok (set to ${BOOST_CFLAGS})]) -# fi - -# AC_MSG_CHECKING(for BOOST_DATE_TIME_LIB environment variable) -# if test x"${BOOST_DATE_TIME_LIB}" = x; then -# AC_MSG_RESULT([Warning: STDAIR needs Boost Date-Time library, and the BOOST_DATE_TIME_LIB environment variable does not appears to be set. The STDAIR may fail to link.]) -# else -# AC_MSG_RESULT([ok (set to ${BOOST_DATE_TIME_LIB})]) -# fi - - min_stdair_version=ifelse([$1], ,0.11.0,$1) + min_stdair_version=ifelse([$1], ,0.5.0,$1) AC_MSG_CHECKING(for STDAIR - version >= $min_stdair_version) no_stdair="" if test "${STDAIR_CONFIG}" = "no" ; then @@ -66,11 +49,9 @@ else STDAIR_VERSION=`${STDAIR_CONFIG} --version` STDAIR_CFLAGS=`${STDAIR_CONFIG} --cflags` - STDAIR_CFLAGS="${GSL_CFLAGS} ${STDAIR_CFLAGS}" -# STDAIR_CFLAGS="${BOOST_CFLAGS} ${STDAIR_CFLAGS}" + STDAIR_CFLAGS="${BOOST_CFLAGS} ${STDAIR_CFLAGS}" STDAIR_LIBS=`${STDAIR_CONFIG} --libs` - STDAIR_LIBS="${GSL_LIBS} ${STDAIR_LIBS}" -# STDAIR_LIBS="${BOOST_LIBS} ${BOOST_DATE_TIME_LIB} ${STDAIR_LIBS}" + STDAIR_LIBS="${BOOST_LIBS} ${BOOST_DATE_TIME_LIB} ${STDAIR_LIBS}" AC_SUBST([STDAIR_VERSION]) AC_SUBST([STDAIR_CFLAGS]) @@ -96,8 +77,8 @@ SAVED_CPPFLAGS="${CPPFLAGS}" SAVED_LDFLAGS="${LDFLAGS}" - CPPFLAGS="${CPPFLAGS} ${GSL_CFLAGS} ${BOOST_CFLAGS} ${STDAIR_CFLAGS}" - LDFLAGS="${LDFLAGS} ${GSL_LIBS} ${STDAIR_LIBS}" + CPPFLAGS="${CPPFLAGS} ${BOOST_CFLAGS} ${STDAIR_CFLAGS}" + LDFLAGS="${LDFLAGS} ${STDAIR_LIBS}" AC_COMPILE_IFELSE( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 14:26:57
|
Revision: 337 http://stdair.svn.sourceforge.net/stdair/?rev=337&view=rev Author: denis_arnaud Date: 2010-09-16 14:26:51 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Branch 0.5.0] Fixed compilation error in the architecture test. Modified Paths: -------------- branches/stdair/0.5.0/main/test/architecture/architecture.cpp Property Changed: ---------------- branches/stdair/0.5.0/main/test/archi_static_cast/ Property changes on: branches/stdair/0.5.0/main/test/archi_static_cast ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile Makefile.in architecture + .deps .libs Makefile Makefile.in archi_static_cast Modified: branches/stdair/0.5.0/main/test/architecture/architecture.cpp =================================================================== --- branches/stdair/0.5.0/main/test/architecture/architecture.cpp 2010-09-16 14:25:12 UTC (rev 336) +++ branches/stdair/0.5.0/main/test/architecture/architecture.cpp 2010-09-16 14:26:51 UTC (rev 337) @@ -25,13 +25,13 @@ const stdair::InventoryKey lBAKey (lAirlineCode); myairline::Inventory& lBAInv = stdair::FacBom<myairline::Inventory>::instance().create (lBAKey); - stdair::FacBomManager::addToList (lBomRoot, lBAInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lBAInv); // Create an Inventory for AF const stdair::InventoryKey lAFKey ("AF"); myairline::Inventory& lAFInv = stdair::FacBom<myairline::Inventory>::instance().create (lAFKey); - stdair::FacBomManager::addToList (lBomRoot, lAFInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lAFInv); // Browse the inventories const myairline::InventoryList_T& lInventoryList = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 14:25:23
|
Revision: 336 http://stdair.svn.sourceforge.net/stdair/?rev=336&view=rev Author: denis_arnaud Date: 2010-09-16 14:25:12 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Test] Fixed compilation error in the architecture test. Modified Paths: -------------- trunk/stdair/test/architecture/architecture.cpp Property Changed: ---------------- trunk/stdair/test/archi_static_cast/ Property changes on: trunk/stdair/test/archi_static_cast ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile Makefile.in architecture + .deps .libs Makefile Makefile.in archi_static_cast Modified: trunk/stdair/test/architecture/architecture.cpp =================================================================== --- trunk/stdair/test/architecture/architecture.cpp 2010-09-16 12:49:31 UTC (rev 335) +++ trunk/stdair/test/architecture/architecture.cpp 2010-09-16 14:25:12 UTC (rev 336) @@ -25,13 +25,13 @@ const stdair::InventoryKey lBAKey (lAirlineCode); myairline::Inventory& lBAInv = stdair::FacBom<myairline::Inventory>::instance().create (lBAKey); - stdair::FacBomManager::addToList (lBomRoot, lBAInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lBAInv); // Create an Inventory for AF const stdair::InventoryKey lAFKey ("AF"); myairline::Inventory& lAFInv = stdair::FacBom<myairline::Inventory>::instance().create (lAFKey); - stdair::FacBomManager::addToList (lBomRoot, lAFInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lAFInv); // Browse the inventories const myairline::InventoryList_T& lInventoryList = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 12:49:36
|
Revision: 335 http://stdair.svn.sourceforge.net/stdair/?rev=335&view=rev Author: denis_arnaud Date: 2010-09-16 12:49:31 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Release] Created the main 0.5.0 release branch, from revision r332. Added Paths: ----------- branches/stdair/0.5.0/main/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 12:39:36
|
Revision: 334 http://stdair.svn.sourceforge.net/stdair/?rev=334&view=rev Author: denis_arnaud Date: 2010-09-16 12:39:28 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Branch 0.5.0] Prepared the branch 0.5.0 to be copied from head of trunk. Added Paths: ----------- branches/stdair/0.5.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 08:02:28
|
Revision: 333 http://stdair.svn.sourceforge.net/stdair/?rev=333&view=rev Author: denis_arnaud Date: 2010-09-16 08:02:19 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Release] Back to working version (99.99.99). Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/stdair.spec Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2010-09-16 08:00:27 UTC (rev 332) +++ trunk/stdair/configure.ac 2010-09-16 08:02:19 UTC (rev 333) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>]) -AC_INIT([STDAIR],[0.5.0],[den...@us...],[stdair]) +AC_INIT([STDAIR],[99.99.99],[den...@us...],[stdair]) AC_CONFIG_HEADER([stdair/config.h]) AC_CONFIG_SRCDIR([stdair/bom/BomRoot.hpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # Shared library versioning -GENERIC_LIBRARY_VERSION="0:5:0" +GENERIC_LIBRARY_VERSION="99:99:99" # | | | # +------+ | +---+ # | | | Modified: trunk/stdair/stdair.spec =================================================================== --- trunk/stdair/stdair.spec 2010-09-16 08:00:27 UTC (rev 332) +++ trunk/stdair/stdair.spec 2010-09-16 08:02:19 UTC (rev 333) @@ -2,7 +2,7 @@ %global mydocs __tmp_docdir # Name: stdair -Version: 0.5.0 +Version: 99.99.99 Release: 1%{?dist} Summary: C++ Standard Airline IT Object Library @@ -111,9 +111,12 @@ %changelog -* Sun Aug 30 2010 Son Nguyen Kim <ngu...@gm...> 0.5.0-1 +* Sun Sep 19 2010 Son Nguyen Kim <ngu...@gm...> 99.99.99-1 - Upstream update +* Thu Sep 16 2010 Son Nguyen Kim <ngu...@gm...> 0.5.0-1 +- Upstream update + * Fri Sep 03 2010 Son Nguyen Kim <ngu...@gm...> 0.4.0-1 - Replace extracc external ref to dependency This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-16 08:00:33
|
Revision: 332 http://stdair.svn.sourceforge.net/stdair/?rev=332&view=rev Author: denis_arnaud Date: 2010-09-16 08:00:27 +0000 (Thu, 16 Sep 2010) Log Message: ----------- [Release 0.5.0] Release of the 0.5.0 version. Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/stdair.spec Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2010-09-15 12:50:01 UTC (rev 331) +++ trunk/stdair/configure.ac 2010-09-16 08:00:27 UTC (rev 332) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>]) -AC_INIT([STDAIR],[99.99.99],[den...@us...],[stdair]) +AC_INIT([STDAIR],[0.5.0],[den...@us...],[stdair]) AC_CONFIG_HEADER([stdair/config.h]) AC_CONFIG_SRCDIR([stdair/bom/BomRoot.hpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # Shared library versioning -GENERIC_LIBRARY_VERSION="99:99:99" +GENERIC_LIBRARY_VERSION="0:5:0" # | | | # +------+ | +---+ # | | | Modified: trunk/stdair/stdair.spec =================================================================== --- trunk/stdair/stdair.spec 2010-09-15 12:50:01 UTC (rev 331) +++ trunk/stdair/stdair.spec 2010-09-16 08:00:27 UTC (rev 332) @@ -2,7 +2,7 @@ %global mydocs __tmp_docdir # Name: stdair -Version: 99.99.99 +Version: 0.5.0 Release: 1%{?dist} Summary: C++ Standard Airline IT Object Library @@ -111,7 +111,7 @@ %changelog -* Sun Aug 30 2010 Son Nguyen Kim <ngu...@gm...> 99.99.99-1 +* Sun Aug 30 2010 Son Nguyen Kim <ngu...@gm...> 0.5.0-1 - Upstream update * Fri Sep 03 2010 Son Nguyen Kim <ngu...@gm...> 0.4.0-1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-09-15 12:50:15
|
Revision: 331 http://stdair.svn.sourceforge.net/stdair/?rev=331&view=rev Author: quannaus Date: 2010-09-15 12:50:01 +0000 (Wed, 15 Sep 2010) Log Message: ----------- [dev] New architecture for stdair. Modified Paths: -------------- trunk/stdair/batches/stdair.cpp trunk/stdair/configure.ac trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/bom/BomAbstract.hpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BookingClass.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/Bucket.cpp trunk/stdair/stdair/bom/Bucket.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightPeriod.cpp trunk/stdair/stdair/bom/FlightPeriod.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp 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/bom/SegmentPeriod.cpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/YieldStore.cpp trunk/stdair/stdair/bom/YieldStore.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/factory/FacBomManager.cpp trunk/stdair/stdair/factory/FacBomManager.hpp trunk/stdair/stdair/service/FacSupervisor.cpp trunk/stdair/stdair/service/FacSupervisor.hpp trunk/stdair/test/Makefile.am trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp trunk/stdair/test/archi_static_cast/BomRoot.cpp trunk/stdair/test/archi_static_cast/BomRoot.hpp trunk/stdair/test/archi_static_cast/Inventory.cpp trunk/stdair/test/archi_static_cast/Inventory.hpp trunk/stdair/test/archi_static_cast/Makefile.am trunk/stdair/test/archi_static_cast/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/BomHolder.hpp trunk/stdair/stdair/bom/BomHolderKey.cpp trunk/stdair/stdair/bom/BomHolderKey.hpp trunk/stdair/test/archi_static_cast/ trunk/stdair/test/archi_static_cast/BomHolder.hpp trunk/stdair/test/archi_static_cast/BomManager.hpp trunk/stdair/test/archi_static_cast/FacBom.hpp trunk/stdair/test/archi_static_cast/FacBomManager.hpp trunk/stdair/test/archi_static_cast/Types.hpp trunk/stdair/test/archi_static_cast/archi_static_cast.cpp Removed Paths: ------------- trunk/stdair/stdair/bom/RelationShip.hpp trunk/stdair/stdair/bom/RelationShipAbstract.hpp trunk/stdair/test/archi_static_cast/architecture.cpp Modified: trunk/stdair/batches/stdair.cpp =================================================================== --- trunk/stdair/batches/stdair.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/batches/stdair.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -167,13 +167,13 @@ const stdair::InventoryKey lBAKey ("BA"); stdair::Inventory& lBAInv = stdair::FacBom<stdair::Inventory>::instance().create (lBAKey); - stdair::FacBomManager::addToList (lBomRoot, lBAInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lBAInv); // Create an Inventory for AF const stdair::InventoryKey lAFKey ("AF"); stdair::Inventory& lAFInv = stdair::FacBom<stdair::Inventory>::instance().create (lAFKey); - stdair::FacBomManager::addToList (lBomRoot, lAFInv); + stdair::FacBomManager::instance().addToList (lBomRoot, lAFInv); // ////// BA /////// // Step 0.2: Flight-date level @@ -184,7 +184,7 @@ stdair::FlightDate& lBA15_20100610_FD = stdair::FacBom<stdair::FlightDate>::instance().create (lFlightDateKey); - stdair::FacBomManager::addToList (lBAInv, lBA15_20100610_FD); + stdair::FacBomManager::instance().addToList (lBAInv, lBA15_20100610_FD); // Display the flight-date // STDAIR_LOG_DEBUG ("FlightDate: " << lBA15_20100610_FD.toString()); @@ -197,7 +197,8 @@ stdair::SegmentDate& lLHRSYDSegment = stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); - stdair::FacBomManager::addToList (lBA15_20100610_FD, lLHRSYDSegment); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lLHRSYDSegment); // Display the segment-date // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment.toString()); @@ -208,7 +209,8 @@ stdair::SegmentDate& lLHRBKKSegment = stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); - stdair::FacBomManager::addToList (lBA15_20100610_FD, lLHRBKKSegment); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lLHRBKKSegment); // Display the segment-date // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment.toString()); @@ -219,7 +221,8 @@ stdair::SegmentDate& lBKKSYDSegment = stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); - stdair::FacBomManager::addToList (lBA15_20100610_FD, lBKKSYDSegment); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lBKKSYDSegment); // Display the segment-date // STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment.toString()); @@ -230,7 +233,7 @@ stdair::LegDate& lLHRLeg = stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); - stdair::FacBomManager::addToList (lBA15_20100610_FD, lLHRLeg); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, lLHRLeg); // Display the leg-date // STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString()); @@ -240,7 +243,7 @@ stdair::LegDate& lBKKLeg = stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); - stdair::FacBomManager::addToList (lBA15_20100610_FD, lBKKLeg); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, lBKKLeg); // Display the leg-date // STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString()); @@ -252,7 +255,8 @@ stdair::SegmentCabin& lLHRBKKSegmentYCabin = stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); - stdair::FacBomManager::addToList (lLHRBKKSegment, lLHRBKKSegmentYCabin); + stdair::FacBomManager::instance().addToList (lLHRBKKSegment, + lLHRBKKSegmentYCabin); // Display the segment-cabin // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString()); @@ -260,7 +264,8 @@ // Create a SegmentCabin (Y) of the Segment BKK-SYD; stdair::SegmentCabin& lBKKSYDSegmentYCabin = stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); - stdair::FacBomManager::addToList (lBKKSYDSegment, lBKKSYDSegmentYCabin); + stdair::FacBomManager::instance().addToList (lBKKSYDSegment, + lBKKSYDSegmentYCabin); // Display the segment-cabin // STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString()); @@ -268,7 +273,8 @@ // Create a SegmentCabin (Y) of the Segment LHR-SYD; stdair::SegmentCabin& lLHRSYDSegmentYCabin = stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); - stdair::FacBomManager::addToList (lLHRSYDSegment, lLHRSYDSegmentYCabin); + stdair::FacBomManager::instance().addToList (lLHRSYDSegment, + lLHRSYDSegmentYCabin); // Display the segment-cabin // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString()); @@ -279,7 +285,7 @@ stdair::LegCabin& lLHRLegYCabin = stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); - stdair::FacBomManager::addToList (lLHRLeg, lLHRLegYCabin); + stdair::FacBomManager::instance().addToList (lLHRLeg, lLHRLegYCabin); // Display the leg-cabin // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString()); @@ -287,7 +293,7 @@ // Create a LegCabin (Y) for the Leg BKK-SYD stdair::LegCabin& lBKKLegYCabin = stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); - stdair::FacBomManager::addToList (lBKKLeg, lBKKLegYCabin); + stdair::FacBomManager::instance().addToList (lBKKLeg, lBKKLegYCabin); // Display the leg-cabin // STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString()); @@ -299,8 +305,8 @@ stdair::BookingClass& lLHRBKKSegmentYCabinQClass = stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); - stdair::FacBomManager::addToList (lLHRBKKSegmentYCabin, - lLHRBKKSegmentYCabinQClass); + stdair::FacBomManager::instance().addToList (lLHRBKKSegmentYCabin, + lLHRBKKSegmentYCabinQClass); // Display the booking class // STDAIR_LOG_DEBUG ("BookingClass: " @@ -309,9 +315,9 @@ // Create a BookingClass (Q) for the Segment BKK-LHR, cabin Y stdair::BookingClass& lBKKSYDSegmentYCabinQClass = stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); - stdair::FacBomManager::addToList (lBKKSYDSegmentYCabin, - lBKKSYDSegmentYCabinQClass); - + stdair::FacBomManager::instance().addToList (lBKKSYDSegmentYCabin, + lBKKSYDSegmentYCabinQClass); + // Display the booking class // STDAIR_LOG_DEBUG ("BookingClass: " // << lLHRBKKSegmentYCabinQClass.toString()); @@ -319,8 +325,8 @@ // Create a BookingClass (Q) for the Segment LHR-SYD, cabin Y stdair::BookingClass& lLHRSYDSegmentYCabinQClass = stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); - stdair::FacBomManager::addToList (lLHRSYDSegmentYCabin, - lLHRSYDSegmentYCabinQClass); + stdair::FacBomManager::instance().addToList (lLHRSYDSegmentYCabin, + lLHRSYDSegmentYCabinQClass); // Display the booking class // STDAIR_LOG_DEBUG ("BookingClass: " @@ -336,7 +342,7 @@ stdair::FlightDate& lAF102_20100320_FD = stdair::FacBom<stdair::FlightDate>::instance().create (lFlightDateKey); - stdair::FacBomManager::addToList (lAFInv, lAF102_20100320_FD); + stdair::FacBomManager::instance().addToList (lAFInv, lAF102_20100320_FD); // Display the flight-date // STDAIR_LOG_DEBUG ("FlightDate: " << lAF102_20100320_FD.toString()); @@ -349,7 +355,8 @@ stdair::SegmentDate& lCDGSFOSegment = stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); - stdair::FacBomManager::addToList (lAF102_20100320_FD, lCDGSFOSegment); + stdair::FacBomManager::instance().addToList (lAF102_20100320_FD, + lCDGSFOSegment); // Display the segment-date // STDAIR_LOG_DEBUG ("SegmentDate: " << lCDGSFOSegment.toString()); @@ -360,7 +367,7 @@ stdair::LegDate& lCDGLeg = stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); - stdair::FacBomManager::addToList (lAF102_20100320_FD, lCDGLeg); + stdair::FacBomManager::instance().addToList (lAF102_20100320_FD, lCDGLeg); // Display the leg-date // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString()); @@ -369,7 +376,8 @@ // Create a SegmentCabin (Y) for the Segment CDG-SFO of AF's Inventory stdair::SegmentCabin& lCDGSFOSegmentYCabin = stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); - stdair::FacBomManager::addToList (lCDGSFOSegment, lCDGSFOSegmentYCabin); + stdair::FacBomManager::instance().addToList (lCDGSFOSegment, + lCDGSFOSegmentYCabin); // Display the segment-cabin // STDAIR_LOG_DEBUG ("SegmentCabin: " << lCDGSFOSegmentYCabin.toString()); @@ -378,7 +386,7 @@ // Create a LegCabin (Y) for the Leg CDG-SFO on AF's Inventory stdair::LegCabin& lCDGLegYCabin = stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); - stdair::FacBomManager::addToList (lCDGLeg, lCDGLegYCabin); + stdair::FacBomManager::instance().addToList (lCDGLeg, lCDGLegYCabin); // Display the leg-cabin // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString()); @@ -387,8 +395,8 @@ // Create a BookingClass (Q) for the Segment CDG-SFO, cabin Y on AF's Inv stdair::BookingClass& lCDGSFOSegmentYCabinQClass = stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); - stdair::FacBomManager::addToList (lCDGSFOSegmentYCabin, - lCDGSFOSegmentYCabinQClass); + stdair::FacBomManager::instance().addToList (lCDGSFOSegmentYCabin, + lCDGSFOSegmentYCabinQClass); // Display the booking class // STDAIR_LOG_DEBUG ("BookingClass: " Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/configure.ac 2010-09-15 12:50:01 UTC (rev 331) @@ -224,6 +224,7 @@ test/inheritance/Makefile test/architecture/Makefile test/archi_intru/Makefile + test/archi_static_cast/Makefile test/mpl/Makefile test/mpl/contrib/Makefile test/stdair/Makefile Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -41,7 +41,7 @@ class NonInitialisedContainerException : public RootException { }; - class NonInitialisedRelationShip : public RootException { }; + class NonInitialisedRelationShipException : public RootException { }; class MemoryAllocationException : public RootException { }; @@ -478,7 +478,7 @@ } -#define CATCH \ +#define CATCH_ALL_EXCEPTIONS \ catch (const stdair::FileNotFoundException& ex) { \ std::cerr << "FileNotFoundException" << std::endl; \ return -1; \ @@ -499,8 +499,8 @@ std::cerr << "NonInitialisedContainerException" << std::endl; \ return -1; \ \ - } catch (const stdair::NonInitialisedRelationShip& ex) { \ - std::cerr << "NonInitialisedRelationShip" << std::endl; \ + } catch (const stdair::NonInitialisedRelationShipException& ex) { \ + std::cerr << "NonInitialisedRelationShipException" << std::endl; \ return -1; \ \ } catch (const stdair::MemoryAllocationException& ex) { \ Modified: trunk/stdair/stdair/bom/BomAbstract.hpp =================================================================== --- trunk/stdair/stdair/bom/BomAbstract.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/BomAbstract.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -12,6 +12,8 @@ // STL #include <iosfwd> #include <string> +#include <map> +#include <typeinfo> // StdAir #include <stdair/STDAIR_Types.hpp> @@ -42,7 +44,10 @@ public: /** Destructor. */ virtual ~BomAbstract() {} - }; + }; + + /* Define the map of object holder type. */ + typedef std::map<const std::type_info*, BomAbstract*> HolderMap_T; } /** Copied: trunk/stdair/stdair/bom/BomHolder.hpp (from rev 330, trunk/stdair/test/architecture/BomRoot.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomHolder.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomHolder.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -0,0 +1,63 @@ +#ifndef __STDAIR_BOM_BOMHOLDER_HPP +#define __STDAIR_BOM_BOMHOLDER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <list> +#include <map> +// StdAir +#include <stdair/bom/BomAbstract.hpp> +#include <stdair/bom/BomHolderKey.hpp> + +namespace stdair { + /** Class representing the holders of BOM. */ + template <typename BOM> + class BomHolder : public stdair::BomAbstract { + template <typename> friend class FacBom; + friend class FacBomManager; + + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef stdair::BomHolderKey Key_T; + + // Definition of diffrent container types. + typedef std::list<BOM*> BomList_T; + typedef std::map<const MapKey_T, BOM*> BomMap_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 ""; } + + /** Get a string describing the key. */ + const std::string describeKey() const { return ""; } + + protected: + /** Default constructors. */ + BomHolder (); + BomHolder (const BomHolder&); + BomHolder (const Key_T& iKey) : _key (iKey) { } + /** Destructor. */ + ~BomHolder() { }; + + public: + // Attributes + Key_T _key; + BomList_T _bomList; + BomMap_T _bomMap; + }; + +} +#endif // __STDAIR_BOM_BOMHOLDER_HPP Copied: trunk/stdair/stdair/bom/BomHolderKey.cpp (from rev 330, trunk/stdair/stdair/bom/BomRootKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/BomHolderKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/BomHolderKey.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -0,0 +1,33 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomHolderKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + BomHolderKey::BomHolderKey () { + } + + // //////////////////////////////////////////////////////////////////// + BomHolderKey::~BomHolderKey () { + } + + // //////////////////////////////////////////////////////////////////// + void BomHolderKey::toStream (std::ostream& ioOut) const { + ioOut << "BomHolderKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void BomHolderKey::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string BomHolderKey::toString() const { + std::ostringstream oStr; + oStr << " -- HOLDER -- "; + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/BomHolderKey.hpp (from rev 330, trunk/stdair/stdair/bom/BomRootKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/BomHolderKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/BomHolderKey.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -0,0 +1,43 @@ +#ifndef __STDAIR_BOM_BOMHOLDERKEY_HPP +#define __STDAIR_BOM_BOMHOLDERKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/KeyAbstract.hpp> + +namespace stdair { + /** Key of the BOM structure holder. */ + struct BomHolderKey : public KeyAbstract { + + public: + // /////////// Construction /////////// + /** Constructor. */ + BomHolderKey (); + /** Destructor. */ + ~BomHolderKey (); + + // /////////// 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; + + }; + +} +#endif // __STDAIR_BOM_BOMHOLDERKEY_HPP Modified: trunk/stdair/stdair/bom/BomManager.hpp =================================================================== --- trunk/stdair/stdair/bom/BomManager.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/BomManager.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -7,151 +7,185 @@ // STL #include <iosfwd> // STDAIR -#include <stdair/bom/RelationShip.hpp> +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomAbstract.hpp> +#include <stdair/bom/BomHolder.hpp> +#include <stdair/service/Logger.hpp> namespace stdair { /** Utility class for StdAir objects. */ class BomManager { + friend class FacBomManager; + public: - /** Get the list of BOM objects within the given parent. */ - template <typename CHILD, typename PARENT> - static std::list<CHILD*>& getList (const PARENT&); - template <typename CHILD, typename PARENT> - static std::list<std::pair<MapKey_T, CHILD*> >& getDetailedList (const PARENT&); - template <typename CHILD, typename PARENT> - static std::map<const MapKey_T, CHILD*>& getMap (const PARENT&); + /** Get the container of object2 within the object1. */ + template <typename OBJECT2, typename OBJECT1> + static const std::list<OBJECT2*>& getList (const OBJECT1&); + template <typename OBJECT2, typename OBJECT1> + static const std::map<const MapKey_T, OBJECT2*>& getMap (const OBJECT1&); - /** Get the map of parent and children holder. */ - template <typename PARENT, typename CHILD> - static const std::map<const PARENT*, - std::list<CHILD*> >& getParentChildrenList(); - template <typename PARENT, typename CHILD> - static const std::map<const PARENT*, - std::map<const MapKey_T, CHILD*> >& getParentChildrenMap(); + /** Check if the list/map of object2 has benn initialised. */ + template <typename OBJECT2, typename OBJECT1> + static bool hasList (const OBJECT1&); + template <typename OBJECT2, typename OBJECT1> + static bool hasMap (const OBJECT1&); - /** Check if the list/map of children has been initialised. */ - template <typename CHILD, typename PARENT> - static bool hasList (const PARENT&); - template <typename CHILD, typename PARENT> - static bool hasDetailedList (const PARENT&); - template <typename CHILD, typename PARENT> - static bool hasMap (const PARENT&); - /** Getter of the PARENT given the CHILD. */ template <typename PARENT, typename CHILD> static PARENT& getParent (const CHILD&); - /** Return the CHILD pointer corresponding to the given string key. - If such a CHILD does not exist, return NULL. */ - template <typename CHILD, typename PARENT> - static CHILD* getChildPtr (const PARENT&, const MapKey_T&); - template <typename BOM> - static BOM* const getObjectPtr (const std::map<const MapKey_T, BOM*>&, - const MapKey_T&); + /** Return the OBJECT2 pointer corresponding to the given string key. + If such a OBJECT2 does not exist, return NULL. */ + template <typename OBJECT2, typename OBJECT1> + static OBJECT2* getObjectPtr (const OBJECT1&, const MapKey_T&); - /** Return the CHILD corresponding the the given string key. */ - template <typename CHILD, typename PARENT> - static CHILD& getChild (const PARENT&, const MapKey_T&); - template <typename BOM> - static BOM& getObject (const std::map<const MapKey_T, BOM*>&, - const MapKey_T&); + /** Return the OBJECT2 corresponding the the given string key. */ + template <typename OBJECT2, typename OBJECT1> + static OBJECT2& getObject (const OBJECT1&, const MapKey_T&); + + + private: + /** Get the holder of object2 within the object1. If the holder does not + exist, then throw an exception. */ + template <typename OBJECT2, typename OBJECT1> + static const BomHolder<OBJECT2>& getBomHolder (const OBJECT1&); }; // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> std::list<CHILD*>& BomManager:: - getList (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>::instance().getChildrenList (iParent); - } + template <typename OBJECT2, typename OBJECT1> + const BomHolder<OBJECT2>& BomManager::getBomHolder (const OBJECT1& iObject1) { + const HolderMap_T& lHolderMap = iObject1.getHolderMap(); + + HolderMap_T::const_iterator itHolder = lHolderMap.find (&typeid (OBJECT2)); + + if (itHolder == lHolderMap.end()) { + std::string lName (typeid (OBJECT2).name()); + + STDAIR_LOG_ERROR ("Cannot find the holder of type " << lName + << " within: " << iObject1.describeKey()); + throw NonInitialisedContainerException (); + } + + const BomHolder<OBJECT2>* lBomHolder_ptr = + static_cast<const BomHolder<OBJECT2>*> (itHolder->second); + assert (lBomHolder_ptr != NULL); - // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - std::list<std::pair<MapKey_T, CHILD*> >& BomManager:: - getDetailedList (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>:: - instance().getChildrenDetailedList (iParent); + return *lBomHolder_ptr; } - + // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> std::map<const MapKey_T, CHILD*>& - BomManager::getMap (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>::instance().getChildrenMap (iParent); + template <typename OBJECT2, typename OBJECT1> + const std::list<OBJECT2*>& BomManager::getList (const OBJECT1& iObject1) { + const BomHolder<OBJECT2>& lBomHolder = getBomHolder<OBJECT2> (iObject1); + return lBomHolder._bomList; } - + // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - const std::map<const PARENT*, std::list<CHILD*> >& BomManager:: - getParentChildrenList() { - return RelationShip<PARENT, CHILD>::instance().getParentChildrenList(); + template <typename OBJECT2, typename OBJECT1> + const std::map<const MapKey_T, OBJECT2*>& BomManager:: + getMap (const OBJECT1& iObject1) { + const BomHolder<OBJECT2>& lBomHolder = getBomHolder<OBJECT2> (iObject1); + return lBomHolder._bomMap; } - + // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - const std::map<const PARENT*, std::map<const MapKey_T, CHILD*> >& BomManager:: - getParentChildrenMap() { - return RelationShip<PARENT, CHILD>::instance().getParentChildrenMap(); - } + template <typename OBJECT2, typename OBJECT1> + bool BomManager::hasList (const OBJECT1& iObject1) { + const HolderMap_T& lHolderMap = iObject1.getHolderMap(); + HolderMap_T::const_iterator itHolder = lHolderMap.find (&typeid (OBJECT2)); + + if (itHolder == lHolderMap.end()) { + return false; + } + const BomHolder<OBJECT2>* lBomHolder_ptr = + static_cast<const BomHolder<OBJECT2>*> (itHolder->second); + assert (lBomHolder_ptr != NULL); - // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - bool BomManager::hasList (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>::instance().hasChildrenList (iParent); + return !lBomHolder_ptr._bomList.empty(); } - + // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - bool BomManager::hasDetailedList (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>:: - instance().hasChildrenDetailedList (iParent); - } + template <typename OBJECT2, typename OBJECT1> + bool BomManager::hasMap (const OBJECT1& iObject1) { + const HolderMap_T& lHolderMap = iObject1.getHolderMap(); + HolderMap_T::const_iterator itHolder = lHolderMap.find (&typeid (OBJECT2)); + + if (itHolder == lHolderMap.end()) { + return false; + } + const BomHolder<OBJECT2>* lBomHolder_ptr = + static_cast<const BomHolder<OBJECT2>*> (itHolder->second); + assert (lBomHolder_ptr != NULL); - // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - bool BomManager::hasMap (const PARENT& iParent) { - return RelationShip<PARENT, CHILD>::instance().hasChildrenMap (iParent); + return !lBomHolder_ptr._bomMap.empty(); } // //////////////////////////////////////////////////////////////////// template <typename PARENT, typename CHILD> PARENT& BomManager::getParent (const CHILD& iChild) { - return RelationShip<PARENT, CHILD>::instance().getParent (iChild); - } + PARENT* const lParent_ptr = + static_cast<PARENT* const> (iChild.getParent()); + assert (lParent_ptr != NULL); - // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - CHILD* BomManager::getChildPtr (const PARENT& iParent, const MapKey_T& iKey) { - return RelationShip<PARENT, CHILD>::instance().getChildPtr (iParent, iKey); + return *lParent_ptr; } // //////////////////////////////////////////////////////////////////// - template <typename CHILD, typename PARENT> - CHILD& BomManager::getChild (const PARENT& iParent, const MapKey_T& iKey) { - return RelationShip<PARENT, CHILD>::instance().getChild (iParent, iKey); - } + template <typename OBJECT2, typename OBJECT1> + OBJECT2* BomManager::getObjectPtr (const OBJECT1& iObject1, + const MapKey_T& iKey) { + OBJECT2* oBom_ptr = NULL; + + typedef std::map<const MapKey_T, OBJECT2*> BomMap_T; + const HolderMap_T& lHolderMap = iObject1.getHolderMap(); - // //////////////////////////////////////////////////////////////////// - template <typename BOM> - BOM* const BomManager::getObjectPtr (const std::map<const MapKey_T,BOM*>& iMap, - const MapKey_T& iKey) { - typename std::map<const MapKey_T, BOM*>::const_iterator it = iMap.find (iKey); - if (it == iMap.end()) { - return NULL; + typename HolderMap_T::const_iterator itHolder = + lHolderMap.find (&typeid (OBJECT2)); + + if (itHolder != lHolderMap.end()) { + + BomHolder<OBJECT2>* const lBomHolder_ptr = + static_cast<BomHolder<OBJECT2>* const> (itHolder->second); + assert (lBomHolder_ptr != NULL); + + BomMap_T& lBomMap = lBomHolder_ptr->_bomMap; + + typename BomMap_T::iterator itBom = lBomMap.find (iKey); + + if (itBom != lBomMap.end()) { + oBom_ptr = itBom->second; + assert (oBom_ptr != NULL); + } } - BOM* const oBom_ptr = it->second; - assert (oBom_ptr != NULL); + return oBom_ptr; } // //////////////////////////////////////////////////////////////////// - template <typename BOM> - BOM& BomManager::getObject (const std::map<const MapKey_T, BOM*>& iMap, - const MapKey_T& iKey) { - typename std::map<const MapKey_T, BOM*>::const_iterator it = iMap.find (iKey); - assert (it != iMap.end()); - BOM* const oBom_ptr = it->second; + template <typename OBJECT2, typename OBJECT1> + OBJECT2& BomManager::getObject (const OBJECT1& iObject1, const MapKey_T& iKey){ + + typedef std::map<const MapKey_T, OBJECT2*> BomMap_T; + const BomMap_T& lBomMap = getMap<OBJECT2> (iObject1); + + typename BomMap_T::const_iterator itBom = lBomMap.find (iKey); + + if (itBom == lBomMap.end()) { + std::string lName (typeid (OBJECT2).name()); + + STDAIR_LOG_ERROR ("Cannot find the objet of type " << lName + << " with key " << iKey << " within: " + << iObject1.describeKey()); + assert (false); + } + + OBJECT2* oBom_ptr = itBom->second; assert (oBom_ptr != NULL); + return *oBom_ptr; } + } #endif // __STDAIR_BOM_BOMMANAGER_HPP Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -12,6 +12,7 @@ /** Class representing the actual attributes for the Bom root. */ class BomRoot : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: /** Definition allowing to retrieve the associated BOM key type. */ @@ -19,10 +20,8 @@ public: // /////////// Getters ////////////// - /** Get the BomRoot key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + const HolderMap_T& getHolderMap() const { return _holderMap; } public: // /////////// Display support methods ///////// @@ -50,8 +49,8 @@ protected: // Attributes - /** The key of both structure and objects. */ - Key_T _key; + Key_T _key; + HolderMap_T _holderMap; }; } Modified: trunk/stdair/stdair/bom/BookingClass.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/BookingClass.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -11,7 +11,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - BookingClass::BookingClass (const Key_T& iKey) : _key (iKey) { + BookingClass::BookingClass (const Key_T& iKey) : _key (iKey), _parent (NULL) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline booking class. */ class BookingClass : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,15 +24,17 @@ public: // /////////// Getters //////////// /** Get the booking class key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } /** Get the booking code (part of the primary key). */ - const ClassCode_T& getClassCode() const { - return _key.getClassCode(); - } + const ClassCode_T& getClassCode() const { return _key.getClassCode(); } + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } + + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -63,6 +66,7 @@ public: // Attributes Key_T _key; + BomAbstract* _parent; SubclassCode_T _subclassCode; AuthorizationLevel_T _cumulatedProtection; AuthorizationLevel_T _protection; @@ -78,6 +82,7 @@ Availability_T _netClassAvailability; Availability_T _segmentAvailability; Availability_T _netRevenueAvailability; + HolderMap_T _holderMap; }; Modified: trunk/stdair/stdair/bom/Bucket.cpp =================================================================== --- trunk/stdair/stdair/bom/Bucket.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/Bucket.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -10,7 +10,7 @@ // //////////////////////////////////////////////////////////////////// Bucket::Bucket (const Key_T& iKey) - : _key (iKey) { + : _key (iKey), _parent (NULL) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Bucket.hpp =================================================================== --- trunk/stdair/stdair/bom/Bucket.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/Bucket.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline booking class. */ class Bucket : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,10 +24,14 @@ public: // /////////// Getters //////////// /** Get the booking class key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } + + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -52,8 +57,9 @@ public: // Attributes - /** The key of both structure and objects. */ Key_T _key; + BomAbstract* _parent; + HolderMap_T _holderMap; // test AIRINV stdair::Yield_T _yieldRangeUpperValue; stdair::CabinCapacity_T _availability; Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -10,7 +10,7 @@ // //////////////////////////////////////////////////////////////////// FlightDate::FlightDate (const Key_T& iKey) - : _key (iKey) { + : _key (iKey), _parent (NULL) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline flight-date. */ class FlightDate : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,9 +24,10 @@ public: // /////////// Getters /////////////// /** Get the flight-date key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } /** Get the flight number (part of the primary key). */ const FlightNumber_T& getFlightNumber() const { @@ -33,10 +35,11 @@ } /** Get the flight date (part of the primary key). */ - const Date_T& getFlightDate() const { - return _key.getFlightDate(); - } + const Date_T& getFlightDate() const { return _key.getFlightDate(); } + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -62,8 +65,9 @@ protected: // Attributes - /** The key of both structure and objects. */ Key_T _key; + BomAbstract* _parent; + HolderMap_T _holderMap; }; } Modified: trunk/stdair/stdair/bom/FlightPeriod.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/FlightPeriod.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -10,7 +10,7 @@ // //////////////////////////////////////////////////////////////////// FlightPeriod::FlightPeriod (const Key_T& iKey) - : _key (iKey) { + : _key (iKey), _parent (NULL) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/FlightPeriod.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/FlightPeriod.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline flight-period. */ class FlightPeriod : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,9 +24,10 @@ public: // /////////// Getters /////////////// /** Get the flight-period key. */ - const Key_T& getKey () const { - return _key; - } + const Key_T& getKey () const { return _key; } + + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } /** Get the flight number (part of the primary key). */ const FlightNumber_T& getFlightNumber () const { @@ -33,10 +35,12 @@ } /** Get the departure period (part of the key). */ - const PeriodStruct_T& getPeriod () const { - return _key.getPeriod(); - } + const PeriodStruct_T& getPeriod () const { return _key.getPeriod(); } + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + + public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -62,8 +66,9 @@ protected: // Attributes - /** The key of both structure and objects. */ Key_T _key; + BomAbstract* _parent; + HolderMap_T _holderMap; }; } Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/Inventory.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -9,7 +9,7 @@ namespace stdair { // //////////////////////////////////////////////////////////////////// - Inventory::Inventory (const Key_T& iKey) : _key (iKey) { + Inventory::Inventory (const Key_T& iKey) : _key (iKey), _parent (NULL) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -18,6 +18,7 @@ */ class Inventory : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public : // Type definitions @@ -42,16 +43,11 @@ public: // ////////// Getters //////////// - /** Get the inventory key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + const AirlineCode_T& getAirlineCode() const { return _key.getAirlineCode();} + BomAbstract* const getParent() const { return _parent; } + const HolderMap_T& getHolderMap() const { return _holderMap; } - /** Get the airline code. */ - const AirlineCode_T& getAirlineCode () const { - return _key.getAirlineCode(); - } - public: // /////////// Setters //////////// /** Set the airline feature. */ @@ -68,11 +64,10 @@ protected: // Attributes - /** The key of both structure and objects. */ Key_T _key; - - /** The feature set of the correspondent airline. */ + BomAbstract* _parent; const AirlineFeature* _airlineFeature; + HolderMap_T _holderMap; }; } Modified: trunk/stdair/stdair/bom/LegCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/LegCabin.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -12,15 +12,15 @@ // //////////////////////////////////////////////////////////////////// LegCabin::LegCabin (const Key_T& iKey) - : _key (iKey), - _offeredCapacity (DEFAULT_CABIN_CAPACITY), - _physicalCapacity (DEFAULT_CABIN_CAPACITY), - _soldSeat (DEFAULT_CLASS_NB_OF_BOOKINGS), - _commitedSpace (DEFAULT_COMMITED_SPACE), - _availabilityPool (DEFAULT_AVAILABILITY), - _availability (DEFAULT_AVAILABILITY), - _bidPriceVector (DEFAULT_BID_PRICE_VECTOR), - _currentBidPrice (DEFAULT_BID_PRICE) { + : _key (iKey), _parent (NULL), + _offeredCapacity (DEFAULT_CABIN_CAPACITY), + _physicalCapacity (DEFAULT_CABIN_CAPACITY), + _soldSeat (DEFAULT_CLASS_NB_OF_BOOKINGS), + _commitedSpace (DEFAULT_COMMITED_SPACE), + _availabilityPool (DEFAULT_AVAILABILITY), + _availability (DEFAULT_AVAILABILITY), + _bidPriceVector (DEFAULT_BID_PRICE_VECTOR), + _currentBidPrice (DEFAULT_BID_PRICE) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline leg-cabin. */ class LegCabin : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,19 +24,16 @@ public: // /////////// Getters //////////// /** Get the leg-cabin key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } /** Get the cabin code (from key). */ - const CabinCode_T& getCabinCode() const { - return _key.getCabinCode(); - } + const CabinCode_T& getCabinCode() const { return _key.getCabinCode(); } /** Get the cabin offered capacity. */ - const CabinCapacity_T& getOfferedCapacity () const { - return _offeredCapacity; - } + const CabinCapacity_T& getOfferedCapacity () const {return _offeredCapacity;} /** Get the cabin physical capacity. */ const CabinCapacity_T& getPhysicalCapacity () const { @@ -43,14 +41,10 @@ } /** Get the number of sold seat. */ - const NbOfBookings_T& getSoldSeat () const { - return _soldSeat; - } + const NbOfBookings_T& getSoldSeat () const { return _soldSeat; } /** Get the value of commited space. */ - const CommitedSpace_T& getCommitedSpace () const { - return _commitedSpace; - } + const CommitedSpace_T& getCommitedSpace () const { return _commitedSpace; } /** Get the value of the availability pool. */ const Availability_T& getAvailabilityPool () const { @@ -58,20 +52,17 @@ } /** Get the value of the availability. */ - const Availability_T& getAvailability () const { - return _availability; - } + const Availability_T& getAvailability () const { return _availability; } /** Retrive the current Bid-Price. */ - const BidPrice_T& getCurrentBidPrice () const { - return _currentBidPrice; - } + const BidPrice_T& getCurrentBidPrice () const { return _currentBidPrice; } /** Retrive the Bid-Price Vector. */ - BidPriceVector_T& getBidPriceVector () { - return _bidPriceVector; - } + BidPriceVector_T& getBidPriceVector () { return _bidPriceVector; } + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + public: // ///////////// Setters /////////////// /** Set the offered and physical capacities. */ @@ -147,33 +138,17 @@ stdair::NbOfBookings_T _groupNbOfBookings; protected: - // Attributes - /** The key of both structure and objects. */ Key_T _key; - - /** Offered capacity of the cabin. */ + BomAbstract* _parent; CabinCapacity_T _offeredCapacity; - - /** Physical capacity of the cabin. */ CabinCapacity_T _physicalCapacity; - - /** Sold seat into the cabin. */ NbOfBookings_T _soldSeat; - - /** Commited space for all segmentCabin composed by this LegCabin. */ CommitedSpace_T _commitedSpace; - - /** Availability Pool between capacity and commited spaces. */ Availability_T _availabilityPool; - - /** Availability Pool between capacity and commited spaces. */ Availability_T _availability; - - /** Bid Price Vector. */ BidPriceVector_T _bidPriceVector; - - /** Current BidPrice. */ BidPrice_T _currentBidPrice; + HolderMap_T _holderMap; }; } Modified: trunk/stdair/stdair/bom/LegDate.cpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.cpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/LegDate.cpp 2010-09-15 12:50:01 UTC (rev 331) @@ -11,8 +11,7 @@ // //////////////////////////////////////////////////////////////////// LegDate::LegDate (const Key_T& iKey) \ - : _key (iKey), - _distance (DEFAULT_DISTANCE_VALUE), + : _key (iKey), _parent (NULL), _distance (DEFAULT_DISTANCE_VALUE), _capacity (DEFAULT_CABIN_CAPACITY) { } Modified: trunk/stdair/stdair/bom/LegDate.hpp =================================================================== --- trunk/stdair/stdair/bom/LegDate.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/LegDate.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -14,6 +14,7 @@ /** Class representing the actual attributes for an airline leg-date. */ class LegDate : public BomAbstract { template <typename BOM> friend class FacBom; + friend class FacBomManager; public: // Type definitions. @@ -23,59 +24,42 @@ public: // /////////// Getters ///////////// /** Get the leg-date key. */ - const Key_T& getKey() const { - return _key; - } + const Key_T& getKey() const { return _key; } + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } + /** Get the boarding point (part of the primary key). */ const AirportCode_T& getBoardingPoint () const { return _key.getBoardingPoint(); } /** Get the off point. */ - const AirportCode_T& getOffPoint () const { - return _offPoint; - } + const AirportCode_T& getOffPoint () const { return _offPoint; } /** Get the boarding date. */ - const Date_T& getBoardingDate () const { - return _boardingDate; - } + const Date_T& getBoardingDate () const { return _boardingDate; } /** Get the boarding time. */ - const Duration_T& getBoardingTime () const { - return _boardingTime; - } + const Duration_T& getBoardingTime () const { return _boardingTime; } /** Get the off date. */ - const Date_T& getOffDate () const { - return _offDate; - } + const Date_T& getOffDate () const { return _offDate; } /** Get the off time. */ - const Duration_T& getOffTime () const { - return _offTime; - } + const Duration_T& getOffTime () const { return _offTime; } /** Get the elapsed time. */ - const Duration_T& getElapsedTime() const { - return _elapsedTime; - } + const Duration_T& getElapsedTime() const { return _elapsedTime; } /** Get the distance. */ - const Distance_T& getDistance() const { - return _distance; - } + const Distance_T& getDistance() const { return _distance; } /** Get the leg capacity. */ - const CabinCapacity_T& getCapacity () const { - return _capacity; - } + const CabinCapacity_T& getCapacity () const { return _capacity; } /** Get the date offset (off date - boarding date). */ - const DateOffset_T getDateOffset () const { - return _offDate - _boardingDate; - } + const DateOffset_T getDateOffset () const { return _offDate - _boardingDate;} /** Get the time off set between boarding and off points. <br>It is defined as being: @@ -83,12 +67,13 @@ - ElapsedTime. */ const Duration_T getTimeOffset() const; + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + public: // ///////// Setters ////////// /** Set the off point. */ - void setOffPoint (const AirportCode_T& iOffPoint) { - _offPoint = iOffPoint; - } + void setOffPoint (const AirportCode_T& iOffPoint) { _offPoint = iOffPoint; } /** Set the boarding date. */ void setBoardingDate (const Date_T& iBoardingDate) { @@ -101,14 +86,10 @@ } /** Set the off date. */ - void setOffDate (const Date_T& iOffDate) { - _offDate = iOffDate; - } + void setOffDate (const Date_T& iOffDate) { _offDate = iOffDate; } /** Set the off time. */ - void setOffTime (const Duration_T& iOffTime) { - _offTime = iOffTime; - } + void setOffTime (const Duration_T& iOffTime) { _offTime = iOffTime; } /** Set the elapsed time. */ void setElapsedTime (const Duration_T&); @@ -141,32 +122,17 @@ protected: // Attributes - /** The key of both structure and objects. */ Key_T _key; - - /** Off Point. */ + BomAbstract* _parent; AirportCode_T _offPoint; - - /** Boarding Date. */ Date_T _boardingDate; - - /** Boarding Time. */ Duration_T _boardingTime; - - /** Off Date. */ Date_T _offDate; - - /** Off Time. */ Duration_T _offTime; - - /** Elapsed Time. */ Duration_T _elapsedTime; - - /** Distance. */ Distance_T _distance; - - /** Capacity of the leg. */ CabinCapacity_T _capacity; + HolderMap_T _holderMap; }; } Deleted: trunk/stdair/stdair/bom/RelationShip.hpp =================================================================== --- trunk/stdair/stdair/bom/RelationShip.hpp 2010-09-13 06:49:06 UTC (rev 330) +++ trunk/stdair/stdair/bom/RelationShip.hpp 2010-09-15 12:50:01 UTC (rev 331) @@ -1,332 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -#ifndef __STDAIR_BOM_RELATIONSHIP_HPP -#define __STDAIR_BOM_RELATIONSHIP_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <map> -#include <list> -#include <cassert> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/RelationShipAbstract.hpp> -#include <stdair/service/FacSupervisor.hpp> -#include <stdair/service/Logger.hpp> - -namespace stdair { - - /** Class which holds the relation ship between different types of objects - (i.e. Inventory is parent of FlightDate). */ - template <typename PARENT, typename CHILD> - class RelationShip : public RelationShipAbstract { - friend class FacSupervisor; - friend class FacBomManager; - - // ////////////////////////////////////////////////////////////////// - // Internal type definitions. - typedef std::list<CHILD*> ChildrenList_T; - typedef std::list<std::pair<MapKey_T, CHILD*> > ChildrenDetailedList_T; - typedef std::map<const MapKey_T, CHILD*> ChildrenMap_T; - typedef std::map<const PARENT*, ChildrenList_T> ParentChildrentList_T; - typedef std::map<const PARENT*, - ChildrenDetailedList_T> ParentChildrentDetailedList_T; - typedef std::map<const PARENT*, ChildrenMap_T> ParentChildrentMap_T; - typedef std::map<const CHILD*, PARENT*> ChildParentMap_T; - // ////////////////////////////////////////////////////////////////// - - public: - /** Provide the unique instance. - <br> The singleton is instatiated when first used. - @return RelationShip& */ - static RelationShip& instance (); - - public: - // ////////////////////// Business Methods ///////////////////////// - /** Getter of the children conainter given the PARENT pointer. */ - ChildrenList_T& getChildrenList (const PARENT&); - ChildrenDetailedList_T& getChildrenDetailedList (const PARENT&); - ChildrenMap_T& getChildrenMap (const PARENT&); - - /** Getter of the attribute holders. */ - const ParentChildrentList_T& getParentChildrenList (); - const ParentChildrentMap_T& getParentChildrenMap (); - - /** Getter of the PARENT given the CHILD. */ - PARENT& getParent (const CHILD&); - - /** Return the CHILD pointer corresponding to the given string key. - If such a CHILD does not exist, return NULL. */ - CHILD* getChildPtr (const PARENT&, const MapKey_T&); - - /** Return the CHILD corresponding the the given string key. */ - CHILD& getChild (const PARENT&, const MapKey_T&); - - /** Check if the list/map of children has been initialised. */ - bool hasChildrenList (const PARENT&); - bool hasChildrenDetailedList (const PARENT&); - bool hasChildrenMap (const PARENT&); - - private: - /** Add the given CHILD to the children containter of the given PARENT. */ - void addChildToTheList (const PARENT&, CHILD&); - void addChildToTheDetailedList (const PARENT&, CHILD&, const MapKey_T&); - void addChildToTheMap (const PARENT&, CHILD&); - void addChildToTheMap (const PARENT&, CHILD&, const MapKey_T&); - - /** Link the CHILD with the PARENT. */ - void linkWithParent (PARENT&, const CHILD&); - - private: - /** Default constructor. */ - RelationShip () { } - /** Destructor. */ - ~RelationShip () { _instance = NULL; }; - - private: - /** The unique instance. */ - static RelationShip* _instance; - /** The containers of relation ships. */ - ParentChildrentList_T _parentChildrenList; - ParentChildrentDetailedList_T _parentChildrenDetailedList; - ParentChildrentMap_T _parentChildrenMap; - ChildParentMap_T _childParentMap; - }; - - // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - RelationShip<PARENT, CHILD>* RelationShip<PARENT, CHILD>::_instance = NULL; - - // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - RelationShip<PARENT, CHILD>& RelationShip<PARENT, CHILD>::instance () { - if (_instance == NULL) { - _instance = new RelationShip (); - assert (_instance != NULL); - - FacSupervisor::instance().registerRelationShip (_instance); - } - return *_instance; - } - - // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - typename RelationShip<PARENT, CHILD>::ChildrenList_T& - RelationShip<PARENT, CHILD>::getChildrenList (const PARENT& iParent) { - ParentChildrentList_T& lParentChildrenList = instance()._parentChildrenList; - typename ParentChildrentList_T::iterator itList = - lParentChildrenList.find (&iParent); - - if (itList == lParentChildrenList.end()) { - STDAIR_LOG_ERROR ("Cannot find the list within: "<< iParent.describeKey()); - throw NonInitialisedContainerException (); - } - - return itList->second; - } - - // //////////////////////////////////////////////////////////////////// - template <typename PARENT, typename CHILD> - typename Relation... [truncated message content] |
From: <den...@us...> - 2010-09-13 06:49:12
|
Revision: 330 http://stdair.svn.sourceforge.net/stdair/?rev=330&view=rev Author: denis_arnaud Date: 2010-09-13 06:49:06 +0000 (Mon, 13 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/BomRoot.hpp trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp trunk/stdair/test/archi_intru/FlightDate.hpp trunk/stdair/test/archi_intru/RelationShipHolder.hpp trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp Modified: trunk/stdair/test/archi_intru/BomRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -20,18 +20,20 @@ /** BomRoot. */ class BomRoot : public BomAbstract { + template <typename BOM> friend class FacBom; + template <typename NODE> friend struct delete_disposer; public: /** Constructors. */ BomRoot (const std::string& iKey) : BomAbstract (iKey) {} BomRoot (const int idx) : BomAbstract (idx) {} - /** Destructor. */ - ~BomRoot() {} private: /** Default constructors. <br>They are kept private, so as to forbid their use (only the public constructors should be used). */ BomRoot () {} BomRoot (const BomRoot&) {} + /** Destructor. */ + ~BomRoot() {} public: bi::list_member_hook<> _childListHook; Modified: trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -49,8 +49,14 @@ public: /** Constructor. */ - FacRelationShipRoot() : _relationShipHolderSet () { - } + FacRelationShipRoot() : _relationShipHolderSet ("DefaultRSHSet") {} + private: + /** Default constructors. + <br>They are kept private, so as to forbid their use (only the + public constructors should be used). */ + FacRelationShipRoot (const FacRelationShipRoot&) {} + /** Destructor. */ + ~FacRelationShipRoot() {} public: /** Add a child/sibling to the dedicated list of the parent/sibling. */ Modified: trunk/stdair/test/archi_intru/FlightDate.hpp =================================================================== --- trunk/stdair/test/archi_intru/FlightDate.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/FlightDate.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -20,11 +20,14 @@ /** FlightDate. */ class FlightDate : public BomAbstract { + template <typename BOM> friend class FacBom; + template <typename NODE> friend struct delete_disposer; public: /** Constructors. */ FlightDate (const std::string& iKey) : BomAbstract (iKey) {} FlightDate (const int idx) : BomAbstract (idx) {} - /** Destructor. */ + /** Destructor. + <br>Note: it should be private, but there is still a compilation bug. */ ~FlightDate() {} private: /** Default constructors. Modified: trunk/stdair/test/archi_intru/RelationShipHolder.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -44,14 +44,14 @@ ioSecondBom.getKey())), _firstBom (ioFirstBom) { } - /** Destructor. */ - ~RelationShipHolder() {} private: /** Default constructors. <br>They are kept private, so as to forbid their use (only the public constructors should be used). */ RelationShipHolder () {} RelationShipHolder (const RelationShipHolder&) {} + /** Destructor. */ + ~RelationShipHolder() {} public: bi::list_member_hook<> _childListHook; Modified: trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -25,7 +25,7 @@ _key = oStr.str(); } /** Destructor. */ - ~RelationShipHolderAbstract() {} + virtual ~RelationShipHolderAbstract() {} protected: /** Default constructors. Modified: trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp 2010-09-13 06:32:16 UTC (rev 329) +++ trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp 2010-09-13 06:49:06 UTC (rev 330) @@ -23,6 +23,7 @@ children or a Bom object and its siblings. */ template <typename FIRST_BOM, typename SECOND_BOM> class RelationShipHolderSet : public RelationShipHolderAbstract { + template <typename ONE, typename SECOND> friend class FacRelationShipRoot; public: // /////////////////////////////////////////// /** Type definition for the specific relationship class. */ @@ -45,9 +46,18 @@ public: /** Constructor. */ + RelationShipHolderSet (const std::string& iKey) + : RelationShipHolderAbstract (iKey) { + } + private: + /** Default constructors. + <br>They are kept private, so as to forbid their use (only the + public constructors should be used). */ RelationShipHolderSet () - : RelationShipHolderAbstract ("RelationShipHolderSet") { - } + : RelationShipHolderAbstract ("RelationShipHolderSet") {} + RelationShipHolderSet (const RelationShipHolderSet&) {} + /** Destructor. */ + ~RelationShipHolderSet() {} public: bi::list_member_hook<> _childListHook; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-13 06:32:22
|
Revision: 329 http://stdair.svn.sourceforge.net/stdair/?rev=329&view=rev Author: denis_arnaud Date: 2010-09-13 06:32:16 +0000 (Mon, 13 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/FacRelationShipRoot.hpp Modified: trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-13 06:31:18 UTC (rev 328) +++ trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-13 06:32:16 UTC (rev 329) @@ -27,25 +27,7 @@ // /////////////////////////////////////////// /** Type definition for the specific relationship class. */ typedef RelationShipHolder<FIRST_BOM, SECOND_BOM> RelationShipHolder_T; - /** Type definition for a list of relationship objects. */ - /* - typedef bi::member_hook <RelationShipHolder_T, - bi::list_member_hook<>, - &RelationShipHolder_T::_childListHook> RSHListMemberOption; - typedef bi::list<RelationShipHolder_T, - RSHListMemberOption> RelationShipHolderList_T; - */ - /** Type definition for a set of relationship objects. */ - /* - typedef bi::member_hook <RelationShipHolder_T, - bi::set_member_hook<>, - &RelationShipHolder_T::_childSetHook> RSHSetMemberOption; - typedef bi::set<RelationShipHolder_T, - RSHSetMemberOption> RelationShipHolderSet_T; - */ - // /////////////////////////////////////////// - // /////////////////////////////////////////// /** Type definition for the specific relationship holder (set) class. */ typedef RelationShipHolderSet<FIRST_BOM, SECOND_BOM> RelationShipHolderHolder_T; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-13 06:31:25
|
Revision: 328 http://stdair.svn.sourceforge.net/stdair/?rev=328&view=rev Author: denis_arnaud Date: 2010-09-13 06:31:18 +0000 (Mon, 13 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/BomRoot.hpp trunk/stdair/test/archi_intru/RelationShipHolder.hpp trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp Modified: trunk/stdair/test/archi_intru/BomRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-12 22:29:25 UTC (rev 327) +++ trunk/stdair/test/archi_intru/BomRoot.hpp 2010-09-13 06:31:18 UTC (rev 328) @@ -21,8 +21,17 @@ /** BomRoot. */ class BomRoot : public BomAbstract { public: + /** Constructors. */ BomRoot (const std::string& iKey) : BomAbstract (iKey) {} BomRoot (const int idx) : BomAbstract (idx) {} + /** Destructor. */ + ~BomRoot() {} + private: + /** Default constructors. + <br>They are kept private, so as to forbid their use (only the + public constructors should be used). */ + BomRoot () {} + BomRoot (const BomRoot&) {} public: bi::list_member_hook<> _childListHook; Modified: trunk/stdair/test/archi_intru/RelationShipHolder.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 22:29:25 UTC (rev 327) +++ trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-13 06:31:18 UTC (rev 328) @@ -44,6 +44,14 @@ ioSecondBom.getKey())), _firstBom (ioFirstBom) { } + /** Destructor. */ + ~RelationShipHolder() {} + private: + /** Default constructors. + <br>They are kept private, so as to forbid their use (only the + public constructors should be used). */ + RelationShipHolder () {} + RelationShipHolder (const RelationShipHolder&) {} public: bi::list_member_hook<> _childListHook; Modified: trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp 2010-09-12 22:29:25 UTC (rev 327) +++ trunk/stdair/test/archi_intru/RelationShipHolderAbstract.hpp 2010-09-13 06:31:18 UTC (rev 328) @@ -24,10 +24,8 @@ oStr << idx; _key = oStr.str(); } - /** Get the key. */ - const std::string& getKey() const { - return _key; - } + /** Destructor. */ + ~RelationShipHolderAbstract() {} protected: /** Default constructors. @@ -37,6 +35,12 @@ RelationShipHolderAbstract (const RelationShipHolderAbstract&) {} public: + /** Get the key. */ + const std::string& getKey() const { + return _key; + } + + public: // Comparison operators friend bool operator< (const RelationShipHolderAbstract& a, const RelationShipHolderAbstract& b) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <den...@us...> - 2010-09-12 22:03:26
|
Revision: 326 http://stdair.svn.sourceforge.net/stdair/?rev=326&view=rev Author: denis_arnaud Date: 2010-09-12 22:03:20 +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/FacRelationShipRoot.hpp Modified: trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 21:57:55 UTC (rev 325) +++ trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 22:03:20 UTC (rev 326) @@ -83,7 +83,8 @@ _relationShipHolderSet.addToList (*lRS_ptr); } - /** Add a child/sibling to the dedicated list of the parent/sibling. */ + /** Search for a child/sibling from the dedicated list of the + parents/siblings. */ static SECOND_BOM* find (const FIRST_BOM& iFirstBom, const std::string& iSecondBomKey) { SECOND_BOM* oSecondBom_ptr = @@ -91,7 +92,8 @@ return oSecondBom_ptr; } - /** Add a child/sibling to the dedicated list of the parent/sibling. */ + /** Search for a child/sibling from the dedicated list of the + parents/siblings. */ SECOND_BOM* findImpl (const FIRST_BOM& iFirstBom, const std::string& iSecondBomKey) { SECOND_BOM* oSecondBom_ptr = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-12 21:58:01
|
Revision: 325 http://stdair.svn.sourceforge.net/stdair/?rev=325&view=rev Author: denis_arnaud Date: 2010-09-12 21:57:55 +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/FacRelationShipRoot.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/RelationShipHolderSet.hpp Modified: trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp =================================================================== --- trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/FacRelationShipRoot.hpp 2010-09-12 21:57:55 UTC (rev 325) @@ -1,9 +1,11 @@ -#ifndef __INTRUSIVE_FAC_FACRELATIONSHIPHOLDER_HPP -#define __INTRUSIVE_FAC_FACRELATIONSHIPHOLDER_HPP +#ifndef __INTRUSIVE_FAC_FACRELATIONSHIPROOT_HPP +#define __INTRUSIVE_FAC_FACRELATIONSHIPROOT_HPP // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> // Boost.Intrusive #include <boost/intrusive/list.hpp> #include <boost/intrusive/set.hpp> @@ -11,6 +13,7 @@ #include <test/archi_intru/FacSupervisor.hpp> #include <test/archi_intru/FacRelationShipRootAbstract.hpp> #include <test/archi_intru/RelationShipHolder.hpp> +#include <test/archi_intru/RelationShipHolderSet.hpp> /** Alias for the boost::intrusive namespace. */ namespace bi = boost::intrusive; @@ -22,23 +25,32 @@ class FacRelationShipRoot : public FacRelationShipRootAbstract { public: // /////////////////////////////////////////// - /** Type definition for the specific relationship. */ + /** Type definition for the specific relationship class. */ typedef RelationShipHolder<FIRST_BOM, SECOND_BOM> RelationShipHolder_T; - - /** Type definition for a list of relationship holder objects. */ + /** Type definition for a list of relationship objects. */ + /* typedef bi::member_hook <RelationShipHolder_T, bi::list_member_hook<>, - &RelationShipHolder_T::_childListHook> RSHolderListMemberOption; + &RelationShipHolder_T::_childListHook> RSHListMemberOption; typedef bi::list<RelationShipHolder_T, - RSHolderListMemberOption> RelationShipHolderList_T; - /** Type definition for a set of relationship holder objects. */ + RSHListMemberOption> RelationShipHolderList_T; + */ + /** Type definition for a set of relationship objects. */ + /* typedef bi::member_hook <RelationShipHolder_T, bi::set_member_hook<>, - &RelationShipHolder_T::_childSetHook> RSHolderSetMemberOption; + &RelationShipHolder_T::_childSetHook> RSHSetMemberOption; typedef bi::set<RelationShipHolder_T, - RSHolderSetMemberOption> RelationShipHolderSet_T; + RSHSetMemberOption> RelationShipHolderSet_T; + */ // /////////////////////////////////////////// + // /////////////////////////////////////////// + /** Type definition for the specific relationship holder (set) class. */ + typedef RelationShipHolderSet<FIRST_BOM, + SECOND_BOM> RelationShipHolderHolder_T; + // /////////////////////////////////////////// + public: /** Provide the unique instance. <br>The singleton is instantiated when first used. @@ -52,6 +64,11 @@ } return *_instance; } + + public: + /** Constructor. */ + FacRelationShipRoot() : _relationShipHolderSet () { + } public: /** Add a child/sibling to the dedicated list of the parent/sibling. */ @@ -63,15 +80,28 @@ void addToListImpl (FIRST_BOM& ioFirstBom, SECOND_BOM& ioSecondBom) { RelationShipHolder_T* lRS_ptr = new RelationShipHolder_T (ioFirstBom, ioSecondBom); - _relationShipHolderList.push_back (*lRS_ptr); - _relationShipHolderSet.insert (*lRS_ptr); + _relationShipHolderSet.addToList (*lRS_ptr); } + /** Add a child/sibling to the dedicated list of the parent/sibling. */ + static SECOND_BOM* find (const FIRST_BOM& iFirstBom, + const std::string& iSecondBomKey) { + SECOND_BOM* oSecondBom_ptr = + instance().findImpl (iFirstBom, iSecondBomKey); + return oSecondBom_ptr; + } + + /** Add a child/sibling to the dedicated list of the parent/sibling. */ + SECOND_BOM* findImpl (const FIRST_BOM& iFirstBom, + const std::string& iSecondBomKey) { + SECOND_BOM* oSecondBom_ptr = + _relationShipHolderSet.find (iFirstBom, iSecondBomKey); + return oSecondBom_ptr; + } + private: - /** List of relationship holder objects. */ - RelationShipHolderList_T _relationShipHolderList; /** Set of relationship holder objects. */ - RelationShipHolderSet_T _relationShipHolderSet; + RelationShipHolderHolder_T _relationShipHolderSet; private: /** The unique instance. */ @@ -84,4 +114,4 @@ FacRelationShipRoot<FIRST_BOM, SECOND_BOM>::_instance = NULL; } -#endif // __INTRUSIVE_FAC_FACRELATIONSHIPHOLDER_HPP +#endif // __INTRUSIVE_FAC_FACRELATIONSHIPROOT_HPP Modified: trunk/stdair/test/archi_intru/RelationShipHolder.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/RelationShipHolder.hpp 2010-09-12 21:57:55 UTC (rev 325) @@ -6,8 +6,12 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> +// Boost.Intrusive +#include <boost/intrusive/list.hpp> +#include <boost/intrusive/set.hpp> // Local #include <test/archi_intru/RelationShipHolderAbstract.hpp> +#include <test/archi_intru/IntrusiveHelper.hpp> /** Alias for the boost::intrusive namespace. */ namespace bi = boost::intrusive; @@ -22,19 +26,37 @@ // /////////////////////////////////////////// /** Type definition for a list of either children or siblings. */ typedef bi::member_hook <SECOND_BOM, - bi::list_member_hook<>, - &SECOND_BOM::_childListHook> SecondBomListMemberOption; - typedef bi::list<SECOND_BOM, SecondBomListMemberOption> SecondBomList_T; + bi::set_member_hook<>, + &SECOND_BOM::_childSetHook> SecondBomSetMemberOption; + typedef bi::set<SECOND_BOM, SecondBomSetMemberOption> SecondBomSet_T; // /////////////////////////////////////////// public: RelationShipHolder (FIRST_BOM& ioFirstBom, SECOND_BOM& ioSecondBom) - : _firstBom (ioFirstBom) { + : RelationShipHolderAbstract (ioFirstBom.getKey() + "," + + ioSecondBom.getKey()), + _firstBom (ioFirstBom) { } public: bi::list_member_hook<> _childListHook; bi::set_member_hook<> _childSetHook; + + public: + /** Search for a child/sibling from the dedicated list of the + parents/siblings. */ + SECOND_BOM* find (const std::string& iSecondBomKey) { + SECOND_BOM* oSecondBom_ptr = NULL; + + typename SecondBomSet_T::iterator itSecondBom = + _secondBomSet.find (iSecondBomKey, StrExpComp<SECOND_BOM>()); + if (itSecondBom == _secondBomSet.end()) { + return oSecondBom_ptr; + } + oSecondBom_ptr = &*itSecondBom; + + return oSecondBom_ptr; + } public: // /////////// Display support methods ///////// @@ -53,7 +75,7 @@ /** Relationship, holding a list of children or siblings for a given parent/Bom object. */ FIRST_BOM& _firstBom; - SecondBomList_T _secondBomList; + SecondBomSet_T _secondBomSet; }; } Added: trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp =================================================================== --- trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp (rev 0) +++ trunk/stdair/test/archi_intru/RelationShipHolderSet.hpp 2010-09-12 21:57:55 UTC (rev 325) @@ -0,0 +1,103 @@ +#ifndef __INTRUSIVE_BOM_RELATIONSHIPHOLDERSET_HPP +#define __INTRUSIVE_BOM_RELATIONSHIPHOLDERSET_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// Boost.Intrusive +#include <boost/intrusive/list.hpp> +#include <boost/intrusive/set.hpp> +// Local +#include <test/archi_intru/RelationShipHolderAbstract.hpp> +#include <test/archi_intru/RelationShipHolder.hpp> +#include <test/archi_intru/IntrusiveHelper.hpp> + +/** Alias for the boost::intrusive namespace. */ +namespace bi = boost::intrusive; + +namespace stdair { + + /** 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 RelationShipHolderSet : public RelationShipHolderAbstract { + public: + // /////////////////////////////////////////// + /** Type definition for the specific relationship class. */ + typedef RelationShipHolder<FIRST_BOM, SECOND_BOM> RelationShipHolder_T; + + /** Type definition for a list of relationship objects. */ + typedef bi::member_hook <RelationShipHolder_T, + bi::list_member_hook<>, + &RelationShipHolder_T::_childListHook> RSHListMemberOption; + typedef bi::list<RelationShipHolder_T, + RSHListMemberOption> RelationShipHolderList_T; + + /** Type definition for a set of relationship objects. */ + typedef bi::member_hook <RelationShipHolder_T, + bi::set_member_hook<>, + &RelationShipHolder_T::_childSetHook> RSHSetMemberOption; + typedef bi::set<RelationShipHolder_T, + RSHSetMemberOption> RelationShipHolderSet_T; + // /////////////////////////////////////////// + + public: + /** Constructor. */ + RelationShipHolderSet () + : RelationShipHolderAbstract ("RelationShipHolderSet") { + } + + public: + bi::list_member_hook<> _childListHook; + bi::set_member_hook<> _childSetHook; + + public: + /** Add a child/sibling to the dedicated list of the parent/sibling. */ + void addToList (RelationShipHolder_T& ioRelationShipHolder) { + _relationShipHolderList.push_back (ioRelationShipHolder); + _relationShipHolderSet.insert (ioRelationShipHolder); + } + + /** Search for a child/sibling from the dedicated list of the + parents/siblings. */ + SECOND_BOM* find (const FIRST_BOM& iFirstBom, + const std::string& iSecondBomKey) { + SECOND_BOM* oSecondBom_ptr = NULL; + RelationShipHolder_T* oRSH_ptr = NULL; + + typename RelationShipHolderSet_T::iterator itRSH = + _relationShipHolderSet.find (iSecondBomKey, StrExpComp<RelationShipHolder_T>()); + if (itRSH == _relationShipHolderSet.end()) { + return oSecondBom_ptr; + } + oRSH_ptr = &*itRSH; + + oSecondBom_ptr = oRSH_ptr->find (iSecondBomKey); + + return oSecondBom_ptr; + } + + 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. */ + RelationShipHolderList_T _relationShipHolderList; + RelationShipHolderSet_T _relationShipHolderSet; + }; + +} +#endif // __INTRUSIVE_BOM_RELATIONSHIPHOLDERSET_HPP Modified: trunk/stdair/test/archi_intru/TestBomUsage.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 21:57:55 UTC (rev 325) @@ -20,12 +20,18 @@ namespace bi = boost::intrusive; // ////////////////////////////////////////////////////////////////////// +TestBomUsage::TestBomUsage() : _bomRoot (NULL) { + init(); +} + +// ////////////////////////////////////////////////////////////////////// TestBomUsage::~TestBomUsage() { clean(); } // ////////////////////////////////////////////////////////////////////// void TestBomUsage::init() { + _bomRoot = &stdair::FacBom<stdair::BomRoot>::instance().create ("BR"); } // ////////////////////////////////////////////////////////////////////// @@ -36,24 +42,64 @@ bool TestBomUsage::testBomBuilding() { bool oTestSuccessfull = true; - const std::string br0 ("BR"); - stdair::BomRoot& lBomRoot = - stdair::FacBom<stdair::BomRoot>::instance().create (br0); - + // 0. Sanity check + assert (_bomRoot != NULL); + + // 1. FlightDate level + // 1.1. BA177 const std::string fdba117 ("BA117"); stdair::FlightDate& lFDBA117 = stdair::FacBom<stdair::FlightDate>::instance().create (fdba117); stdair::FacRelationShipRoot<stdair::BomRoot, - stdair::FlightDate>::addToList(lBomRoot,lFDBA117); + stdair::FlightDate>::addToList (*_bomRoot, + lFDBA117); + // 1.2. LH434 + const std::string fdlh434 ("LH434"); + stdair::FlightDate& lFDLH434 = + stdair::FacBom<stdair::FlightDate>::instance().create (fdlh434); + + stdair::FacRelationShipRoot<stdair::BomRoot, + stdair::FlightDate>::addToList (*_bomRoot, + lFDLH434); + return oTestSuccessfull; } // ////////////////////////////////////////////////////////////////////// +bool TestBomUsage::testBomSearching() { + bool oTestSuccessfull = true; + + stdair::FlightDate* lFlightDate_ptr = + stdair::FacRelationShipRoot<stdair::BomRoot, + stdair::FlightDate>::find (*_bomRoot, "BA117"); + + // DEBUG + const std::string isFDNullStr = (lFlightDate_ptr == NULL)?"Yes":"No"; + std::cout << "Is FlightDate NULL? " << isFDNullStr << std::endl; + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// bool TestBomUsage::test() { bool oTestSuccessfull = true; + // + TestBomUsage lTestBomUsage; + + // Test the building of the BOM tree + oTestSuccessfull = lTestBomUsage.testBomBuilding(); + if (oTestSuccessfull == false) { + return oTestSuccessfull; + } + // Test searching within the BOM tree + oTestSuccessfull = lTestBomUsage.testBomSearching(); + if (oTestSuccessfull == false) { + return oTestSuccessfull; + } + return oTestSuccessfull; } Modified: trunk/stdair/test/archi_intru/TestBomUsage.hpp =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.hpp 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/TestBomUsage.hpp 2010-09-12 21:57:55 UTC (rev 325) @@ -9,9 +9,16 @@ // Local #include <test/archi_intru/FlightDate.hpp> +// Forward declarations +namespace stdair { + class BomRoot; +} + /** Class wrapping test functions. */ class TestBomUsage { public: + /** Constructor. */ + TestBomUsage(); /** Destructor. */ ~TestBomUsage(); @@ -23,6 +30,9 @@ /** Test the building of the BOM tree. */ bool testBomBuilding(); + /** Test the search within the BOM tree. */ + bool testBomSearching(); + private: /** Initialise. */ void init(); @@ -31,6 +41,7 @@ void clean(); private: + stdair::BomRoot* _bomRoot; }; #endif // __INTRUSIVE_TST_TESTBOMUSAGE_HPP Modified: trunk/stdair/test/archi_intru/TestIntrusive.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestIntrusive.cpp 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/TestIntrusive.cpp 2010-09-12 21:57:55 UTC (rev 325) @@ -7,7 +7,7 @@ #include <sstream> #include <string> #include <vector> -// Boost +// Boost.Intrusive #include <boost/intrusive/list.hpp> // Local #include <test/archi_intru/FacBom.hpp> @@ -165,13 +165,22 @@ lTestIntrusive.init(); // Now test lists - lTestIntrusive.testIntrusiveList(); + oTestSuccessfull = lTestIntrusive.testIntrusiveList(); + if (oTestSuccessfull == false) { + return oTestSuccessfull; + } // Now, test iterator_to() - lTestIntrusive.testIntrusiveIteratorTo(); + oTestSuccessfull = lTestIntrusive.testIntrusiveIteratorTo(); + if (oTestSuccessfull == false) { + return oTestSuccessfull; + } // Now, test sets - lTestIntrusive.testIntrusiveSets(); + oTestSuccessfull = lTestIntrusive.testIntrusiveSets(); + if (oTestSuccessfull == false) { + return oTestSuccessfull; + } return oTestSuccessfull; } Modified: trunk/stdair/test/archi_intru/sources.mk =================================================================== --- trunk/stdair/test/archi_intru/sources.mk 2010-09-12 19:11:43 UTC (rev 324) +++ trunk/stdair/test/archi_intru/sources.mk 2010-09-12 21:57:55 UTC (rev 325) @@ -7,6 +7,7 @@ $(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/RelationShipHolderSet.hpp \ $(top_srcdir)/test/archi_intru/BomAbstract.hpp \ $(top_srcdir)/test/archi_intru/BomRoot.hpp \ $(top_srcdir)/test/archi_intru/FlightDate.hpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <den...@us...> - 2010-09-12 17:23:14
|
Revision: 323 http://stdair.svn.sourceforge.net/stdair/?rev=323&view=rev Author: denis_arnaud Date: 2010-09-12 17:23:08 +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/archi.cpp trunk/stdair/test/archi_intru/sources.mk Added Paths: ----------- trunk/stdair/test/archi_intru/TestBomUsage.cpp trunk/stdair/test/archi_intru/TestBomUsage.hpp Copied: trunk/stdair/test/archi_intru/TestBomUsage.cpp (from rev 322, trunk/stdair/test/archi_intru/TestIntrusive.cpp) =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.cpp (rev 0) +++ trunk/stdair/test/archi_intru/TestBomUsage.cpp 2010-09-12 17:23:08 UTC (rev 323) @@ -0,0 +1,38 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iostream> +#include <sstream> +#include <string> +#include <vector> +// Boost +#include <boost/intrusive/list.hpp> +// Local +#include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/TestBomUsage.hpp> + +/** Alias for the boost::intrusive namespace. */ +namespace bi = boost::intrusive; + +// ////////////////////////////////////////////////////////////////////// +TestBomUsage::~TestBomUsage() { + clean(); +} + +// ////////////////////////////////////////////////////////////////////// +void TestBomUsage::init() { +} + +// ////////////////////////////////////////////////////////////////////// +void TestBomUsage::clean() { +} + +// ////////////////////////////////////////////////////////////////////// +bool TestBomUsage::test() { + bool oTestSuccessfull = true; + + + return oTestSuccessfull; +} Copied: trunk/stdair/test/archi_intru/TestBomUsage.hpp (from rev 322, trunk/stdair/test/archi_intru/TestIntrusive.hpp) =================================================================== --- trunk/stdair/test/archi_intru/TestBomUsage.hpp (rev 0) +++ trunk/stdair/test/archi_intru/TestBomUsage.hpp 2010-09-12 17:23:08 UTC (rev 323) @@ -0,0 +1,32 @@ +#ifndef __INTRUSIVE_TST_TESTBOMUSAGE_HPP +#define __INTRUSIVE_TST_TESTBOMUSAGE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// Local +#include <test/archi_intru/FlightDate.hpp> + +/** Class wrapping test functions. */ +class TestBomUsage { +public: + /** Destructor. */ + ~TestBomUsage(); + +public: + /** Perform the full test set. */ + static bool test(); + +private: + /** Initialise. */ + void init(); + + /** Cleaning. */ + void clean(); + +private: +}; + +#endif // __INTRUSIVE_TST_TESTBOMUSAGE_HPP Modified: trunk/stdair/test/archi_intru/archi.cpp =================================================================== --- trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 17:03:33 UTC (rev 322) +++ trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 17:23:08 UTC (rev 323) @@ -6,8 +6,7 @@ //#include <vector> // Local #include <test/archi_intru/TestIntrusive.hpp> -#include <test/archi_intru/BomRoot.hpp> -#include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/TestBomUsage.hpp> // /////////////////////////// M A I N ///////////////////////// /** Main. @@ -19,7 +18,15 @@ int main (int argc, char* argv[]) { // - TestIntrusive::test(); + const bool lTestIntrusiveSuccessfull = TestIntrusive::test(); + // + const bool lTestBomUsageSuccessfull = TestBomUsage::test(); + + if (lTestIntrusiveSuccessfull == false + || lTestBomUsageSuccessfull == false) { + return 1; + } + return 0; } Modified: trunk/stdair/test/archi_intru/sources.mk =================================================================== --- trunk/stdair/test/archi_intru/sources.mk 2010-09-12 17:03:33 UTC (rev 322) +++ trunk/stdair/test/archi_intru/sources.mk 2010-09-12 17:23:08 UTC (rev 323) @@ -8,7 +8,9 @@ $(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/TestIntrusive.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/TestIntrusive.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. |
From: <den...@us...> - 2010-09-12 17:03:40
|
Revision: 322 http://stdair.svn.sourceforge.net/stdair/?rev=322&view=rev Author: denis_arnaud Date: 2010-09-12 17:03:33 +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/archi.cpp trunk/stdair/test/archi_intru/sources.mk Added Paths: ----------- trunk/stdair/test/archi_intru/TestIntrusive.cpp trunk/stdair/test/archi_intru/TestIntrusive.hpp Removed Paths: ------------- trunk/stdair/test/archi_intru/TestManager.cpp trunk/stdair/test/archi_intru/TestManager.hpp Copied: trunk/stdair/test/archi_intru/TestIntrusive.cpp (from rev 321, trunk/stdair/test/archi_intru/TestManager.cpp) =================================================================== --- trunk/stdair/test/archi_intru/TestIntrusive.cpp (rev 0) +++ trunk/stdair/test/archi_intru/TestIntrusive.cpp 2010-09-12 17:03:33 UTC (rev 322) @@ -0,0 +1,175 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iostream> +#include <sstream> +#include <string> +#include <vector> +// Boost +#include <boost/intrusive/list.hpp> +// Local +#include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/TestIntrusive.hpp> + +/** Alias for the boost::intrusive namespace. */ +namespace bi = boost::intrusive; + +// ////////////////////////////////////////////////////////////////////// +TestIntrusive::~TestIntrusive() { + clean(); +} + +// ////////////////////////////////////////////////////////////////////// +void TestIntrusive::init() { + initStandard(); + initIntrusive(); +} + +// ////////////////////////////////////////////////////////////////////// +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); + } +} + +// ////////////////////////////////////////////////////////////////////// +void TestIntrusive::initIntrusive() { + // Now insert them in the same order as in vector in the member hook list + for (stdair::FlightDateVector_T::iterator itFlight(_flightDateVector.begin()), + itend (_flightDateVector.end()); itFlight != itend; ++itFlight) { + stdair::FlightDate* lFlightDate_ptr = *itFlight; + assert (lFlightDate_ptr != NULL); + + _flightDateChildList.push_back (*lFlightDate_ptr); + _flightDateChildSet.insert (*lFlightDate_ptr); + } + + // DEBUG + /* + std::cout << "Size of the Boost.Intrusive list of FlightDate objects: " + << lFlightDateChildList.size() << std::endl; + std::cout << "Size of the Boost.Intrusive set of FlightDate objects: " + << lFlightDateChildSet.size() << std::endl; + */ +} + +// ////////////////////////////////////////////////////////////////////// +void TestIntrusive::clean() { + _flightDateChildSet.clear(); + _flightDateChildList.clear_and_dispose(delete_disposer<stdair::FlightDate>()); +} + +// ////////////////////////////////////////////////////////////////////// +stdair::FlightDate* TestIntrusive::getFromSet (const std::string& iKey) { + stdair::FlightDate* oFlightDate_ptr = NULL; + stdair::FlightDateChildSet::iterator itFlight = + _flightDateChildSet.find (iKey, StrExpComp<stdair::FlightDate>()); + if (itFlight == _flightDateChildSet.end()) { + return oFlightDate_ptr; + } + oFlightDate_ptr = &*itFlight; + return oFlightDate_ptr; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestIntrusive::testIntrusiveList() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildList::iterator mit (_flightDateChildList.begin()), + mitend (_flightDateChildList.end()); + stdair::FlightDateVector_T::iterator itFlight (_flightDateVector.begin()), + itend (_flightDateVector.end()); + + // Test the objects inserted in the member hook list + for (itFlight = _flightDateVector.begin(); + itFlight != itend; ++itFlight, ++mit) { + stdair::FlightDate* lFlightDate_ptr = *itFlight; + assert (lFlightDate_ptr != NULL); + + if (&*mit != lFlightDate_ptr) { + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestIntrusive::testIntrusiveIteratorTo() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildList::iterator itChild(_flightDateChildList.begin()); + for (int idx = 0; idx < 100; ++idx, ++itChild) { + stdair::FlightDate* lFlightDate_ptr = _flightDateVector.at(idx); + assert (lFlightDate_ptr != NULL); + + if (_flightDateChildList.iterator_to (*lFlightDate_ptr) != itChild || + stdair::FlightDateChildList::s_iterator_to(*lFlightDate_ptr)!= itChild){ + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestIntrusive::testIntrusiveSets() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildSet::iterator itChild (_flightDateChildSet.begin()), + itChildEnd (_flightDateChildSet.end()); + for (; itChild != itChildEnd; ++itChild) { + const stdair::FlightDate& lFlightDate = *itChild; + + const std::string& lKey = lFlightDate.getKey(); + stdair::FlightDate* retrievedFlightDate_ptr = getFromSet (lKey); + + // DEBUG + /* + std::cout << "Key = '" << lKey << "', itFD = " + << &lFlightDate << ", retrieved: " << retrievedFlightDate_ptr + << std::endl; + */ + + if (retrievedFlightDate_ptr == NULL || + _flightDateChildSet.iterator_to (lFlightDate) != itChild || + _flightDateChildSet.iterator_to (*retrievedFlightDate_ptr) != itChild || + stdair::FlightDateChildSet::s_iterator_to (lFlightDate) != itChild || + stdair::FlightDateChildSet::s_iterator_to(*retrievedFlightDate_ptr) != itChild) { + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestIntrusive::test() { + bool oTestSuccessfull = true; + + // + TestIntrusive lTestIntrusive; + + // Initialise the internal (STL) vector, (Boost.Intrusive) list and set + lTestIntrusive.init(); + + // Now test lists + lTestIntrusive.testIntrusiveList(); + + // Now, test iterator_to() + lTestIntrusive.testIntrusiveIteratorTo(); + + // Now, test sets + lTestIntrusive.testIntrusiveSets(); + + return oTestSuccessfull; +} Copied: trunk/stdair/test/archi_intru/TestIntrusive.hpp (from rev 321, trunk/stdair/test/archi_intru/TestManager.hpp) =================================================================== --- trunk/stdair/test/archi_intru/TestIntrusive.hpp (rev 0) +++ trunk/stdair/test/archi_intru/TestIntrusive.hpp 2010-09-12 17:03:33 UTC (rev 322) @@ -0,0 +1,66 @@ +#ifndef __INTRUSIVE_TST_TESTINTRUSIVE_HPP +#define __INTRUSIVE_TST_TESTINTRUSIVE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// Local +#include <test/archi_intru/FlightDate.hpp> + +/** Class wrapping test functions. */ +class TestIntrusive { +public: + /** Destructor. */ + ~TestIntrusive(); + +public: + /** Perform the full test set. */ + static bool test(); + +private: + /** Initialise the internal vector, list and set. */ + void init(); + + /** Fill the standard (STL) vector. */ + void initStandard(); + + /** Fill the (Boost) Intrusive list (and set). */ + void initIntrusive(); + + /** Some memory cleaning. + <br>Note: the FlightDate objects cannot be simply deleted (with the + delete opearator). + <br>See also, for more details: + - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/usage.html#intrusive.usage.usage_lifetime + - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/erasing_and_disposing.html + <br>First, clear simply all the Boost.Intrusive containers but one. Then, + clear the last Boost.Intrusive container while deleting the corresponding + hooked objects. + */ + void clean(); + +private: + /** Optimized search functions */ + stdair::FlightDate* getFromSet (const std::string& iKey); + + /** Test (Boost) Intrusive lists. */ + bool testIntrusiveList(); + + /** Test (Boost) Intrusive iterator_to(). */ + bool testIntrusiveIteratorTo(); + + /** Test (Boost) Intrusive sets. */ + bool testIntrusiveSets(); + +private: + // Standard STL container + stdair::FlightDateVector_T _flightDateVector; + + // (Boost) Intrusive container + stdair::FlightDateChildList _flightDateChildList; + stdair::FlightDateChildSet _flightDateChildSet; +}; + +#endif // __INTRUSIVE_TST_TESTINTRUSIVE_HPP Deleted: trunk/stdair/test/archi_intru/TestManager.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestManager.cpp 2010-09-12 16:40:31 UTC (rev 321) +++ trunk/stdair/test/archi_intru/TestManager.cpp 2010-09-12 17:03:33 UTC (rev 322) @@ -1,153 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -#include <iostream> -#include <sstream> -#include <string> -#include <vector> -// Boost -#include <boost/intrusive/list.hpp> -// Local -#include <test/archi_intru/FlightDate.hpp> -#include <test/archi_intru/TestManager.hpp> - -/** Alias for the boost::intrusive namespace. */ -namespace bi = boost::intrusive; - -// ////////////////////////////////////////////////////////////////////// -TestManager::~TestManager() { - clean(); -} - -// ////////////////////////////////////////////////////////////////////// -void TestManager::init() { - initStandard(); - initIntrusive(); -} - -// ////////////////////////////////////////////////////////////////////// -void TestManager::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); - } -} - -// ////////////////////////////////////////////////////////////////////// -void TestManager::initIntrusive() { - // Now insert them in the same order as in vector in the member hook list - for (stdair::FlightDateVector_T::iterator itFlight(_flightDateVector.begin()), - itend (_flightDateVector.end()); itFlight != itend; ++itFlight) { - stdair::FlightDate* lFlightDate_ptr = *itFlight; - assert (lFlightDate_ptr != NULL); - - _flightDateChildList.push_back (*lFlightDate_ptr); - _flightDateChildSet.insert (*lFlightDate_ptr); - } - - // DEBUG - /* - std::cout << "Size of the Boost.Intrusive list of FlightDate objects: " - << lFlightDateChildList.size() << std::endl; - std::cout << "Size of the Boost.Intrusive set of FlightDate objects: " - << lFlightDateChildSet.size() << std::endl; - */ -} - -// ////////////////////////////////////////////////////////////////////// -void TestManager::clean() { - _flightDateChildSet.clear(); - _flightDateChildList.clear_and_dispose(delete_disposer<stdair::FlightDate>()); -} - -// ////////////////////////////////////////////////////////////////////// -stdair::FlightDate* TestManager::getFromSet (const std::string& iKey) { - stdair::FlightDate* oFlightDate_ptr = NULL; - stdair::FlightDateChildSet::iterator itFlight = - _flightDateChildSet.find (iKey, StrExpComp<stdair::FlightDate>()); - if (itFlight == _flightDateChildSet.end()) { - return oFlightDate_ptr; - } - oFlightDate_ptr = &*itFlight; - return oFlightDate_ptr; -} - -// ////////////////////////////////////////////////////////////////////// -bool TestManager::testIntrusiveList() { - bool oTestSuccessfull = true; - - stdair::FlightDateChildList::iterator mit (_flightDateChildList.begin()), - mitend (_flightDateChildList.end()); - stdair::FlightDateVector_T::iterator itFlight (_flightDateVector.begin()), - itend (_flightDateVector.end()); - - // Test the objects inserted in the member hook list - for (itFlight = _flightDateVector.begin(); - itFlight != itend; ++itFlight, ++mit) { - stdair::FlightDate* lFlightDate_ptr = *itFlight; - assert (lFlightDate_ptr != NULL); - - if (&*mit != lFlightDate_ptr) { - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; -} - -// ////////////////////////////////////////////////////////////////////// -bool TestManager::testIntrusiveIteratorTo() { - bool oTestSuccessfull = true; - - stdair::FlightDateChildList::iterator itChild(_flightDateChildList.begin()); - for (int idx = 0; idx < 100; ++idx, ++itChild) { - stdair::FlightDate* lFlightDate_ptr = _flightDateVector.at(idx); - assert (lFlightDate_ptr != NULL); - - if (_flightDateChildList.iterator_to (*lFlightDate_ptr) != itChild || - stdair::FlightDateChildList::s_iterator_to(*lFlightDate_ptr)!= itChild){ - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; -} - -// ////////////////////////////////////////////////////////////////////// -bool TestManager::testIntrusiveSets() { - bool oTestSuccessfull = true; - - stdair::FlightDateChildSet::iterator itChild (_flightDateChildSet.begin()), - itChildEnd (_flightDateChildSet.end()); - for (; itChild != itChildEnd; ++itChild) { - const stdair::FlightDate& lFlightDate = *itChild; - - const std::string& lKey = lFlightDate.getKey(); - stdair::FlightDate* retrievedFlightDate_ptr = getFromSet (lKey); - - // DEBUG - /* - std::cout << "Key = '" << lKey << "', itFD = " - << &lFlightDate << ", retrieved: " << retrievedFlightDate_ptr - << std::endl; - */ - - if (retrievedFlightDate_ptr == NULL || - _flightDateChildSet.iterator_to (lFlightDate) != itChild || - _flightDateChildSet.iterator_to (*retrievedFlightDate_ptr) != itChild || - stdair::FlightDateChildSet::s_iterator_to (lFlightDate) != itChild || - stdair::FlightDateChildSet::s_iterator_to(*retrievedFlightDate_ptr) != itChild) { - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; -} Deleted: trunk/stdair/test/archi_intru/TestManager.hpp =================================================================== --- trunk/stdair/test/archi_intru/TestManager.hpp 2010-09-12 16:40:31 UTC (rev 321) +++ trunk/stdair/test/archi_intru/TestManager.hpp 2010-09-12 17:03:33 UTC (rev 322) @@ -1,63 +0,0 @@ -#ifndef __INTRUSIVE_TST_TESTMANAGER_HPP -#define __INTRUSIVE_TST_TESTMANAGER_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -// Local -#include <test/archi_intru/FlightDate.hpp> - -/** Class wrapping test functions. */ -class TestManager { -public: - /** Destructor. */ - ~TestManager(); - -public: - /** Initialise the internal vector, list and set. */ - void init(); - -private: - /** Fill the standard (STL) vector. */ - void initStandard(); - - /** Fill the (Boost) Intrusive list (and set). */ - void initIntrusive(); - - /** Some memory cleaning. - <br>Note: the FlightDate objects cannot be simply deleted (with the - delete opearator). - <br>See also, for more details: - - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/usage.html#intrusive.usage.usage_lifetime - - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/erasing_and_disposing.html - <br>First, clear simply all the Boost.Intrusive containers but one. Then, - clear the last Boost.Intrusive container while deleting the corresponding - hooked objects. - */ - void clean(); - -public: - /** Optimized search functions */ - stdair::FlightDate* getFromSet (const std::string& iKey); - - /** Test (Boost) Intrusive lists. */ - bool testIntrusiveList(); - - /** Test (Boost) Intrusive iterator_to(). */ - bool testIntrusiveIteratorTo(); - - /** Test (Boost) Intrusive sets. */ - bool testIntrusiveSets(); - -private: - // Standard STL container - stdair::FlightDateVector_T _flightDateVector; - - // (Boost) Intrusive container - stdair::FlightDateChildList _flightDateChildList; - stdair::FlightDateChildSet _flightDateChildSet; -}; - -#endif // __INTRUSIVE_TST_TESTMANAGER_HPP Modified: trunk/stdair/test/archi_intru/archi.cpp =================================================================== --- trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 16:40:31 UTC (rev 321) +++ trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 17:03:33 UTC (rev 322) @@ -5,7 +5,9 @@ //#include <string> //#include <vector> // Local -#include <test/archi_intru/TestManager.hpp> +#include <test/archi_intru/TestIntrusive.hpp> +#include <test/archi_intru/BomRoot.hpp> +#include <test/archi_intru/FlightDate.hpp> // /////////////////////////// M A I N ///////////////////////// /** Main. @@ -17,19 +19,7 @@ int main (int argc, char* argv[]) { // - TestManager lTestManager; + TestIntrusive::test(); - // Initialise the internal (STL) vector, (Boost.Intrusive) list and set - lTestManager.init(); - - // Now test lists - lTestManager.testIntrusiveList(); - - // Now, test iterator_to() - lTestManager.testIntrusiveIteratorTo(); - - // Now, test sets - lTestManager.testIntrusiveSets(); - return 0; } Modified: trunk/stdair/test/archi_intru/sources.mk =================================================================== --- trunk/stdair/test/archi_intru/sources.mk 2010-09-12 16:40:31 UTC (rev 321) +++ trunk/stdair/test/archi_intru/sources.mk 2010-09-12 17:03:33 UTC (rev 322) @@ -8,7 +8,7 @@ $(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/TestManager.hpp + $(top_srcdir)/test/archi_intru/TestIntrusive.hpp archi_intru_cc_sources = \ $(top_srcdir)/test/archi_intru/FacSupervisor.cpp \ - $(top_srcdir)/test/archi_intru/TestManager.cpp + $(top_srcdir)/test/archi_intru/TestIntrusive.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-12 16:40:37
|
Revision: 321 http://stdair.svn.sourceforge.net/stdair/?rev=321&view=rev Author: denis_arnaud Date: 2010-09-12 16:40:31 +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/FlightDate.hpp trunk/stdair/test/archi_intru/TestManager.cpp trunk/stdair/test/archi_intru/TestManager.hpp trunk/stdair/test/archi_intru/archi.cpp Modified: trunk/stdair/test/archi_intru/FlightDate.hpp =================================================================== --- trunk/stdair/test/archi_intru/FlightDate.hpp 2010-09-12 16:23:47 UTC (rev 320) +++ trunk/stdair/test/archi_intru/FlightDate.hpp 2010-09-12 16:40:31 UTC (rev 321) @@ -5,8 +5,8 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <cassert> #include <string> +#include <vector> // Boost.Intrusive #include <boost/intrusive/list.hpp> #include <boost/intrusive/set.hpp> @@ -67,5 +67,6 @@ typedef bi::member_hook <FlightDate, bi::set_member_hook<>, &FlightDate::_childSetHook> FlightDateSetMemberOption; typedef bi::set<FlightDate, FlightDateSetMemberOption> FlightDateChildSet; + } #endif // __INTRUSIVE_BOM_FLIGHTDATE_HPP Modified: trunk/stdair/test/archi_intru/TestManager.cpp =================================================================== --- trunk/stdair/test/archi_intru/TestManager.cpp 2010-09-12 16:23:47 UTC (rev 320) +++ trunk/stdair/test/archi_intru/TestManager.cpp 2010-09-12 16:40:31 UTC (rev 321) @@ -0,0 +1,153 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <iostream> +#include <sstream> +#include <string> +#include <vector> +// Boost +#include <boost/intrusive/list.hpp> +// Local +#include <test/archi_intru/FlightDate.hpp> +#include <test/archi_intru/TestManager.hpp> + +/** Alias for the boost::intrusive namespace. */ +namespace bi = boost::intrusive; + +// ////////////////////////////////////////////////////////////////////// +TestManager::~TestManager() { + clean(); +} + +// ////////////////////////////////////////////////////////////////////// +void TestManager::init() { + initStandard(); + initIntrusive(); +} + +// ////////////////////////////////////////////////////////////////////// +void TestManager::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); + } +} + +// ////////////////////////////////////////////////////////////////////// +void TestManager::initIntrusive() { + // Now insert them in the same order as in vector in the member hook list + for (stdair::FlightDateVector_T::iterator itFlight(_flightDateVector.begin()), + itend (_flightDateVector.end()); itFlight != itend; ++itFlight) { + stdair::FlightDate* lFlightDate_ptr = *itFlight; + assert (lFlightDate_ptr != NULL); + + _flightDateChildList.push_back (*lFlightDate_ptr); + _flightDateChildSet.insert (*lFlightDate_ptr); + } + + // DEBUG + /* + std::cout << "Size of the Boost.Intrusive list of FlightDate objects: " + << lFlightDateChildList.size() << std::endl; + std::cout << "Size of the Boost.Intrusive set of FlightDate objects: " + << lFlightDateChildSet.size() << std::endl; + */ +} + +// ////////////////////////////////////////////////////////////////////// +void TestManager::clean() { + _flightDateChildSet.clear(); + _flightDateChildList.clear_and_dispose(delete_disposer<stdair::FlightDate>()); +} + +// ////////////////////////////////////////////////////////////////////// +stdair::FlightDate* TestManager::getFromSet (const std::string& iKey) { + stdair::FlightDate* oFlightDate_ptr = NULL; + stdair::FlightDateChildSet::iterator itFlight = + _flightDateChildSet.find (iKey, StrExpComp<stdair::FlightDate>()); + if (itFlight == _flightDateChildSet.end()) { + return oFlightDate_ptr; + } + oFlightDate_ptr = &*itFlight; + return oFlightDate_ptr; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestManager::testIntrusiveList() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildList::iterator mit (_flightDateChildList.begin()), + mitend (_flightDateChildList.end()); + stdair::FlightDateVector_T::iterator itFlight (_flightDateVector.begin()), + itend (_flightDateVector.end()); + + // Test the objects inserted in the member hook list + for (itFlight = _flightDateVector.begin(); + itFlight != itend; ++itFlight, ++mit) { + stdair::FlightDate* lFlightDate_ptr = *itFlight; + assert (lFlightDate_ptr != NULL); + + if (&*mit != lFlightDate_ptr) { + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestManager::testIntrusiveIteratorTo() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildList::iterator itChild(_flightDateChildList.begin()); + for (int idx = 0; idx < 100; ++idx, ++itChild) { + stdair::FlightDate* lFlightDate_ptr = _flightDateVector.at(idx); + assert (lFlightDate_ptr != NULL); + + if (_flightDateChildList.iterator_to (*lFlightDate_ptr) != itChild || + stdair::FlightDateChildList::s_iterator_to(*lFlightDate_ptr)!= itChild){ + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} + +// ////////////////////////////////////////////////////////////////////// +bool TestManager::testIntrusiveSets() { + bool oTestSuccessfull = true; + + stdair::FlightDateChildSet::iterator itChild (_flightDateChildSet.begin()), + itChildEnd (_flightDateChildSet.end()); + for (; itChild != itChildEnd; ++itChild) { + const stdair::FlightDate& lFlightDate = *itChild; + + const std::string& lKey = lFlightDate.getKey(); + stdair::FlightDate* retrievedFlightDate_ptr = getFromSet (lKey); + + // DEBUG + /* + std::cout << "Key = '" << lKey << "', itFD = " + << &lFlightDate << ", retrieved: " << retrievedFlightDate_ptr + << std::endl; + */ + + if (retrievedFlightDate_ptr == NULL || + _flightDateChildSet.iterator_to (lFlightDate) != itChild || + _flightDateChildSet.iterator_to (*retrievedFlightDate_ptr) != itChild || + stdair::FlightDateChildSet::s_iterator_to (lFlightDate) != itChild || + stdair::FlightDateChildSet::s_iterator_to(*retrievedFlightDate_ptr) != itChild) { + oTestSuccessfull = false; + break; + } + } + + return oTestSuccessfull; +} Modified: trunk/stdair/test/archi_intru/TestManager.hpp =================================================================== --- trunk/stdair/test/archi_intru/TestManager.hpp 2010-09-12 16:23:47 UTC (rev 320) +++ trunk/stdair/test/archi_intru/TestManager.hpp 2010-09-12 16:40:31 UTC (rev 321) @@ -1,63 +1,31 @@ -#ifndef __LATUS_STDAIR_TST_TESTMANAGER_HPP -#define __LATUS_STDAIR_TST_TESTMANAGER_HPP +#ifndef __INTRUSIVE_TST_TESTMANAGER_HPP +#define __INTRUSIVE_TST_TESTMANAGER_HPP // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <cassert> -#include <iostream> -#include <sstream> #include <string> -#include <vector> -// Boost -#include <boost/intrusive/list.hpp> // Local #include <test/archi_intru/FlightDate.hpp> -//#include <test/archi_intru/FacRelationShipRoot.hpp> -/** Alias for the boost::intrusive namespace. */ -namespace bi = boost::intrusive; - /** Class wrapping test functions. */ class TestManager { public: /** Destructor. */ - ~TestManager() { clean(); } + ~TestManager(); public: + /** Initialise the internal vector, list and set. */ + void init(); + +private: /** Fill the standard (STL) vector. */ - void 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); - } - } + void initStandard(); /** Fill the (Boost) Intrusive list (and set). */ - void initIntrusive() { - // Now insert them in the same order as in vector in the member hook list - for (stdair::FlightDateVector_T::iterator itFlight (_flightDateVector.begin()), - itend (_flightDateVector.end()); itFlight != itend; ++itFlight) { - stdair::FlightDate* lFlightDate_ptr = *itFlight; - assert (lFlightDate_ptr != NULL); - - _flightDateChildList.push_back (*lFlightDate_ptr); - _flightDateChildSet.insert (*lFlightDate_ptr); - } - - // DEBUG - /* - std::cout << "Size of the Boost.Intrusive list of FlightDate objects: " - << lFlightDateChildList.size() << std::endl; - std::cout << "Size of the Boost.Intrusive set of FlightDate objects: " - << lFlightDateChildSet.size() << std::endl; - */ - } - + void initIntrusive(); + /** Some memory cleaning. <br>Note: the FlightDate objects cannot be simply deleted (with the delete opearator). @@ -68,99 +36,22 @@ clear the last Boost.Intrusive container while deleting the corresponding hooked objects. */ - void clean() { - _flightDateChildSet.clear(); - _flightDateChildList.clear_and_dispose (delete_disposer<stdair::FlightDate>()); - } - + void clean(); + +public: /** Optimized search functions */ - stdair::FlightDate* getFromSet (const std::string& iKey) { - stdair::FlightDate* oFlightDate_ptr = NULL; - stdair::FlightDateChildSet::iterator itFlight = - _flightDateChildSet.find (iKey, StrExpComp<stdair::FlightDate>()); - if (itFlight == _flightDateChildSet.end()) { - return oFlightDate_ptr; - } - oFlightDate_ptr = &*itFlight; - return oFlightDate_ptr; - } + stdair::FlightDate* getFromSet (const std::string& iKey); /** Test (Boost) Intrusive lists. */ - bool testIntrusiveList() { - bool oTestSuccessfull = true; - - stdair::FlightDateChildList::iterator mit (_flightDateChildList.begin()), - mitend (_flightDateChildList.end()); - stdair::FlightDateVector_T::iterator itFlight (_flightDateVector.begin()), - itend (_flightDateVector.end()); + bool testIntrusiveList(); - // Test the objects inserted in the member hook list - for (itFlight = _flightDateVector.begin(); - itFlight != itend; ++itFlight, ++mit) { - stdair::FlightDate* lFlightDate_ptr = *itFlight; - assert (lFlightDate_ptr != NULL); - - if (&*mit != lFlightDate_ptr) { - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; - } - /** Test (Boost) Intrusive iterator_to(). */ - bool testIntrusiveIteratorTo() { - bool oTestSuccessfull = true; - - stdair::FlightDateChildList::iterator itChild(_flightDateChildList.begin()); - for (int idx = 0; idx < 100; ++idx, ++itChild) { - stdair::FlightDate* lFlightDate_ptr = _flightDateVector.at(idx); - assert (lFlightDate_ptr != NULL); - - if (_flightDateChildList.iterator_to (*lFlightDate_ptr) != itChild || - stdair::FlightDateChildList::s_iterator_to(*lFlightDate_ptr) != itChild) { - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; - } + bool testIntrusiveIteratorTo(); /** Test (Boost) Intrusive sets. */ - bool testIntrusiveSets() { - bool oTestSuccessfull = true; + bool testIntrusiveSets(); - stdair::FlightDateChildSet::iterator itChild (_flightDateChildSet.begin()), - itChildEnd (_flightDateChildSet.end()); - for (; itChild != itChildEnd; ++itChild) { - const stdair::FlightDate& lFlightDate = *itChild; - - const std::string& lKey = lFlightDate.getKey(); - stdair::FlightDate* retrievedFlightDate_ptr = getFromSet (lKey); - - // DEBUG - /* - std::cout << "Key = '" << lKey << "', itFD = " - << &lFlightDate << ", retrieved: " << retrievedFlightDate_ptr - << std::endl; - */ - - if (retrievedFlightDate_ptr == NULL || - _flightDateChildSet.iterator_to (lFlightDate) != itChild || - _flightDateChildSet.iterator_to (*retrievedFlightDate_ptr) != itChild || - stdair::FlightDateChildSet::s_iterator_to (lFlightDate) != itChild || - stdair::FlightDateChildSet::s_iterator_to(*retrievedFlightDate_ptr) != itChild) { - oTestSuccessfull = false; - break; - } - } - - return oTestSuccessfull; - } - -public: +private: // Standard STL container stdair::FlightDateVector_T _flightDateVector; @@ -169,4 +60,4 @@ stdair::FlightDateChildSet _flightDateChildSet; }; -#endif // __LATUS_STDAIR_TST_TESTMANAGER_HPP +#endif // __INTRUSIVE_TST_TESTMANAGER_HPP Modified: trunk/stdair/test/archi_intru/archi.cpp =================================================================== --- trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 16:23:47 UTC (rev 320) +++ trunk/stdair/test/archi_intru/archi.cpp 2010-09-12 16:40:31 UTC (rev 321) @@ -1,17 +1,12 @@ // STL #include <cassert> -#include <iostream> -#include <sstream> -#include <string> -#include <vector> -// Boost -#include <boost/intrusive/list.hpp> +//#include <iostream> +//#include <sstream> +//#include <string> +//#include <vector> // Local #include <test/archi_intru/TestManager.hpp> -/** Alias for the boost::intrusive namespace. */ -namespace bi = boost::intrusive; - // /////////////////////////// M A I N ///////////////////////// /** Main. <br>Run with the following command: @@ -24,10 +19,8 @@ // TestManager lTestManager; - // Fill the standard (STL) vector - lTestManager.initStandard(); - - lTestManager.initIntrusive(); + // Initialise the internal (STL) vector, (Boost.Intrusive) list and set + lTestManager.init(); // Now test lists lTestManager.testIntrusiveList(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |