add Vcs entries to control file
[debian/gnuradio] / gnuradio-core / src / lib / filter / gr_fir_filter_scc.cc
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004 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_gr_fir_filter_XXX.py
25  * Any changes made to this file will be overwritten.
26  */
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #include <gr_fir_filter_scc.h>
33 #include <gr_fir_scc.h>
34 #include <gr_fir_util.h>
35 #include <gr_io_signature.h>
36
37 gr_fir_filter_scc_sptr gr_make_fir_filter_scc (int decimation, const std::vector<gr_complex> &taps)
38 {
39   return gr_fir_filter_scc_sptr (new gr_fir_filter_scc (decimation, taps));
40 }
41
42
43 gr_fir_filter_scc::gr_fir_filter_scc (int decimation, const std::vector<gr_complex> &taps)
44   : gr_sync_decimator ("fir_filter_scc",
45                        gr_make_io_signature (1, 1, sizeof (short)),
46                        gr_make_io_signature (1, 1, sizeof (gr_complex)),
47                        decimation),
48     d_updated (false)
49 {
50   d_fir = gr_fir_util::create_gr_fir_scc (taps);
51   set_history (d_fir->ntaps ());
52 }
53
54 gr_fir_filter_scc::~gr_fir_filter_scc ()
55 {
56   delete d_fir;
57 }
58
59 void
60 gr_fir_filter_scc::set_taps (const std::vector<gr_complex> &taps)
61 {
62   d_new_taps = taps;
63   d_updated = true;
64 }
65
66 int
67 gr_fir_filter_scc::work (int noutput_items,
68                    gr_vector_const_void_star &input_items,
69                    gr_vector_void_star &output_items)
70 {
71   short *in = (short *) input_items[0];
72   gr_complex *out = (gr_complex *) output_items[0];
73
74   if (d_updated) {
75     d_fir->set_taps (d_new_taps);
76     set_history (d_fir->ntaps ());
77     d_updated = false;
78     return 0;                // history requirements may have changed.
79   }
80
81   if (decimation() == 1)
82     d_fir->filterN (out, in, noutput_items);
83
84   else
85     d_fir->filterNdec (out, in, noutput_items, decimation());
86
87   return noutput_items;
88 }