From: <qua...@us...> - 2010-08-03 08:30:51
|
Revision: 256 http://stdair.svn.sourceforge.net/stdair/?rev=256&view=rev Author: quannaus Date: 2010-08-03 08:30:45 +0000 (Tue, 03 Aug 2010) Log Message: ----------- [dev] Added reset funtions for trademgen. Modified Paths: -------------- trunk/stdair/stdair/basic/RandomGenerationContext.cpp trunk/stdair/stdair/basic/RandomGenerationContext.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp Modified: trunk/stdair/stdair/basic/RandomGenerationContext.cpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-03 08:30:45 UTC (rev 256) @@ -29,4 +29,10 @@ ++_numberOfRequestsGeneratedSoFar; } + // ////////////////////////////////////////////////////////////////////// + void RandomGenerationContext::reset () { + _cumulativeProbabilitySoFar = 0.0; + _numberOfRequestsGeneratedSoFar = 0; + } + } Modified: trunk/stdair/stdair/basic/RandomGenerationContext.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-03 08:30:45 UTC (rev 256) @@ -26,6 +26,9 @@ /** Increment counter of requests generated so far */ void incrementGeneratedRequestsCounter (); + /** Reset the counters. */ + void reset (); + // ////////// Attributes ////////// /** Cumulative probability in arrival pattern for last request generated so far (needed for sequential generation)*/ Modified: trunk/stdair/stdair/bom/DemandStream.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.cpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/bom/DemandStream.cpp 2010-08-03 08:30:45 UTC (rev 256) @@ -46,5 +46,10 @@ // //////////////////////////////////////////////////////////////////// void DemandStream::init () { } - + + // //////////////////////////////////////////////////////////////////// + void DemandStream::reset () { + DemandStreamContent::init (); + _randomGenerationContext.reset(); + } } Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-08-02 13:58:47 UTC (rev 255) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-08-03 08:30:45 UTC (rev 256) @@ -64,6 +64,11 @@ at any level). */ const std::string describeKey() const { return _key.toString(); } + public: + // ////////// Business Methods ////////// + /** Reset all the contexts of the demand stream. */ + void reset (); + protected: // ////////// Constructors and destructors ///////// /** Constructor by default */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |