rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
beast::insight::Counter Class Referencefinal

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

#include <Counter.h>

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

Public Types

using value_type = CounterImpl::value_type
 

Public Member Functions

 Counter ()
 Create a null metric.
 
 Counter (std::shared_ptr< CounterImpl > const &impl)
 Create the metric reference the specified implementation.
 
std::shared_ptr< CounterImplm_impl
 
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

Definition at line 22 of file Counter.h.

Constructor & Destructor Documentation

◆ Counter() [1/2]

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

Create a null metric.

A null metric reports no information.

Definition at line 27 of file Counter.h.

◆ Counter() [2/2]

beast::insight::Counter::Counter ( std::shared_ptr< CounterImpl > 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 36 of file Counter.h.

Member Function Documentation

◆ increment()

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

Increment the counter.

Definition at line 43 of file Counter.h.

◆ operator+=()

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

Definition at line 50 of file Counter.h.

◆ operator-=()

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

Definition at line 57 of file Counter.h.

◆ operator++() [1/2]

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

Definition at line 64 of file Counter.h.

◆ operator++() [2/2]

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

Definition at line 71 of file Counter.h.

◆ operator--() [1/2]

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

Definition at line 78 of file Counter.h.

◆ operator--() [2/2]

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

Definition at line 85 of file Counter.h.

Member Data Documentation

◆ m_impl

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

Definition at line 92 of file Counter.h.