BoxFilter

template<int64_t filter_order, double maximal_filtered_value = 1e5>
class BoxFilter : public vslib::Filter

Public Functions

inline BoxFilter(std::string_view name, Component &parent)

Constructor of the Box filter Component.

Parameters:
inline virtual double filter(const double input) override

Filters the provided input by calculating the moving average of the buffer of previously provided inputs.

Parameters:

input – Input value to be filtered

Returns:

Filtered value

Public Static Functions

static inline constexpr auto getMaxInputValue()

Returns the maximum value that can be filtered by this filter.

Returns:

Maximal value that can be filter by this filter

Public Static Attributes

static constexpr int64_t fractional_bits = sizeof(int64_t) * 8 - 1 - std::ceil(log2(maximal_filtered_value))

< 8 is the number of bits per byte, -1 is for the sign