rippled
Public Types | Public Member Functions | List of all members
beast::insight::Counter Class Referencefinal

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

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. More...
 
 Counter (std::shared_ptr< CounterImpl > const &impl)
 Create the metric reference the specified implementation. More...
 
std::shared_ptr< CounterImplm_impl
 
void increment (value_type amount) const
 Increment the counter. More...
 
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 38 of file Counter.h.

Member Typedef Documentation

◆ value_type

Definition at line 41 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 46 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 55 of file Counter.h.

Member Function Documentation

◆ increment()

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

Increment the counter.

Definition at line 62 of file Counter.h.

◆ operator+=()

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

Definition at line 69 of file Counter.h.

◆ operator-=()

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

Definition at line 76 of file Counter.h.

◆ operator++() [1/2]

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

Definition at line 83 of file Counter.h.

◆ operator++() [2/2]

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

Definition at line 90 of file Counter.h.

◆ operator--() [1/2]

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

Definition at line 97 of file Counter.h.

◆ operator--() [2/2]

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

Definition at line 104 of file Counter.h.

Member Data Documentation

◆ m_impl

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

Definition at line 111 of file Counter.h.