18 #ifndef SIGNAL_FILTERS__FILTER_FACTORY_HPP_
19 #define SIGNAL_FILTERS__FILTER_FACTORY_HPP_
34 namespace signal_filters
54 template<
typename T,
typename ClockT = DummyClock>
55 static std::unique_ptr<FilterBase<T, ClockT>>
create(
const std::string & type, T cutoff_frequency)
58 auto type_clean = type;
60 type_clean.begin(), type_clean.end(), type_clean.begin(),
61 [](
auto c) {
return std::tolower(c);});
62 if (
"low_pass_filter" == type_clean) {
64 }
else if (type_clean.empty() || (
"none" == type_clean)) {
67 std::string err{
"Unknown filter type: "};
69 throw std::domain_error{err};
71 return create<T, ClockT>(type_enum, cutoff_frequency);
81 template<
typename T,
typename ClockT = DummyClock>
82 static std::unique_ptr<FilterBase<T, ClockT>>
create(
FilterType type, T cutoff_frequency)
88 return std::make_unique<LowPassFilter<T, ClockT>>(cutoff_frequency);
90 throw std::domain_error{
"Unknown filter type"};
99 #endif // SIGNAL_FILTERS__FILTER_FACTORY_HPP_