GNU Radio 3.4.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2002,2003 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 /* 00024 * WARNING: This file is automatically generated by generate_gr_fir_XXX.py 00025 * Any changes made to this file will be overwritten. 00026 */ 00027 00028 00029 #ifndef INCLUDED_GR_FIR_FFF_H 00030 #define INCLUDED_GR_FIR_FFF_H 00031 00032 #include <vector> 00033 00034 #include <gr_reverse.h> 00035 00036 /*! 00037 * \brief Abstract class for FIR with float input, float output and float taps 00038 * \ingroup filter_primitive 00039 * 00040 * This is the abstract class for a Finite Impulse Response filter. 00041 * 00042 * The trailing suffix has the form _IOT where I codes the input type, 00043 * O codes the output type, and T codes the tap type. 00044 * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) 00045 */ 00046 00047 class gr_fir_fff { 00048 00049 protected: 00050 std::vector<float> d_taps; // reversed taps 00051 00052 public: 00053 00054 // CONSTRUCTORS 00055 00056 /*! 00057 * \brief construct new FIR with given taps. 00058 * 00059 * Note that taps must be in forward order, e.g., coefficient 0 is 00060 * stored in new_taps[0], coefficient 1 is stored in 00061 * new_taps[1], etc. 00062 */ 00063 gr_fir_fff () {} 00064 gr_fir_fff (const std::vector<float> &taps) : d_taps (gr_reverse(taps)) {} 00065 00066 virtual ~gr_fir_fff (); 00067 00068 // MANIPULATORS 00069 00070 /*! 00071 * \brief compute a single output value. 00072 * 00073 * \p input must have ntaps() valid entries. 00074 * input[0] .. input[ntaps() - 1] are referenced to compute the output value. 00075 * 00076 * \returns the filtered input value. 00077 */ 00078 virtual float filter (const float input[]) = 0; 00079 00080 /*! 00081 * \brief compute an array of N output values. 00082 * 00083 * \p input must have (n - 1 + ntaps()) valid entries. 00084 * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. 00085 */ 00086 virtual void filterN (float output[], const float input[], 00087 unsigned long n) = 0; 00088 00089 /*! 00090 * \brief compute an array of N output values, decimating the input 00091 * 00092 * \p input must have (decimate * (n - 1) + ntaps()) valid entries. 00093 * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to 00094 * compute the output values. 00095 */ 00096 virtual void filterNdec (float output[], const float input[], 00097 unsigned long n, unsigned decimate) = 0; 00098 00099 /*! 00100 * \brief install \p new_taps as the current taps. 00101 */ 00102 virtual void set_taps (const std::vector<float> &taps) 00103 { 00104 d_taps = gr_reverse(taps); 00105 } 00106 00107 // ACCESSORS 00108 00109 /*! 00110 * \return number of taps in filter. 00111 */ 00112 unsigned ntaps () const { return d_taps.size (); } 00113 00114 /*! 00115 * \return current taps 00116 */ 00117 virtual const std::vector<float> get_taps () const 00118 { 00119 return gr_reverse(d_taps); 00120 } 00121 }; 00122 00123 #endif /* INCLUDED_GR_FIR_FFF_H */