3 * Copyright 2002,2003 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
24 * WARNING: This file is automatically generated by generate_gr_fir_XXX.py
25 * Any changes made to this file will be overwritten.
29 #ifndef INCLUDED_GR_FIR_FSF_H
30 #define INCLUDED_GR_FIR_FSF_H
34 #include <gr_reverse.h>
37 * \brief Abstract class for FIR with float input, short output and float taps
38 * \ingroup filter_primitive
40 * This is the abstract class for a Finite Impulse Response filter.
42 * The trailing suffix has the form _IOT where I codes the input type,
43 * O codes the output type, and T codes the tap type.
44 * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int)
50 std::vector<float> d_taps; // reversed taps
57 * \brief construct new FIR with given taps.
59 * Note that taps must be in forward order, e.g., coefficient 0 is
60 * stored in new_taps[0], coefficient 1 is stored in
64 gr_fir_fsf (const std::vector<float> &taps) : d_taps (gr_reverse(taps)) {}
66 virtual ~gr_fir_fsf ();
71 * \brief compute a single output value.
73 * \p input must have ntaps() valid entries.
74 * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
76 * \returns the filtered input value.
78 virtual short filter (const float input[]) = 0;
81 * \brief compute an array of N output values.
83 * \p input must have (n - 1 + ntaps()) valid entries.
84 * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
86 virtual void filterN (short output[], const float input[],
90 * \brief compute an array of N output values, decimating the input
92 * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
93 * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
94 * compute the output values.
96 virtual void filterNdec (short output[], const float input[],
97 unsigned long n, unsigned decimate) = 0;
100 * \brief install \p new_taps as the current taps.
102 virtual void set_taps (const std::vector<float> &taps)
104 d_taps = gr_reverse(taps);
110 * \return number of taps in filter.
112 unsigned ntaps () const { return d_taps.size (); }
115 * \return current taps
117 virtual const std::vector<float> get_taps () const
119 return gr_reverse(d_taps);
123 #endif /* INCLUDED_GR_FIR_FSF_H */