4 # Copyright 2003,2009 Free Software Foundation, Inc.
6 # This file is part of GNU Radio
8 # GNU Radio is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3, or (at your option)
13 # GNU Radio is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Radio; see the file COPYING. If not, write to
20 # the Free Software Foundation, Inc., 51 Franklin Street,
21 # Boston, MA 02110-1301, USA.
24 from generate_utils import *
27 # ----------------------------------------------------------------
29 def make_gr_fir_sysconfig_generic_h ():
30 out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w')
38 * WARNING: This file is automatically generated by
39 * generate_gr_fir_sysconfig_generic.py.
41 * Any changes made to this file will be overwritten.
44 #ifndef _GR_FIR_SYSCONFIG_GENERIC_H_
45 #define _GR_FIR_SYSCONFIG_GENERIC_H_
47 #include <gr_fir_sysconfig.h>
53 class gr_fir_sysconfig_generic : public gr_fir_sysconfig {
57 for sig in fir_signatures:
58 out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);\n' %
59 (sig, sig, tap_type (sig))))
63 for sig in fir_signatures:
64 out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);\n' %
72 #endif /* _GR_FIR_SYSCONFIG_GENERIC_H_ */
77 # ----------------------------------------------------------------
79 def make_constructor (sig, out):
82 make_gr_fir_%s (const std::vector<%s> &taps)
84 return new gr_fir_%s_generic (taps);
86 ''' % (sig, sig, tap_type (sig), sig))
89 def make_creator (sig, out):
92 gr_fir_sysconfig_generic::create_gr_fir_%s (const std::vector<%s> &taps)
94 return make_gr_fir_%s (taps);
96 ''' % (sig, sig, tap_type (sig), sig))
99 def make_info (sig, out):
102 gr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info)
105 (*info)[0].name = "generic";
106 (*info)[0].create = make_gr_fir_%s;
108 ''' % (sig, sig, sig))
111 # ----------------------------------------------------------------
113 def make_gr_fir_sysconfig_generic_cc ():
114 out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w')
117 out.write (copyright)
122 * WARNING: This file is automatically generated by
123 * generate_gr_fir_sysconfig_generic.py.
125 * Any changes made to this file will be overwritten.
131 #include <gr_fir_sysconfig_generic.h>
135 for sig in fir_signatures:
136 out.write ('#include <gr_fir_%s_generic.h>\n' % (sig))
141 * ----------------------------------------------------------------
142 * static functions that serve as constructors returned by info
143 * ----------------------------------------------------------------
147 for sig in fir_signatures:
148 make_constructor (sig, out)
153 * ----------------------------------------------------------------
154 * return instances of the generic C++ versions of these classes.
155 * ----------------------------------------------------------------
159 for sig in fir_signatures:
160 make_creator (sig, out)
165 * Return info about available implementations.
167 * This is the bottom of the concrete hierarchy, so we set the
168 * size of the vector to 1, and install our info. Classes derived
169 * from us invoke us first, then append their own info.
173 for sig in fir_signatures:
179 # ----------------------------------------------------------------
182 make_gr_fir_sysconfig_generic_h ()
183 make_gr_fir_sysconfig_generic_cc ()
185 if __name__ == '__main__':