okapi::ComposableFilter class

Base classes

class Filter

Constructors, destructors, conversion operators

ComposableFilter(const std::initializer_list<std::shared_ptr<Filter>>& ilist)
A composable filter is a filter that consists of other filters.

Public functions

auto filter(double ireading) -> double override
Filters a value.
auto getOutput() const -> double override
void addFilter(std::shared_ptr<Filter> ifilter) virtual
Adds a filter to the end of the sequence.

Protected variables

std::vector<std::shared_ptr<Filter>> filters
double output

Function documentation

okapi::ComposableFilter::ComposableFilter(const std::initializer_list<std::shared_ptr<Filter>>& ilist)

A composable filter is a filter that consists of other filters.

Parameters
ilist The filters to use in sequence.

The input signal is passed through each filter in sequence. The final output of this filter is the output of the last filter.

double okapi::ComposableFilter::filter(double ireading) override

Filters a value.

Parameters
ireading A new measurement.
Returns The filtered result.

double okapi::ComposableFilter::getOutput() const override

Returns The previous output from filter.

void okapi::ComposableFilter::addFilter(std::shared_ptr<Filter> ifilter) virtual

Adds a filter to the end of the sequence.

Parameters
ifilter The filter to add.