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

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

#include <Gauge.h>

Collaboration diagram for beast::insight::Gauge:

Public Types

using value_type = GaugeImpl::value_type
using difference_type = GaugeImpl::difference_type

Public Member Functions

 Gauge ()=default
 Create a null metric.
 Gauge (std::shared_ptr< GaugeImpl > impl)
 Create the metric reference the specified implementation.
std::shared_ptr< GaugeImpl > const & impl () const
void set (value_type value) const
 Set the value on the gauge.
Gauge const & operator= (value_type value) const
void increment (difference_type amount) const
 Adjust the value of the gauge.
Gauge const & operator+= (difference_type amount) const
Gauge const & operator-= (difference_type amount) const
Gauge const & operator++ () const
Gauge const & operator++ (int) const
Gauge const & operator-- () const
Gauge const & operator-- (int) const

Private Attributes

std::shared_ptr< GaugeImplimpl_

Detailed Description

A metric for measuring an integral value.

A gauge is an instantaneous measurement of a value, like the gas gauge in a car. The caller directly sets the value, or adjusts it by a specified amount. The value is kept in the client rather than the collector.

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 Gauge.h.

Member Typedef Documentation

◆ value_type

◆ difference_type

Constructor & Destructor Documentation

◆ Gauge() [1/2]

beast::insight::Gauge::Gauge ( )
default

Create a null metric.

A null metric reports no information.

◆ Gauge() [2/2]

beast::insight::Gauge::Gauge ( std::shared_ptr< GaugeImpl > 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 35 of file Gauge.h.

Member Function Documentation

◆ set()

void beast::insight::Gauge::set ( value_type value) const

Set the value on the gauge.

A Collector implementation should combine multiple calls to value changes into a single change if the calls occur within a single collection interval.

Definition at line 46 of file Gauge.h.

◆ operator=()

Gauge const & beast::insight::Gauge::operator= ( value_type value) const

Definition at line 53 of file Gauge.h.

◆ increment()

void beast::insight::Gauge::increment ( difference_type amount) const

Adjust the value of the gauge.

Definition at line 63 of file Gauge.h.

◆ operator+=()

Gauge const & beast::insight::Gauge::operator+= ( difference_type amount) const

Definition at line 70 of file Gauge.h.

◆ operator-=()

Gauge const & beast::insight::Gauge::operator-= ( difference_type amount) const

Definition at line 77 of file Gauge.h.

◆ operator++() [1/2]

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

Definition at line 84 of file Gauge.h.

◆ operator++() [2/2]

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

Definition at line 91 of file Gauge.h.

◆ operator--() [1/2]

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

Definition at line 98 of file Gauge.h.

◆ operator--() [2/2]

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

Definition at line 105 of file Gauge.h.

◆ impl()

std::shared_ptr< GaugeImpl > const & beast::insight::Gauge::impl ( ) const
nodiscard

Definition at line 113 of file Gauge.h.

Member Data Documentation

◆ impl_

std::shared_ptr<GaugeImpl> beast::insight::Gauge::impl_
private

Definition at line 119 of file Gauge.h.