kopia lustrzana https://github.com/vsamy/DiFipp
39 wiersze
935 B
C++
39 wiersze
935 B
C++
#pragma once
|
|
|
|
#include "type_checks.h"
|
|
#include <stddef.h>
|
|
#include <vector>
|
|
|
|
namespace fratio {
|
|
|
|
template <typename T>
|
|
class GenericFilter {
|
|
static_assert(std::is_floating_point<T>::value && !std::is_const<T>::value, "Only accept non-complex floating point types.");
|
|
|
|
public:
|
|
T stepFilter(T data);
|
|
std::vector<T> filter(const std::vector<T>& data);
|
|
void resetFilter();
|
|
|
|
void getCoeff(std::vector<T>& aCoeff, std::vector<T>& bCoeff) const noexcept;
|
|
|
|
protected:
|
|
GenericFilter() = default;
|
|
GenericFilter(const std::vector<T>& aCoeff, const std::vector<T>& bCoeff);
|
|
virtual ~GenericFilter() = default;
|
|
|
|
void checkCoeff(const std::vector<T>& aCoeff, const std::vector<T>& bCoeff);
|
|
void normalize();
|
|
|
|
protected:
|
|
std::vector<T> m_aCoeff;
|
|
std::vector<T> m_bCoeff;
|
|
|
|
private:
|
|
std::vector<T> m_filteredData;
|
|
std::vector<T> m_rawData;
|
|
};
|
|
|
|
} // namespace fratio
|
|
|
|
#include "GenericFilter.inl" |