rippled
Loading...
Searching...
No Matches
Meter.h
1#ifndef BEAST_INSIGHT_METER_H_INCLUDED
2#define BEAST_INSIGHT_METER_H_INCLUDED
3
4#include <xrpl/beast/insight/MeterImpl.h>
5
6#include <memory>
7
8namespace beast {
9namespace insight {
10
18class Meter final
19{
20public:
22
27 {
28 }
29
36 {
37 }
38
41 void
42 increment(value_type amount) const
43 {
44 if (m_impl)
45 m_impl->increment(amount);
46 }
47
48 Meter const&
49 operator+=(value_type amount) const
50 {
51 increment(amount);
52 return *this;
53 }
54
55 Meter const&
56 operator++() const
57 {
58 increment(1);
59 return *this;
60 }
61
62 Meter const&
63 operator++(int) const
64 {
65 increment(1);
66 return *this;
67 }
71 impl() const
72 {
73 return m_impl;
74 }
75
76private:
78};
79
80} // namespace insight
81} // namespace beast
82
83#endif
std::uint64_t value_type
Definition MeterImpl.h:15
A metric for measuring an integral value.
Definition Meter.h:19
void increment(value_type amount) const
Increment the meter.
Definition Meter.h:42
Meter()
Create a null metric.
Definition Meter.h:26
std::shared_ptr< MeterImpl > m_impl
Definition Meter.h:77
Meter(std::shared_ptr< MeterImpl > const &impl)
Create the metric reference the specified implementation.
Definition Meter.h:35
Meter const & operator++(int) const
Definition Meter.h:63
Meter const & operator+=(value_type amount) const
Definition Meter.h:49
Meter const & operator++() const
Definition Meter.h:56
std::shared_ptr< MeterImpl > const & impl() const
Definition Meter.h:71