GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2010 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_gri_fir_XXX.py 00025 * Any changes made to this file will be overwritten. 00026 */ 00027 00028 00029 #ifndef INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H 00030 #define INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H 00031 00032 #include <gr_core_api.h> 00033 #include <vector> 00034 #include <gr_types.h> 00035 #include <gr_reverse.h> 00036 #include <string.h> 00037 #include <cstdio> 00038 00039 /*! 00040 * \brief FIR with internal buffer for float input, 00041 gr_complex output and gr_complex taps 00042 * \ingroup filter 00043 * 00044 */ 00045 00046 class GR_CORE_API gri_fir_filter_with_buffer_fcc { 00047 00048 protected: 00049 std::vector<gr_complex> d_taps; // reversed taps 00050 float *d_buffer; 00051 unsigned int d_idx; 00052 00053 public: 00054 00055 // CONSTRUCTORS 00056 00057 /*! 00058 * \brief construct new FIR with given taps. 00059 * 00060 * Note that taps must be in forward order, e.g., coefficient 0 is 00061 * stored in new_taps[0], coefficient 1 is stored in 00062 * new_taps[1], etc. 00063 */ 00064 gri_fir_filter_with_buffer_fcc (const std::vector<gr_complex> &taps); 00065 00066 ~gri_fir_filter_with_buffer_fcc (); 00067 00068 // MANIPULATORS 00069 00070 /*! 00071 * \brief compute a single output value. 00072 * 00073 * \p input is a single input value of the filter type 00074 * 00075 * \returns the filtered input value. 00076 */ 00077 gr_complex filter (float input); 00078 00079 00080 /*! 00081 * \brief compute a single output value; designed for decimating filters. 00082 * 00083 * \p input is a single input value of the filter type. The value of dec is the 00084 * decimating value of the filter, so input[] must have dec valid values. 00085 * The filter pushes dec number of items onto the circ. buffer before computing 00086 * a single output. 00087 * 00088 * \returns the filtered input value. 00089 */ 00090 gr_complex filter (const float input[], unsigned long dec); 00091 00092 /*! 00093 * \brief compute an array of N output values. 00094 * 00095 * \p input must have (n - 1 + ntaps()) valid entries. 00096 * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. 00097 */ 00098 void filterN (gr_complex output[], const float input[], 00099 unsigned long n); 00100 00101 /*! 00102 * \brief compute an array of N output values, decimating the input 00103 * 00104 * \p input must have (decimate * (n - 1) + ntaps()) valid entries. 00105 * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to 00106 * compute the output values. 00107 */ 00108 void filterNdec (gr_complex output[], const float input[], 00109 unsigned long n, unsigned long decimate); 00110 00111 /*! 00112 * \brief install \p new_taps as the current taps. 00113 */ 00114 void set_taps (const std::vector<gr_complex> &taps); 00115 00116 // ACCESSORS 00117 00118 /*! 00119 * \return number of taps in filter. 00120 */ 00121 unsigned ntaps () const { return d_taps.size (); } 00122 00123 /*! 00124 * \return current taps 00125 */ 00126 const std::vector<gr_complex> get_taps () const 00127 { 00128 return gr_reverse(d_taps); 00129 } 00130 }; 00131 00132 #endif /* INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H */