ComPPare 1.0.0
Loading...
Searching...
No Matches
comppare::internal::policy::autopolicy::RangeErrorPolicy< R > Class Template Reference

Error policy for ranges of arithmetic types. More...

#include <policy.hpp>

Public Member Functions

 RangeErrorPolicy ()
 
 ~RangeErrorPolicy ()=default
 
MetricValue< Tmetric (std::size_t i) const
 
bool is_fail () const
 Checks if the current error state is a failure.
 
void compute_error (const R &a, const R &b)
 

Static Public Member Functions

static constexpr std::size_t metric_count ()
 
static constexpr std::string_view metric_name (std::size_t i)
 

Private Types

using T = std::remove_cvref_t< std::ranges::range_value_t< R > >
 

Private Member Functions

MetricValue< Tget_max () const
 
MetricValue< Tget_mean () const
 
MetricValue< Tget_total () const
 

Private Attributes

T max_error_ = T(0)
 
T total_error_ = T(0)
 
std::size_t elem_cnt_ = 0
 
bool fail_ {false}
 
bool valid_ {true}
 Indicates if the current error state is a failure.
 
std::string err_msg_
 Indicates if the current error state is valid.
 
T tolerance_
 

Static Private Attributes

static constexpr std::array names {"Max|err|", "Mean|err|", "Total|err|"}
 

Detailed Description

template<typename R>
requires comppare::internal::concepts::RangeOfArithmetic<R>
class comppare::internal::policy::autopolicy::RangeErrorPolicy< R >

Error policy for ranges of arithmetic types.

Compares two ranges element-wise and computes metrics such as maximum error, mean error, and total error.

Template Parameters
RRange type (e.g., std::vector<int>, std::deque<float>)

Member Typedef Documentation

◆ T

template<typename R >
using comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::T = std::remove_cvref_t<std::ranges::range_value_t<R> >
private

Constructor & Destructor Documentation

◆ RangeErrorPolicy()

template<typename R >
comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::RangeErrorPolicy ( )
inline

◆ ~RangeErrorPolicy()

Member Function Documentation

◆ compute_error()

template<typename R >
void comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::compute_error ( const R &  a,
const R &  b 
)
inline

◆ get_max()

template<typename R >
MetricValue< T > comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::get_max ( ) const
inlineprivate

◆ get_mean()

template<typename R >
MetricValue< T > comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::get_mean ( ) const
inlineprivate

◆ get_total()

template<typename R >
MetricValue< T > comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::get_total ( ) const
inlineprivate

◆ is_fail()

template<typename R >
bool comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::is_fail ( ) const
inline

Checks if the current error state is a failure.

Returns
true if the error state is a failure, false otherwise. if the error state is invalid, it returns false.

◆ metric()

template<typename R >
MetricValue< T > comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::metric ( std::size_t  i) const
inline

◆ metric_count()

template<typename R >
static constexpr std::size_t comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::metric_count ( )
inlinestaticconstexpr

◆ metric_name()

template<typename R >
static constexpr std::string_view comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::metric_name ( std::size_t  i)
inlinestaticconstexpr

Member Data Documentation

◆ elem_cnt_

template<typename R >
std::size_t comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::elem_cnt_ = 0
private

◆ err_msg_

template<typename R >
std::string comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::err_msg_
private

Indicates if the current error state is valid.

<

◆ fail_

template<typename R >
bool comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::fail_ {false}
private

◆ max_error_

template<typename R >
T comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::max_error_ = T(0)
private

◆ names

template<typename R >
constexpr std::array comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::names {"Max|err|", "Mean|err|", "Total|err|"}
staticconstexprprivate

◆ tolerance_

template<typename R >
T comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::tolerance_
private

◆ total_error_

template<typename R >
T comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::total_error_ = T(0)
private

◆ valid_

template<typename R >
bool comppare::internal::policy::autopolicy::RangeErrorPolicy< R >::valid_ {true}
private

Indicates if the current error state is a failure.

<


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