Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65111 - sandbox/chrono/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2010-08-29 14:24:37


Author: viboes
Date: 2010-08-29 14:24:36 EDT (Sun, 29 Aug 2010)
New Revision: 65111
URL: http://svn.boost.org/trac/boost/changeset/65111

Log:
interface change for stopwatch_accumulator
Text files modified:
   sandbox/chrono/boost/chrono/stopclock_accumulator.hpp | 24 ++++++++++++------------
   sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp | 20 ++++++++++----------
   2 files changed, 22 insertions(+), 22 deletions(-)

Modified: sandbox/chrono/boost/chrono/stopclock_accumulator.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopclock_accumulator.hpp (original)
+++ sandbox/chrono/boost/chrono/stopclock_accumulator.hpp 2010-08-29 14:24:36 EDT (Sun, 29 Aug 2010)
@@ -45,33 +45,33 @@
  */
 //--------------------------------------------------------------------------------------//
 
- template <class Clock, class Accumulator>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Accumulator> > {
+ template <class Clock, typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Features,Weight> > {
         typedef stopwatch_accumulator_formatter type;
     };
 
- template <class Clock, class Accumulator>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Accumulator> > {
+ template <class Clock, typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Features,Weight> > {
         typedef wstopwatch_accumulator_formatter type;
     };
 
- template <class Accumulator>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock,Accumulator> > {
+ template <typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock,Features,Weight> > {
         typedef stopwatch_accumulator_time_formatter type;
     };
 
- template <class Accumulator>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock, Accumulator> > {
+ template <typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock, Features,Weight> > {
         typedef wstopwatch_accumulator_time_formatter type;
     };
 
- template <class Accumulator>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<suspendible_clock<process_cpu_clock>, Accumulator> > {
+ template <typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<suspendible_clock<process_cpu_clock>, Features,Weight> > {
         typedef stopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock> >::type type;
     };
 
- template <class Accumulator>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<suspendible_clock<process_cpu_clock>, Accumulator> > {
+ template <typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<suspendible_clock<process_cpu_clock>, Features,Weight> > {
         typedef wstopwatch_reporter_default_formatter<stopwatch_accumulator<process_cpu_clock> >::type type;
     };
 

Modified: sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp (original)
+++ sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp 2010-08-29 14:24:36 EDT (Sun, 29 Aug 2010)
@@ -42,23 +42,23 @@
 
     // forward declaration
     template <class Clock=high_resolution_clock,
- class Accumulator=accumulators::accumulator_set<typename Clock::duration::rep,
- accumulators::features<
+ typename Features=accumulators::features<
                         accumulators::tag::count,
                         accumulators::tag::sum,
                         accumulators::tag::min,
                         accumulators::tag::max,
- accumulators::tag::mean >
- >
+ accumulators::tag::mean >,
+ typename Weight=void
>
     class stopwatch_accumulator;
 
 
 //--------------------------------------------------------------------------------------//
- template <class Clock, class Accumulator>
+ template <class Clock, typename Features, typename Weight>
     class stopwatch_accumulator
     {
     public:
+ typedef accumulators::accumulator_set<typename Clock::duration::rep, Features, Weight> Accumulator;
         typedef Clock clock;
         typedef typename Clock::duration duration;
         typedef typename Clock::time_point time_point;
@@ -171,6 +171,7 @@
 
         void reset( system::error_code & ec = system::throws ) {
             construction_=clock::now( ec );
+ if (ec) return;
             accumulated_ = accumulator();
             running_=false;
             suspended_=false;
@@ -178,7 +179,6 @@
             start_ = time_point(duration::zero());
             level_=0;
             suspend_level_=0;
- ec.clear();
         }
 
         accumulator& accumulated( ) { return accumulated_; }
@@ -186,10 +186,10 @@
             return clock::now( ec ) - construction_;
         }
 
- typedef stopwatch_runner<stopwatch_accumulator<Clock> > scoped_run;
- typedef stopwatch_stopper<stopwatch_accumulator<Clock> > scoped_stop;
- typedef stopwatch_suspender<stopwatch_accumulator<Clock> > scoped_suspend;
- typedef stopwatch_resumer<stopwatch_accumulator<Clock> > scoped_resume;
+ typedef stopwatch_runner<stopwatch_accumulator<Clock,Features,Weight> > scoped_run;
+ typedef stopwatch_stopper<stopwatch_accumulator<Clock,Features,Weight> > scoped_stop;
+ typedef stopwatch_suspender<stopwatch_accumulator<Clock,Features,Weight> > scoped_suspend;
+ typedef stopwatch_resumer<stopwatch_accumulator<Clock,Features,Weight> > scoped_resume;
     private:
         bool running_;
         bool suspended_;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk