⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generate_gr_fir_sysconfig_generic.py

📁 gnuradio软件无线电源程序.现在的手机多基于软件无线电
💻 PY
字号:
#!/bin/env python# -*- python -*-## Copyright 2003 Free Software Foundation, Inc.# # This file is part of GNU Radio# # GNU Radio is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.# # GNU Radio is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with GNU Radio; see the file COPYING.  If not, write to# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,# Boston, MA 02111-1307, USA.# from generate_utils import *# ----------------------------------------------------------------def make_gr_fir_sysconfig_generic_h ():    out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w')    out.write (copyright)    out.write ('''/* * WARNING: This file is automatically generated by * generate_gr_fir_sysconfig_generic.py. * * Any changes made to this file will be overwritten. */#ifndef _GR_FIR_SYSCONFIG_GENERIC_H_#define _GR_FIR_SYSCONFIG_GENERIC_H_#include <gr_fir_sysconfig.h>''')    out.write ('''class gr_fir_sysconfig_generic : public gr_fir_sysconfig {public:''')        for sig in fir_signatures:      out.write (('  virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);\n' %        (sig, sig, tap_type (sig))))    out.write ('\n')    for sig in fir_signatures:      out.write (('  virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);\n' %        (sig, sig)))    out.write ('''};#endif /* _GR_FIR_SYSCONFIG_GENERIC_H_ */''')    out.close ()    # ----------------------------------------------------------------def make_constructor (sig, out):    out.write ('''static gr_fir_%s *make_gr_fir_%s (const std::vector<%s> &taps){  return new gr_fir_%s_generic (taps);}''' % (sig, sig, tap_type (sig), sig))  def make_creator (sig, out):    out.write ('''gr_fir_%s *gr_fir_sysconfig_generic::create_gr_fir_%s (const std::vector<%s> &taps){  return make_gr_fir_%s (taps);}''' % (sig, sig, tap_type (sig), sig))    def make_info (sig, out):    out.write ('''voidgr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info){  info->resize (1);  (*info)[0].name = "generic";  (*info)[0].create = make_gr_fir_%s;}''' % (sig, sig, sig))    # ----------------------------------------------------------------def make_gr_fir_sysconfig_generic_cc ():    out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w')    out.write (copyright)    out.write ('''/* * WARNING: This file is automatically generated by * generate_gr_fir_sysconfig_generic.py. * * Any changes made to this file will be overwritten. */#include <gr_fir_sysconfig_generic.h>''')        for sig in fir_signatures:        out.write ('#include <gr_fir_%s_generic.h>\n' % (sig))    out.write ('''/* * ---------------------------------------------------------------- * static functions that serve as constructors returned by info * ---------------------------------------------------------------- */''')    for sig in fir_signatures:        make_constructor (sig, out)    out.write ('''/* * ---------------------------------------------------------------- * return instances of the generic C++ versions of these classes. * ---------------------------------------------------------------- */''')    for sig in fir_signatures:        make_creator (sig, out)    out.write ('''/* * Return info about available implementations. * * This is the bottom of the concrete hierarchy, so we set the * size of the vector to 1, and install our info.  Classes derived * from us invoke us first, then append their own info. */''')    for sig in fir_signatures:        make_info (sig, out)    out.close ()# ----------------------------------------------------------------def generate ():    make_gr_fir_sysconfig_generic_h ()    make_gr_fir_sysconfig_generic_cc ()if __name__ == '__main__':    generate ()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -