C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::telemetry::counter< ValueType > Class Template Reference

A metric that represents a single value that can only go up. More...

#include <counter.hpp>

Public Types

using value_type = ValueType
 
using family_setting = unit_t
 

Public Member Functions

 counter (value_type initial_value) noexcept
 
 counter (span< const label >) noexcept
 
void inc () noexcept
 Increments the counter by 1.
 
void inc (value_type amount) noexcept
 Increments the counter by amount.
 
template<class T = ValueType>
std::enable_if_t< std::is_same_v< T, int64_t >, T > operator++ () noexcept
 Increments the counter by 1.
 
template<class T = ValueType>
std::enable_if_t< std::is_same_v< T, int64_t >, T > operator++ (int) noexcept
 Increments the counter by 1.
 
value_type value () const noexcept
 Returns the current value of the counter.
 

Static Public Attributes

static constexpr metric_type runtime_type
 

Detailed Description

template<class ValueType>
class caf::telemetry::counter< ValueType >

A metric that represents a single value that can only go up.

Member Function Documentation

◆ inc()

template<class ValueType >
void caf::telemetry::counter< ValueType >::inc ( value_type amount)
noexcept

Increments the counter by amount.

Precondition
amount >= 0

◆ operator++() [1/2]

template<class ValueType >
template<class T = ValueType>
std::enable_if_t< std::is_same_v< T, int64_t >, T > caf::telemetry::counter< ValueType >::operator++ ( )
noexcept

Increments the counter by 1.

Returns
The new value of the counter.

◆ operator++() [2/2]

template<class ValueType >
template<class T = ValueType>
std::enable_if_t< std::is_same_v< T, int64_t >, T > caf::telemetry::counter< ValueType >::operator++ ( int )
noexcept

Increments the counter by 1.

Returns
The old value of the counter.

Member Data Documentation

◆ runtime_type

template<class ValueType >
metric_type caf::telemetry::counter< ValueType >::runtime_type
staticconstexpr
Initial value:
= std::is_same_v<value_type, double>
? metric_type::dbl_counter
: metric_type::int_counter

The documentation for this class was generated from the following files: