xrpld
Loading...
Searching...
No Matches
beast::insight::Counter Class Referencefinal

A metric for measuring an integral value. More...

#include <Counter.h>

Collaboration diagram for beast::insight::Counter:

Public Types

using value_type = CounterImpl::value_type

Public Member Functions

 Counter ()=default
 Create a null metric.
 Counter (std::shared_ptr< CounterImpl > impl)
 Create the metric reference the specified implementation.
std::shared_ptr< CounterImplimpl_
void increment (value_type amount) const
 Increment the counter.
Counter const & operator+= (value_type amount) const
Counter const & operator-= (value_type amount) const
Counter const & operator++ () const
Counter const & operator++ (int) const
Counter const & operator-- () const
Counter const & operator-- (int) const

Detailed Description

A metric for measuring an integral value.

A counter is a gauge calculated at the server. The owner of the counter may increment and decrement the value by an amount.

This is a lightweight reference wrapper which is cheap to copy and assign. When the last reference goes away, the metric is no longer collected.

Definition at line 19 of file Counter.h.

Member Typedef Documentation

◆ value_type

Constructor & Destructor Documentation

◆ Counter() [1/2]

beast::insight::Counter::Counter ( )
default

Create a null metric.

A null metric reports no information.

◆ Counter() [2/2]

beast::insight::Counter::Counter ( std::shared_ptr< CounterImpl > impl)
explicit

Create the metric reference the specified implementation.

Normally this won't be called directly. Instead, call the appropriate factory function in the Collector interface.

See also
Collector.

Definition at line 36 of file Counter.h.

Member Function Documentation

◆ increment()

void beast::insight::Counter::increment ( value_type amount) const

Increment the counter.

Definition at line 45 of file Counter.h.

◆ operator+=()

Counter const & beast::insight::Counter::operator+= ( value_type amount) const

Definition at line 52 of file Counter.h.

◆ operator-=()

Counter const & beast::insight::Counter::operator-= ( value_type amount) const

Definition at line 59 of file Counter.h.

◆ operator++() [1/2]

Counter const & beast::insight::Counter::operator++ ( ) const

Definition at line 66 of file Counter.h.

◆ operator++() [2/2]

Counter const & beast::insight::Counter::operator++ ( int ) const

Definition at line 73 of file Counter.h.

◆ operator--() [1/2]

Counter const & beast::insight::Counter::operator-- ( ) const

Definition at line 80 of file Counter.h.

◆ operator--() [2/2]

Counter const & beast::insight::Counter::operator-- ( int ) const

Definition at line 87 of file Counter.h.

Member Data Documentation

◆ impl_

std::shared_ptr<CounterImpl> beast::insight::Counter::impl_
private

Definition at line 94 of file Counter.h.