xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
beast
insight
Counter.h
1
#pragma once
2
3
#include <xrpl/beast/insight/CounterImpl.h>
4
5
#include <
memory
>
6
#include <
utility
>
7
8
namespace
beast::insight
{
9
19
class
Counter
final
20
{
21
public
:
22
using
value_type
=
CounterImpl::value_type
;
23
28
Counter
() =
default
;
29
36
explicit
Counter
(
std::shared_ptr<CounterImpl>
impl) :
impl_
(
std
::move(impl))
37
{
38
}
39
44
void
45
increment
(
value_type
amount)
const
46
{
47
if
(
impl_
)
48
impl_
->increment(amount);
49
}
50
51
Counter
const
&
52
operator+=
(
value_type
amount)
const
53
{
54
increment
(amount);
55
return
*
this
;
56
}
57
58
Counter
const
&
59
operator-=
(
value_type
amount)
const
60
{
61
increment
(-amount);
62
return
*
this
;
63
}
64
65
Counter
const
&
66
operator++
()
const
67
{
68
increment
(1);
69
return
*
this
;
70
}
71
72
Counter
const
&
73
operator++
(
int
)
const
74
{
75
increment
(1);
76
return
*
this
;
77
}
78
79
Counter
const
&
80
operator--
()
const
81
{
82
increment
(-1);
83
return
*
this
;
84
}
85
86
Counter
const
&
87
operator--
(
int
)
const
88
{
89
increment
(-1);
90
return
*
this
;
91
}
92
93
private
:
94
std::shared_ptr<CounterImpl>
impl_
;
95
};
96
97
}
// namespace beast::insight
beast::insight::CounterImpl::value_type
std::int64_t value_type
Definition
CounterImpl.h:13
beast::insight::Counter
A metric for measuring an integral value.
Definition
Counter.h:20
beast::insight::Counter::value_type
CounterImpl::value_type value_type
Definition
Counter.h:22
beast::insight::Counter::operator--
Counter const & operator--() const
Definition
Counter.h:80
beast::insight::Counter::increment
void increment(value_type amount) const
Increment the counter.
Definition
Counter.h:45
beast::insight::Counter::operator++
Counter const & operator++(int) const
Definition
Counter.h:73
beast::insight::Counter::impl_
std::shared_ptr< CounterImpl > impl_
Definition
Counter.h:94
beast::insight::Counter::Counter
Counter()=default
Create a null metric.
beast::insight::Counter::operator--
Counter const & operator--(int) const
Definition
Counter.h:87
beast::insight::Counter::operator++
Counter const & operator++() const
Definition
Counter.h:66
beast::insight::Counter::operator+=
Counter const & operator+=(value_type amount) const
Definition
Counter.h:52
beast::insight::Counter::Counter
Counter(std::shared_ptr< CounterImpl > impl)
Create the metric reference the specified implementation.
Definition
Counter.h:36
beast::insight::Counter::operator-=
Counter const & operator-=(value_type amount) const
Definition
Counter.h:59
memory
beast::insight
Definition
Collector.h:13
std
STL namespace.
std::shared_ptr
utility
Generated by
1.17.0