Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74741 - in trunk/boost/chrono: . io
From: vicente.botet_at_[hidden]
Date: 2011-10-05 10:51:35


Author: viboes
Date: 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
New Revision: 74741
URL: http://svn.boost.org/trac/boost/changeset/74741

Log:
Chrono: Move clock_string specializations to the respective clock files.
Text files modified:
   trunk/boost/chrono/chrono_io.hpp | 2
   trunk/boost/chrono/config.hpp | 2
   trunk/boost/chrono/duration.hpp | 2
   trunk/boost/chrono/io/clock_string.hpp | 171 ---------------------------------------
   trunk/boost/chrono/io/duration_io.hpp | 2
   trunk/boost/chrono/io/duration_unit_string.hpp | 2
   trunk/boost/chrono/io/time_point_io.hpp | 3
   trunk/boost/chrono/io/translate.hpp | 2
   trunk/boost/chrono/process_cpu_clocks.hpp | 90 ++++++++++++++++++++
   trunk/boost/chrono/system_clocks.hpp | 52 +++++++++++
   trunk/boost/chrono/thread_clock.hpp | 26 +++++
   trunk/boost/chrono/time_point.hpp | 2
   12 files changed, 174 insertions(+), 182 deletions(-)

Modified: trunk/boost/chrono/chrono_io.hpp
==============================================================================
--- trunk/boost/chrono/chrono_io.hpp (original)
+++ trunk/boost/chrono/chrono_io.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -2,7 +2,7 @@
 // chrono_io
 //
 // (C) Copyright Howard Hinnant
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).

Modified: trunk/boost/chrono/config.hpp
==============================================================================
--- trunk/boost/chrono/config.hpp (original)
+++ trunk/boost/chrono/config.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,7 +1,7 @@
 // boost/chrono/config.hpp -------------------------------------------------//
 
 // Copyright Beman Dawes 2003, 2006, 2008
-// Copyright 2009 Vicente J. Botet Escriba
+// Copyright 2009-2011 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)

Modified: trunk/boost/chrono/duration.hpp
==============================================================================
--- trunk/boost/chrono/duration.hpp (original)
+++ trunk/boost/chrono/duration.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -2,7 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

Modified: trunk/boost/chrono/io/clock_string.hpp
==============================================================================
--- trunk/boost/chrono/io/clock_string.hpp (original)
+++ trunk/boost/chrono/io/clock_string.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,5 +1,5 @@
 //
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).
@@ -8,10 +8,6 @@
 #ifndef BOOST_CHRONO_IO_CLOCK_STRING_HPP
 #define BOOST_CHRONO_IO_CLOCK_STRING_HPP
 
-#include <boost/chrono/config.hpp>
-#include <boost/chrono/chrono.hpp>
-#include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/thread_clock.hpp>
 #include <string>
 
 namespace boost
@@ -22,169 +18,8 @@
     template<class Clock, class CharT>
     struct clock_string;
 
- template<class CharT>
- struct clock_string<system_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT u[] =
- { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- static const CharT
- u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- };
-
-#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
-
- template<class CharT>
- struct clock_string<steady_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT
- u[] =
- { 'm', 'o', 'n', 'o', 't', 'o', 'n', 'i', 'c', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' };
- const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
- return str;
- }
- };
-
-#endif
-
-#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
-
- template <class CharT>
- struct clock_string<thread_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT u[] =
- { 't', 'h', 'r', 'e', 'd', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- };
-
-#endif
-
-#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
-
- template<class CharT>
- struct clock_string<process_real_cpu_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT
- u[] =
- { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT
- u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
- const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
- return str;
- }
- };
-
- template<class CharT>
- struct clock_string<process_user_cpu_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT
- u[] =
- { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT
- u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
- const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
- return str;
- }
- };
-
- template<class CharT>
- struct clock_string<process_system_cpu_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT
- u[] =
- { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT
- u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
- const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
- return str;
- }
- };
-
- template<class CharT>
- struct clock_string<process_cpu_clock, CharT>
- {
- static std::basic_string<CharT> name()
- {
- static const CharT u[] =
- { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'c', 'l', 'o', 'c', 'k' };
- static const std::basic_string<CharT> str(u, u + sizeof(u)
- / sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT
- u[] =
- { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
- const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
- return str;
- }
- };
-#endif
-
   } // chrono
 
-}
+} // boost
 
-#endif // BOOST_CHRONO_CHRONO_IO_HPP
+#endif // BOOST_CHRONO_IO_CLOCK_STRING_HPP

Modified: trunk/boost/chrono/io/duration_io.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_io.hpp (original)
+++ trunk/boost/chrono/io/duration_io.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,7 +1,7 @@
 // chrono_io
 //
 // (C) Copyright Howard Hinnant
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).

Modified: trunk/boost/chrono/io/duration_unit_string.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_unit_string.hpp (original)
+++ trunk/boost/chrono/io/duration_unit_string.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,5 +1,5 @@
 //
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).

Modified: trunk/boost/chrono/io/time_point_io.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_io.hpp (original)
+++ trunk/boost/chrono/io/time_point_io.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,7 +1,7 @@
 // chrono_io
 //
 // (C) Copyright Howard Hinnant
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).
@@ -12,7 +12,6 @@
 #ifndef BOOST_CHRONO_IO_TIME_POINT_IO_HPP
 #define BOOST_CHRONO_IO_TIME_POINT_IO_HPP
 
-#include <boost/chrono/io/clock_string.hpp>
 #include <boost/chrono/io/duration_io.hpp>
 #include <boost/chrono/chrono.hpp>
 #include <locale>

Modified: trunk/boost/chrono/io/translate.hpp
==============================================================================
--- trunk/boost/chrono/io/translate.hpp (original)
+++ trunk/boost/chrono/io/translate.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,5 +1,5 @@
 //
-// (C) Copyright 2010 Vicente J. Botet Escriba
+// (C) Copyright 2011 Vicente J. Botet Escriba
 // Use, modification and distribution are subject to 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).

Modified: trunk/boost/chrono/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/process_cpu_clocks.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,6 +1,6 @@
 // boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
 
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -21,6 +21,7 @@
 #include <boost/chrono/detail/system.hpp>
 #include <iostream>
 #include <boost/type_traits/common_type.hpp>
+#include <boost/chrono/io/clock_string.hpp>
 
 
 #ifndef BOOST_CHRONO_HEADER_ONLY
@@ -343,6 +344,93 @@
         }
     };
 
+ template<class CharT>
+ struct clock_string<process_real_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_user_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_system_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
 } // namespace chrono
 } // namespace boost
 

Modified: trunk/boost/chrono/system_clocks.hpp
==============================================================================
--- trunk/boost/chrono/system_clocks.hpp (original)
+++ trunk/boost/chrono/system_clocks.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,8 +1,8 @@
-// chrono.hpp --------------------------------------------------------------//
+// system_clocks.hpp --------------------------------------------------------------//
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -64,6 +64,7 @@
 #include <boost/chrono/time_point.hpp>
 #include <boost/chrono/detail/system.hpp>
 #include <boost/system/error_code.hpp>
+#include <boost/chrono/io/clock_string.hpp>
 
 #include <ctime>
 
@@ -163,6 +164,53 @@
 // See synopsis.
 
 
+ template<class CharT>
+ struct clock_string<system_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ static const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ };
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+
+ template<class CharT>
+ struct clock_string<steady_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 's', 't', 'e', 'a', 'd', 'y', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+#endif
+
 } // namespace chrono
 } // namespace boost
 

Modified: trunk/boost/chrono/thread_clock.hpp
==============================================================================
--- trunk/boost/chrono/thread_clock.hpp (original)
+++ trunk/boost/chrono/thread_clock.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -1,6 +1,6 @@
-// boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
+// boost/chrono/thread_clock.hpp -----------------------------------------------------------//
 
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -17,6 +17,7 @@
 #include <boost/chrono/time_point.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/chrono/detail/system.hpp>
+#include <boost/chrono/io/clock_string.hpp>
 
 #ifndef BOOST_CHRONO_HEADER_ONLY
 #include <boost/config/abi_prefix.hpp> // must be the last #include
@@ -35,6 +36,27 @@
     static BOOST_CHRONO_INLINE time_point now( ) BOOST_CHRONO_NOEXCEPT;
     static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
 };
+
+template <class CharT>
+struct clock_string<thread_clock, CharT>
+{
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 't', 'h', 'r', 'e', 'd', '_',
+ 'c', 'l','o', 'c', 'k'};
+ static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
+ const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
+ return str;
+ }
+};
+
 } // namespace chrono
 } // namespace boost
 

Modified: trunk/boost/chrono/time_point.hpp
==============================================================================
--- trunk/boost/chrono/time_point.hpp (original)
+++ trunk/boost/chrono/time_point.hpp 2011-10-05 10:51:33 EDT (Wed, 05 Oct 2011)
@@ -2,7 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt


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