xronos-sdk 0.5.0
Xronos C++ SDK
Loading...
Searching...
No Matches
xronos::sdk::Metric Class Referencefinal

A reactor element for recording metric data to an external data base. More...

#include <xronos/sdk/metric.hh>

Inheritance diagram for xronos::sdk::Metric:
[legend]

Public Member Functions

 Metric (std::string_view name, ReactorContext context, std::string_view description, std::string_view unit="")
 Constructor.
auto description () const noexcept -> const std::string &
 Get the description.
auto unit () const noexcept -> const std::string &
 Get the unit.
Public Member Functions inherited from xronos::sdk::Element
auto name () const noexcept -> const std::string &
 Get the element's name.
auto fqn () const noexcept -> const std::string &
 Get the element's fully qualified name.
auto add_attribute (std::string_view key, const AttributeValue &value) noexcept -> bool
 Annotate an element with an attribute.
template<std::ranges::input_range R>
requires requires(std::ranges::range_value_t<R> pair) { { pair.first } -> std::convertible_to<std::string_view>; { pair.second } -> std::convertible_to<AttributeValue>; }
auto add_attributes (const R &range) noexcept -> bool
 Annotate an element with multiple attributes.
auto add_attributes (std::initializer_list< std::pair< std::string_view, AttributeValue > > attributes) -> bool
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
virtual ~Element ()=default
 Virtual destructor.

Detailed Description

A reactor element for recording metric data to an external data base.

Can be used as a reaction effect allowing the reaction handler to record values using the metric.

Constructor & Destructor Documentation

◆ Metric()

xronos::sdk::Metric::Metric ( std::string_view name,
ReactorContext context,
std::string_view description,
std::string_view unit = "" )

Constructor.

Parameters
nameThe name of the metric.
contextThe containing reactor's context.
descriptionA human readable description of the metric.
unitThe unit of values recorded using the metric.

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