rippled
ripple
beast
insight
Meter.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of Beast: https://github.com/vinniefalco/Beast
4
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef BEAST_INSIGHT_METER_H_INCLUDED
21
#define BEAST_INSIGHT_METER_H_INCLUDED
22
23
#include <
memory
>
24
25
#include <ripple/beast/insight/MeterImpl.h>
26
27
namespace
beast
{
28
namespace
insight {
29
37
class
Meter
final
38
{
39
public
:
40
using
value_type
=
MeterImpl::value_type
;
41
45
Meter
()
46
{
47
}
48
54
explicit
Meter
(
std::shared_ptr<MeterImpl>
const
&
impl
) :
m_impl
(
impl
)
55
{
56
}
57
60
void
61
increment
(
value_type
amount)
const
62
{
63
if
(
m_impl
)
64
m_impl
->increment(amount);
65
}
66
67
Meter
const
&
68
operator+=
(
value_type
amount)
const
69
{
70
increment
(amount);
71
return
*
this
;
72
}
73
74
Meter
const
&
75
operator++
()
const
76
{
77
increment
(1);
78
return
*
this
;
79
}
80
81
Meter
const
&
82
operator++
(
int
)
const
83
{
84
increment
(1);
85
return
*
this
;
86
}
89
std::shared_ptr<MeterImpl>
const
&
90
impl
()
const
91
{
92
return
m_impl
;
93
}
94
95
private
:
96
std::shared_ptr<MeterImpl>
m_impl
;
97
};
98
99
}
// namespace insight
100
}
// namespace beast
101
102
#endif
beast::insight::Meter::operator+=
Meter const & operator+=(value_type amount) const
Definition:
Meter.h:68
std::shared_ptr
STL class.
beast::insight::Meter
A metric for measuring an integral value.
Definition:
Meter.h:37
beast::insight::Meter::Meter
Meter(std::shared_ptr< MeterImpl > const &impl)
Create the metric reference the specified implementation.
Definition:
Meter.h:54
beast::insight::Meter::m_impl
std::shared_ptr< MeterImpl > m_impl
Definition:
Meter.h:96
beast::insight::Meter::operator++
Meter const & operator++() const
Definition:
Meter.h:75
beast::insight::Meter::operator++
Meter const & operator++(int) const
Definition:
Meter.h:82
beast::insight::Meter::increment
void increment(value_type amount) const
Increment the meter.
Definition:
Meter.h:61
beast::insight::MeterImpl::value_type
std::uint64_t value_type
Definition:
MeterImpl.h:34
std::uint64_t
beast::insight::Meter::impl
std::shared_ptr< MeterImpl > const & impl() const
Definition:
Meter.h:90
beast::insight::Meter::Meter
Meter()
Create a null metric.
Definition:
Meter.h:45
memory
beast
Definition:
base_uint.h:641
Generated by
1.8.17