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
18class Meter final
19{
20public:
22
27 Meter() = default;
28
36 {
37 }
38
43 void
44 increment(value_type amount) const
45 {
46 if (impl_)
47 impl_->increment(amount);
48 }
49
50 Meter const&
51 operator+=(value_type amount) const
52 {
53 increment(amount);
54 return *this;
55 }
56
57 Meter const&
58 operator++() const
59 {
60 increment(1);
61 return *this;
62 }
63
64 Meter const&
65 operator++(int) const
66 {
67 increment(1);
68 return *this;
69 }
70
71
72 [[nodiscard]] std::shared_ptr<MeterImpl> const&
73 impl() const
74 {
75 return impl_;
76 }
77
78private:
80};
81
82} // namespace beast::insight
std::uint64_t value_type
Definition MeterImpl.h:13
A metric for measuring an integral value.
Definition Meter.h:19
void increment(value_type amount) const
Increment the meter.
Definition Meter.h:44
Meter()=default
Create a null metric.
Meter const & operator++(int) const
Definition Meter.h:65
Meter(std::shared_ptr< MeterImpl > impl)
Create the metric reference the specified implementation.
Definition Meter.h:35
Meter const & operator+=(value_type amount) const
Definition Meter.h:51
Meter const & operator++() const
Definition Meter.h:58
std::shared_ptr< MeterImpl > const & impl() const
Definition Meter.h:73
std::shared_ptr< MeterImpl > impl_
Definition Meter.h:79
MeterImpl::value_type value_type
Definition Meter.h:21
STL namespace.