rippled
Public Types | Public Member Functions | Private Attributes | List of all members
beast::insight::Gauge Class Referencefinal

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

Collaboration diagram for beast::insight::Gauge:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

 Gauge ()
 Create a null metric. More...
 
 Gauge (std::shared_ptr< GaugeImpl > const &impl)
 Create the metric reference the specified implementation. More...
 
std::shared_ptr< GaugeImpl > const & impl () const
 
void set (value_type value) const
 Set the value on the gauge. More...
 
Gauge const & operator= (value_type value) const
 
void increment (difference_type amount) const
 Adjust the value of the gauge. More...
 
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< GaugeImplm_impl
 

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 39 of file Gauge.h.

Member Typedef Documentation

◆ value_type

Definition at line 42 of file Gauge.h.

◆ difference_type

Definition at line 43 of file Gauge.h.

Constructor & Destructor Documentation

◆ Gauge() [1/2]

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

Create a null metric.

A null metric reports no information.

Definition at line 48 of file Gauge.h.

◆ Gauge() [2/2]

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

◆ operator=()

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

Definition at line 75 of file Gauge.h.

◆ increment()

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

Adjust the value of the gauge.

Definition at line 85 of file Gauge.h.

◆ operator+=()

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

Definition at line 92 of file Gauge.h.

◆ operator-=()

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

Definition at line 99 of file Gauge.h.

◆ operator++() [1/2]

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

Definition at line 106 of file Gauge.h.

◆ operator++() [2/2]

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

Definition at line 113 of file Gauge.h.

◆ operator--() [1/2]

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

Definition at line 120 of file Gauge.h.

◆ operator--() [2/2]

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

Definition at line 127 of file Gauge.h.

◆ impl()

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

Definition at line 135 of file Gauge.h.

Member Data Documentation

◆ m_impl

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

Definition at line 141 of file Gauge.h.