From: <qua...@us...> - 2010-05-26 13:14:00
|
Revision: 190 http://stdair.svn.sourceforge.net/stdair/?rev=190&view=rev Author: quannaus Date: 2010-05-26 13:13:51 +0000 (Wed, 26 May 2010) Log Message: ----------- [Dev] Fixed a bug in the cloning process in FacBomContent.hpp Modified Paths: -------------- trunk/stdair/stdair/bom/OutboundPath.cpp trunk/stdair/stdair/bom/OutboundPath.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.hpp Modified: trunk/stdair/stdair/bom/OutboundPath.cpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.cpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/OutboundPath.cpp 2010-05-26 13:13:51 UTC (rev 190) @@ -189,7 +189,8 @@ } // //////////////////////////////////////////////////////////////////// - const Duration_T OutboundPath::calculateElapsedTimeFromRouting () const { + const Duration_T OutboundPath:: + calculateElapsedTimeFromRouting (const SegmentDate& iSegmentDate) const { const SegmentDateList_T& lAllSegmentList = getSegmentDateList(); SegmentDateList_T::iterator itSegmentDate = lAllSegmentList.begin(); @@ -228,7 +229,15 @@ lCurrentSegmentDate_ptr->getElapsedTime(); oElapsedTime += currentElapsedTime; } - + + SegmentDateList_T::reverse_iterator itLastSegmentDate = + lAllSegmentList.rbegin(); + const SegmentDate& lLastSegmentDate = *itLastSegmentDate; + const Duration_T& lLastStop = iSegmentDate.getBoardingTime() + - lLastSegmentDate.getOffTime(); + oElapsedTime += lLastStop; + oElapsedTime += iSegmentDate.getElapsedTime(); + // Store the result return oElapsedTime; } Modified: trunk/stdair/stdair/bom/OutboundPath.hpp =================================================================== --- trunk/stdair/stdair/bom/OutboundPath.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/OutboundPath.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -98,7 +98,7 @@ <br>Of course, in case of mono-segment outbound pathes, there is no stop-over, and the elapsed time of the outbound-path is equal to the elapsed time of the single routing segment. */ - const Duration_T calculateElapsedTimeFromRouting ()const; + const Duration_T calculateElapsedTimeFromRouting (const SegmentDate&) const; /** Update Airline Code. */ void updateAirlineCode (); Modified: trunk/stdair/stdair/bom/SegmentDate.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/bom/SegmentDate.cpp 2010-05-26 13:13:51 UTC (rev 190) @@ -79,20 +79,26 @@ bool SegmentDate:: isConnectable (const SegmentDate& iSegmentDate) const { bool oIsConnectable = false; - - const Date_T& lOffDate = getOffDate(); - const Date_T& lBoardingDate = iSegmentDate.getBoardingDate(); - const DateOffSet_T lDateOffSet = lBoardingDate - lOffDate; - const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); - - const Duration_T& lOffTime = getOffTime(); - const Duration_T& lBoardingTime = iSegmentDate.getBoardingTime(); - - const Duration_T lStopOverTime = - lBoardingTime - lOffTime + lDateOffSetInHours; - oIsConnectable = lStopOverTime >= DEFAULT_MINIMUM_CONNECTION_TIME; + const AirportCode_T lOffPoint = getOffPoint(); + const AirportCode_T lBoardingPointOfNextSegment = + iSegmentDate.getBoardingPoint(); + if (lOffPoint == lBoardingPointOfNextSegment) { + const Date_T& lOffDate = getOffDate(); + const Date_T& lBoardingDate = iSegmentDate.getBoardingDate(); + const DateOffSet_T lDateOffSet = lBoardingDate - lOffDate; + const Duration_T lDateOffSetInHours (lDateOffSet.days() * 24, 0, 0); + + const Duration_T& lOffTime = getOffTime(); + const Duration_T& lBoardingTime = iSegmentDate.getBoardingTime(); + + const Duration_T lStopOverTime = + lBoardingTime - lOffTime + lDateOffSetInHours; + + oIsConnectable = lStopOverTime >= DEFAULT_MINIMUM_CONNECTION_TIME; + } + return oIsConnectable; } Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -68,6 +68,9 @@ ioChild._structure); if (hasLinkBeenSuccessful == false) { + std::cout << "link with parent" << std::endl; + std::cout << ioParent.describeKey() << std::endl; + std::cout << ioChild.describeShortKey() << std::endl; throw ObjectLinkingException(); } } @@ -123,8 +126,13 @@ typedef BomChildrenHolderImp<CHILD> CHILDREN_HOLDER_T; CHILDREN_HOLDER_T*& lChildrenHolder_ptr = boost::fusion::at_key<CHILD> (ioParent._structure._holderMap); - lChildrenHolder_ptr = + CHILDREN_HOLDER_T*& lReferenceChildrenHolder_ptr = boost::fusion::at_key<CHILD> (iReferenceParent._structure._holderMap); + assert (lReferenceChildrenHolder_ptr != NULL); + + FacBomStructure:: + cloneChildrenHolder (lChildrenHolder_ptr, + *lReferenceChildrenHolder_ptr); } private: Modified: trunk/stdair/stdair/factory/FacBomStructure.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-05-03 14:57:07 UTC (rev 189) +++ trunk/stdair/stdair/factory/FacBomStructure.hpp 2010-05-26 13:13:51 UTC (rev 190) @@ -161,7 +161,19 @@ return true; } - + + // ////////////////////////////////////////////////////////////////// + /** Clone the children holder.*/ + template <typename HOLDER> + static void cloneChildrenHolder (HOLDER*& ioHolder_ptr, + const HOLDER& iReferenceHolder) { + if (ioHolder_ptr == NULL) { + ioHolder_ptr = &instance().create<HOLDER> (); + } + ioHolder_ptr->_bomChildrenMap = iReferenceHolder._bomChildrenMap; + ioHolder_ptr->_bomChildrenList = iReferenceHolder._bomChildrenList; + } + protected: /** Default Constructor. <br>This constructor is protected to ensure the class is structure. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |