LCOV - code coverage report
Current view: top level - datadog - rate.h (source / functions) Hit Total Coverage
Test: filtered.info Lines: 5 5 100.0 %
Date: 2024-01-03 20:30:12 Functions: 5 5 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : // This component provides a `class`, `Rate`, that is a `double` whose value is
       4             : // between zero and one, inclusive.
       5             : //
       6             : // `Rate` objects are obtained by calling the static member function
       7             : // `Rate::from` with a `double` argument. A default-constructed `Rate` has the
       8             : // zero value. The static member functions `Rate::one` and `Rate::zero` are
       9             : // provided for convenience.
      10             : 
      11             : #include <variant>
      12             : 
      13             : #include "expected.h"
      14             : 
      15             : namespace datadog {
      16             : namespace tracing {
      17             : 
      18             : class Rate {
      19             :   double value_;
      20       36970 :   explicit Rate(double value) : value_(value) {}
      21             : 
      22             :  public:
      23          93 :   Rate() : value_(0.0) {}
      24             : 
      25      256135 :   double value() const { return value_; }
      26      256135 :   operator double() const { return value(); }
      27             : 
      28       10495 :   static Rate one() { return Rate(1.0); }
      29             :   static Rate zero() { return Rate(0.0); }
      30             : 
      31             :   static Expected<Rate> from(double);
      32             : };
      33             : 
      34             : }  // namespace tracing
      35             : }  // namespace datadog

Generated by: LCOV version 1.16