$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59053 - sandbox/chrono/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2010-01-15 12:22:10
Author: viboes
Date: 2010-01-15 12:22:09 EST (Fri, 15 Jan 2010)
New Revision: 59053
URL: http://svn.boost.org/trac/boost/changeset/59053
Log:
Boost.Chrono: Version 0.3.0, 
* Added stopclock
Added:
   sandbox/chrono/boost/chrono/stopclock.hpp   (contents, props changed)
Text files modified: 
   sandbox/chrono/boost/chrono/process_cpu_clocks.hpp |     2 +-                                      
   sandbox/chrono/boost/chrono/stopwatch_reporter.hpp |    34 ++++++++++++++++++----------------      
   2 files changed, 19 insertions(+), 17 deletions(-)
Modified: sandbox/chrono/boost/chrono/process_cpu_clocks.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/process_cpu_clocks.hpp	(original)
+++ sandbox/chrono/boost/chrono/process_cpu_clocks.hpp	2010-01-15 12:22:09 EST (Fri, 15 Jan 2010)
@@ -112,7 +112,7 @@
             }
         };
 
-        typedef duration<times,  nano>                duration;
+        typedef boost::chrono::duration<times,  nano>                duration;
         typedef duration::rep                       rep;
         typedef duration::period                    period;
         typedef chrono::time_point<process_cpu_clock>  time_point;
Added: sandbox/chrono/boost/chrono/stopclock.hpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/boost/chrono/stopclock.hpp	2010-01-15 12:22:09 EST (Fri, 15 Jan 2010)
@@ -0,0 +1,95 @@
+//  boost/chrono/timer.hpp  ------------------------------------------------------------//
+
+//  Copyright 2009-2010 Vicente J. Botet Escriba
+
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying
+//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/libs/system for documentation.
+
+#ifndef BOOST_CHRONO_STOPCLOCK_HPP
+#define BOOST_CHRONO_STOPCLOCK_HPP
+
+#include <boost/chrono/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatch.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+
+#include <boost/config/abi_prefix.hpp> // must be the last #include
+
+namespace boost { namespace chrono  {
+
+//--------------------------------------------------------------------------------------//
+//~ provides a everything a Timer provides and it adds reporting capabilities that can be invoked in a single line of code. The reporting is controleed by two parameters:
+
+    //~ * format : The output format
+    //~ * places(precission): the number of decimal placess used.
+
+//~ The default places is given by default_places and is 3. The default format is "\n%ts\n", where
+
+    //~ * %t : the result of elapsed() when the reporting is done. 
+
+//~ The time is given using the suffix "s" following the System International d'Unites Std.     
+
+/* void f1()
+ * {
+ *      stopclock<> _;
+ *      // ...
+ * }    
+ */
+//--------------------------------------------------------------------------------------//
+
+    template <class Clock=process_cpu_clock, class Stopwatch=stopwatch<Clock>, class Formatter=typename stopwatch_reporter_default_formatter<Stopwatch>::type> 
+    class stopclock : public stopwatch_reporter<Stopwatch, Formatter> {
+        typedef stopwatch_reporter<Stopwatch, Formatter> base_type;
+    public:
+        explicit stopclock( system::error_code & ec = system::throws )
+        : base_type(ec) { }
+        explicit stopclock( std::ostream & os,
+                    system::error_code & ec = system::throws )
+        : base_type(os, ec) { }
+
+        explicit stopclock( const std::string & format,
+                    system::error_code & ec = system::throws )
+        : base_type(format, ec) { }
+
+        explicit stopclock( int places,
+                    system::error_code & ec = system::throws )
+        : base_type(places, ec) { }
+        
+        stopclock( std::ostream & os, const std::string & format,
+                    system::error_code & ec = system::throws )
+        : base_type(os, format, ec) { }
+
+        stopclock( const std::string & format, int places,
+                    system::error_code & ec = system::throws )
+        : base_type(format, places, ec) { }
+        
+        stopclock( std::ostream & os, int places,
+                    system::error_code & ec = system::throws )
+        : base_type(os, places, ec) { }
+
+        stopclock( int places, const std::string & format,
+                    system::error_code & ec = system::throws )
+        : base_type(places, format, ec) { }
+        
+        stopclock( std::ostream & os, const std::string & format, int places,
+                    system::error_code & ec = system::throws )
+        : base_type(os, format, places, ec) { }
+
+        stopclock( std::ostream & os, int places, const std::string & format,
+                    system::error_code & ec = system::throws )
+        : base_type(os, places, format, ec) { }
+
+        
+        typedef typename base_type::scoped_run scoped_run;
+        typedef typename base_type::scoped_suspend scoped_suspend;
+        typedef typename base_type::scoped_resume scoped_resume;        
+    };
+    
+
+  } // namespace chrono
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
+
+#endif // BOOST_CHRONO_STOPCLOCK_HPP
Modified: sandbox/chrono/boost/chrono/stopwatch_reporter.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopwatch_reporter.hpp	(original)
+++ sandbox/chrono/boost/chrono/stopwatch_reporter.hpp	2010-01-15 12:22:09 EST (Fri, 15 Jan 2010)
@@ -83,37 +83,40 @@
     class stopwatch_reporter : public Stopwatch {
     public:
         explicit stopwatch_reporter( system::error_code & ec = system::throws )
-        : m_places(Formatter::m_default_places), m_os(Formatter::m_cout()), m_reported(false) { }
+        : m_places(Formatter::m_default_places), m_os(Formatter::m_cout()), m_format(Formatter::default_format), m_reported(false) { }
         explicit stopwatch_reporter( std::ostream & os,
                     system::error_code & ec = system::throws )
-        : m_places(Formatter::m_default_places), m_os(os), m_reported(false) { }
+        : m_places(Formatter::m_default_places), m_os(os), m_format(Formatter::default_format), m_reported(false) { }
 
         explicit stopwatch_reporter( const std::string & format,
                     system::error_code & ec = system::throws )
         : m_places(Formatter::m_default_places), m_os(Formatter::m_cout()), m_format(format), m_reported(false) {}
 
-        explicit stopwatch_reporter( std::ostream & os, const std::string & format,
+        explicit stopwatch_reporter( int places,
+                    system::error_code & ec = system::throws )
+        : m_places(places), m_os(Formatter::m_cout()), m_format(Formatter::default_format), m_reported(false) { }
+
+        stopwatch_reporter( std::ostream & os, const std::string & format,
                     system::error_code & ec = system::throws )
         : m_places(Formatter::m_default_places), m_os(os), m_format(format), m_reported(false) { }
 
-        explicit stopwatch_reporter( const std::string & format, int places,
+        stopwatch_reporter( const std::string & format, int places,
                     system::error_code & ec = system::throws )
         : m_places(places), m_os(Formatter::m_cout()), m_format(format), m_reported(false) { }
-        explicit stopwatch_reporter( std::ostream & os, const std::string & format, int places,
+        
+        stopwatch_reporter( std::ostream & os, int places,
                     system::error_code & ec = system::throws )
-        : m_places(places), m_os(os), m_reported(false) { }
-
-        explicit stopwatch_reporter( int places,
+        : m_places(places), m_os(os), m_format(Formatter::default_format), m_reported(false) { }
+        
+        stopwatch_reporter( int places, const std::string & format,
                     system::error_code & ec = system::throws )
-        : m_places(places), m_os(Formatter::m_cout()), m_reported(false) { }
-        explicit stopwatch_reporter( std::ostream & os, int places,
+        : m_places(places), m_os(Formatter::m_cout()), m_format(format), m_reported(false) { }
+        
+        stopwatch_reporter( std::ostream & os, const std::string & format, int places,
                     system::error_code & ec = system::throws )
-        : m_places(places), m_os(os), m_reported(false) { }
+        : m_places(places), m_os(os), m_format(format), m_reported(false) { }
 
-        explicit stopwatch_reporter( int places, const std::string & format,
-                    system::error_code & ec = system::throws )
-        : m_places(places), m_os(Formatter::m_cout()), m_format(format), m_reported(false) { }
-        explicit stopwatch_reporter( std::ostream & os, int places, const std::string & format,
+        stopwatch_reporter( std::ostream & os, int places, const std::string & format,
                     system::error_code & ec = system::throws )
         : m_places(places), m_os(os), m_format(format), m_reported(false) { }
 
@@ -166,7 +169,6 @@
             
     }
 
-    
 
   } // namespace chrono
 } // namespace boost