GNU Radio 3.6.5 C++ API

gr_fir_scc.h

Go to the documentation of this file.
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_GR_FIR_SCC_H
00030 #define INCLUDED_GR_GR_FIR_SCC_H
00031 
00032 #include <gr_core_api.h>
00033 #include <vector>
00034 #include <gr_types.h>
00035 #include <gr_reverse.h>
00036 
00037 /*!
00038  * \brief Abstract class for FIR with short input, gr_complex output and gr_complex taps
00039  * \ingroup filter_primitive
00040  *
00041  * This is the abstract class for a Finite Impulse Response filter.
00042  *
00043  * The trailing suffix has the form _IOT where I codes the input type,
00044  * O codes the output type, and T codes the tap type.
00045  * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int)
00046  */
00047 
00048 class GR_CORE_API gr_fir_scc {
00049 
00050 protected:
00051   std::vector<gr_complex>       d_taps;         // reversed taps
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   gr_fir_scc () {}
00065   gr_fir_scc (const std::vector<gr_complex> &taps) : d_taps (gr_reverse(taps)) {}
00066 
00067   virtual ~gr_fir_scc ();
00068 
00069   // MANIPULATORS
00070 
00071   /*!
00072    * \brief compute a single output value.
00073    *
00074    * \p input must have ntaps() valid entries.
00075    * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
00076    *
00077    * \returns the filtered input value.
00078    */
00079   virtual gr_complex filter (const short input[]) = 0;
00080 
00081   /*!
00082    * \brief compute an array of N output values.
00083    *
00084    * \p input must have (n - 1 + ntaps()) valid entries.
00085    * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
00086    */
00087   virtual void filterN (gr_complex output[], const short input[],
00088                         unsigned long n) = 0;
00089 
00090   /*!
00091    * \brief compute an array of N output values, decimating the input
00092    *
00093    * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
00094    * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
00095    * compute the output values.
00096    */
00097   virtual void filterNdec (gr_complex output[], const short input[],
00098                            unsigned long n, unsigned decimate) = 0;
00099 
00100   /*!
00101    * \brief install \p new_taps as the current taps.
00102    */
00103   virtual void set_taps (const std::vector<gr_complex> &taps)
00104   {
00105     d_taps = gr_reverse(taps);
00106   }
00107 
00108   // ACCESSORS
00109 
00110   /*!
00111    * \return number of taps in filter.
00112    */
00113   unsigned ntaps () const { return d_taps.size (); }
00114 
00115   /*!
00116    * \return current taps
00117    */
00118   virtual const std::vector<gr_complex> get_taps () const
00119   {
00120     return gr_reverse(d_taps);
00121   }
00122 };
00123 
00124 #endif /* INCLUDED_GR_GR_FIR_SCC_H */