gr-baz Package
gri_fir_filter_with_buffer_fcc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2010 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
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)
10  * any later version.
11  *
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.
16  *
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.
21  */
22 
23 /*
24  * WARNING: This file is automatically generated by generate_gri_fir_XXX.py
25  * Any changes made to this file will be overwritten.
26  */
27 
28 
29 #ifndef INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H
30 #define INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H
31 
32 #include <gr_core_api.h>
33 #include <vector>
34 #include <gr_types.h>
35 #include <gr_reverse.h>
36 #include <string.h>
37 #include <cstdio>
38 
39 /*!
40  * \brief FIR with internal buffer for float input,
41  gr_complex output and gr_complex taps
42  * \ingroup filter
43  *
44  */
45 
47 
48 protected:
49  std::vector<gr_complex> d_taps; // reversed taps
50  float *d_buffer;
51  unsigned int d_idx;
52 
53 public:
54 
55  // CONSTRUCTORS
56 
57  /*!
58  * \brief construct new FIR with given taps.
59  *
60  * Note that taps must be in forward order, e.g., coefficient 0 is
61  * stored in new_taps[0], coefficient 1 is stored in
62  * new_taps[1], etc.
63  */
64  gri_fir_filter_with_buffer_fcc (const std::vector<gr_complex> &taps);
65 
67 
68  // MANIPULATORS
69 
70  /*!
71  * \brief compute a single output value.
72  *
73  * \p input is a single input value of the filter type
74  *
75  * \returns the filtered input value.
76  */
77  gr_complex filter (float input);
78 
79 
80  /*!
81  * \brief compute a single output value; designed for decimating filters.
82  *
83  * \p input is a single input value of the filter type. The value of dec is the
84  * decimating value of the filter, so input[] must have dec valid values.
85  * The filter pushes dec number of items onto the circ. buffer before computing
86  * a single output.
87  *
88  * \returns the filtered input value.
89  */
90  gr_complex filter (const float input[], unsigned long dec);
91 
92  /*!
93  * \brief compute an array of N output values.
94  *
95  * \p input must have (n - 1 + ntaps()) valid entries.
96  * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
97  */
98  void filterN (gr_complex output[], const float input[],
99  unsigned long n);
100 
101  /*!
102  * \brief compute an array of N output values, decimating the input
103  *
104  * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
105  * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
106  * compute the output values.
107  */
108  void filterNdec (gr_complex output[], const float input[],
109  unsigned long n, unsigned long decimate);
110 
111  /*!
112  * \brief install \p new_taps as the current taps.
113  */
114  void set_taps (const std::vector<gr_complex> &taps);
115 
116  // ACCESSORS
117 
118  /*!
119  * \return number of taps in filter.
120  */
121  unsigned ntaps () const { return d_taps.size (); }
122 
123  /*!
124  * \return current taps
125  */
126  const std::vector<gr_complex> get_taps () const
127  {
128  return gr_reverse(d_taps);
129  }
130 };
131 
132 #endif /* INCLUDED_GR_GRI_FIR_FILTER_WITH_BUFFER_FCC_H */