xrpld
Loading...
Searching...
No Matches
Meter.h
1#pragma once
2
3#include <xrpl/beast/insight/MeterImpl.h>
4
5#include <memory>
6#include <utility>
7
8namespace beast::insight {
9
17class Meter final
18{
19public:
21
25 Meter() = default;
26
33 {
34 }
35
38 void
39 increment(value_type amount) const
40 {
41 if (impl_)
42 impl_->increment(amount);
43 }
44
45 Meter const&
46 operator+=(value_type amount) const
47 {
48 increment(amount);
49 return *this;
50 }
51
52 Meter const&
53 operator++() const
54 {
55 increment(1);
56 return *this;
57 }
58
59 Meter const&
60 operator++(int) const
61 {
62 increment(1);
63 return *this;
64 }
65
66
67 [[nodiscard]] std::shared_ptr<MeterImpl> const&
68 impl() const
69 {
70 return impl_;
71 }
72
73private:
75};
76
77} // namespace beast::insight
std::uint64_t value_type
Definition MeterImpl.h:13
A metric for measuring an integral value.
Definition Meter.h:18
void increment(value_type amount) const
Increment the meter.
Definition Meter.h:39
Meter()=default
Create a null metric.
Meter const & operator++(int) const
Definition Meter.h:60
Meter(std::shared_ptr< MeterImpl > impl)
Create the metric reference the specified implementation.
Definition Meter.h:32
Meter const & operator+=(value_type amount) const
Definition Meter.h:46
Meter const & operator++() const
Definition Meter.h:53
std::shared_ptr< MeterImpl > const & impl() const
Definition Meter.h:68
std::shared_ptr< MeterImpl > impl_
Definition Meter.h:74
MeterImpl::value_type value_type
Definition Meter.h:20
STL namespace.