summaryrefslogtreecommitdiff
path: root/src/third_party/boost-1.60.0/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/strict_stopclock.hpp
blob: 2252c8049a9e0368f221d5c19ab55d94d1cd847b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//  boost/chrono/stopwatches/reporters/strict_stopclock.hpp
//  Copyright 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)
//  See http://www.boost.org/libs/chrono/stopwatches for documentation.

#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_STRICT_STOPCLOCK_HPP
#define BOOST_CHRONO_STOPWATCHES_REPORTERS_STRICT_STOPCLOCK_HPP

#include <boost/chrono/config.hpp>

#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
#if defined __GNUC__
#pragma GCC system_header
#elif defined __SUNPRO_CC
#pragma disable_warn
#elif defined _MSC_VER
#pragma warning(push, 1)
#endif
#endif

#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
#include <boost/chrono/chrono.hpp>
#include <boost/chrono/detail/system.hpp>
#include <boost/cstdint.hpp>
#include <cassert>

namespace boost
{
  namespace chrono
  {

    template<class CharT, typename Clock, class Formatter>
    class basic_strict_stopclock: public basic_stopwatch_reporter<CharT, strict_stopwatch<Clock>, Formatter>
    {
    public:
      typedef basic_stopwatch_reporter<CharT, strict_stopwatch<Clock>, Formatter> base_type;
      typedef Clock clock;
      typedef strict_stopwatch<Clock> stopwatch;
      typedef Formatter formatter_type;

      basic_strict_stopclock()
      {
      }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
      explicit basic_strict_stopclock(system::error_code & ec) :
        base_type(ec)
      {
      }
#endif

      explicit basic_strict_stopclock(formatter_type const& fmt) :
        base_type(fmt)
      {
      }

      explicit basic_strict_stopclock(const typename Formatter::char_type* fmt) :
        base_type(fmt)
      {
      }
      explicit basic_strict_stopclock(typename Formatter::string_type const& fmt) :
        base_type(fmt)
      {
      }

    protected:

      basic_strict_stopclock(const basic_strict_stopclock&); // = delete;
      basic_strict_stopclock& operator=(const basic_strict_stopclock&); // = delete;
    };


    template<typename Clock=high_resolution_clock,
        class Formatter = typename basic_stopwatch_reporter_default_formatter<char, strict_stopwatch<Clock> >::type>
    class strict_stopclock;

    template<class Stopwatch, class Formatter>
    struct basic_stopwatch_reporter_default_formatter<char, strict_stopclock<Stopwatch, Formatter> >
    {
      typedef Formatter type;
    };

    template<typename Clock, class Formatter>
    class strict_stopclock: public basic_strict_stopclock<char, Clock, Formatter>
    {
      typedef basic_strict_stopclock<char, Clock, Formatter> base_type;
    public:
      typedef Clock clock;
      typedef typename base_type::stopwatch stopwatch;
      typedef Formatter formatter_type;

      strict_stopclock()
      {
      }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
      explicit strict_stopclock(system::error_code & ec) :
        base_type(ec)
      {
      }
#endif

      explicit strict_stopclock(formatter_type const& fmt) :
        base_type(fmt)
      {
      }

      explicit strict_stopclock(const typename Formatter::char_type* fmt) :
        base_type(fmt)
      {
      }
      explicit strict_stopclock(typename Formatter::string_type const& fmt) :
        base_type(fmt)
      {
      }

    protected:

      strict_stopclock(const strict_stopclock&); // = delete;
      strict_stopclock& operator=(const strict_stopclock&); // = delete;
    };



  } // namespace chrono
} // namespace boost


#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
#if defined __SUNPRO_CC
#pragma enable_warn
#elif defined _MSC_VER
#pragma warning(pop)
#endif
#endif

#endif