LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
composableFilter.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
9#include <functional>
10#include <initializer_list>
11#include <memory>
12#include <vector>
13
14namespace okapi {
15class ComposableFilter : public Filter {
16 public:
24 ComposableFilter(const std::initializer_list<std::shared_ptr<Filter>> &ilist);
25
32 double filter(double ireading) override;
33
37 double getOutput() const override;
38
44 virtual void addFilter(std::shared_ptr<Filter> ifilter);
45
46 protected:
47 std::vector<std::shared_ptr<Filter>> filters;
48 double output = 0;
49};
50} // namespace okapi
double getOutput() const override
ComposableFilter(const std::initializer_list< std::shared_ptr< Filter > > &ilist)
A composable filter is a filter that consists of other filters.
virtual void addFilter(std::shared_ptr< Filter > ifilter)
Adds a filter to the end of the sequence.
double filter(double ireading) override
Filters a value.
std::vector< std::shared_ptr< Filter > > filters