summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/GrMiscUtils.cmake173
-rw-r--r--docs/doxygen/CMakeLists.txt24
-rw-r--r--docs/doxygen/Doxyfile.in2
-rw-r--r--gnuradio-runtime/include/pmt/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/include/pmt/pmt_serial_tags.h (renamed from gnuradio-runtime/lib/pmt/gen-serial-tags.py)62
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt5
-rw-r--r--gnuradio-runtime/lib/pmt/CMakeLists.txt63
-rw-r--r--gnuradio-runtime/lib/pmt/generate_unv.py192
-rw-r--r--gnuradio-runtime/lib/pmt/pmt-serial-tags.scm77
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_int.h3
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_unv.cc1821
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_unv_int.h331
-rw-r--r--gnuradio-runtime/lib/pmt/qa_pmt_unv.cc448
-rw-r--r--gnuradio-runtime/lib/pmt/qa_pmt_unv.h61
-rw-r--r--gnuradio-runtime/lib/pmt/unv_qa_template.cc.t35
-rw-r--r--gnuradio-runtime/lib/pmt/unv_template.cc.t149
-rw-r--r--gnuradio-runtime/lib/pmt/unv_template.h.t25
-rw-r--r--gnuradio-runtime/python/build_utils.py227
-rw-r--r--gnuradio-runtime/python/build_utils_codes.py53
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/swig/gr_swig_block_magic.i12
-rw-r--r--gr-analog/include/gnuradio/analog/CMakeLists.txt18
-rw-r--r--gr-analog/include/gnuradio/analog/fastnoise_source.h (renamed from gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t)25
-rw-r--r--gr-analog/include/gnuradio/analog/noise_source.h (renamed from gr-analog/include/gnuradio/analog/noise_source_X.h.t)21
-rw-r--r--gr-analog/include/gnuradio/analog/random_uniform_source.h (renamed from gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t)19
-rw-r--r--gr-analog/include/gnuradio/analog/sig_source.h (renamed from gr-analog/include/gnuradio/analog/sig_source_X.h.t)28
-rw-r--r--gr-analog/lib/CMakeLists.txt17
-rw-r--r--gr-analog/lib/fastnoise_source_X_impl.cc.t175
-rw-r--r--gr-analog/lib/fastnoise_source_impl.cc191
-rw-r--r--gr-analog/lib/fastnoise_source_impl.h (renamed from gr-analog/lib/fastnoise_source_X_impl.h.t)22
-rw-r--r--gr-analog/lib/noise_source_X_impl.cc.t139
-rw-r--r--gr-analog/lib/noise_source_impl.cc150
-rw-r--r--gr-analog/lib/noise_source_impl.h (renamed from gr-analog/lib/noise_source_X_impl.h.t)16
-rw-r--r--gr-analog/lib/random_uniform_source_X_impl.cc.t83
-rw-r--r--gr-analog/lib/random_uniform_source_impl.cc76
-rw-r--r--gr-analog/lib/random_uniform_source_impl.h (renamed from gr-analog/lib/random_uniform_source_X_impl.h.t)16
-rw-r--r--gr-analog/lib/sig_source_X_impl.cc.t287
-rw-r--r--gr-analog/lib/sig_source_impl.cc287
-rw-r--r--gr-analog/lib/sig_source_impl.h (renamed from gr-analog/lib/sig_source_X_impl.h.t)26
-rw-r--r--gr-analog/swig/CMakeLists.txt1
-rw-r--r--gr-analog/swig/analog_swig.i68
-rw-r--r--gr-audio/examples/c++/dial_tone.cc2
-rw-r--r--gr-blocks/include/gnuradio/blocks/CMakeLists.txt77
-rw-r--r--gr-blocks/include/gnuradio/blocks/abs_blk.h (renamed from gr-blocks/include/gnuradio/blocks/abs_XX.h.t)22
-rw-r--r--gr-blocks/include/gnuradio/blocks/add_blk.h (renamed from gr-blocks/include/gnuradio/blocks/add_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/add_const_v.h (renamed from gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t)31
-rw-r--r--gr-blocks/include/gnuradio/blocks/add_ff.h57
-rw-r--r--gr-blocks/include/gnuradio/blocks/and_blk.h (renamed from gr-blocks/include/gnuradio/blocks/and_XX.h.t)20
-rw-r--r--gr-blocks/include/gnuradio/blocks/and_const.h (renamed from gr-blocks/include/gnuradio/blocks/and_const_XX.h.t)28
-rw-r--r--gr-blocks/include/gnuradio/blocks/argmax.h (renamed from gr-blocks/include/gnuradio/blocks/argmax_XX.h.t)20
-rw-r--r--gr-blocks/include/gnuradio/blocks/divide.h (renamed from gr-blocks/include/gnuradio/blocks/divide_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/integrate.h (renamed from gr-blocks/include/gnuradio/blocks/integrate_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/max_blk.h (renamed from gr-blocks/include/gnuradio/blocks/max_XX.h.t)22
-rw-r--r--gr-blocks/include/gnuradio/blocks/min_blk.h (renamed from gr-blocks/include/gnuradio/blocks/min_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/moving_average.h (renamed from gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t)29
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply.h (renamed from gr-blocks/include/gnuradio/blocks/multiply_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_cc.h57
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const.h (renamed from gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t)29
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const_cc.h65
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const_ff.h67
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const_v.h (renamed from gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t)30
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h62
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_const_vff.h62
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_ff.h57
-rw-r--r--gr-blocks/include/gnuradio/blocks/multiply_matrix.h (renamed from gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t)29
-rw-r--r--gr-blocks/include/gnuradio/blocks/mute.h (renamed from gr-blocks/include/gnuradio/blocks/mute_XX.h.t)20
-rw-r--r--gr-blocks/include/gnuradio/blocks/not_blk.h (renamed from gr-blocks/include/gnuradio/blocks/not_XX.h.t)19
-rw-r--r--gr-blocks/include/gnuradio/blocks/or_blk.h (renamed from gr-blocks/include/gnuradio/blocks/or_XX.h.t)20
-rw-r--r--gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h (renamed from gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t)22
-rw-r--r--gr-blocks/include/gnuradio/blocks/peak_detector.h (renamed from gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/probe_signal.h (renamed from gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t)24
-rw-r--r--gr-blocks/include/gnuradio/blocks/probe_signal_v.h (renamed from gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t)25
-rw-r--r--gr-blocks/include/gnuradio/blocks/sample_and_hold.h (renamed from gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/sub.h (renamed from gr-blocks/include/gnuradio/blocks/sub_XX.h.t)21
-rw-r--r--gr-blocks/include/gnuradio/blocks/sub_ff.h51
-rw-r--r--gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h (renamed from gr-blocks/include/gnuradio/blocks/tsb_vector_sink_X.h.t)22
-rw-r--r--gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h (renamed from gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t)22
-rw-r--r--gr-blocks/include/gnuradio/blocks/vector_insert.h (renamed from gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t)28
-rw-r--r--gr-blocks/include/gnuradio/blocks/vector_sink.h (renamed from gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t)26
-rw-r--r--gr-blocks/include/gnuradio/blocks/vector_source.h (renamed from gr-blocks/include/gnuradio/blocks/vector_source_X.h.t)30
-rw-r--r--gr-blocks/include/gnuradio/blocks/xor_blk.h (renamed from gr-blocks/include/gnuradio/blocks/xor_XX.h.t)20
-rw-r--r--gr-blocks/lib/CMakeLists.txt80
-rw-r--r--gr-blocks/lib/abs_blk_impl.cc (renamed from gr-blocks/lib/abs_XX_impl.cc.t)33
-rw-r--r--gr-blocks/lib/abs_blk_impl.h (renamed from gr-blocks/lib/add_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/add_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/add_blk_impl.cc106
-rw-r--r--gr-blocks/lib/add_blk_impl.h (renamed from gr-blocks/lib/abs_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/add_const_v_impl.cc (renamed from gr-blocks/lib/add_const_vXX_impl.cc.t)34
-rw-r--r--gr-blocks/lib/add_const_v_impl.h (renamed from gr-blocks/lib/add_const_vXX_impl.h.t)23
-rw-r--r--gr-blocks/lib/add_ff_impl.cc65
-rw-r--r--gr-blocks/lib/and_blk_impl.cc (renamed from gr-blocks/lib/divide_XX_impl.cc.t)33
-rw-r--r--gr-blocks/lib/and_blk_impl.h (renamed from gr-blocks/lib/and_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/and_const_impl.cc (renamed from gr-blocks/lib/and_const_XX_impl.cc.t)29
-rw-r--r--gr-blocks/lib/and_const_impl.h51
-rw-r--r--gr-blocks/lib/argmax_impl.cc (renamed from gr-blocks/lib/argmax_XX_impl.cc.t)45
-rw-r--r--gr-blocks/lib/argmax_impl.h (renamed from gr-blocks/lib/argmax_XX_impl.h.t)19
-rw-r--r--gr-blocks/lib/divide_cc_impl.cc66
-rw-r--r--gr-blocks/lib/divide_ff_impl.cc66
-rw-r--r--gr-blocks/lib/divide_impl.cc130
-rw-r--r--gr-blocks/lib/divide_impl.h (renamed from gr-blocks/lib/divide_cc_impl.h)15
-rw-r--r--gr-blocks/lib/integrate_impl.cc (renamed from gr-blocks/lib/integrate_XX_impl.cc.t)32
-rw-r--r--gr-blocks/lib/integrate_impl.h (renamed from gr-blocks/lib/integrate_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/max_blk_impl.cc (renamed from gr-blocks/lib/max_XX_impl.cc.t)48
-rw-r--r--gr-blocks/lib/max_blk_impl.h (renamed from gr-blocks/lib/min_XX_impl.h.t)18
-rw-r--r--gr-blocks/lib/min_blk_impl.cc (renamed from gr-blocks/lib/min_XX_impl.cc.t)53
-rw-r--r--gr-blocks/lib/min_blk_impl.h (renamed from gr-blocks/lib/max_XX_impl.h.t)18
-rw-r--r--gr-blocks/lib/moving_average_impl.cc (renamed from gr-blocks/lib/moving_average_XX_impl.cc.t)52
-rw-r--r--gr-blocks/lib/moving_average_impl.h (renamed from gr-blocks/lib/moving_average_XX_impl.h.t)30
-rw-r--r--gr-blocks/lib/multiply_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/multiply_XX_impl.h.t47
-rw-r--r--gr-blocks/lib/multiply_cc_impl.cc66
-rw-r--r--gr-blocks/lib/multiply_cc_impl.h47
-rw-r--r--gr-blocks/lib/multiply_const_XX_impl.cc.t77
-rw-r--r--gr-blocks/lib/multiply_const_XX_impl.h.t51
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.cc91
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.h52
-rw-r--r--gr-blocks/lib/multiply_const_ff_impl.cc89
-rw-r--r--gr-blocks/lib/multiply_const_ff_impl.h54
-rw-r--r--gr-blocks/lib/multiply_const_impl.cc139
-rw-r--r--gr-blocks/lib/multiply_const_impl.h (renamed from gr-blocks/lib/and_const_XX_impl.h.t)22
-rw-r--r--gr-blocks/lib/multiply_const_vXX_impl.cc.t66
-rw-r--r--gr-blocks/lib/multiply_const_vXX_impl.h.t51
-rw-r--r--gr-blocks/lib/multiply_const_v_impl.cc138
-rw-r--r--gr-blocks/lib/multiply_const_v_impl.h50
-rw-r--r--gr-blocks/lib/multiply_const_vcc_impl.cc100
-rw-r--r--gr-blocks/lib/multiply_const_vcc_impl.h52
-rw-r--r--gr-blocks/lib/multiply_const_vff_impl.cc96
-rw-r--r--gr-blocks/lib/multiply_const_vff_impl.h52
-rw-r--r--gr-blocks/lib/multiply_ff_impl.cc66
-rw-r--r--gr-blocks/lib/multiply_ff_impl.h47
-rw-r--r--gr-blocks/lib/multiply_impl.cc132
-rw-r--r--gr-blocks/lib/multiply_impl.h (renamed from gr-blocks/lib/add_ff_impl.h)18
-rw-r--r--gr-blocks/lib/multiply_matrix_cc_impl.cc182
-rw-r--r--gr-blocks/lib/multiply_matrix_cc_impl.h56
-rw-r--r--gr-blocks/lib/multiply_matrix_ff_impl.cc182
-rw-r--r--gr-blocks/lib/multiply_matrix_impl.cc327
-rw-r--r--gr-blocks/lib/multiply_matrix_impl.h (renamed from gr-blocks/lib/multiply_matrix_ff_impl.h)24
-rw-r--r--gr-blocks/lib/mute_impl.cc (renamed from gr-blocks/lib/mute_XX_impl.cc.t)43
-rw-r--r--gr-blocks/lib/mute_impl.h (renamed from gr-blocks/lib/mute_XX_impl.h.t)18
-rw-r--r--gr-blocks/lib/not_blk_impl.cc (renamed from gr-blocks/lib/not_XX_impl.cc.t)29
-rw-r--r--gr-blocks/lib/not_blk_impl.h (renamed from gr-blocks/lib/divide_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/or_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/or_blk_impl.cc67
-rw-r--r--gr-blocks/lib/or_blk_impl.h (renamed from gr-blocks/lib/or_XX_impl.h.t)17
-rw-r--r--gr-blocks/lib/packed_to_unpacked_impl.cc (renamed from gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t)71
-rw-r--r--gr-blocks/lib/packed_to_unpacked_impl.h (renamed from gr-blocks/lib/unpacked_to_packed_XX_impl.h.t)23
-rw-r--r--gr-blocks/lib/peak_detector_impl.cc (renamed from gr-blocks/lib/peak_detector_XX_impl.cc.t)35
-rw-r--r--gr-blocks/lib/peak_detector_impl.h (renamed from gr-blocks/lib/peak_detector_XX_impl.h.t)19
-rw-r--r--gr-blocks/lib/probe_signal_impl.cc (renamed from gr-blocks/lib/probe_signal_X_impl.cc.t)32
-rw-r--r--gr-blocks/lib/probe_signal_impl.h52
-rw-r--r--gr-blocks/lib/probe_signal_v_impl.cc (renamed from gr-blocks/lib/probe_signal_vX_impl.cc.t)33
-rw-r--r--gr-blocks/lib/probe_signal_v_impl.h (renamed from gr-blocks/lib/probe_signal_vX_impl.h.t)23
-rw-r--r--gr-blocks/lib/sample_and_hold_XX_impl.h.t50
-rw-r--r--gr-blocks/lib/sample_and_hold_impl.cc (renamed from gr-blocks/lib/sample_and_hold_XX_impl.cc.t)35
-rw-r--r--gr-blocks/lib/sample_and_hold_impl.h (renamed from gr-blocks/lib/probe_signal_X_impl.h.t)22
-rw-r--r--gr-blocks/lib/sub_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/sub_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/sub_ff_impl.h47
-rw-r--r--gr-blocks/lib/sub_impl.cc (renamed from gr-blocks/lib/sub_ff_impl.cc)60
-rw-r--r--gr-blocks/lib/sub_impl.h (renamed from gr-blocks/lib/not_XX_impl.h.t)16
-rw-r--r--gr-blocks/lib/tsb_vector_sink_impl.cc (renamed from gr-blocks/lib/tsb_vector_sink_X_impl.cc.t)44
-rw-r--r--gr-blocks/lib/tsb_vector_sink_impl.h (renamed from gr-blocks/lib/tsb_vector_sink_X_impl.h.t)22
-rw-r--r--gr-blocks/lib/unpacked_to_packed_impl.cc (renamed from gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t)61
-rw-r--r--gr-blocks/lib/unpacked_to_packed_impl.h (renamed from gr-blocks/lib/packed_to_unpacked_XX_impl.h.t)20
-rw-r--r--gr-blocks/lib/vector_insert_impl.cc (renamed from gr-blocks/lib/vector_insert_X_impl.cc.t)50
-rw-r--r--gr-blocks/lib/vector_insert_impl.h (renamed from gr-blocks/lib/vector_insert_X_impl.h.t)22
-rw-r--r--gr-blocks/lib/vector_sink_impl.cc (renamed from gr-blocks/lib/vector_sink_X_impl.cc.t)45
-rw-r--r--gr-blocks/lib/vector_sink_impl.h (renamed from gr-blocks/lib/vector_sink_X_impl.h.t)22
-rw-r--r--gr-blocks/lib/vector_source_impl.cc (renamed from gr-blocks/lib/vector_source_X_impl.cc.t)43
-rw-r--r--gr-blocks/lib/vector_source_impl.h (renamed from gr-blocks/lib/vector_source_X_impl.h.t)22
-rw-r--r--gr-blocks/lib/xor_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/xor_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/xor_blk_impl.cc (renamed from gr-blocks/lib/and_XX_impl.cc.t)34
-rw-r--r--gr-blocks/lib/xor_blk_impl.h (renamed from gr-blocks/lib/divide_ff_impl.h)15
-rw-r--r--gr-blocks/swig/CMakeLists.txt1
-rw-r--r--gr-blocks/swig/blocks_swig1.i66
-rw-r--r--gr-blocks/swig/blocks_swig10.i74
-rw-r--r--gr-blocks/swig/blocks_swig2.i28
-rw-r--r--gr-blocks/swig/blocks_swig3.i82
-rw-r--r--gr-blocks/swig/blocks_swig4.i58
-rw-r--r--gr-blocks/swig/blocks_swig5.i36
-rw-r--r--gr-blocks/swig/blocks_swig6.i28
-rw-r--r--gr-blocks/swig/blocks_swig7.i40
-rw-r--r--gr-blocks/swig/blocks_swig8.i68
-rw-r--r--gr-blocks/swig/blocks_swig9.i32
-rw-r--r--gr-channels/lib/CMakeLists.txt3
-rw-r--r--gr-channels/lib/cfo_model_impl.h6
-rw-r--r--gr-channels/lib/channel_model2_impl.h10
-rw-r--r--gr-channels/lib/channel_model_impl.h10
-rw-r--r--gr-channels/lib/dynamic_channel_model_impl.h10
-rw-r--r--gr-channels/lib/sro_model_impl.h2
-rw-r--r--gr-comedi/swig/CMakeLists.txt1
-rw-r--r--gr-digital/include/gnuradio/digital/CMakeLists.txt14
-rw-r--r--gr-digital/include/gnuradio/digital/burst_shaper.h (renamed from gr-digital/include/gnuradio/digital/burst_shaper_XX.h.t)32
-rw-r--r--gr-digital/include/gnuradio/digital/chunks_to_symbols.h (renamed from gr-digital/include/gnuradio/digital/chunks_to_symbols_XX.h.t)35
-rw-r--r--gr-digital/lib/CMakeLists.txt12
-rw-r--r--gr-digital/lib/burst_shaper_impl.cc (renamed from gr-digital/lib/burst_shaper_XX_impl.cc.t)157
-rw-r--r--gr-digital/lib/burst_shaper_impl.h (renamed from gr-digital/lib/burst_shaper_XX_impl.h.t)43
-rw-r--r--gr-digital/lib/chunks_to_symbols_impl.cc (renamed from gr-digital/lib/chunks_to_symbols_XX_impl.cc.t)74
-rw-r--r--gr-digital/lib/chunks_to_symbols_impl.h (renamed from gr-digital/lib/chunks_to_symbols_XX_impl.h.t)27
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.h13
-rw-r--r--gr-digital/lib/modulate_vector.cc6
-rw-r--r--gr-digital/lib/ofdm_sync_sc_cfb_impl.cc21
-rw-r--r--gr-digital/swig/CMakeLists.txt1
-rw-r--r--gr-digital/swig/digital_swig1.i36
-rw-r--r--gr-filter/include/gnuradio/filter/CMakeLists.txt17
-rw-r--r--gr-filter/include/gnuradio/filter/fir_filter.h234
-rw-r--r--gr-filter/include/gnuradio/filter/fir_filter_blk.h (renamed from gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t)40
-rw-r--r--gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h (renamed from gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t)40
-rw-r--r--gr-filter/include/gnuradio/filter/interp_fir_filter.h (renamed from gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t)38
-rw-r--r--gr-filter/include/gnuradio/filter/rational_resampler_base.h (renamed from gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t)32
-rw-r--r--gr-filter/lib/CMakeLists.txt19
-rw-r--r--gr-filter/lib/fir_filter.cc858
-rw-r--r--gr-filter/lib/fir_filter_XXX_impl.cc.t107
-rw-r--r--gr-filter/lib/fir_filter_blk_impl.cc115
-rw-r--r--gr-filter/lib/fir_filter_blk_impl.h (renamed from gr-filter/lib/fir_filter_XXX_impl.h.t)25
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_impl.cc (renamed from gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t)86
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_impl.h (renamed from gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t)32
-rw-r--r--gr-filter/lib/interp_fir_filter_XXX_impl.cc.t155
-rw-r--r--gr-filter/lib/interp_fir_filter_impl.cc167
-rw-r--r--gr-filter/lib/interp_fir_filter_impl.h (renamed from gr-filter/lib/interp_fir_filter_XXX_impl.h.t)31
-rw-r--r--gr-filter/lib/rational_resampler_base_XXX_impl.cc.t176
-rw-r--r--gr-filter/lib/rational_resampler_base_impl.cc188
-rw-r--r--gr-filter/lib/rational_resampler_base_impl.h (renamed from gr-filter/lib/rational_resampler_base_XXX_impl.h.t)31
-rw-r--r--gr-filter/swig/CMakeLists.txt1
-rw-r--r--gr-filter/swig/filter_swig.i104
-rw-r--r--gr-qtgui/examples/c++/display_qt.h6
-rw-r--r--gr-trellis/include/gnuradio/trellis/CMakeLists.txt33
-rw-r--r--gr-trellis/include/gnuradio/trellis/encoder.h (renamed from gr-trellis/include/gnuradio/trellis/encoder_XX.h.t)23
-rw-r--r--gr-trellis/include/gnuradio/trellis/metrics.h (renamed from gr-trellis/include/gnuradio/trellis/metrics_X.h.t)27
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h (renamed from gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t)20
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h (renamed from gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t)28
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_encoder.h (renamed from gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t)24
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h (renamed from gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t)20
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h (renamed from gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t)28
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_encoder.h (renamed from gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t)22
-rw-r--r--gr-trellis/include/gnuradio/trellis/viterbi.h (renamed from gr-trellis/include/gnuradio/trellis/viterbi_X.h.t)20
-rw-r--r--gr-trellis/include/gnuradio/trellis/viterbi_combined.h (renamed from gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t)36
-rw-r--r--gr-trellis/lib/CMakeLists.txt32
-rw-r--r--gr-trellis/lib/encoder_XX_impl.cc.t118
-rw-r--r--gr-trellis/lib/encoder_impl.cc131
-rw-r--r--gr-trellis/lib/encoder_impl.h (renamed from gr-trellis/lib/encoder_XX_impl.h.t)21
-rw-r--r--gr-trellis/lib/metrics_impl.cc (renamed from gr-trellis/lib/metrics_X_impl.cc.t)76
-rw-r--r--gr-trellis/lib/metrics_impl.h (renamed from gr-trellis/lib/metrics_X_impl.h.t)24
-rw-r--r--gr-trellis/lib/pccc_decoder_blk_impl.cc (renamed from gr-trellis/lib/pccc_decoder_X_impl.cc.t)39
-rw-r--r--gr-trellis/lib/pccc_decoder_blk_impl.h (renamed from gr-trellis/lib/pccc_decoder_X_impl.h.t)18
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_blk_impl.cc (renamed from gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t)59
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_blk_impl.h (renamed from gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t)25
-rw-r--r--gr-trellis/lib/pccc_encoder_impl.cc (renamed from gr-trellis/lib/pccc_encoder_XX_impl.cc.t)42
-rw-r--r--gr-trellis/lib/pccc_encoder_impl.h (renamed from gr-trellis/lib/pccc_encoder_XX_impl.h.t)19
-rw-r--r--gr-trellis/lib/sccc_decoder_blk_impl.cc (renamed from gr-trellis/lib/sccc_decoder_X_impl.cc.t)39
-rw-r--r--gr-trellis/lib/sccc_decoder_blk_impl.h (renamed from gr-trellis/lib/sccc_decoder_X_impl.h.t)18
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_blk_impl.cc (renamed from gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t)60
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_blk_impl.h (renamed from gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t)25
-rw-r--r--gr-trellis/lib/sccc_encoder_impl.cc (renamed from gr-trellis/lib/sccc_encoder_XX_impl.cc.t)44
-rw-r--r--gr-trellis/lib/sccc_encoder_impl.h (renamed from gr-trellis/lib/sccc_encoder_XX_impl.h.t)19
-rw-r--r--gr-trellis/lib/viterbi_combined_XX_impl.cc.t153
-rw-r--r--gr-trellis/lib/viterbi_combined_impl.cc176
-rw-r--r--gr-trellis/lib/viterbi_combined_impl.h (renamed from gr-trellis/lib/viterbi_combined_XX_impl.h.t)27
-rw-r--r--gr-trellis/lib/viterbi_impl.cc (renamed from gr-trellis/lib/viterbi_X_impl.cc.t)65
-rw-r--r--gr-trellis/lib/viterbi_impl.h (renamed from gr-trellis/lib/viterbi_X_impl.h.t)18
-rw-r--r--gr-trellis/swig/CMakeLists.txt1
-rw-r--r--gr-trellis/swig/trellis_swig0.i96
-rw-r--r--gr-trellis/swig/trellis_swig1.i145
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake176
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils.py228
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py53
-rw-r--r--gr-video-sdl/swig/CMakeLists.txt1
-rw-r--r--gr-wavelet/lib/CMakeLists.txt4
-rwxr-xr-xtools/template_convert.py282
270 files changed, 8589 insertions, 9180 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 6f0c8ac270..920e8adbee 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -302,176 +302,3 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread)
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
-
-########################################################################
-# Macros to generate source and header files from template
-########################################################################
-macro(GR_EXPAND_X_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated headers
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the headers
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #install rules for the generated headers
- list(APPEND generated_includes ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_H)
-
-macro(GR_EXPAND_X_CC_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_impl_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the source files
- add_custom_command(
- OUTPUT ${expanded_files_cc}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.cc.t ${ARGN}
- )
-
- #create a command to generate the header files
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #make source files depends on headers to force generation
- set_source_files_properties(${expanded_files_cc}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc})
- list(APPEND generated_headers ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_CC_H)
-
-macro(GR_EXPAND_X_CC_H_IMPL component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, '${component}')
- build_utils.expand_template(d, inp, '_impl')
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc_impl)
- unset(expanded_files_h_impl)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc)
- list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the _impl.cc files
- add_custom_command(
- OUTPUT ${expanded_files_cc_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.cc.t ${ARGN}
- )
-
- #create a command to generate the _impl.h files
- add_custom_command(
- OUTPUT ${expanded_files_h_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.h.t ${ARGN}
- )
-
- #make _impl.cc source files depend on _impl.h to force generation
- set_source_files_properties(${expanded_files_cc_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}"
- )
-
- #make _impl.h source files depend on headers to force generation
- set_source_files_properties(${expanded_files_h_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc_impl})
- list(APPEND generated_headers ${expanded_files_h_impl})
-
-endmacro(GR_EXPAND_X_CC_H_IMPL)
diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt
index 83a9ee29ed..952579f589 100644
--- a/docs/doxygen/CMakeLists.txt
+++ b/docs/doxygen/CMakeLists.txt
@@ -41,30 +41,6 @@ configure_file(
set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
-if(ENABLE_GNURADIO_RUNTIME)
- list(APPEND GENERATED_DEPS pmt_generated)
-endif(ENABLE_GNURADIO_RUNTIME)
-
-if(ENABLE_GR_BLOCKS)
- list(APPEND GENERATED_DEPS blocks_generated_includes)
-endif(ENABLE_GR_BLOCKS)
-
-if(ENABLE_GR_ANALOG)
- list(APPEND GENERATED_DEPS analog_generated_includes)
-endif(ENABLE_GR_ANALOG)
-
-if(ENABLE_GR_DIGITAL)
- list(APPEND GENERATED_DEPS digital_generated_includes)
-endif(ENABLE_GR_DIGITAL)
-
-if(ENABLE_GR_FILTER)
- list(APPEND GENERATED_DEPS filter_generated_includes)
-endif(ENABLE_GR_FILTER)
-
-if(ENABLE_GR_TRELLIS)
- list(APPEND GENERATED_DEPS trellis_generated_includes)
-endif(ENABLE_GR_TRELLIS)
-
########################################################################
# Make and install doxygen docs
########################################################################
diff --git a/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in
index 3be1cbc23a..698798d762 100644
--- a/docs/doxygen/Doxyfile.in
+++ b/docs/doxygen/Doxyfile.in
@@ -738,8 +738,6 @@ EXCLUDE = @abs_top_srcdir@/volk \
@abs_top_builddir@/dtools \
@abs_top_builddir@/gnuradio-runtime/lib/runtime/gr_error_handler.cc \
@abs_top_builddir@/gnuradio-runtime/swig \
- @abs_top_builddir@/gnuradio-runtime/python/build_utils.py \
- @abs_top_builddir@/gnuradio-runtime/python/build_utils_codes.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py \
diff --git a/gnuradio-runtime/include/pmt/CMakeLists.txt b/gnuradio-runtime/include/pmt/CMakeLists.txt
index f4a541e0dd..2b33ea0105 100644
--- a/gnuradio-runtime/include/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/include/pmt/CMakeLists.txt
@@ -25,5 +25,6 @@ install(FILES
pmt.h
pmt_pool.h
pmt_sugar.h
+ pmt_serial_tags.h
DESTINATION ${GR_INCLUDE_DIR}/pmt
)
diff --git a/gnuradio-runtime/lib/pmt/gen-serial-tags.py b/gnuradio-runtime/include/pmt/pmt_serial_tags.h
index 2ff2240a47..ea89693a49 100644
--- a/gnuradio-runtime/lib/pmt/gen-serial-tags.py
+++ b/gnuradio-runtime/include/pmt/pmt_serial_tags.h
@@ -1,4 +1,4 @@
-"""
+
//
// Copyright 2011 Free Software Foundation, Inc.
//
@@ -19,38 +19,44 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//
-// THIS FILE IS MACHINE GENERATED FROM %s. DO NOT EDIT BY HAND.
-// See %s for additional commentary.
+// THIS FILE IS MACHINE GENERATED FROM gen-serial-tags.py. DO NOT EDIT BY HAND.
+// See pmt-serial-tags.scm for additional commentary.
//
#ifndef INCLUDED_PMT_SERIAL_TAGS_H
#define INCLUDED_PMT_SERIAL_TAGS_H
enum pst_tags {
-%s
+ PST_TRUE = 0x00,
+ PST_FALSE = 0x01,
+ PST_SYMBOL = 0x02,
+ PST_INT32 = 0x03,
+ PST_DOUBLE = 0x04,
+ PST_COMPLEX = 0x05,
+ PST_NULL = 0x06,
+ PST_PAIR = 0x07,
+ PST_VECTOR = 0x08,
+ PST_DICT = 0x09,
+ PST_UNIFORM_VECTOR = 0x0a,
+ PST_UINT64 = 0x0b,
+ PST_TUPLE = 0x0c,
+ UVI_ENDIAN_MASK = 0x80,
+ UVI_SUBTYPE_MASK = 0x7f,
+ UVI_LITTLE_ENDIAN = 0x00,
+ UVI_BIG_ENDIAN = 0x80,
+ UVI_U8 = 0x00,
+ UVI_S8 = 0x01,
+ UVI_U16 = 0x02,
+ UVI_S16 = 0x03,
+ UVI_U32 = 0x04,
+ UVI_S32 = 0x05,
+ UVI_U64 = 0x06,
+ UVI_S64 = 0x07,
+ UVI_F32 = 0x08,
+ UVI_F64 = 0x09,
+ UVI_C32 = 0x0a,
+ UVI_C64 = 0x0b,
+ PST_COMMENT = 0x3b,
+ PST_COMMENT_END = 0x0a
};
#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
-"""
-
-from __future__ import print_function
-from __future__ import unicode_literals
-
-import sys, os, re
-
-if __name__ == '__main__':
- if len(sys.argv) != 3:
- print("Usage %s <input_scm_file> <output_hdr_file>"%__file__)
- exit()
- input_scm_file, output_hdr_file = sys.argv[1:]
- enums = list()
- for line in open(input_scm_file).readlines():
- match = re.match('^\s*\(define\s+([\w|-]+)\s+#x([0-9a-fA-F]+)\)', line)
- if not match: continue
- name, value = match.groups()
- name = name.upper().replace('-', '_')
- enums.append(' %s = 0x%s'%(name, value))
- open(output_hdr_file, 'w').write(__doc__%(
- os.path.basename(__file__),
- os.path.basename(input_scm_file),
- ',\n'.join(enums),
- ))
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index c820c5f1e9..81b7efa766 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -188,11 +188,6 @@ add_library(gnuradio-runtime SHARED ${gnuradio_runtime_sources})
target_link_libraries(gnuradio-runtime ${gnuradio_runtime_libs})
GR_LIBRARY_FOO(gnuradio-runtime)
-add_dependencies(gnuradio-runtime
- pmt_generated runtime_generated_includes
-)
-
-
#######################################################
# STATIC LIB BUILD
#######################################################
diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt
index 85b2a4d6e0..c840b8b930 100644
--- a/gnuradio-runtime/lib/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt
@@ -23,57 +23,8 @@
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-########################################################################
-# Generate serial tags header file
-########################################################################
-
-get_filename_component(PMT_SERIAL_TAGS_H
- ${CMAKE_CURRENT_BINARY_DIR}/../../include/pmt/pmt_serial_tags.h ABSOLUTE
-)
-
-add_custom_command(
- OUTPUT ${PMT_SERIAL_TAGS_H}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
- COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
- ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
- ${PMT_SERIAL_TAGS_H}
-)
-
-install(
- FILES ${PMT_SERIAL_TAGS_H}
- DESTINATION ${GR_INCLUDE_DIR}/pmt
-)
-
-include(AddFileDependencies)
-ADD_FILE_DEPENDENCIES(
- ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc
- ${PMT_SERIAL_TAGS_H}
-)
-
-########################################################################
-# Generate other pmt stuff
-########################################################################
-add_custom_command(
- OUTPUT
- ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h
- ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.h
- ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
- ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
- DEPENDS
- ${CMAKE_CURRENT_SOURCE_DIR}/generate_unv.py
- ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t
- ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t
- ${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B -c
- "import os, sys; srcdir='${CMAKE_CURRENT_SOURCE_DIR}'; sys.path.append(srcdir); os.environ['srcdir']=srcdir; from generate_unv import main; main()"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- VERBATIM
-)
-
set(pmt_sources
- ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt_unv.cc
${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc
${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc
${CMAKE_CURRENT_SOURCE_DIR}/pmt_pool.cc
@@ -85,10 +36,6 @@ list(APPEND gnuradio_pmt_libs
${LOG4CPP_LIBRARIES}
)
-add_custom_target(pmt_generated
- DEPENDS ${PMT_SERIAL_TAGS_H} ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h)
-
-
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -109,14 +56,10 @@ target_link_libraries(gnuradio-pmt ${gnuradio_pmt_libs})
GR_LIBRARY_FOO(gnuradio-pmt)
-add_dependencies(gnuradio-pmt
- pmt_generated
-)
-
if(ENABLE_STATIC_LIBS)
add_library(gnuradio-pmt_static STATIC ${pmt_sources})
- add_dependencies(gnuradio-pmt_static pmt_generated)
+ add_dependencies(gnuradio-pmt_static)
if(NOT WIN32)
set_target_properties(gnuradio-pmt_static
@@ -140,7 +83,7 @@ include(GrTest)
list(APPEND test_gnuradio_pmt_sources
qa_pmt.cc
qa_pmt_prims.cc
- ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
+ qa_pmt_unv.cc
)
include_directories(${CPPUNIT_INCLUDE_DIRS})
diff --git a/gnuradio-runtime/lib/pmt/generate_unv.py b/gnuradio-runtime/lib/pmt/generate_unv.py
deleted file mode 100644
index 45c57a3fb8..0000000000
--- a/gnuradio-runtime/lib/pmt/generate_unv.py
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,2009 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 3, 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-"""
-Generate code for uniform numeric vectors
-"""
-from __future__ import unicode_literals
-
-import re, os, os.path
-
-
-unv_types = (
- ('u8', 'uint8_t'),
- ('s8', 'int8_t'),
- ('u16', 'uint16_t'),
- ('s16', 'int16_t'),
- ('u32', 'uint32_t'),
- ('s32', 'int32_t'),
- ('u64', 'uint64_t'),
- ('s64', 'int64_t'),
- ('f32', 'float'),
- ('f64', 'double'),
- ('c32', 'std::complex<float>'),
- ('c64', 'std::complex<double>')
- )
-
-header = """\
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2009 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-"""
-
-guard_tail = """
-#endif
-"""
-
-includes = """
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <vector>
-#include <pmt/pmt.h>
-#include <boost/lexical_cast.hpp>
-#include "pmt_int.h"
-"""
-
-qa_includes = """
-#include <qa_pmt_unv.h>
-#include <cppunit/TestAssert.h>
-#include <pmt/pmt.h>
-#include <stdio.h>
-
-using namespace pmt;
-"""
-
-
-# set srcdir to the directory that contains Makefile.am
-try:
- srcdir = os.environ['srcdir']
-except KeyError as e:
- srcdir = "."
-srcdir = srcdir + '/'
-
-
-def open_src (name, mode):
- global srcdir
- return open(os.path.join (srcdir, name), mode)
-
-
-def guard_name(filename):
- return 'INCLUDED_' + re.sub('\.', '_', filename.upper())
-
-def guard_head(filename):
- guard = guard_name(filename)
- return """
-#ifndef %s
-#define %s
-""" % (guard, guard)
-
-
-def do_substitution (d, input, out_file):
- def repl (match_obj):
- key = match_obj.group (1)
- # print key
- return d[key]
-
- out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, input)
- out_file.write (out)
-
-
-def generate_h():
- template = open_src('unv_template.h.t', 'r').read()
- output_filename = 'pmt_unv_int.h'
- output = open(output_filename, 'w')
- output.write(header)
- output.write(guard_head(output_filename))
- for tag, typ in unv_types:
- d = { 'TAG' : tag, 'TYPE' : typ }
- do_substitution(d, template, output)
- output.write(guard_tail)
-
-def generate_cc():
- template = open_src('unv_template.cc.t', 'r').read()
- output = open('pmt_unv.cc', 'w')
- output.write(header)
- output.write(includes)
- for tag, typ in unv_types:
- d = { 'TAG' : tag, 'TYPE' : typ }
- do_substitution(d, template, output)
-
-
-def generate_qa_h():
- output_filename = 'qa_pmt_unv.h'
- output = open(output_filename, 'w')
- output.write(header)
- output.write(guard_head(output_filename))
-
- output.write('''
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/TestCase.h>
-
-class qa_pmt_unv : public CppUnit::TestCase {
-
- CPPUNIT_TEST_SUITE(qa_pmt_unv);
-''')
- for tag, typ in unv_types:
- output.write(' CPPUNIT_TEST(test_%svector);\n' % (tag,))
- output.write('''\
- CPPUNIT_TEST_SUITE_END();
-
- private:
-''')
- for tag, typ in unv_types:
- output.write(' void test_%svector();\n' % (tag,))
- output.write('};\n')
- output.write(guard_tail)
-
-def generate_qa_cc():
- template = open_src('unv_qa_template.cc.t', 'r').read()
- output = open('qa_pmt_unv.cc', 'w')
- output.write(header)
- output.write(qa_includes)
- for tag, typ in unv_types:
- d = { 'TAG' : tag, 'TYPE' : typ }
- do_substitution(d, template, output)
-
-
-def main():
- generate_h()
- generate_cc()
- generate_qa_h()
- generate_qa_cc()
-
-if __name__ == '__main__':
- main()
diff --git a/gnuradio-runtime/lib/pmt/pmt-serial-tags.scm b/gnuradio-runtime/lib/pmt/pmt-serial-tags.scm
deleted file mode 100644
index 4f06bf75f8..0000000000
--- a/gnuradio-runtime/lib/pmt/pmt-serial-tags.scm
+++ /dev/null
@@ -1,77 +0,0 @@
-;;; -*-scheme-*-
-;;;
-;;; Copyright 2007 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 3, or (define 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 this program; if not, write to the Free Software Foundation, Inc.,
-;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-;;;
-
-;;; definitions of tag values used for marshalling pmt data
-
-(define pst-true #x00)
-(define pst-false #x01)
-(define pst-symbol #x02) ; untagged-int16 n; followed by n bytes of symbol name
-(define pst-int32 #x03)
-(define pst-double #x04)
-(define pst-complex #x05) ; complex<double>: real, imag
-(define pst-null #x06)
-(define pst-pair #x07) ; followed by two objects
-(define pst-vector #x08) ; untagged-int32 n; followed by n objects
-(define pst-dict #x09) ; untagged-int32 n; followed by n key/value tuples
-
-(define pst-uniform-vector #x0a)
-(define pst-uint64 #x0b)
-(define pst-tuple #x0c)
-
-;; u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, c32, c64
-;;
-;; untagged-uint8 tag
-;; untagged-uint8 uvi (define uniform vector info, see below)
-;; untagged-int32 n-items
-;; untagged-uint8 npad
-;; npad bytes of zeros to align binary data
-;; n-items binary numeric items
-;;
-;; uvi:
-;; +-+-+-+-+-+-+-+-+
-;; |B| subtype |
-;; +-+-+-+-+-+-+-+-+
-;;
-;; B == 0, numeric data is little-endian.
-;; B == 1, numeric data is big-endian.
-
- (define uvi-endian-mask #x80)
- (define uvi-subtype-mask #x7f)
-
- (define uvi-little-endian #x00)
- (define uvi-big-endian #x80)
-
- (define uvi-u8 #x00)
- (define uvi-s8 #x01)
- (define uvi-u16 #x02)
- (define uvi-s16 #x03)
- (define uvi-u32 #x04)
- (define uvi-s32 #x05)
- (define uvi-u64 #x06)
- (define uvi-s64 #x07)
- (define uvi-f32 #x08)
- (define uvi-f64 #x09)
- (define uvi-c32 #x0a)
- (define uvi-c64 #x0b)
-
-
-(define pst-comment #x3b) ; ascii ';'
-(define pst-comment-end #x0a) ; ascii '\n'
diff --git a/gnuradio-runtime/lib/pmt/pmt_int.h b/gnuradio-runtime/lib/pmt/pmt_int.h
index f06f507944..ead058598d 100644
--- a/gnuradio-runtime/lib/pmt/pmt_int.h
+++ b/gnuradio-runtime/lib/pmt/pmt_int.h
@@ -242,9 +242,6 @@ public:
virtual size_t itemsize() const = 0;
virtual const std::string string_ref(size_t k) const { return std::string("not implemented"); }
};
-
-#include "pmt_unv_int.h"
-
} /* namespace pmt */
#endif /* INCLUDED_PMT_INT_H */
diff --git a/gnuradio-runtime/lib/pmt/pmt_unv.cc b/gnuradio-runtime/lib/pmt/pmt_unv.cc
new file mode 100644
index 0000000000..cda0c085cd
--- /dev/null
+++ b/gnuradio-runtime/lib/pmt/pmt_unv.cc
@@ -0,0 +1,1821 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// This file is machine generated using the generate_unv.py tool
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pmt_unv_int.h"
+#include "pmt_int.h"
+#include <pmt/pmt.h>
+#include <boost/lexical_cast.hpp>
+#include <vector>
+////////////////////////////////////////////////////////////////////////////
+// pmt_u8vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_u8vector *
+_u8vector(pmt_t x)
+{
+ return dynamic_cast<pmt_u8vector*>(x.get());
+}
+
+
+pmt_u8vector::pmt_u8vector(size_t k, uint8_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_u8vector::pmt_u8vector(size_t k, const uint8_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(uint8_t) );
+}
+
+uint8_t
+pmt_u8vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_u8vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_u8vector::set(size_t k, uint8_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_u8vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const uint8_t *
+pmt_u8vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+uint8_t *
+pmt_u8vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_u8vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(uint8_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_u8vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(uint8_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_u8vector(pmt_t obj)
+{
+ return obj->is_u8vector();
+}
+
+pmt_t
+make_u8vector(size_t k, uint8_t fill)
+{
+ return pmt_t(new pmt_u8vector(k, fill));
+}
+
+pmt_t
+init_u8vector(size_t k, const uint8_t *data)
+{
+ return pmt_t(new pmt_u8vector(k, data));
+}
+
+pmt_t
+init_u8vector(size_t k, const std::vector< uint8_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_u8vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_u8vector(k, static_cast< uint8_t >(0))); // fills an empty vector with 0
+}
+
+uint8_t
+u8vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_u8vector())
+ throw wrong_type("pmt_u8vector_ref", vector);
+ return _u8vector(vector)->ref(k);
+}
+
+void
+u8vector_set(pmt_t vector, size_t k, uint8_t obj)
+{
+ if (!vector->is_u8vector())
+ throw wrong_type("pmt_u8vector_set", vector);
+ _u8vector(vector)->set(k, obj);
+}
+
+const uint8_t *
+u8vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u8vector())
+ throw wrong_type("pmt_u8vector_elements", vector);
+ return _u8vector(vector)->elements(len);
+}
+
+const std::vector< uint8_t >
+u8vector_elements(pmt_t vector)
+{
+ if (!vector->is_u8vector())
+ throw wrong_type("pmt_u8vector_elements", vector);
+ size_t len;
+ const uint8_t *array = _u8vector(vector)->elements(len);
+ const std::vector< uint8_t > vec(array, array+len);
+ return vec;
+}
+
+
+uint8_t *
+u8vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u8vector())
+ throw wrong_type("pmt_u8vector_writable_elements", vector);
+ return _u8vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_u8vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, uint8_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_s8vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_s8vector *
+_s8vector(pmt_t x)
+{
+ return dynamic_cast<pmt_s8vector*>(x.get());
+}
+
+
+pmt_s8vector::pmt_s8vector(size_t k, int8_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_s8vector::pmt_s8vector(size_t k, const int8_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(int8_t) );
+}
+
+int8_t
+pmt_s8vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_s8vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_s8vector::set(size_t k, int8_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_s8vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const int8_t *
+pmt_s8vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+int8_t *
+pmt_s8vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_s8vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(int8_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_s8vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(int8_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_s8vector(pmt_t obj)
+{
+ return obj->is_s8vector();
+}
+
+pmt_t
+make_s8vector(size_t k, int8_t fill)
+{
+ return pmt_t(new pmt_s8vector(k, fill));
+}
+
+pmt_t
+init_s8vector(size_t k, const int8_t *data)
+{
+ return pmt_t(new pmt_s8vector(k, data));
+}
+
+pmt_t
+init_s8vector(size_t k, const std::vector< int8_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_s8vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_s8vector(k, static_cast< int8_t >(0))); // fills an empty vector with 0
+}
+
+int8_t
+s8vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_s8vector())
+ throw wrong_type("pmt_s8vector_ref", vector);
+ return _s8vector(vector)->ref(k);
+}
+
+void
+s8vector_set(pmt_t vector, size_t k, int8_t obj)
+{
+ if (!vector->is_s8vector())
+ throw wrong_type("pmt_s8vector_set", vector);
+ _s8vector(vector)->set(k, obj);
+}
+
+const int8_t *
+s8vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s8vector())
+ throw wrong_type("pmt_s8vector_elements", vector);
+ return _s8vector(vector)->elements(len);
+}
+
+const std::vector< int8_t >
+s8vector_elements(pmt_t vector)
+{
+ if (!vector->is_s8vector())
+ throw wrong_type("pmt_s8vector_elements", vector);
+ size_t len;
+ const int8_t *array = _s8vector(vector)->elements(len);
+ const std::vector< int8_t > vec(array, array+len);
+ return vec;
+}
+
+
+int8_t *
+s8vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s8vector())
+ throw wrong_type("pmt_s8vector_writable_elements", vector);
+ return _s8vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_s8vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, int8_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_u16vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_u16vector *
+_u16vector(pmt_t x)
+{
+ return dynamic_cast<pmt_u16vector*>(x.get());
+}
+
+
+pmt_u16vector::pmt_u16vector(size_t k, uint16_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_u16vector::pmt_u16vector(size_t k, const uint16_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(uint16_t) );
+}
+
+uint16_t
+pmt_u16vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_u16vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_u16vector::set(size_t k, uint16_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_u16vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const uint16_t *
+pmt_u16vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+uint16_t *
+pmt_u16vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_u16vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(uint16_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_u16vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(uint16_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_u16vector(pmt_t obj)
+{
+ return obj->is_u16vector();
+}
+
+pmt_t
+make_u16vector(size_t k, uint16_t fill)
+{
+ return pmt_t(new pmt_u16vector(k, fill));
+}
+
+pmt_t
+init_u16vector(size_t k, const uint16_t *data)
+{
+ return pmt_t(new pmt_u16vector(k, data));
+}
+
+pmt_t
+init_u16vector(size_t k, const std::vector< uint16_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_u16vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_u16vector(k, static_cast< uint16_t >(0))); // fills an empty vector with 0
+}
+
+uint16_t
+u16vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_u16vector())
+ throw wrong_type("pmt_u16vector_ref", vector);
+ return _u16vector(vector)->ref(k);
+}
+
+void
+u16vector_set(pmt_t vector, size_t k, uint16_t obj)
+{
+ if (!vector->is_u16vector())
+ throw wrong_type("pmt_u16vector_set", vector);
+ _u16vector(vector)->set(k, obj);
+}
+
+const uint16_t *
+u16vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u16vector())
+ throw wrong_type("pmt_u16vector_elements", vector);
+ return _u16vector(vector)->elements(len);
+}
+
+const std::vector< uint16_t >
+u16vector_elements(pmt_t vector)
+{
+ if (!vector->is_u16vector())
+ throw wrong_type("pmt_u16vector_elements", vector);
+ size_t len;
+ const uint16_t *array = _u16vector(vector)->elements(len);
+ const std::vector< uint16_t > vec(array, array+len);
+ return vec;
+}
+
+
+uint16_t *
+u16vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u16vector())
+ throw wrong_type("pmt_u16vector_writable_elements", vector);
+ return _u16vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_u16vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, uint16_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_s16vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_s16vector *
+_s16vector(pmt_t x)
+{
+ return dynamic_cast<pmt_s16vector*>(x.get());
+}
+
+
+pmt_s16vector::pmt_s16vector(size_t k, int16_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_s16vector::pmt_s16vector(size_t k, const int16_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(int16_t) );
+}
+
+int16_t
+pmt_s16vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_s16vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_s16vector::set(size_t k, int16_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_s16vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const int16_t *
+pmt_s16vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+int16_t *
+pmt_s16vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_s16vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(int16_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_s16vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(int16_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_s16vector(pmt_t obj)
+{
+ return obj->is_s16vector();
+}
+
+pmt_t
+make_s16vector(size_t k, int16_t fill)
+{
+ return pmt_t(new pmt_s16vector(k, fill));
+}
+
+pmt_t
+init_s16vector(size_t k, const int16_t *data)
+{
+ return pmt_t(new pmt_s16vector(k, data));
+}
+
+pmt_t
+init_s16vector(size_t k, const std::vector< int16_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_s16vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_s16vector(k, static_cast< int16_t >(0))); // fills an empty vector with 0
+}
+
+int16_t
+s16vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_s16vector())
+ throw wrong_type("pmt_s16vector_ref", vector);
+ return _s16vector(vector)->ref(k);
+}
+
+void
+s16vector_set(pmt_t vector, size_t k, int16_t obj)
+{
+ if (!vector->is_s16vector())
+ throw wrong_type("pmt_s16vector_set", vector);
+ _s16vector(vector)->set(k, obj);
+}
+
+const int16_t *
+s16vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s16vector())
+ throw wrong_type("pmt_s16vector_elements", vector);
+ return _s16vector(vector)->elements(len);
+}
+
+const std::vector< int16_t >
+s16vector_elements(pmt_t vector)
+{
+ if (!vector->is_s16vector())
+ throw wrong_type("pmt_s16vector_elements", vector);
+ size_t len;
+ const int16_t *array = _s16vector(vector)->elements(len);
+ const std::vector< int16_t > vec(array, array+len);
+ return vec;
+}
+
+
+int16_t *
+s16vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s16vector())
+ throw wrong_type("pmt_s16vector_writable_elements", vector);
+ return _s16vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_s16vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, int16_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_u32vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_u32vector *
+_u32vector(pmt_t x)
+{
+ return dynamic_cast<pmt_u32vector*>(x.get());
+}
+
+
+pmt_u32vector::pmt_u32vector(size_t k, uint32_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_u32vector::pmt_u32vector(size_t k, const uint32_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(uint32_t) );
+}
+
+uint32_t
+pmt_u32vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_u32vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_u32vector::set(size_t k, uint32_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_u32vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const uint32_t *
+pmt_u32vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+uint32_t *
+pmt_u32vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_u32vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(uint32_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_u32vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(uint32_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_u32vector(pmt_t obj)
+{
+ return obj->is_u32vector();
+}
+
+pmt_t
+make_u32vector(size_t k, uint32_t fill)
+{
+ return pmt_t(new pmt_u32vector(k, fill));
+}
+
+pmt_t
+init_u32vector(size_t k, const uint32_t *data)
+{
+ return pmt_t(new pmt_u32vector(k, data));
+}
+
+pmt_t
+init_u32vector(size_t k, const std::vector< uint32_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_u32vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_u32vector(k, static_cast< uint32_t >(0))); // fills an empty vector with 0
+}
+
+uint32_t
+u32vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_u32vector())
+ throw wrong_type("pmt_u32vector_ref", vector);
+ return _u32vector(vector)->ref(k);
+}
+
+void
+u32vector_set(pmt_t vector, size_t k, uint32_t obj)
+{
+ if (!vector->is_u32vector())
+ throw wrong_type("pmt_u32vector_set", vector);
+ _u32vector(vector)->set(k, obj);
+}
+
+const uint32_t *
+u32vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u32vector())
+ throw wrong_type("pmt_u32vector_elements", vector);
+ return _u32vector(vector)->elements(len);
+}
+
+const std::vector< uint32_t >
+u32vector_elements(pmt_t vector)
+{
+ if (!vector->is_u32vector())
+ throw wrong_type("pmt_u32vector_elements", vector);
+ size_t len;
+ const uint32_t *array = _u32vector(vector)->elements(len);
+ const std::vector< uint32_t > vec(array, array+len);
+ return vec;
+}
+
+
+uint32_t *
+u32vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u32vector())
+ throw wrong_type("pmt_u32vector_writable_elements", vector);
+ return _u32vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_u32vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, uint32_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_s32vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_s32vector *
+_s32vector(pmt_t x)
+{
+ return dynamic_cast<pmt_s32vector*>(x.get());
+}
+
+
+pmt_s32vector::pmt_s32vector(size_t k, int32_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_s32vector::pmt_s32vector(size_t k, const int32_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(int32_t) );
+}
+
+int32_t
+pmt_s32vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_s32vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_s32vector::set(size_t k, int32_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_s32vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const int32_t *
+pmt_s32vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+int32_t *
+pmt_s32vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_s32vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(int32_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_s32vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(int32_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_s32vector(pmt_t obj)
+{
+ return obj->is_s32vector();
+}
+
+pmt_t
+make_s32vector(size_t k, int32_t fill)
+{
+ return pmt_t(new pmt_s32vector(k, fill));
+}
+
+pmt_t
+init_s32vector(size_t k, const int32_t *data)
+{
+ return pmt_t(new pmt_s32vector(k, data));
+}
+
+pmt_t
+init_s32vector(size_t k, const std::vector< int32_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_s32vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_s32vector(k, static_cast< int32_t >(0))); // fills an empty vector with 0
+}
+
+int32_t
+s32vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_s32vector())
+ throw wrong_type("pmt_s32vector_ref", vector);
+ return _s32vector(vector)->ref(k);
+}
+
+void
+s32vector_set(pmt_t vector, size_t k, int32_t obj)
+{
+ if (!vector->is_s32vector())
+ throw wrong_type("pmt_s32vector_set", vector);
+ _s32vector(vector)->set(k, obj);
+}
+
+const int32_t *
+s32vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s32vector())
+ throw wrong_type("pmt_s32vector_elements", vector);
+ return _s32vector(vector)->elements(len);
+}
+
+const std::vector< int32_t >
+s32vector_elements(pmt_t vector)
+{
+ if (!vector->is_s32vector())
+ throw wrong_type("pmt_s32vector_elements", vector);
+ size_t len;
+ const int32_t *array = _s32vector(vector)->elements(len);
+ const std::vector< int32_t > vec(array, array+len);
+ return vec;
+}
+
+
+int32_t *
+s32vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s32vector())
+ throw wrong_type("pmt_s32vector_writable_elements", vector);
+ return _s32vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_s32vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, int32_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_u64vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_u64vector *
+_u64vector(pmt_t x)
+{
+ return dynamic_cast<pmt_u64vector*>(x.get());
+}
+
+
+pmt_u64vector::pmt_u64vector(size_t k, uint64_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_u64vector::pmt_u64vector(size_t k, const uint64_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(uint64_t) );
+}
+
+uint64_t
+pmt_u64vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_u64vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_u64vector::set(size_t k, uint64_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_u64vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const uint64_t *
+pmt_u64vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+uint64_t *
+pmt_u64vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_u64vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(uint64_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_u64vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(uint64_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_u64vector(pmt_t obj)
+{
+ return obj->is_u64vector();
+}
+
+pmt_t
+make_u64vector(size_t k, uint64_t fill)
+{
+ return pmt_t(new pmt_u64vector(k, fill));
+}
+
+pmt_t
+init_u64vector(size_t k, const uint64_t *data)
+{
+ return pmt_t(new pmt_u64vector(k, data));
+}
+
+pmt_t
+init_u64vector(size_t k, const std::vector< uint64_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_u64vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_u64vector(k, static_cast< uint64_t >(0))); // fills an empty vector with 0
+}
+
+uint64_t
+u64vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_u64vector())
+ throw wrong_type("pmt_u64vector_ref", vector);
+ return _u64vector(vector)->ref(k);
+}
+
+void
+u64vector_set(pmt_t vector, size_t k, uint64_t obj)
+{
+ if (!vector->is_u64vector())
+ throw wrong_type("pmt_u64vector_set", vector);
+ _u64vector(vector)->set(k, obj);
+}
+
+const uint64_t *
+u64vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u64vector())
+ throw wrong_type("pmt_u64vector_elements", vector);
+ return _u64vector(vector)->elements(len);
+}
+
+const std::vector< uint64_t >
+u64vector_elements(pmt_t vector)
+{
+ if (!vector->is_u64vector())
+ throw wrong_type("pmt_u64vector_elements", vector);
+ size_t len;
+ const uint64_t *array = _u64vector(vector)->elements(len);
+ const std::vector< uint64_t > vec(array, array+len);
+ return vec;
+}
+
+
+uint64_t *
+u64vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_u64vector())
+ throw wrong_type("pmt_u64vector_writable_elements", vector);
+ return _u64vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_u64vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, uint64_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_s64vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_s64vector *
+_s64vector(pmt_t x)
+{
+ return dynamic_cast<pmt_s64vector*>(x.get());
+}
+
+
+pmt_s64vector::pmt_s64vector(size_t k, int64_t fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_s64vector::pmt_s64vector(size_t k, const int64_t *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(int64_t) );
+}
+
+int64_t
+pmt_s64vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_s64vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_s64vector::set(size_t k, int64_t x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_s64vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const int64_t *
+pmt_s64vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+int64_t *
+pmt_s64vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_s64vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(int64_t);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_s64vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(int64_t);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_s64vector(pmt_t obj)
+{
+ return obj->is_s64vector();
+}
+
+pmt_t
+make_s64vector(size_t k, int64_t fill)
+{
+ return pmt_t(new pmt_s64vector(k, fill));
+}
+
+pmt_t
+init_s64vector(size_t k, const int64_t *data)
+{
+ return pmt_t(new pmt_s64vector(k, data));
+}
+
+pmt_t
+init_s64vector(size_t k, const std::vector< int64_t > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_s64vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_s64vector(k, static_cast< int64_t >(0))); // fills an empty vector with 0
+}
+
+int64_t
+s64vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_s64vector())
+ throw wrong_type("pmt_s64vector_ref", vector);
+ return _s64vector(vector)->ref(k);
+}
+
+void
+s64vector_set(pmt_t vector, size_t k, int64_t obj)
+{
+ if (!vector->is_s64vector())
+ throw wrong_type("pmt_s64vector_set", vector);
+ _s64vector(vector)->set(k, obj);
+}
+
+const int64_t *
+s64vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s64vector())
+ throw wrong_type("pmt_s64vector_elements", vector);
+ return _s64vector(vector)->elements(len);
+}
+
+const std::vector< int64_t >
+s64vector_elements(pmt_t vector)
+{
+ if (!vector->is_s64vector())
+ throw wrong_type("pmt_s64vector_elements", vector);
+ size_t len;
+ const int64_t *array = _s64vector(vector)->elements(len);
+ const std::vector< int64_t > vec(array, array+len);
+ return vec;
+}
+
+
+int64_t *
+s64vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_s64vector())
+ throw wrong_type("pmt_s64vector_writable_elements", vector);
+ return _s64vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_s64vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, int64_t > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_f32vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_f32vector *
+_f32vector(pmt_t x)
+{
+ return dynamic_cast<pmt_f32vector*>(x.get());
+}
+
+
+pmt_f32vector::pmt_f32vector(size_t k, float fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_f32vector::pmt_f32vector(size_t k, const float *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(float) );
+}
+
+float
+pmt_f32vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_f32vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_f32vector::set(size_t k, float x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_f32vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const float *
+pmt_f32vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+float *
+pmt_f32vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_f32vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(float);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_f32vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(float);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_f32vector(pmt_t obj)
+{
+ return obj->is_f32vector();
+}
+
+pmt_t
+make_f32vector(size_t k, float fill)
+{
+ return pmt_t(new pmt_f32vector(k, fill));
+}
+
+pmt_t
+init_f32vector(size_t k, const float *data)
+{
+ return pmt_t(new pmt_f32vector(k, data));
+}
+
+pmt_t
+init_f32vector(size_t k, const std::vector< float > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_f32vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_f32vector(k, static_cast< float >(0))); // fills an empty vector with 0
+}
+
+float
+f32vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_f32vector())
+ throw wrong_type("pmt_f32vector_ref", vector);
+ return _f32vector(vector)->ref(k);
+}
+
+void
+f32vector_set(pmt_t vector, size_t k, float obj)
+{
+ if (!vector->is_f32vector())
+ throw wrong_type("pmt_f32vector_set", vector);
+ _f32vector(vector)->set(k, obj);
+}
+
+const float *
+f32vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_f32vector())
+ throw wrong_type("pmt_f32vector_elements", vector);
+ return _f32vector(vector)->elements(len);
+}
+
+const std::vector< float >
+f32vector_elements(pmt_t vector)
+{
+ if (!vector->is_f32vector())
+ throw wrong_type("pmt_f32vector_elements", vector);
+ size_t len;
+ const float *array = _f32vector(vector)->elements(len);
+ const std::vector< float > vec(array, array+len);
+ return vec;
+}
+
+
+float *
+f32vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_f32vector())
+ throw wrong_type("pmt_f32vector_writable_elements", vector);
+ return _f32vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_f32vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, float > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_f64vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_f64vector *
+_f64vector(pmt_t x)
+{
+ return dynamic_cast<pmt_f64vector*>(x.get());
+}
+
+
+pmt_f64vector::pmt_f64vector(size_t k, double fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_f64vector::pmt_f64vector(size_t k, const double *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(double) );
+}
+
+double
+pmt_f64vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_f64vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_f64vector::set(size_t k, double x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_f64vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const double *
+pmt_f64vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+double *
+pmt_f64vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_f64vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(double);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_f64vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(double);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_f64vector(pmt_t obj)
+{
+ return obj->is_f64vector();
+}
+
+pmt_t
+make_f64vector(size_t k, double fill)
+{
+ return pmt_t(new pmt_f64vector(k, fill));
+}
+
+pmt_t
+init_f64vector(size_t k, const double *data)
+{
+ return pmt_t(new pmt_f64vector(k, data));
+}
+
+pmt_t
+init_f64vector(size_t k, const std::vector< double > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_f64vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_f64vector(k, static_cast< double >(0))); // fills an empty vector with 0
+}
+
+double
+f64vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_f64vector())
+ throw wrong_type("pmt_f64vector_ref", vector);
+ return _f64vector(vector)->ref(k);
+}
+
+void
+f64vector_set(pmt_t vector, size_t k, double obj)
+{
+ if (!vector->is_f64vector())
+ throw wrong_type("pmt_f64vector_set", vector);
+ _f64vector(vector)->set(k, obj);
+}
+
+const double *
+f64vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_f64vector())
+ throw wrong_type("pmt_f64vector_elements", vector);
+ return _f64vector(vector)->elements(len);
+}
+
+const std::vector< double >
+f64vector_elements(pmt_t vector)
+{
+ if (!vector->is_f64vector())
+ throw wrong_type("pmt_f64vector_elements", vector);
+ size_t len;
+ const double *array = _f64vector(vector)->elements(len);
+ const std::vector< double > vec(array, array+len);
+ return vec;
+}
+
+
+double *
+f64vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_f64vector())
+ throw wrong_type("pmt_f64vector_writable_elements", vector);
+ return _f64vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_f64vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, double > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_c32vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_c32vector *
+_c32vector(pmt_t x)
+{
+ return dynamic_cast<pmt_c32vector*>(x.get());
+}
+
+
+pmt_c32vector::pmt_c32vector(size_t k, std::complex<float> fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_c32vector::pmt_c32vector(size_t k, const std::complex<float> *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(std::complex<float>) );
+}
+
+std::complex<float>
+pmt_c32vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_c32vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_c32vector::set(size_t k, std::complex<float> x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_c32vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const std::complex<float> *
+pmt_c32vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+std::complex<float> *
+pmt_c32vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_c32vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(std::complex<float>);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_c32vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(std::complex<float>);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_c32vector(pmt_t obj)
+{
+ return obj->is_c32vector();
+}
+
+pmt_t
+make_c32vector(size_t k, std::complex<float> fill)
+{
+ return pmt_t(new pmt_c32vector(k, fill));
+}
+
+pmt_t
+init_c32vector(size_t k, const std::complex<float> *data)
+{
+ return pmt_t(new pmt_c32vector(k, data));
+}
+
+pmt_t
+init_c32vector(size_t k, const std::vector< std::complex<float> > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_c32vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_c32vector(k, static_cast< std::complex<float> >(0))); // fills an empty vector with 0
+}
+
+std::complex<float>
+c32vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_c32vector())
+ throw wrong_type("pmt_c32vector_ref", vector);
+ return _c32vector(vector)->ref(k);
+}
+
+void
+c32vector_set(pmt_t vector, size_t k, std::complex<float> obj)
+{
+ if (!vector->is_c32vector())
+ throw wrong_type("pmt_c32vector_set", vector);
+ _c32vector(vector)->set(k, obj);
+}
+
+const std::complex<float> *
+c32vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_c32vector())
+ throw wrong_type("pmt_c32vector_elements", vector);
+ return _c32vector(vector)->elements(len);
+}
+
+const std::vector< std::complex<float> >
+c32vector_elements(pmt_t vector)
+{
+ if (!vector->is_c32vector())
+ throw wrong_type("pmt_c32vector_elements", vector);
+ size_t len;
+ const std::complex<float> *array = _c32vector(vector)->elements(len);
+ const std::vector< std::complex<float> > vec(array, array+len);
+ return vec;
+}
+
+
+std::complex<float> *
+c32vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_c32vector())
+ throw wrong_type("pmt_c32vector_writable_elements", vector);
+ return _c32vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_c32vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, std::complex<float> > (ref(k));
+}
+
+} /* namespace pmt */
+////////////////////////////////////////////////////////////////////////////
+// pmt_c64vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_c64vector *
+_c64vector(pmt_t x)
+{
+ return dynamic_cast<pmt_c64vector*>(x.get());
+}
+
+
+pmt_c64vector::pmt_c64vector(size_t k, std::complex<double> fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_c64vector::pmt_c64vector(size_t k, const std::complex<double> *data)
+ : d_v(k)
+{
+ if(k)
+ memcpy( &d_v[0], data, k * sizeof(std::complex<double>) );
+}
+
+std::complex<double>
+pmt_c64vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw out_of_range("pmt_c64vector_ref", from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_c64vector::set(size_t k, std::complex<double> x)
+{
+ if (k >= length())
+ throw out_of_range("pmt_c64vector_set", from_long(k));
+ d_v[k] = x;
+}
+
+const std::complex<double> *
+pmt_c64vector::elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+std::complex<double> *
+pmt_c64vector::writable_elements(size_t &len)
+{
+ len = length();
+ return len ? &d_v[0] : nullptr;
+}
+
+const void*
+pmt_c64vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(std::complex<double>);
+ return len ? &d_v[0] : nullptr;
+}
+
+void*
+pmt_c64vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(std::complex<double>);
+ return len ? (&d_v[0]) : nullptr;
+}
+
+bool
+is_c64vector(pmt_t obj)
+{
+ return obj->is_c64vector();
+}
+
+pmt_t
+make_c64vector(size_t k, std::complex<double> fill)
+{
+ return pmt_t(new pmt_c64vector(k, fill));
+}
+
+pmt_t
+init_c64vector(size_t k, const std::complex<double> *data)
+{
+ return pmt_t(new pmt_c64vector(k, data));
+}
+
+pmt_t
+init_c64vector(size_t k, const std::vector< std::complex<double> > &data)
+{
+ if(k) {
+ return pmt_t(new pmt_c64vector(k, &data[0]));
+ }
+ return pmt_t(new pmt_c64vector(k, static_cast< std::complex<double> >(0))); // fills an empty vector with 0
+}
+
+std::complex<double>
+c64vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_c64vector())
+ throw wrong_type("pmt_c64vector_ref", vector);
+ return _c64vector(vector)->ref(k);
+}
+
+void
+c64vector_set(pmt_t vector, size_t k, std::complex<double> obj)
+{
+ if (!vector->is_c64vector())
+ throw wrong_type("pmt_c64vector_set", vector);
+ _c64vector(vector)->set(k, obj);
+}
+
+const std::complex<double> *
+c64vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_c64vector())
+ throw wrong_type("pmt_c64vector_elements", vector);
+ return _c64vector(vector)->elements(len);
+}
+
+const std::vector< std::complex<double> >
+c64vector_elements(pmt_t vector)
+{
+ if (!vector->is_c64vector())
+ throw wrong_type("pmt_c64vector_elements", vector);
+ size_t len;
+ const std::complex<double> *array = _c64vector(vector)->elements(len);
+ const std::vector< std::complex<double> > vec(array, array+len);
+ return vec;
+}
+
+
+std::complex<double> *
+c64vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_c64vector())
+ throw wrong_type("pmt_c64vector_writable_elements", vector);
+ return _c64vector(vector)->writable_elements(len);
+}
+
+const std::string
+pmt_c64vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, std::complex<double> > (ref(k));
+}
+
+} /* namespace pmt */
diff --git a/gnuradio-runtime/lib/pmt/pmt_unv_int.h b/gnuradio-runtime/lib/pmt/pmt_unv_int.h
new file mode 100644
index 0000000000..4b4364b411
--- /dev/null
+++ b/gnuradio-runtime/lib/pmt/pmt_unv_int.h
@@ -0,0 +1,331 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_PMT_UNV_INT_H
+#define INCLUDED_PMT_UNV_INT_H
+
+#include "pmt_int.h"
+
+#include <vector>
+#include <cstdint>
+
+namespace pmt{
+////////////////////////////////////////////////////////////////////////////
+// pmt_u8vector
+////////////////////////////////////////////////////////////////////////////
+class PMT_API pmt_u8vector : public pmt_uniform_vector
+{
+ std::vector< uint8_t > d_v;
+
+public:
+ pmt_u8vector(size_t k, uint8_t fill);
+ pmt_u8vector(size_t k, const uint8_t *data);
+ // ~pmt_u8vector();
+
+ bool is_u8vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(uint8_t); }
+ uint8_t ref(size_t k) const;
+ void set(size_t k, uint8_t x);
+ const uint8_t *elements(size_t &len);
+ uint8_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_s8vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_s8vector : public pmt_uniform_vector
+{
+ std::vector< int8_t > d_v;
+
+public:
+ pmt_s8vector(size_t k, int8_t fill);
+ pmt_s8vector(size_t k, const int8_t *data);
+ // ~pmt_s8vector();
+
+ bool is_s8vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(int8_t); }
+ int8_t ref(size_t k) const;
+ void set(size_t k, int8_t x);
+ const int8_t *elements(size_t &len);
+ int8_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_u16vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_u16vector : public pmt_uniform_vector
+{
+ std::vector< uint16_t > d_v;
+
+public:
+ pmt_u16vector(size_t k, uint16_t fill);
+ pmt_u16vector(size_t k, const uint16_t *data);
+ // ~pmt_u16vector();
+
+ bool is_u16vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(uint16_t); }
+ uint16_t ref(size_t k) const;
+ void set(size_t k, uint16_t x);
+ const uint16_t *elements(size_t &len);
+ uint16_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_s16vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_s16vector : public pmt_uniform_vector
+{
+ std::vector< int16_t > d_v;
+
+public:
+ pmt_s16vector(size_t k, int16_t fill);
+ pmt_s16vector(size_t k, const int16_t *data);
+ // ~pmt_s16vector();
+
+ bool is_s16vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(int16_t); }
+ int16_t ref(size_t k) const;
+ void set(size_t k, int16_t x);
+ const int16_t *elements(size_t &len);
+ int16_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_u32vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_u32vector : public pmt_uniform_vector
+{
+ std::vector< uint32_t > d_v;
+
+public:
+ pmt_u32vector(size_t k, uint32_t fill);
+ pmt_u32vector(size_t k, const uint32_t *data);
+ // ~pmt_u32vector();
+
+ bool is_u32vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(uint32_t); }
+ uint32_t ref(size_t k) const;
+ void set(size_t k, uint32_t x);
+ const uint32_t *elements(size_t &len);
+ uint32_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_s32vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_s32vector : public pmt_uniform_vector
+{
+ std::vector< int32_t > d_v;
+
+public:
+ pmt_s32vector(size_t k, int32_t fill);
+ pmt_s32vector(size_t k, const int32_t *data);
+ // ~pmt_s32vector();
+
+ bool is_s32vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(int32_t); }
+ int32_t ref(size_t k) const;
+ void set(size_t k, int32_t x);
+ const int32_t *elements(size_t &len);
+ int32_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_u64vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_u64vector : public pmt_uniform_vector
+{
+ std::vector< uint64_t > d_v;
+
+public:
+ pmt_u64vector(size_t k, uint64_t fill);
+ pmt_u64vector(size_t k, const uint64_t *data);
+ // ~pmt_u64vector();
+
+ bool is_u64vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(uint64_t); }
+ uint64_t ref(size_t k) const;
+ void set(size_t k, uint64_t x);
+ const uint64_t *elements(size_t &len);
+ uint64_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_s64vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_s64vector : public pmt_uniform_vector
+{
+ std::vector< int64_t > d_v;
+
+public:
+ pmt_s64vector(size_t k, int64_t fill);
+ pmt_s64vector(size_t k, const int64_t *data);
+ // ~pmt_s64vector();
+
+ bool is_s64vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(int64_t); }
+ int64_t ref(size_t k) const;
+ void set(size_t k, int64_t x);
+ const int64_t *elements(size_t &len);
+ int64_t *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_f32vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_f32vector : public pmt_uniform_vector
+{
+ std::vector< float > d_v;
+
+public:
+ pmt_f32vector(size_t k, float fill);
+ pmt_f32vector(size_t k, const float *data);
+ // ~pmt_f32vector();
+
+ bool is_f32vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(float); }
+ float ref(size_t k) const;
+ void set(size_t k, float x);
+ const float *elements(size_t &len);
+ float *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_f64vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_f64vector : public pmt_uniform_vector
+{
+ std::vector< double > d_v;
+
+public:
+ pmt_f64vector(size_t k, double fill);
+ pmt_f64vector(size_t k, const double *data);
+ // ~pmt_f64vector();
+
+ bool is_f64vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(double); }
+ double ref(size_t k) const;
+ void set(size_t k, double x);
+ const double *elements(size_t &len);
+ double *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_c32vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_c32vector : public pmt_uniform_vector
+{
+ std::vector< std::complex<float> > d_v;
+
+public:
+ pmt_c32vector(size_t k, std::complex<float> fill);
+ pmt_c32vector(size_t k, const std::complex<float> *data);
+ // ~pmt_c32vector();
+
+ bool is_c32vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(std::complex<float>); }
+ std::complex<float> ref(size_t k) const;
+ void set(size_t k, std::complex<float> x);
+ const std::complex<float> *elements(size_t &len);
+ std::complex<float> *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_c64vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_c64vector : public pmt_uniform_vector
+{
+ std::vector< std::complex<double> > d_v;
+
+public:
+ pmt_c64vector(size_t k, std::complex<double> fill);
+ pmt_c64vector(size_t k, const std::complex<double> *data);
+ // ~pmt_c64vector();
+
+ bool is_c64vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ size_t itemsize() const { return sizeof(std::complex<double>); }
+ std::complex<double> ref(size_t k) const;
+ void set(size_t k, std::complex<double> x);
+ const std::complex<double> *elements(size_t &len);
+ std::complex<double> *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
+};
+} /* namespace pmt */
+#endif
diff --git a/gnuradio-runtime/lib/pmt/qa_pmt_unv.cc b/gnuradio-runtime/lib/pmt/qa_pmt_unv.cc
new file mode 100644
index 0000000000..9751f5e610
--- /dev/null
+++ b/gnuradio-runtime/lib/pmt/qa_pmt_unv.cc
@@ -0,0 +1,448 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qa_pmt_unv.h>
+#include <cppunit/TestAssert.h>
+#include <pmt/pmt.h>
+#include <stdio.h>
+
+using namespace pmt;
+void
+qa_pmt_unv::test_u8vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_u8vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ uint8_t s0 = uint8_t(10);
+ uint8_t s1 = uint8_t(20);
+ uint8_t s2 = uint8_t(30);
+
+ pmt::u8vector_set(v1, 0, s0);
+ pmt::u8vector_set(v1, 1, s1);
+ pmt::u8vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::u8vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::u8vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::u8vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::u8vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::u8vector_set(v1, N, uint8_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const uint8_t *rd = pmt::u8vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ uint8_t *wr = pmt::u8vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = uint8_t(0);
+ CPPUNIT_ASSERT_EQUAL(uint8_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_s8vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_s8vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ int8_t s0 = int8_t(10);
+ int8_t s1 = int8_t(20);
+ int8_t s2 = int8_t(30);
+
+ pmt::s8vector_set(v1, 0, s0);
+ pmt::s8vector_set(v1, 1, s1);
+ pmt::s8vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::s8vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::s8vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::s8vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::s8vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::s8vector_set(v1, N, int8_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const int8_t *rd = pmt::s8vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ int8_t *wr = pmt::s8vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = int8_t(0);
+ CPPUNIT_ASSERT_EQUAL(int8_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_u16vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_u16vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ uint16_t s0 = uint16_t(10);
+ uint16_t s1 = uint16_t(20);
+ uint16_t s2 = uint16_t(30);
+
+ pmt::u16vector_set(v1, 0, s0);
+ pmt::u16vector_set(v1, 1, s1);
+ pmt::u16vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::u16vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::u16vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::u16vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::u16vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::u16vector_set(v1, N, uint16_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const uint16_t *rd = pmt::u16vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ uint16_t *wr = pmt::u16vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = uint16_t(0);
+ CPPUNIT_ASSERT_EQUAL(uint16_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_s16vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_s16vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ int16_t s0 = int16_t(10);
+ int16_t s1 = int16_t(20);
+ int16_t s2 = int16_t(30);
+
+ pmt::s16vector_set(v1, 0, s0);
+ pmt::s16vector_set(v1, 1, s1);
+ pmt::s16vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::s16vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::s16vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::s16vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::s16vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::s16vector_set(v1, N, int16_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const int16_t *rd = pmt::s16vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ int16_t *wr = pmt::s16vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = int16_t(0);
+ CPPUNIT_ASSERT_EQUAL(int16_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_u32vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_u32vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ uint32_t s0 = uint32_t(10);
+ uint32_t s1 = uint32_t(20);
+ uint32_t s2 = uint32_t(30);
+
+ pmt::u32vector_set(v1, 0, s0);
+ pmt::u32vector_set(v1, 1, s1);
+ pmt::u32vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::u32vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::u32vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::u32vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::u32vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::u32vector_set(v1, N, uint32_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const uint32_t *rd = pmt::u32vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ uint32_t *wr = pmt::u32vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = uint32_t(0);
+ CPPUNIT_ASSERT_EQUAL(uint32_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_s32vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_s32vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ int32_t s0 = int32_t(10);
+ int32_t s1 = int32_t(20);
+ int32_t s2 = int32_t(30);
+
+ pmt::s32vector_set(v1, 0, s0);
+ pmt::s32vector_set(v1, 1, s1);
+ pmt::s32vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::s32vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::s32vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::s32vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::s32vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::s32vector_set(v1, N, int32_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const int32_t *rd = pmt::s32vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ int32_t *wr = pmt::s32vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = int32_t(0);
+ CPPUNIT_ASSERT_EQUAL(int32_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_u64vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_u64vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ uint64_t s0 = uint64_t(10);
+ uint64_t s1 = uint64_t(20);
+ uint64_t s2 = uint64_t(30);
+
+ pmt::u64vector_set(v1, 0, s0);
+ pmt::u64vector_set(v1, 1, s1);
+ pmt::u64vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::u64vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::u64vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::u64vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::u64vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::u64vector_set(v1, N, uint64_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const uint64_t *rd = pmt::u64vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ uint64_t *wr = pmt::u64vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = uint64_t(0);
+ CPPUNIT_ASSERT_EQUAL(uint64_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_s64vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_s64vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ int64_t s0 = int64_t(10);
+ int64_t s1 = int64_t(20);
+ int64_t s2 = int64_t(30);
+
+ pmt::s64vector_set(v1, 0, s0);
+ pmt::s64vector_set(v1, 1, s1);
+ pmt::s64vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::s64vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::s64vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::s64vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::s64vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::s64vector_set(v1, N, int64_t(0)), pmt::out_of_range);
+
+ size_t len;
+ const int64_t *rd = pmt::s64vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ int64_t *wr = pmt::s64vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = int64_t(0);
+ CPPUNIT_ASSERT_EQUAL(int64_t(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_f32vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_f32vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ float s0 = float(10);
+ float s1 = float(20);
+ float s2 = float(30);
+
+ pmt::f32vector_set(v1, 0, s0);
+ pmt::f32vector_set(v1, 1, s1);
+ pmt::f32vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::f32vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::f32vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::f32vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::f32vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::f32vector_set(v1, N, float(0)), pmt::out_of_range);
+
+ size_t len;
+ const float *rd = pmt::f32vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ float *wr = pmt::f32vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = float(0);
+ CPPUNIT_ASSERT_EQUAL(float(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_f64vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_f64vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ double s0 = double(10);
+ double s1 = double(20);
+ double s2 = double(30);
+
+ pmt::f64vector_set(v1, 0, s0);
+ pmt::f64vector_set(v1, 1, s1);
+ pmt::f64vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::f64vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::f64vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::f64vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::f64vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::f64vector_set(v1, N, double(0)), pmt::out_of_range);
+
+ size_t len;
+ const double *rd = pmt::f64vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ double *wr = pmt::f64vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = double(0);
+ CPPUNIT_ASSERT_EQUAL(double(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_c32vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_c32vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ std::complex<float> s0 = std::complex<float>(10);
+ std::complex<float> s1 = std::complex<float>(20);
+ std::complex<float> s2 = std::complex<float>(30);
+
+ pmt::c32vector_set(v1, 0, s0);
+ pmt::c32vector_set(v1, 1, s1);
+ pmt::c32vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::c32vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::c32vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::c32vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::c32vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::c32vector_set(v1, N, std::complex<float>(0)), pmt::out_of_range);
+
+ size_t len;
+ const std::complex<float> *rd = pmt::c32vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ std::complex<float> *wr = pmt::c32vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = std::complex<float>(0);
+ CPPUNIT_ASSERT_EQUAL(std::complex<float>(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
+void
+qa_pmt_unv::test_c64vector()
+{
+ static const size_t N = 3;
+ pmt::pmt_t v1 = pmt::make_c64vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
+ std::complex<double> s0 = std::complex<double>(10);
+ std::complex<double> s1 = std::complex<double>(20);
+ std::complex<double> s2 = std::complex<double>(30);
+
+ pmt::c64vector_set(v1, 0, s0);
+ pmt::c64vector_set(v1, 1, s1);
+ pmt::c64vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt::c64vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt::c64vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt::c64vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt::c64vector_ref(v1, N), pmt::out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt::c64vector_set(v1, N, std::complex<double>(0)), pmt::out_of_range);
+
+ size_t len;
+ const std::complex<double> *rd = pmt::c64vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ std::complex<double> *wr = pmt::c64vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = std::complex<double>(0);
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
diff --git a/gnuradio-runtime/lib/pmt/qa_pmt_unv.h b/gnuradio-runtime/lib/pmt/qa_pmt_unv.h
new file mode 100644
index 0000000000..71462a9212
--- /dev/null
+++ b/gnuradio-runtime/lib/pmt/qa_pmt_unv.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QA_PMT_UNV_H
+#define INCLUDED_QA_PMT_UNV_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_pmt_unv : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_pmt_unv);
+ CPPUNIT_TEST(test_u8vector);
+ CPPUNIT_TEST(test_s8vector);
+ CPPUNIT_TEST(test_u16vector);
+ CPPUNIT_TEST(test_s16vector);
+ CPPUNIT_TEST(test_u32vector);
+ CPPUNIT_TEST(test_s32vector);
+ CPPUNIT_TEST(test_u64vector);
+ CPPUNIT_TEST(test_s64vector);
+ CPPUNIT_TEST(test_f32vector);
+ CPPUNIT_TEST(test_f64vector);
+ CPPUNIT_TEST(test_c32vector);
+ CPPUNIT_TEST(test_c64vector);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_u8vector();
+ void test_s8vector();
+ void test_u16vector();
+ void test_s16vector();
+ void test_u32vector();
+ void test_s32vector();
+ void test_u64vector();
+ void test_s64vector();
+ void test_f32vector();
+ void test_f64vector();
+ void test_c32vector();
+ void test_c64vector();
+};
+
+#endif
diff --git a/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t b/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t
deleted file mode 100644
index ea675cee16..0000000000
--- a/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t
+++ /dev/null
@@ -1,35 +0,0 @@
-void
-qa_pmt_unv::test_@TAG@vector()
-{
- static const size_t N = 3;
- pmt::pmt_t v1 = pmt::make_@TAG@vector(N, 0);
- CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1));
- @TYPE@ s0 = @TYPE@(10);
- @TYPE@ s1 = @TYPE@(20);
- @TYPE@ s2 = @TYPE@(30);
-
- pmt::@TAG@vector_set(v1, 0, s0);
- pmt::@TAG@vector_set(v1, 1, s1);
- pmt::@TAG@vector_set(v1, 2, s2);
-
- CPPUNIT_ASSERT_EQUAL(s0, pmt::@TAG@vector_ref(v1, 0));
- CPPUNIT_ASSERT_EQUAL(s1, pmt::@TAG@vector_ref(v1, 1));
- CPPUNIT_ASSERT_EQUAL(s2, pmt::@TAG@vector_ref(v1, 2));
-
- CPPUNIT_ASSERT_THROW(pmt::@TAG@vector_ref(v1, N), pmt::out_of_range);
- CPPUNIT_ASSERT_THROW(pmt::@TAG@vector_set(v1, N, @TYPE@(0)), pmt::out_of_range);
-
- size_t len;
- const @TYPE@ *rd = pmt::@TAG@vector_elements(v1, len);
- CPPUNIT_ASSERT_EQUAL(len, N);
- CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
- CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
- CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
-
- @TYPE@ *wr = pmt::@TAG@vector_writable_elements(v1, len);
- CPPUNIT_ASSERT_EQUAL(len, N);
- wr[0] = @TYPE@(0);
- CPPUNIT_ASSERT_EQUAL(@TYPE@(0), wr[0]);
- CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
- CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
-}
diff --git a/gnuradio-runtime/lib/pmt/unv_template.cc.t b/gnuradio-runtime/lib/pmt/unv_template.cc.t
deleted file mode 100644
index b6c9d05c1d..0000000000
--- a/gnuradio-runtime/lib/pmt/unv_template.cc.t
+++ /dev/null
@@ -1,149 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-// pmt_@TAG@vector
-////////////////////////////////////////////////////////////////////////////
-
-namespace pmt {
-
-static pmt_@TAG@vector *
-_@TAG@vector(pmt_t x)
-{
- return dynamic_cast<pmt_@TAG@vector*>(x.get());
-}
-
-
-pmt_@TAG@vector::pmt_@TAG@vector(size_t k, @TYPE@ fill)
- : d_v(k)
-{
- for (size_t i = 0; i < k; i++)
- d_v[i] = fill;
-}
-
-pmt_@TAG@vector::pmt_@TAG@vector(size_t k, const @TYPE@ *data)
- : d_v(k)
-{
- if(k)
- memcpy( &d_v[0], data, k * sizeof(@TYPE@) );
-}
-
-@TYPE@
-pmt_@TAG@vector::ref(size_t k) const
-{
- if (k >= length())
- throw out_of_range("pmt_@TAG@vector_ref", from_long(k));
- return d_v[k];
-}
-
-void
-pmt_@TAG@vector::set(size_t k, @TYPE@ x)
-{
- if (k >= length())
- throw out_of_range("pmt_@TAG@vector_set", from_long(k));
- d_v[k] = x;
-}
-
-const @TYPE@ *
-pmt_@TAG@vector::elements(size_t &len)
-{
- len = length();
- return len ? &d_v[0] : nullptr;
-}
-
-@TYPE@ *
-pmt_@TAG@vector::writable_elements(size_t &len)
-{
- len = length();
- return len ? &d_v[0] : nullptr;
-}
-
-const void*
-pmt_@TAG@vector::uniform_elements(size_t &len)
-{
- len = length() * sizeof(@TYPE@);
- return len ? &d_v[0] : nullptr;
-}
-
-void*
-pmt_@TAG@vector::uniform_writable_elements(size_t &len)
-{
- len = length() * sizeof(@TYPE@);
- return len ? (&d_v[0]) : nullptr;
-}
-
-bool
-is_@TAG@vector(pmt_t obj)
-{
- return obj->is_@TAG@vector();
-}
-
-pmt_t
-make_@TAG@vector(size_t k, @TYPE@ fill)
-{
- return pmt_t(new pmt_@TAG@vector(k, fill));
-}
-
-pmt_t
-init_@TAG@vector(size_t k, const @TYPE@ *data)
-{
- return pmt_t(new pmt_@TAG@vector(k, data));
-}
-
-pmt_t
-init_@TAG@vector(size_t k, const std::vector< @TYPE@ > &data)
-{
- if(k) {
- return pmt_t(new pmt_@TAG@vector(k, &data[0]));
- }
- return pmt_t(new pmt_@TAG@vector(k, static_cast< @TYPE@ >(0))); // fills an empty vector with 0
-}
-
-@TYPE@
-@TAG@vector_ref(pmt_t vector, size_t k)
-{
- if (!vector->is_@TAG@vector())
- throw wrong_type("pmt_@TAG@vector_ref", vector);
- return _@TAG@vector(vector)->ref(k);
-}
-
-void
-@TAG@vector_set(pmt_t vector, size_t k, @TYPE@ obj)
-{
- if (!vector->is_@TAG@vector())
- throw wrong_type("pmt_@TAG@vector_set", vector);
- _@TAG@vector(vector)->set(k, obj);
-}
-
-const @TYPE@ *
-@TAG@vector_elements(pmt_t vector, size_t &len)
-{
- if (!vector->is_@TAG@vector())
- throw wrong_type("pmt_@TAG@vector_elements", vector);
- return _@TAG@vector(vector)->elements(len);
-}
-
-const std::vector< @TYPE@ >
-@TAG@vector_elements(pmt_t vector)
-{
- if (!vector->is_@TAG@vector())
- throw wrong_type("pmt_@TAG@vector_elements", vector);
- size_t len;
- const @TYPE@ *array = _@TAG@vector(vector)->elements(len);
- const std::vector< @TYPE@ > vec(array, array+len);
- return vec;
-}
-
-
-@TYPE@ *
-@TAG@vector_writable_elements(pmt_t vector, size_t &len)
-{
- if (!vector->is_@TAG@vector())
- throw wrong_type("pmt_@TAG@vector_writable_elements", vector);
- return _@TAG@vector(vector)->writable_elements(len);
-}
-
-const std::string
-pmt_@TAG@vector::string_ref(size_t k) const
-{
- return boost::lexical_cast< std::string, @TYPE@ > (ref(k));
-}
-
-} /* namespace pmt */
diff --git a/gnuradio-runtime/lib/pmt/unv_template.h.t b/gnuradio-runtime/lib/pmt/unv_template.h.t
deleted file mode 100644
index ab5c163570..0000000000
--- a/gnuradio-runtime/lib/pmt/unv_template.h.t
+++ /dev/null
@@ -1,25 +0,0 @@
-
-////////////////////////////////////////////////////////////////////////////
-// pmt_@TAG@vector
-////////////////////////////////////////////////////////////////////////////
-
-class pmt_@TAG@vector : public pmt_uniform_vector
-{
- std::vector< @TYPE@ > d_v;
-
-public:
- pmt_@TAG@vector(size_t k, @TYPE@ fill);
- pmt_@TAG@vector(size_t k, const @TYPE@ *data);
- // ~pmt_@TAG@vector();
-
- bool is_@TAG@vector() const { return true; }
- size_t length() const { return d_v.size(); }
- size_t itemsize() const { return sizeof(@TYPE@); }
- @TYPE@ ref(size_t k) const;
- void set(size_t k, @TYPE@ x);
- const @TYPE@ *elements(size_t &len);
- @TYPE@ *writable_elements(size_t &len);
- const void *uniform_elements(size_t &len);
- void *uniform_writable_elements(size_t &len);
- virtual const std::string string_ref(size_t k) const;
-};
diff --git a/gnuradio-runtime/python/build_utils.py b/gnuradio-runtime/python/build_utils.py
deleted file mode 100644
index 82a2265cc2..0000000000
--- a/gnuradio-runtime/python/build_utils.py
+++ /dev/null
@@ -1,227 +0,0 @@
-#
-# Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-"""Misc utilities used at build time
-"""
-from __future__ import unicode_literals
-
-import re, os, os.path
-from build_utils_codes import *
-
-
-# set srcdir to the directory that contains Makefile.am
-try:
- srcdir = os.environ['srcdir']
-except KeyError as e:
- srcdir = "."
-srcdir = srcdir + '/'
-
-# set do_makefile to either true or false dependeing on the environment
-try:
- if os.environ['do_makefile'] == '0':
- do_makefile = False
- else:
- do_makefile = True
-except KeyError as e:
- do_makefile = False
-
-# set do_sources to either true or false dependeing on the environment
-try:
- if os.environ['do_sources'] == '0':
- do_sources = False
- else:
- do_sources = True
-except KeyError as e:
- do_sources = True
-
-name_dict = {}
-
-def log_output_name (name):
- (base, ext) = os.path.splitext (name)
- ext = ext[1:] # drop the leading '.'
-
- entry = name_dict.setdefault (ext, [])
- entry.append (name)
-
-def open_and_log_name (name, dir):
- global do_sources
- if do_sources:
- f = open (name, dir)
- else:
- f = None
- log_output_name (name)
- return f
-
-def expand_template (d, template_filename, extra = ""):
- '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
- '''
- global do_sources
- output_extension = extract_extension (template_filename)
- template = open_src (template_filename, 'r')
- output_name = d['NAME'] + extra + '.' + output_extension
- log_output_name (output_name)
- if do_sources:
- output = open (output_name, 'w')
- do_substitution (d, template, output)
- output.close ()
- template.close ()
-
-def output_glue (dirname):
- output_makefile_fragment ()
- output_ifile_include (dirname)
-
-def output_makefile_fragment ():
- global do_makefile
- if not do_makefile:
- return
-# overwrite the source, which must be writable; this should have been
-# checked for beforehand in the top-level Makefile.gen.gen .
- f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
- f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
- output_subfrag (f, 'h')
- output_subfrag (f, 'i')
- output_subfrag (f, 'cc')
- f.close ()
-
-def output_ifile_include (dirname):
- global do_sources
- if do_sources:
- f = open ('%s_generated.i' % (dirname,), 'w')
- f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
- files = name_dict.setdefault ('i', [])
- files.sort ()
- f.write ('%{\n')
- for file in files:
- f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
- f.write ('%}\n\n')
- for file in files:
- f.write ('%%include <%s>\n' % (file,))
-
-def output_subfrag (f, ext):
- files = name_dict.setdefault (ext, [])
- files.sort ()
- f.write ("GENERATED_%s =" % (ext.upper ()))
- for file in files:
- f.write (" \\\n\t%s" % (file,))
- f.write ("\n\n")
-
-def extract_extension (template_name):
- # template name is something like: GrFIRfilterXXX.h.t
- # we return everything between the penultimate . and .t
- mo = re.search (r'\.([a-z]+)\.t$', template_name)
- if not mo:
- raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
- return mo.group (1)
-
-def open_src (name, mode):
- global srcdir
- return open (os.path.join (srcdir, name), mode)
-
-def do_substitution (d, in_file, out_file):
- def repl (match_obj):
- key = match_obj.group (1)
- # print key
- return d[key]
-
- inp = in_file.read ()
- out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
- out_file.write (out)
-
-
-
-copyright = '''/* -*- c++ -*- */
-/*
- * Copyright 2003,2004 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-'''
-
-def is_complex (code3):
- if i_code (code3) == 'c' or o_code (code3) == 'c':
- return '1'
- else:
- return '0'
-
-
-def standard_dict (name, code3, package='gr'):
- d = {}
- d['NAME'] = name
- d['NAME_IMPL'] = name+'_impl'
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
- d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
- d['SPTR_NAME'] = '%s_sptr' % name
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-
-def standard_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['BASE_NAME'] = name
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-def standard_impl_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['IMPL_NAME'] = name
- d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['FIR_TYPE'] = "fir_filter_" + code3
- d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
diff --git a/gnuradio-runtime/python/build_utils_codes.py b/gnuradio-runtime/python/build_utils_codes.py
index 22a6bdb99b..e69de29bb2 100644
--- a/gnuradio-runtime/python/build_utils_codes.py
+++ b/gnuradio-runtime/python/build_utils_codes.py
@@ -1,53 +0,0 @@
-from __future__ import unicode_literals
-#
-# Copyright 2004 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 3, 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-def i_code (code3):
- return code3[0]
-
-def o_code (code3):
- if len (code3) >= 2:
- return code3[1]
- else:
- return code3[0]
-
-def tap_code (code3):
- if len (code3) >= 3:
- return code3[2]
- else:
- return code3[0]
-
-def i_type (code3):
- return char_to_type[i_code (code3)]
-
-def o_type (code3):
- return char_to_type[o_code (code3)]
-
-def tap_type (code3):
- return char_to_type[tap_code (code3)]
-
-
-char_to_type = {}
-char_to_type['s'] = 'short'
-char_to_type['i'] = 'int'
-char_to_type['f'] = 'float'
-char_to_type['c'] = 'gr_complex'
-char_to_type['b'] = 'unsigned char'
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index 3b9e89eab0..16cba615fa 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -45,7 +45,6 @@ set(GR_SWIG_LIBRARIES
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/pmt
${CMAKE_CURRENT_BINARY_DIR}/../include/pmt)
-list(APPEND GR_SWIG_TARGET_DEPS pmt_generated)
GR_SWIG_MAKE(pmt_swig pmt_swig.i)
GR_SWIG_INSTALL(
diff --git a/gnuradio-runtime/swig/gr_swig_block_magic.i b/gnuradio-runtime/swig/gr_swig_block_magic.i
index 6d1af6136d..3a23487239 100644
--- a/gnuradio-runtime/swig/gr_swig_block_magic.i
+++ b/gnuradio-runtime/swig/gr_swig_block_magic.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -49,6 +49,16 @@ BASE_NAME = BASE_NAME.make;
%}
%enddef
+%define GR_SWIG_BLOCK_MAGIC2_TMPL(PKG, BASE_NAME, TARGET_NAME...)
+%template(BASE_NAME) gr:: ## PKG ## :: ## TARGET_NAME;
+%template(BASE_NAME ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## TARGET_NAME ## >;
+%pythoncode %{
+BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id())
+BASE_NAME = BASE_NAME.make
+%}
+%enddef
+
+
%define GR_SWIG_BLOCK_MAGIC_FACTORY(PKG, BASE_NAME, FACTORY)
%template(FACTORY ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>;
%pythoncode %{
diff --git a/gr-analog/include/gnuradio/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt
index 24b9ad95d1..b03e63fe12 100644
--- a/gr-analog/include/gnuradio/analog/CMakeLists.txt
+++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt
@@ -18,23 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(analog noise_source_X s i f c)
-GR_EXPAND_X_H(analog fastnoise_source_X s i f c)
-GR_EXPAND_X_H(analog sig_source_X s i f c)
-GR_EXPAND_X_H(analog random_uniform_source_X b s i)
-
-add_custom_target(analog_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
api.h
cpm.h
noise_type.h
@@ -51,9 +37,11 @@ install(FILES
cpfsk_bc.h
ctcss_squelch_ff.h
dpll_bb.h
+ fastnoise_source.h
feedforward_agc_cc.h
fmdet_cf.h
frequency_modulator_fc.h
+ noise_source.h
phase_modulator_fc.h
pll_carriertracking_cc.h
pll_freqdet_cf.h
@@ -65,6 +53,8 @@ install(FILES
pwr_squelch_ff.h
quadrature_demod_cf.h
rail_ff.h
+ random_uniform_source.h
+ sig_source.h
sig_source_waveform.h
simple_squelch_cc.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog
diff --git a/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t b/gr-analog/include/gnuradio/analog/fastnoise_source.h
index 850633979c..f32720a2e1 100644
--- a/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/fastnoise_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,14 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FASTNOISE_SOURCE_H
+#define FASTNOISE_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/noise_type.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace analog {
@@ -40,11 +40,12 @@ namespace gr {
* Generate random values from different distributions.
* Currently, only Gaussian and uniform are enabled.
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API fastnoise_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::fastnoise_source::sptr
+ typedef boost::shared_ptr< fastnoise_source<T> > sptr;
/*! \brief Make a fast noise source
* \param type the random distribution to use (see
@@ -60,8 +61,8 @@ namespace gr {
*/
static sptr make(noise_type_t type, float ampl,
long seed = 0, long samples=1024*16);
- virtual @TYPE@ sample() = 0;
- virtual @TYPE@ sample_unbiased() = 0;
+ virtual T sample() = 0;
+ virtual T sample_unbiased() = 0;
/*!
* Set the noise type. Nominally from the
@@ -80,8 +81,12 @@ namespace gr {
virtual float amplitude() const = 0;
};
+ typedef fastnoise_source<float> fastnoise_source_f;
+ typedef fastnoise_source<std::int32_t> fastnoise_source_i;
+ typedef fastnoise_source<std::int16_t> fastnoise_source_s;
+ typedef fastnoise_source<gr_complex> fastnoise_source_c;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FASTNOISE_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/noise_source_X.h.t b/gr-analog/include/gnuradio/analog/noise_source.h
index f619ca5146..4653074cb8 100644
--- a/gr-analog/include/gnuradio/analog/noise_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/noise_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef NOISE_SOURCE_H
+#define NOISE_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/noise_type.h>
@@ -40,11 +39,12 @@ namespace gr {
* Generate random values from different distributions.
* Currently, only Gaussian and uniform are enabled.
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API noise_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::noise_source::sptr
+ typedef boost::shared_ptr< noise_source<T> > sptr;
/*! Build a noise source
* \param type the random distribution to use (see
@@ -76,7 +76,12 @@ namespace gr {
virtual float amplitude() const = 0;
};
+ typedef noise_source<std::int16_t> noise_source_s;
+ typedef noise_source<std::int32_t> noise_source_i;
+ typedef noise_source<float> noise_source_f;
+ typedef noise_source<gr_complex> noise_source_c;
+
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* NOISE_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t b/gr-analog/include/gnuradio/analog/random_uniform_source.h
index d2f7cbdc44..95948cc24e 100644
--- a/gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/random_uniform_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2015 Free Software Foundation, Inc.
+ * Copyright 2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RANDOM_UNIFORM_SOURCE_H
+#define RANDOM_UNIFORM_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/sync_block.h>
@@ -35,11 +34,12 @@ namespace gr {
* \brief Uniform Random Number Generator with @TYPE@ output.
* \ingroup waveform_generators_blk
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API random_uniform_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::random_uniform_source::sptr
+ typedef boost::shared_ptr< random_uniform_source<T> > sptr;
/*!
* \brief Return a shared_ptr to a new instance of analog::random_uniform_source_X.
@@ -55,7 +55,10 @@ namespace gr {
static sptr make(int minimum, int maximum, int seed);
};
+ typedef random_uniform_source<std::uint8_t> random_uniform_source_b;
+ typedef random_uniform_source<std::int16_t> random_uniform_source_s;
+ typedef random_uniform_source<std::int32_t> random_uniform_source_i;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RANDOM_UNIFORM_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/sig_source_X.h.t b/gr-analog/include/gnuradio/analog/sig_source.h
index cf6cdc212d..759f93754c 100644
--- a/gr-analog/include/gnuradio/analog/sig_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/sig_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SIG_SOURCE_H
+#define SIG_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/sig_source_waveform.h>
@@ -33,14 +32,15 @@ namespace gr {
namespace analog {
/*!
- * \brief signal generator with @TYPE@ output.
+ * \brief signal generator with T output.
* \ingroup waveform_generators_blk
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API sig_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::sig_source::sptr
+ typedef boost::shared_ptr< sig_source<T> > sptr;
/*!
* Build a signal source block.
@@ -54,22 +54,26 @@ namespace gr {
static sptr make(double sampling_freq,
gr::analog::gr_waveform_t waveform,
double wave_freq,
- double ampl, @TYPE@ offset = 0);
+ double ampl, T offset = 0);
virtual double sampling_freq() const = 0;
virtual gr::analog::gr_waveform_t waveform() const = 0;
virtual double frequency() const = 0;
virtual double amplitude() const = 0;
- virtual @TYPE@ offset() const = 0;
+ virtual T offset() const = 0;
virtual void set_sampling_freq(double sampling_freq) = 0;
virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0;
virtual void set_frequency(double frequency) = 0;
virtual void set_amplitude(double ampl) = 0;
- virtual void set_offset(@TYPE@ offset) = 0;
+ virtual void set_offset(T offset) = 0;
};
+ typedef sig_source<std::int16_t> sig_source_s;
+ typedef sig_source<std::int32_t> sig_source_i;
+ typedef sig_source<float> sig_source_f;
+ typedef sig_source<gr_complex> sig_source_c;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SIG_SOURCE_H */
diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt
index a3b279f900..eeb287db05 100644
--- a/gr-analog/lib/CMakeLists.txt
+++ b/gr-analog/lib/CMakeLists.txt
@@ -40,19 +40,9 @@ if(ENABLE_GR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
########################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(analog noise_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog fastnoise_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog sig_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog random_uniform_source_X_impl b s i)
-
-########################################################################
# Setup library
########################################################################
list(APPEND analog_sources
- ${generated_sources}
cpm.cc
squelch_base_cc_impl.cc
squelch_base_ff_impl.cc
@@ -64,9 +54,11 @@ list(APPEND analog_sources
cpfsk_bc_impl.cc
ctcss_squelch_ff_impl.cc
dpll_bb_impl.cc
+ fastnoise_source_impl.cc
feedforward_agc_cc_impl.cc
fmdet_cf_impl.cc
frequency_modulator_fc_impl.cc
+ noise_source_impl.cc
phase_modulator_fc_impl.cc
pll_carriertracking_cc_impl.cc
pll_freqdet_cf_impl.cc
@@ -78,6 +70,8 @@ list(APPEND analog_sources
pwr_squelch_ff_impl.cc
quadrature_demod_cf_impl.cc
rail_ff_impl.cc
+ random_uniform_source_impl.cc
+ sig_source_impl.cc
simple_squelch_cc_impl.cc
)
@@ -107,13 +101,12 @@ list(APPEND analog_libs
add_library(gnuradio-analog SHARED ${analog_sources})
target_link_libraries(gnuradio-analog ${analog_libs})
GR_LIBRARY_FOO(gnuradio-analog)
-add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter)
+add_dependencies(gnuradio-analog analog_generated_swigs gnuradio-filter)
if(ENABLE_STATIC_LIBS)
add_library(gnuradio-analog_static STATIC ${analog_sources})
add_dependencies(gnuradio-analog_static
- analog_generated_includes
gnuradio-filter_static)
if(NOT WIN32)
diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t
deleted file mode 100644
index 940918b11b..0000000000
--- a/gr-analog/lib/fastnoise_source_X_impl.cc.t
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(noise_type_t type, float ampl, long seed, long samples)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(type, ampl, seed, samples));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_type(type),
-#if @IS_COMPLEX@ // complex?
- d_ampl(ampl/sqrtf(2.0f)),
-#else
- d_ampl(ampl),
-#endif
- d_rng(seed)
- {
- d_samples.resize(samples);
- generate();
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_type(noise_type_t type)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_type = type;
- generate();
- }
-
- void
- @IMPL_NAME@::set_amplitude(float ampl)
- {
- gr::thread::scoped_lock l(d_setlock);
-#if @IS_COMPLEX@ // complex?
- d_ampl = ampl/sqrtf(2.0f);
-#else
- d_ampl = ampl;
-#endif
- generate();
- }
-
- void
- @IMPL_NAME@::generate()
- {
- int noutput_items = d_samples.size();
- switch(d_type){
-#if @IS_COMPLEX@ // complex?
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
- d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = d_ampl * d_rng.rayleigh_complex();
- break;
-
-#else // nope...
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev());
- break;
-
- case GR_LAPLACIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian());
- break;
-
- case GR_IMPULSE: // FIXME changeable impulse settings
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse(9));
- break;
-#endif
-
- default:
- throw std::runtime_error("invalid type");
- }
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- for(int i=0; i<noutput_items; i++) {
- out[i] = sample();
- }
-
- return noutput_items;
- }
-
- @TYPE@ @IMPL_NAME@::sample()
- {
-#ifdef HAVE_RAND48
- size_t idx = lrand48() % d_samples.size();
-#else
- size_t idx = rand() % d_samples.size();
-#endif
- return d_samples[idx];
- }
-
-#ifndef FASTNOISE_RANDOM_SIGN
-#ifndef HAVE_RAND48
-#define FASTNOISE_RANDOM_SIGN ((rand()%2==0)?1:-1)
-#else
-#define FASTNOISE_RANDOM_SIGN ((lrand48()%2==0)?1:-1)
-#endif
-#endif
-
- @TYPE@ @IMPL_NAME@::sample_unbiased()
- {
-#if @IS_COMPLEX@
- gr_complex s(sample());
- return gr_complex(FASTNOISE_RANDOM_SIGN * s.real(),
- FASTNOISE_RANDOM_SIGN * s.imag());
-#else
- return FASTNOISE_RANDOM_SIGN * sample();
-#endif
- }
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/fastnoise_source_impl.cc b/gr-analog/lib/fastnoise_source_impl.cc
new file mode 100644
index 0000000000..ef85586b98
--- /dev/null
+++ b/gr-analog/lib/fastnoise_source_impl.cc
@@ -0,0 +1,191 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "fastnoise_source_impl.h"
+#include <gnuradio/io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename fastnoise_source<T>::sptr
+fastnoise_source<T>::make(noise_type_t type, float ampl, long seed, long samples) {
+ return gnuradio::get_initial_sptr(new fastnoise_source_impl<T>(type, ampl, seed, samples));
+}
+
+ template <>
+ void fastnoise_source_impl<gr_complex>::generate() {
+ int noutput_items = d_samples.size();
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = d_ampl * d_rng.rayleigh_complex();
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+ }
+
+template <class T>
+fastnoise_source_impl<T>::fastnoise_source_impl(noise_type_t type,
+ float ampl,
+ long seed,
+ long samples)
+ : sync_block(
+ "fastnoise_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_type(type), d_ampl(ampl), d_rng(seed) {
+ d_samples.resize(samples);
+ generate();
+}
+
+
+template <>
+fastnoise_source_impl<gr_complex>::fastnoise_source_impl(noise_type_t type,
+ float ampl,
+ long seed,
+ long samples)
+ : sync_block("fastnoise_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(gr_complex))),
+ d_type(type), d_ampl(ampl / sqrtf(2.0f)), d_rng(seed) {
+ d_samples.resize(samples);
+ generate();
+}
+
+template <class T>
+fastnoise_source_impl<T>::~fastnoise_source_impl() {}
+
+template <class T>
+void fastnoise_source_impl<T>::set_type(noise_type_t type) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_type = type;
+ generate();
+}
+
+template <class T>
+void fastnoise_source_impl<T>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl;
+ generate();
+}
+
+template <>
+void fastnoise_source_impl<gr_complex>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl / sqrtf(2.0f);
+ generate();
+}
+
+
+template <class T>
+void fastnoise_source_impl<T>::generate() {
+ int noutput_items = d_samples.size();
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.gasdev());
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.laplacian());
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.impulse(9));
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+}
+
+
+
+template <class T>
+int fastnoise_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ T* out = (T*)output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = sample();
+ }
+
+ return noutput_items;
+}
+
+template <class T>
+T fastnoise_source_impl<T>::sample() {
+#ifdef HAVE_RAND48
+ size_t idx = lrand48() % d_samples.size();
+#else
+ size_t idx = rand() % d_samples.size();
+#endif
+ return d_samples[idx];
+}
+
+#ifndef FASTNOISE_RANDOM_SIGN
+#ifndef HAVE_RAND48
+#define FASTNOISE_RANDOM_SIGN ((rand() % 2 == 0) ? 1 : -1)
+#else
+#define FASTNOISE_RANDOM_SIGN ((lrand48() % 2 == 0) ? 1 : -1)
+#endif
+#endif
+
+template <class T>
+T fastnoise_source_impl<T>::sample_unbiased() {
+ return FASTNOISE_RANDOM_SIGN * sample();
+}
+
+template <>
+gr_complex fastnoise_source_impl<gr_complex>::sample_unbiased() {
+ gr_complex s(sample());
+ return gr_complex(FASTNOISE_RANDOM_SIGN * s.real(), FASTNOISE_RANDOM_SIGN * s.imag());
+}
+
+
+template class fastnoise_source<std::int16_t>;
+template class fastnoise_source<std::int32_t>;
+template class fastnoise_source<float>;
+template class fastnoise_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/fastnoise_source_X_impl.h.t b/gr-analog/lib/fastnoise_source_impl.h
index 8ad1e4f8fe..2795b269dc 100644
--- a/gr-analog/lib/fastnoise_source_X_impl.h.t
+++ b/gr-analog/lib/fastnoise_source_impl.h
@@ -20,31 +20,31 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FASTNOISE_SOURCE_IMPL_H
+#define FASTNOISE_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/random.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class fastnoise_source_impl : public fastnoise_source<T>
{
private:
noise_type_t d_type;
float d_ampl;
gr::random d_rng;
- std::vector<@TYPE@> d_samples;
+ std::vector<T> d_samples;
public:
- @IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples);
- ~@IMPL_NAME@();
+ fastnoise_source_impl(noise_type_t type, float ampl, long seed, long samples);
+ ~fastnoise_source_impl();
- @TYPE@ sample();
- @TYPE@ sample_unbiased();
+ T sample();
+ T sample_unbiased();
void set_type(noise_type_t type);
void set_amplitude(float ampl);
@@ -61,4 +61,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FASTNOISE_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t
deleted file mode 100644
index d8c1b7eb1b..0000000000
--- a/gr-analog/lib/noise_source_X_impl.cc.t
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(noise_type_t type, float ampl, long seed)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(type, ampl, seed));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_type(type),
-#if @IS_COMPLEX@ // complex?
- d_ampl(ampl/sqrtf(2.0f)),
-#else
- d_ampl(ampl),
-#endif
- d_rng(seed)
- {
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_type(noise_type_t type)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_type = type;
- }
-
- void
- @IMPL_NAME@::set_amplitude(float ampl)
- {
- gr::thread::scoped_lock l(d_setlock);
-#if @IS_COMPLEX@ // complex?
- d_ampl = ampl/sqrtf(2.0f);
-#else
- d_ampl = ampl;
-#endif
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- switch(d_type) {
-#if @IS_COMPLEX@ // complex?
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
- d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- }
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = d_ampl * d_rng.rayleigh_complex();
- }
- break;
-
-#else // nope...
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- }
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.gasdev());
- }
- break;
-
- case GR_LAPLACIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.laplacian());
- }
- break;
-
- case GR_IMPULSE: // FIXME changeable impulse settings
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.impulse(9));
- }
- break;
-#endif
-
- default:
- throw std::runtime_error("invalid type");
- }
-
- return noutput_items;
- }
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/noise_source_impl.cc b/gr-analog/lib/noise_source_impl.cc
new file mode 100644
index 0000000000..a3dd2c20c9
--- /dev/null
+++ b/gr-analog/lib/noise_source_impl.cc
@@ -0,0 +1,150 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "noise_source_impl.h"
+#include <gnuradio/io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename noise_source<T>::sptr noise_source<T>::make(noise_type_t type, float ampl, long seed) {
+ return gnuradio::get_initial_sptr(new noise_source_impl<T>(type, ampl, seed));
+}
+
+template <class T>
+noise_source_impl<T>::noise_source_impl(noise_type_t type, float ampl, long seed)
+ : sync_block("noise_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_type(type), d_ampl(ampl), d_rng(seed) {}
+
+template <>
+noise_source_impl<gr_complex>::noise_source_impl(noise_type_t type, float ampl, long seed)
+ : sync_block("noise_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(gr_complex))),
+ d_type(type), d_ampl(ampl / sqrtf(2.0f)), d_rng(seed) {}
+
+
+template <class T>
+noise_source_impl<T>::~noise_source_impl<T>() {}
+
+template <class T>
+void noise_source_impl<T>::set_type(noise_type_t type) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_type = type;
+}
+
+template <class T>
+void noise_source_impl<T>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl;
+}
+
+template <>
+void noise_source_impl<gr_complex>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl / sqrtf(2.0f);
+}
+
+
+template <class T>
+int noise_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ T* out = (T*)output_items[0];
+
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ }
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.gasdev());
+ }
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.laplacian());
+ }
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.impulse(9));
+ }
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+
+ return noutput_items;
+}
+
+template <>
+int noise_source_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ gr_complex* out = (gr_complex*)output_items[0];
+
+ switch (d_type) {
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ }
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = d_ampl * d_rng.rayleigh_complex();
+ }
+ break;
+
+ default:
+ throw std::runtime_error("invalid type");
+ }
+
+ return noutput_items;
+}
+
+
+template class noise_source<std::int16_t>;
+template class noise_source<std::int32_t>;
+template class noise_source<float>;
+template class noise_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_impl.h
index cd7a3e1636..ddef4f25e9 100644
--- a/gr-analog/lib/noise_source_X_impl.h.t
+++ b/gr-analog/lib/noise_source_impl.h
@@ -20,26 +20,26 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef NOISE_SOURCE_IMPL_H
+#define NOISE_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/noise_source.h>
#include <gnuradio/random.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class noise_source_impl : public noise_source<T>
{
noise_type_t d_type;
float d_ampl;
gr::random d_rng;
public:
- @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0);
- ~@IMPL_NAME@();
+ noise_source_impl(noise_type_t type, float ampl, long seed = 0);
+ ~noise_source_impl();
void set_type(noise_type_t type);
void set_amplitude(float ampl);
@@ -55,4 +55,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* NOISE_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/random_uniform_source_X_impl.cc.t b/gr-analog/lib/random_uniform_source_X_impl.cc.t
deleted file mode 100644
index 98af5d02fa..0000000000
--- a/gr-analog/lib/random_uniform_source_X_impl.cc.t
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2015 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int minimum, int maximum, int seed)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@(minimum, maximum, seed));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(int minimum, int maximum, int seed)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@)))
- {
- d_rng = new gr::random(seed, minimum, maximum);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- delete d_rng;
- }
-
- int
- @IMPL_NAME@::random_value()
- {
- return d_rng->ran_int();
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- for(int i = 0; i < noutput_items; i++){
- *out++ = (@TYPE@) random_value();
- }
-
- // Tell runtime system how many output items we produced.
- return noutput_items;
- }
-
-
-
-
-
-
-
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/random_uniform_source_impl.cc b/gr-analog/lib/random_uniform_source_impl.cc
new file mode 100644
index 0000000000..cf89cac1e3
--- /dev/null
+++ b/gr-analog/lib/random_uniform_source_impl.cc
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2015 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "random_uniform_source_impl.h"
+#include <gnuradio/io_signature.h>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename random_uniform_source<T>::sptr
+random_uniform_source<T>::make(int minimum, int maximum, int seed) {
+ return gnuradio::get_initial_sptr(new random_uniform_source_impl<T>(minimum, maximum, seed));
+}
+
+template <class T>
+random_uniform_source_impl<T>::random_uniform_source_impl(int minimum, int maximum, int seed)
+ : sync_block("random_uniform_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(T))) {
+ d_rng = new gr::random(seed, minimum, maximum);
+}
+
+template <class T>
+random_uniform_source_impl<T>::~random_uniform_source_impl() {
+ delete d_rng;
+}
+
+template <class T>
+int random_uniform_source_impl<T>::random_value() {
+ return d_rng->ran_int();
+}
+
+template <class T>
+int random_uniform_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ T* out = (T*)output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ *out++ = (T)random_value();
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+
+template class random_uniform_source<std::uint8_t>;
+template class random_uniform_source<std::int16_t>;
+template class random_uniform_source<std::int32_t>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/random_uniform_source_X_impl.h.t b/gr-analog/lib/random_uniform_source_impl.h
index 67fcfc9893..65e6c3ef64 100644
--- a/gr-analog/lib/random_uniform_source_X_impl.h.t
+++ b/gr-analog/lib/random_uniform_source_impl.h
@@ -20,25 +20,25 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RANDOM_UNIFORM_SOURCE_IMPL_H
+#define RANDOM_UNIFORM_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/random_uniform_source.h>
#include <gnuradio/random.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class random_uniform_source_impl : public random_uniform_source<T>
{
private:
gr::random *d_rng;
public:
- @IMPL_NAME@(int minimum, int maximum, int seed);
- ~@IMPL_NAME@();
+ random_uniform_source_impl(int minimum, int maximum, int seed);
+ ~random_uniform_source_impl();
// Where all the action really happens
int work(int noutput_items,
@@ -51,4 +51,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */ \ No newline at end of file
+#endif /* RANDOM_UNIFORM_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t
deleted file mode 100644
index 18a45f5801..0000000000
--- a/gr-analog/lib/sig_source_X_impl.cc.t
+++ /dev/null
@@ -1,287 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <gnuradio/gr_complex.h>
-#include <gnuradio/math.h>
-
-#include <stdexcept>
-#include <algorithm>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(double sampling_freq, gr_waveform_t waveform,
- double frequency, double ampl, @TYPE@ offset)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(sampling_freq, waveform, frequency, ampl, offset));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(double sampling_freq, gr_waveform_t waveform,
- double frequency, double ampl, @TYPE@ offset)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_sampling_freq(sampling_freq), d_waveform(waveform),
- d_frequency(frequency), d_ampl(ampl), d_offset(offset)
- {
- set_frequency(frequency);
-
- message_port_register_in(pmt::mp("freq"));
- set_msg_handler(pmt::mp("freq"), boost::bind(&@IMPL_NAME@::set_frequency_msg, this, _1));
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_frequency_msg(pmt::pmt_t msg)
- {
- // Accepts either a number that is assumed to be the new
- // frequency or a key:value pair message where the key must be
- // "freq" and the value is the new frequency.
-
- if(pmt::is_number(msg)) {
- set_frequency(pmt::to_double(msg));
- }
- else if(pmt::is_pair(msg)) {
- pmt::pmt_t key = pmt::car(msg);
- pmt::pmt_t val = pmt::cdr(msg);
- if(pmt::eq(key, pmt::intern("freq"))) {
- if(pmt::is_number(val)) {
- set_frequency(pmt::to_double(val));
- }
- }
- else {
- GR_LOG_WARN(d_logger, boost::format("Set Frequency Message must have "
- "the key = 'freq'; got '%1%'.") \
- % pmt::write_string(key));
- }
- }
- else {
- GR_LOG_WARN(d_logger, "Set Frequency Message must be either a number or a "
- "key:value pair where the key is 'freq'.");
- }
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @TYPE@ *optr = (@TYPE@*)output_items[0];
- @TYPE@ t;
-
- switch(d_waveform) {
-
-#if @IS_COMPLEX@ // complex?
-
- case GR_CONST_WAVE:
- t = (gr_complex) d_ampl + d_offset;
- std::fill_n(optr, noutput_items, t);
- break;
-
- case GR_SIN_WAVE:
- case GR_COS_WAVE:
- d_nco.sincos(optr, noutput_items, d_ampl);
- if(d_offset == gr_complex(0,0))
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- /* Implements a real square wave high from -PI to 0.
- * The imaginary square wave leads by 90 deg.
- */
- case GR_SQR_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*GR_M_PI/2)
- optr[i] = gr_complex(d_ampl, 0) + d_offset;
- else if(d_nco.get_phase() < 0)
- optr[i] = gr_complex(d_ampl, d_ampl) + d_offset;
- else if(d_nco.get_phase() < GR_M_PI/2)
- optr[i] = gr_complex(0, d_ampl) + d_offset;
- else
- optr[i] = d_offset;
- d_nco.step();
- }
- break;
-
- /* Implements a real triangle wave rising from -PI to 0 and
- * falling from 0 to PI. The imaginary triangle wave leads by
- * 90 deg.
- */
- case GR_TRI_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*GR_M_PI/2){
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
- -1*d_ampl*d_nco.get_phase()/GR_M_PI - d_ampl/2) + d_offset;
- }
- else if(d_nco.get_phase() < 0) {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
- d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl/2) + d_offset;
- }
- else if(d_nco.get_phase() < GR_M_PI/2) {
- optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
- d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl/2) + d_offset;
- }
- else {
- optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
- -1*d_ampl*d_nco.get_phase()/GR_M_PI + 3*d_ampl/2) + d_offset;
- }
- d_nco.step();
- }
- break;
-
- /* Implements a real saw tooth wave rising from -PI to PI.
- * The imaginary saw tooth wave leads by 90 deg.
- */
- case GR_SAW_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*GR_M_PI/2) {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/2,
- d_ampl*d_nco.get_phase()/(2*GR_M_PI) + 5*d_ampl/4) + d_offset;
- }
- else {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/2,
- d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/4) + d_offset;
- }
- d_nco.step();
- }
- break;
-
-#else // nope...
-
- case GR_CONST_WAVE:
- t = (@TYPE@)d_ampl + d_offset;
- std::fill_n(optr, noutput_items, t);
- break;
-
- case GR_SIN_WAVE:
- d_nco.sin(optr, noutput_items, d_ampl);
- if(d_offset == 0)
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- case GR_COS_WAVE:
- d_nco.cos(optr, noutput_items, d_ampl);
- if(d_offset == 0)
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- /* The square wave is high from -PI to 0. */
- case GR_SQR_WAVE:
- t = (@TYPE@)d_ampl + d_offset;
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < 0)
- optr[i] = t;
- else
- optr[i] = d_offset;
- d_nco.step();
- }
- break;
-
- /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
- case GR_TRI_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- double t = d_ampl*d_nco.get_phase()/GR_M_PI;
- if (d_nco.get_phase() < 0)
- optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
- else
- optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset);
- d_nco.step();
- }
- break;
-
- /* The saw tooth wave rises from -PI to PI. */
- case GR_SAW_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*GR_M_PI)
- + d_ampl/2 + d_offset);
- optr[i] = t;
- d_nco.step();
- }
- break;
-
-#endif
-
- default:
- throw std::runtime_error("analog::sig_source: invalid waveform");
- }
-
- return noutput_items;
- }
-
- void
- @NAME@::set_sampling_freq(double sampling_freq)
- {
- d_sampling_freq = sampling_freq;
- d_nco.set_freq (2 * GR_M_PI * d_frequency / d_sampling_freq);
- }
-
- void
- @NAME@::set_waveform(gr_waveform_t waveform)
- {
- d_waveform = waveform;
- }
-
- void
- @NAME@::set_frequency(double frequency)
- {
- d_frequency = frequency;
- d_nco.set_freq(2 * GR_M_PI * d_frequency / d_sampling_freq);
- }
-
- void
- @NAME@::set_amplitude(double ampl)
- {
- d_ampl = ampl;
- }
-
- void
- @NAME@::set_offset(@TYPE@ offset)
- {
- d_offset = offset;
- }
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/sig_source_impl.cc b/gr-analog/lib/sig_source_impl.cc
new file mode 100644
index 0000000000..0f7ced0eb2
--- /dev/null
+++ b/gr-analog/lib/sig_source_impl.cc
@@ -0,0 +1,287 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "sig_source_impl.h"
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
+
+#include <algorithm>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename sig_source<T>::sptr sig_source<T>::make(
+ double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, T offset) {
+ return gnuradio::get_initial_sptr(
+ new sig_source_impl<T>(sampling_freq, waveform, frequency, ampl, offset));
+}
+
+template <class T>
+sig_source_impl<T>::sig_source_impl(
+ double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, T offset)
+ : sync_block("sig_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_sampling_freq(sampling_freq), d_waveform(waveform), d_frequency(frequency), d_ampl(ampl),
+ d_offset(offset) {
+ this->set_frequency(frequency);
+
+ this->message_port_register_in(pmt::mp("freq"));
+ this->set_msg_handler(pmt::mp("freq"), boost::bind(&sig_source_impl<T>::set_frequency_msg, this, _1));
+}
+
+template <class T>
+sig_source_impl<T>::~sig_source_impl() {}
+
+template <class T>
+void sig_source_impl<T>::set_frequency_msg(pmt::pmt_t msg) {
+ // Accepts either a number that is assumed to be the new
+ // frequency or a key:value pair message where the key must be
+ // "freq" and the value is the new frequency.
+
+ if (pmt::is_number(msg)) {
+ set_frequency(pmt::to_double(msg));
+ } else if (pmt::is_pair(msg)) {
+ pmt::pmt_t key = pmt::car(msg);
+ pmt::pmt_t val = pmt::cdr(msg);
+ if (pmt::eq(key, pmt::intern("freq"))) {
+ if (pmt::is_number(val)) {
+ set_frequency(pmt::to_double(val));
+ }
+ } else {
+ GR_LOG_WARN(this->d_logger,
+ boost::format("Set Frequency Message must have "
+ "the key = 'freq'; got '%1%'.") %
+ pmt::write_string(key));
+ }
+ } else {
+ GR_LOG_WARN(this->d_logger,
+ "Set Frequency Message must be either a number or a "
+ "key:value pair where the key is 'freq'.");
+ }
+}
+
+template <class T>
+int sig_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ T* optr = (T*)output_items[0];
+ T t;
+
+ switch (d_waveform) {
+ case GR_CONST_WAVE:
+ t = (T)d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ d_nco.sin(optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ case GR_COS_WAVE:
+ d_nco.cos(optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* The square wave is high from -PI to 0. */
+ case GR_SQR_WAVE:
+ t = (T)d_ampl + d_offset;
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < 0)
+ optr[i] = t;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ double t = d_ampl * d_nco.get_phase() / GR_M_PI;
+ if (d_nco.get_phase() < 0)
+ optr[i] = static_cast<T>(t + d_ampl + d_offset);
+ else
+ optr[i] = static_cast<T>(-1 * t + d_ampl + d_offset);
+ d_nco.step();
+ }
+ break;
+
+ /* The saw tooth wave rises from -PI to PI. */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ t = static_cast<T>(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2 + d_offset);
+ optr[i] = t;
+ d_nco.step();
+ }
+ break;
+ default:
+ throw std::runtime_error("analog::sig_source: invalid waveform");
+ }
+
+ return noutput_items;
+}
+
+
+template <>
+int sig_source_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr_complex* optr = (gr_complex*)output_items[0];
+ gr_complex t;
+
+ switch (d_waveform) {
+ case GR_CONST_WAVE:
+ t = (gr_complex)d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ case GR_COS_WAVE:
+ d_nco.sincos(optr, noutput_items, d_ampl);
+ if (d_offset == gr_complex(0, 0))
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* Implements a real square wave high from -PI to 0.
+ * The imaginary square wave leads by 90 deg.
+ */
+ case GR_SQR_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2)
+ optr[i] = gr_complex(d_ampl, 0) + d_offset;
+ else if (d_nco.get_phase() < 0)
+ optr[i] = gr_complex(d_ampl, d_ampl) + d_offset;
+ else if (d_nco.get_phase() < GR_M_PI / 2)
+ optr[i] = gr_complex(0, d_ampl) + d_offset;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real triangle wave rising from -PI to 0 and
+ * falling from 0 to PI. The imaginary triangle wave leads by
+ * 90 deg.
+ */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ -1 * d_ampl * d_nco.get_phase() / GR_M_PI - d_ampl / 2) +
+ d_offset;
+ } else if (d_nco.get_phase() < 0) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl / 2) +
+ d_offset;
+ } else if (d_nco.get_phase() < GR_M_PI / 2) {
+ optr[i] = gr_complex(-1 * d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl / 2) +
+ d_offset;
+ } else {
+ optr[i] = gr_complex(-1 * d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ -1 * d_ampl * d_nco.get_phase() / GR_M_PI + 3 * d_ampl / 2) +
+ d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real saw tooth wave rising from -PI to PI.
+ * The imaginary saw tooth wave leads by 90 deg.
+ */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2,
+ d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + 5 * d_ampl / 4) +
+ d_offset;
+ } else {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2,
+ d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 4) +
+ d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+ default:
+ throw std::runtime_error("analog::sig_source: invalid waveform");
+ }
+
+ return noutput_items;
+}
+
+
+template <class T>
+void sig_source_impl<T>::set_sampling_freq(double sampling_freq) {
+ d_sampling_freq = sampling_freq;
+ d_nco.set_freq(2 * GR_M_PI * this->d_frequency / this->d_sampling_freq);
+}
+
+template <class T>
+void sig_source_impl<T>::set_waveform(gr_waveform_t waveform) {
+ d_waveform = waveform;
+}
+
+template <class T>
+void sig_source_impl<T>::set_frequency(double frequency) {
+ d_frequency = frequency;
+ d_nco.set_freq(2 * GR_M_PI * this->d_frequency / this->d_sampling_freq);
+}
+
+template <class T>
+void sig_source_impl<T>::set_amplitude(double ampl) {
+ d_ampl = ampl;
+}
+
+template <class T>
+void sig_source_impl<T>::set_offset(T offset) {
+ d_offset = offset;
+}
+
+template class sig_source<std::int16_t>;
+template class sig_source<std::int32_t>;
+template class sig_source<float>;
+template class sig_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/sig_source_X_impl.h.t b/gr-analog/lib/sig_source_impl.h
index f5dfd5c4f6..9fd26582fa 100644
--- a/gr-analog/lib/sig_source_X_impl.h.t
+++ b/gr-analog/lib/sig_source_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,32 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SIG_SOURCE_IMPL_H
+#define SIG_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/sig_source.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/fxpt_nco.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class sig_source_impl : public sig_source<T>
{
private:
double d_sampling_freq;
gr_waveform_t d_waveform;
double d_frequency;
double d_ampl;
- @TYPE@ d_offset;
+ T d_offset;
gr::fxpt_nco d_nco;
public:
- @IMPL_NAME@(double sampling_freq, gr_waveform_t waveform,
- double wave_freq, double ampl, @TYPE@ offset = 0);
- ~@IMPL_NAME@();
+ sig_source_impl(double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, T offset = 0);
+ ~sig_source_impl();
virtual int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -55,17 +55,17 @@ namespace gr {
gr_waveform_t waveform() const { return d_waveform; }
double frequency() const { return d_frequency; }
double amplitude() const { return d_ampl; }
- @TYPE@ offset() const { return d_offset; }
+ T offset() const { return d_offset; }
void set_sampling_freq(double sampling_freq);
void set_waveform(gr_waveform_t waveform);
void set_frequency_msg(pmt::pmt_t msg);
void set_frequency(double frequency);
void set_amplitude(double ampl);
- void set_offset(@TYPE@ offset);
+ void set_offset(T offset);
};
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SIG_SOURCE_IMPL_H */
diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt
index 3636cce16d..9646299098 100644
--- a/gr-analog/swig/CMakeLists.txt
+++ b/gr-analog/swig/CMakeLists.txt
@@ -42,7 +42,6 @@ set(GR_SWIG_DOC_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/analog
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
-set(GR_SWIG_TARGET_DEPS analog_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-analog gnuradio-filter)
GR_SWIG_MAKE(analog_swig analog_swig.i)
diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i
index 7f064f545f..8f4b90b71c 100644
--- a/gr-analog/swig/analog_swig.i
+++ b/gr-analog/swig/analog_swig.i
@@ -47,14 +47,8 @@
#include "gnuradio/analog/feedforward_agc_cc.h"
#include "gnuradio/analog/fmdet_cf.h"
#include "gnuradio/analog/frequency_modulator_fc.h"
-#include "gnuradio/analog/fastnoise_source_s.h"
-#include "gnuradio/analog/fastnoise_source_i.h"
-#include "gnuradio/analog/fastnoise_source_f.h"
-#include "gnuradio/analog/fastnoise_source_c.h"
-#include "gnuradio/analog/noise_source_s.h"
-#include "gnuradio/analog/noise_source_i.h"
-#include "gnuradio/analog/noise_source_f.h"
-#include "gnuradio/analog/noise_source_c.h"
+#include "gnuradio/analog/fastnoise_source.h"
+#include "gnuradio/analog/noise_source.h"
#include "gnuradio/analog/phase_modulator_fc.h"
#include "gnuradio/analog/pll_carriertracking_cc.h"
#include "gnuradio/analog/pll_freqdet_cf.h"
@@ -66,17 +60,12 @@
#include "gnuradio/analog/pwr_squelch_ff.h"
#include "gnuradio/analog/quadrature_demod_cf.h"
#include "gnuradio/analog/rail_ff.h"
-#include "gnuradio/analog/sig_source_s.h"
-#include "gnuradio/analog/sig_source_i.h"
-#include "gnuradio/analog/sig_source_f.h"
-#include "gnuradio/analog/sig_source_c.h"
+#include "gnuradio/analog/sig_source.h"
#include "gnuradio/analog/sig_source_waveform.h"
#include "gnuradio/analog/simple_squelch_cc.h"
#include "gnuradio/analog/squelch_base_cc.h"
#include "gnuradio/analog/squelch_base_ff.h"
-#include "gnuradio/analog/random_uniform_source_b.h"
-#include "gnuradio/analog/random_uniform_source_s.h"
-#include "gnuradio/analog/random_uniform_source_i.h"
+#include "gnuradio/analog/random_uniform_source.h"
%}
%include "gnuradio/analog/cpm.h"
@@ -92,14 +81,8 @@
%include "gnuradio/analog/feedforward_agc_cc.h"
%include "gnuradio/analog/fmdet_cf.h"
%include "gnuradio/analog/frequency_modulator_fc.h"
-%include "gnuradio/analog/fastnoise_source_s.h"
-%include "gnuradio/analog/fastnoise_source_i.h"
-%include "gnuradio/analog/fastnoise_source_f.h"
-%include "gnuradio/analog/fastnoise_source_c.h"
-%include "gnuradio/analog/noise_source_s.h"
-%include "gnuradio/analog/noise_source_i.h"
-%include "gnuradio/analog/noise_source_f.h"
-%include "gnuradio/analog/noise_source_c.h"
+%include "gnuradio/analog/fastnoise_source.h"
+%include "gnuradio/analog/noise_source.h"
%include "gnuradio/analog/phase_modulator_fc.h"
%include "gnuradio/analog/pll_carriertracking_cc.h"
%include "gnuradio/analog/pll_freqdet_cf.h"
@@ -111,17 +94,12 @@
%include "gnuradio/analog/pwr_squelch_ff.h"
%include "gnuradio/analog/quadrature_demod_cf.h"
%include "gnuradio/analog/rail_ff.h"
-%include "gnuradio/analog/sig_source_s.h"
-%include "gnuradio/analog/sig_source_i.h"
-%include "gnuradio/analog/sig_source_f.h"
-%include "gnuradio/analog/sig_source_c.h"
+%include "gnuradio/analog/sig_source.h"
%include "gnuradio/analog/sig_source_waveform.h"
%include "gnuradio/analog/simple_squelch_cc.h"
%include "gnuradio/analog/squelch_base_cc.h"
%include "gnuradio/analog/squelch_base_ff.h"
-%include "gnuradio/analog/random_uniform_source_b.h"
-%include "gnuradio/analog/random_uniform_source_s.h"
-%include "gnuradio/analog/random_uniform_source_i.h"
+%include "gnuradio/analog/random_uniform_source.h"
GR_SWIG_BLOCK_MAGIC2(analog, agc_cc);
GR_SWIG_BLOCK_MAGIC2(analog, agc_ff);
@@ -134,14 +112,14 @@ GR_SWIG_BLOCK_MAGIC2(analog, dpll_bb);
GR_SWIG_BLOCK_MAGIC2(analog, feedforward_agc_cc);
GR_SWIG_BLOCK_MAGIC2(analog, fmdet_cf);
GR_SWIG_BLOCK_MAGIC2(analog, frequency_modulator_fc);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_c);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_s, fastnoise_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_i, fastnoise_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_f, fastnoise_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_c, fastnoise_source<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_s, noise_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_i, noise_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_f, noise_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_c, noise_source<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc);
GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc);
GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf);
@@ -153,11 +131,11 @@ GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_cc);
GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_ff);
GR_SWIG_BLOCK_MAGIC2(analog, quadrature_demod_cf);
GR_SWIG_BLOCK_MAGIC2(analog, rail_ff);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_s, sig_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_i, sig_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_f, sig_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_c, sig_source<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(analog, simple_squelch_cc);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_b);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_i);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_b, random_uniform_source<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_s, random_uniform_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_i, random_uniform_source<std::int32_t>);
diff --git a/gr-audio/examples/c++/dial_tone.cc b/gr-audio/examples/c++/dial_tone.cc
index 728d1767a3..a573ead3cd 100644
--- a/gr-audio/examples/c++/dial_tone.cc
+++ b/gr-audio/examples/c++/dial_tone.cc
@@ -38,7 +38,7 @@
// Include header files for each block used in flowgraph
#include <gnuradio/top_block.h>
-#include <gnuradio/analog/sig_source_f.h>
+#include <gnuradio/analog/sig_source.h>
#include <gnuradio/audio/sink.h>
using namespace gr;
diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
index 6f4915b9ef..e74cef627f 100644
--- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
+++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
@@ -18,61 +18,47 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(blocks abs_XX ss ii ff)
-GR_EXPAND_X_H(blocks add_XX ss ii cc)
-GR_EXPAND_X_H(blocks add_const_vXX bb ss ii ff cc)
-GR_EXPAND_X_H(blocks and_XX bb ss ii)
-GR_EXPAND_X_H(blocks and_const_XX bb ss ii)
-GR_EXPAND_X_H(blocks argmax_XX fs is ss)
-GR_EXPAND_X_H(blocks divide_XX ss ii ff cc)
-GR_EXPAND_X_H(blocks integrate_XX ss ii ff cc)
-GR_EXPAND_X_H(blocks max_XX ss ii ff)
-GR_EXPAND_X_H(blocks min_XX ss ii ff)
-GR_EXPAND_X_H(blocks moving_average_XX ss ii ff cc)
-GR_EXPAND_X_H(blocks multiply_XX ss ii)
-GR_EXPAND_X_H(blocks multiply_const_XX ss ii)
-GR_EXPAND_X_H(blocks multiply_const_vXX ss ii)
-GR_EXPAND_X_H(blocks multiply_matrix_XX ff cc)
-GR_EXPAND_X_H(blocks mute_XX ss ii ff cc)
-GR_EXPAND_X_H(blocks not_XX bb ss ii)
-GR_EXPAND_X_H(blocks or_XX bb ss ii)
-GR_EXPAND_X_H(blocks peak_detector_XX fb ib sb)
-GR_EXPAND_X_H(blocks probe_signal_X b s i f c)
-GR_EXPAND_X_H(blocks probe_signal_vX b s i f c)
-GR_EXPAND_X_H(blocks sample_and_hold_XX bb ss ii ff)
-GR_EXPAND_X_H(blocks sub_XX ss ii cc)
-GR_EXPAND_X_H(blocks tsb_vector_sink_X b s i f c)
-GR_EXPAND_X_H(blocks xor_XX bb ss ii)
-GR_EXPAND_X_H(blocks packed_to_unpacked_XX bb ss ii)
-GR_EXPAND_X_H(blocks unpacked_to_packed_XX bb ss ii)
-GR_EXPAND_X_H(blocks vector_insert_X b s i f c)
-GR_EXPAND_X_H(blocks vector_sink_X b s i f c)
-GR_EXPAND_X_H(blocks vector_source_X b s i f c)
-
-add_custom_target(blocks_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
+ abs_blk.h
+ add_blk.h
+ add_const_v.h
+ and_blk.h
api.h
+ argmax.h
control_loop.h
count_bits.h
+ divide.h
file_sink_base.h
+ integrate.h
lfsr_15_1_0.h
lfsr_32k.h
log2_const.h
+ max_blk.h
+ min_blk.h
+ moving_average.h
+ multiply.h
+ multiply_const.h
+ multiply_matrix.h
+ mute.h
+ not_blk.h
pack_k_bits.h
+ packed_to_unpacked.h
+ peak_detector.h
+ probe_signal.h
+ probe_signal_v.h
rotator.h
+ sample_and_hold.h
+ sub.h
+ tsb_vector_sink.h
unpack_k_bits.h
+ unpacked_to_packed.h
+ vector_insert.h
+ vector_sink.h
+ vector_source.h
wavfile.h
- add_ff.h
+ xor_blk.h
add_const_bb.h
add_const_ss.h
add_const_ii.h
@@ -123,18 +109,14 @@ install(FILES
message_debug.h
message_strobe.h
message_strobe_random.h
- multiply_cc.h
- multiply_ff.h
multiply_conjugate_cc.h
- multiply_const_cc.h
- multiply_const_vcc.h
- multiply_const_ff.h
- multiply_const_vff.h
+ multiply_const_v.h
multiply_by_tag_value_cc.h
nlog10_ff.h
nop.h
null_sink.h
null_source.h
+ or_blk.h
pack_k_bits_bb.h
patterned_interleaver.h
pdu.h
@@ -163,7 +145,6 @@ install(FILES
streams_to_stream.h
streams_to_vector.h
stretch_ff.h
- sub_ff.h
tag_debug.h
tag_gate.h
tag_share.h
diff --git a/gr-blocks/include/gnuradio/blocks/abs_XX.h.t b/gr-blocks/include/gnuradio/blocks/abs_blk.h
index 541716296f..83e3307e50 100644
--- a/gr-blocks/include/gnuradio/blocks/abs_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/abs_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef ABS_BLK_H
+#define ABS_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,21 +38,25 @@ namespace gr {
* \details
* absolute value of data stream (Strip sign)
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API abs_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::abs_blk::sptr
+ typedef boost::shared_ptr< abs_blk<T> > sptr;
/*!
- * \brief Create an instance of @NAME@
+ * \brief Create an instance of abs_blk
*/
static sptr make(size_t vlen=1);
};
+typedef abs_blk<std::int16_t> abs_ss;
+typedef abs_blk<std::int32_t> abs_ii;
+typedef abs_blk<float> abs_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ABS_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/add_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_blk.h
index 0a7195d7c3..40408f7836 100644
--- a/gr-blocks/include/gnuradio/blocks/add_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/add_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef ADD_BLK_H
+#define ADD_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -43,17 +43,22 @@ namespace gr {
* y[n] = \sum_{m=0}^{M-1} x_m[n]
* \f]
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API add_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::add_blk::sptr
+ typedef boost::shared_ptr< add_blk<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef add_blk<std::int16_t> add_ss;
+typedef add_blk<std::int32_t> add_ii;
+typedef add_blk<gr_complex> add_cc;
+typedef add_blk<float> add_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ADD_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_v.h
index 55b8ce3f73..f33393c668 100644
--- a/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/add_const_v.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef ADD_CONST_V_H
+#define ADD_CONST_V_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,32 +34,38 @@ namespace gr {
* \brief output[m] = input[m] + constant vector for all M streams.
* \ingroup math_operators_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template <class T>
+ class BLOCKS_API add_const_v : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr<add_const_v <T> > sptr;
/*!
- * \brief Create an instance of @NAME@
+ * \brief Create an instance of add_const_v
* \param k additive constant vector
*/
- static sptr make(std::vector<@O_TYPE@> k);
+ static sptr make(std::vector<T> k);
/*!
* \brief Return additive constant vector
*/
- virtual std::vector<@O_TYPE@> k() const = 0;
+ virtual std::vector<T> k() const = 0;
/*!
* \brief Set additive constant vector
*/
- virtual void set_k(std::vector<@O_TYPE@> k) = 0;
+ virtual void set_k(std::vector<T> k) = 0;
};
+ typedef add_const_v<std::uint8_t> add_const_vbb;
+ typedef add_const_v<std::int16_t> add_const_vss;
+ typedef add_const_v<std::int32_t> add_const_vii;
+ typedef add_const_v<float> add_const_vff;
+ typedef add_const_v<gr_complex> add_const_vcc;
+
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ADD_CONST_V_H */
diff --git a/gr-blocks/include/gnuradio/blocks/add_ff.h b/gr-blocks/include/gnuradio/blocks/add_ff.h
deleted file mode 100644
index ea56677757..0000000000
--- a/gr-blocks/include/gnuradio/blocks/add_ff.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_ADD_FF_H
-#define INCLUDED_BLOCKS_ADD_FF_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = sum (input_0, input_1, ...)
- * \ingroup math_operators_blk
- *
- * \details
- * Add across all input streams.
- */
- class BLOCKS_API add_ff : virtual public sync_block
- {
- public:
-
- // gr::blocks::add_ff::sptr
- typedef boost::shared_ptr<add_ff> sptr;
-
- /*!
- * \brief Add streams of float values
- * \param vlen Vector length
- * \ingroup math_blk
- */
- static sptr make(size_t vlen=1);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_ADD_FF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/and_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_blk.h
index cf2b1ab488..d24781b0f4 100644
--- a/gr-blocks/include/gnuradio/blocks/and_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/and_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef AND_BLK_H
+#define AND_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,17 +38,21 @@ namespace gr {
* \details
* bitwise boolean AND across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API and_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::and_blk::sptr
+ typedef boost::shared_ptr< and_blk<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef and_blk<std::uint8_t> and_bb;
+typedef and_blk<std::int16_t> and_ss;
+typedef and_blk<std::int32_t> and_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* AND_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_const.h
index ee2ff3da20..dbc664d170 100644
--- a/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/and_const.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef AND_CONST_H
+#define AND_CONST_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,32 +38,36 @@ namespace gr {
* \details
* Bitwise boolean AND of constant \p k with the data stream.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API and_const : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::and_const::sptr
+ typedef boost::shared_ptr< and_const<T> > sptr;
/*!
- * \brief Create an instance of @NAME@
+ * \brief Create an instance of and_const
* \param k AND constant
*/
- static sptr make(@O_TYPE@ k);
+ static sptr make(T k);
/*!
* \brief Return AND constant
*/
- virtual @O_TYPE@ k() const = 0;
+ virtual T k() const = 0;
/*!
* \brief Set AND constant
*/
- virtual void set_k(@O_TYPE@ k) = 0;
+ virtual void set_k(T k) = 0;
};
+typedef and_const<std::uint8_t> and_const_bb;
+typedef and_const<std::int16_t> and_const_ss;
+typedef and_const<std::int32_t> and_const_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* AND_CONST_H */
diff --git a/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t b/gr-blocks/include/gnuradio/blocks/argmax.h
index ca0243b6dc..fe4d750e7b 100644
--- a/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/argmax.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef ARGMAX_H
+#define ARGMAX_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -48,16 +47,19 @@ namespace gr {
* \li Stream 1 will contain the number of the input stream that
* held the maximum value.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template <class T>
+ class BLOCKS_API argmax : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< argmax<T> > sptr;
static sptr make(size_t vlen);
};
+ typedef argmax<float> argmax_fs;
+ typedef argmax<std::int32_t> argmax_is;
+ typedef argmax<std::int16_t> argmax_ss;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ARGMAX_H */
diff --git a/gr-blocks/include/gnuradio/blocks/divide_XX.h.t b/gr-blocks/include/gnuradio/blocks/divide.h
index 1ceeb5f1df..0ad62e50b4 100644
--- a/gr-blocks/include/gnuradio/blocks/divide_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/divide.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef DIVIDE_H
+#define DIVIDE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,17 +38,22 @@ namespace gr {
* \details
* Divide across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API divide : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::divide::sptr
+ typedef boost::shared_ptr< divide<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef divide<std::int16_t> divide_ss;
+typedef divide<std::int32_t> divide_ii;
+typedef divide<float> divide_ff;
+typedef divide<gr_complex> divide_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* DIVIDE_H */
diff --git a/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t b/gr-blocks/include/gnuradio/blocks/integrate.h
index 7ec1176558..b10c6595eb 100644
--- a/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/integrate.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef INTEGRATE_H
+#define INTEGRATE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_decimator.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,17 +35,22 @@ namespace gr {
* \brief Integrate successive samples and decimate
* \ingroup math_operators_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_decimator
+template<class T>
+ class BLOCKS_API integrate : virtual public sync_decimator
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::integrate::sptr
+ typedef boost::shared_ptr< integrate<T> > sptr;
static sptr make(int decim, int vlen = 1);
};
+typedef integrate<std::int16_t> integrate_ss;
+typedef integrate<std::int32_t> integrate_ii;
+typedef integrate<float> integrate_ff;
+typedef integrate<gr_complex> integrate_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* INTEGRATE_H */
diff --git a/gr-blocks/include/gnuradio/blocks/max_XX.h.t b/gr-blocks/include/gnuradio/blocks/max_blk.h
index 6168769d61..dcdc3204d1 100644
--- a/gr-blocks/include/gnuradio/blocks/max_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/max_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MAX_BLK_H
+#define MAX_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,7 +38,7 @@ namespace gr {
*
* \details
* Data is passed in as a vector of length \p vlen from multiple
- * input sources. If vlen_out == 1 then
+ * input sources. If vlen_out == 1 then
* It will look through these streams of \p vlen
* data items and the output stream will contain the maximum value
* in the vector.
@@ -46,16 +46,20 @@ namespace gr {
* output will be a vector with individual items selected from
* the maximum corresponding input vector items.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API max_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::max_blk::sptr
+ typedef boost::shared_ptr< max_blk<T> > sptr;
static sptr make(size_t vlen, size_t vlen_out = 1);
};
+typedef max_blk<std::int16_t> max_ss;
+typedef max_blk<std::int32_t> max_ii;
+typedef max_blk<float> max_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MAX_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/min_XX.h.t b/gr-blocks/include/gnuradio/blocks/min_blk.h
index 3f8e6392d3..29dc75ae18 100644
--- a/gr-blocks/include/gnuradio/blocks/min_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/min_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MIN_BLK_H
+#define MIN_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,7 +38,7 @@ namespace gr {
*
* \details
* Data is passed in as a vector of length \p vlen from multiple
- * input sources. If vlen_out == 1 then
+ * input sources. If vlen_out == 1 then
* It will look through these streams of \p vlen
* data items and the output stream will contain the minimum value
* in the vector.
@@ -46,16 +46,19 @@ namespace gr {
* output will be a vector with individual items selected from
* the minimum corresponding input vector items.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API min_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< min_blk<T> > sptr;
static sptr make(size_t vlen, size_t vlen_out = 1);
};
+typedef min_blk<std::int16_t> min_ss;
+typedef min_blk<std::int32_t> min_ii;
+typedef min_blk<float> min_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MIN_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t b/gr-blocks/include/gnuradio/blocks/moving_average.h
index deabf31832..8448c45ded 100644
--- a/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/moving_average.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2013,2017 Free Software Foundation, Inc.
+ * Copyright 2008,2013,2017,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MOVING_AVERAGE_H
+#define MOVING_AVERAGE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,11 +35,12 @@ namespace gr {
* \brief output is the moving sum of the last N samples, scaled by the scale factor
* \ingroup level_controllers_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API moving_average : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::moving_average::sptr
+ typedef boost::shared_ptr< moving_average<T> > sptr;
/*!
* Create a moving average block.
@@ -50,7 +51,7 @@ namespace gr {
* This is necessary to avoid numerical instability for float and complex.
* \param vlen When > 1, do a per-vector-element moving average
*/
- static sptr make(int length, @O_TYPE@ scale,
+ static sptr make(int length, T scale,
int max_iter = 4096,
unsigned int vlen = 1);
@@ -62,12 +63,12 @@ namespace gr {
/*!
* Get the scale factor being used.
*/
- virtual @O_TYPE@ scale() const = 0;
+ virtual T scale() const = 0;
/*!
* Set both the length and the scale factor together.
*/
- virtual void set_length_and_scale(int length, @O_TYPE@ scale) = 0;
+ virtual void set_length_and_scale(int length, T scale) = 0;
/*!
* Set the length.
@@ -77,10 +78,14 @@ namespace gr {
/*!
* Set the scale factor.
*/
- virtual void set_scale(@O_TYPE@ scale) = 0;
+ virtual void set_scale(T scale) = 0;
};
+typedef moving_average<std::int16_t> moving_average_ss;
+typedef moving_average<std::int32_t> moving_average_ii;
+typedef moving_average<float> moving_average_ff;
+typedef moving_average<gr_complex> moving_average_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MOVING_AVERAGE_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply.h
index 1071b5b5c5..06bda22cbf 100644
--- a/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/multiply.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004, 2009, 2012 Free Software Foundation, Inc.
+ * Copyright 2004, 2009, 2012, 2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MULTIPLY_H
+#define MULTIPLY_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,17 +38,22 @@ namespace gr {
* \details
* Multiply across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API multiply : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::multiply::sptr
+ typedef boost::shared_ptr< multiply<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef multiply<std::int16_t> multiply_ss;
+typedef multiply<std::int32_t> multiply_ii;
+typedef multiply<float> multiply_ff;
+typedef multiply<gr_complex> multiply_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MULTIPLY_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_cc.h
deleted file mode 100644
index 9adf7d07ff..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_cc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_MULTIPLY_CC_H
-#define INCLUDED_GR_MULTIPLY_CC_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = prod (input_0, input_1, ...)
- * \ingroup math_operators_blk
- *
- * \details
- * Multiply across all input streams.
- */
- class BLOCKS_API multiply_cc : virtual public sync_block
- {
- public:
-
- // gr::blocks::multiply_cc::sptr
- typedef boost::shared_ptr<multiply_cc> sptr;
-
- /*!
- * \brief Multiply streams of complex values
- * \param vlen Vector length
- * \ingroup math_blk
- */
- static sptr make(size_t vlen=1);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_CC_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const.h
index 9cb2823f46..c09f3ae79a 100644
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/multiply_const.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MULTIPLY_CONST_H
+#define MULTIPLY_CONST_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,32 +35,37 @@ namespace gr {
* \brief output = input * constant
* \ingroup math_operators_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API multiply_const : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::multiply_const::sptr
+ typedef boost::shared_ptr< multiply_const<T> > sptr;
/*!
- * \brief Create an instance of @NAME@
+ * \brief Create an instance of multiply_const
* \param k multiplicative constant
*/
- static sptr make(@O_TYPE@ k);
+ static sptr make(T k);
/*!
* \brief Return multiplicative constant
*/
- virtual @O_TYPE@ k() const = 0;
+ virtual T k() const = 0;
/*!
* \brief Set multiplicative constant
*/
- virtual void set_k(@O_TYPE@ k) = 0;
+ virtual void set_k(T k) = 0;
};
+typedef multiply_const<std::int16_t> multiply_const_ss;
+typedef multiply_const<std::int32_t> multiply_const_ii;
+typedef multiply_const<float> multiply_const_ff;
+typedef multiply_const<gr_complex> multiply_const_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME */
+#endif /* MULTIPLY_CONST_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h
deleted file mode 100644
index 3e8ed7c889..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_MULTIPLY_CONST_CC_H
-#define INCLUDED_MULTIPLY_CONST_CC_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = input * complex constant
- * \ingroup math_operators_blk
- */
- class BLOCKS_API multiply_const_cc : virtual public sync_block
- {
-
- public:
-
- // gr::blocks::multiply_const_cc::sptr
- typedef boost::shared_ptr<multiply_const_cc> sptr;
-
- /*!
- * \brief Create an instance of multiply_const_cc
- * \param k complex multiplicative constant
- * \param vlen Vector length of incoming stream
- */
- static sptr make(gr_complex k, size_t vlen=1);
-
- /*!
- * \brief Return complex multiplicative constant
- */
- virtual gr_complex k() const = 0;
-
- /*!
- * \brief Set complex multiplicative constant
- */
- virtual void set_k(gr_complex k) = 0;
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_CC_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h
deleted file mode 100644
index 5d93f04184..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef INCLUDED_MULTIPLY_CONST_FF_H
-#define INCLUDED_MULTIPLY_CONST_FF_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = input * real constant
- * \ingroup math_operators_blk
- */
- class BLOCKS_API multiply_const_ff : virtual public sync_block
- {
-
- public:
-
- // gr::blocks::multiply_const_ff::sptr
- typedef boost::shared_ptr<multiply_const_ff> sptr;
-
- /*!
- * \brief Create an instance of multiply_const_ff
- * \param k real multiplicative constant
- * \param vlen Vector length of incoming stream
- */
- static sptr make(float k, size_t vlen=1);
-
- /*!
- * \brief Return real multiplicative constant
- */
- virtual float k() const = 0;
-
- /*!
- * \brief Set real multiplicative constant
- */
- virtual void set_k(float k) = 0;
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_FF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const_v.h
index 608c52f78a..b1cc2dca36 100644
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/multiply_const_v.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MULTIPLY_CONST_V_H
+#define MULTIPLY_CONST_V_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,32 +34,37 @@ namespace gr {
* \brief output = input * constant vector (element-wise)
* \ingroup math_operators_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template <class T>
+ class BLOCKS_API multiply_const_v : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::multiply_const_v::sptr
+ typedef boost::shared_ptr< multiply_const_v<T> > sptr;
/*!
- * \brief Create an instance of @NAME@
+ * \brief Create an instance of multiply_const_v
* \param k multiplicative constant vector
*/
- static sptr make(std::vector<@O_TYPE@> k);
+ static sptr make(std::vector<T> k);
/*!
* \brief Return multiplicative constant vector
*/
- virtual std::vector<@O_TYPE@> k() const = 0;
+ virtual std::vector<T> k() const = 0;
/*!
* \brief Set multiplicative constant vector
*/
- virtual void set_k(std::vector<@O_TYPE@> k) = 0;
+ virtual void set_k(std::vector<T> k) = 0;
};
+ typedef multiply_const_v<std::int16_t> multiply_const_vss;
+ typedef multiply_const_v<std::int32_t> multiply_const_vii;
+ typedef multiply_const_v<float> multiply_const_vff;
+ typedef multiply_const_v<gr_complex> multiply_const_vcc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MULTIPLY_CONST_V_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h
deleted file mode 100644
index 78d2752751..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_MULTIPLY_CONST_VCC_H
-#define INCLUDED_MULTIPLY_CONST_VCC_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = input * constant vector (element-wise)
- * \ingroup math_operators_blk
- */
- class BLOCKS_API multiply_const_vcc : virtual public sync_block
- {
- public:
- // gr::blocks::multiply_const_vcc::sptr
- typedef boost::shared_ptr<multiply_const_vcc> sptr;
-
- /*!
- * \brief Create an instance of multiply_const_vcc
- * \param k multiplicative constant vector
- */
- static sptr make(std::vector<gr_complex> k);
-
- /*!
- * \brief Return multiplicative constant vector
- */
- virtual std::vector<gr_complex> k() const = 0;
-
- /*!
- * \brief Set multiplicative constant vector
- */
- virtual void set_k(std::vector<gr_complex> k) = 0;
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_VCC_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h b/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h
deleted file mode 100644
index 884088e288..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_MULTIPLY_CONST_VFF_H
-#define INCLUDED_MULTIPLY_CONST_VFF_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = input * constant vector (element-wise)
- * \ingroup math_operators_blk
- */
- class BLOCKS_API multiply_const_vff : virtual public sync_block
- {
- public:
- // gr::blocks::multiply_const_vff::sptr
- typedef boost::shared_ptr<multiply_const_vff> sptr;
-
- /*!
- * \brief Create an instance of multiply_const_vff
- * \param k multiplicative constant vector
- */
- static sptr make(std::vector<float> k);
-
- /*!
- * \brief Return multiplicative constant vector
- */
- virtual std::vector<float> k() const = 0;
-
- /*!
- * \brief Set multiplicative constant vector
- */
- virtual void set_k(std::vector<float> k) = 0;
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_VFF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_ff.h
deleted file mode 100644
index b6e3ed6ac9..0000000000
--- a/gr-blocks/include/gnuradio/blocks/multiply_ff.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_MULTIPLY_FF_H
-#define INCLUDED_GR_MULTIPLY_FF_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = prod (input_0, input_1, ...)
- * \ingroup math_operators_blk
- *
- * \details
- * Multiply across all input streams.
- */
- class BLOCKS_API multiply_ff : virtual public sync_block
- {
- public:
-
- // gr::blocks::multiply_ff::sptr
- typedef boost::shared_ptr<multiply_ff> sptr;
-
- /*!
- * \brief Multiply streams of float values
- * \param vlen Vector length
- * \ingroup math_blk
- */
- static sptr make(size_t vlen=1);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_FF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_matrix.h
index 710f7d343a..fba4930fcd 100644
--- a/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/multiply_matrix.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014, 2017 Free Software Foundation, Inc.
+ * Copyright 2014, 2017, 2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MULTIPLY_MATRIX_H
+#define MULTIPLY_MATRIX_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -53,10 +53,10 @@ namespace gr {
* to gr::block::TPP_CUSTOM, a tag is propagated from input \f$k\f$
* to output \f$l\f$, if \f$(A)_{l,k} \neq 0\f$.
*
- * \section blocks_matrixmult_msgports_@NAME@ Message Ports
+ * \section blocks_matrixmult_msgports_multiply_matrix Message Ports
*
* This block as one input message port (\p set_A). A message sent to this port will
- * be converted to a std::vector<std::vector<@O_TYPE@> >, and then passed on to set_A().
+ * be converted to a std::vector<std::vector<T> >, and then passed on to set_A().
* If no conversion is possible, a warning is issued via the logging interface, and
* A remains unchanged.
*
@@ -64,10 +64,11 @@ namespace gr {
* as this affects the I/O signature! If a matrix of invalid size is passed to the block,
* an alert is raised via the logging interface, and A remains unchanged.
*/
- class BLOCKS_API @NAME@ : virtual public gr::sync_block
+template<class T>
+ class BLOCKS_API multiply_matrix : virtual public gr::sync_block
{
public:
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< multiply_matrix<T> > sptr;
/*!
* \param A The matrix
@@ -79,19 +80,21 @@ namespace gr {
* output \f$l \iff (A)_{l,k} \neq 0\f$.
*/
static sptr make(
- std::vector<std::vector<@O_TYPE@> > A,
+ std::vector<std::vector<T> > A,
gr::block::tag_propagation_policy_t tag_propagation_policy=gr::block::TPP_ALL_TO_ALL
);
//! Returns the current matrix
- virtual const std::vector<std::vector<@O_TYPE@> >& get_A() const = 0;
+ virtual const std::vector<std::vector<T> >& get_A() const = 0;
//! Sets the matrix to a new value \p new_A. Returns true if the new matrix was valid and could be changed.
- virtual bool set_A(const std::vector<std::vector<@O_TYPE@> > &new_A) = 0;
+ virtual bool set_A(const std::vector<std::vector<T> > &new_A) = 0;
- static const std::string MSG_PORT_NAME_SET_A;
+ std::string MSG_PORT_NAME_SET_A;
};
+ typedef multiply_matrix<float> multiply_matrix_ff;
+ typedef multiply_matrix<gr_complex> multiply_matrix_cc;
} // namespace blocks
} // namespace gr
-#endif /* @GUARD_NAME */
+#endif /* MULTIPLY_MATRIX_H */
diff --git a/gr-blocks/include/gnuradio/blocks/mute_XX.h.t b/gr-blocks/include/gnuradio/blocks/mute.h
index ab246c54b5..1d5f3a3e22 100644
--- a/gr-blocks/include/gnuradio/blocks/mute_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/mute.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef MUTE_H
+#define MUTE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,11 +35,11 @@ namespace gr {
* \brief output = input or zero if muted.
* \ingroup level_controllers_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API mute_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< mute_blk<T> > sptr;
static sptr make(bool mute=false);
@@ -47,8 +47,12 @@ namespace gr {
virtual void set_mute(bool mute=false) = 0;
};
+typedef mute_blk<std::int16_t> mute_ss;
+typedef mute_blk<std::int32_t> mute_ii;
+typedef mute_blk<float> mute_ff;
+typedef mute_blk<gr_complex> mute_cc;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* MUTE_H */
diff --git a/gr-blocks/include/gnuradio/blocks/not_XX.h.t b/gr-blocks/include/gnuradio/blocks/not_blk.h
index 1164c1f855..7484e127e5 100644
--- a/gr-blocks/include/gnuradio/blocks/not_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/not_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef NOT_BLK_H
+#define NOT_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -37,17 +37,20 @@ namespace gr {
*
* bitwise boolean not of input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API not_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< not_blk<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef not_blk<std::uint8_t> not_bb;
+typedef not_blk<std::int16_t> not_ss;
+typedef not_blk<std::int32_t> not_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* NOT_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/or_XX.h.t b/gr-blocks/include/gnuradio/blocks/or_blk.h
index fbc691c5ed..d84925bd13 100644
--- a/gr-blocks/include/gnuradio/blocks/or_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/or_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef OR_BLK_H
+#define OR_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
@@ -37,17 +35,21 @@ namespace gr {
*
* Bitwise boolean or across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template<class T>
+ class BLOCKS_API or_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::or_blk::sptr
+ typedef boost::shared_ptr<or_blk<T> > sptr;
static sptr make(size_t vlen=1);
};
+ typedef or_blk<short> or_ss;
+ typedef or_blk<int> or_ii;
+ typedef or_blk<char> or_bb;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* OR_BLK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h
index 98b7df2658..0a9c0d7c3c 100644
--- a/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2013 Free Software Foundation, Inc.
+ * Copyright 2006,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,14 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PACKED_TO_UNPACKED_H
+#define PACKED_TO_UNPACKED_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/block.h>
#include <gnuradio/endianness.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -37,7 +37,7 @@ namespace gr {
* \ingroup byte_operators_blk
*
* \details
- * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ * input: stream of T; output: stream of T
*
* This is the inverse of gr::blocks::unpacked_to_packed_XX.
*
@@ -58,17 +58,21 @@ namespace gr {
* \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc.
* \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc.
*/
- class BLOCKS_API @NAME@ : virtual public block
+template<class T>
+ class BLOCKS_API packed_to_unpacked : virtual public block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::packed_to_unpacked::sptr
+ typedef boost::shared_ptr< packed_to_unpacked<T> > sptr;
static sptr make(unsigned int bits_per_chunk,
endianness_t endianness);
};
+typedef packed_to_unpacked<std::uint8_t> packed_to_unpacked_bb;
+typedef packed_to_unpacked<std::int16_t> packed_to_unpacked_ss;
+typedef packed_to_unpacked<std::int32_t> packed_to_unpacked_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PACKED_TO_UNPACKED_H */
diff --git a/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t b/gr-blocks/include/gnuradio/blocks/peak_detector.h
index 6e151c0cbd..4cc7dbd627 100644
--- a/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/peak_detector.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PEAK_DETECTOR_H
+#define PEAK_DETECTOR_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -39,11 +38,11 @@ namespace gr {
* If a peak is detected, this block outputs a 1,
* or it outputs 0's.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template <class T>
+ class BLOCKS_API peak_detector : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< peak_detector<T> > sptr;
/*!
* Make a peak detector block.
@@ -112,7 +111,11 @@ namespace gr {
virtual float alpha() = 0;
};
+ typedef peak_detector<float> peak_detector_fb;
+ typedef peak_detector<std::int32_t> peak_detector_ib;
+ typedef peak_detector<std::int16_t> peak_detector_sb;
+
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PEAK_DETECTOR_H */
diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal.h
index 5b45fd2864..39754ed7a0 100644
--- a/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t
+++ b/gr-blocks/include/gnuradio/blocks/probe_signal.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2005,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PROBE_SIGNAL_H
+#define PROBE_SIGNAL_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -35,18 +35,24 @@ namespace gr {
* \brief Sink that allows a sample to be grabbed from Python.
* \ingroup measurement_tools_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API probe_signal : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::probe_signal::sptr
+ typedef boost::shared_ptr< probe_signal<T> > sptr;
static sptr make();
- virtual @TYPE@ level() const = 0;
+ virtual T level() const = 0;
};
+typedef probe_signal<std::uint8_t> probe_signal_b;
+typedef probe_signal<std::int16_t> probe_signal_s;
+typedef probe_signal<std::int32_t> probe_signal_i;
+typedef probe_signal<float> probe_signal_f;
+typedef probe_signal<gr_complex> probe_signal_c;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PROBE_SIGNAL_H */
diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal_v.h
index 9f24731663..2d088cbd5f 100644
--- a/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/probe_signal_v.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2005,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PROBE_SIGNAL_V_H
+#define PROBE_SIGNAL_V_H
#include <vector>
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -37,18 +36,24 @@ namespace gr {
* \ingroup sink_blk
* \ingroup measurement_tools_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+ template <class T>
+ class BLOCKS_API probe_signal_v : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< probe_signal_v<T> > sptr;
static sptr make(size_t size);
- virtual std::vector<@TYPE@> level() const = 0;
+ virtual std::vector<T> level() const = 0;
};
+ typedef probe_signal_v<std::uint8_t> probe_signal_vb;
+ typedef probe_signal_v<std::int16_t> probe_signal_vs;
+ typedef probe_signal_v<std::int32_t> probe_signal_vi;
+ typedef probe_signal_v<float> probe_signal_vf;
+ typedef probe_signal_v<gr_complex> probe_signal_vc;
+
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PROBE_SIGNAL_V_H */
diff --git a/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t b/gr-blocks/include/gnuradio/blocks/sample_and_hold.h
index a87ae0f423..a6172a75c5 100644
--- a/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/sample_and_hold.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SAMPLE_AND_HOLD_H
+#define SAMPLE_AND_HOLD_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -39,16 +39,21 @@ namespace gr {
* Samples the data stream (input stream 0) and holds the value if
* the control signal is 1 (intput stream 1).
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API sample_and_hold : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::sample_and_hold::sptr
+ typedef boost::shared_ptr< sample_and_hold<T> > sptr;
static sptr make();
};
+typedef sample_and_hold<std::uint8_t> sample_and_hold_bb;
+typedef sample_and_hold<std::int16_t> sample_and_hold_ss;
+typedef sample_and_hold<std::int32_t> sample_and_hold_ii;
+typedef sample_and_hold<float> sample_and_hold_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SAMPLE_AND_HOLD_H */
diff --git a/gr-blocks/include/gnuradio/blocks/sub_XX.h.t b/gr-blocks/include/gnuradio/blocks/sub.h
index 44da6e16c4..942cd727d2 100644
--- a/gr-blocks/include/gnuradio/blocks/sub_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/sub.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SUB_H
+#define SUB_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,17 +38,22 @@ namespace gr {
* \details
* Subtract across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API sub : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::sub::sptr
+ typedef boost::shared_ptr< sub<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef sub<std::int16_t> sub_ss;
+typedef sub<std::int32_t> sub_ii;
+typedef sub<gr_complex> sub_cc;
+typedef sub<float> sub_ff;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SUB_H */
diff --git a/gr-blocks/include/gnuradio/blocks/sub_ff.h b/gr-blocks/include/gnuradio/blocks/sub_ff.h
deleted file mode 100644
index 3cc844f888..0000000000
--- a/gr-blocks/include/gnuradio/blocks/sub_ff.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_SUB_FF_H
-#define INCLUDED_BLOCKS_SUB_FF_H
-
-#include <gnuradio/blocks/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace blocks {
-
- /*!
- * \brief output = input_0 - input_1 - ...)
- * \ingroup math_operators_blk
- *
- * \details
- * Subtract across all input streams.
- */
- class BLOCKS_API sub_ff : virtual public sync_block
- {
- public:
- // gr::blocks::sub_ff::sptr
- typedef boost::shared_ptr<sub_ff> sptr;
-
- static sptr make(size_t vlen=1);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_SUB_FF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/tsb_vector_sink_X.h.t b/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h
index 03cc37afd2..7d0d3ff981 100644
--- a/gr-blocks/include/gnuradio/blocks/tsb_vector_sink_X.h.t
+++ b/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef TSB_VECTOR_SINK_H
+#define TSB_VECTOR_SINK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/tagged_stream_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -38,13 +38,14 @@ namespace gr {
*
* \ingroup blocks
*/
- class BLOCKS_API @NAME@ : virtual public gr::tagged_stream_block
+template<class T>
+ class BLOCKS_API tsb_vector_sink : virtual public gr::tagged_stream_block
{
public:
- typedef boost::shared_ptr<@NAME@> sptr;
+ typedef boost::shared_ptr< tsb_vector_sink<T> > sptr;
virtual void reset() = 0;
- virtual std::vector<std::vector<@TYPE@> > data() const = 0;
+ virtual std::vector<std::vector<T> > data() const = 0;
/*! Doesn't include the TSB tags.
*/
virtual std::vector<tag_t> tags() const = 0;
@@ -55,9 +56,14 @@ namespace gr {
*/
static sptr make(int vlen=1, const std::string &tsb_key="ts_last");
};
+ typedef tsb_vector_sink<std::uint8_t> tsb_vector_sink_b;
+ typedef tsb_vector_sink<std::uint32_t> tsb_vector_sink_i;
+ typedef tsb_vector_sink<std::uint16_t> tsb_vector_sink_s;
+ typedef tsb_vector_sink<float> tsb_vector_sink_f;
+ typedef tsb_vector_sink<gr_complex> tsb_vector_sink_c;
} // namespace blocks
} // namespace gr
-#endif /* @GUARD_NAME@ */
+#endif /* TSB_VECTOR_SINK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h
index 194d79e0d2..d23ff6cc12 100644
--- a/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2013 Free Software Foundation, Inc.
+ * Copyright 2006,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,14 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef UNPACKED_TO_PACKED_H
+#define UNPACKED_TO_PACKED_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/block.h>
#include <gnuradio/endianness.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -37,7 +37,7 @@ namespace gr {
* \ingroup byte_operators_blk
*
* \details
- * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ * input: stream of T; output: stream of T
*
* This is the inverse of gr::blocks::packed_to_unpacked_XX.
*
@@ -57,17 +57,21 @@ namespace gr {
* \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc.
* \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc.
*/
- class BLOCKS_API @NAME@ : virtual public block
+template<class T>
+ class BLOCKS_API unpacked_to_packed : virtual public block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::unpacked_to_packed::sptr
+ typedef boost::shared_ptr< unpacked_to_packed<T> > sptr;
static sptr make(unsigned int bits_per_chunk,
endianness_t endianness);
};
+typedef unpacked_to_packed<std::uint8_t> unpacked_to_packed_bb;
+typedef unpacked_to_packed<std::int16_t> unpacked_to_packed_ss;
+typedef unpacked_to_packed<std::int32_t> unpacked_to_packed_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* UNPACKED_TO_PACKED_H */
diff --git a/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_insert.h
index 73330b175b..cce50ed445 100644
--- a/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t
+++ b/gr-blocks/include/gnuradio/blocks/vector_insert.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012-2013 Free Software Foundation, Inc.
+ * Copyright 2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,26 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VECTOR_INSERT_H
+#define VECTOR_INSERT_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
/*!
- * \brief source of @TYPE@'s that gets its data from a vector
+ * \brief source of T's that gets its data from a vector
* \ingroup stream_operators_blk
*/
- class BLOCKS_API @NAME@ : virtual public block
+template<class T>
+ class BLOCKS_API vector_insert : virtual public block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::vector_insert::sptr
+ typedef boost::shared_ptr< vector_insert<T> > sptr;
/*!
* Make vector insert block.
@@ -48,14 +49,19 @@ namespace gr {
* \param periodicity number of samples between when to send \p data
* \param offset initial item offset of first insert
*/
- static sptr make(const std::vector<@TYPE@> &data,
+ static sptr make(const std::vector<T> &data,
int periodicity, int offset=0);
virtual void rewind() = 0;
- virtual void set_data(const std::vector<@TYPE@> &data) = 0;
+ virtual void set_data(const std::vector<T> &data) = 0;
};
+typedef vector_insert<std::uint8_t> vector_insert_b;
+typedef vector_insert<std::int16_t> vector_insert_s;
+typedef vector_insert<std::int32_t> vector_insert_i;
+typedef vector_insert<float> vector_insert_f;
+typedef vector_insert<gr_complex> vector_insert_c;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VECTOR_INSERT_H */
diff --git a/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_sink.h
index a4ef38fd04..cd75e8da87 100644
--- a/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t
+++ b/gr-blocks/include/gnuradio/blocks/vector_sink.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,36 +20,42 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VECTOR_SINK_H
+#define VECTOR_SINK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
/*!
- * \brief @TYPE@ sink that writes to a vector
+ * \brief T sink that writes to a vector
* \ingroup debug_tools_blk
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API vector_sink : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::vector_sink::sptr
+ typedef boost::shared_ptr< vector_sink<T> > sptr;
static sptr make(int vlen = 1);
//! Clear the data and tags containers.
virtual void reset() = 0;
- virtual std::vector<@TYPE@> data() const = 0;
+ virtual std::vector<T> data() const = 0;
virtual std::vector<tag_t> tags() const = 0;
};
+typedef vector_sink<std::uint8_t> vector_sink_b;
+typedef vector_sink<std::int16_t> vector_sink_s;
+typedef vector_sink<std::int32_t> vector_sink_i;
+typedef vector_sink<float> vector_sink_f;
+typedef vector_sink<gr_complex> vector_sink_c;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VECTOR_SINK_H */
diff --git a/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_source.h
index b0ca6b869f..189bdadb4b 100644
--- a/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t
+++ b/gr-blocks/include/gnuradio/blocks/vector_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,24 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VECTOR_SOURCE_H
+#define VECTOR_SOURCE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
/*!
- * \brief Source that streams @TYPE@ items based on the input \p data vector.
+ * \brief Source that streams T items based on the input \p data vector.
* \ingroup misc_blk
*
* \details
* This block produces a stream of samples based on an input
- * vector. In C++, this is a std::vector<@TYPE@>, and in Python,
+ * vector. In C++, this is a std::vector<T>, and in Python,
* this is either a list or tuple. The data can repeat infinitely
* until the flowgraph is terminated by some other event or, the
* default, run the data once and stop.
@@ -63,23 +63,29 @@ namespace gr {
* offset of 0, that tag will be placed on item 0, 500, 1000,
* 1500, etc.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API vector_source : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::vector_source::sptr
+ typedef boost::shared_ptr< vector_source<T> > sptr;
- static sptr make(const std::vector<@TYPE@> &data,
+ static sptr make(const std::vector<T> &data,
bool repeat=false, int vlen=1,
const std::vector<tag_t> &tags=std::vector<tag_t>());
virtual void rewind() = 0;
- virtual void set_data(const std::vector<@TYPE@> &data,
+ virtual void set_data(const std::vector<T> &data,
const std::vector<tag_t> &tags=std::vector<tag_t>()) = 0;
virtual void set_repeat(bool repeat) = 0;
};
+typedef vector_source<std::uint8_t> vector_source_b;
+typedef vector_source<std::int16_t> vector_source_s;
+typedef vector_source<std::int32_t> vector_source_i;
+typedef vector_source<float> vector_source_f;
+typedef vector_source<gr_complex> vector_source_c;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VECTOR_SOURCE_H */
diff --git a/gr-blocks/include/gnuradio/blocks/xor_XX.h.t b/gr-blocks/include/gnuradio/blocks/xor_blk.h
index e58866f03e..3113a0703c 100644
--- a/gr-blocks/include/gnuradio/blocks/xor_XX.h.t
+++ b/gr-blocks/include/gnuradio/blocks/xor_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef XOR_BLK_H
+#define XOR_BLK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace blocks {
@@ -37,17 +37,21 @@ namespace gr {
*
* Bitwise boolean xor across all input streams.
*/
- class BLOCKS_API @NAME@ : virtual public sync_block
+template<class T>
+ class BLOCKS_API xor_blk : virtual public sync_block
{
public:
- // gr::blocks::@NAME@::sptr
- typedef boost::shared_ptr<@NAME@> sptr;
+ // gr::blocks::xor::sptr
+ typedef boost::shared_ptr< xor_blk<T> > sptr;
static sptr make(size_t vlen=1);
};
+typedef xor_blk<std::uint8_t> xor_bb;
+typedef xor_blk<std::int16_t> xor_ss;
+typedef xor_blk<std::int32_t> xor_ii;
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* XOR_BLK_H */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 5cc2e1e1da..49e7307658 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -23,40 +23,6 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
########################################################################
-# Invoke macro to generate various sources
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H_IMPL(blocks abs_XX ss ii ff)
-GR_EXPAND_X_CC_H_IMPL(blocks add_XX ss ii cc)
-GR_EXPAND_X_CC_H_IMPL(blocks add_const_vXX bb ss ii ff cc)
-GR_EXPAND_X_CC_H_IMPL(blocks and_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks and_const_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks argmax_XX fs is ss)
-GR_EXPAND_X_CC_H_IMPL(blocks divide_XX ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks integrate_XX ss ii ff cc)
-GR_EXPAND_X_CC_H_IMPL(blocks max_XX ss ii ff)
-GR_EXPAND_X_CC_H_IMPL(blocks min_XX ss ii ff)
-GR_EXPAND_X_CC_H_IMPL(blocks moving_average_XX ss ii ff cc)
-GR_EXPAND_X_CC_H_IMPL(blocks multiply_XX ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_XX ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_vXX ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks mute_XX ss ii ff cc)
-GR_EXPAND_X_CC_H_IMPL(blocks not_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks or_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks peak_detector_XX fb ib sb)
-GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_X b s i f c)
-GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_vX b s i f c)
-GR_EXPAND_X_CC_H_IMPL(blocks sample_and_hold_XX bb ss ii ff)
-GR_EXPAND_X_CC_H_IMPL(blocks sub_XX ss ii cc)
-GR_EXPAND_X_CC_H_IMPL(blocks tsb_vector_sink_X b s i f c)
-GR_EXPAND_X_CC_H_IMPL(blocks xor_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks packed_to_unpacked_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks unpacked_to_packed_XX bb ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks vector_insert_X b s i f c)
-GR_EXPAND_X_CC_H_IMPL(blocks vector_sink_X b s i f c)
-GR_EXPAND_X_CC_H_IMPL(blocks vector_source_X b s i f c)
-
-########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
@@ -78,14 +44,40 @@ endif(ENABLE_GR_CTRLPORT)
# Setup library
########################################################################
list(APPEND gr_blocks_sources
- ${generated_sources}
+ abs_blk_impl.cc
+ add_blk_impl.cc
+ add_const_v_impl.cc
+ and_blk_impl.cc
+ and_const_impl.cc
+ argmax_impl.cc
+ divide_impl.cc
+ integrate_impl.cc
+ max_blk_impl.cc
+ min_blk_impl.cc
+ moving_average_impl.cc
+ multiply_const_impl.cc
+ multiply_impl.cc
+ mute_impl.cc
+ not_blk_impl.cc
+ packed_to_unpacked_impl.cc
+ peak_detector_impl.cc
+ probe_signal_impl.cc
+ probe_signal_v_impl.cc
+ sample_and_hold_impl.cc
+ sub_impl.cc
+ tsb_vector_sink_impl.cc
+ unpacked_to_packed_impl.cc
+ vector_insert_impl.cc
+ vector_sink_impl.cc
+ vector_source_impl.cc
+ xor_blk_impl.cc
+ or_blk_impl.cc
control_loop.cc
count_bits.cc
file_sink_base.cc
pack_k_bits.cc
unpack_k_bits.cc
wavfile.cc
- add_ff_impl.cc
add_const_bb_impl.cc
add_const_ss_impl.cc
add_const_ii_impl.cc
@@ -111,8 +103,6 @@ list(APPEND gr_blocks_sources
conjugate_cc_impl.cc
copy_impl.cc
deinterleave_impl.cc
- divide_cc_impl.cc
- divide_ff_impl.cc
delay_impl.cc
endian_swap_impl.cc
exponentiate_const_cci_impl.cc
@@ -142,15 +132,9 @@ list(APPEND gr_blocks_sources
message_debug_impl.cc
message_strobe_impl.cc
message_strobe_random_impl.cc
- multiply_cc_impl.cc
- multiply_ff_impl.cc
multiply_conjugate_cc_impl.cc
- multiply_const_cc_impl.cc
- multiply_const_vcc_impl.cc
- multiply_const_ff_impl.cc
- multiply_const_vff_impl.cc
- multiply_matrix_cc_impl.cc
- multiply_matrix_ff_impl.cc
+ multiply_const_v_impl.cc
+ multiply_matrix_impl.cc
multiply_by_tag_value_cc_impl.cc
nlog10_ff_impl.cc
nop_impl.cc
@@ -186,7 +170,6 @@ list(APPEND gr_blocks_sources
streams_to_stream_impl.cc
streams_to_vector_impl.cc
stretch_ff_impl.cc
- sub_ff_impl.cc
tag_share_impl.cc
tagged_file_sink_impl.cc
tagged_stream_to_pdu_impl.cc
@@ -252,7 +235,6 @@ list(APPEND blocks_libs
)
add_library(gnuradio-blocks SHARED ${gr_blocks_sources})
-add_dependencies(gnuradio-blocks blocks_generated_includes)
target_link_libraries(gnuradio-blocks ${blocks_libs})
GR_LIBRARY_FOO(gnuradio-blocks)
@@ -278,7 +260,7 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-blocks_static STATIC ${gr_blocks_sources})
- add_dependencies(gnuradio-blocks_static blocks_generated_includes)
+ add_dependencies(gnuradio-blocks_static)
if(NOT WIN32)
set_target_properties(gnuradio-blocks_static
diff --git a/gr-blocks/lib/abs_XX_impl.cc.t b/gr-blocks/lib/abs_blk_impl.cc
index 195d8dff3d..aab0c8552a 100644
--- a/gr-blocks/lib/abs_XX_impl.cc.t
+++ b/gr-blocks/lib/abs_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,46 +20,51 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "abs_blk_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(size_t vlen)
+ template <class T>
+ typename abs_blk<T>::sptr abs_blk<T>::make(size_t vlen)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ return gnuradio::get_initial_sptr(new abs_blk_impl<T> (vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
+ template <class T>
+ abs_blk_impl<T> ::abs_blk_impl (size_t vlen)
+ : sync_block("abs_blk",
+ io_signature::make (1, 1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
d_vlen(vlen)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ abs_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ T *iptr = (T *) input_items[0];
+ T *optr = (T *) output_items[0];
for(size_t i=0; i<noutput_items*d_vlen; i++) {
- @I_TYPE@ val = iptr[i];
- optr[i] = ((val < ((@I_TYPE@)0)) ? -val : val);
+ T val = iptr[i];
+ optr[i] = ((val < ((T)0)) ? -val : val);
}
return noutput_items;
}
+template class abs_blk<std::int16_t>;
+template class abs_blk<std::int32_t>;
+template class abs_blk<float>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/add_XX_impl.h.t b/gr-blocks/lib/abs_blk_impl.h
index 22292b9fa5..787a056767 100644
--- a/gr-blocks/lib/add_XX_impl.h.t
+++ b/gr-blocks/lib/abs_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,23 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef ABS_BLK_IMPL_H
+#define ABS_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/abs_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+ class BLOCKS_API abs_blk_impl : public abs_blk<T>
{
private:
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ abs_blk_impl(size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -46,4 +46,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* ABS_BLK_IMPL_H */
diff --git a/gr-blocks/lib/add_XX_impl.cc.t b/gr-blocks/lib/add_XX_impl.cc.t
deleted file mode 100644
index a88398d89b..0000000000
--- a/gr-blocks/lib/add_XX_impl.cc.t
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int ninputs = input_items.size ();
-
- for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- for (int j = 1; j < ninputs; j++)
- acc += ((@I_TYPE@ *) input_items[j])[i];
-
- *optr++ = (@O_TYPE@) acc;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/add_blk_impl.cc b/gr-blocks/lib/add_blk_impl.cc
new file mode 100644
index 0000000000..9cda4d080e
--- /dev/null
+++ b/gr-blocks/lib/add_blk_impl.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "add_blk_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ typename add_blk<T>::sptr add_blk<T>::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new add_blk_impl<T> (vlen));
+ }
+
+
+ template <>
+ add_blk_impl<float>::add_blk_impl(size_t vlen)
+ : sync_block("add_ff",
+ io_signature::make (1, -1, sizeof(float)*vlen),
+ io_signature::make (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ template <>
+ int
+ add_blk_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_add_32f(out, out, (const float*)input_items[i], noi);
+ return noutput_items;
+ }
+
+
+
+ template <class T>
+ add_blk_impl<T> ::add_blk_impl (size_t vlen)
+ : sync_block ("add_blk",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <class T>
+ int
+ add_blk_impl<T> ::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *optr = (T *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ T acc = ((T *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc += ((T *) input_items[j])[i];
+
+ *optr++ = (T) acc;
+ }
+
+ return noutput_items;
+ }
+
+template class add_blk<std::int16_t>;
+template class add_blk<std::int32_t>;
+template class add_blk<gr_complex>;
+template class add_blk<float>;
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/abs_XX_impl.h.t b/gr-blocks/lib/add_blk_impl.h
index fa96c84073..74f3e1bac1 100644
--- a/gr-blocks/lib/abs_XX_impl.h.t
+++ b/gr-blocks/lib/add_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,23 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef ADD_BLK_IMPL_H
+#define ADD_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/add_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+class BLOCKS_API add_blk_impl : public add_blk<T>
{
private:
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ add_blk_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -46,4 +46,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* ADD_BLK_IMPL_H */
diff --git a/gr-blocks/lib/add_const_vXX_impl.cc.t b/gr-blocks/lib/add_const_v_impl.cc
index 28471ddeb1..38a4883485 100644
--- a/gr-blocks/lib/add_const_vXX_impl.cc.t
+++ b/gr-blocks/lib/add_const_v_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,40 +20,41 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <add_const_v_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(std::vector<@O_TYPE@> k)
+ template <class T>
+ typename add_const_v<T>::sptr add_const_v<T>::make(std::vector<T> k)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ return gnuradio::get_initial_sptr(new add_const_v_impl<T>(k));
}
- @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)*k.size()),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*k.size())),
+ template <class T>
+ add_const_v_impl<T>::add_const_v_impl(std::vector<T> k)
+ : sync_block ("add_const_v",
+ io_signature::make (1, 1, sizeof (T)*k.size()),
+ io_signature::make (1, 1, sizeof (T)*k.size())),
d_k(k)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ add_const_v_impl<T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@ *)input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+ T *iptr = (T *)input_items[0];
+ T *optr = (T *)output_items[0];
- int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@);
+ int nitems_per_block = this->output_signature()->sizeof_stream_item(0)/sizeof(T);
for (int i = 0; i < noutput_items; i++)
for (int j = 0; j < nitems_per_block; j++)
@@ -62,5 +63,10 @@ namespace gr {
return noutput_items;
}
+ template class add_const_v<std::uint8_t>;
+ template class add_const_v<std::int16_t>;
+ template class add_const_v<std::int32_t>;
+ template class add_const_v<float>;
+ template class add_const_v<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/add_const_vXX_impl.h.t b/gr-blocks/lib/add_const_v_impl.h
index 6c087d9461..1257ec08a0 100644
--- a/gr-blocks/lib/add_const_vXX_impl.h.t
+++ b/gr-blocks/lib/add_const_v_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,25 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef ADD_CONST_V_IMPL_H
+#define ADD_CONST_V_IMPL_H
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/add_const_v.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ template <class T>
+ class BLOCKS_API add_const_v_impl: public add_const_v<T>
{
- std::vector<@O_TYPE@> d_k;
+ std::vector<T> d_k;
public:
- @NAME_IMPL@(std::vector<@O_TYPE@> k);
+ add_const_v_impl(std::vector<T> k);
- std::vector<@O_TYPE@> k() const { return d_k; }
- void set_k(std::vector<@O_TYPE@> k) { d_k = k; }
+ std::vector<T> k() const { return d_k; }
+ void set_k(std::vector<T> k) { d_k = k; }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -48,4 +47,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* ADD_CONST_V_IMPL_H */
diff --git a/gr-blocks/lib/add_ff_impl.cc b/gr-blocks/lib/add_ff_impl.cc
deleted file mode 100644
index e99b121816..0000000000
--- a/gr-blocks/lib/add_ff_impl.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "add_ff_impl.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- add_ff::sptr add_ff::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new add_ff_impl(vlen));
- }
-
- add_ff_impl::add_ff_impl(size_t vlen)
- : sync_block("add_ff",
- io_signature::make (1, -1, sizeof(float)*vlen),
- io_signature::make (1, 1, sizeof(float)*vlen)),
- d_vlen(vlen)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1, alignment_multiple));
- }
-
- int
- add_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- float *out = (float *) output_items[0];
- int noi = d_vlen*noutput_items;
-
- memcpy(out, input_items[0], noi*sizeof(float));
- for(size_t i = 1; i < input_items.size(); i++)
- volk_32f_x2_add_32f(out, out, (const float*)input_items[i], noi);
- return noutput_items;
- }
-
- } /* namespace blocks */
-}/* namespace gr */
diff --git a/gr-blocks/lib/divide_XX_impl.cc.t b/gr-blocks/lib/and_blk_impl.cc
index 052b09217a..f0f329dae4 100644
--- a/gr-blocks/lib/divide_XX_impl.cc.t
+++ b/gr-blocks/lib/and_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,50 +20,55 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "and_blk_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(size_t vlen)
+ template <class T>
+ typename and_blk<T>::sptr and_blk<T>::make(size_t vlen)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ return gnuradio::get_initial_sptr(new and_blk_impl<T> (vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
+ template <class T>
+ and_blk_impl<T> ::and_blk_impl (size_t vlen)
+ : sync_block ("and_blk",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
d_vlen(vlen)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ and_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ T *optr = (T *) output_items[0];
int ninputs = input_items.size ();
for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ T acc = ((T *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
- acc /= ((@I_TYPE@ *) input_items[j])[i];
+ acc &= ((T *) input_items[j])[i];
- *optr++ = (@O_TYPE@) acc;
+ *optr++ = (T) acc;
}
return noutput_items;
}
+template class and_blk<std::uint8_t>;
+template class and_blk<std::int16_t>;
+template class and_blk<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/and_XX_impl.h.t b/gr-blocks/lib/and_blk_impl.h
index f7db3f2162..54d721111e 100644
--- a/gr-blocks/lib/and_XX_impl.h.t
+++ b/gr-blocks/lib/and_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,22 +20,22 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef AND_BLK_IMPL_H
+#define AND_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/and_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+ class BLOCKS_API and_blk_impl : public and_blk<T>
{
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ and_blk_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -45,4 +45,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* AND_BLK_IMPL_H */
diff --git a/gr-blocks/lib/and_const_XX_impl.cc.t b/gr-blocks/lib/and_const_impl.cc
index 975dd9334a..d319f0c25e 100644
--- a/gr-blocks/lib/and_const_XX_impl.cc.t
+++ b/gr-blocks/lib/and_const_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,38 +20,40 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <and_const_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(@O_TYPE@ k)
+ template <class T>
+ typename and_const<T>::sptr and_const<T>::make(T k)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ return gnuradio::get_initial_sptr(new and_const_impl<T> (k));
}
- @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)),
- io_signature::make (1, 1, sizeof (@O_TYPE@))),
+ template <class T>
+ and_const_impl<T> ::and_const_impl (T k)
+ : sync_block ("and_const",
+ io_signature::make (1, 1, sizeof (T)),
+ io_signature::make (1, 1, sizeof (T))),
d_k(k)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ and_const_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ T *iptr = (T *) input_items[0];
+ T *optr = (T *) output_items[0];
int size = noutput_items;
@@ -73,5 +75,8 @@ namespace gr {
return noutput_items;
}
+template class and_const<std::uint8_t>;
+template class and_const<std::int16_t>;
+template class and_const<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/and_const_impl.h b/gr-blocks/lib/and_const_impl.h
new file mode 100644
index 0000000000..3af7651e22
--- /dev/null
+++ b/gr-blocks/lib/and_const_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef AND_CONST_IMPL_H
+#define AND_CONST_IMPL_H
+
+#include <gnuradio/blocks/and_const.h>
+
+namespace gr {
+ namespace blocks {
+
+template<class T>
+ class BLOCKS_API and_const_impl : public and_const<T>
+ {
+ T d_k;
+
+ public:
+ and_const_impl (T k);
+
+ T k() const { return d_k; }
+ void set_k(T k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* AND_CONST_IMPL_H */
diff --git a/gr-blocks/lib/argmax_XX_impl.cc.t b/gr-blocks/lib/argmax_impl.cc
index 87e025e2d7..b3fd548aee 100644
--- a/gr-blocks/lib/argmax_XX_impl.cc.t
+++ b/gr-blocks/lib/argmax_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,67 +20,72 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "argmax_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(size_t vlen)
+ template <class T>
+ typename argmax<T>::sptr
+ argmax<T>::make(size_t vlen)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(vlen));
+ (new argmax_impl<T>(vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)),
- io_signature::make(2, 2, sizeof(@O_TYPE@))),
+ template <class T>
+ argmax_impl<T>::argmax_impl(size_t vlen)
+ : sync_block("argmax",
+ io_signature::make(1, -1, vlen*sizeof(T)),
+ io_signature::make(2, 2, sizeof(std::int16_t))),
d_vlen(vlen)
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ argmax_impl<T>::~argmax_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ argmax_impl<T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
int ninputs = input_items.size ();
- @O_TYPE@ *x_optr = (@O_TYPE@ *)output_items[0];
- @O_TYPE@ *y_optr = (@O_TYPE@ *)output_items[1];
+ std::int16_t *x_optr = (std::int16_t *)output_items[0];
+ std::int16_t *y_optr = (std::int16_t *)output_items[1];
for(int i = 0; i < noutput_items; i++) {
- @I_TYPE@ max = ((@I_TYPE@ *)input_items[0])[i*d_vlen];
+ T max = ((T *)input_items[0])[i*d_vlen];
int x = 0;
int y = 0;
for(int j = 0; j < (int)d_vlen; j++ ) {
for(int k = 0; k < ninputs; k++) {
- if(((@I_TYPE@ *)input_items[k])[i*d_vlen + j] > max) {
- max = ((@I_TYPE@ *)input_items[k])[i*d_vlen + j];
+ if(((T *)input_items[k])[i*d_vlen + j] > max) {
+ max = ((T *)input_items[k])[i*d_vlen + j];
x = j;
y = k;
}
}
}
- *x_optr++ = (@O_TYPE@)x;
- *y_optr++ = (@O_TYPE@)y;
+ *x_optr++ = (std::int16_t)x;
+ *y_optr++ = (std::int16_t)y;
}
return noutput_items;
}
+ template class argmax<float>;
+ template class argmax<std::int32_t>;
+ template class argmax<std::int16_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/argmax_XX_impl.h.t b/gr-blocks/lib/argmax_impl.h
index 79da4e1d82..e6609930dc 100644
--- a/gr-blocks/lib/argmax_XX_impl.h.t
+++ b/gr-blocks/lib/argmax_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,24 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef ARGMAX_IMPL_H
+#define ARGMAX_IMPL_H
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/argmax.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+ template <class T>
+ class argmax_impl : public argmax<T>
{
private:
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
- ~@NAME_IMPL@();
+ argmax_impl(size_t vlen);
+ ~argmax_impl();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -47,4 +46,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* ARGMAX_IMPL_H */
diff --git a/gr-blocks/lib/divide_cc_impl.cc b/gr-blocks/lib/divide_cc_impl.cc
deleted file mode 100644
index 56ce09e04c..0000000000
--- a/gr-blocks/lib/divide_cc_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004-2016 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <divide_cc_impl.h>
-#include <volk/volk.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- divide_cc::sptr divide_cc::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new divide_cc_impl(vlen));
- }
-
- divide_cc_impl::divide_cc_impl(size_t vlen)
- : sync_block ("divide_cc",
- io_signature::make (2, -1, sizeof (gr_complex)*vlen),
- io_signature::make (1, 1, sizeof (gr_complex)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- divide_cc_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr_complex *optr = (gr_complex *) output_items[0];
- size_t ninputs = input_items.size ();
- gr_complex *numerator = (gr_complex *) input_items[0];
- for(size_t inp = 1; inp < ninputs; ++inp)
- {
- volk_32fc_x2_divide_32fc(optr, numerator, (gr_complex*) input_items[inp], noutput_items * d_vlen);
- numerator = optr;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/divide_ff_impl.cc b/gr-blocks/lib/divide_ff_impl.cc
deleted file mode 100644
index 5bd5f88d84..0000000000
--- a/gr-blocks/lib/divide_ff_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004-2016 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <divide_ff_impl.h>
-#include <volk/volk.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- divide_ff::sptr divide_ff::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new divide_ff_impl(vlen));
- }
-
- divide_ff_impl::divide_ff_impl(size_t vlen)
- : sync_block ("divide_ff",
- io_signature::make (2, -1, sizeof (float)*vlen),
- io_signature::make (1, 1, sizeof (float)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- divide_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- float *optr = (float *) output_items[0];
- size_t ninputs = input_items.size ();
- float *numerator = (float *) input_items[0];
- for(size_t inp = 1; inp < ninputs; ++inp)
- {
- volk_32f_x2_divide_32f(optr, numerator, (float*) input_items[inp], noutput_items * d_vlen);
- numerator = optr;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/divide_impl.cc b/gr-blocks/lib/divide_impl.cc
new file mode 100644
index 0000000000..5fe08f95d1
--- /dev/null
+++ b/gr-blocks/lib/divide_impl.cc
@@ -0,0 +1,130 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "divide_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ typename divide<T>::sptr divide<T>::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new divide_impl<T> (vlen));
+ }
+
+ template <>
+ divide_impl<float>::divide_impl(size_t vlen)
+ : sync_block ("divide",
+ io_signature::make (2, -1, sizeof (float)*vlen),
+ io_signature::make (1, 1, sizeof (float)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <>
+ int
+ divide_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *optr = (float *) output_items[0];
+ size_t ninputs = input_items.size ();
+ float *numerator = (float *) input_items[0];
+ for(size_t inp = 1; inp < ninputs; ++inp)
+ {
+ volk_32f_x2_divide_32f(optr, numerator, (float*) input_items[inp], noutput_items * d_vlen);
+ numerator = optr;
+ }
+
+ return noutput_items;
+ }
+
+ template <>
+ divide_impl<gr_complex>::divide_impl(size_t vlen)
+ : sync_block ("divide_cc",
+ io_signature::make (2, -1, sizeof (gr_complex)*vlen),
+ io_signature::make (1, 1, sizeof (gr_complex)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <>
+ int
+ divide_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *optr = (gr_complex *) output_items[0];
+ size_t ninputs = input_items.size ();
+ gr_complex *numerator = (gr_complex *) input_items[0];
+ for(size_t inp = 1; inp < ninputs; ++inp)
+ {
+ volk_32fc_x2_divide_32fc(optr, numerator, (gr_complex*) input_items[inp], noutput_items * d_vlen);
+ numerator = optr;
+ }
+
+ return noutput_items;
+ }
+
+ template <class T>
+ divide_impl<T> ::divide_impl (size_t vlen)
+ : sync_block ("divide",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <class T>
+ int
+ divide_impl<T> ::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *optr = (T *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ T acc = ((T *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc /= ((T *) input_items[j])[i];
+
+ *optr++ = (T) acc;
+ }
+
+ return noutput_items;
+ }
+
+template class divide<std::int16_t>;
+template class divide<std::int32_t>;
+ template class divide<float>;
+ template class divide<gr_complex>;
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/divide_cc_impl.h b/gr-blocks/lib/divide_impl.h
index 2bcd698818..cc9045c711 100644
--- a/gr-blocks/lib/divide_cc_impl.h
+++ b/gr-blocks/lib/divide_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004-2016 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,20 +21,21 @@
*/
-#ifndef __DIVIDE_CC_IMPL_H__
-#define __DIVIDE_CC_IMPL_H__
+#ifndef DIVIDE_IMPL_H
+#define DIVIDE_IMPL_H
-#include <gnuradio/blocks/divide_cc.h>
+#include <gnuradio/blocks/divide.h>
namespace gr {
namespace blocks {
- class BLOCKS_API divide_cc_impl : public divide_cc
+template<class T>
+ class BLOCKS_API divide_impl : public divide<T>
{
size_t d_vlen;
public:
- divide_cc_impl(size_t vlen);
+ divide_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -44,4 +45,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* include guard */
+#endif /* DIVIDE_IMPL_H */
diff --git a/gr-blocks/lib/integrate_XX_impl.cc.t b/gr-blocks/lib/integrate_impl.cc
index cb7a448ced..3c2cf022cb 100644
--- a/gr-blocks/lib/integrate_XX_impl.cc.t
+++ b/gr-blocks/lib/integrate_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,44 +20,46 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <integrate_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(int decim, int vlen)
+ template <class T>
+ typename integrate<T>::sptr integrate<T>::make(int decim, int vlen)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(decim, vlen));
+ return gnuradio::get_initial_sptr(new integrate_impl<T> (decim, vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(int decim, int vlen)
- : sync_decimator("@NAME@",
- io_signature::make(1, 1, sizeof (@I_TYPE@) * vlen),
- io_signature::make(1, 1, sizeof (@O_TYPE@) * vlen),
+ template <class T>
+ integrate_impl<T> ::integrate_impl(int decim, int vlen)
+ : sync_decimator("integrate",
+ io_signature::make(1, 1, sizeof (T) * vlen),
+ io_signature::make(1, 1, sizeof (T) * vlen),
decim),
d_decim(decim),
d_vlen(vlen)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ integrate_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
+ const T *in = (const T *)input_items[0];
+ T *out = (T *)output_items[0];
for (int i = 0; i < noutput_items; i++) {
for (int j = 0; j < d_vlen; ++j) {
- out[i*d_vlen + j] = (@O_TYPE@)0;
+ out[i*d_vlen + j] = (T)0;
}
for (int j = 0; j < d_decim; j++) {
for (int k = 0; k < d_vlen; ++k) {
@@ -69,5 +71,9 @@ namespace gr {
return noutput_items;
}
+template class integrate<std::int16_t>;
+template class integrate<std::int32_t>;
+template class integrate<float>;
+template class integrate<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/integrate_XX_impl.h.t b/gr-blocks/lib/integrate_impl.h
index 67e6fce43a..efe475e103 100644
--- a/gr-blocks/lib/integrate_XX_impl.h.t
+++ b/gr-blocks/lib/integrate_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,23 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef INTEGRATE_IMPL_H
+#define INTEGRATE_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/integrate.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+class BLOCKS_API integrate_impl : public integrate<T>
{
int d_decim;
int d_vlen;
public:
- @NAME_IMPL@(int decim, int vlen);
+ integrate_impl (int decim, int vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -46,4 +46,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* INTEGRATE_IMPL_H */
diff --git a/gr-blocks/lib/max_XX_impl.cc.t b/gr-blocks/lib/max_blk_impl.cc
index 36c97260ae..eef6366804 100644
--- a/gr-blocks/lib/max_XX_impl.cc.t
+++ b/gr-blocks/lib/max_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,77 +20,83 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <max_blk_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(size_t vlen, size_t vlen_out)
+ template <class T>
+ typename max_blk<T>::sptr
+ max_blk<T>::make(size_t vlen, size_t vlen_out)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(vlen,vlen_out));
+ (new max_blk_impl<T> (vlen,vlen_out));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen, size_t vlen_out)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)),
- io_signature::make(1, 1, vlen_out*sizeof(@O_TYPE@))),
+ template <class T>
+ max_blk_impl<T> ::max_blk_impl(size_t vlen, size_t vlen_out)
+ : sync_block("max_blk",
+ io_signature::make(1, -1, vlen*sizeof(T)),
+ io_signature::make(1, 1, vlen_out*sizeof(T))),
d_vlen(vlen), d_vlen_out(vlen_out)
{
assert((vlen_out == vlen) || (vlen_out == 1));
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ max_blk_impl<T> ::~max_blk_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ max_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+ T *optr = (T *)output_items[0];
int ninputs = input_items.size();
if(d_vlen_out == 1)
for(int i = 0; i < noutput_items; i++) {
- @I_TYPE@ max = ((@I_TYPE@ *)input_items[0])[i*d_vlen];
+ T max = ((T *)input_items[0])[i*d_vlen];
for(int j = 0; j < (int)d_vlen; j++ ) {
for(int k = 0; k < ninputs; k++) {
- if(((@I_TYPE@ *)input_items[k])[i*d_vlen + j] > max) {
- max = ((@I_TYPE@*)input_items[k])[i*d_vlen + j];
+ if(((T *)input_items[k])[i*d_vlen + j] > max) {
+ max = ((T*)input_items[k])[i*d_vlen + j];
}
}
}
- *optr++ = (@O_TYPE@)max;
+ *optr++ = (T)max;
}
else // vector mode output
for(size_t i = 0; i < (size_t)noutput_items * d_vlen_out; i++) {
- @I_TYPE@ max = ((@I_TYPE@ *)input_items[0])[i];
+ T max = ((T *)input_items[0])[i];
for(int k = 1; k < ninputs; k++) {
- if(((@I_TYPE@ *)input_items[k])[i] > max) {
- max = ((@I_TYPE@*)input_items[k])[i];
+ if(((T *)input_items[k])[i] > max) {
+ max = ((T*)input_items[k])[i];
}
}
- *optr++ = (@O_TYPE@)max;
+ *optr++ = (T)max;
}
return noutput_items;
}
+template class max_blk<std::int16_t>;
+template class max_blk<std::int32_t>;
+template class max_blk<float>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/min_XX_impl.h.t b/gr-blocks/lib/max_blk_impl.h
index c829ab0514..af62d9f4a8 100644
--- a/gr-blocks/lib/min_XX_impl.h.t
+++ b/gr-blocks/lib/max_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,24 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef MAX_BLK_IMPL_H
+#define MAX_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/max_blk.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class max_blk_impl : public max_blk<T>
{
private:
size_t d_vlen, d_vlen_out;
public:
- @NAME_IMPL@(size_t vlen, size_t vlen_out);
- ~@NAME_IMPL@();
+ max_blk_impl (size_t vlen, size_t vlen_out);
+ ~max_blk_impl ();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -47,4 +47,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* MAX_BLK_IMPL_H */
diff --git a/gr-blocks/lib/min_XX_impl.cc.t b/gr-blocks/lib/min_blk_impl.cc
index 0f7059f7cd..df3b6b0896 100644
--- a/gr-blocks/lib/min_XX_impl.cc.t
+++ b/gr-blocks/lib/min_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015,2016 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2016,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,77 +20,78 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <min_blk_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(size_t vlen, size_t vlen_out)
+ template <class T>
+ typename min_blk<T>::sptr
+ min_blk<T>::make(size_t vlen, size_t vlen_out)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(vlen,vlen_out));
+ (new min_blk_impl<T> (vlen,vlen_out));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen, size_t vlen_out)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)),
- io_signature::make(1, 1, vlen_out*sizeof(@O_TYPE@))),
+ template <class T>
+ min_blk_impl<T> ::min_blk_impl(size_t vlen, size_t vlen_out)
+ : sync_block("min",
+ io_signature::make(1, -1, vlen*sizeof(T)),
+ io_signature::make(1, 1, vlen_out*sizeof(T))),
d_vlen(vlen), d_vlen_out(vlen_out)
{
assert((vlen_out == vlen) || (vlen_out == 1));
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ min_blk_impl<T> ::~min_blk_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ min_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+ T *optr = (T *)output_items[0];
int ninputs = input_items.size();
if(d_vlen_out == 1)
for(int i = 0; i < noutput_items; i++) {
- @I_TYPE@ min = ((@I_TYPE@ *)input_items[0])[i*d_vlen];
-
+ T min = ((T *)input_items[0])[i*d_vlen];
for(int j = 0; j < (int)d_vlen; j++ ) {
for(int k = 0; k < ninputs; k++) {
- if(((@I_TYPE@ *)input_items[k])[i*d_vlen + j] < min) {
- min = ((@I_TYPE@*)input_items[k])[i*d_vlen + j];
+ if(((T *)input_items[k])[i*d_vlen + j] < min) {
+ min = ((T*)input_items[k])[i*d_vlen + j];
}
}
}
-
- *optr++ = (@O_TYPE@)min;
+ *optr++ = (T)min;
}
else // vector mode output
for(size_t i = 0; i < noutput_items * d_vlen_out; i++) {
- @I_TYPE@ min = ((@I_TYPE@ *)input_items[0])[i];
-
+ T min = ((T *)input_items[0])[i];
for(int k = 1; k < ninputs; k++) {
- if(((@I_TYPE@ *)input_items[k])[i] < min) {
- min = ((@I_TYPE@*)input_items[k])[i];
+ if(((T *)input_items[k])[i] < min) {
+ min = ((T*)input_items[k])[i];
}
}
-
- *optr++ = (@O_TYPE@)min;
+ *optr++ = (T)min;
}
-
return noutput_items;
}
+template class min_blk<std::int16_t>;
+template class min_blk<std::int32_t>;
+template class min_blk<float>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/max_XX_impl.h.t b/gr-blocks/lib/min_blk_impl.h
index c829ab0514..151b97b391 100644
--- a/gr-blocks/lib/max_XX_impl.h.t
+++ b/gr-blocks/lib/min_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014,2015 Free Software Foundation, Inc.
+ * Copyright 2014,2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,24 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef MIN_BLK_IMPL_H
+#define MIN_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/min_blk.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class min_blk_impl : public min_blk<T>
{
private:
size_t d_vlen, d_vlen_out;
public:
- @NAME_IMPL@(size_t vlen, size_t vlen_out);
- ~@NAME_IMPL@();
+ min_blk_impl (size_t vlen, size_t vlen_out);
+ ~min_blk_impl ();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -47,4 +47,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* MIN_BLK_IMPL_H */
diff --git a/gr-blocks/lib/moving_average_XX_impl.cc.t b/gr-blocks/lib/moving_average_impl.cc
index fe0a2bdebd..b77a70a440 100644
--- a/gr-blocks/lib/moving_average_XX_impl.cc.t
+++ b/gr-blocks/lib/moving_average_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2010,2013,2017 Free Software Foundation, Inc.
+ * Copyright 2008,2010,2013,2017,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,29 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME_IMPL@.h"
+#include "moving_average_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(int length, @O_TYPE@ scale, int max_iter, unsigned int vlen)
+ template <class T>
+ typename moving_average<T>::sptr
+ moving_average<T>::make(int length, T scale, int max_iter, unsigned int vlen)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(length, scale, max_iter, vlen));
+ (new moving_average_impl<T> (length, scale, max_iter, vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(int length, @O_TYPE@ scale, int max_iter, unsigned int vlen)
- : sync_block("@NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)*vlen),
- io_signature::make(1, 1, sizeof(@O_TYPE@)*vlen)),
+ template <class T>
+ moving_average_impl<T>::moving_average_impl(int length, T scale, int max_iter, unsigned int vlen)
+ : sync_block("moving_average",
+ io_signature::make(1, 1, sizeof(T)*vlen),
+ io_signature::make(1, 1, sizeof(T)*vlen)),
d_length(length),
d_scale(scale),
d_max_iter(max_iter),
@@ -51,59 +52,64 @@ namespace gr {
d_new_scale(scale),
d_updated(false)
{
- set_history(length);
+ this->set_history(length);
//we don't have C++11's <array>, so initialize the stored vector instead
//we store this vector so that work() doesn't spend its time allocating and freeing vector storage
if(d_vlen > 1) {
- d_sum = std::vector<@I_TYPE@>(d_vlen);
+ d_sum = std::vector<T>(d_vlen);
}
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ moving_average_impl<T> ::~moving_average_impl()
{
}
+ template <class T>
void
- @NAME_IMPL@::set_length_and_scale(int length, @O_TYPE@ scale)
+ moving_average_impl<T> ::set_length_and_scale(int length, T scale)
{
d_new_length = length;
d_new_scale = scale;
d_updated = true;
}
+ template <class T>
void
- @NAME_IMPL@::set_length(int length)
+ moving_average_impl<T> ::set_length(int length)
{
d_new_length = length;
d_updated = true;
}
+ template <class T>
void
- @NAME_IMPL@::set_scale(@O_TYPE@ scale)
+ moving_average_impl<T> ::set_scale(T scale)
{
d_new_scale = scale;
d_updated = true;
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ moving_average_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
if(d_updated) {
d_length = d_new_length;
d_scale = d_new_scale;
- set_history(d_length);
+ this->set_history(d_length);
d_updated = false;
return 0; // history requirements might have changed
}
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
+ const T *in = (const T *)input_items[0];
+ T *out = (T *)output_items[0];
unsigned int num_iter = (unsigned int)((noutput_items>d_max_iter) ? d_max_iter : noutput_items);
if(d_vlen == 1) {
- @I_TYPE@ sum = in[0];
+ T sum = in[0];
for(int i = 1; i < d_length-1; i++) {
sum += in[i];
}
@@ -137,5 +143,9 @@ namespace gr {
return num_iter;
}
+template class moving_average<std::int16_t>;
+template class moving_average<std::int32_t>;
+template class moving_average<float>;
+template class moving_average<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/moving_average_XX_impl.h.t b/gr-blocks/lib/moving_average_impl.h
index f90a666bbf..a4e248d05d 100644
--- a/gr-blocks/lib/moving_average_XX_impl.h.t
+++ b/gr-blocks/lib/moving_average_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2013,2017 Free Software Foundation, Inc.
+ * Copyright 2008,2013,2017-2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,45 +20,45 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef MOVING_AVERAGE_IMPL_H
+#define MOVING_AVERAGE_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/moving_average.h>
#include <vector>
#include <algorithm>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class moving_average_impl : public moving_average<T>
{
private:
int d_length;
- @O_TYPE@ d_scale;
+ T d_scale;
int d_max_iter;
unsigned int d_vlen;
- std::vector<@I_TYPE@> d_sum;
+ std::vector<T> d_sum;
int d_new_length;
- @O_TYPE@ d_new_scale;
+ T d_new_scale;
bool d_updated;
public:
- @NAME_IMPL@(int length, @O_TYPE@ scale,
+ moving_average_impl (int length, T scale,
int max_iter = 4096,
unsigned int vlen = 1);
- ~@NAME_IMPL@();
+ ~moving_average_impl ();
int length() const { return d_new_length; }
- @O_TYPE@ scale() const { return d_new_scale; }
+ T scale() const { return d_new_scale; }
unsigned int vlen() const { return d_vlen; }
- void set_length_and_scale(int length, @O_TYPE@ scale);
+ void set_length_and_scale(int length, T scale);
void set_length(int length);
- void set_scale(@O_TYPE@ scale);
+ void set_scale(T scale);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -69,4 +69,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* MOVING_AVERAGE_IMPL_H */
diff --git a/gr-blocks/lib/multiply_XX_impl.cc.t b/gr-blocks/lib/multiply_XX_impl.cc.t
deleted file mode 100644
index d9b41b3d9f..0000000000
--- a/gr-blocks/lib/multiply_XX_impl.cc.t
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int ninputs = input_items.size ();
-
- for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- for (int j = 1; j < ninputs; j++)
- acc *= ((@I_TYPE@ *) input_items[j])[i];
-
- *optr++ = (@O_TYPE@) acc;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_XX_impl.h.t b/gr-blocks/lib/multiply_XX_impl.h.t
deleted file mode 100644
index 2b0ea25a1b..0000000000
--- a/gr-blocks/lib/multiply_XX_impl.h.t
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
- {
- size_t d_vlen;
-
- public:
- @NAME_IMPL@(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_cc_impl.cc b/gr-blocks/lib/multiply_cc_impl.cc
deleted file mode 100644
index 1f58ffd386..0000000000
--- a/gr-blocks/lib/multiply_cc_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_cc_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_cc::sptr multiply_cc::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new multiply_cc_impl(vlen));
- }
-
- multiply_cc_impl::multiply_cc_impl(size_t vlen)
- : sync_block("multiply_cc",
- io_signature::make (1, -1, sizeof(gr_complex)*vlen),
- io_signature::make (1, 1, sizeof(gr_complex)*vlen)),
- d_vlen(vlen)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1, alignment_multiple));
- }
-
- int
- multiply_cc_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr_complex *out = (gr_complex *) output_items[0];
- int noi = d_vlen*noutput_items;
-
- memcpy(out, input_items[0], noi*sizeof(gr_complex));
- for(size_t i = 1; i < input_items.size(); i++)
- volk_32fc_x2_multiply_32fc(out, out, (gr_complex*)input_items[i], noi);
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-}/* namespace gr */
diff --git a/gr-blocks/lib/multiply_cc_impl.h b/gr-blocks/lib/multiply_cc_impl.h
deleted file mode 100644
index 86b4334bf8..0000000000
--- a/gr-blocks/lib/multiply_cc_impl.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H
-
-#include <gnuradio/blocks/multiply_cc.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_cc_impl : public multiply_cc
- {
- size_t d_vlen;
-
- public:
- multiply_cc_impl(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_XX_impl.cc.t b/gr-blocks/lib/multiply_const_XX_impl.cc.t
deleted file mode 100644
index 941cb9622e..0000000000
--- a/gr-blocks/lib/multiply_const_XX_impl.cc.t
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(@O_TYPE@ k)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)),
- io_signature::make (1, 1, sizeof (@O_TYPE@))),
- d_k(k)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int size = noutput_items;
-
- while (size >= 8){
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- *optr++ = *iptr++ * d_k;
- size -= 8;
- }
-
- while (size-- > 0)
- *optr++ = *iptr++ * d_k;
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_XX_impl.h.t b/gr-blocks/lib/multiply_const_XX_impl.h.t
deleted file mode 100644
index e0c2ae54bc..0000000000
--- a/gr-blocks/lib/multiply_const_XX_impl.h.t
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
- {
- @O_TYPE@ d_k;
-
- public:
- @NAME_IMPL@(@O_TYPE@ k);
-
- @O_TYPE@ k() const { return d_k; }
- void set_k(@O_TYPE@ k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_const_cc_impl.cc b/gr-blocks/lib/multiply_const_cc_impl.cc
deleted file mode 100644
index e7c5e3b08e..0000000000
--- a/gr-blocks/lib/multiply_const_cc_impl.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012,2015 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_const_cc_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_const_cc::sptr multiply_const_cc::make(gr_complex k, size_t vlen)
- {
- return gnuradio::get_initial_sptr(new multiply_const_cc_impl(k, vlen));
- }
-
- multiply_const_cc_impl::multiply_const_cc_impl(gr_complex k, size_t vlen)
- : sync_block ("multiply_const_cc",
- io_signature::make (1, 1, sizeof (gr_complex)*vlen),
- io_signature::make (1, 1, sizeof (gr_complex)*vlen)),
- d_k(k), d_vlen(vlen)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1,alignment_multiple));
- }
-
- int
- multiply_const_cc_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const gr_complex *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
- int noi = d_vlen*noutput_items;
-
- volk_32fc_s32fc_multiply_32fc(out, in, d_k, noi);
-
- return noutput_items;
- }
-
- void
- multiply_const_cc_impl::setup_rpc()
- {
-#ifdef GR_CTRLPORT
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<multiply_const_cc, gr_complex>(
- alias(), "Constant",
- &multiply_const_cc::k,
- pmt::from_complex(-1024.0f, 0.0f),
- pmt::from_complex(1024.0f, 0.0f),
- pmt::from_complex(0.0f, 0.0f),
- "", "Constant to multiply", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTCPLX | DISPOPTSTRIP)));
-
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_set<multiply_const_cc, gr_complex>(
- alias(), "Constant",
- &multiply_const_cc::set_k,
- pmt::from_complex(-1024.0f, 0.0f),
- pmt::from_complex(1024.0f, 0.0f),
- pmt::from_complex(0.0f, 0.0f),
- "", "Constant to multiply",
- RPC_PRIVLVL_MIN, DISPNULL)));
-#endif /* GR_CTRLPORT */
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_cc_impl.h b/gr-blocks/lib/multiply_const_cc_impl.h
deleted file mode 100644
index 06f60b13dc..0000000000
--- a/gr-blocks/lib/multiply_const_cc_impl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_MULTIPLY_CONST_CC_IMPL_H
-#define INCLUDED_MULTIPLY_CONST_CC_IMPL_H
-
-#include <gnuradio/blocks/multiply_const_cc.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_const_cc_impl : public multiply_const_cc
- {
- gr_complex d_k;
- size_t d_vlen;
-
- public:
- multiply_const_cc_impl(gr_complex k, size_t vlen);
-
- void setup_rpc();
-
- gr_complex k() const { return d_k; }
- void set_k(gr_complex k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_CC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_ff_impl.cc b/gr-blocks/lib/multiply_const_ff_impl.cc
deleted file mode 100644
index c5d0ce1e9a..0000000000
--- a/gr-blocks/lib/multiply_const_ff_impl.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012,2015 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_const_ff_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_const_ff::sptr multiply_const_ff::make(float k, size_t vlen)
- {
- return gnuradio::get_initial_sptr(new multiply_const_ff_impl(k, vlen));
- }
-
- multiply_const_ff_impl::multiply_const_ff_impl(float k, size_t vlen)
- : sync_block ("multiply_const_ff",
- io_signature::make (1, 1, sizeof (float)*vlen),
- io_signature::make (1, 1, sizeof (float)*vlen)),
- d_k(k), d_vlen(vlen)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1,alignment_multiple));
- }
-
- int
- multiply_const_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const float *in = (const float *) input_items[0];
- float *out = (float *) output_items[0];
- int noi = d_vlen*noutput_items;
-
- volk_32f_s32f_multiply_32f(out, in, d_k, noi);
-
- return noutput_items;
- }
-
- void
- multiply_const_ff_impl::setup_rpc()
- {
-#ifdef GR_CTRLPORT
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<multiply_const_ff, float>(
- alias(), "coefficient",
- &multiply_const_ff::k,
- pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
- "", "Coefficient", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTSTRIP)));
-
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_set<multiply_const_ff, float>(
- alias(), "coefficient",
- &multiply_const_ff::set_k,
- pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
- "", "Coefficient",
- RPC_PRIVLVL_MIN, DISPNULL)));
-#endif /* GR_CTRLPORT */
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_ff_impl.h b/gr-blocks/lib/multiply_const_ff_impl.h
deleted file mode 100644
index 4eb1c19f76..0000000000
--- a/gr-blocks/lib/multiply_const_ff_impl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef INCLUDED_MULTIPLY_CONST_FF_IMPL_H
-#define INCLUDED_MULTIPLY_CONST_FF_IMPL_H
-
-#include <gnuradio/blocks/multiply_const_ff.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_const_ff_impl : public multiply_const_ff
- {
- float d_k;
- size_t d_vlen;
-
- public:
- multiply_const_ff_impl(float k, size_t vlen);
-
- void setup_rpc();
-
- float k() const { return d_k; }
- void set_k(float k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_MULTIPLY_CONST_FF_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_impl.cc b/gr-blocks/lib/multiply_const_impl.cc
new file mode 100644
index 0000000000..bfdd88ed04
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_impl.cc
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "multiply_const_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ typename multiply_const<T>::sptr multiply_const<T>::make(T k)
+ {
+ return gnuradio::get_initial_sptr(new multiply_const_impl<T> (k));
+ }
+
+ template <>
+ multiply_const_impl<float>::multiply_const_impl(float k)
+ : sync_block ("multiply_const_ff",
+ io_signature::make (1, 1, sizeof (float)),
+ io_signature::make (1, 1, sizeof (float))),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ template<>
+ int
+ multiply_const_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items;
+
+ volk_32f_s32f_multiply_32f(out, in, d_k, noi);
+
+ return noutput_items;
+ }
+
+ template <>
+ multiply_const_impl<gr_complex>::multiply_const_impl(gr_complex k)
+ : sync_block ("multiply_const_cc",
+ io_signature::make (1, 1, sizeof (gr_complex)),
+ io_signature::make (1, 1, sizeof (gr_complex))),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ template <>
+ int
+ multiply_const_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = noutput_items;
+
+ volk_32fc_s32fc_multiply_32fc(out, in, d_k, noi);
+
+ return noutput_items;
+ }
+
+
+ template <class T>
+ multiply_const_impl<T> ::multiply_const_impl(T k)
+ : sync_block ("multiply_const",
+ io_signature::make (1, 1, sizeof (T)),
+ io_signature::make (1, 1, sizeof (T))),
+ d_k(k)
+ {
+ }
+
+ template <class T>
+ int
+ multiply_const_impl<T> ::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *iptr = (T *) input_items[0];
+ T *optr = (T *) output_items[0];
+
+ int size = noutput_items;
+
+ while (size >= 8){
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ size -= 8;
+ }
+
+ while (size-- > 0)
+ *optr++ = *iptr++ * d_k;
+
+ return noutput_items;
+ }
+
+template class multiply_const<std::int16_t>;
+template class multiply_const<std::int32_t>;
+template class multiply_const<float>;
+template class multiply_const<gr_complex>;
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/and_const_XX_impl.h.t b/gr-blocks/lib/multiply_const_impl.h
index 186fda9508..c2cc388845 100644
--- a/gr-blocks/lib/and_const_XX_impl.h.t
+++ b/gr-blocks/lib/multiply_const_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,25 +20,25 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef MULTIPLY_CONST_IMPL_H
+#define MULTIPLY_CONST_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/multiply_const.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+ class BLOCKS_API multiply_const_impl : public multiply_const<T>
{
- @O_TYPE@ d_k;
+ T d_k;
public:
- @NAME_IMPL@(@O_TYPE@ k);
+ multiply_const_impl (T k);
- @O_TYPE@ k() const { return d_k; }
- void set_k(@O_TYPE@ k) { d_k = k; }
+ T k() const { return d_k; }
+ void set_k(T k) { d_k = k; }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -48,4 +48,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* MULTIPLY_CONST_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_vXX_impl.cc.t b/gr-blocks/lib/multiply_const_vXX_impl.cc.t
deleted file mode 100644
index 2de0684144..0000000000
--- a/gr-blocks/lib/multiply_const_vXX_impl.cc.t
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(std::vector<@O_TYPE@> k)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)*k.size()),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*k.size())),
- d_k(k)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @I_TYPE@ *iptr = (@I_TYPE@ *)input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
-
- int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@);
-
- for (int i = 0; i < noutput_items; i++)
- for (int j = 0; j < nitems_per_block; j++)
- *optr++ = *iptr++ * d_k[j];
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vXX_impl.h.t b/gr-blocks/lib/multiply_const_vXX_impl.h.t
deleted file mode 100644
index 6c087d9461..0000000000
--- a/gr-blocks/lib/multiply_const_vXX_impl.h.t
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
- {
- std::vector<@O_TYPE@> d_k;
-
- public:
- @NAME_IMPL@(std::vector<@O_TYPE@> k);
-
- std::vector<@O_TYPE@> k() const { return d_k; }
- void set_k(std::vector<@O_TYPE@> k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_const_v_impl.cc b/gr-blocks/lib/multiply_const_v_impl.cc
new file mode 100644
index 0000000000..24c4a99b78
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_v_impl.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_const_v_impl.h>
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ typename multiply_const_v<T>::sptr multiply_const_v<T>::make(std::vector<T> k)
+ {
+ return gnuradio::get_initial_sptr(new multiply_const_v_impl<T>(k));
+ }
+
+ template <>
+ multiply_const_v_impl<float>::multiply_const_v_impl(std::vector<float> k)
+ : sync_block("multiply_const_vff",
+ io_signature::make(1, 1, sizeof(float)*k.size()),
+ io_signature::make(1, 1, sizeof(float)*k.size())),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ template <>
+ int
+ multiply_const_v_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *iptr = (float*)input_items[0];
+ float *optr = (float*)output_items[0];
+
+ int nitems_per_block = this->output_signature()->sizeof_stream_item(0)/sizeof(float);
+
+ for(int i = 0; i < noutput_items; i++) {
+ for(int j = 0; j < nitems_per_block; j++) {
+ *optr++ = *iptr++ * d_k[j];
+ }
+ }
+
+ return noutput_items;
+ }
+
+ template <>
+ multiply_const_v_impl<gr_complex>::multiply_const_v_impl(std::vector<gr_complex> k)
+ : sync_block("multiply_const_vcc",
+ io_signature::make(1, 1, sizeof(gr_complex)*k.size()),
+ io_signature::make(1, 1, sizeof(gr_complex)*k.size())),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ template <>
+ int
+ multiply_const_v_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *iptr = (gr_complex*)input_items[0];
+ gr_complex *optr = (gr_complex*)output_items[0];
+
+ int nitems_per_block = this->output_signature()->sizeof_stream_item(0)/sizeof(gr_complex);
+
+ for(int i = 0; i < noutput_items; i++) {
+ for(int j = 0; j < nitems_per_block; j++) {
+ *optr++ = *iptr++ * d_k[j];
+ }
+ }
+
+ return noutput_items;
+ }
+
+
+
+ template <class T>
+ multiply_const_v_impl<T>::multiply_const_v_impl(std::vector<T> k)
+ : sync_block ("multiply_const_v<T>",
+ io_signature::make (1, 1, sizeof (T)*k.size()),
+ io_signature::make (1, 1, sizeof (T)*k.size())),
+ d_k(k)
+ {
+ }
+
+ template <class T>
+ int
+ multiply_const_v_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *iptr = (T *)input_items[0];
+ T *optr = (T *)output_items[0];
+
+ int nitems_per_block = this->output_signature()->sizeof_stream_item(0)/sizeof(T);
+
+ for (int i = 0; i < noutput_items; i++)
+ for (int j = 0; j < nitems_per_block; j++)
+ *optr++ = *iptr++ * d_k[j];
+
+ return noutput_items;
+ }
+
+ template class multiply_const_v<std::int16_t>;
+ template class multiply_const_v<std::int32_t>;
+ template class multiply_const_v<float>;
+ template class multiply_const_v<gr_complex>;
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_v_impl.h b/gr-blocks/lib/multiply_const_v_impl.h
new file mode 100644
index 0000000000..a329c12dd3
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_v_impl.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef MULTIPLY_CONST_V_IMPL_H
+#define MULTIPLY_CONST_V_IMPL_H
+
+#include <gnuradio/blocks/multiply_const_v.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ class BLOCKS_API multiply_const_v_impl : public multiply_const_v<T>
+ {
+ std::vector<T> d_k;
+
+ public:
+ multiply_const_v_impl(std::vector<T> k);
+
+ std::vector<T> k() const { return d_k; }
+ void set_k(std::vector<T> k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* MULTIPLY_CONST_V_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_vcc_impl.cc b/gr-blocks/lib/multiply_const_vcc_impl.cc
deleted file mode 100644
index b793ec7ddb..0000000000
--- a/gr-blocks/lib/multiply_const_vcc_impl.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014-2015 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_const_vcc_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_const_vcc::sptr
- multiply_const_vcc::make(std::vector<gr_complex> k)
- {
- return gnuradio::get_initial_sptr
- (new multiply_const_vcc_impl(k));
- }
-
- multiply_const_vcc_impl::multiply_const_vcc_impl(std::vector<gr_complex> k)
- : sync_block("multiply_const_vcc",
- io_signature::make(1, 1, sizeof(gr_complex)*k.size()),
- io_signature::make(1, 1, sizeof(gr_complex)*k.size())),
- d_k(k)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1,alignment_multiple));
- }
-
- int
- multiply_const_vcc_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr_complex *iptr = (gr_complex*)input_items[0];
- gr_complex *optr = (gr_complex*)output_items[0];
-
- int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(gr_complex);
-
- for(int i = 0; i < noutput_items; i++) {
- for(int j = 0; j < nitems_per_block; j++) {
- *optr++ = *iptr++ * d_k[j];
- }
- }
-
- return noutput_items;
- }
-
- void
- multiply_const_vcc_impl::setup_rpc()
- {
-#ifdef GR_CTRLPORT
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vcc,
- std::vector<gr_complex> >(
- alias(), "coefficient",
- &multiply_const_vcc::k,
- pmt::from_complex(-1024.0f),
- pmt::from_complex(1024.0f),
- pmt::from_complex(0.0f),
- "", "Coefficient", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTSTRIP)));
-
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vcc,
- std::vector<gr_complex> >(
- alias(), "coefficient",
- &multiply_const_vcc::set_k,
- pmt::from_complex(-1024.0f),
- pmt::from_complex(1024.0f),
- pmt::from_complex(0.0f),
- "", "Coefficient",
- RPC_PRIVLVL_MIN, DISPNULL)));
-#endif /* GR_CTRLPORT */
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vcc_impl.h b/gr-blocks/lib/multiply_const_vcc_impl.h
deleted file mode 100644
index c3fc5885b0..0000000000
--- a/gr-blocks/lib/multiply_const_vcc_impl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_MULTIPLY_CONST_VCC_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_CONST_VCC_IMPL_H
-
-#include <gnuradio/blocks/multiply_const_vcc.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_const_vcc_impl : public multiply_const_vcc
- {
- private:
- std::vector<gr_complex> d_k;
-
- public:
- multiply_const_vcc_impl(std::vector<gr_complex> k);
-
- void setup_rpc();
-
- std::vector<gr_complex> k() const { return d_k; }
- void set_k(std::vector<gr_complex> k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_CONST_VCC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_vff_impl.cc b/gr-blocks/lib/multiply_const_vff_impl.cc
deleted file mode 100644
index 6a4719e5d3..0000000000
--- a/gr-blocks/lib/multiply_const_vff_impl.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014-2015 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_const_vff_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_const_vff::sptr
- multiply_const_vff::make(std::vector<float> k)
- {
- return gnuradio::get_initial_sptr
- (new multiply_const_vff_impl(k));
- }
-
- multiply_const_vff_impl::multiply_const_vff_impl(std::vector<float> k)
- : sync_block("multiply_const_vff",
- io_signature::make(1, 1, sizeof(float)*k.size()),
- io_signature::make(1, 1, sizeof(float)*k.size())),
- d_k(k)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1,alignment_multiple));
- }
-
- int
- multiply_const_vff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- float *iptr = (float*)input_items[0];
- float *optr = (float*)output_items[0];
-
- int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(float);
-
- for(int i = 0; i < noutput_items; i++) {
- for(int j = 0; j < nitems_per_block; j++) {
- *optr++ = *iptr++ * d_k[j];
- }
- }
-
- return noutput_items;
- }
-
- void
- multiply_const_vff_impl::setup_rpc()
- {
-#ifdef GR_CTRLPORT
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vff,
- std::vector<float> >(
- alias(), "coefficient",
- &multiply_const_vff::k,
- pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
- "", "Coefficient", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTSTRIP)));
-
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vff,
- std::vector<float> >(
- alias(), "coefficient",
- &multiply_const_vff::set_k,
- pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
- "", "Coefficient",
- RPC_PRIVLVL_MIN, DISPNULL)));
-#endif /* GR_CTRLPORT */
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vff_impl.h b/gr-blocks/lib/multiply_const_vff_impl.h
deleted file mode 100644
index ca555669ed..0000000000
--- a/gr-blocks/lib/multiply_const_vff_impl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_MULTIPLY_CONST_VFF_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_CONST_VFF_IMPL_H
-
-#include <gnuradio/blocks/multiply_const_vff.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_const_vff_impl : public multiply_const_vff
- {
- private:
- std::vector<float> d_k;
-
- public:
- multiply_const_vff_impl(std::vector<float> k);
-
- void setup_rpc();
-
- std::vector<float> k() const { return d_k; }
- void set_k(std::vector<float> k) { d_k = k; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_CONST_VFF_IMPL_H */
diff --git a/gr-blocks/lib/multiply_ff_impl.cc b/gr-blocks/lib/multiply_ff_impl.cc
deleted file mode 100644
index edc0749f2c..0000000000
--- a/gr-blocks/lib/multiply_ff_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <multiply_ff_impl.h>
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace blocks {
-
- multiply_ff::sptr multiply_ff::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new multiply_ff_impl(vlen));
- }
-
- multiply_ff_impl::multiply_ff_impl(size_t vlen)
- : sync_block("multiply_ff",
- io_signature::make (1, -1, sizeof(float)*vlen),
- io_signature::make (1, 1, sizeof(float)*vlen)),
- d_vlen(vlen)
- {
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1, alignment_multiple));
- }
-
- int
- multiply_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- float *out = (float *) output_items[0];
- int noi = d_vlen*noutput_items;
-
- memcpy(out, input_items[0], noi*sizeof(float));
- for(size_t i = 1; i < input_items.size(); i++)
- volk_32f_x2_multiply_32f(out, out, (float*)input_items[i], noi);
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-}/* namespace gr */
diff --git a/gr-blocks/lib/multiply_ff_impl.h b/gr-blocks/lib/multiply_ff_impl.h
deleted file mode 100644
index 1213eef842..0000000000
--- a/gr-blocks/lib/multiply_ff_impl.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H
-
-#include <gnuradio/blocks/multiply_ff.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API multiply_ff_impl : public multiply_ff
- {
- size_t d_vlen;
-
- public:
- multiply_ff_impl(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H */
diff --git a/gr-blocks/lib/multiply_impl.cc b/gr-blocks/lib/multiply_impl.cc
new file mode 100644
index 0000000000..22845251fb
--- /dev/null
+++ b/gr-blocks/lib/multiply_impl.cc
@@ -0,0 +1,132 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "multiply_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ template <class T>
+ typename multiply<T>::sptr multiply<T>::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_impl<T> (vlen));
+ }
+
+ template <>
+ multiply_impl<float>::multiply_impl(size_t vlen)
+ : sync_block("multiply_ff",
+ io_signature::make (1, -1, sizeof(float)*vlen),
+ io_signature::make (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ template<>
+ int
+ multiply_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_multiply_32f(out, out, (float*)input_items[i], noi);
+
+ return noutput_items;
+ }
+
+ template <>
+ multiply_impl<gr_complex>::multiply_impl(size_t vlen)
+ : sync_block("multiply_cc",
+ io_signature::make (1, -1, sizeof(gr_complex)*vlen),
+ io_signature::make (1, 1, sizeof(gr_complex)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ template <>
+ int
+ multiply_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(gr_complex));
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32fc_x2_multiply_32fc(out, out, (gr_complex*)input_items[i], noi);
+
+ return noutput_items;
+ }
+
+ template <class T>
+ multiply_impl<T> ::multiply_impl(size_t vlen)
+ : sync_block ("multiply",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <class T>
+ int
+ multiply_impl<T> ::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *optr = (T *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ T acc = ((T *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc *= ((T *) input_items[j])[i];
+
+ *optr++ = (T) acc;
+ }
+
+ return noutput_items;
+ }
+
+template class multiply<std::int16_t>;
+template class multiply<std::int32_t>;
+template class multiply<gr_complex>;
+template class multiply<float>;
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/add_ff_impl.h b/gr-blocks/lib/multiply_impl.h
index 4683688399..7f75f85f9f 100644
--- a/gr-blocks/lib/add_ff_impl.h
+++ b/gr-blocks/lib/multiply_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,28 +20,28 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_BLOCKS_ADD_FF_IMPL_H
-#define INCLUDED_BLOCKS_ADD_FF_IMPL_H
-#include <gnuradio/blocks/add_ff.h>
+#ifndef MULTIPLY_IMPL_H
+#define MULTIPLY_IMPL_H
+
+#include <gnuradio/blocks/multiply.h>
namespace gr {
namespace blocks {
- class BLOCKS_API add_ff_impl : public add_ff
+template<class T>
+ class BLOCKS_API multiply_impl : public multiply<T>
{
size_t d_vlen;
public:
- add_ff_impl(size_t vlen);
+ multiply_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
-
} /* namespace blocks */
} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_ADD_FF_IMPL_H */
+#endif /* MULTIPLY_IMPL_H */
diff --git a/gr-blocks/lib/multiply_matrix_cc_impl.cc b/gr-blocks/lib/multiply_matrix_cc_impl.cc
deleted file mode 100644
index 15fc0fc814..0000000000
--- a/gr-blocks/lib/multiply_matrix_cc_impl.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014,2017 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include "multiply_matrix_cc_impl.h"
-
-namespace gr {
- namespace blocks {
-
- const std::string multiply_matrix_cc::MSG_PORT_NAME_SET_A = "set_A";
-
- multiply_matrix_cc::sptr
- multiply_matrix_cc::make(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
- {
- if (A.empty() || A[0].size() == 0) {
- throw std::invalid_argument("matrix A has invalid dimensions.");
- }
- return gnuradio::get_initial_sptr
- (new multiply_matrix_cc_impl(A, tag_propagation_policy));
- }
-
- multiply_matrix_cc_impl::multiply_matrix_cc_impl(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
- : gr::sync_block("multiply_matrix_cc",
- gr::io_signature::make(A[0].size(), A[0].size(), sizeof(gr_complex)),
- gr::io_signature::make(A.size(), A.size(), sizeof(gr_complex))),
- d_A(A)
- {
- this->set_tag_propagation_policy(tag_propagation_policy);
- const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1, alignment_multiple));
-
- pmt::pmt_t port_name = pmt::string_to_symbol("set_A");
- message_port_register_in(port_name);
- set_msg_handler(
- port_name,
- boost::bind(&multiply_matrix_cc_impl::msg_handler_A, this, _1)
- );
- }
-
- multiply_matrix_cc_impl::~multiply_matrix_cc_impl()
- {
- }
-
- int
- multiply_matrix_cc_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- for (size_t out_idx = 0; out_idx < output_items.size(); out_idx++) {
- gr_complex *out = reinterpret_cast<gr_complex *>(output_items[out_idx]);
- // Do input 0 first, this saves a memset
- const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
- volk_32fc_s32fc_multiply_32fc(out, in, d_A[out_idx][0], noutput_items);
- // Then do inputs 1 through N
- for (size_t in_idx = 1; in_idx < input_items.size(); in_idx++) {
- in = reinterpret_cast<const gr_complex *>(input_items[in_idx]);
- // Yeah, this needs VOLK-ifying (TODO)
- for (int i = 0; i < noutput_items; i++) {
- out[i] += in[i] * d_A[out_idx][in_idx];
- }
- }
- }
- if (tag_propagation_policy() == TPP_CUSTOM) {
- propagate_tags_by_A(noutput_items, input_items.size(), output_items.size());
- }
- return noutput_items;
- }
-
-
- // Copy tags from input k to output l if A[l][k] is not zero
- void
- multiply_matrix_cc_impl::propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports)
- {
- std::vector<gr::tag_t> tags;
- for (size_t in_idx = 0; in_idx < ninput_ports; in_idx++) {
- get_tags_in_window(
- tags,
- in_idx,
- 0,
- noutput_items
- );
-
- for (size_t out_idx = 0; out_idx < noutput_ports; out_idx++) {
- if (d_A[out_idx][in_idx] == std::complex<float>(0, 0)) {
- continue;
- }
- for (size_t i = 0; i < tags.size(); i++) {
- add_item_tag(out_idx, tags[i]);
- }
- }
- }
- }
-
- // Check dimensions before copying
- bool
- multiply_matrix_cc_impl::set_A(const std::vector<std::vector<gr_complex> > &new_A)
- {
- if (d_A.size() != new_A.size()) {
- GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
- return false;
- }
- for (size_t i = 0; i < d_A.size(); i++) {
- if (d_A[i].size() != new_A[i].size()) {
- GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
- return false;
- }
- }
- d_A = new_A;
- return true;
- }
-
- void
- multiply_matrix_cc_impl::msg_handler_A(pmt::pmt_t A)
- {
- if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
- return;
- }
- if (pmt::length(A) != d_A.size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
- return;
- }
-
- std::vector<std::vector<gr_complex> > new_A(d_A);
- for (size_t i = 0; i < pmt::length(A); i++) {
- pmt::pmt_t row;
- if (pmt::is_vector(A)) {
- row = pmt::vector_ref(A, i);
- } else if (pmt::is_tuple(A)) {
- row = pmt::tuple_ref(A, i);
- }
- if (pmt::is_vector(row) || pmt::is_tuple(row)) {
- if (pmt::length(row) != d_A[0].size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
- return;
- }
- for (size_t k = 0; k < pmt::length(row); k++) {
- new_A[i][k] = pmt::to_double(pmt::is_vector(row) ? pmt::vector_ref(row, k) : pmt::tuple_ref(row, k));
- }
- } else if (pmt::is_c32vector(row)) {
- size_t row_len = 0;
- const gr_complex *elements = pmt::c32vector_elements(row, row_len);
- if (row_len != d_A[0].size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
- return;
- }
- new_A[i].assign(elements, elements + row_len);
- }
- }
-
- if (!set_A(new_A)) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A.");
- }
- }
-
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_matrix_cc_impl.h b/gr-blocks/lib/multiply_matrix_cc_impl.h
deleted file mode 100644
index f342817e26..0000000000
--- a/gr-blocks/lib/multiply_matrix_cc_impl.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014, 2017 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_MULTIPLY_matrix_cc_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_matrix_cc_IMPL_H
-
-#include <gnuradio/blocks/multiply_matrix_cc.h>
-
-namespace gr {
- namespace blocks {
-
- class multiply_matrix_cc_impl : public multiply_matrix_cc
- {
- private:
- std::vector<std::vector<gr_complex> > d_A;
-
- void propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports);
-
- void msg_handler_A(pmt::pmt_t A);
-
- public:
- multiply_matrix_cc_impl(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy);
- ~multiply_matrix_cc_impl();
-
- const std::vector<std::vector<gr_complex> >& get_A() const { return d_A; };
- bool set_A(const std::vector<std::vector<gr_complex> > &new_A);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } // namespace blocks
-} // namespace gr
-
-#endif /* INCLUDED_BLOCKS_MULTIPLY_matrix_cc_IMPL_H */
-
diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.cc b/gr-blocks/lib/multiply_matrix_ff_impl.cc
deleted file mode 100644
index a5eae4261e..0000000000
--- a/gr-blocks/lib/multiply_matrix_ff_impl.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include "multiply_matrix_ff_impl.h"
-
-namespace gr {
- namespace blocks {
-
- const std::string multiply_matrix_ff::MSG_PORT_NAME_SET_A = "set_A";
-
- multiply_matrix_ff::sptr
- multiply_matrix_ff::make(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
- {
- if (A.empty() || A[0].size() == 0) {
- throw std::invalid_argument("matrix A has invalid dimensions.");
- }
- return gnuradio::get_initial_sptr
- (new multiply_matrix_ff_impl(A, tag_propagation_policy));
- }
-
- multiply_matrix_ff_impl::multiply_matrix_ff_impl(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
- : gr::sync_block("multiply_matrix_ff",
- gr::io_signature::make(A[0].size(), A[0].size(), sizeof(float)),
- gr::io_signature::make(A.size(), A.size(), sizeof(float))),
- d_A(A)
- {
- this->set_tag_propagation_policy(tag_propagation_policy);
- const int alignment_multiple = volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1, alignment_multiple));
-
- pmt::pmt_t port_name = pmt::string_to_symbol("set_A");
- message_port_register_in(port_name);
- set_msg_handler(
- port_name,
- boost::bind(&multiply_matrix_ff_impl::msg_handler_A, this, _1)
- );
- }
-
- multiply_matrix_ff_impl::~multiply_matrix_ff_impl()
- {
- }
-
- int
- multiply_matrix_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- for (size_t out_idx = 0; out_idx < output_items.size(); out_idx++) {
- float *out = reinterpret_cast<float *>(output_items[out_idx]);
- // Do input 0 first, this saves a memset
- const float *in = reinterpret_cast<const float *>(input_items[0]);
- volk_32f_s32f_multiply_32f(out, in, d_A[out_idx][0], noutput_items);
- // Then do inputs 1 through N
- for (size_t in_idx = 1; in_idx < input_items.size(); in_idx++) {
- in = reinterpret_cast<const float *>(input_items[in_idx]);
- // Yeah, this needs VOLK-ifying (TODO)
- for (int i = 0; i < noutput_items; i++) {
- out[i] += in[i] * d_A[out_idx][in_idx];
- }
- }
- }
- if (tag_propagation_policy() == TPP_CUSTOM) {
- propagate_tags_by_A(noutput_items, input_items.size(), output_items.size());
- }
- return noutput_items;
- }
-
-
- // Copy tags from input k to output l if A[l][k] is not zero
- void
- multiply_matrix_ff_impl::propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports)
- {
- std::vector<gr::tag_t> tags;
- for (size_t in_idx = 0; in_idx < ninput_ports; in_idx++) {
- get_tags_in_window(
- tags,
- in_idx,
- 0,
- noutput_items
- );
-
- for (size_t out_idx = 0; out_idx < noutput_ports; out_idx++) {
- if (d_A[out_idx][in_idx] == 0) {
- continue;
- }
- for (size_t i = 0; i < tags.size(); i++) {
- add_item_tag(out_idx, tags[i]);
- }
- }
- }
- }
-
- // Check dimensions before copying
- bool
- multiply_matrix_ff_impl::set_A(const std::vector<std::vector<float> > &new_A)
- {
- if (d_A.size() != new_A.size()) {
- GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
- return false;
- }
- for (size_t i = 0; i < d_A.size(); i++) {
- if (d_A[i].size() != new_A[i].size()) {
- GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
- return false;
- }
- }
- d_A = new_A;
- return true;
- }
-
- void
- multiply_matrix_ff_impl::msg_handler_A(pmt::pmt_t A)
- {
- if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
- return;
- }
- if (pmt::length(A) != d_A.size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
- return;
- }
-
- std::vector<std::vector<float> > new_A(d_A);
- for (size_t i = 0; i < pmt::length(A); i++) {
- pmt::pmt_t row;
- if (pmt::is_vector(A)) {
- row = pmt::vector_ref(A, i);
- } else if (pmt::is_tuple(A)) {
- row = pmt::tuple_ref(A, i);
- }
- if (pmt::is_vector(row) || pmt::is_tuple(row)) {
- if (pmt::length(row) != d_A[0].size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
- return;
- }
- for (size_t k = 0; k < pmt::length(row); k++) {
- new_A[i][k] = pmt::to_double(pmt::is_vector(row) ? pmt::vector_ref(row, k) : pmt::tuple_ref(row, k));
- }
- } else if (pmt::is_f32vector(row)) {
- size_t row_len = 0;
- const float *elements = pmt::f32vector_elements(row, row_len);
- if (row_len != d_A[0].size()) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
- return;
- }
- new_A[i].assign(elements, elements + row_len);
- }
- }
-
- if (!set_A(new_A)) {
- GR_LOG_ALERT(d_logger, "Invalid message to set A.");
- }
- }
-
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_matrix_impl.cc b/gr-blocks/lib/multiply_matrix_impl.cc
new file mode 100644
index 0000000000..4d7dbb3651
--- /dev/null
+++ b/gr-blocks/lib/multiply_matrix_impl.cc
@@ -0,0 +1,327 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014,2017,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include "multiply_matrix_impl.h"
+
+namespace gr {
+ namespace blocks {
+
+ // Copy tags from input k to output l if A[l][k] is not zero
+ template <>
+ void
+ multiply_matrix_impl<gr_complex>::propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports)
+ {
+ std::vector<gr::tag_t> tags;
+ for (size_t in_idx = 0; in_idx < ninput_ports; in_idx++) {
+ this->get_tags_in_window(
+ tags,
+ in_idx,
+ 0,
+ noutput_items
+ );
+
+ for (size_t out_idx = 0; out_idx < noutput_ports; out_idx++) {
+ if (d_A[out_idx][in_idx] == std::complex<float>(0, 0)) {
+ continue;
+ }
+ for (size_t i = 0; i < tags.size(); i++) {
+ this->add_item_tag(out_idx, tags[i]);
+ }
+ }
+ }
+ }
+
+ // Check dimensions before copying
+ template <>
+ bool
+ multiply_matrix_impl<gr_complex>::set_A(const std::vector<std::vector<gr_complex> > &new_A)
+ {
+ if (d_A.size() != new_A.size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
+ return false;
+ }
+ for (size_t i = 0; i < d_A.size(); i++) {
+ if (d_A[i].size() != new_A[i].size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
+ return false;
+ }
+ }
+ d_A = new_A;
+ return true;
+ }
+
+ template <>
+ void
+ multiply_matrix_impl<gr_complex>::msg_handler_A(pmt::pmt_t A)
+ {
+ if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
+ return;
+ }
+ if (pmt::length(A) != d_A.size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
+ return;
+ }
+
+ std::vector<std::vector<gr_complex> > new_A(d_A);
+ for (size_t i = 0; i < pmt::length(A); i++) {
+ pmt::pmt_t row;
+ if (pmt::is_vector(A)) {
+ row = pmt::vector_ref(A, i);
+ } else if (pmt::is_tuple(A)) {
+ row = pmt::tuple_ref(A, i);
+ }
+ if (pmt::is_vector(row) || pmt::is_tuple(row)) {
+ if (pmt::length(row) != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
+ return;
+ }
+ for (size_t k = 0; k < pmt::length(row); k++) {
+ new_A[i][k] = pmt::to_double(pmt::is_vector(row) ? pmt::vector_ref(row, k) : pmt::tuple_ref(row, k));
+ }
+ } else if (pmt::is_c32vector(row)) {
+ size_t row_len = 0;
+ const gr_complex *elements = pmt::c32vector_elements(row, row_len);
+ if (row_len != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
+ return;
+ }
+ new_A[i].assign(elements, elements + row_len);
+ }
+ }
+
+ if (!set_A(new_A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A.");
+ }
+ }
+
+ // Copy tags from input k to output l if A[l][k] is not zero
+ template <>
+ void
+ multiply_matrix_impl<float>::propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports)
+ {
+ std::vector<gr::tag_t> tags;
+ for (size_t in_idx = 0; in_idx < ninput_ports; in_idx++) {
+ get_tags_in_window(
+ tags,
+ in_idx,
+ 0,
+ noutput_items
+ );
+
+ for (size_t out_idx = 0; out_idx < noutput_ports; out_idx++) {
+ if (d_A[out_idx][in_idx] == 0) {
+ continue;
+ }
+ for (size_t i = 0; i < tags.size(); i++) {
+ add_item_tag(out_idx, tags[i]);
+ }
+ }
+ }
+ }
+
+ // Check dimensions before copying
+ template <>
+ bool
+ multiply_matrix_impl<float>::set_A(const std::vector<std::vector<float> > &new_A)
+ {
+ if (d_A.size() != new_A.size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
+ return false;
+ }
+ for (size_t i = 0; i < d_A.size(); i++) {
+ if (d_A[i].size() != new_A[i].size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid dimensions.");
+ return false;
+ }
+ }
+ d_A = new_A;
+ return true;
+ }
+
+ template <>
+ void
+ multiply_matrix_impl<float>::msg_handler_A(pmt::pmt_t A)
+ {
+ if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
+ return;
+ }
+ if (pmt::length(A) != d_A.size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
+ return;
+ }
+
+ std::vector<std::vector<float> > new_A(d_A);
+ for (size_t i = 0; i < pmt::length(A); i++) {
+ pmt::pmt_t row;
+ if (pmt::is_vector(A)) {
+ row = pmt::vector_ref(A, i);
+ } else if (pmt::is_tuple(A)) {
+ row = pmt::tuple_ref(A, i);
+ }
+ if (pmt::is_vector(row) || pmt::is_tuple(row)) {
+ if (pmt::length(row) != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
+ return;
+ }
+ for (size_t k = 0; k < pmt::length(row); k++) {
+ new_A[i][k] = pmt::to_double(pmt::is_vector(row) ? pmt::vector_ref(row, k) : pmt::tuple_ref(row, k));
+ }
+ } else if (pmt::is_f32vector(row)) {
+ size_t row_len = 0;
+ const float *elements = pmt::f32vector_elements(row, row_len);
+ if (row_len != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
+ return;
+ }
+ new_A[i].assign(elements, elements + row_len);
+ }
+ }
+
+ if (!set_A(new_A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A.");
+ }
+ }
+
+
+
+ template <class T>
+ typename multiply_matrix<T>::sptr
+ multiply_matrix<T>::make(std::vector<std::vector<T> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
+ {
+ if (A.empty() || A[0].size() == 0) {
+ throw std::invalid_argument("matrix A has invalid dimensions.");
+ }
+ return gnuradio::get_initial_sptr
+ (new multiply_matrix_impl<T>(A, tag_propagation_policy));
+ }
+
+ template <>
+ multiply_matrix_impl<gr_complex>::multiply_matrix_impl(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
+ : gr::sync_block("multiply_matrix_cc",
+ gr::io_signature::make(A[0].size(), A[0].size(), sizeof(gr_complex)),
+ gr::io_signature::make(A.size(), A.size(), sizeof(gr_complex))),
+ d_A(A)
+ { this->MSG_PORT_NAME_SET_A = "set_A";
+ this->set_tag_propagation_policy(tag_propagation_policy);
+ const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1, alignment_multiple));
+
+ pmt::pmt_t port_name = pmt::string_to_symbol("set_A");
+ message_port_register_in(port_name);
+ set_msg_handler(
+ port_name,
+ boost::bind(&multiply_matrix_impl<gr_complex>::msg_handler_A, this, _1)
+ );
+ }
+
+ template <>
+ multiply_matrix_impl<float>::multiply_matrix_impl(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
+ : gr::sync_block("multiply_matrix_ff",
+ gr::io_signature::make(A[0].size(), A[0].size(), sizeof(float)),
+ gr::io_signature::make(A.size(), A.size(), sizeof(float))),
+ d_A(A)
+ { this->MSG_PORT_NAME_SET_A = "set_A";
+ this->set_tag_propagation_policy(tag_propagation_policy);
+ const int alignment_multiple = volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+
+ pmt::pmt_t port_name = pmt::string_to_symbol("set_A");
+ message_port_register_in(port_name);
+ set_msg_handler(
+ port_name,
+ boost::bind(&multiply_matrix_impl<float>::msg_handler_A, this, _1)
+ );
+ }
+
+
+
+ template <class T>
+ multiply_matrix_impl<T>::~multiply_matrix_impl()
+ {
+ }
+
+ template <>
+ int
+ multiply_matrix_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ for (size_t out_idx = 0; out_idx < output_items.size(); out_idx++) {
+ gr_complex *out = reinterpret_cast<gr_complex *>(output_items[out_idx]);
+ // Do input 0 first, this saves a memset
+ const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
+ volk_32fc_s32fc_multiply_32fc(out, in, d_A[out_idx][0], noutput_items);
+ // Then do inputs 1 through N
+ for (size_t in_idx = 1; in_idx < input_items.size(); in_idx++) {
+ in = reinterpret_cast<const gr_complex *>(input_items[in_idx]);
+ // Yeah, this needs VOLK-ifying (TODO)
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] += in[i] * d_A[out_idx][in_idx];
+ }
+ }
+ }
+ if (tag_propagation_policy() == TPP_CUSTOM) {
+ propagate_tags_by_A(noutput_items, input_items.size(), output_items.size());
+ }
+ return noutput_items;
+ }
+
+ template <>
+ int
+ multiply_matrix_impl<float>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ for (size_t out_idx = 0; out_idx < output_items.size(); out_idx++) {
+ float *out = reinterpret_cast<float *>(output_items[out_idx]);
+ // Do input 0 first, this saves a memset
+ const float *in = reinterpret_cast<const float *>(input_items[0]);
+ volk_32f_s32f_multiply_32f(out, in, d_A[out_idx][0], noutput_items);
+ // Then do inputs 1 through N
+ for (size_t in_idx = 1; in_idx < input_items.size(); in_idx++) {
+ in = reinterpret_cast<const float *>(input_items[in_idx]);
+ // Yeah, this needs VOLK-ifying (TODO)
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] += in[i] * d_A[out_idx][in_idx];
+ }
+ }
+ }
+ if (tag_propagation_policy() == TPP_CUSTOM) {
+ propagate_tags_by_A(noutput_items, input_items.size(), output_items.size());
+ }
+ return noutput_items;
+ }
+
+
+ template class multiply_matrix<float>;
+ template class multiply_matrix<gr_complex>;
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.h b/gr-blocks/lib/multiply_matrix_impl.h
index 93b2bebadd..bb5477e805 100644
--- a/gr-blocks/lib/multiply_matrix_ff_impl.h
+++ b/gr-blocks/lib/multiply_matrix_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014, 2017 Free Software Foundation, Inc.
+ * Copyright 2014,2017-2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,29 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H
-#define INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H
+#ifndef INCLUDED_BLOCKS_MULTIPLY_MATRIX_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_MATRIX_IMPL_H
-#include <gnuradio/blocks/multiply_matrix_ff.h>
+#include <gnuradio/blocks/multiply_matrix.h>
namespace gr {
namespace blocks {
- class multiply_matrix_ff_impl : public multiply_matrix_ff
+ template <class T>
+ class multiply_matrix_impl : public multiply_matrix<T>
{
private:
- std::vector<std::vector<float> > d_A;
+ std::vector<std::vector<T> > d_A;
void propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t noutput_ports);
void msg_handler_A(pmt::pmt_t A);
public:
- multiply_matrix_ff_impl(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy);
- ~multiply_matrix_ff_impl();
+ multiply_matrix_impl(std::vector<std::vector<T> > A, gr::block::tag_propagation_policy_t tag_propagation_policy);
+ ~multiply_matrix_impl();
- const std::vector<std::vector<float> >& get_A() const { return d_A; };
- bool set_A(const std::vector<std::vector<float> > &new_A);
+ const std::vector<std::vector<T> >& get_A() const { return d_A; };
+ bool set_A(const std::vector<std::vector<T> > &new_A);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -52,5 +53,4 @@ namespace gr {
} // namespace blocks
} // namespace gr
-#endif /* INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H */
-
+#endif /* INCLUDED_BLOCKS_MULTIPLY_MATRIX_IMPL_H */
diff --git a/gr-blocks/lib/mute_XX_impl.cc.t b/gr-blocks/lib/mute_impl.cc
index e7c2c4398b..081dd81b35 100644
--- a/gr-blocks/lib/mute_XX_impl.cc.t
+++ b/gr-blocks/lib/mute_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,53 +20,56 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "mute_impl.h"
#include <gnuradio/io_signature.h>
#include <string.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(bool mute)
+ template <class T>
+ typename mute_blk<T>::sptr
+ mute_blk<T>::make(bool mute)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(mute));
+ (new mute_impl<T> (mute));
}
- @NAME_IMPL@::@NAME_IMPL@(bool mute)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ template <class T>
+ mute_impl<T> ::mute_impl(bool mute)
+ : sync_block("mute",
+ io_signature::make(1, 1, sizeof(T)),
+ io_signature::make(1, 1, sizeof(T))),
d_mute(mute)
{
- message_port_register_in(pmt::intern("set_mute"));
- set_msg_handler(pmt::intern("set_mute"),
- boost::bind(&@NAME_IMPL@::set_mute_pmt, this, _1));
+ this->message_port_register_in(pmt::intern("set_mute"));
+ this->set_msg_handler(pmt::intern("set_mute"),
+ boost::bind(&mute_impl<T> ::set_mute_pmt, this, _1));
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ mute_impl<T> ::~mute_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ mute_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@ *)input_items[0];
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+ T *iptr = (T *)input_items[0];
+ T *optr = (T *)output_items[0];
int size = noutput_items;
if(d_mute) {
- memset(optr, 0, noutput_items * sizeof(@O_TYPE@));
+ memset(optr, 0, noutput_items * sizeof(T));
}
else {
while(size >= 8) {
@@ -88,5 +91,9 @@ namespace gr {
return noutput_items;
}
+template class mute_blk<std::int16_t>;
+template class mute_blk<std::int32_t>;
+template class mute_blk<float>;
+template class mute_blk<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/mute_XX_impl.h.t b/gr-blocks/lib/mute_impl.h
index 8234583bbf..6943e22739 100644
--- a/gr-blocks/lib/mute_XX_impl.h.t
+++ b/gr-blocks/lib/mute_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,24 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef MUTE_IMPL_H
+#define MUTE_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/mute.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class mute_impl : public mute_blk<T>
{
private:
bool d_mute;
public:
- @NAME_IMPL@(bool mute);
- ~@NAME_IMPL@();
+ mute_impl (bool mute);
+ ~mute_impl ();
bool mute() const { return d_mute; }
void set_mute(bool mute) { d_mute = mute; }
@@ -51,4 +51,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* MUTE_IMPL_H */
diff --git a/gr-blocks/lib/not_XX_impl.cc.t b/gr-blocks/lib/not_blk_impl.cc
index cb9be5cdb8..3c3dea5a15 100644
--- a/gr-blocks/lib/not_XX_impl.cc.t
+++ b/gr-blocks/lib/not_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,38 +20,40 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "not_blk_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr @NAME@::make(size_t vlen)
+ template <class T>
+ typename not_blk<T>::sptr not_blk<T>::make(size_t vlen)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ return gnuradio::get_initial_sptr(new not_blk_impl<T> (vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, 1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
+ template <class T>
+ not_blk_impl<T> ::not_blk_impl(size_t vlen)
+ : sync_block ("not_blk",
+ io_signature::make (1, 1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
d_vlen(vlen)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ not_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
- const @I_TYPE@ *inptr = (const @I_TYPE@ *) input_items[0];
+ T *optr = (T *) output_items[0];
+ const T *inptr = (const T *) input_items[0];
int noi = noutput_items*d_vlen;
@@ -61,5 +63,8 @@ namespace gr {
return noutput_items;
}
+template class not_blk<std::uint8_t>;
+template class not_blk<std::int16_t>;
+template class not_blk<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/divide_XX_impl.h.t b/gr-blocks/lib/not_blk_impl.h
index 2680ef7012..77050adee2 100644
--- a/gr-blocks/lib/divide_XX_impl.h.t
+++ b/gr-blocks/lib/not_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,22 +20,22 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef NOT_BLK_IMPL_H
+#define NOT_BLK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/not_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+ class BLOCKS_API not_blk_impl : public not_blk<T>
{
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ not_blk_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -45,4 +45,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* NOT_BLK_IMPL_H */
diff --git a/gr-blocks/lib/or_XX_impl.cc.t b/gr-blocks/lib/or_XX_impl.cc.t
deleted file mode 100644
index 2782e1ee5f..0000000000
--- a/gr-blocks/lib/or_XX_impl.cc.t
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int ninputs = input_items.size ();
-
- for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- for (int j = 1; j < ninputs; j++)
- acc |= ((@I_TYPE@ *) input_items[j])[i];
-
- *optr++ = (@O_TYPE@) acc;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/or_blk_impl.cc b/gr-blocks/lib/or_blk_impl.cc
new file mode 100644
index 0000000000..1e9dab5ea5
--- /dev/null
+++ b/gr-blocks/lib/or_blk_impl.cc
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include <or_blk_impl.h>
+
+namespace gr {
+namespace blocks {
+
+template <class T> typename or_blk<T>::sptr or_blk<T>::make(size_t vlen) {
+ return gnuradio::get_initial_sptr(new or_blk_impl<T>(vlen));
+}
+
+template <class T>
+or_blk_impl<T>::or_blk_impl(size_t vlen)
+ : sync_block("or_blk", io_signature::make(1, -1, sizeof(T) * vlen),
+ io_signature::make(1, 1, sizeof(T) * vlen)),
+ d_vlen(vlen) {}
+
+template <class T>
+int or_blk_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items) {
+ T *optr = (T *)output_items[0];
+
+ int ninputs = input_items.size();
+
+ for (size_t i = 0; i < noutput_items * d_vlen; i++) {
+ T acc = ((T *)input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc |= ((T *)input_items[j])[i];
+
+ *optr++ = (T)acc;
+ }
+
+ return noutput_items;
+}
+
+template class or_blk<short>;
+template class or_blk<int>;
+template class or_blk<char>;
+
+} /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/or_XX_impl.h.t b/gr-blocks/lib/or_blk_impl.h
index f7db3f2162..fbff19a24d 100644
--- a/gr-blocks/lib/or_XX_impl.h.t
+++ b/gr-blocks/lib/or_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,22 +20,21 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef OR_BLK_IMPL_H
+#define OR_BLK_IMPL_H
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/or_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ template<class T>
+ class BLOCKS_API or_blk_impl : public or_blk<T>
{
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ or_blk_impl(size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -45,4 +44,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* OR_BLK_IMPL_H */
diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t b/gr-blocks/lib/packed_to_unpacked_impl.cc
index de96135ce8..54b6031238 100644
--- a/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t
+++ b/gr-blocks/lib/packed_to_unpacked_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,54 +20,53 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME_IMPL@.h"
+#include "packed_to_unpacked_impl.h"
#include <gnuradio/io_signature.h>
-#include <gnuradio/blocks/log2_const.h>
#include <assert.h>
namespace gr {
namespace blocks {
- static const unsigned int BITS_PER_TYPE = sizeof(@I_TYPE@) * 8;
- static const unsigned int LOG2_L_TYPE = log2_const<sizeof(@I_TYPE@) * 8>();
-
- @NAME@::sptr
- @NAME@::make(unsigned int bits_per_chunk,
+ template <class T>
+ typename packed_to_unpacked<T>::sptr
+ packed_to_unpacked<T>::make(unsigned int bits_per_chunk,
endianness_t endianness)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(bits_per_chunk, endianness));
+ (new packed_to_unpacked_impl<T> (bits_per_chunk, endianness));
}
- @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk,
+ template <class T>
+ packed_to_unpacked_impl<T> ::packed_to_unpacked_impl(unsigned int bits_per_chunk,
endianness_t endianness)
- : block("@NAME@",
- io_signature::make(1, -1, sizeof(@I_TYPE@)),
- io_signature::make(1, -1, sizeof(@O_TYPE@))),
+ : block("packed_to_unpacked",
+ io_signature::make(1, -1, sizeof(T)),
+ io_signature::make(1, -1, sizeof(T))),
d_bits_per_chunk(bits_per_chunk), d_endianness(endianness), d_index(0)
{
- assert(bits_per_chunk <= BITS_PER_TYPE);
+ assert(bits_per_chunk <= this->d_bits_per_type);
assert(bits_per_chunk > 0);
- set_relative_rate((1.0 * BITS_PER_TYPE) / bits_per_chunk);
+ this->set_relative_rate((1.0 * this->d_bits_per_type) / bits_per_chunk);
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ packed_to_unpacked_impl<T> ::~packed_to_unpacked_impl()
{
}
+ template <class T>
void
- @NAME_IMPL@::forecast(int noutput_items,
+ packed_to_unpacked_impl<T> ::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = (int)ceil((d_index + noutput_items * d_bits_per_chunk)
- / (1.0 * BITS_PER_TYPE));
+ / (1.0 * this->d_bits_per_type));
unsigned ninputs = ninput_items_required.size();
for(unsigned int i = 0; i < ninputs; i++) {
ninput_items_required[i] = input_required;
@@ -75,22 +74,25 @@ namespace gr {
}
}
+ template <class T>
unsigned int
- get_bit_le(const @I_TYPE@ *in_vector, unsigned int bit_addr)
+ packed_to_unpacked_impl<T>::get_bit_le(const T *in_vector, unsigned int bit_addr)
{
- @I_TYPE@ x = in_vector[bit_addr >> LOG2_L_TYPE];
- return (x >> (bit_addr & (BITS_PER_TYPE-1))) & 1;
+ T x = in_vector[bit_addr >> this->d_log2_l_type];
+ return (x >> (bit_addr & (this->d_bits_per_type-1))) & 1;
}
+ template <class T>
unsigned int
- get_bit_be(const @I_TYPE@ *in_vector, unsigned int bit_addr)
+ packed_to_unpacked_impl<T>::get_bit_be(const T *in_vector, unsigned int bit_addr)
{
- @I_TYPE@ x = in_vector[bit_addr >> LOG2_L_TYPE];
- return (x >> ((BITS_PER_TYPE-1) - (bit_addr & (BITS_PER_TYPE-1)))) & 1;
+ T x = in_vector[bit_addr >> this->d_log2_l_type];
+ return (x >> ((this->d_bits_per_type-1) - (bit_addr & (this->d_bits_per_type-1)))) & 1;
}
+ template <class T>
int
- @NAME_IMPL@::general_work(int noutput_items,
+ packed_to_unpacked_impl<T> ::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -101,8 +103,8 @@ namespace gr {
int nstreams = input_items.size();
for (int m=0; m < nstreams; m++){
- const @I_TYPE@ *in = (@I_TYPE@ *)input_items[m];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[m];
+ const T *in = (T *)input_items[m];
+ T *out = (T *)output_items[m];
index_tmp = d_index;
// per stream processing
@@ -111,7 +113,7 @@ namespace gr {
case GR_MSB_FIRST:
for(int i = 0; i < noutput_items; i++) {
//printf("here msb %d\n",i);
- @O_TYPE@ x = 0;
+ T x = 0;
for(unsigned int j = 0; j < d_bits_per_chunk; j++, index_tmp++)
x = (x<<1) | get_bit_be(in, index_tmp);
out[i] = x;
@@ -121,7 +123,7 @@ namespace gr {
case GR_LSB_FIRST:
for(int i = 0; i < noutput_items; i++) {
//printf("here lsb %d\n",i);
- @O_TYPE@ x = 0;
+ T x = 0;
for(unsigned int j = 0; j < d_bits_per_chunk; j++, index_tmp++)
x = (x<<1) | get_bit_le(in, index_tmp);
out[i] = x;
@@ -133,15 +135,18 @@ namespace gr {
}
//printf("almost got to end\n");
- assert(ninput_items[m] >= (int)((d_index+(BITS_PER_TYPE-1)) >> LOG2_L_TYPE));
+ assert(ninput_items[m] >= (int)((d_index+(this->d_bits_per_type-1)) >> this->d_log2_l_type));
}
d_index = index_tmp;
- consume_each(d_index >> LOG2_L_TYPE);
- d_index = d_index & (BITS_PER_TYPE-1);
+ this->consume_each(d_index >> this->d_log2_l_type);
+ d_index = d_index & (this->d_bits_per_type-1);
//printf("got to end\n");
return noutput_items;
}
+template class packed_to_unpacked<std::uint8_t>;
+template class packed_to_unpacked<std::int16_t>;
+template class packed_to_unpacked<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t b/gr-blocks/lib/packed_to_unpacked_impl.h
index 2076c65e9b..fd65242478 100644
--- a/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t
+++ b/gr-blocks/lib/packed_to_unpacked_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006.2013 Free Software Foundation, Inc.
+ * Copyright 2006,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,27 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef PACKED_TO_UNPACKED_IMPL_H
+#define PACKED_TO_UNPACKED_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/packed_to_unpacked.h>
+#include <gnuradio/blocks/log2_const.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class packed_to_unpacked_impl : public packed_to_unpacked<T>
{
private:
unsigned int d_bits_per_chunk;
endianness_t d_endianness;
unsigned int d_index;
+ const unsigned int d_bits_per_type = sizeof(T) * 8;
+ const unsigned int d_log2_l_type = log2_const<sizeof(T) * 8>();
+ unsigned int get_bit_le(const T *in_vector, unsigned int bit_addr);
+ unsigned int get_bit_be(const T *in_vector, unsigned int bit_addr);
public:
- @NAME_IMPL@(unsigned int bits_per_chunk,
+ packed_to_unpacked_impl (unsigned int bits_per_chunk,
endianness_t endianness);
- ~@NAME_IMPL@();
+ ~packed_to_unpacked_impl ();
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
@@ -56,4 +61,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* PACKED_TO_UNPACKED_IMPL_H */
diff --git a/gr-blocks/lib/peak_detector_XX_impl.cc.t b/gr-blocks/lib/peak_detector_impl.cc
index bc4136143d..cda1f6007b 100644
--- a/gr-blocks/lib/peak_detector_XX_impl.cc.t
+++ b/gr-blocks/lib/peak_detector_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2010,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME_IMPL@.h"
+#include "peak_detector_impl.h"
#include <gnuradio/io_signature.h>
#include <string.h>
#include <limits>
@@ -34,22 +32,24 @@
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(float threshold_factor_rise,
+ template <class T>
+ typename peak_detector<T>::sptr
+ peak_detector<T>::make(float threshold_factor_rise,
float threshold_factor_fall,
int look_ahead, float alpha)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(threshold_factor_rise,
+ (new peak_detector_impl<T>(threshold_factor_rise,
threshold_factor_fall,
look_ahead, alpha));
}
- @NAME_IMPL@::@NAME_IMPL@(float threshold_factor_rise,
+ template <class T>
+ peak_detector_impl<T>::peak_detector_impl(float threshold_factor_rise,
float threshold_factor_fall,
int look_ahead, float alpha)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
+ : sync_block("peak_detector",
+ io_signature::make(1, 1, sizeof(T)),
io_signature::make(1, 1, sizeof(char))),
d_threshold_factor_rise(threshold_factor_rise),
d_threshold_factor_fall(threshold_factor_fall),
@@ -57,21 +57,23 @@ namespace gr {
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ peak_detector_impl<T>::~peak_detector_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ peak_detector_impl<T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@*)input_items[0];
+ T *iptr = (T*)input_items[0];
char *optr = (char*)output_items[0];
memset(optr, 0, noutput_items*sizeof(char));
- @I_TYPE@ peak_val = std::numeric_limits<@I_TYPE@>::min();
+ T peak_val = std::numeric_limits<T>::min();
int peak_ind = 0;
unsigned char state = 0;
int i = 0;
@@ -102,7 +104,7 @@ namespace gr {
else {
optr[peak_ind] = 1;
state = 0;
- peak_val = -(@I_TYPE@)INFINITY;
+ peak_val = -(T)INFINITY;
//printf("Leaving State 1: Peak: %f Peak Ind: %d i: %d noutput_items: %d\n",
//peak_val, peak_ind, i, noutput_items);
}
@@ -119,5 +121,8 @@ namespace gr {
}
}
+ template class peak_detector<float>;
+ template class peak_detector<std::int16_t>;
+ template class peak_detector<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/peak_detector_XX_impl.h.t b/gr-blocks/lib/peak_detector_impl.h
index aa04794536..5a70c1b060 100644
--- a/gr-blocks/lib/peak_detector_XX_impl.h.t
+++ b/gr-blocks/lib/peak_detector_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef PEAK_DETECTOR_IMPL_H
+#define PEAK_DETECTOR_IMPL_H
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/peak_detector.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+ template <class T>
+ class peak_detector_impl : public peak_detector<T>
{
private:
float d_threshold_factor_rise;
@@ -40,10 +39,10 @@ namespace gr {
float d_avg;
public:
- @NAME_IMPL@(float threshold_factor_rise,
+ peak_detector_impl(float threshold_factor_rise,
float threshold_factor_fall,
int look_ahead, float alpha);
- ~@NAME_IMPL@();
+ ~peak_detector_impl();
void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; }
@@ -62,4 +61,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* PEAK_DETECTOR_IMPL_H */
diff --git a/gr-blocks/lib/probe_signal_X_impl.cc.t b/gr-blocks/lib/probe_signal_impl.cc
index 1bc2793af2..1766464fc6 100644
--- a/gr-blocks/lib/probe_signal_X_impl.cc.t
+++ b/gr-blocks/lib/probe_signal_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2005,2010,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,43 +20,46 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "probe_signal_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @BASE_NAME@::make()
+ template <class T>
+ typename probe_signal<T>::sptr
+ probe_signal<T>::make()
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@());
+ (new probe_signal_impl<T> ());
}
- @NAME_IMPL@::@NAME_IMPL@()
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@TYPE@)),
+ template <class T>
+ probe_signal_impl<T> ::probe_signal_impl()
+ : sync_block("probe_signal",
+ io_signature::make(1, 1, sizeof(T)),
io_signature::make(0, 0, 0)),
d_level(0)
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ probe_signal_impl<T> ::~probe_signal_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ probe_signal_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const @TYPE@ *in = (const @TYPE@ *)input_items[0];
+ const T *in = (const T *)input_items[0];
if(noutput_items > 0)
d_level = in[noutput_items-1];
@@ -64,5 +67,10 @@ namespace gr {
return noutput_items;
}
+template class probe_signal<std::uint8_t>;
+template class probe_signal<std::int16_t>;
+template class probe_signal<std::int32_t>;
+template class probe_signal<float>;
+template class probe_signal<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/probe_signal_impl.h b/gr-blocks/lib/probe_signal_impl.h
new file mode 100644
index 0000000000..d86f6e6d75
--- /dev/null
+++ b/gr-blocks/lib/probe_signal_impl.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2012-2013,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef PROBE_SIGNAL_IMPL_H
+#define PROBE_SIGNAL_IMPL_H
+
+#include <gnuradio/blocks/probe_signal.h>
+
+namespace gr {
+ namespace blocks {
+
+template<class T>
+ class probe_signal_impl : public probe_signal<T>
+ {
+ private:
+ T d_level;
+
+ public:
+ probe_signal_impl ();
+ ~probe_signal_impl ();
+
+ T level() const { return d_level; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* PROBE_SIGNAL_IMPL_H */
diff --git a/gr-blocks/lib/probe_signal_vX_impl.cc.t b/gr-blocks/lib/probe_signal_v_impl.cc
index 5865bde41b..e355fd030a 100644
--- a/gr-blocks/lib/probe_signal_vX_impl.cc.t
+++ b/gr-blocks/lib/probe_signal_v_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2005,2010,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,50 +20,57 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include <probe_signal_v_impl.h>
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @BASE_NAME@::make(size_t size)
+ template <class T>
+ typename probe_signal_v<T>::sptr
+ probe_signal_v<T>::make(size_t size)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(size));
+ (new probe_signal_v_impl<T>(size));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t size)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, size*sizeof(@TYPE@)),
+ template <class T>
+ probe_signal_v_impl<T>::probe_signal_v_impl(size_t size)
+ : sync_block("probe_signal_v",
+ io_signature::make(1, 1, size*sizeof(T)),
io_signature::make(0, 0, 0)),
d_level(size, 0), d_size(size)
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ probe_signal_v_impl<T>::~probe_signal_v_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ probe_signal_v_impl<T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const @TYPE@ *in = (const @TYPE@ *)input_items[0];
+ const T *in = (const T *)input_items[0];
for(size_t i=0; i<d_size; i++)
d_level[i] = in[(noutput_items-1)*d_size+i];
return noutput_items;
}
+ template class probe_signal_v<std::uint8_t>;
+ template class probe_signal_v<std::int16_t>;
+ template class probe_signal_v<std::int32_t>;
+ template class probe_signal_v<float>;
+ template class probe_signal_v<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/probe_signal_vX_impl.h.t b/gr-blocks/lib/probe_signal_v_impl.h
index 434eb44ac1..dd36ebf741 100644
--- a/gr-blocks/lib/probe_signal_vX_impl.h.t
+++ b/gr-blocks/lib/probe_signal_v_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2005,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,28 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef PROBE_SIGNAL_V_IMPL_H
+#define PROBE_SIGNAL_V_IMPL_H
#include <vector>
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/probe_signal_v.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+ template <class T>
+ class probe_signal_v_impl : public probe_signal_v<T>
{
private:
- std::vector<@TYPE@> d_level;
+ std::vector<T> d_level;
size_t d_size;
public:
- @NAME_IMPL@(size_t size);
- ~@NAME_IMPL@();
+ probe_signal_v_impl(size_t size);
+ ~probe_signal_v_impl();
- std::vector<@TYPE@> level() const { return d_level; }
+ std::vector<T> level() const { return d_level; }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -51,4 +50,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* PROBE_SIGNAL_V_IMPL_H */
diff --git a/gr-blocks/lib/sample_and_hold_XX_impl.h.t b/gr-blocks/lib/sample_and_hold_XX_impl.h.t
deleted file mode 100644
index ed7d6f4d40..0000000000
--- a/gr-blocks/lib/sample_and_hold_XX_impl.h.t
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2013 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class @NAME_IMPL@ : public @NAME@
- {
- private:
- @O_TYPE@ d_data;
-
- public:
- @NAME_IMPL@();
- ~@NAME_IMPL@();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/sample_and_hold_XX_impl.cc.t b/gr-blocks/lib/sample_and_hold_impl.cc
index 27597b67dd..c5e25bca6c 100644
--- a/gr-blocks/lib/sample_and_hold_XX_impl.cc.t
+++ b/gr-blocks/lib/sample_and_hold_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2010,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,45 +20,48 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "sample_and_hold_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make()
+ template <class T>
+ typename sample_and_hold<T>::sptr
+ sample_and_hold<T>::make()
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@());
+ (new sample_and_hold_impl<T> ());
}
- @NAME_IMPL@::@NAME_IMPL@()
- : sync_block("@BASE_NAME@",
- io_signature::make2(2, 2, sizeof(@I_TYPE@), sizeof(char)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ template <class T>
+ sample_and_hold_impl<T> ::sample_and_hold_impl()
+ : sync_block("sample_and_hold",
+ io_signature::make2(2, 2, sizeof(T), sizeof(char)),
+ io_signature::make(1, 1, sizeof(T))),
d_data(0)
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ sample_and_hold_impl<T> ::~sample_and_hold_impl()
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ sample_and_hold_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *iptr = (@I_TYPE@ *)input_items[0];
+ T *iptr = (T *)input_items[0];
const char *ctrl = (const char *)input_items[1];
- @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+ T *optr = (T *)output_items[0];
for(int i = 0; i < noutput_items; i++) {
if(ctrl[i]) {
@@ -69,5 +72,9 @@ namespace gr {
return noutput_items;
}
+template class sample_and_hold<std::uint8_t>;
+template class sample_and_hold<std::int16_t>;
+template class sample_and_hold<std::int32_t>;
+template class sample_and_hold<float>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/probe_signal_X_impl.h.t b/gr-blocks/lib/sample_and_hold_impl.h
index c20994877f..f2ba032073 100644
--- a/gr-blocks/lib/probe_signal_X_impl.h.t
+++ b/gr-blocks/lib/sample_and_hold_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,26 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef SAMPLE_AND_HOLD_IMPL_H
+#define SAMPLE_AND_HOLD_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/sample_and_hold.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class sample_and_hold_impl : public sample_and_hold<T>
{
private:
- @TYPE@ d_level;
+ T d_data;
public:
- @NAME_IMPL@();
- ~@NAME_IMPL@();
-
- @TYPE@ level() const { return d_level; }
+ sample_and_hold_impl ();
+ ~sample_and_hold_impl ();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -49,4 +47,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* SAMPLE_AND_HOLD_IMPL_H */
diff --git a/gr-blocks/lib/sub_XX_impl.cc.t b/gr-blocks/lib/sub_XX_impl.cc.t
deleted file mode 100644
index 6c7484a5d4..0000000000
--- a/gr-blocks/lib/sub_XX_impl.cc.t
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int ninputs = input_items.size ();
-
- for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- for (int j = 1; j < ninputs; j++)
- acc -= ((@I_TYPE@ *) input_items[j])[i];
-
- *optr++ = (@O_TYPE@) acc;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/sub_XX_impl.h.t b/gr-blocks/lib/sub_XX_impl.h.t
deleted file mode 100644
index 2680ef7012..0000000000
--- a/gr-blocks/lib/sub_XX_impl.h.t
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
- {
- size_t d_vlen;
-
- public:
- @NAME_IMPL@(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/sub_ff_impl.h b/gr-blocks/lib/sub_ff_impl.h
deleted file mode 100644
index b4eff66ae6..0000000000
--- a/gr-blocks/lib/sub_ff_impl.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_BLOCKS_SUB_FF_IMPL_H
-#define INCLUDED_BLOCKS_SUB_FF_IMPL_H
-
-#include <gnuradio/blocks/sub_ff.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API sub_ff_impl : public sub_ff
- {
- private:
- size_t d_vlen;
-
- public:
- sub_ff_impl(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_BLOCKS_SUB_FF_IMPL_H */
diff --git a/gr-blocks/lib/sub_ff_impl.cc b/gr-blocks/lib/sub_impl.cc
index 8ea1a47c8b..ee4df1ed66 100644
--- a/gr-blocks/lib/sub_ff_impl.cc
+++ b/gr-blocks/lib/sub_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,25 +20,26 @@
* Boston, MA 02110-1301, USA.
*/
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <sub_ff_impl.h>
+#include "sub_impl.h"
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
namespace gr {
namespace blocks {
- sub_ff::sptr
- sub_ff::make(size_t vlen)
+ template <class T>
+ typename sub<T>::sptr sub<T>::make(size_t vlen)
{
- return gnuradio::get_initial_sptr
- (new sub_ff_impl(vlen));
+ return gnuradio::get_initial_sptr(new sub_impl<T> (vlen));
}
- sub_ff_impl::sub_ff_impl(size_t vlen)
+ template <>
+ sub_impl<float>::sub_impl(size_t vlen)
: sync_block("@sub_ff",
io_signature::make(1, -1, sizeof(float)*vlen),
io_signature::make(1, 1, sizeof(float)*vlen)),
@@ -49,8 +50,9 @@ namespace gr {
set_alignment(std::max(1, alignment_multiple));
}
+ template <>
int
- sub_ff_impl::work(int noutput_items,
+ sub_impl<float>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
@@ -59,14 +61,6 @@ namespace gr {
int ninputs = input_items.size();
int noi = noutput_items*d_vlen;
- //for(size_t i = 0; i < noutput_items*d_vlen; i++){
- // @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- // for (int j = 1; j < ninputs; j++)
- // acc -= ((@I_TYPE@ *) input_items[j])[i];
- //
- // *optr++ = (@O_TYPE@) acc;
- //}
-
const float *in = (const float*)input_items[0];
memcpy(out, in, noi*sizeof(float));
for(int i = 1; i < ninputs; i++) {
@@ -77,5 +71,39 @@ namespace gr {
return noutput_items;
}
+ template <class T>
+ sub_impl<T> ::sub_impl(size_t vlen)
+ : sync_block ("sub",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ template <class T>
+ int
+ sub_impl<T> ::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ T *optr = (T *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ T acc = ((T *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc -= ((T *) input_items[j])[i];
+
+ *optr++ = (T) acc;
+ }
+
+ return noutput_items;
+ }
+
+template class sub<std::int16_t>;
+template class sub<std::int32_t>;
+template class sub<gr_complex>;
+template class sub<float>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/not_XX_impl.h.t b/gr-blocks/lib/sub_impl.h
index f7db3f2162..66e46995fd 100644
--- a/gr-blocks/lib/not_XX_impl.h.t
+++ b/gr-blocks/lib/sub_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,22 +20,22 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef SUB_IMPL_H
+#define SUB_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/sub.h>
namespace gr {
namespace blocks {
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
+template<class T>
+ class BLOCKS_API sub_impl : public sub<T>
{
size_t d_vlen;
public:
- @NAME_IMPL@(size_t vlen);
+ sub_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -45,4 +45,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* SUB_IMPL_H */
diff --git a/gr-blocks/lib/tsb_vector_sink_X_impl.cc.t b/gr-blocks/lib/tsb_vector_sink_impl.cc
index c5b79f94a4..e4a3474e96 100644
--- a/gr-blocks/lib/tsb_vector_sink_X_impl.cc.t
+++ b/gr-blocks/lib/tsb_vector_sink_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,66 +20,76 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "tsb_vector_sink_impl.h"
#include <gnuradio/io_signature.h>
-#include "@NAME_IMPL@.h"
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(int vlen, const std::string &tsb_key)
+ template <class T>
+ typename tsb_vector_sink<T>::sptr
+ tsb_vector_sink<T>::make(int vlen, const std::string &tsb_key)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(vlen, tsb_key));
+ (new tsb_vector_sink_impl<T> (vlen, tsb_key));
}
- @NAME_IMPL@::@NAME_IMPL@(int vlen, const std::string &tsb_key)
- : gr::tagged_stream_block("@NAME@",
- gr::io_signature::make(1, 1, vlen * sizeof(@TYPE@)),
+ template <class T>
+ tsb_vector_sink_impl<T> ::tsb_vector_sink_impl(int vlen, const std::string &tsb_key)
+ : gr::tagged_stream_block("tsb_vector_sink",
+ gr::io_signature::make(1, 1, vlen * sizeof(T)),
gr::io_signature::make(0, 0, 0), tsb_key),
d_vlen(vlen)
{}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ tsb_vector_sink_impl<T> ::~tsb_vector_sink_impl()
{
}
- std::vector<std::vector<@TYPE@> >
- @NAME_IMPL@::data() const
+ template <class T>
+ std::vector<std::vector<T> >
+ tsb_vector_sink_impl<T> ::data() const
{
return d_data;
}
+ template <class T>
std::vector<tag_t>
- @NAME_IMPL@::tags() const
+ tsb_vector_sink_impl<T> ::tags() const
{
return d_tags;
}
+ template <class T>
int
- @NAME_IMPL@::work (int noutput_items,
+ tsb_vector_sink_impl<T> ::work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const @TYPE@ *in = (const @TYPE@ *) input_items[0];
+ const T *in = (const T *) input_items[0];
- std::vector<@TYPE@> new_data(in, in + (ninput_items[0] * d_vlen));
+ std::vector<T> new_data(in, in + (ninput_items[0] * d_vlen));
d_data.push_back(new_data);
std::vector<tag_t> tags;
- get_tags_in_window(tags, 0, 0, ninput_items[0]);
+ this->get_tags_in_window(tags, 0, 0, ninput_items[0]);
d_tags.insert(d_tags.end(), tags.begin(), tags.end());
return ninput_items[0];
}
+template class tsb_vector_sink<std::uint8_t>;
+template class tsb_vector_sink<std::int16_t>;
+template class tsb_vector_sink<std::int32_t>;
+template class tsb_vector_sink<float>;
+template class tsb_vector_sink<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/tsb_vector_sink_X_impl.h.t b/gr-blocks/lib/tsb_vector_sink_impl.h
index 3bf5892cc2..555e80c7dd 100644
--- a/gr-blocks/lib/tsb_vector_sink_X_impl.h.t
+++ b/gr-blocks/lib/tsb_vector_sink_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,29 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef TSB_VECTOR_SINK_IMPL_H
+#define TSB_VECTOR_SINK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/tsb_vector_sink.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class tsb_vector_sink_impl : public tsb_vector_sink<T>
{
private:
- std::vector<std::vector<@TYPE@> > d_data;
+ std::vector<std::vector<T> > d_data;
std::vector<tag_t> d_tags;
int d_vlen;
public:
- @NAME_IMPL@(int vlen, const std::string &tsb_key);
- ~@NAME_IMPL@();
+ tsb_vector_sink_impl (int vlen, const std::string &tsb_key);
+ ~tsb_vector_sink_impl ();
void reset() { d_data.clear(); }
- std::vector<std::vector<@TYPE@> > data() const;
+ std::vector<std::vector<T> > data() const;
std::vector<tag_t> tags() const;
int work(int noutput_items,
@@ -54,5 +54,5 @@ namespace gr {
} // namespace blocks
} // namespace gr
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* TSB_VECTOR_SINK_IMPL_H */
diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t b/gr-blocks/lib/unpacked_to_packed_impl.cc
index 8e06570740..92240c516a 100644
--- a/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t
+++ b/gr-blocks/lib/unpacked_to_packed_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,51 +20,53 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME_IMPL@.h"
+#include "unpacked_to_packed_impl.h"
#include <gnuradio/io_signature.h>
#include <assert.h>
namespace gr {
namespace blocks {
- static const unsigned int BITS_PER_TYPE = sizeof(@O_TYPE@) * 8;
- @NAME@::sptr
- @NAME@::make(unsigned int bits_per_chunk,
+ template <class T>
+ typename unpacked_to_packed<T>::sptr
+ unpacked_to_packed<T>::make(unsigned int bits_per_chunk,
endianness_t endianness)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(bits_per_chunk, endianness));
+ (new unpacked_to_packed_impl<T> (bits_per_chunk, endianness));
}
- @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk,
+ template <class T>
+ unpacked_to_packed_impl<T> ::unpacked_to_packed_impl(unsigned int bits_per_chunk,
endianness_t endianness)
- : block("@NAME@",
- io_signature::make(1, -1, sizeof(@I_TYPE@)),
- io_signature::make(1, -1, sizeof(@O_TYPE@))),
+ : block("unpacked_to_packed",
+ io_signature::make(1, -1, sizeof(T)),
+ io_signature::make(1, -1, sizeof(T))),
d_bits_per_chunk(bits_per_chunk), d_endianness(endianness), d_index(0)
{
- assert(bits_per_chunk <= BITS_PER_TYPE);
+ assert(bits_per_chunk <= d_bits_per_type);
assert(bits_per_chunk > 0);
- set_relative_rate(bits_per_chunk/(1.0 * BITS_PER_TYPE));
+ this->set_relative_rate(bits_per_chunk/(1.0 * d_bits_per_type));
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ unpacked_to_packed_impl<T> ::~unpacked_to_packed_impl()
{
}
+ template <class T>
void
- @NAME_IMPL@::forecast(int noutput_items,
+ unpacked_to_packed_impl<T> ::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
- int input_required = (int)ceil((d_index+noutput_items * 1.0 * BITS_PER_TYPE)
+ int input_required = (int)ceil((d_index+noutput_items * 1.0 * d_bits_per_type)
/ d_bits_per_chunk);
unsigned ninputs = ninput_items_required.size();
for(unsigned int i = 0; i < ninputs; i++) {
@@ -72,19 +74,21 @@ namespace gr {
}
}
+ template <class T>
unsigned int
- get_bit_be1(const @I_TYPE@ *in_vector, unsigned int bit_addr,
+ unpacked_to_packed_impl<T>::get_bit_be1(const T *in_vector, unsigned int bit_addr,
unsigned int bits_per_chunk)
{
unsigned int byte_addr = (int)bit_addr/bits_per_chunk;
- @I_TYPE@ x = in_vector[byte_addr];
+ T x = in_vector[byte_addr];
unsigned int residue = bit_addr - byte_addr * bits_per_chunk;
//printf("Bit addr %d byte addr %d residue %d val %d\n",bit_addr,byte_addr,residue,(x>>(bits_per_chunk-1-residue))&1);
return (x >> (bits_per_chunk-1-residue)) & 1;
}
+ template <class T>
int
- @NAME_IMPL@::general_work(int noutput_items,
+ unpacked_to_packed_impl<T> ::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -95,20 +99,20 @@ namespace gr {
int nstreams = input_items.size();
for(int m=0; m< nstreams; m++) {
- const @I_TYPE@ *in = (@I_TYPE@ *)input_items[m];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[m];
+ const T *in = (T *)input_items[m];
+ T *out = (T *)output_items[m];
index_tmp=d_index;
// per stream processing
- //assert((ninput_items[m]-d_index)*d_bits_per_chunk >= noutput_items*BITS_PER_TYPE);
+ //assert((ninput_items[m]-d_index)*d_bits_per_chunk >= noutput_items*d_bits_per_type);
switch(d_endianness) {
case GR_MSB_FIRST:
for(int i = 0; i < noutput_items; i++) {
- @O_TYPE@ tmp=0;
- for(unsigned int j = 0; j < BITS_PER_TYPE; j++) {
+ T tmp=0;
+ for(unsigned int j = 0; j < d_bits_per_type; j++) {
tmp = (tmp<<1) | get_bit_be1(in, index_tmp, d_bits_per_chunk);
index_tmp++;
}
@@ -119,8 +123,8 @@ namespace gr {
case GR_LSB_FIRST:
for(int i = 0; i < noutput_items; i++) {
unsigned long tmp=0;
- for(unsigned int j = 0; j < BITS_PER_TYPE; j++) {
- tmp = (tmp>>1) | (get_bit_be1(in, index_tmp, d_bits_per_chunk) << (BITS_PER_TYPE-1));
+ for(unsigned int j = 0; j < d_bits_per_type; j++) {
+ tmp = (tmp>>1) | (get_bit_be1(in, index_tmp, d_bits_per_chunk) << (d_bits_per_type-1));
index_tmp++;
}
out[i] = tmp;
@@ -133,11 +137,14 @@ namespace gr {
}
d_index = index_tmp;
- consume_each((int)(d_index/d_bits_per_chunk));
+ this->consume_each((int)(d_index/d_bits_per_chunk));
d_index = d_index%d_bits_per_chunk;
return noutput_items;
}
+template class unpacked_to_packed<std::uint8_t>;
+template class unpacked_to_packed<std::int16_t>;
+template class unpacked_to_packed<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t b/gr-blocks/lib/unpacked_to_packed_impl.h
index 3f8b15c1a6..78b39b0f2d 100644
--- a/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t
+++ b/gr-blocks/lib/unpacked_to_packed_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2013 Free Software Foundation, Inc.
+ * Copyright 2006.2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,27 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef UNPACKED_TO_PACKED_IMPL_H
+#define UNPACKED_TO_PACKED_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/unpacked_to_packed.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class unpacked_to_packed_impl : public unpacked_to_packed<T>
{
private:
unsigned int d_bits_per_chunk;
endianness_t d_endianness;
unsigned int d_index;
+ const unsigned int d_bits_per_type = sizeof(T) * 8;
+ unsigned int get_bit_be1(const T *in_vector, unsigned int bit_addr, unsigned int bits_per_chunk);
public:
- @NAME_IMPL@(unsigned int bits_per_chunk,
+ unpacked_to_packed_impl (unsigned int bits_per_chunk,
endianness_t endianness);
- ~@NAME_IMPL@();
+ ~unpacked_to_packed_impl ();
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
@@ -56,4 +58,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* UNPACKED_TO_PACKED_IMPL_H */
diff --git a/gr-blocks/lib/vector_insert_X_impl.cc.t b/gr-blocks/lib/vector_insert_impl.cc
index 6464a4aba3..a39b0779ac 100644
--- a/gr-blocks/lib/vector_insert_X_impl.cc.t
+++ b/gr-blocks/lib/vector_insert_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,56 +20,59 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <@NAME_IMPL@.h>
+#include "vector_insert_impl.h"
#include <algorithm>
#include <gnuradio/io_signature.h>
+#include <gnuradio/block.h>
#include <stdexcept>
#include <stdio.h>
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(const std::vector<@TYPE@> &data, int periodicity, int offset)
+ template <class T>
+ typename vector_insert<T>::sptr
+ vector_insert<T>::make(const std::vector<T> &data, int periodicity, int offset)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(data, periodicity, offset));
+ (new vector_insert_impl<T> (data, periodicity, offset));
}
- @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data,
+ template <class T>
+ vector_insert_impl<T>::vector_insert_impl(const std::vector<T> &data,
int periodicity, int offset)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@TYPE@)),
- io_signature::make(1, 1, sizeof(@TYPE@))),
+ : block("vector_insert",
+ io_signature::make(1, 1, sizeof(T)),
+ io_signature::make(1, 1, sizeof(T))),
d_data(data),
d_offset(offset),
d_periodicity(periodicity)
{
- set_tag_propagation_policy(TPP_DONT); // handle tags manually
- //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset);
+ this->set_tag_propagation_policy(gr::block::TPP_DONT); // handle tags manually
// some sanity checks
assert(offset < periodicity);
assert(offset >= 0);
assert((size_t)periodicity > data.size());
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ vector_insert_impl<T>::~vector_insert_impl()
{}
+ template <class T>
int
- @NAME_IMPL@::general_work(int noutput_items,
+ vector_insert_impl<T> ::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @TYPE@ *out = (@TYPE@ *)output_items[0];
- const @TYPE@ *in = (const @TYPE@ *)input_items[0];
+ T *out = (T *)output_items[0];
+ const T *in = (const T *)input_items[0];
int ii(0), oo(0);
@@ -81,14 +84,14 @@ namespace gr {
int max_copy = std::min(std::min(noutput_items - oo, ninput_items[0] - ii),
d_periodicity - d_offset);
std::vector<tag_t> tags;
- get_tags_in_range(tags, 0, nitems_read(0) + ii, nitems_read(0) + max_copy + ii);
+ this->get_tags_in_range(tags, 0, this->nitems_read(0) + ii, this->nitems_read(0) + max_copy + ii);
for(unsigned i = 0; i < tags.size(); i++)
{
//printf("copy tag from in@%d to out@%d\n", int(tags[i].offset), int(nitems_written(0) + oo + (tags[i].offset-nitems_read(0)-ii)));
- add_item_tag(0, nitems_written(0) + oo + (tags[i].offset-nitems_read(0)-ii), tags[i].key, tags[i].value, tags[i].srcid);
+ this->add_item_tag(0, this->nitems_written(0) + oo + (tags[i].offset-this->nitems_read(0)-ii), tags[i].key, tags[i].value, tags[i].srcid);
}
//printf("copy %d from input\n", max_copy);
- memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy );
+ memcpy( &out[oo], &in[ii], sizeof(T)*max_copy );
//printf(" * memcpy returned.\n");
ii += max_copy;
oo += max_copy;
@@ -97,7 +100,7 @@ namespace gr {
else { // if we are in the insertion region
int max_copy = std::min(noutput_items - oo, ((int)d_data.size()) - d_offset);
//printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo);
- memcpy(&out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy);
+ memcpy(&out[oo], &d_data[d_offset], sizeof(T)*max_copy);
//printf(" * memcpy returned.\n");
oo += max_copy;
d_offset = (d_offset + max_copy)%d_periodicity;
@@ -109,9 +112,14 @@ namespace gr {
//printf(" # got out of loop\n");
//printf("consume = %d, produce = %d\n", ii, oo);
- consume_each(ii);
+ this->consume_each(ii);
return oo;
}
+template class vector_insert<std::uint8_t>;
+template class vector_insert<std::int16_t>;
+template class vector_insert<std::int32_t>;
+template class vector_insert<float>;
+template class vector_insert<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/vector_insert_X_impl.h.t b/gr-blocks/lib/vector_insert_impl.h
index fa03f52693..a24fe4fc43 100644
--- a/gr-blocks/lib/vector_insert_X_impl.h.t
+++ b/gr-blocks/lib/vector_insert_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012,2013 Free Software Foundation, Inc.
+ * Copyright 2012,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,30 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef VECTOR_INSERT_IMPL_H
+#define VECTOR_INSERT_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/vector_insert.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class vector_insert_impl : public vector_insert<T>
{
private:
- std::vector<@TYPE@> d_data;
+ std::vector<T> d_data;
int d_offset;
int d_periodicity;
public:
- @NAME_IMPL@(const std::vector<@TYPE@> &data,
+ vector_insert_impl (const std::vector<T> &data,
int periodicity, int offset);
- ~@NAME_IMPL@();
+ ~vector_insert_impl ();
void rewind() { d_offset=0; }
- void set_data(const std::vector<@TYPE@> &data) {
+ void set_data(const std::vector<T> &data) {
d_data = data; rewind(); }
int general_work(int noutput_items,
@@ -55,4 +55,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* VECTOR_INSERT_IMPL_H */
diff --git a/gr-blocks/lib/vector_sink_X_impl.cc.t b/gr-blocks/lib/vector_sink_impl.cc
index 3155c0cb67..8a99b32b6d 100644
--- a/gr-blocks/lib/vector_sink_X_impl.cc.t
+++ b/gr-blocks/lib/vector_sink_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2010,2013,2017 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2010,2013,2017-2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <@NAME_IMPL@.h>
+#include "vector_sink_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/thread/thread.h>
#include <algorithm>
@@ -35,53 +34,60 @@
namespace gr {
namespace blocks {
- @NAME@::sptr
- @BASE_NAME@::make(int vlen)
+ template <class T>
+ typename vector_sink<T>::sptr
+ vector_sink<T>::make(int vlen)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(vlen));
+ (new vector_sink_impl<T> (vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(int vlen)
- : sync_block("@NAME@",
- io_signature::make(1, 1, sizeof(@TYPE@) * vlen),
+ template <class T>
+ vector_sink_impl<T> ::vector_sink_impl(int vlen)
+ : sync_block("vector_sink",
+ io_signature::make(1, 1, sizeof(T) * vlen),
io_signature::make(0, 0, 0)),
d_vlen(vlen)
{
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ vector_sink_impl<T> ::~vector_sink_impl()
{}
- std::vector<@TYPE@>
- @NAME_IMPL@::data() const
+ template <class T>
+ std::vector<T>
+ vector_sink_impl<T> ::data() const
{
gr::thread::scoped_lock guard(d_data_mutex);
return d_data;
}
+ template <class T>
std::vector<tag_t>
- @NAME_IMPL@::tags() const
+ vector_sink_impl<T> ::tags() const
{
gr::thread::scoped_lock guard(d_data_mutex);
return d_tags;
}
+ template <class T>
void
- @NAME_IMPL@::reset()
+ vector_sink_impl<T> ::reset()
{
gr::thread::scoped_lock guard(d_data_mutex);
d_tags.clear();
d_data.clear();
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ vector_sink_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @TYPE@ *iptr = (@TYPE@*)input_items[0];
+ T *iptr = (T*)input_items[0];
// can't touch this (as long as work() is working, the accessors shall not
// read the data
@@ -89,10 +95,15 @@ namespace gr {
for(int i = 0; i < noutput_items * d_vlen; i++)
d_data.push_back (iptr[i]);
std::vector<tag_t> tags;
- get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items);
+ this->get_tags_in_range(tags, 0, this->nitems_read(0), this->nitems_read(0) + noutput_items);
d_tags.insert(d_tags.end(), tags.begin(), tags.end());
return noutput_items;
}
+template class vector_sink<std::uint8_t>;
+template class vector_sink<std::int16_t>;
+template class vector_sink<std::int32_t>;
+template class vector_sink<float>;
+template class vector_sink<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/vector_sink_X_impl.h.t b/gr-blocks/lib/vector_sink_impl.h
index bf4811dfde..be083b2213 100644
--- a/gr-blocks/lib/vector_sink_X_impl.h.t
+++ b/gr-blocks/lib/vector_sink_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2009,2013,2017 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009,2013,2017-2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,31 +20,31 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef VECTOR_SINK_IMPL_H
+#define VECTOR_SINK_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/vector_sink.h>
#include <gnuradio/thread/thread.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class vector_sink_impl : public vector_sink<T>
{
private:
- std::vector<@TYPE@> d_data;
+ std::vector<T> d_data;
std::vector<tag_t> d_tags;
mutable gr::thread::mutex d_data_mutex; // protects internal data access.
int d_vlen;
public:
- @NAME_IMPL@(int vlen);
- ~@NAME_IMPL@();
+ vector_sink_impl (int vlen);
+ ~vector_sink_impl ();
void reset();
- std::vector<@TYPE@> data() const;
+ std::vector<T> data() const;
std::vector<tag_t> tags() const;
int work(int noutput_items,
@@ -55,4 +55,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* VECTOR_SINK_IMPL_H */
diff --git a/gr-blocks/lib/vector_source_X_impl.cc.t b/gr-blocks/lib/vector_source_impl.cc
index 82e157268c..fd1ad16981 100644
--- a/gr-blocks/lib/vector_source_X_impl.cc.t
+++ b/gr-blocks/lib/vector_source_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2010,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <@NAME_IMPL@.h>
+#include "vector_source_impl.h"
#include <algorithm>
#include <gnuradio/io_signature.h>
#include <stdexcept>
@@ -34,21 +33,23 @@
namespace gr {
namespace blocks {
- @NAME@::sptr
- @NAME@::make(const std::vector<@TYPE@> &data,
+ template <class T>
+ typename vector_source<T>::sptr
+ vector_source<T>::make(const std::vector<T> &data,
bool repeat, int vlen,
const std::vector<tag_t> &tags)
{
return gnuradio::get_initial_sptr
- (new @NAME_IMPL@(data, repeat, vlen, tags));
+ (new vector_source_impl<T> (data, repeat, vlen, tags));
}
- @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data,
+ template <class T>
+ vector_source_impl<T> ::vector_source_impl(const std::vector<T> &data,
bool repeat, int vlen,
const std::vector<tag_t> &tags)
- : sync_block("@BASE_NAME@",
+ : sync_block("vector_source",
io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@) * vlen)),
+ io_signature::make(1, 1, sizeof(T) * vlen)),
d_data(data),
d_repeat(repeat),
d_offset(0),
@@ -60,17 +61,19 @@ namespace gr {
}
else {
d_settags = 1;
- set_output_multiple(data.size() / vlen);
+ this->set_output_multiple(data.size() / vlen);
}
if((data.size() % vlen) != 0)
throw std::invalid_argument("data length must be a multiple of vlen");
}
- @NAME_IMPL@::~@NAME_IMPL@()
+ template <class T>
+ vector_source_impl<T> ::~vector_source_impl()
{}
+ template <class T>
void
- @NAME_IMPL@::set_data (const std::vector<@TYPE@> &data,
+ vector_source_impl<T> ::set_data (const std::vector<T> &data,
const std::vector<tag_t> &tags)
{
d_data = data;
@@ -84,12 +87,13 @@ namespace gr {
}
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ vector_source_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @TYPE@ *optr = (@TYPE@ *) output_items[0];
+ T *optr = (T *) output_items[0];
if(d_repeat) {
unsigned int size = d_data.size ();
@@ -101,10 +105,10 @@ namespace gr {
int n_outputitems_per_vector = d_data.size() / d_vlen;
for(int i = 0; i < noutput_items; i += n_outputitems_per_vector) {
// FIXME do proper vector copy
- memcpy((void *) optr, (const void*)&d_data[0], size*sizeof (@TYPE@));
+ memcpy((void *) optr, (const void*)&d_data[0], size*sizeof (T));
optr += size;
for(unsigned t = 0; t < d_tags.size(); t++) {
- add_item_tag(0, nitems_written(0)+i+d_tags[t].offset,
+ this->add_item_tag(0, this->nitems_written(0)+i+d_tags[t].offset,
d_tags[t].key, d_tags[t].value, d_tags[t].srcid);
}
}
@@ -132,7 +136,7 @@ namespace gr {
}
for(unsigned t = 0; t < d_tags.size(); t++) {
if((d_tags[t].offset >= d_offset) && (d_tags[t].offset < d_offset+n))
- add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value,
+ this->add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value,
d_tags[t].srcid);
}
d_offset += n;
@@ -140,5 +144,10 @@ namespace gr {
}
}
+template class vector_source<std::uint8_t>;
+template class vector_source<std::int16_t>;
+template class vector_source<std::int32_t>;
+template class vector_source<float>;
+template class vector_source<gr_complex>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/vector_source_X_impl.h.t b/gr-blocks/lib/vector_source_impl.h
index 07bfc53e63..b4161d68fc 100644
--- a/gr-blocks/lib/vector_source_X_impl.h.t
+++ b/gr-blocks/lib/vector_source_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2012-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,20 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
+#ifndef VECTOR_SOURCE_IMPL_H
+#define VECTOR_SOURCE_IMPL_H
-#include <gnuradio/blocks/@NAME@.h>
+#include <gnuradio/blocks/vector_source.h>
namespace gr {
namespace blocks {
- class @NAME_IMPL@ : public @NAME@
+template<class T>
+ class vector_source_impl : public vector_source<T>
{
private:
- std::vector<@TYPE@> d_data;
+ std::vector<T> d_data;
bool d_repeat;
unsigned int d_offset;
int d_vlen;
@@ -41,13 +41,13 @@ namespace gr {
std::vector<tag_t> d_tags;
public:
- @NAME_IMPL@(const std::vector<@TYPE@> &data,
+ vector_source_impl (const std::vector<T> &data,
bool repeat, int vlen,
const std::vector<tag_t> &tags);
- ~@NAME_IMPL@();
+ ~vector_source_impl ();
void rewind() { d_offset=0; }
- void set_data(const std::vector<@TYPE@> &data,
+ void set_data(const std::vector<T> &data,
const std::vector<tag_t> &tags);
void set_repeat(bool repeat) { d_repeat=repeat; };
@@ -59,4 +59,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* @GUARD_NAME_IMPL@ */
+#endif /* VECTOR_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/xor_XX_impl.cc.t b/gr-blocks/lib/xor_XX_impl.cc.t
deleted file mode 100644
index aa7a542ed9..0000000000
--- a/gr-blocks/lib/xor_XX_impl.cc.t
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME_IMPL@.h>
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
- {
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
- }
-
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
- d_vlen(vlen)
- {
- }
-
- int
- @NAME_IMPL@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
-
- int ninputs = input_items.size ();
-
- for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
- for (int j = 1; j < ninputs; j++)
- acc ^= ((@I_TYPE@ *) input_items[j])[i];
-
- *optr++ = (@O_TYPE@) acc;
- }
-
- return noutput_items;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/xor_XX_impl.h.t b/gr-blocks/lib/xor_XX_impl.h.t
deleted file mode 100644
index f7db3f2162..0000000000
--- a/gr-blocks/lib/xor_XX_impl.h.t
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME_IMPL@
-#define @GUARD_NAME_IMPL@
-
-#include <gnuradio/blocks/@NAME@.h>
-
-namespace gr {
- namespace blocks {
-
- class BLOCKS_API @NAME_IMPL@ : public @NAME@
- {
- size_t d_vlen;
-
- public:
- @NAME_IMPL@(size_t vlen);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/and_XX_impl.cc.t b/gr-blocks/lib/xor_blk_impl.cc
index c2aa31c50c..5180e6a600 100644
--- a/gr-blocks/lib/and_XX_impl.cc.t
+++ b/gr-blocks/lib/xor_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,50 +20,54 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <@NAME_IMPL@.h>
+#include "xor_blk_impl.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace blocks {
-
- @NAME@::sptr @NAME@::make(size_t vlen)
+ template <class T>
+ typename xor_blk<T>::sptr xor_blk<T>::make(size_t vlen)
{
- return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ return gnuradio::get_initial_sptr(new xor_blk_impl<T> (vlen));
}
- @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
- : sync_block ("@NAME@",
- io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen),
- io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)),
+ template <class T>
+ xor_blk_impl<T> ::xor_blk_impl(size_t vlen)
+ : sync_block ("xor_blk",
+ io_signature::make (1, -1, sizeof (T)*vlen),
+ io_signature::make (1, 1, sizeof (T)*vlen)),
d_vlen(vlen)
{
}
+ template <class T>
int
- @NAME_IMPL@::work(int noutput_items,
+ xor_blk_impl<T> ::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ T *optr = (T *) output_items[0];
int ninputs = input_items.size ();
for (size_t i = 0; i < noutput_items*d_vlen; i++){
- @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ T acc = ((T *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
- acc &= ((@I_TYPE@ *) input_items[j])[i];
+ acc ^= ((T *) input_items[j])[i];
- *optr++ = (@O_TYPE@) acc;
+ *optr++ = (T) acc;
}
return noutput_items;
}
+template class xor_blk<std::uint8_t>;
+template class xor_blk<std::int16_t>;
+template class xor_blk<std::int32_t>;
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/divide_ff_impl.h b/gr-blocks/lib/xor_blk_impl.h
index efa099f93c..72caa0a799 100644
--- a/gr-blocks/lib/divide_ff_impl.h
+++ b/gr-blocks/lib/xor_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004-2016 Free Software Foundation, Inc.
+ * Copyright 2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,20 +21,21 @@
*/
-#ifndef __DIVIDE_FF_IMPL_H__
-#define __DIVIDE_FF_IMPL_H__
+#ifndef XOR_BLK_IMPL_H
+#define XOR_BLK_IMPL_H
-#include <gnuradio/blocks/divide_ff.h>
+#include <gnuradio/blocks/xor_blk.h>
namespace gr {
namespace blocks {
- class BLOCKS_API divide_ff_impl : public divide_ff
+template<class T>
+ class BLOCKS_API xor_blk_impl : public xor_blk<T>
{
size_t d_vlen;
public:
- divide_ff_impl(size_t vlen);
+ xor_blk_impl (size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -44,4 +45,4 @@ namespace gr {
} /* namespace blocks */
} /* namespace gr */
-#endif /* include guard */
+#endif /* XOR_BLK_IMPL_H */
diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt
index d5e9a8a725..1dc4aca483 100644
--- a/gr-blocks/swig/CMakeLists.txt
+++ b/gr-blocks/swig/CMakeLists.txt
@@ -66,7 +66,6 @@ foreach(swigfile ${GR_SWIG_BLOCK_IFILES})
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/blocks
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
- set(GR_SWIG_TARGET_DEPS blocks_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-blocks)
GR_SWIG_MAKE(${swigfile} ${swigfile}.i)
diff --git a/gr-blocks/swig/blocks_swig1.i b/gr-blocks/swig/blocks_swig1.i
index cbff920d02..f94f5e0253 100644
--- a/gr-blocks/swig/blocks_swig1.i
+++ b/gr-blocks/swig/blocks_swig1.i
@@ -31,21 +31,9 @@
#include "gnuradio/blocks/vector_map.h"
#include "gnuradio/blocks/vector_to_stream.h"
#include "gnuradio/blocks/vector_to_streams.h"
-#include "gnuradio/blocks/vector_insert_b.h"
-#include "gnuradio/blocks/vector_insert_s.h"
-#include "gnuradio/blocks/vector_insert_i.h"
-#include "gnuradio/blocks/vector_insert_f.h"
-#include "gnuradio/blocks/vector_insert_c.h"
-#include "gnuradio/blocks/vector_sink_b.h"
-#include "gnuradio/blocks/vector_sink_s.h"
-#include "gnuradio/blocks/vector_sink_i.h"
-#include "gnuradio/blocks/vector_sink_f.h"
-#include "gnuradio/blocks/vector_sink_c.h"
-#include "gnuradio/blocks/vector_source_b.h"
-#include "gnuradio/blocks/vector_source_s.h"
-#include "gnuradio/blocks/vector_source_i.h"
-#include "gnuradio/blocks/vector_source_f.h"
-#include "gnuradio/blocks/vector_source_c.h"
+#include "gnuradio/blocks/vector_insert.h"
+#include "gnuradio/blocks/vector_sink.h"
+#include "gnuradio/blocks/vector_source.h"
#include "gnuradio/blocks/wavfile_sink.h"
#include "gnuradio/blocks/wavfile_source.h"
%}
@@ -53,41 +41,29 @@
%include "gnuradio/blocks/vector_map.h"
%include "gnuradio/blocks/vector_to_stream.h"
%include "gnuradio/blocks/vector_to_streams.h"
-%include "gnuradio/blocks/vector_insert_b.h"
-%include "gnuradio/blocks/vector_insert_s.h"
-%include "gnuradio/blocks/vector_insert_i.h"
-%include "gnuradio/blocks/vector_insert_f.h"
-%include "gnuradio/blocks/vector_insert_c.h"
-%include "gnuradio/blocks/vector_sink_b.h"
-%include "gnuradio/blocks/vector_sink_s.h"
-%include "gnuradio/blocks/vector_sink_i.h"
-%include "gnuradio/blocks/vector_sink_f.h"
-%include "gnuradio/blocks/vector_sink_c.h"
-%include "gnuradio/blocks/vector_source_b.h"
-%include "gnuradio/blocks/vector_source_s.h"
-%include "gnuradio/blocks/vector_source_i.h"
-%include "gnuradio/blocks/vector_source_f.h"
-%include "gnuradio/blocks/vector_source_c.h"
+%include "gnuradio/blocks/vector_insert.h"
+%include "gnuradio/blocks/vector_sink.h"
+%include "gnuradio/blocks/vector_source.h"
%include "gnuradio/blocks/wavfile_sink.h"
%include "gnuradio/blocks/wavfile_source.h"
GR_SWIG_BLOCK_MAGIC2(blocks, vector_map);
GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f);
-GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_insert_b, vector_insert<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_insert_s, vector_insert<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_insert_i, vector_insert<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_insert_f, vector_insert<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_insert_c, vector_insert<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_sink_b, vector_sink<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_sink_s, vector_sink<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_sink_i, vector_sink<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_sink_f, vector_sink<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_sink_c, vector_sink<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_source_b, vector_source<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_source_s, vector_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_source_i, vector_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_source_f, vector_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, vector_source_c, vector_source<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink);
GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source);
diff --git a/gr-blocks/swig/blocks_swig10.i b/gr-blocks/swig/blocks_swig10.i
index 5872b17cf3..32ecbea9ef 100644
--- a/gr-blocks/swig/blocks_swig10.i
+++ b/gr-blocks/swig/blocks_swig10.i
@@ -28,63 +28,41 @@
%include "blocks_swig10_doc.i"
%{
-#include "gnuradio/blocks/min_ff.h"
-#include "gnuradio/blocks/min_ii.h"
-#include "gnuradio/blocks/min_ss.h"
-#include "gnuradio/blocks/moving_average_cc.h"
-#include "gnuradio/blocks/moving_average_ff.h"
-#include "gnuradio/blocks/moving_average_ii.h"
-#include "gnuradio/blocks/moving_average_ss.h"
+#include "gnuradio/blocks/min_blk.h"
+#include "gnuradio/blocks/moving_average.h"
#include "gnuradio/blocks/nlog10_ff.h"
-#include "gnuradio/blocks/not_bb.h"
-#include "gnuradio/blocks/not_ss.h"
-#include "gnuradio/blocks/not_ii.h"
-#include "gnuradio/blocks/or_bb.h"
-#include "gnuradio/blocks/or_ss.h"
-#include "gnuradio/blocks/or_ii.h"
+#include "gnuradio/blocks/not_blk.h"
+#include "gnuradio/blocks/or_blk.h"
#include "gnuradio/blocks/patterned_interleaver.h"
#include "gnuradio/blocks/pack_k_bits_bb.h"
-#include "gnuradio/blocks/packed_to_unpacked_bb.h"
-#include "gnuradio/blocks/packed_to_unpacked_ss.h"
-#include "gnuradio/blocks/packed_to_unpacked_ii.h"
+#include "gnuradio/blocks/packed_to_unpacked.h"
%}
-%include "gnuradio/blocks/min_ff.h"
-%include "gnuradio/blocks/min_ii.h"
-%include "gnuradio/blocks/min_ss.h"
-%include "gnuradio/blocks/moving_average_cc.h"
-%include "gnuradio/blocks/moving_average_ff.h"
-%include "gnuradio/blocks/moving_average_ii.h"
-%include "gnuradio/blocks/moving_average_ss.h"
+%include "gnuradio/blocks/min_blk.h"
+%include "gnuradio/blocks/moving_average.h"
%include "gnuradio/blocks/nlog10_ff.h"
-%include "gnuradio/blocks/not_bb.h"
-%include "gnuradio/blocks/not_ss.h"
-%include "gnuradio/blocks/not_ii.h"
-%include "gnuradio/blocks/or_bb.h"
-%include "gnuradio/blocks/or_ss.h"
-%include "gnuradio/blocks/or_ii.h"
+%include "gnuradio/blocks/not_blk.h"
+%include "gnuradio/blocks/or_blk.h"
%include "gnuradio/blocks/patterned_interleaver.h"
%include "gnuradio/blocks/pack_k_bits_bb.h"
-%include "gnuradio/blocks/packed_to_unpacked_bb.h"
-%include "gnuradio/blocks/packed_to_unpacked_ss.h"
-%include "gnuradio/blocks/packed_to_unpacked_ii.h"
+%include "gnuradio/blocks/packed_to_unpacked.h"
-GR_SWIG_BLOCK_MAGIC2(blocks, min_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, min_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, min_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ss);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, min_ff, min_blk<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, min_ii, min_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, min_ss, min_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, moving_average_cc, moving_average<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, moving_average_ff, moving_average<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, moving_average_ii, moving_average<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, moving_average_ss, moving_average<std::int16_t>);
GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, not_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, not_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, not_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, not_bb, not_blk<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, not_ss, not_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, not_ii, not_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, or_bb, or_blk<char>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, or_ss, or_blk<short>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, or_ii, or_blk<int>);
GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver);
GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, packed_to_unpacked_bb, packed_to_unpacked<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, packed_to_unpacked_ss, packed_to_unpacked<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, packed_to_unpacked_ii, packed_to_unpacked<std::int32_t>);
diff --git a/gr-blocks/swig/blocks_swig2.i b/gr-blocks/swig/blocks_swig2.i
index ea25a6bccc..60ffa06e79 100644
--- a/gr-blocks/swig/blocks_swig2.i
+++ b/gr-blocks/swig/blocks_swig2.i
@@ -31,12 +31,8 @@
%include "feval.i"
%{
-#include "gnuradio/blocks/and_const_bb.h"
-#include "gnuradio/blocks/and_const_ss.h"
-#include "gnuradio/blocks/and_const_ii.h"
-#include "gnuradio/blocks/argmax_fs.h"
-#include "gnuradio/blocks/argmax_is.h"
-#include "gnuradio/blocks/argmax_ss.h"
+#include "gnuradio/blocks/and_const.h"
+#include "gnuradio/blocks/argmax.h"
#include "gnuradio/blocks/bin_statistics_f.h"
#include "gnuradio/blocks/burst_tagger.h"
#include "gnuradio/blocks/char_to_float.h"
@@ -54,12 +50,8 @@
#include "gnuradio/blocks/conjugate_cc.h"
%}
-%include "gnuradio/blocks/and_const_bb.h"
-%include "gnuradio/blocks/and_const_ss.h"
-%include "gnuradio/blocks/and_const_ii.h"
-%include "gnuradio/blocks/argmax_fs.h"
-%include "gnuradio/blocks/argmax_is.h"
-%include "gnuradio/blocks/argmax_ss.h"
+%include "gnuradio/blocks/and_const.h"
+%include "gnuradio/blocks/argmax.h"
%include "gnuradio/blocks/char_to_float.h"
%include "gnuradio/blocks/bin_statistics_f.h"
%include "gnuradio/blocks/burst_tagger.h"
@@ -76,12 +68,12 @@
%include "gnuradio/blocks/complex_to_arg.h"
%include "gnuradio/blocks/conjugate_cc.h"
-GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, argmax_fs);
-GR_SWIG_BLOCK_MAGIC2(blocks, argmax_is);
-GR_SWIG_BLOCK_MAGIC2(blocks, argmax_ss);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_const_bb, and_const<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_const_ss, and_const<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_const_ii, and_const<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, argmax_fs, argmax<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, argmax_is, argmax<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, argmax_ss, argmax<std::int16_t>);
GR_SWIG_BLOCK_MAGIC2(blocks, bin_statistics_f);
GR_SWIG_BLOCK_MAGIC2(blocks, burst_tagger);
GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float);
diff --git a/gr-blocks/swig/blocks_swig3.i b/gr-blocks/swig/blocks_swig3.i
index 6794b75d57..6be0b4a86c 100644
--- a/gr-blocks/swig/blocks_swig3.i
+++ b/gr-blocks/swig/blocks_swig3.i
@@ -28,66 +28,40 @@
%include "blocks_swig3_doc.i"
%{
-#include "gnuradio/blocks/multiply_ss.h"
-#include "gnuradio/blocks/multiply_ii.h"
-#include "gnuradio/blocks/multiply_ff.h"
-#include "gnuradio/blocks/multiply_cc.h"
+#include "gnuradio/blocks/multiply.h"
#include "gnuradio/blocks/multiply_conjugate_cc.h"
-#include "gnuradio/blocks/multiply_const_ss.h"
-#include "gnuradio/blocks/multiply_const_ii.h"
-#include "gnuradio/blocks/multiply_const_ff.h"
-#include "gnuradio/blocks/multiply_const_cc.h"
-#include "gnuradio/blocks/multiply_const_vss.h"
-#include "gnuradio/blocks/multiply_const_vii.h"
-#include "gnuradio/blocks/multiply_const_vff.h"
-#include "gnuradio/blocks/multiply_const_vcc.h"
-#include "gnuradio/blocks/multiply_matrix_cc.h"
-#include "gnuradio/blocks/multiply_matrix_ff.h"
+#include "gnuradio/blocks/multiply_const.h"
+#include "gnuradio/blocks/multiply_const_v.h"
+#include "gnuradio/blocks/multiply_matrix.h"
#include "gnuradio/blocks/multiply_by_tag_value_cc.h"
-#include "gnuradio/blocks/mute_ss.h"
-#include "gnuradio/blocks/mute_ii.h"
-#include "gnuradio/blocks/mute_ff.h"
-#include "gnuradio/blocks/mute_cc.h"
+#include "gnuradio/blocks/mute.h"
%}
-%include "gnuradio/blocks/multiply_ss.h"
-%include "gnuradio/blocks/multiply_ii.h"
-%include "gnuradio/blocks/multiply_ff.h"
-%include "gnuradio/blocks/multiply_cc.h"
+%include "gnuradio/blocks/multiply.h"
%include "gnuradio/blocks/multiply_conjugate_cc.h"
-%include "gnuradio/blocks/multiply_const_ss.h"
-%include "gnuradio/blocks/multiply_const_ii.h"
-%include "gnuradio/blocks/multiply_const_ff.h"
-%include "gnuradio/blocks/multiply_const_cc.h"
-%include "gnuradio/blocks/multiply_const_vss.h"
-%include "gnuradio/blocks/multiply_const_vii.h"
-%include "gnuradio/blocks/multiply_const_vff.h"
-%include "gnuradio/blocks/multiply_const_vcc.h"
-%include "gnuradio/blocks/multiply_matrix_cc.h"
-%include "gnuradio/blocks/multiply_matrix_ff.h"
+%include "gnuradio/blocks/multiply_const.h"
+%include "gnuradio/blocks/multiply_const_v.h"
+%include "gnuradio/blocks/multiply_matrix.h"
%include "gnuradio/blocks/multiply_by_tag_value_cc.h"
-%include "gnuradio/blocks/mute_ss.h"
-%include "gnuradio/blocks/mute_ii.h"
-%include "gnuradio/blocks/mute_ff.h"
-%include "gnuradio/blocks/mute_cc.h"
+%include "gnuradio/blocks/mute.h"
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_ss, multiply<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_ii, multiply<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_ff, multiply<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_cc, multiply<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_conjugate_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_matrix_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, multiply_matrix_ff);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_ss, multiply_const<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_ii, multiply_const<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_ff, multiply_const<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_cc, multiply_const<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_vss, multiply_const_v<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_vii, multiply_const_v<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_vff, multiply_const_v<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_const_vcc, multiply_const_v<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_matrix_cc, multiply_matrix<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, multiply_matrix_ff, multiply_matrix<float>);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_by_tag_value_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, mute_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, mute_ss, mute_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, mute_ii, mute_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, mute_ff, mute_blk<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, mute_cc, mute_blk<gr_complex>);
diff --git a/gr-blocks/swig/blocks_swig4.i b/gr-blocks/swig/blocks_swig4.i
index bb39740123..f6c0445d58 100644
--- a/gr-blocks/swig/blocks_swig4.i
+++ b/gr-blocks/swig/blocks_swig4.i
@@ -35,48 +35,28 @@
#include "gnuradio/blocks/pdu_set.h"
#include "gnuradio/blocks/pdu_remove.h"
#include "gnuradio/blocks/pdu_to_tagged_stream.h"
-#include "gnuradio/blocks/peak_detector_fb.h"
-#include "gnuradio/blocks/peak_detector_ib.h"
-#include "gnuradio/blocks/peak_detector_sb.h"
+#include "gnuradio/blocks/peak_detector.h"
#include "gnuradio/blocks/peak_detector2_fb.h"
#include "gnuradio/blocks/plateau_detector_fb.h"
#include "gnuradio/blocks/probe_rate.h"
-#include "gnuradio/blocks/probe_signal_b.h"
-#include "gnuradio/blocks/probe_signal_s.h"
-#include "gnuradio/blocks/probe_signal_i.h"
-#include "gnuradio/blocks/probe_signal_f.h"
-#include "gnuradio/blocks/probe_signal_c.h"
-#include "gnuradio/blocks/probe_signal_vb.h"
-#include "gnuradio/blocks/probe_signal_vs.h"
-#include "gnuradio/blocks/probe_signal_vi.h"
-#include "gnuradio/blocks/probe_signal_vf.h"
-#include "gnuradio/blocks/probe_signal_vc.h"
+#include "gnuradio/blocks/probe_signal.h"
+#include "gnuradio/blocks/probe_signal_v.h"
%}
-%include "gnuradio/blocks/probe_signal_b.h"
-%include "gnuradio/blocks/probe_signal_s.h"
-%include "gnuradio/blocks/probe_signal_i.h"
-%include "gnuradio/blocks/probe_signal_f.h"
-%include "gnuradio/blocks/probe_signal_c.h"
-%include "gnuradio/blocks/probe_signal_vb.h"
-%include "gnuradio/blocks/probe_signal_vs.h"
-%include "gnuradio/blocks/probe_signal_vi.h"
-%include "gnuradio/blocks/probe_signal_vf.h"
-%include "gnuradio/blocks/probe_signal_vc.h"
+%include "gnuradio/blocks/probe_signal.h"
+%include "gnuradio/blocks/probe_signal_v.h"
%include "gnuradio/blocks/pdu_filter.h"
%include "gnuradio/blocks/pdu_set.h"
%include "gnuradio/blocks/pdu_remove.h"
%include "gnuradio/blocks/pdu_to_tagged_stream.h"
-%include "gnuradio/blocks/peak_detector_fb.h"
-%include "gnuradio/blocks/peak_detector_ib.h"
-%include "gnuradio/blocks/peak_detector_sb.h"
+%include "gnuradio/blocks/peak_detector.h"
%include "gnuradio/blocks/peak_detector2_fb.h"
%include "gnuradio/blocks/plateau_detector_fb.h"
%include "gnuradio/blocks/probe_rate.h"
-GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_fb);
-GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_ib);
-GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_sb);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, peak_detector_fb, peak_detector<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, peak_detector_ib, peak_detector<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, peak_detector_sb, peak_detector<std::int16_t>);
GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, plateau_detector_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, pdu_filter);
@@ -84,13 +64,13 @@ GR_SWIG_BLOCK_MAGIC2(blocks, pdu_set);
GR_SWIG_BLOCK_MAGIC2(blocks, pdu_remove);
GR_SWIG_BLOCK_MAGIC2(blocks, pdu_to_tagged_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, probe_rate);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_b);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_s);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_i);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_f);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_c);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vb);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vs);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vi);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vf);
-GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_b, probe_signal<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_s, probe_signal<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_i, probe_signal<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_f, probe_signal<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_c, probe_signal<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_vb, probe_signal_v<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_vs, probe_signal_v<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_vi, probe_signal_v<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_vf, probe_signal_v<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, probe_signal_vc, probe_signal_v<gr_complex>);
diff --git a/gr-blocks/swig/blocks_swig5.i b/gr-blocks/swig/blocks_swig5.i
index da8048370a..d7d2d7143a 100644
--- a/gr-blocks/swig/blocks_swig5.i
+++ b/gr-blocks/swig/blocks_swig5.i
@@ -39,18 +39,12 @@
#include "gnuradio/blocks/rms_cf.h"
#include "gnuradio/blocks/rms_ff.h"
#include "gnuradio/blocks/rotator_cc.h"
-#include "gnuradio/blocks/sample_and_hold_bb.h"
-#include "gnuradio/blocks/sample_and_hold_ss.h"
-#include "gnuradio/blocks/sample_and_hold_ii.h"
-#include "gnuradio/blocks/sample_and_hold_ff.h"
+#include "gnuradio/blocks/sample_and_hold.h"
#include "gnuradio/blocks/short_to_char.h"
#include "gnuradio/blocks/short_to_float.h"
#include "gnuradio/blocks/socket_pdu.h"
#include "gnuradio/blocks/stretch_ff.h"
-#include "gnuradio/blocks/sub_ff.h"
-#include "gnuradio/blocks/sub_ss.h"
-#include "gnuradio/blocks/sub_ii.h"
-#include "gnuradio/blocks/sub_cc.h"
+#include "gnuradio/blocks/sub.h"
%}
%include "gnuradio/blocks/random_pdu.h"
@@ -60,18 +54,12 @@
%include "gnuradio/blocks/rms_cf.h"
%include "gnuradio/blocks/rms_ff.h"
%include "gnuradio/blocks/rotator_cc.h"
-%include "gnuradio/blocks/sample_and_hold_bb.h"
-%include "gnuradio/blocks/sample_and_hold_ss.h"
-%include "gnuradio/blocks/sample_and_hold_ii.h"
-%include "gnuradio/blocks/sample_and_hold_ff.h"
+%include "gnuradio/blocks/sample_and_hold.h"
%include "gnuradio/blocks/short_to_char.h"
%include "gnuradio/blocks/short_to_float.h"
%include "gnuradio/blocks/socket_pdu.h"
%include "gnuradio/blocks/stretch_ff.h"
-%include "gnuradio/blocks/sub_ff.h"
-%include "gnuradio/blocks/sub_ss.h"
-%include "gnuradio/blocks/sub_ii.h"
-%include "gnuradio/blocks/sub_cc.h"
+%include "gnuradio/blocks/sub.h"
GR_SWIG_BLOCK_MAGIC2(blocks, random_pdu);
GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
@@ -80,15 +68,15 @@ GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, rotator_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sample_and_hold_bb, sample_and_hold<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sample_and_hold_ss, sample_and_hold<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sample_and_hold_ii, sample_and_hold<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sample_and_hold_ff, sample_and_hold<float>);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu);
GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sub_ff, sub<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sub_ss, sub<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sub_ii, sub<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, sub_cc, sub<gr_complex>);
diff --git a/gr-blocks/swig/blocks_swig6.i b/gr-blocks/swig/blocks_swig6.i
index f4c266814b..38f5c9538e 100644
--- a/gr-blocks/swig/blocks_swig6.i
+++ b/gr-blocks/swig/blocks_swig6.i
@@ -48,14 +48,10 @@
#include "gnuradio/blocks/udp_source.h"
#include "gnuradio/blocks/unpack_k_bits.h"
#include "gnuradio/blocks/unpack_k_bits_bb.h"
-#include "gnuradio/blocks/unpacked_to_packed_bb.h"
-#include "gnuradio/blocks/unpacked_to_packed_ss.h"
-#include "gnuradio/blocks/unpacked_to_packed_ii.h"
+#include "gnuradio/blocks/unpacked_to_packed.h"
#include "gnuradio/blocks/vco_f.h"
#include "gnuradio/blocks/vco_c.h"
-#include "gnuradio/blocks/xor_bb.h"
-#include "gnuradio/blocks/xor_ss.h"
-#include "gnuradio/blocks/xor_ii.h"
+#include "gnuradio/blocks/xor_blk.h"
%}
%include "gnuradio/blocks/tag_gate.h"
@@ -75,14 +71,10 @@
%include "gnuradio/blocks/udp_source.h"
%include "gnuradio/blocks/unpack_k_bits.h"
%include "gnuradio/blocks/unpack_k_bits_bb.h"
-%include "gnuradio/blocks/unpacked_to_packed_bb.h"
-%include "gnuradio/blocks/unpacked_to_packed_ss.h"
-%include "gnuradio/blocks/unpacked_to_packed_ii.h"
+%include "gnuradio/blocks/unpacked_to_packed.h"
%include "gnuradio/blocks/vco_f.h"
%include "gnuradio/blocks/vco_c.h"
-%include "gnuradio/blocks/xor_bb.h"
-%include "gnuradio/blocks/xor_ss.h"
-%include "gnuradio/blocks/xor_ii.h"
+%include "gnuradio/blocks/xor_blk.h"
GR_SWIG_BLOCK_MAGIC2(blocks, tag_gate);
GR_SWIG_BLOCK_MAGIC2(blocks, tag_share);
@@ -100,11 +92,11 @@ GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, udp_sink);
GR_SWIG_BLOCK_MAGIC2(blocks, udp_source);
GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, unpacked_to_packed_bb, unpacked_to_packed<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, unpacked_to_packed_ss, unpacked_to_packed<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, unpacked_to_packed_ii, unpacked_to_packed<std::int32_t>);
GR_SWIG_BLOCK_MAGIC2(blocks, vco_f);
GR_SWIG_BLOCK_MAGIC2(blocks, vco_c);
-GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, xor_bb, xor_blk<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, xor_ss, xor_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, xor_ii, xor_blk<std::int32_t>);
diff --git a/gr-blocks/swig/blocks_swig7.i b/gr-blocks/swig/blocks_swig7.i
index 20ca46dee6..6314873b71 100644
--- a/gr-blocks/swig/blocks_swig7.i
+++ b/gr-blocks/swig/blocks_swig7.i
@@ -32,10 +32,7 @@
%{
#include "gnuradio/blocks/deinterleave.h"
-#include "gnuradio/blocks/divide_ff.h"
-#include "gnuradio/blocks/divide_ss.h"
-#include "gnuradio/blocks/divide_ii.h"
-#include "gnuradio/blocks/divide_cc.h"
+#include "gnuradio/blocks/divide.h"
#include "gnuradio/blocks/exponentiate_const_cci.h"
#include "gnuradio/blocks/skiphead.h"
#include "gnuradio/blocks/stream_mux.h"
@@ -46,19 +43,12 @@
#include "gnuradio/blocks/streams_to_vector.h"
#include "gnuradio/blocks/tag_debug.h"
#include "gnuradio/blocks/tagged_file_sink.h"
-#include "gnuradio/blocks/tsb_vector_sink_b.h"
-#include "gnuradio/blocks/tsb_vector_sink_c.h"
-#include "gnuradio/blocks/tsb_vector_sink_f.h"
-#include "gnuradio/blocks/tsb_vector_sink_i.h"
-#include "gnuradio/blocks/tsb_vector_sink_s.h"
+#include "gnuradio/blocks/tsb_vector_sink.h"
#include "gnuradio/blocks/throttle.h"
%}
%include "gnuradio/blocks/deinterleave.h"
-%include "gnuradio/blocks/divide_ff.h"
-%include "gnuradio/blocks/divide_ss.h"
-%include "gnuradio/blocks/divide_ii.h"
-%include "gnuradio/blocks/divide_cc.h"
+%include "gnuradio/blocks/divide.h"
%include "gnuradio/blocks/exponentiate_const_cci.h"
%include "gnuradio/blocks/skiphead.h"
%include "gnuradio/blocks/stream_mux.h"
@@ -69,18 +59,14 @@
%include "gnuradio/blocks/streams_to_vector.h"
%include "gnuradio/blocks/tag_debug.h"
%include "gnuradio/blocks/tagged_file_sink.h"
-%include "gnuradio/blocks/tsb_vector_sink_b.h"
-%include "gnuradio/blocks/tsb_vector_sink_c.h"
-%include "gnuradio/blocks/tsb_vector_sink_f.h"
-%include "gnuradio/blocks/tsb_vector_sink_i.h"
-%include "gnuradio/blocks/tsb_vector_sink_s.h"
+%include "gnuradio/blocks/tsb_vector_sink.h"
%include "gnuradio/blocks/throttle.h"
GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave);
-GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, divide_ff, divide<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, divide_ss, divide<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, divide_ii, divide<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, divide_cc, divide<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(blocks, exponentiate_const_cci);
GR_SWIG_BLOCK_MAGIC2(blocks, skiphead);
GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux);
@@ -91,9 +77,9 @@ GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector);
GR_SWIG_BLOCK_MAGIC2(blocks, tag_debug);
GR_SWIG_BLOCK_MAGIC2(blocks, tagged_file_sink);
-GR_SWIG_BLOCK_MAGIC2(blocks, tsb_vector_sink_b);
-GR_SWIG_BLOCK_MAGIC2(blocks, tsb_vector_sink_c);
-GR_SWIG_BLOCK_MAGIC2(blocks, tsb_vector_sink_f);
-GR_SWIG_BLOCK_MAGIC2(blocks, tsb_vector_sink_i);
-GR_SWIG_BLOCK_MAGIC2(blocks, tsb_vector_sink_s);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, tsb_vector_sink_b, tsb_vector_sink<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, tsb_vector_sink_c, tsb_vector_sink<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, tsb_vector_sink_f, tsb_vector_sink<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, tsb_vector_sink_i, tsb_vector_sink<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, tsb_vector_sink_s, tsb_vector_sink<std::int16_t>);
GR_SWIG_BLOCK_MAGIC2(blocks, throttle);
diff --git a/gr-blocks/swig/blocks_swig8.i b/gr-blocks/swig/blocks_swig8.i
index 2bf5070bb8..78f6c145df 100644
--- a/gr-blocks/swig/blocks_swig8.i
+++ b/gr-blocks/swig/blocks_swig8.i
@@ -28,66 +28,44 @@
%include "blocks_swig8_doc.i"
%{
-#include "gnuradio/blocks/abs_ff.h"
-#include "gnuradio/blocks/abs_ss.h"
-#include "gnuradio/blocks/abs_ii.h"
-#include "gnuradio/blocks/add_ff.h"
-#include "gnuradio/blocks/add_ss.h"
-#include "gnuradio/blocks/add_ii.h"
-#include "gnuradio/blocks/add_cc.h"
+#include "gnuradio/blocks/abs_blk.h"
+#include "gnuradio/blocks/add_blk.h"
#include "gnuradio/blocks/add_const_bb.h"
#include "gnuradio/blocks/add_const_ff.h"
#include "gnuradio/blocks/add_const_ss.h"
#include "gnuradio/blocks/add_const_ii.h"
#include "gnuradio/blocks/add_const_cc.h"
-#include "gnuradio/blocks/add_const_vbb.h"
-#include "gnuradio/blocks/add_const_vff.h"
-#include "gnuradio/blocks/add_const_vss.h"
-#include "gnuradio/blocks/add_const_vii.h"
-#include "gnuradio/blocks/add_const_vcc.h"
-#include "gnuradio/blocks/and_bb.h"
-#include "gnuradio/blocks/and_ss.h"
-#include "gnuradio/blocks/and_ii.h"
+#include "gnuradio/blocks/add_const_v.h"
+#include "gnuradio/blocks/and_blk.h"
%}
-%include "gnuradio/blocks/abs_ff.h"
-%include "gnuradio/blocks/abs_ss.h"
-%include "gnuradio/blocks/abs_ii.h"
-%include "gnuradio/blocks/add_ff.h"
-%include "gnuradio/blocks/add_ss.h"
-%include "gnuradio/blocks/add_ii.h"
-%include "gnuradio/blocks/add_cc.h"
+%include "gnuradio/blocks/abs_blk.h"
+%include "gnuradio/blocks/add_blk.h"
%include "gnuradio/blocks/add_const_bb.h"
%include "gnuradio/blocks/add_const_ff.h"
%include "gnuradio/blocks/add_const_ss.h"
%include "gnuradio/blocks/add_const_ii.h"
%include "gnuradio/blocks/add_const_cc.h"
-%include "gnuradio/blocks/add_const_vbb.h"
-%include "gnuradio/blocks/add_const_vff.h"
-%include "gnuradio/blocks/add_const_vss.h"
-%include "gnuradio/blocks/add_const_vii.h"
-%include "gnuradio/blocks/add_const_vcc.h"
-%include "gnuradio/blocks/and_bb.h"
-%include "gnuradio/blocks/and_ss.h"
-%include "gnuradio/blocks/and_ii.h"
+%include "gnuradio/blocks/add_const_v.h"
+%include "gnuradio/blocks/and_blk.h"
-GR_SWIG_BLOCK_MAGIC2(blocks, abs_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, abs_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, abs_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, abs_ff, abs_blk<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, abs_ss, abs_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, abs_ii, abs_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_ff, add_blk<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_ss, add_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_ii, add_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_cc, add_blk<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vbb);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii);
-GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc);
-GR_SWIG_BLOCK_MAGIC2(blocks, and_bb);
-GR_SWIG_BLOCK_MAGIC2(blocks, and_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, and_ii);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_const_vbb, add_const_v<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_const_vff, add_const_v<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_const_vss, add_const_v<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_const_vii, add_const_v<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, add_const_vcc, add_const_v<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_bb, and_blk<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_ss, and_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, and_ii, and_blk<std::int32_t>);
diff --git a/gr-blocks/swig/blocks_swig9.i b/gr-blocks/swig/blocks_swig9.i
index 872abd9d46..8fecdf5c1b 100644
--- a/gr-blocks/swig/blocks_swig9.i
+++ b/gr-blocks/swig/blocks_swig9.i
@@ -35,19 +35,14 @@
#include "gnuradio/blocks/float_to_short.h"
#include "gnuradio/blocks/float_to_uchar.h"
#include "gnuradio/blocks/int_to_float.h"
-#include "gnuradio/blocks/integrate_ss.h"
-#include "gnuradio/blocks/integrate_ii.h"
-#include "gnuradio/blocks/integrate_ff.h"
-#include "gnuradio/blocks/integrate_cc.h"
+#include "gnuradio/blocks/integrate.h"
#include "gnuradio/blocks/interleave.h"
#include "gnuradio/blocks/interleaved_short_to_complex.h"
#include "gnuradio/blocks/interleaved_char_to_complex.h"
#include "gnuradio/blocks/keep_m_in_n.h"
#include "gnuradio/blocks/keep_one_in_n.h"
#include "gnuradio/blocks/lfsr_32k_source_s.h"
-#include "gnuradio/blocks/max_ff.h"
-#include "gnuradio/blocks/max_ii.h"
-#include "gnuradio/blocks/max_ss.h"
+#include "gnuradio/blocks/max_blk.h"
%}
%include "gnuradio/blocks/float_to_char.h"
@@ -57,19 +52,14 @@
%include "gnuradio/blocks/float_to_short.h"
%include "gnuradio/blocks/float_to_uchar.h"
%include "gnuradio/blocks/int_to_float.h"
-%include "gnuradio/blocks/integrate_ss.h"
-%include "gnuradio/blocks/integrate_ii.h"
-%include "gnuradio/blocks/integrate_ff.h"
-%include "gnuradio/blocks/integrate_cc.h"
+%include "gnuradio/blocks/integrate.h"
%include "gnuradio/blocks/interleave.h"
%include "gnuradio/blocks/interleaved_short_to_complex.h"
%include "gnuradio/blocks/interleaved_char_to_complex.h"
%include "gnuradio/blocks/keep_m_in_n.h"
%include "gnuradio/blocks/keep_one_in_n.h"
%include "gnuradio/blocks/lfsr_32k_source_s.h"
-%include "gnuradio/blocks/max_ff.h"
-%include "gnuradio/blocks/max_ii.h"
-%include "gnuradio/blocks/max_ss.h"
+%include "gnuradio/blocks/max_blk.h"
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_char);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex);
@@ -78,16 +68,16 @@ GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar);
GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float);
-GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss);
-GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, integrate_cc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, integrate_ss, integrate<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, integrate_ii, integrate<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, integrate_ff, integrate<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, integrate_cc, integrate<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(blocks, interleave);
GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex);
GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_char_to_complex);
GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n);
GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n);
GR_SWIG_BLOCK_MAGIC2(blocks, lfsr_32k_source_s);
-GR_SWIG_BLOCK_MAGIC2(blocks, max_ff);
-GR_SWIG_BLOCK_MAGIC2(blocks, max_ii);
-GR_SWIG_BLOCK_MAGIC2(blocks, max_ss);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, max_ff, max_blk<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, max_ii, max_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(blocks, max_ss, max_blk<std::int16_t>);
diff --git a/gr-channels/lib/CMakeLists.txt b/gr-channels/lib/CMakeLists.txt
index d025889edb..2e2fe71d22 100644
--- a/gr-channels/lib/CMakeLists.txt
+++ b/gr-channels/lib/CMakeLists.txt
@@ -79,7 +79,7 @@ add_library(gnuradio-channels SHARED ${channels_sources})
target_link_libraries(gnuradio-channels ${channels_libs})
GR_LIBRARY_FOO(gnuradio-channels)
add_dependencies(gnuradio-channels
- channels_generated_includes channels_generated_swigs
+ channels_generated_swigs
gnuradio-runtime gnuradio-filter gnuradio-analog gnuradio-blocks)
if(ENABLE_STATIC_LIBS)
@@ -97,7 +97,6 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-channels_static STATIC ${channels_sources})
add_dependencies(gnuradio-channels_static
- channels_generated_includes
gnuradio-runtime_static
gnuradio-filter_static
gnuradio-analog_static
diff --git a/gr-channels/lib/cfo_model_impl.h b/gr-channels/lib/cfo_model_impl.h
index a8774c91bb..1f26cf3fec 100644
--- a/gr-channels/lib/cfo_model_impl.h
+++ b/gr-channels/lib/cfo_model_impl.h
@@ -24,10 +24,10 @@
#define INCLUDED_CHANNELS_CFO_MODEL_IMPL_H
#include <gnuradio/top_block.h>
-#include <gnuradio/blocks/integrate_ff.h>
+#include <gnuradio/blocks/integrate.h>
#include <gnuradio/blocks/vco_c.h>
-#include <gnuradio/blocks/multiply_cc.h>
-#include <gnuradio/analog/fastnoise_source_f.h>
+#include <gnuradio/blocks/multiply.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/channels/cfo_model.h>
#include <sincostable.h>
diff --git a/gr-channels/lib/channel_model2_impl.h b/gr-channels/lib/channel_model2_impl.h
index 50f489f05e..9de837a6c1 100644
--- a/gr-channels/lib/channel_model2_impl.h
+++ b/gr-channels/lib/channel_model2_impl.h
@@ -25,12 +25,12 @@
#include <gnuradio/channels/channel_model2.h>
#include <gnuradio/top_block.h>
-#include <gnuradio/blocks/add_cc.h>
-#include <gnuradio/blocks/multiply_cc.h>
-#include <gnuradio/analog/sig_source_c.h>
-#include <gnuradio/analog/fastnoise_source_c.h>
+#include <gnuradio/blocks/add_blk.h>
+#include <gnuradio/blocks/multiply.h>
+#include <gnuradio/analog/sig_source.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/filter/mmse_resampler_cc.h>
-#include <gnuradio/filter/fir_filter_ccc.h>
+#include <gnuradio/filter/fir_filter_blk.h>
#include <gnuradio/blocks/vco_c.h>
namespace gr {
diff --git a/gr-channels/lib/channel_model_impl.h b/gr-channels/lib/channel_model_impl.h
index 7376bf372d..fd0d0f175b 100644
--- a/gr-channels/lib/channel_model_impl.h
+++ b/gr-channels/lib/channel_model_impl.h
@@ -24,13 +24,13 @@
#define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H
#include <gnuradio/top_block.h>
-#include <gnuradio/blocks/add_cc.h>
-#include <gnuradio/blocks/multiply_cc.h>
-#include <gnuradio/analog/sig_source_c.h>
-#include <gnuradio/analog/fastnoise_source_c.h>
+#include <gnuradio/blocks/add_blk.h>
+#include <gnuradio/blocks/multiply.h>
+#include <gnuradio/analog/sig_source.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/channels/channel_model.h>
#include <gnuradio/filter/mmse_resampler_cc.h>
-#include <gnuradio/filter/fir_filter_ccc.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace channels {
diff --git a/gr-channels/lib/dynamic_channel_model_impl.h b/gr-channels/lib/dynamic_channel_model_impl.h
index c0be94aac3..7b3b8c5809 100644
--- a/gr-channels/lib/dynamic_channel_model_impl.h
+++ b/gr-channels/lib/dynamic_channel_model_impl.h
@@ -24,16 +24,16 @@
#define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H
#include <gnuradio/top_block.h>
-#include <gnuradio/blocks/add_cc.h>
-#include <gnuradio/blocks/multiply_cc.h>
-#include <gnuradio/analog/sig_source_c.h>
-#include <gnuradio/analog/fastnoise_source_c.h>
+#include <gnuradio/blocks/add_blk.h>
+#include <gnuradio/blocks/multiply.h>
+#include <gnuradio/analog/sig_source.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/channels/dynamic_channel_model.h>
#include <gnuradio/channels/selective_fading_model.h>
#include <gnuradio/channels/sro_model.h>
#include <gnuradio/channels/cfo_model.h>
#include <gnuradio/filter/mmse_resampler_cc.h>
-#include <gnuradio/filter/fir_filter_ccc.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace channels {
diff --git a/gr-channels/lib/sro_model_impl.h b/gr-channels/lib/sro_model_impl.h
index b0b8809469..3bbd12f5e5 100644
--- a/gr-channels/lib/sro_model_impl.h
+++ b/gr-channels/lib/sro_model_impl.h
@@ -25,7 +25,7 @@
#include <gnuradio/filter/mmse_interpolator_cc.h>
#include <gnuradio/filter/mmse_fir_interpolator_cc.h>
-#include <gnuradio/analog/fastnoise_source_f.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/channels/sro_model.h>
namespace gr {
diff --git a/gr-comedi/swig/CMakeLists.txt b/gr-comedi/swig/CMakeLists.txt
index d406a3002e..bc9a99bd4a 100644
--- a/gr-comedi/swig/CMakeLists.txt
+++ b/gr-comedi/swig/CMakeLists.txt
@@ -34,7 +34,6 @@ if(ENABLE_GR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
# Setup swig docs to depend on includes and pull in from build directory
-set(GR_SWIG_TARGET_DEPS comedi_generated_includes)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/comedi_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/comedi)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
diff --git a/gr-digital/include/gnuradio/digital/CMakeLists.txt b/gr-digital/include/gnuradio/digital/CMakeLists.txt
index cdaf48080b..af7a20eda5 100644
--- a/gr-digital/include/gnuradio/digital/CMakeLists.txt
+++ b/gr-digital/include/gnuradio/digital/CMakeLists.txt
@@ -18,24 +18,14 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-#######################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(digital chunks_to_symbols_XX bf bc sf sc if ic)
-GR_EXPAND_X_H(digital burst_shaper_XX cc ff)
-
-add_custom_target(digital_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
additive_scrambler_bb.h
api.h
binary_slicer_fb.h
+ burst_shaper.h
+ chunks_to_symbols.h
clock_recovery_mm_cc.h
clock_recovery_mm_ff.h
cma_equalizer_cc.h
diff --git a/gr-digital/include/gnuradio/digital/burst_shaper_XX.h.t b/gr-digital/include/gnuradio/digital/burst_shaper.h
index fd7b69060e..25277595b3 100644
--- a/gr-digital/include/gnuradio/digital/burst_shaper_XX.h.t
+++ b/gr-digital/include/gnuradio/digital/burst_shaper.h
@@ -1,29 +1,27 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 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 3, 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., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef BURST_SHAPER_H
+#define BURST_SHAPER_H
#include <gnuradio/digital/api.h>
#include <gnuradio/block.h>
@@ -59,14 +57,14 @@ namespace gr {
* burst's length tags. Tags at other offsets will be placed with
* the samples on which they were found.
*
- * \li input: stream of @I_TYPE@
- * \li output: stream of @O_TYPE@
+ * \li input: stream of T
+ * \li output: stream of T
*/
- class DIGITAL_API @NAME@ : virtual public block
+ template <class T>
+ class DIGITAL_API burst_shaper : virtual public block
{
public:
- // gr::digital::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< burst_shaper<T> > sptr;
/*!
* Make a burst shaper block.
@@ -89,7 +87,7 @@ namespace gr {
* \param length_tag_name: the name of the tagged stream length
* tag key.
*/
- static sptr make(const std::vector<@O_TYPE@> &taps,
+ static sptr make(const std::vector<T> &taps,
int pre_padding=0, int post_padding=0,
bool insert_phasing=false,
const std::string &length_tag_name="packet_len");
@@ -117,7 +115,9 @@ namespace gr {
virtual int suffix_length() const = 0;
};
+ typedef burst_shaper<float> burst_shaper_ff;
+ typedef burst_shaper<gr_complex> burst_shaper_cc;
} // namespace digital
} // namespace gr
-#endif /* @GUARD_NAME@ */
+#endif /* BURST_SHAPER_H */
diff --git a/gr-digital/include/gnuradio/digital/chunks_to_symbols_XX.h.t b/gr-digital/include/gnuradio/digital/chunks_to_symbols.h
index 6683ea94fc..f7cdd45352 100644
--- a/gr-digital/include/gnuradio/digital/chunks_to_symbols_XX.h.t
+++ b/gr-digital/include/gnuradio/digital/chunks_to_symbols.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,25 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef CHUNKS_TO_SYMBOLS_H
+#define CHUNKS_TO_SYMBOLS_H
#include <gnuradio/digital/api.h>
#include <gnuradio/sync_interpolator.h>
+#include <cstdint>
namespace gr {
namespace digital {
-
+
/*!
* \brief Map a stream of unpacked symbol indexes to stream of
* float or complex constellation points in D dimensions (D = 1 by
* default) \ingroup converter_blk
*
* \details
- * \li input: stream of @I_TYPE@
- * \li output: stream of @O_TYPE@
+ * \li input: stream of IN_T
+ * \li output: stream of OUT_T
*
* \li out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1
*
@@ -52,11 +51,11 @@ namespace gr {
* \sa gr::digital::chunks_to_symbols_bf, gr::digital::chunks_to_symbols_bc.
* \sa gr::digital::chunks_to_symbols_sf, gr::digital::chunks_to_symbols_sc.
*/
- class DIGITAL_API @NAME@ : virtual public sync_interpolator
+ template <class IN_T, class OUT_T>
+ class DIGITAL_API chunks_to_symbols : virtual public sync_interpolator
{
public:
- // gr::digital::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< chunks_to_symbols<IN_T,OUT_T> > sptr;
/*!
* Make a chunks-to-symbols block.
@@ -64,14 +63,20 @@ namespace gr {
* \param symbol_table: list that maps chunks to symbols.
* \param D: dimension of table.
*/
- static sptr make(const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+ static sptr make(const std::vector<OUT_T> &symbol_table, const int D = 1);
virtual int D() const = 0;
- virtual std::vector<@O_TYPE@> symbol_table() const = 0;
- virtual void set_symbol_table(const std::vector<@O_TYPE@> &symbol_table) =0;
+ virtual std::vector<OUT_T> symbol_table() const = 0;
+ virtual void set_symbol_table(const std::vector<OUT_T> &symbol_table) =0;
};
+ typedef chunks_to_symbols<std::uint8_t, float> chunks_to_symbols_bf;
+ typedef chunks_to_symbols<std::uint8_t, gr_complex> chunks_to_symbols_bc;
+ typedef chunks_to_symbols<std::int16_t, float> chunks_to_symbols_sf;
+ typedef chunks_to_symbols<std::int16_t, gr_complex> chunks_to_symbols_sc;
+ typedef chunks_to_symbols<std::int32_t, float> chunks_to_symbols_if;
+ typedef chunks_to_symbols<std::int32_t, gr_complex> chunks_to_symbols_ic;
} /* namespace digital */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* CHUNKS_TO_SYMBOLS_H */
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index f19d037171..cfcee3012c 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -39,19 +39,13 @@ if(ENABLE_GR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
########################################################################
-# Invoke macro to generate various sources
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(digital chunks_to_symbols_XX_impl bf bc sf sc if ic)
-GR_EXPAND_X_CC_H(digital burst_shaper_XX_impl cc ff)
-
-########################################################################
# Setup library
########################################################################
list(APPEND digital_sources
- ${generated_sources}
additive_scrambler_bb_impl.cc
binary_slicer_fb_impl.cc
+ burst_shaper_impl.cc
+ chunks_to_symbols_impl.cc
clock_recovery_mm_cc_impl.cc
clock_recovery_mm_ff_impl.cc
clock_tracking_loop.cc
@@ -156,7 +150,6 @@ GR_LIBRARY_FOO(gnuradio-digital)
add_dependencies(
gnuradio-digital
- digital_generated_includes
digital_generated_swigs
gnuradio-runtime
gnuradio-filter
@@ -179,7 +172,6 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-digital_static STATIC ${digital_sources})
add_dependencies(gnuradio-digital_static
- digital_generated_includes
gnuradio-runtime_static
gnuradio-filter_static
gnuradio-analog_static
diff --git a/gr-digital/lib/burst_shaper_XX_impl.cc.t b/gr-digital/lib/burst_shaper_impl.cc
index 0a60696b8e..d732ec76aa 100644
--- a/gr-digital/lib/burst_shaper_XX_impl.cc.t
+++ b/gr-digital/lib/burst_shaper_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2015 Free Software Foundation, Inc.
+ * Copyright 2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,45 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "burst_shaper_impl.h"
#include <boost/format.hpp>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
-#include "@IMPL_NAME@.h"
-
-#ifndef VOLK_MULT_gr_complex
-#define VOLK_MULT_gr_complex volk_32fc_x2_multiply_32fc
-#endif
-#ifndef VOLK_MULT_float
-#define VOLK_MULT_float volk_32f_x2_multiply_32f
-#endif
namespace gr {
namespace digital {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const std::vector<@I_TYPE@> &taps,
+ template <class T>
+ typename burst_shaper<T>::sptr
+ burst_shaper<T>::make(const std::vector<T> &taps,
int pre_padding, int post_padding,
bool insert_phasing,
const std::string &length_tag_name)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(taps, pre_padding, post_padding,
+ (new burst_shaper_impl<T>(taps, pre_padding, post_padding,
insert_phasing, length_tag_name));
}
- @IMPL_NAME@::@IMPL_NAME@(const std::vector<@I_TYPE@> &taps,
+ template <class T>
+ burst_shaper_impl<T>::burst_shaper_impl(const std::vector<T> &taps,
int pre_padding, int post_padding,
bool insert_phasing,
const std::string &length_tag_name)
- : gr::block("@BASE_NAME@",
- gr::io_signature::make(1, 1, sizeof(@I_TYPE@)),
- gr::io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : gr::block("burst_shaper",
+ gr::io_signature::make(1, 1, sizeof(T)),
+ gr::io_signature::make(1, 1, sizeof(T))),
d_up_ramp(taps.begin(), taps.begin() + taps.size()/2 + taps.size()%2),
d_down_ramp(taps.begin() + taps.size()/2, taps.end()),
d_nprepad(pre_padding),
@@ -77,23 +70,25 @@ namespace gr {
d_up_phasing.resize(d_up_ramp.size());
d_down_phasing.resize(d_down_ramp.size());
- @I_TYPE@ symbol;
+ T symbol;
for(unsigned int i = 0; i < d_up_ramp.size(); i++) {
- symbol = (i%2 == 0) ? @I_TYPE@(1.0f) : @I_TYPE@(-1.0f);
+ symbol = (i%2 == 0) ? T(1.0f) : T(-1.0f);
d_up_phasing[i] = symbol * d_up_ramp[i];
d_down_phasing[i] = symbol * d_down_ramp[i];
}
//set_relative_rate(1.0);
- set_tag_propagation_policy(TPP_DONT);
+ this->set_tag_propagation_policy(gr::block::TPP_DONT);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ burst_shaper_impl<T>::~burst_shaper_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ burst_shaper_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
switch(d_state) {
@@ -115,14 +110,15 @@ namespace gr {
}
}
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ burst_shaper_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const @I_TYPE@ *in = reinterpret_cast<const @I_TYPE@ *>(input_items[0]);
- @O_TYPE@ *out = reinterpret_cast<@O_TYPE@ *>(output_items[0]);
+ const T *in = reinterpret_cast<const T *>(input_items[0]);
+ T *out = reinterpret_cast<T *>(output_items[0]);
int nwritten = 0;
int nread = 0;
@@ -131,7 +127,7 @@ namespace gr {
int curr_tag_index = 0;
std::vector<tag_t> length_tags;
- get_tags_in_window(length_tags, 0, 0, ninput_items[0], d_length_tag_key);
+ this->get_tags_in_window(length_tags, 0, 0, ninput_items[0], d_length_tag_key);
std::sort(length_tags.rbegin(), length_tags.rend(), tag_t::offset_compare);
while(nwritten < noutput_items) {
@@ -154,7 +150,7 @@ namespace gr {
case(STATE_WAIT):
if(!length_tags.empty()) {
d_length_tag_offset = length_tags.back().offset;
- curr_tag_index = (int)(d_length_tag_offset - nitems_read(0));
+ curr_tag_index = (int)(d_length_tag_offset - this->nitems_read(0));
d_ncopy = pmt::to_long(length_tags.back().value);
length_tags.pop_back();
nskip = curr_tag_index - nread;
@@ -166,7 +162,7 @@ namespace gr {
nskip = ninput_items[0] - nread;
}
if(nskip > 0) {
- GR_LOG_WARN(d_logger,
+ GR_LOG_WARN(this->d_logger,
boost::format("Dropping %1% samples") %
nskip);
nread += nskip;
@@ -205,46 +201,50 @@ namespace gr {
break;
default:
- throw std::runtime_error("@BASE_NAME@: invalid state");
+ throw std::runtime_error("burst_shaper: invalid state");
}
}
- consume_each(nread);
+ this->consume_each(nread);
return nwritten;
}
+ template <class T>
int
- @IMPL_NAME@::prefix_length() const
+ burst_shaper_impl<T>::prefix_length() const
{
return (d_insert_phasing) ?
d_nprepad + d_up_ramp.size() : d_nprepad;
}
+ template <class T>
int
- @IMPL_NAME@::suffix_length() const
+ burst_shaper_impl<T>::suffix_length() const
{
return (d_insert_phasing) ?
d_npostpad + d_down_ramp.size() : d_npostpad;
}
+ template <class T>
void
- @IMPL_NAME@::write_padding(@O_TYPE@ *&dst, int &nwritten, int nspace)
+ burst_shaper_impl<T>::write_padding(T *&dst, int &nwritten, int nspace)
{
int nprocess = std::min(d_limit - d_index, nspace);
- std::memset(dst, 0x00, nprocess * sizeof(@O_TYPE@));
+ std::memset(dst, 0x00, nprocess * sizeof(T));
dst += nprocess;
nwritten += nprocess;
d_index += nprocess;
}
+ template <class T>
void
- @IMPL_NAME@::copy_items(@O_TYPE@ *&dst, const @I_TYPE@ *&src, int &nwritten,
+ burst_shaper_impl<T>::copy_items(T *&dst, const T *&src, int &nwritten,
int &nread, int nspace)
{
int nprocess = std::min(d_limit - d_index, nspace);
propagate_tags(nread, nwritten, nprocess);
- std::memcpy(dst, src, nprocess * sizeof(@O_TYPE@));
+ std::memcpy(dst, src, nprocess * sizeof(T));
dst += nprocess;
nwritten += nprocess;
src += nprocess;
@@ -252,13 +252,14 @@ namespace gr {
d_index += nprocess;
}
+ template <>
void
- @IMPL_NAME@::apply_ramp(@O_TYPE@ *&dst, const @I_TYPE@ *&src, int &nwritten,
+ burst_shaper_impl<gr_complex>::apply_ramp(gr_complex *&dst, const gr_complex *&src, int &nwritten,
int &nread, int nspace)
{
int nprocess = std::min(d_limit - d_index, nspace);
- @O_TYPE@ *phasing;
- const @O_TYPE@ *ramp;
+ gr_complex *phasing;
+ const gr_complex *ramp;
if(d_state == STATE_RAMPUP) {
phasing = &d_up_phasing[d_index];
@@ -270,10 +271,10 @@ namespace gr {
}
if(d_insert_phasing)
- std::memcpy(dst, phasing, nprocess * sizeof(@O_TYPE@));
+ std::memcpy(dst, phasing, nprocess * sizeof(gr_complex));
else {
propagate_tags(nread, nwritten, nprocess);
- VOLK_MULT_@O_TYPE@(dst, src, ramp, nprocess);
+ volk_32fc_x2_multiply_32fc(dst, src, ramp, nprocess);
src += nprocess;
nread += nprocess;
}
@@ -283,27 +284,63 @@ namespace gr {
d_index += nprocess;
}
+ template <>
+ void
+ burst_shaper_impl<float>::apply_ramp(float *&dst, const float *&src, int &nwritten,
+ int &nread, int nspace)
+ {
+ int nprocess = std::min(d_limit - d_index, nspace);
+ float *phasing;
+ const float *ramp;
+
+ if(d_state == STATE_RAMPUP) {
+ phasing = &d_up_phasing[d_index];
+ ramp = &d_up_ramp[d_index];
+ }
+ else {
+ phasing = &d_down_phasing[d_index];
+ ramp = &d_down_ramp[d_index];
+ }
+
+ if(d_insert_phasing)
+ std::memcpy(dst, phasing, nprocess * sizeof(float));
+ else {
+ propagate_tags(nread, nwritten, nprocess);
+ volk_32f_x2_multiply_32f(dst, src, ramp, nprocess);
+ src += nprocess;
+ nread += nprocess;
+ }
+
+ dst += nprocess;
+ nwritten += nprocess;
+ d_index += nprocess;
+ }
+
+
+
+ template <class T>
void
- @IMPL_NAME@::add_length_tag(int offset)
+ burst_shaper_impl<T>::add_length_tag(int offset)
{
- add_item_tag(0, nitems_written(0) + offset, d_length_tag_key,
+ this->add_item_tag(0, this->nitems_written(0) + offset, d_length_tag_key,
pmt::from_long(d_ncopy + prefix_length() +
suffix_length()),
- pmt::string_to_symbol(name()));
+ pmt::string_to_symbol(this->name()));
}
+ template <class T>
void
- @IMPL_NAME@::propagate_tags(int in_offset, int out_offset, int count, bool skip)
+ burst_shaper_impl<T>::propagate_tags(int in_offset, int out_offset, int count, bool skip)
{
- uint64_t abs_start = nitems_read(0) + in_offset;
+ uint64_t abs_start = this->nitems_read(0) + in_offset;
uint64_t abs_end = abs_start + count;
- uint64_t abs_offset = nitems_written(0) + out_offset;
+ uint64_t abs_offset = this->nitems_written(0) + out_offset;
tag_t temp_tag;
std::vector<tag_t> tags;
std::vector<tag_t>::iterator it;
- get_tags_in_range(tags, 0, abs_start, abs_end);
+ this->get_tags_in_range(tags, 0, abs_start, abs_end);
for(it = tags.begin(); it != tags.end(); it++) {
if(!pmt::equal(it->key, d_length_tag_key)) {
@@ -311,29 +348,32 @@ namespace gr {
continue;
temp_tag = *it;
temp_tag.offset = abs_offset + it->offset - abs_start;
- add_item_tag(0, temp_tag);
+ this->add_item_tag(0, temp_tag);
}
}
}
+ template <class T>
void
- @IMPL_NAME@::enter_wait()
+ burst_shaper_impl<T>::enter_wait()
{
d_finished = true;
d_index = 0;
d_state = STATE_WAIT;
}
+ template <class T>
void
- @IMPL_NAME@::enter_prepad()
+ burst_shaper_impl<T>::enter_prepad()
{
d_limit = d_nprepad;
d_index = 0;
d_state = STATE_PREPAD;
}
+ template <class T>
void
- @IMPL_NAME@::enter_rampup()
+ burst_shaper_impl<T>::enter_rampup()
{
if(d_insert_phasing)
d_limit = d_up_ramp.size();
@@ -343,8 +383,9 @@ namespace gr {
d_state = STATE_RAMPUP;
}
+ template <class T>
void
- @IMPL_NAME@::enter_copy()
+ burst_shaper_impl<T>::enter_copy()
{
if(d_insert_phasing)
d_limit = d_ncopy;
@@ -356,8 +397,9 @@ namespace gr {
d_state = STATE_COPY;
}
+ template <class T>
void
- @IMPL_NAME@::enter_rampdown()
+ burst_shaper_impl<T>::enter_rampdown()
{
if(d_insert_phasing)
d_limit = d_down_ramp.size();
@@ -367,13 +409,16 @@ namespace gr {
d_state = STATE_RAMPDOWN;
}
+ template <class T>
void
- @IMPL_NAME@::enter_postpad()
+ burst_shaper_impl<T>::enter_postpad()
{
d_limit = d_npostpad;
d_index = 0;
d_state = STATE_POSTPAD;
}
+ template class burst_shaper<gr_complex>;
+ template class burst_shaper<float>;
} /* namespace digital */
} /* namespace gr */
diff --git a/gr-digital/lib/burst_shaper_XX_impl.h.t b/gr-digital/lib/burst_shaper_impl.h
index 99ad7fb08a..dbcbb5068a 100644
--- a/gr-digital/lib/burst_shaper_XX_impl.h.t
+++ b/gr-digital/lib/burst_shaper_impl.h
@@ -1,50 +1,49 @@
/* -*- c++ -*- */
-/*
- * Copyright 2015 Free Software Foundation, Inc.
- *
+/*
+ * Copyright 2015,2018 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 3, 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., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
+#ifndef BURST_SHAPER_IMPL_H
+#define BURST_SHAPER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/digital/@BASE_NAME@.h>
+#include <gnuradio/digital/burst_shaper.h>
namespace gr {
namespace digital {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class T>
+ class burst_shaper_impl : public burst_shaper<T>
{
protected:
enum state_t {STATE_WAIT, STATE_PREPAD, STATE_RAMPUP,
STATE_COPY, STATE_RAMPDOWN, STATE_POSTPAD};
private:
- const std::vector<@O_TYPE@> d_up_ramp;
- const std::vector<@O_TYPE@> d_down_ramp;
+ const std::vector<T> d_up_ramp;
+ const std::vector<T> d_down_ramp;
const int d_nprepad;
const int d_npostpad;
const bool d_insert_phasing;
const pmt::pmt_t d_length_tag_key;
- std::vector<@O_TYPE@> d_up_phasing;
- std::vector<@O_TYPE@> d_down_phasing;
+ std::vector<T> d_up_phasing;
+ std::vector<T> d_down_phasing;
int d_ncopy;
int d_limit;
int d_index;
@@ -52,10 +51,10 @@ namespace gr {
bool d_finished;
state_t d_state;
- void write_padding(@O_TYPE@ *&dst, int &nwritten, int nspace);
- void copy_items(@O_TYPE@ *&dst, const @I_TYPE@ *&src, int &nwritten,
+ void write_padding(T *&dst, int &nwritten, int nspace);
+ void copy_items(T *&dst, const T *&src, int &nwritten,
int &nread, int nspace);
- void apply_ramp(@O_TYPE@ *&dst, const @I_TYPE@ *&src, int &nwritten,
+ void apply_ramp(T *&dst, const T *&src, int &nwritten,
int &nread, int nspace);
void add_length_tag(int offset);
void propagate_tags(int in_offset, int out_offset, int count, bool skip=true);
@@ -67,10 +66,10 @@ namespace gr {
void enter_postpad();
public:
- @IMPL_NAME@(const std::vector<@O_TYPE@> &taps, int pre_padding,
+ burst_shaper_impl(const std::vector<T> &taps, int pre_padding,
int post_padding, bool insert_phasing,
const std::string &length_tag_name);
- ~@IMPL_NAME@();
+ ~burst_shaper_impl();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@@ -87,4 +86,4 @@ namespace gr {
} // namespace digital
} // namespace gr
-#endif /* @GUARD_NAME@ */
+#endif /* BURST_SHAPER_IMPL_H */
diff --git a/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t b/gr-digital/lib/chunks_to_symbols_impl.cc
index b08bdde08f..0d01c337d4 100644
--- a/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t
+++ b/gr-digital/lib/chunks_to_symbols_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "chunks_to_symbols_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/tag_checker.h>
#include <assert.h>
@@ -34,60 +32,67 @@
namespace gr {
namespace digital {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const std::vector<@O_TYPE@> &symbol_table, const int D)
+ template <class IN_T, class OUT_T>
+ typename chunks_to_symbols<IN_T,OUT_T>::sptr
+ chunks_to_symbols<IN_T,OUT_T>::make(const std::vector<OUT_T> &symbol_table, const int D)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(symbol_table, D));
+ (new chunks_to_symbols_impl<IN_T,OUT_T>(symbol_table, D));
}
- @IMPL_NAME@::@IMPL_NAME@(const std::vector<@O_TYPE@> &symbol_table, const int D)
- : sync_interpolator("@BASE_NAME@",
- io_signature::make(1, -1, sizeof(@I_TYPE@)),
- io_signature::make(1, -1, sizeof(@O_TYPE@)),
+ template <class IN_T, class OUT_T>
+ chunks_to_symbols_impl<IN_T,OUT_T>::chunks_to_symbols_impl(const std::vector<OUT_T> &symbol_table, const int D)
+ : sync_interpolator("chunks_to_symbols",
+ io_signature::make(1, -1, sizeof(IN_T)),
+ io_signature::make(1, -1, sizeof(OUT_T)),
D),
d_D(D), d_symbol_table(symbol_table)
{
- message_port_register_in(pmt::mp("set_symbol_table"));
- set_msg_handler(
+ this->message_port_register_in(pmt::mp("set_symbol_table"));
+ this->set_msg_handler(
pmt::mp("set_symbol_table"),
- boost::bind(&@IMPL_NAME@::handle_set_symbol_table,
+ boost::bind(&chunks_to_symbols_impl<IN_T,OUT_T>::handle_set_symbol_table,
this, _1));
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ chunks_to_symbols_impl<IN_T,OUT_T>::~chunks_to_symbols_impl()
{
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::set_vector_from_pmt(std::vector<gr_complex> &symbol_table, pmt::pmt_t &symbol_table_pmt) {
+ chunks_to_symbols_impl<IN_T,OUT_T>::set_vector_from_pmt(std::vector<gr_complex> &symbol_table, pmt::pmt_t &symbol_table_pmt) {
symbol_table.resize(0);
for (unsigned int i=0; i<pmt::length(symbol_table_pmt); i++) {
symbol_table.push_back(pmt::c32vector_ref(symbol_table_pmt, i));
- }
+ }
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::set_vector_from_pmt(std::vector<float> &symbol_table, pmt::pmt_t &symbol_table_pmt) {
+ chunks_to_symbols_impl<IN_T,OUT_T>::set_vector_from_pmt(std::vector<float> &symbol_table, pmt::pmt_t &symbol_table_pmt) {
symbol_table.resize(0);
for (unsigned int i=0; i<pmt::length(symbol_table_pmt); i++) {
float f = pmt::f32vector_ref(symbol_table_pmt, i);
symbol_table.push_back(f);
}
}
-
+
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::handle_set_symbol_table(pmt::pmt_t symbol_table_pmt)
+ chunks_to_symbols_impl<IN_T,OUT_T>::handle_set_symbol_table(pmt::pmt_t symbol_table_pmt)
{
- std::vector<@O_TYPE@> symbol_table;
+ std::vector<OUT_T> symbol_table;
set_vector_from_pmt(symbol_table, symbol_table_pmt);
set_symbol_table(symbol_table);
}
-
+
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::set_symbol_table(const std::vector<@O_TYPE@> &symbol_table)
+ chunks_to_symbols_impl<IN_T,OUT_T>::set_symbol_table(const std::vector<OUT_T> &symbol_table)
{
d_symbol_table.resize(0);
for (unsigned int i=0; i<symbol_table.size(); i++) {
@@ -95,8 +100,9 @@ namespace gr {
}
}
+ template <class IN_T, class OUT_T>
int
- @IMPL_NAME@::work(int noutput_items,
+ chunks_to_symbols_impl<IN_T,OUT_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
@@ -105,29 +111,35 @@ namespace gr {
int nstreams = input_items.size();
for(int m = 0; m < nstreams; m++) {
- const @I_TYPE@ *in = (@I_TYPE@*)input_items[m];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[m];
+ const IN_T *in = (IN_T*)input_items[m];
+ OUT_T *out = (OUT_T*)output_items[m];
std::vector<tag_t> tags;
- get_tags_in_range(tags, m, nitems_read(m), nitems_read(m)+noutput_items/d_D);
+ this->get_tags_in_range(tags, m, this->nitems_read(m), this->nitems_read(m)+noutput_items/d_D);
tag_checker tchecker(tags);
// per stream processing
for(int i = 0; i < noutput_items / d_D; i++) {
-
+
std::vector<tag_t> tags_now;
- tchecker.get_tags(tags_now, i+nitems_read(m));
+ tchecker.get_tags(tags_now, i+this->nitems_read(m));
for (unsigned int j=0; j<tags_now.size(); j++) {
tag_t tag = tags_now[j];
- dispatch_msg(tag.key, tag.value);
+ this->dispatch_msg(tag.key, tag.value);
}
assert(((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size());
- memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@));
+ memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(OUT_T));
out+=d_D;
}
}
return noutput_items;
}
+ template class chunks_to_symbols<std::uint8_t, float>;
+ template class chunks_to_symbols<std::uint8_t, gr_complex>;
+ template class chunks_to_symbols<std::int16_t, float>;
+ template class chunks_to_symbols<std::int16_t, gr_complex>;
+ template class chunks_to_symbols<std::int32_t, float>;
+ template class chunks_to_symbols<std::int32_t, gr_complex>;
} /* namespace digital */
} /* namespace gr */
diff --git a/gr-digital/lib/chunks_to_symbols_XX_impl.h.t b/gr-digital/lib/chunks_to_symbols_impl.h
index e0857bfb3c..ae8c9a6c3a 100644
--- a/gr-digital/lib/chunks_to_symbols_XX_impl.h.t
+++ b/gr-digital/lib/chunks_to_symbols_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,35 +20,34 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
+#ifndef CHUNKS_TO_SYMBOLS_IMPL_H
+#define CHUNKS_TO_SYMBOLS_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/digital/@BASE_NAME@.h>
+#include <gnuradio/digital/chunks_to_symbols.h>
namespace gr {
namespace digital {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class chunks_to_symbols_impl : public chunks_to_symbols<IN_T, OUT_T>
{
private:
int d_D;
- std::vector<@O_TYPE@> d_symbol_table;
+ std::vector<OUT_T> d_symbol_table;
public:
- @IMPL_NAME@(const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+ chunks_to_symbols_impl(const std::vector<OUT_T> &symbol_table, const int D = 1);
- ~@IMPL_NAME@();
+ ~chunks_to_symbols_impl();
void set_vector_from_pmt(std::vector<float> &symbol_table, pmt::pmt_t &symbol_table_pmt);
void set_vector_from_pmt(std::vector<gr_complex> &symbol_table, pmt::pmt_t &symbol_table_pmt);
void handle_set_symbol_table(pmt::pmt_t symbol_table_pmt);
- void set_symbol_table(const std::vector<@O_TYPE@> &symbol_table);
-
+ void set_symbol_table(const std::vector<OUT_T> &symbol_table);
+
int D() const { return d_D; }
- std::vector<@O_TYPE@> symbol_table() const { return d_symbol_table; }
+ std::vector<OUT_T> symbol_table() const { return d_symbol_table; }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -60,4 +59,4 @@ namespace gr {
} /* namespace digital */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* CHUNKS_TO_SYMBOLS_IMPL_H */
diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h
index 3402e6e2bb..f6385d0d30 100644
--- a/gr-digital/lib/cpmmod_bc_impl.h
+++ b/gr-digital/lib/cpmmod_bc_impl.h
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2010,2012 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 3, 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., 51 Franklin Street,
@@ -26,7 +26,7 @@
#include <gnuradio/digital/cpmmod_bc.h>
#include <gnuradio/blocks/char_to_float.h>
#include <gnuradio/analog/frequency_modulator_fc.h>
-#include <gnuradio/filter/interp_fir_filter_fff.h>
+#include <gnuradio/filter/interp_fir_filter.h>
namespace gr {
namespace digital {
@@ -45,7 +45,7 @@ namespace gr {
gr::blocks::char_to_float::sptr d_char_to_float;
gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper;
analog::frequency_modulator_fc::sptr d_fm;
-
+
public:
cpmmod_bc_impl(const std::string &name,
analog::cpm::cpm_type type, float h,
@@ -65,4 +65,3 @@ namespace gr {
} /* namespace gr */
#endif /* INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H */
-
diff --git a/gr-digital/lib/modulate_vector.cc b/gr-digital/lib/modulate_vector.cc
index c6ba0f61aa..81964aa8e5 100644
--- a/gr-digital/lib/modulate_vector.cc
+++ b/gr-digital/lib/modulate_vector.cc
@@ -40,9 +40,9 @@
#include "config.h"
#endif
-#include <gnuradio/blocks/vector_source_b.h>
-#include <gnuradio/blocks/vector_sink_c.h>
-#include <gnuradio/filter/fir_filter_ccf.h>
+#include <gnuradio/blocks/vector_source.h>
+#include <gnuradio/blocks/vector_sink.h>
+#include <gnuradio/filter/fir_filter_blk.h>
#include <gnuradio/top_block.h>
#include <gnuradio/digital/modulate_vector.h>
diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
index 9b3e9687bc..b928d94e99 100644
--- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
+++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2013 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 3, 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., 51 Franklin Street,
@@ -32,12 +32,10 @@
#include <gnuradio/blocks/complex_to_mag_squared.h>
#include <gnuradio/blocks/conjugate_cc.h>
#include <gnuradio/blocks/delay.h>
-#include <gnuradio/blocks/divide_ff.h>
-#include <gnuradio/blocks/multiply_cc.h>
-#include <gnuradio/blocks/multiply_ff.h>
-#include <gnuradio/blocks/sample_and_hold_ff.h>
-#include <gnuradio/filter/fir_filter_ccf.h>
-#include <gnuradio/filter/fir_filter_fff.h>
+#include <gnuradio/blocks/divide.h>
+#include <gnuradio/blocks/multiply.h>
+#include <gnuradio/blocks/sample_and_hold.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace digital {
@@ -108,4 +106,3 @@ namespace gr {
} /* namespace digital */
} /* namespace gr */
-
diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt
index 658ac46ed6..fcfc14c33c 100644
--- a/gr-digital/swig/CMakeLists.txt
+++ b/gr-digital/swig/CMakeLists.txt
@@ -62,7 +62,6 @@ foreach(swigfile ${GR_SWIG_BLOCK_IFILES})
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/digital
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
- set(GR_SWIG_TARGET_DEPS digital_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-digital
gnuradio-filter gnuradio-analog gnuradio-blocks)
GR_SWIG_MAKE(${swigfile} ${swigfile}.i)
diff --git a/gr-digital/swig/digital_swig1.i b/gr-digital/swig/digital_swig1.i
index 6d19da0328..dd6cd97745 100644
--- a/gr-digital/swig/digital_swig1.i
+++ b/gr-digital/swig/digital_swig1.i
@@ -38,14 +38,8 @@
%{
#include "gnuradio/digital/additive_scrambler_bb.h"
-#include "gnuradio/digital/burst_shaper_cc.h"
-#include "gnuradio/digital/burst_shaper_ff.h"
-#include "gnuradio/digital/chunks_to_symbols_bc.h"
-#include "gnuradio/digital/chunks_to_symbols_bf.h"
-#include "gnuradio/digital/chunks_to_symbols_ic.h"
-#include "gnuradio/digital/chunks_to_symbols_if.h"
-#include "gnuradio/digital/chunks_to_symbols_sc.h"
-#include "gnuradio/digital/chunks_to_symbols_sf.h"
+#include "gnuradio/digital/burst_shaper.h"
+#include "gnuradio/digital/chunks_to_symbols.h"
#include "gnuradio/digital/clock_recovery_mm_cc.h"
#include "gnuradio/digital/clock_recovery_mm_ff.h"
#include "gnuradio/digital/diff_decoder_bb.h"
@@ -68,14 +62,8 @@
%}
%include "gnuradio/digital/additive_scrambler_bb.h"
-%include "gnuradio/digital/burst_shaper_cc.h"
-%include "gnuradio/digital/burst_shaper_ff.h"
-%include "gnuradio/digital/chunks_to_symbols_bc.h"
-%include "gnuradio/digital/chunks_to_symbols_bf.h"
-%include "gnuradio/digital/chunks_to_symbols_ic.h"
-%include "gnuradio/digital/chunks_to_symbols_if.h"
-%include "gnuradio/digital/chunks_to_symbols_sc.h"
-%include "gnuradio/digital/chunks_to_symbols_sf.h"
+%include "gnuradio/digital/burst_shaper.h"
+%include "gnuradio/digital/chunks_to_symbols.h"
%include "gnuradio/digital/clock_recovery_mm_cc.h"
%include "gnuradio/digital/clock_recovery_mm_ff.h"
%include "gnuradio/digital/diff_decoder_bb.h"
@@ -97,14 +85,14 @@
%include "gnuradio/digital/msk_timing_recovery_cc.h"
GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb);
-GR_SWIG_BLOCK_MAGIC2(digital, burst_shaper_cc);
-GR_SWIG_BLOCK_MAGIC2(digital, burst_shaper_ff);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_bc);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_bf);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_ic);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_if);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_sc);
-GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_sf);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, burst_shaper_cc, burst_shaper<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, burst_shaper_ff, burst_shaper<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_bc, chunks_to_symbols<std::uint8_t,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_bf, chunks_to_symbols<std::uint8_t,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_ic, chunks_to_symbols<std::int32_t,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_if, chunks_to_symbols<std::int32_t,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_sc, chunks_to_symbols<std::int16_t,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(digital, chunks_to_symbols_sf, chunks_to_symbols<std::int16_t,float>);
GR_SWIG_BLOCK_MAGIC2(digital, clock_recovery_mm_cc);
GR_SWIG_BLOCK_MAGIC2(digital, clock_recovery_mm_ff);
GR_SWIG_BLOCK_MAGIC2(digital, diff_decoder_bb);
diff --git a/gr-filter/include/gnuradio/filter/CMakeLists.txt b/gr-filter/include/gnuradio/filter/CMakeLists.txt
index 9338d96713..8f17b496b2 100644
--- a/gr-filter/include/gnuradio/filter/CMakeLists.txt
+++ b/gr-filter/include/gnuradio/filter/CMakeLists.txt
@@ -18,23 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-#######################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(filter fir_filter_XXX ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_H(filter freq_xlating_fir_filter_XXX ccc ccf fcc fcf scf scc)
-GR_EXPAND_X_H(filter interp_fir_filter_XXX ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_H(filter rational_resampler_base_XXX ccc ccf fcc fff fsf scc)
-
-add_custom_target(filter_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
api.h
firdes.h
fir_filter.h
@@ -57,6 +43,7 @@ install(FILES
fft_filter_ccc.h
fft_filter_ccf.h
fft_filter_fff.h
+ freq_xlating_fir_filter.h
mmse_interpolator_cc.h
mmse_interpolator_ff.h
mmse_resampler_cc.h
@@ -75,8 +62,8 @@ install(FILES
pfb_decimator_ccf.h
pfb_interpolator_ccf.h
pfb_synthesizer_ccf.h
+ rational_resampler_base.h
single_pole_iir_filter_cc.h
single_pole_iir_filter_ff.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/filter
)
-
diff --git a/gr-filter/include/gnuradio/filter/fir_filter.h b/gr-filter/include/gnuradio/filter/fir_filter.h
index 99ca96c19a..48562d3680 100644
--- a/gr-filter/include/gnuradio/filter/fir_filter.h
+++ b/gr-filter/include/gnuradio/filter/fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,206 +23,46 @@
#ifndef INCLUDED_FILTER_FIR_FILTER_H
#define INCLUDED_FILTER_FIR_FILTER_H
+#include <cstdint>
#include <gnuradio/filter/api.h>
-#include <vector>
#include <gnuradio/gr_complex.h>
+#include <vector>
namespace gr {
- namespace filter {
- namespace kernel {
-
- class FILTER_API fir_filter_fff
- {
- public:
- fir_filter_fff(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_fff();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- float filter(const float input[]);
- void filterN(float output[],
- const float input[],
- unsigned long n);
- void filterNdec(float output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- float *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_ccf
- {
- public:
- fir_filter_ccf(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_ccf();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const gr_complex input[]);
- void filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_fcc
- {
- public:
- fir_filter_fcc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_fcc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const float input[]);
- void filterN(gr_complex output[],
- const float input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_ccc
- {
- public:
- fir_filter_ccc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_ccc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const gr_complex input[]);
- void filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_scc
- {
- public:
- fir_filter_scc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_scc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const short input[]);
- void filterN(gr_complex output[],
- const short input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const short input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_fsf
- {
- public:
- fir_filter_fsf(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_fsf();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- short filter(const float input[]);
- void filterN(short output[],
- const float input[],
- unsigned long n);
- void filterNdec(short output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- short *d_output;
- int d_align;
- int d_naligned;
- };
-
- } /* namespace kernel */
- } /* namespace filter */
+namespace filter {
+namespace kernel {
+
+template <class IN_T, class OUT_T, class TAP_T>
+class FILTER_API fir_filter {
+ public:
+ fir_filter(int decimation, const std::vector<TAP_T>& taps);
+ ~fir_filter();
+
+ void set_taps(const std::vector<TAP_T>& taps);
+ void update_tap(TAP_T t, unsigned int index);
+ std::vector<TAP_T> taps() const;
+ unsigned int ntaps() const;
+
+ OUT_T filter(const IN_T input[]);
+ void filterN(OUT_T output[], const IN_T input[], unsigned long n);
+ void filterNdec(OUT_T output[], const IN_T input[], unsigned long n, unsigned int decimate);
+
+ protected:
+ std::vector<TAP_T> d_taps;
+ unsigned int d_ntaps;
+ TAP_T** d_aligned_taps;
+ OUT_T* d_output;
+ int d_align;
+ int d_naligned;
+};
+typedef fir_filter<float, float, float> fir_filter_fff;
+typedef fir_filter<gr_complex, gr_complex, float> fir_filter_ccf;
+typedef fir_filter<float, gr_complex, gr_complex> fir_filter_fcc;
+typedef fir_filter<gr_complex, gr_complex, gr_complex> fir_filter_ccc;
+typedef fir_filter<std::int16_t, gr_complex, gr_complex> fir_filter_scc;
+typedef fir_filter<float, std::int16_t, float> fir_filter_fsf;
+} /* namespace kernel */
+} /* namespace filter */
} /* namespace gr */
#endif /* INCLUDED_FILTER_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/fir_filter_blk.h
index 5e38653c63..be0ca50bb6 100644
--- a/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/fir_filter_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,23 +20,22 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FIR_FILTER_BLK_H
+#define FIR_FILTER_BLK_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_decimator.h>
+#include <cstdint>
namespace gr {
namespace filter {
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief FIR filter with IN_T input, OUT_T output, and TAP_T taps
* \ingroup filter_blk
*
* \details
- * The fir_filter_XXX blocks create finite impulse response
+ * The fir_filter_blk_XXX blocks create finite impulse response
* (FIR) filters that perform the convolution in the time
* domain:
*
@@ -48,34 +47,41 @@ namespace gr {
*
* The taps are a C++ vector (or Python list) of values of the
* type specified by the third letter in the block's suffix. For
- * this block, the value is of type @TAP_TYPE@. Taps can be
+ * this block, the value is of type TAP_T. Taps can be
* created using the firdes or optfir tools.
*
* These versions of the filter can also act as down-samplers
* (or decimators) by specifying an integer value for \p
* decimation.
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_decimator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API fir_filter_blk : virtual public sync_decimator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< fir_filter_blk<IN_T,OUT_T,TAP_T> > sptr;
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief FIR filter with IN_T input, OUT_T output, and TAP_T taps
*
* \param decimation set the integer decimation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
*/
static sptr make(int decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef fir_filter_blk<gr_complex, gr_complex, gr_complex> fir_filter_ccc;
+ typedef fir_filter_blk<gr_complex, gr_complex, float> fir_filter_ccf;
+ typedef fir_filter_blk<float, gr_complex, gr_complex> fir_filter_fcc;
+ typedef fir_filter_blk<float, float, float> fir_filter_fff;
+ typedef fir_filter_blk<float, std::int16_t, float> fir_filter_fsf;
+ typedef fir_filter_blk<std::int16_t, gr_complex, gr_complex> fir_filter_scc;
+
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FIR_FILTER_BLK_H */
diff --git a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h
index d8cb8f962c..d06f5ed042 100644
--- a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2004,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FREQ_XLATING_FIR_FILTER_H
+#define FREQ_XLATING_FIR_FILTER_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_decimator.h>
@@ -37,7 +32,7 @@ namespace gr {
/*!
* \brief FIR filter combined with frequency translation with
- * @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * IN_T input, OUT_T output and TAP_T taps
*
* \ingroup channelizers_blk
*
@@ -59,15 +54,15 @@ namespace gr {
* Use the filter's group delay to determine when the
* transients after the change have settled down.
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_decimator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API freq_xlating_fir_filter : virtual public sync_decimator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< freq_xlating_fir_filter<IN_T,OUT_T,TAP_T> > sptr;
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and
- * @TAP_TYPE@ taps that also frequency translates a signal from
+ * \brief FIR filter with IN_T input, OUT_T output, and
+ * TAP_T taps that also frequency translates a signal from
* \p center_freq.
*
* Construct a FIR filter with the given taps and a composite
@@ -76,23 +71,30 @@ namespace gr {
* filtering operation.
*
* \param decimation set the integer decimation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
* \param center_freq Center frequency of signal to down convert from (Hz)
* \param sampling_freq Sampling rate of signal (in Hz)
*/
static sptr make(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq);
virtual void set_center_freq(double center_freq) = 0;
virtual double center_freq() const = 0;
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex> freq_xlating_fir_filter_ccc;
+ typedef freq_xlating_fir_filter<gr_complex, gr_complex, float> freq_xlating_fir_filter_ccf;
+ typedef freq_xlating_fir_filter<float, gr_complex, gr_complex> freq_xlating_fir_filter_fcc;
+ typedef freq_xlating_fir_filter<float, gr_complex, float> freq_xlating_fir_filter_fcf;
+ typedef freq_xlating_fir_filter<std::int16_t, gr_complex, float> freq_xlating_fir_filter_scf;
+ typedef freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex> freq_xlating_fir_filter_scc;
+
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FREQ_XLATING_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/interp_fir_filter.h
index 5b0f3511b4..abdc12ec20 100644
--- a/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/interp_fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,19 +20,18 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef INTERP_FIR_FILTER_H
+#define INTERP_FIR_FILTER_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_interpolator.h>
+#include <cstdint>
namespace gr {
namespace filter {
/*!
- * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \brief Interpolating FIR filter with IN_T input, OUT_T output and TAP_T taps
* \ingroup filter_blk
*
* \details
@@ -48,7 +47,7 @@ namespace gr {
*
* The taps are a C++ vector (or Python list) of values of the
* type specified by the third letter in the block's suffix. For
- * this block, the value is of type @TAP_TYPE@. Taps can be
+ * this block, the value is of type TAP_T. Taps can be
* created using the firdes or optfir tools.
*
* These versions of the filter can also act as up-samplers
@@ -56,26 +55,33 @@ namespace gr {
* interpolation.
*
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_interpolator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API interp_fir_filter : virtual public sync_interpolator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::filter::interp_fir_filter::sptr
+ typedef boost::shared_ptr<interp_fir_filter> sptr;
/*!
- * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief Interpolating FIR filter with IN_T input, OUT_T output, and TAP_T taps
*
* \param interpolation set the integer interpolation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
*/
static sptr make(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef interp_fir_filter<gr_complex, gr_complex, gr_complex> interp_fir_filter_ccc;
+ typedef interp_fir_filter<gr_complex, gr_complex, float> interp_fir_filter_ccf;
+ typedef interp_fir_filter<float, gr_complex, gr_complex> interp_fir_filter_fcc;
+ typedef interp_fir_filter<float, float, float> interp_fir_filter_fff;
+ typedef interp_fir_filter<float, std::int16_t, float> interp_fir_filter_fsf;
+ typedef interp_fir_filter<std::int16_t, gr_complex, gr_complex> interp_fir_filter_scc;
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* INTERP_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t b/gr-filter/include/gnuradio/filter/rational_resampler_base.h
index d5f8379804..97974c6c15 100644
--- a/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/rational_resampler_base.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012 Free Software Foundation, Inc.
+ * Copyright 2005,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RATIONAL_RESAMPLER_BASE_H
+#define RATIONAL_RESAMPLER_BASE_H
#include <gnuradio/filter/api.h>
#include <gnuradio/block.h>
@@ -33,8 +31,8 @@ namespace gr {
namespace filter {
/*!
- * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@
- * input, @O_TYPE@ output and @TAP_TYPE@ taps.
+ * \brief Rational Resampling Polyphase FIR filter with IN_T
+ * input, OUT_T output and TAP_T taps.
* \ingroup resamplers_blk
*
* Make a rational resampling FIR filter. If the input signal is
@@ -68,11 +66,11 @@ namespace gr {
* narrower of the required anti-image postfilter or anti-alias
* prefilter.
*/
- class FILTER_API @NAME@ : virtual public block
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API rational_resampler_base : virtual public block
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< rational_resampler_base<IN_T,OUT_T,TAP_T> > sptr;
/*!
* Make a rational resampling FIR filter.
@@ -83,16 +81,22 @@ namespace gr {
*/
static sptr make(unsigned interpolation,
unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
virtual unsigned interpolation() const = 0;
virtual unsigned decimation() const = 0;
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef rational_resampler_base<gr_complex, gr_complex, gr_complex> rational_resampler_base_ccc;
+ typedef rational_resampler_base<gr_complex, gr_complex, float> rational_resampler_base_ccf;
+ typedef rational_resampler_base<float, gr_complex, gr_complex> rational_resampler_base_fcc;
+ typedef rational_resampler_base<float, float, float> rational_resampler_base_fff;
+ typedef rational_resampler_base<float, std::int16_t, float> rational_resampler_base_fsf;
+ typedef rational_resampler_base<std::int16_t, gr_complex, gr_complex> rational_resampler_base_scc;
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RATIONAL_RESAMPLER_BASE_H */
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index 8bd7236865..5bb7b5d1fb 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014,2017 Free Software Foundation, Inc.
+# Copyright (C) 2012-2014,2017-2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,15 +18,6 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(filter fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_CC_H(filter freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc)
-GR_EXPAND_X_CC_H(filter interp_fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_CC_H(filter rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc)
-
-########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
@@ -53,17 +44,19 @@ endif(ENABLE_GR_CTRLPORT)
########################################################################
list(APPEND filter_sources
fir_filter.cc
+ fir_filter_blk_impl.cc
fir_filter_with_buffer.cc
fft_filter.cc
firdes.cc
+ freq_xlating_fir_filter_impl.cc
iir_filter.cc
+ interp_fir_filter_impl.cc
mmse_fir_interpolator_cc.cc
mmse_fir_interpolator_ff.cc
mmse_interp_differentiator_cc.cc
mmse_interp_differentiator_ff.cc
pm_remez.cc
polyphase_filterbank.cc
- ${generated_sources}
dc_blocker_cc_impl.cc
dc_blocker_ff_impl.cc
filter_delay_fc_impl.cc
@@ -90,6 +83,7 @@ list(APPEND filter_sources
pfb_decimator_ccf_impl.cc
pfb_interpolator_ccf_impl.cc
pfb_synthesizer_ccf_impl.cc
+ rational_resampler_base_impl.cc
single_pole_iir_filter_cc_impl.cc
single_pole_iir_filter_ff_impl.cc
)
@@ -121,7 +115,7 @@ add_library(gnuradio-filter SHARED ${filter_sources})
target_link_libraries(gnuradio-filter ${filter_libs})
GR_LIBRARY_FOO(gnuradio-filter)
add_dependencies(gnuradio-filter
- filter_generated_includes filter_generated_swigs
+ filter_generated_swigs
gnuradio-runtime gnuradio-fft)
if(ENABLE_STATIC_LIBS)
@@ -139,7 +133,6 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-filter_static STATIC ${filter_sources})
add_dependencies(gnuradio-filter_static
- filter_generated_includes
gnuradio-runtime_static gnuradio-fft_static)
if(NOT WIN32)
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
index 895c778076..b85e972255 100644
--- a/gr-filter/lib/fir_filter.cc
+++ b/gr-filter/lib/fir_filter.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,703 +20,169 @@
* Boston, MA 02110-1301, USA.
*/
-#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/fft/fft.h>
-#include <volk/volk.h>
#include <cstdio>
#include <cstring>
+#include <gnuradio/fft/fft.h>
+#include <gnuradio/filter/fir_filter.h>
+#include <volk/volk.h>
namespace gr {
- namespace filter {
- namespace kernel {
-
- fir_filter_fff::fir_filter_fff(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (float*)volk_malloc(1*sizeof(float), d_align);
- }
-
- fir_filter_fff::~fir_filter_fff()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fff::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps!= NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fff::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_fff::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fff::ntaps() const
- {
- return d_ntaps;
- }
-
- float
- fir_filter_fff::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32f_x2_dot_prod_32f_a(d_output, ar,
- d_aligned_taps[al],
- d_ntaps+al);
- return *d_output;
- }
-
- void
- fir_filter_fff::filterN(float output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++) {
- output[i] = filter(&input[i]);
- }
- }
-
- void
- fir_filter_fff::filterNdec(float output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++) {
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_ccf::fir_filter_ccf(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_ccf::~fir_filter_ccf()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_ccf::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_ccf::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_ccf::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_ccf::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_ccf::filter(const gr_complex input[])
- {
- const gr_complex *ar = (gr_complex *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_32f_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_ccf::filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_ccf::filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
-
- /**************************************************************/
-
-
- fir_filter_fcc::fir_filter_fcc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_fcc::~fir_filter_fcc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fcc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fcc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
-
- std::vector<gr_complex>
- fir_filter_fcc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fcc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_fcc::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_32f_dot_prod_32fc_a(d_output,
- d_aligned_taps[al],
- ar,
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_fcc::filterN(gr_complex output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_fcc::filterNdec(gr_complex output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_ccc::fir_filter_ccc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_ccc::~fir_filter_ccc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_ccc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_ccc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<gr_complex>
- fir_filter_ccc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_ccc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_ccc::filter(const gr_complex input[])
- {
- const gr_complex *ar = (gr_complex *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_x2_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_ccc::filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_ccc::filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_scc::fir_filter_scc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(short));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_scc::~fir_filter_scc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_scc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_scc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<gr_complex>
- fir_filter_scc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_scc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_scc::filter(const short input[])
- {
- const short *ar = (short *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_16i_32fc_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
-
- return *d_output;
- }
-
- void
- fir_filter_scc::filterN(gr_complex output[],
- const short input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_scc::filterNdec(gr_complex output[],
- const short input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_fsf::fir_filter_fsf(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (short*)volk_malloc(1*sizeof(short), d_align);
- }
-
- fir_filter_fsf::~fir_filter_fsf()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fsf::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fsf::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_fsf::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fsf::ntaps() const
- {
- return d_ntaps;
- }
-
- short
- fir_filter_fsf::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32f_x2_dot_prod_16i_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
-
- return *d_output;
- }
-
- void
- fir_filter_fsf::filterN(short output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
- void
- fir_filter_fsf::filterNdec(short output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- } /* namespace kernel */
- } /* namespace filter */
+namespace filter {
+namespace kernel {
+
+template <class IN_T, class OUT_T, class TAP_T>
+fir_filter<IN_T, OUT_T, TAP_T>::fir_filter(int decimation, const std::vector<TAP_T>& taps) {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(IN_T));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = (OUT_T*)volk_malloc(1 * sizeof(OUT_T), d_align);
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+fir_filter<IN_T, OUT_T, TAP_T>::~fir_filter() {
+ // Free all aligned taps
+ if (d_aligned_taps != NULL) {
+ for (int i = 0; i < d_naligned; i++) {
+ volk_free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ volk_free(d_output);
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::set_taps(const std::vector<TAP_T>& taps) {
+ // Free the taps if already allocated
+ if (d_aligned_taps != NULL) {
+ for (int i = 0; i < d_naligned; i++) {
+ volk_free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (TAP_T**)malloc(d_naligned * sizeof(TAP_T*));
+ for (int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] =
+ (TAP_T*)volk_malloc((d_ntaps + d_naligned - 1) * sizeof(TAP_T), d_align);
+ memset(d_aligned_taps[i], 0, sizeof(TAP_T) * (d_ntaps + d_naligned - 1));
+ for (unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i + j] = d_taps[j];
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::update_tap(TAP_T t, unsigned int index) {
+ d_taps[index] = t;
+ for (int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i][i + index] = t;
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+std::vector<TAP_T> fir_filter<IN_T, OUT_T, TAP_T>::taps() const {
+ std::vector<TAP_T> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+unsigned int fir_filter<IN_T, OUT_T, TAP_T>::ntaps() const {
+ return d_ntaps;
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::filterN(OUT_T output[], const IN_T input[], unsigned long n) {
+ for (unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[i]);
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T,OUT_T,TAP_T>::filterNdec(OUT_T output[],
+ const IN_T input[],
+ unsigned long n,
+ unsigned int decimate) {
+ unsigned long j = 0;
+ for (unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+}
+
+template <>
+float fir_filter<float, float, float>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_32f_a(d_output, ar, d_aligned_taps[al], d_ntaps + al);
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<gr_complex, gr_complex, float>::filter(const gr_complex input[]) {
+ const gr_complex* ar = (gr_complex*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<float, gr_complex, gr_complex>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, d_aligned_taps[al], ar, (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<gr_complex, gr_complex, gr_complex>::filter(const gr_complex input[]) {
+ const gr_complex* ar = (gr_complex*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_x2_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<std::int16_t, gr_complex, gr_complex>::filter(const std::int16_t input[]) {
+ const std::int16_t* ar = (std::int16_t*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_16i_32fc_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+
+ return *d_output;
+}
+
+template <>
+short fir_filter<float, std::int16_t, float>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_16i_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+
+ return *d_output;
+}
+ template class fir_filter<float, float, float>;
+ template class fir_filter<gr_complex, gr_complex, float>;
+ template class fir_filter<float, gr_complex, gr_complex>;
+ template class fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class fir_filter<std::int16_t, gr_complex, gr_complex>;
+ template class fir_filter<float, std::int16_t, float>;
+} /* namespace kernel */
+} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t
deleted file mode 100644
index 4a112a2180..0000000000
--- a/gr-filter/lib/fir_filter_XXX_impl.cc.t
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int decimation, const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
- (decimation, taps));
- }
-
-
- @IMPL_NAME@::@IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps)
- : sync_decimator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
- decimation)
- {
- d_fir = new kernel::@BASE_NAME@(decimation, taps);
- d_updated = false;
- set_history(d_fir->ntaps());
-
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1, alignment_multiple));
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- delete d_fir;
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_fir->set_taps(taps);
- d_updated = true;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_fir->taps();
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
-
- if (d_updated) {
- set_history(d_fir->ntaps());
- d_updated = false;
- return 0; // history requirements may have changed.
- }
-
- if (decimation() == 1) {
- d_fir->filterN(out, in, noutput_items);
- }
- else {
- d_fir->filterNdec(out, in, noutput_items,
- decimation());
- }
-
- return noutput_items;
- }
-
- } /* namespace filter */
-} /* namespace gr */
-
diff --git a/gr-filter/lib/fir_filter_blk_impl.cc b/gr-filter/lib/fir_filter_blk_impl.cc
new file mode 100644
index 0000000000..2ffa62e596
--- /dev/null
+++ b/gr-filter/lib/fir_filter_blk_impl.cc
@@ -0,0 +1,115 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "fir_filter_blk_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename fir_filter_blk<IN_T,OUT_T,TAP_T>::sptr
+ fir_filter_blk<IN_T,OUT_T,TAP_T>::make(int decimation, const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr(new fir_filter_blk_impl<IN_T,OUT_T,TAP_T>
+ (decimation, taps));
+ }
+
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::fir_filter_blk_impl(int decimation, const std::vector<TAP_T> &taps)
+ : sync_decimator("fir_filter_blk<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
+ decimation)
+ {
+ d_fir = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(decimation, taps);
+ d_updated = false;
+ this->set_history(d_fir->ntaps());
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ this->set_alignment(std::max(1, alignment_multiple));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::~fir_filter_blk_impl()
+ {
+ delete d_fir;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_fir->set_taps(taps);
+ d_updated = true;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_fir->taps();
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T*)output_items[0];
+
+ if (d_updated) {
+ this->set_history(d_fir->ntaps());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ if (this->decimation() == 1) {
+ d_fir->filterN(out, in, noutput_items);
+ }
+ else {
+ d_fir->filterNdec(out, in, noutput_items,
+ this->decimation());
+ }
+
+ return noutput_items;
+ }
+ template class fir_filter_blk<gr_complex, gr_complex, gr_complex>;
+ template class fir_filter_blk<gr_complex, gr_complex, float>;
+ template class fir_filter_blk<float, gr_complex, gr_complex>;
+ template class fir_filter_blk<float, float, float>;
+ template class fir_filter_blk<float, std::int16_t, float>;
+ template class fir_filter_blk<std::int16_t, gr_complex, gr_complex>;
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fir_filter_XXX_impl.h.t b/gr-filter/lib/fir_filter_blk_impl.h
index 3678d82acb..03faaebf26 100644
--- a/gr-filter/lib/fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/fir_filter_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,30 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FIR_FILTER_BLK_IMPL_H
+#define FIR_FILTER_BLK_IMPL_H
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API fir_filter_blk_impl : public fir_filter_blk<IN_T, OUT_T, TAP_T>
{
private:
- kernel::@BASE_NAME@ *d_fir;
+ kernel::fir_filter<IN_T, OUT_T, TAP_T> *d_fir;
bool d_updated;
public:
- @IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps);
+ fir_filter_blk_impl(int decimation, const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~fir_filter_blk_impl();
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -53,4 +52,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FIR_FILTER_BLK_IMPL_H */
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_impl.cc
index fc6ede2bb5..5a858c3d10 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_impl.cc
@@ -20,16 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@IMPL_NAME@.h"
+#include "freq_xlating_fir_filter_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/math.h>
#include <volk/volk.h>
@@ -37,49 +32,53 @@
namespace gr {
namespace filter {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>::sptr
+ freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>::make(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq)
{
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
+ return gnuradio::get_initial_sptr(new freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>
(decimation, taps,
center_freq,
sampling_freq));
}
- @IMPL_NAME@::@IMPL_NAME@(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ template <class IN_T, class OUT_T, class TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::freq_xlating_fir_filter_impl(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq)
- : sync_decimator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
+ : sync_decimator("freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
decimation),
d_proto_taps(taps), d_center_freq(center_freq),
d_sampling_freq(sampling_freq),
d_updated(false)
{
std::vector<gr_complex> dummy_taps;
- d_composite_fir = new kernel::@CFIR_TYPE@(decimation, dummy_taps);
+ d_composite_fir = new kernel::fir_filter<IN_T,OUT_T,gr_complex>(decimation, dummy_taps);
- set_history(d_proto_taps.size());
- build_composite_fir();
+ this->set_history(this->d_proto_taps.size());
+ this->build_composite_fir();
- message_port_register_in(pmt::mp("freq"));
- set_msg_handler(pmt::mp("freq"),
- boost::bind(&@IMPL_NAME@::handle_set_center_freq,
+ this->message_port_register_in(pmt::mp("freq"));
+ this->set_msg_handler(pmt::mp("freq"),
+ boost::bind(&freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::handle_set_center_freq,
this, _1));
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T, class TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::~freq_xlating_fir_filter_impl()
{
delete d_composite_fir;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::build_composite_fir()
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::build_composite_fir()
{
std::vector<gr_complex> ctaps(d_proto_taps.size());
@@ -97,37 +96,42 @@ namespace gr {
}
d_composite_fir->set_taps(ctaps);
- d_r.set_phase_incr(exp(gr_complex(0, -fwT0 * decimation())));
+ d_r.set_phase_incr(exp(gr_complex(0, -fwT0 * this->decimation())));
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::set_center_freq(double center_freq)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_center_freq(double center_freq)
{
d_center_freq = center_freq;
d_updated = true;
}
+ template <class IN_T, class OUT_T, class TAP_T>
double
- @IMPL_NAME@::center_freq() const
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::center_freq() const
{
return d_center_freq;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
{
d_proto_taps = taps;
d_updated = true;
}
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::taps() const
{
return d_proto_taps;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::handle_set_center_freq(pmt::pmt_t msg)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::handle_set_center_freq(pmt::pmt_t msg)
{
if(pmt::is_dict(msg) && pmt::dict_has_key(msg, pmt::intern("freq")) ) {
pmt::pmt_t x = pmt::dict_ref(msg, pmt::intern("freq"), pmt::PMT_NIL );
@@ -144,35 +148,43 @@ namespace gr {
}
}
+ template <class IN_T, class OUT_T, class TAP_T>
int
- @IMPL_NAME@::work(int noutput_items,
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *in = (@I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
+ IN_T *in = (IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
// rebuild composite FIR if the center freq has changed
if(d_updated) {
- set_history(d_proto_taps.size());
+ this->set_history(d_proto_taps.size());
build_composite_fir();
d_updated = false;
// Tell downstream items where the frequency change was applied
- add_item_tag(0, nitems_written(0),
+ this->add_item_tag(0, this->nitems_written(0),
pmt::intern("freq"), pmt::from_double(d_center_freq),
- alias_pmt());
+ this->alias_pmt());
return 0; // history requirements may have changed.
}
unsigned j = 0;
for (int i = 0; i < noutput_items; i++){
out[i] = d_r.rotate(d_composite_fir->filter(&in[j]));
- j += decimation();
+ j += this->decimation();
}
return noutput_items;
}
+ template class freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class freq_xlating_fir_filter<gr_complex, gr_complex, float>;
+ template class freq_xlating_fir_filter<float, gr_complex, gr_complex>;
+ template class freq_xlating_fir_filter<float, gr_complex, float>;
+ template class freq_xlating_fir_filter<std::int16_t, gr_complex, float>;
+ template class freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex>;
+
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t b/gr-filter/lib/freq_xlating_fir_filter_impl.h
index bd7aced6f8..176b57f93b 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2004,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,27 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FREQ_XLATING_FIR_FILTER_IMPL_H
+#define FREQ_XLATING_FIR_FILTER_IMPL_H
#include <gnuradio/filter/api.h>
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/freq_xlating_fir_filter.h>
#include <gnuradio/blocks/rotator.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API freq_xlating_fir_filter_impl : public freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>
{
protected:
- std::vector<@TAP_TYPE@> d_proto_taps;
- kernel::@CFIR_TYPE@ *d_composite_fir;
+ std::vector<TAP_T> d_proto_taps;
+ kernel::fir_filter<IN_T, OUT_T, gr_complex> *d_composite_fir;
blocks::rotator d_r;
double d_center_freq;
double d_sampling_freq;
@@ -49,17 +45,17 @@ namespace gr {
virtual void build_composite_fir();
public:
- @IMPL_NAME@(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ freq_xlating_fir_filter_impl(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq);
- virtual ~@IMPL_NAME@();
+ virtual ~freq_xlating_fir_filter_impl();
void set_center_freq(double center_freq);
double center_freq() const;
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
void handle_set_center_freq(pmt::pmt_t msg);
@@ -71,4 +67,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FREQ_XLATING_FIR_FILTER_IMPL_H */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
deleted file mode 100644
index 507322b21d..0000000000
--- a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include <stdexcept>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
- (interpolation, taps));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps)
- : sync_interpolator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
- interpolation),
- d_updated(false), d_firs(interpolation)
- {
- if(interpolation == 0) {
- throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0\n");
- }
-
- if(taps.size() == 0) {
- throw std::runtime_error("@IMPL_NAME@: no filter taps provided.\n");
- }
-
- std::vector<@TAP_TYPE@> dummy_taps;
-
- for(unsigned i = 0; i < interpolation; i++) {
- d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
- }
-
- set_taps(taps);
- install_taps(d_new_taps);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- for(unsigned i = 0; i < interpolation(); i++) {
- delete d_firs[i];
- }
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- d_new_taps = taps;
- d_updated = true;
-
- // round up length to a multiple of the interpolation factor
- int n = taps.size() % interpolation();
- if(n > 0) {
- n = interpolation() - n;
- while(n-- > 0) {
- d_new_taps.insert(d_new_taps.end(), 0);
- }
- }
-
- if(d_new_taps.size() % interpolation() != 0) {
- throw std::runtime_error("@IMPL_NAME@: error setting interpolator taps.\n");
- }
- }
-
- void
- @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- unsigned nfilters = interpolation();
- int nt = taps.size() / nfilters;
-
- std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
-
- for(unsigned n = 0; n < nfilters; n++) {
- xtaps[n].resize (nt);
- }
-
- for(size_t i = 0; i < taps.size(); i++) {
- xtaps[i % nfilters][i / nfilters] = taps[i];
- }
-
- for(unsigned n = 0; n < nfilters; n++) {
- d_firs[n]->set_taps (xtaps[n]);
- }
-
- set_history(nt);
- d_updated = false;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_new_taps;
- }
-
- int
- @NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
-
- if(d_updated) {
- install_taps(d_new_taps);
- return 0; // history requirements may have changed.
- }
-
- int nfilters = interpolation();
- int ni = noutput_items / interpolation();
-
- for(int i = 0; i < ni; i++) {
- for(int nf = 0; nf < nfilters; nf++) {
- out[nf] = d_firs[nf]->filter(&in[i]);
- }
- out += nfilters;
- }
-
- return noutput_items;
- }
-
- } /* namespace filter */
-} /* namespace gr */
diff --git a/gr-filter/lib/interp_fir_filter_impl.cc b/gr-filter/lib/interp_fir_filter_impl.cc
new file mode 100644
index 0000000000..a7020ce653
--- /dev/null
+++ b/gr-filter/lib/interp_fir_filter_impl.cc
@@ -0,0 +1,167 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "interp_fir_filter_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename interp_fir_filter<IN_T,OUT_T,TAP_T>::sptr
+ interp_fir_filter<IN_T,OUT_T,TAP_T>::make(unsigned interpolation,
+ const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr(new interp_fir_filter_impl<IN_T,OUT_T,TAP_T>
+ (interpolation, taps));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::interp_fir_filter_impl(unsigned interpolation,
+ const std::vector<TAP_T> &taps)
+ : sync_interpolator("interp_fir_filter<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
+ interpolation),
+ d_updated(false), d_firs(interpolation)
+ {
+ if(interpolation == 0) {
+ throw std::out_of_range("interp_fir_filter_impl: interpolation must be > 0\n");
+ }
+
+ if(taps.size() == 0) {
+ throw std::runtime_error("interp_fir_filter_impl: no filter taps provided.\n");
+ }
+
+ std::vector<TAP_T> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::~interp_fir_filter_impl()
+ {
+ for(unsigned i = 0; i < this->interpolation(); i++) {
+ delete d_firs[i];
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % this->interpolation();
+ if(n > 0) {
+ n = this->interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.end(), 0);
+ }
+ }
+
+ if(d_new_taps.size() % this->interpolation() != 0) {
+ throw std::runtime_error("interp_fir_filter_impl: error setting interpolator taps.\n");
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::install_taps(const std::vector<TAP_T> &taps)
+ {
+ unsigned nfilters = this->interpolation();
+ int nt = taps.size() / nfilters;
+
+ std::vector< std::vector <TAP_T> > xtaps(nfilters);
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ xtaps[n].resize (nt);
+ }
+
+ for(size_t i = 0; i < taps.size(); i++) {
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+ }
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ d_firs[n]->set_taps (xtaps[n]);
+ }
+
+ this->set_history(nt);
+ d_updated = false;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_new_taps;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const IN_T *in = (const IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirements may have changed.
+ }
+
+ int nfilters = this->interpolation();
+ int ni = noutput_items / this->interpolation();
+
+ for(int i = 0; i < ni; i++) {
+ for(int nf = 0; nf < nfilters; nf++) {
+ out[nf] = d_firs[nf]->filter(&in[i]);
+ }
+ out += nfilters;
+ }
+
+ return noutput_items;
+ }
+ template class interp_fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class interp_fir_filter<gr_complex, gr_complex, float>;
+ template class interp_fir_filter<float, gr_complex, gr_complex>;
+ template class interp_fir_filter<float, float, float>;
+ template class interp_fir_filter<float, std::int16_t, float>;
+ template class interp_fir_filter<std::int16_t, gr_complex, gr_complex>;
+
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t b/gr-filter/lib/interp_fir_filter_impl.h
index 0e39de613c..0ebcc19edf 100644
--- a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/interp_fir_filter_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,36 +20,35 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef INTERP_FIR_FILTER_IMPL_H
+#define INTERP_FIR_FILTER_IMPL_H
#include <gnuradio/filter/api.h>
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/interp_fir_filter.h>
#include <vector>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API interp_fir_filter_impl : public interp_fir_filter<IN_T,OUT_T,TAP_T>
{
private:
bool d_updated;
- std::vector<kernel::@FIR_TYPE@ *> d_firs;
- std::vector<@TAP_TYPE@> d_new_taps;
+ std::vector< kernel::fir_filter<IN_T,OUT_T,TAP_T> *> d_firs;
+ std::vector<TAP_T> d_new_taps;
- void install_taps(const std::vector<@TAP_TYPE@> &taps);
+ void install_taps(const std::vector<TAP_T> &taps);
public:
- @IMPL_NAME@(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps);
+ interp_fir_filter_impl(unsigned interpolation,
+ const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~interp_fir_filter_impl();
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -59,4 +58,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* INTERP_FIR_FILTER_IMPL_H */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
deleted file mode 100644
index 0b74e60969..0000000000
--- a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include <stdexcept>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(unsigned interpolation,
- unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(interpolation, decimation, taps));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
- unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
- d_history(1),
- d_interpolation(interpolation),
- d_decimation(decimation),
- d_ctr(0),
- d_firs(interpolation),
- d_updated(false)
- {
- if(interpolation == 0)
- throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0");
- if(decimation == 0)
- throw std::out_of_range("@IMPL_NAME@: decimation must be > 0");
-
- set_relative_rate(1.0 * interpolation / decimation);
- set_output_multiple(1);
-
- std::vector<@TAP_TYPE@> dummy_taps;
-
- for(unsigned i = 0; i < interpolation; i++) {
- d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
- }
-
- set_taps(taps);
- install_taps(d_new_taps);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- int interp = interpolation();
- for(int i = 0; i < interp; i++) {
- delete d_firs[i];
- }
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- d_new_taps = taps;
- d_updated = true;
-
- // round up length to a multiple of the interpolation factor
- int n = taps.size() % interpolation();
- if(n > 0) {
- n = interpolation() - n;
- while(n-- > 0) {
- d_new_taps.insert(d_new_taps.end(), 0);
- }
- }
-
- assert(d_new_taps.size() % interpolation() == 0);
- }
-
- void
- @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- int nfilters = interpolation();
- int nt = taps.size() / nfilters;
-
- assert(nt * nfilters == (int) taps.size());
-
- std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
-
- for(int n = 0; n < nfilters; n++)
- xtaps[n].resize (nt);
-
- for(int i = 0; i < (int)taps.size(); i++)
- xtaps[i % nfilters][i / nfilters] = taps[i];
-
- for(int n = 0; n < nfilters; n++)
- d_firs[n]->set_taps(xtaps[n]);
-
- set_history(nt);
- d_updated = false;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_new_taps;
- }
-
- void
- @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
- {
- int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * \
- decimation() / interpolation()) + history() - 1);
- unsigned ninputs = ninput_items_required.size();
- for(unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = nreqd;
- }
-
- int
- @IMPL_NAME@::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
-
- if(d_updated) {
- install_taps(d_new_taps);
- return 0; // history requirement may have increased.
- }
-
- unsigned int ctr = d_ctr;
- int count = 0;
-
- int i = 0;
- while((i < noutput_items) && (count < ninput_items[0])) {
- out[i++] = d_firs[ctr]->filter(in);
- ctr += decimation();
- while(ctr >= interpolation()) {
- ctr -= interpolation();
- in++;
- count++;
- }
- }
-
- d_ctr = ctr;
- consume_each(count);
- return i;
- }
-
- } /* namespace filter */
-} /* namespace gr */
diff --git a/gr-filter/lib/rational_resampler_base_impl.cc b/gr-filter/lib/rational_resampler_base_impl.cc
new file mode 100644
index 0000000000..133f62e3f8
--- /dev/null
+++ b/gr-filter/lib/rational_resampler_base_impl.cc
@@ -0,0 +1,188 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "rational_resampler_base_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename rational_resampler_base<IN_T,OUT_T,TAP_T>::sptr
+ rational_resampler_base<IN_T,OUT_T,TAP_T>::make(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr
+ (new rational_resampler_base_impl<IN_T,OUT_T,TAP_T>(interpolation, decimation, taps));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::rational_resampler_base_impl(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<TAP_T> &taps)
+ : block("rational_resampler_base<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
+ d_history(1),
+ d_interpolation(interpolation),
+ d_decimation(decimation),
+ d_ctr(0),
+ d_firs(interpolation),
+ d_updated(false)
+ {
+ if(interpolation == 0)
+ throw std::out_of_range("rational_resampler_base_impl<IN_T,OUT_T,TAP_T>: interpolation must be > 0");
+ if(decimation == 0)
+ throw std::out_of_range("rational_resampler_base_impl<IN_T,OUT_T,TAP_T>: decimation must be > 0");
+
+ this->set_relative_rate(1.0 * interpolation / decimation);
+ this->set_output_multiple(1);
+
+ std::vector<TAP_T> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::~rational_resampler_base_impl()
+ {
+ int interp = this->interpolation();
+ for(int i = 0; i < interp; i++) {
+ delete d_firs[i];
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % this->interpolation();
+ if(n > 0) {
+ n = this->interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.end(), 0);
+ }
+ }
+
+ assert(d_new_taps.size() % this->interpolation() == 0);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::install_taps(const std::vector<TAP_T> &taps)
+ {
+ int nfilters = this->interpolation();
+ int nt = taps.size() / nfilters;
+
+ assert(nt * nfilters == (int) taps.size());
+
+ std::vector< std::vector <TAP_T> > xtaps(nfilters);
+
+ for(int n = 0; n < nfilters; n++)
+ xtaps[n].resize (nt);
+
+ for(int i = 0; i < (int)taps.size(); i++)
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+
+ for(int n = 0; n < nfilters; n++)
+ d_firs[n]->set_taps(xtaps[n]);
+
+ set_history(nt);
+ d_updated = false;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_new_taps;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * \
+ this->decimation() / this->interpolation()) + history() - 1);
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = nreqd;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const IN_T *in = (const IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirement may have increased.
+ }
+
+ unsigned int ctr = d_ctr;
+ int count = 0;
+
+ int i = 0;
+ while((i < noutput_items) && (count < ninput_items[0])) {
+ out[i++] = d_firs[ctr]->filter(in);
+ ctr += this->decimation();
+ while(ctr >= this->interpolation()) {
+ ctr -= this->interpolation();
+ in++;
+ count++;
+ }
+ }
+
+ d_ctr = ctr;
+ this->consume_each(count);
+ return i;
+ }
+ template class rational_resampler_base<gr_complex, gr_complex, gr_complex>;
+ template class rational_resampler_base<gr_complex, gr_complex, float>;
+ template class rational_resampler_base<float, gr_complex, gr_complex>;
+ template class rational_resampler_base<float, float, float>;
+ template class rational_resampler_base<float, std::int16_t, float>;
+ template class rational_resampler_base<std::int16_t, gr_complex, gr_complex>;
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t b/gr-filter/lib/rational_resampler_base_impl.h
index debd059092..a42d1b0fda 100644
--- a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t
+++ b/gr-filter/lib/rational_resampler_base_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012 Free Software Foundation, Inc.
+ * Copyright 2005,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,35 +20,34 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RATIONAL_RESAMPLER_IMPL_BASE_H
+#define RATIONAL_RESAMPLER_IMPL_BASE_H
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/rational_resampler_base.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API rational_resampler_base_impl : public rational_resampler_base<IN_T,OUT_T,TAP_T>
{
private:
unsigned d_history;
unsigned d_interpolation;
unsigned d_decimation;
unsigned d_ctr;
- std::vector<@TAP_TYPE@> d_new_taps;
- std::vector<kernel::@FIR_TYPE@ *> d_firs;
+ std::vector<TAP_T> d_new_taps;
+ std::vector<kernel::fir_filter<IN_T,OUT_T,TAP_T> *> d_firs;
bool d_updated;
- void install_taps(const std::vector<@TAP_TYPE@> &taps);
+ void install_taps(const std::vector<TAP_T> &taps);
public:
- @IMPL_NAME@(unsigned interpolation, unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ rational_resampler_base_impl(unsigned interpolation, unsigned decimation,
+ const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~rational_resampler_base_impl();
unsigned history() const { return d_history; }
void set_history(unsigned history) { d_history = history; }
@@ -56,8 +55,8 @@ namespace gr {
unsigned interpolation() const { return d_interpolation; }
unsigned decimation() const { return d_decimation; }
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
@@ -69,4 +68,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RATIONAL_RESAMPLER_IMPL_BASE_H */
diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt
index ee8389dddb..2308739062 100644
--- a/gr-filter/swig/CMakeLists.txt
+++ b/gr-filter/swig/CMakeLists.txt
@@ -42,7 +42,6 @@ set(GR_SWIG_DOC_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/filter
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
-set(GR_SWIG_TARGET_DEPS filter_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-filter gnuradio-fft)
GR_SWIG_MAKE(filter_swig filter_swig.i)
diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i
index db0ad0fd95..939f038208 100644
--- a/gr-filter/swig/filter_swig.i
+++ b/gr-filter/swig/filter_swig.i
@@ -34,12 +34,7 @@
#include "gnuradio/filter/dc_blocker_ff.h"
#include "gnuradio/filter/filter_delay_fc.h"
#include "gnuradio/filter/filterbank_vcvcf.h"
-#include "gnuradio/filter/fir_filter_ccc.h"
-#include "gnuradio/filter/fir_filter_ccf.h"
-#include "gnuradio/filter/fir_filter_fcc.h"
-#include "gnuradio/filter/fir_filter_fff.h"
-#include "gnuradio/filter/fir_filter_fsf.h"
-#include "gnuradio/filter/fir_filter_scc.h"
+#include "gnuradio/filter/fir_filter_blk.h"
#include "gnuradio/filter/fft_filter_ccc.h"
#include "gnuradio/filter/fft_filter_ccf.h"
#include "gnuradio/filter/fft_filter_fff.h"
@@ -47,24 +42,14 @@
#include "gnuradio/filter/mmse_interpolator_ff.h"
#include "gnuradio/filter/mmse_resampler_cc.h"
#include "gnuradio/filter/mmse_resampler_ff.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_ccc.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_ccf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_fcc.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_fcf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_scf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_scc.h"
+#include "gnuradio/filter/freq_xlating_fir_filter.h"
#include "gnuradio/filter/hilbert_fc.h"
#include "gnuradio/filter/iir_filter_ffd.h"
#include "gnuradio/filter/iir_filter_ccc.h"
#include "gnuradio/filter/iir_filter_ccf.h"
#include "gnuradio/filter/iir_filter_ccd.h"
#include "gnuradio/filter/iir_filter_ccz.h"
-#include "gnuradio/filter/interp_fir_filter_ccc.h"
-#include "gnuradio/filter/interp_fir_filter_ccf.h"
-#include "gnuradio/filter/interp_fir_filter_fcc.h"
-#include "gnuradio/filter/interp_fir_filter_fff.h"
-#include "gnuradio/filter/interp_fir_filter_fsf.h"
-#include "gnuradio/filter/interp_fir_filter_scc.h"
+#include "gnuradio/filter/interp_fir_filter.h"
#include "gnuradio/filter/pfb_arb_resampler_ccf.h"
#include "gnuradio/filter/pfb_arb_resampler_ccc.h"
#include "gnuradio/filter/pfb_arb_resampler_fff.h"
@@ -72,12 +57,7 @@
#include "gnuradio/filter/pfb_decimator_ccf.h"
#include "gnuradio/filter/pfb_interpolator_ccf.h"
#include "gnuradio/filter/pfb_synthesizer_ccf.h"
-#include "gnuradio/filter/rational_resampler_base_ccc.h"
-#include "gnuradio/filter/rational_resampler_base_ccf.h"
-#include "gnuradio/filter/rational_resampler_base_fcc.h"
-#include "gnuradio/filter/rational_resampler_base_fff.h"
-#include "gnuradio/filter/rational_resampler_base_fsf.h"
-#include "gnuradio/filter/rational_resampler_base_scc.h"
+#include "gnuradio/filter/rational_resampler_base.h"
#include "gnuradio/filter/single_pole_iir_filter_cc.h"
#include "gnuradio/filter/single_pole_iir_filter_ff.h"
%}
@@ -88,12 +68,7 @@
%include "gnuradio/filter/dc_blocker_ff.h"
%include "gnuradio/filter/filter_delay_fc.h"
%include "gnuradio/filter/filterbank_vcvcf.h"
-%include "gnuradio/filter/fir_filter_ccc.h"
-%include "gnuradio/filter/fir_filter_ccf.h"
-%include "gnuradio/filter/fir_filter_fcc.h"
-%include "gnuradio/filter/fir_filter_fff.h"
-%include "gnuradio/filter/fir_filter_fsf.h"
-%include "gnuradio/filter/fir_filter_scc.h"
+%include "gnuradio/filter/fir_filter_blk.h"
%include "gnuradio/filter/fft_filter_ccc.h"
%include "gnuradio/filter/fft_filter_ccf.h"
%include "gnuradio/filter/fft_filter_fff.h"
@@ -101,24 +76,14 @@
%include "gnuradio/filter/mmse_interpolator_ff.h"
%include "gnuradio/filter/mmse_resampler_cc.h"
%include "gnuradio/filter/mmse_resampler_ff.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_ccc.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_ccf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_fcc.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_fcf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_scf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_scc.h"
+%include "gnuradio/filter/freq_xlating_fir_filter.h"
%include "gnuradio/filter/hilbert_fc.h"
%include "gnuradio/filter/iir_filter_ffd.h"
%include "gnuradio/filter/iir_filter_ccc.h"
%include "gnuradio/filter/iir_filter_ccf.h"
%include "gnuradio/filter/iir_filter_ccd.h"
%include "gnuradio/filter/iir_filter_ccz.h"
-%include "gnuradio/filter/interp_fir_filter_ccc.h"
-%include "gnuradio/filter/interp_fir_filter_ccf.h"
-%include "gnuradio/filter/interp_fir_filter_fcc.h"
-%include "gnuradio/filter/interp_fir_filter_fff.h"
-%include "gnuradio/filter/interp_fir_filter_fsf.h"
-%include "gnuradio/filter/interp_fir_filter_scc.h"
+%include "gnuradio/filter/interp_fir_filter.h"
%include "gnuradio/filter/pfb_arb_resampler_ccf.h"
%include "gnuradio/filter/pfb_arb_resampler_ccc.h"
%include "gnuradio/filter/pfb_arb_resampler_fff.h"
@@ -126,12 +91,7 @@
%include "gnuradio/filter/pfb_decimator_ccf.h"
%include "gnuradio/filter/pfb_interpolator_ccf.h"
%include "gnuradio/filter/pfb_synthesizer_ccf.h"
-%include "gnuradio/filter/rational_resampler_base_ccc.h"
-%include "gnuradio/filter/rational_resampler_base_ccf.h"
-%include "gnuradio/filter/rational_resampler_base_fcc.h"
-%include "gnuradio/filter/rational_resampler_base_fff.h"
-%include "gnuradio/filter/rational_resampler_base_fsf.h"
-%include "gnuradio/filter/rational_resampler_base_scc.h"
+%include "gnuradio/filter/rational_resampler_base.h"
%include "gnuradio/filter/single_pole_iir_filter_cc.h"
%include "gnuradio/filter/single_pole_iir_filter_ff.h"
@@ -139,12 +99,12 @@ GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_cc);
GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_ff);
GR_SWIG_BLOCK_MAGIC2(filter, filter_delay_fc);
GR_SWIG_BLOCK_MAGIC2(filter, filterbank_vcvcf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_ccc, fir_filter_blk<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_ccf, fir_filter_blk<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fcc, fir_filter_blk<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fff, fir_filter_blk<float, float, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fsf, fir_filter_blk<float, std::int16_t, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_scc, fir_filter_blk<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_fff);
@@ -152,24 +112,24 @@ GR_SWIG_BLOCK_MAGIC2(filter, mmse_interpolator_cc);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_interpolator_ff);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_resampler_cc);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_resampler_ff);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_ccc, freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_ccf, freq_xlating_fir_filter<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_fcc, freq_xlating_fir_filter<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_fcf, freq_xlating_fir_filter<float, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_scf, freq_xlating_fir_filter<std::int16_t, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_scc, freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, hilbert_fc);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ffd);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccd);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccz);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_ccc, interp_fir_filter<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_ccf, interp_fir_filter<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fcc, interp_fir_filter<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fff, interp_fir_filter<float, float, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fsf, interp_fir_filter<float, std::int16_t, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_scc, interp_fir_filter<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_fff);
@@ -177,11 +137,11 @@ GR_SWIG_BLOCK_MAGIC2(filter, pfb_channelizer_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_decimator_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_interpolator_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_synthesizer_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_ccc, rational_resampler_base<gr_complex,gr_complex,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_ccf, rational_resampler_base<gr_complex,gr_complex,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fcc, rational_resampler_base<float,gr_complex,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fff, rational_resampler_base<float,float,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fsf, rational_resampler_base<float,std::int16_t,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_scc, rational_resampler_base<std::int16_t,gr_complex,gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_cc);
GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_ff);
diff --git a/gr-qtgui/examples/c++/display_qt.h b/gr-qtgui/examples/c++/display_qt.h
index 97c46c1faa..5df8b88f57 100644
--- a/gr-qtgui/examples/c++/display_qt.h
+++ b/gr-qtgui/examples/c++/display_qt.h
@@ -22,9 +22,9 @@
// Q_MOC_RUN is a workaround for a QT4 + Boost version issue
#ifndef Q_MOC_RUN
#include <gnuradio/top_block.h>
-#include <gnuradio/analog/sig_source_f.h>
-#include <gnuradio/analog/noise_source_f.h>
-#include <gnuradio/blocks/add_ff.h>
+#include <gnuradio/analog/sig_source.h>
+#include <gnuradio/analog/noise_source.h>
+#include <gnuradio/blocks/add_blk.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/qtgui/time_sink_f.h>
#include <gnuradio/qtgui/freq_sink_f.h>
diff --git a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt
index 831f2916dc..a9c664606c 100644
--- a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt
+++ b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2014 Free Software Foundation, Inc.
+# Copyright 2012,2014,2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,41 +18,30 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(trellis encoder_XX bb bs bi ss si ii)
-GR_EXPAND_X_H(trellis sccc_encoder_XX bb bs bi ss si ii)
-GR_EXPAND_X_H(trellis pccc_encoder_XX bb bs bi ss si ii)
-GR_EXPAND_X_H(trellis metrics_X s i f c)
-GR_EXPAND_X_H(trellis viterbi_X b s i)
-GR_EXPAND_X_H(trellis viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci)
-GR_EXPAND_X_H(trellis sccc_decoder_X b s i)
-GR_EXPAND_X_H(trellis sccc_decoder_combined_XX fb fs fi cb cs ci)
-GR_EXPAND_X_H(trellis pccc_decoder_X b s i)
-GR_EXPAND_X_H(trellis pccc_decoder_combined_XX fb fs fi cb cs ci)
-
-add_custom_target(trellis_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
api.h
base.h
calc_metric.h
constellation_metrics_cf.h
core_algorithms.h
+ encoder.h
fsm.h
interleaver.h
+ metrics.h
+ pccc_decoder_blk.h
+ pccc_decoder_combined_blk.h
+ pccc_encoder.h
permutation.h
quicksort_index.h
+ sccc_encoder.h
+ sccc_decoder_blk.h
+ sccc_decoder_combined_blk.h
siso_type.h
siso_combined_f.h
siso_f.h
+ viterbi.h
+ viterbi_combined.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/trellis
)
-
diff --git a/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/encoder.h
index affd62f68b..5f022f2a01 100644
--- a/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/encoder.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef ENCODER_H
+#define ENCODER_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
#include <gnuradio/sync_block.h>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -36,11 +35,11 @@ namespace gr {
* \brief Convolutional encoder.
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public sync_block
+ template <class IN_T, class OUT_T>
+ class TRELLIS_API encoder : virtual public sync_block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< encoder<IN_T,OUT_T> > sptr;
static sptr make(const fsm &FSM, int ST);
@@ -53,8 +52,14 @@ namespace gr {
virtual void set_ST(int ST) =0;
virtual void set_K(int K) =0;
};
+ typedef encoder<std::uint8_t, std::uint8_t> encoder_bb;
+ typedef encoder<std::uint8_t, std::int16_t> encoder_bs;
+ typedef encoder<std::uint8_t, std::int32_t> encoder_bi;
+ typedef encoder<std::int16_t, std::int16_t> encoder_ss;
+ typedef encoder<std::int16_t, std::int32_t> encoder_si;
+ typedef encoder<std::int32_t, std::int32_t> encoder_ii;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ENCODER_H */
diff --git a/gr-trellis/include/gnuradio/trellis/metrics_X.h.t b/gr-trellis/include/gnuradio/trellis/metrics.h
index f463c865a9..e2ca32222a 100644
--- a/gr-trellis/include/gnuradio/trellis/metrics_X.h.t
+++ b/gr-trellis/include/gnuradio/trellis/metrics.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,14 +20,14 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef METRICS_H
+#define METRICS_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/calc_metric.h>
#include <gnuradio/block.h>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -36,28 +36,33 @@ namespace gr {
* \brief Evaluate metrics for use by the Viterbi algorithm.
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+template<class T>
+ class TRELLIS_API metrics : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::trellis::metrics::sptr
+ typedef boost::shared_ptr< metrics<T> > sptr;
- static sptr make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ static sptr make(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE);
virtual int O() const = 0;
virtual int D() const = 0;
virtual digital::trellis_metric_type_t TYPE() const = 0;
- virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual std::vector<T> TABLE() const = 0;
virtual void set_O(int O) = 0;
virtual void set_D(int D) = 0;
virtual void set_TYPE(digital::trellis_metric_type_t type) = 0;
- virtual void set_TABLE(const std::vector<@I_TYPE@> &table) = 0;
+ virtual void set_TABLE(const std::vector<T> &table) = 0;
};
+typedef metrics<std::int16_t> metrics_s;
+typedef metrics<std::int32_t> metrics_i;
+typedef metrics<float> metrics_f;
+typedef metrics<gr_complex> metrics_c;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* METRICS_H */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h
index affce07042..8684f33f03 100644
--- a/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t
+++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PCCC_DECODER_BLK_H
+#define PCCC_DECODER_BLK_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
@@ -31,6 +30,7 @@
#include <gnuradio/trellis/siso_type.h>
#include <gnuradio/block.h>
#include <vector>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -38,11 +38,12 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+template<class T>
+ class TRELLIS_API pccc_decoder_blk : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::trellis::pccc_decoder_blk::sptr
+ typedef boost::shared_ptr< pccc_decoder_blk<T> > sptr;
static sptr make(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
@@ -63,7 +64,10 @@ namespace gr {
virtual siso_type_t SISO_TYPE() const = 0;
};
+typedef pccc_decoder_blk<std::uint8_t> pccc_decoder_b;
+typedef pccc_decoder_blk<std::int16_t> pccc_decoder_s;
+typedef pccc_decoder_blk<std::int32_t> pccc_decoder_i;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_BLK_H */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h
index 719b0aa1e5..e09c08f3bc 100644
--- a/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PCCC_DECODER_COMBINED_BLK_H
+#define PCCC_DECODER_COMBINED_BLK_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
@@ -32,6 +30,7 @@
#include <gnuradio/trellis/siso_type.h>
#include <gnuradio/block.h>
#include <vector>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -39,11 +38,11 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+ template <class IN_T,class OUT_T>
+ class TRELLIS_API pccc_decoder_combined_blk : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< pccc_decoder_combined_blk<IN_T,OUT_T> > sptr;
static sptr make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
@@ -52,7 +51,7 @@ namespace gr {
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
@@ -66,14 +65,21 @@ namespace gr {
virtual int blocklength() const = 0;
virtual int repetitions() const = 0;
virtual int D() const = 0;
- virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual std::vector<IN_T> TABLE() const = 0;
virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
virtual siso_type_t SISO_TYPE() const = 0;
virtual float scaling() const = 0;
virtual void set_scaling(float scaling) = 0;
};
+ typedef pccc_decoder_combined_blk<float, std::uint8_t> pccc_decoder_combined_fb;
+ typedef pccc_decoder_combined_blk<float, std::int16_t> pccc_decoder_combined_fs;
+ typedef pccc_decoder_combined_blk<float, std::int32_t> pccc_decoder_combined_fi;
+ typedef pccc_decoder_combined_blk<gr_complex, std::uint8_t> pccc_decoder_combined_cb;
+ typedef pccc_decoder_combined_blk<gr_complex, std::int16_t> pccc_decoder_combined_cs;
+ typedef pccc_decoder_combined_blk<gr_complex, std::int32_t> pccc_decoder_combined_ci;
+
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_COMBINED_BLK_H */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_encoder.h
index 5308fe275d..6f3ee25170 100644
--- a/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/pccc_encoder.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,16 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PCCC_ENCODER_H
+#define PCCC_ENCODER_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
#include <gnuradio/trellis/interleaver.h>
#include <gnuradio/sync_block.h>
#include <vector>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -38,11 +37,11 @@ namespace gr {
* \brief PCCC encoder.
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public sync_block
+ template <class IN_T, class OUT_T>
+ class TRELLIS_API pccc_encoder : virtual public sync_block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr<pccc_encoder<IN_T,OUT_T>> sptr;
static sptr make(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
@@ -56,8 +55,15 @@ namespace gr {
virtual interleaver INTERLEAVER() const = 0;
virtual int blocklength() const = 0;
};
+ typedef pccc_encoder<std::uint8_t, std::uint8_t> pccc_encoder_bb;
+ typedef pccc_encoder<std::uint8_t, std::int16_t> pccc_encoder_bs;
+ typedef pccc_encoder<std::uint8_t, std::int32_t> pccc_encoder_bi;
+ typedef pccc_encoder<std::int16_t, std::int16_t> pccc_encoder_ss;
+ typedef pccc_encoder<std::int16_t, std::int32_t> pccc_encoder_si;
+ typedef pccc_encoder<std::int32_t, std::int32_t> pccc_encoder_ii;
+
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_ENCODER_H */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h
index cc1d86b709..48b90dc927 100644
--- a/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t
+++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SCCC_DECODER_BLK_H
+#define SCCC_DECODER_BLK_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
@@ -31,6 +30,7 @@
#include <gnuradio/trellis/siso_type.h>
#include <gnuradio/block.h>
#include <vector>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -38,11 +38,12 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+template<class T>
+ class TRELLIS_API sccc_decoder_blk : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::trellis::sccc_decoder_blk::sptr
+ typedef boost::shared_ptr< sccc_decoder_blk<T> > sptr;
static sptr make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
@@ -63,7 +64,10 @@ namespace gr {
virtual siso_type_t SISO_TYPE() const = 0;
};
+typedef sccc_decoder_blk<std::uint8_t> sccc_decoder_b;
+typedef sccc_decoder_blk<std::int16_t> sccc_decoder_s;
+typedef sccc_decoder_blk<std::int32_t> sccc_decoder_i;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_BLK_H */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h
index e1f95dff1f..cfec71e981 100644
--- a/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SCCC_DECODER_COMBINED_BLK_H
+#define SCCC_DECODER_COMBINED_BLK_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
@@ -32,6 +30,7 @@
#include <gnuradio/trellis/siso_type.h>
#include <gnuradio/block.h>
#include <vector>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -39,11 +38,11 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+ template <class IN_T,class OUT_T>
+ class TRELLIS_API sccc_decoder_combined_blk : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< sccc_decoder_combined_blk<IN_T,OUT_T> > sptr;
static sptr make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
@@ -52,7 +51,7 @@ namespace gr {
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
@@ -66,7 +65,7 @@ namespace gr {
virtual int blocklength() const = 0;
virtual int repetitions() const = 0;
virtual int D() const = 0;
- virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual std::vector<IN_T> TABLE() const = 0;
virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
virtual siso_type_t SISO_TYPE() const = 0;
virtual float scaling() const = 0;
@@ -74,7 +73,14 @@ namespace gr {
virtual void set_scaling(float scaling) = 0;
};
+ typedef sccc_decoder_combined_blk<float, std::uint8_t> sccc_decoder_combined_fb;
+ typedef sccc_decoder_combined_blk<float, std::int16_t> sccc_decoder_combined_fs;
+ typedef sccc_decoder_combined_blk<float, std::int32_t> sccc_decoder_combined_fi;
+ typedef sccc_decoder_combined_blk<gr_complex, std::uint8_t> sccc_decoder_combined_cb;
+ typedef sccc_decoder_combined_blk<gr_complex, std::int16_t> sccc_decoder_combined_cs;
+ typedef sccc_decoder_combined_blk<gr_complex, std::int32_t> sccc_decoder_combined_ci;
+
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_COMBINED_H */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_encoder.h
index 85fad02eeb..394cce50de 100644
--- a/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/sccc_encoder.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SCCC_ENCODER_H
+#define SCCC_ENCODER_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
@@ -38,11 +36,11 @@ namespace gr {
* \brief SCCC encoder.
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public sync_block
+ template <class IN_T, class OUT_T>
+ class TRELLIS_API sccc_encoder : virtual public sync_block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< sccc_encoder<IN_T,OUT_T> > sptr;
static sptr make(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
@@ -56,8 +54,14 @@ namespace gr {
virtual interleaver INTERLEAVER() const = 0;
virtual int blocklength() const = 0;
};
+ typedef sccc_encoder<std::uint8_t, std::uint8_t> sccc_encoder_bb;
+ typedef sccc_encoder<std::uint8_t, std::int16_t> sccc_encoder_bs;
+ typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_bi;
+ typedef sccc_encoder<std::int16_t, std::int16_t> sccc_encoder_ss;
+ typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_si;
+ typedef sccc_encoder<std::int32_t, std::int32_t> sccc_encoder_ii;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_ENCODER_H */
diff --git a/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t b/gr-trellis/include/gnuradio/trellis/viterbi.h
index 252ffb715d..c37392fb99 100644
--- a/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t
+++ b/gr-trellis/include/gnuradio/trellis/viterbi.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,15 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VITERBI_H
+#define VITERBI_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
#include <gnuradio/trellis/core_algorithms.h>
#include <gnuradio/block.h>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -36,11 +36,12 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+template<class T>
+ class TRELLIS_API viterbi : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::trellis::viterbi::sptr
+ typedef boost::shared_ptr< viterbi<T> > sptr;
static sptr make(const fsm &FSM, int K,
int S0, int SK);
@@ -56,7 +57,10 @@ namespace gr {
virtual void set_SK(int SK) =0;
};
+typedef viterbi<std::uint8_t> viterbi_b;
+typedef viterbi<std::int16_t> viterbi_s;
+typedef viterbi<std::int32_t> viterbi_i;
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_H */
diff --git a/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/viterbi_combined.h
index 4546e95739..b48106a8b4 100644
--- a/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t
+++ b/gr-trellis/include/gnuradio/trellis/viterbi_combined.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,16 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VITERBI_COMBINED_H
+#define VITERBI_COMBINED_H
#include <gnuradio/trellis/api.h>
#include <gnuradio/trellis/fsm.h>
#include <gnuradio/trellis/calc_metric.h>
#include <gnuradio/trellis/core_algorithms.h>
#include <gnuradio/block.h>
+#include <cstdint>
namespace gr {
namespace trellis {
@@ -37,15 +36,15 @@ namespace gr {
/*!
* \ingroup trellis_coding_blk
*/
- class TRELLIS_API @NAME@ : virtual public block
+ template <class IN_T,class OUT_T>
+ class TRELLIS_API viterbi_combined : virtual public block
{
public:
- // gr::trellis::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< viterbi_combined<IN_T,OUT_T> > sptr;
static sptr make(const fsm &FSM, int K,
int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t TYPE);
virtual fsm FSM() const = 0;
@@ -53,7 +52,7 @@ namespace gr {
virtual int S0() const = 0;
virtual int SK() const = 0;
virtual int D() const = 0;
- virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual std::vector<IN_T> TABLE() const = 0;
virtual digital::trellis_metric_type_t TYPE() const = 0;
virtual void set_FSM(const fsm &FSM) =0;
@@ -61,11 +60,24 @@ namespace gr {
virtual void set_S0(int S0) =0;
virtual void set_SK(int SK) =0;
virtual void set_D(int D) =0;
- virtual void set_TABLE (const std::vector<@I_TYPE@> &table) = 0;
+ virtual void set_TABLE (const std::vector<IN_T> &table) = 0;
virtual void set_TYPE(digital::trellis_metric_type_t type) = 0;
};
+ typedef viterbi_combined<std::int16_t, std::uint8_t> viterbi_combined_sb;
+ typedef viterbi_combined<std::int16_t, std::int16_t> viterbi_combined_ss;
+ typedef viterbi_combined<std::int16_t, std::int32_t> viterbi_combined_si;
+ typedef viterbi_combined<std::int32_t, std::uint8_t> viterbi_combined_ib;
+ typedef viterbi_combined<std::int32_t, std::int16_t> viterbi_combined_is;
+ typedef viterbi_combined<std::int32_t, std::int32_t> viterbi_combined_ii;
+ typedef viterbi_combined<float, std::uint8_t> viterbi_combined_fb;
+ typedef viterbi_combined<float, std::int16_t> viterbi_combined_fs;
+ typedef viterbi_combined<float, std::int32_t> viterbi_combined_fi;
+ typedef viterbi_combined<gr_complex, std::uint8_t> viterbi_combined_cb;
+ typedef viterbi_combined<gr_complex, std::int16_t> viterbi_combined_cs;
+ typedef viterbi_combined<gr_complex, std::int32_t> viterbi_combined_ci;
+
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_COMBINED_H */
diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt
index a016f9885a..968de82879 100644
--- a/gr-trellis/lib/CMakeLists.txt
+++ b/gr-trellis/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2014 Free Software Foundation, Inc.
+# Copyright 2012,2014,2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,36 +34,30 @@ if(ENABLE_GR_CTRLPORT)
ADD_DEFINITIONS(-DGR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
-#######################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(trellis encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis sccc_encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis pccc_encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis metrics_X_impl s i f c)
-GR_EXPAND_X_CC_H(trellis viterbi_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis viterbi_combined_XX_impl sb ss si ib is ii fb fs fi cb cs ci)
-GR_EXPAND_X_CC_H(trellis sccc_decoder_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis sccc_decoder_combined_XX_impl fb fs fi cb cs ci)
-GR_EXPAND_X_CC_H(trellis pccc_decoder_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis pccc_decoder_combined_XX_impl fb fs fi cb cs ci)
-
########################################################################
# Setup library
########################################################################
list(APPEND trellis_sources
- ${generated_sources}
base.cc
calc_metric.cc
core_algorithms.cc
+ encoder_impl.cc
fsm.cc
interleaver.cc
quicksort_index.cc
constellation_metrics_cf_impl.cc
+ metrics_impl.cc
+ pccc_decoder_blk_impl.cc
+ pccc_encoder_impl.cc
+ pccc_decoder_combined_blk_impl.cc
permutation_impl.cc
+ sccc_decoder_blk_impl.cc
+ sccc_decoder_combined_blk_impl.cc
+ sccc_encoder_impl.cc
siso_f_impl.cc
siso_combined_f_impl.cc
+ viterbi_impl.cc
+ viterbi_combined_impl.cc
)
list(APPEND trellis_libs
@@ -90,7 +84,7 @@ add_library(gnuradio-trellis SHARED ${trellis_sources})
target_link_libraries(gnuradio-trellis ${trellis_libs})
GR_LIBRARY_FOO(gnuradio-trellis)
add_dependencies(gnuradio-trellis
- trellis_generated_includes trellis_generated_swigs
+ trellis_generated_swigs
gnuradio-runtime gnuradio-digital)
if(ENABLE_STATIC_LIBS)
@@ -108,7 +102,7 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-trellis_static STATIC ${trellis_sources})
add_dependencies(gnuradio-trellis_static
- trellis_generated_includes trellis_generated_swigs
+ trellis_generated_swigs
gnuradio-runtime_static gnuradio-digital_static
)
diff --git a/gr-trellis/lib/encoder_XX_impl.cc.t b/gr-trellis/lib/encoder_XX_impl.cc.t
deleted file mode 100644
index 3a004a2f94..0000000000
--- a/gr-trellis/lib/encoder_XX_impl.cc.t
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <iostream>
-
-namespace gr {
- namespace trellis {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int ST)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM,ST,0,false));
- }
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int ST, int K)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM,ST,K,true));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int ST, int K, bool B)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
- d_FSM(FSM),
- d_ST(ST),
- d_K(K),
- d_B(B)
- {
- }
-
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_FSM = FSM;
- }
-
- void @IMPL_NAME@::set_ST(int ST)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_ST = ST;
- }
-
- void @IMPL_NAME@::set_K(int K)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_K = K;
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock guard(d_setlock);
- int ST_tmp = 0;
-
- if (d_B){ // blockwise operation
- int nblocks = noutput_items /d_K;
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for(int n = 0; n < nblocks; n++) {
- ST_tmp = d_ST;
- for(int i = 0; i < d_K; i++) {
- out[n*d_K+i] = (@O_TYPE@)d_FSM.OS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
- ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
- }
- }
- return nblocks*d_K;
- } // end blockwise operation
- else{ // streaming operation
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- ST_tmp = d_ST;
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@O_TYPE@)d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]];
- ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
- }
- d_ST = ST_tmp;
- return noutput_items;
- } // end streaming operation
- }
-
- } /* namespace trellis */
-} /* namespace gr */
diff --git a/gr-trellis/lib/encoder_impl.cc b/gr-trellis/lib/encoder_impl.cc
new file mode 100644
index 0000000000..ecb0410a5f
--- /dev/null
+++ b/gr-trellis/lib/encoder_impl.cc
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "encoder_impl.h"
+#include <gnuradio/io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ template <class IN_T, class OUT_T>
+ typename encoder<IN_T,OUT_T>::sptr
+ encoder<IN_T,OUT_T>::make(const fsm &FSM, int ST)
+ {
+ return gnuradio::get_initial_sptr
+ (new encoder_impl<IN_T,OUT_T>(FSM,ST,0,false));
+ }
+
+ template <class IN_T, class OUT_T>
+ typename encoder<IN_T,OUT_T>::sptr
+ encoder<IN_T,OUT_T>::make(const fsm &FSM, int ST, int K)
+ {
+ return gnuradio::get_initial_sptr
+ (new encoder_impl<IN_T,OUT_T>(FSM,ST,K,true));
+ }
+
+ template <class IN_T, class OUT_T>
+ encoder_impl<IN_T,OUT_T>::encoder_impl(const fsm &FSM, int ST, int K, bool B)
+ : sync_block("encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
+ d_FSM(FSM),
+ d_ST(ST),
+ d_K(K),
+ d_B(B)
+ {
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_FSM(const fsm &FSM)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_FSM = FSM;
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_ST(int ST)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_ST = ST;
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_K(int K)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_K = K;
+ }
+
+ template <class IN_T, class OUT_T>
+ encoder_impl<IN_T,OUT_T>::~encoder_impl()
+ {
+ }
+
+ template <class IN_T, class OUT_T>
+ int
+ encoder_impl<IN_T,OUT_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ int ST_tmp = 0;
+
+ if (d_B){ // blockwise operation
+ int nblocks = noutput_items /d_K;
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
+ for(int n = 0; n < nblocks; n++) {
+ ST_tmp = d_ST;
+ for(int i = 0; i < d_K; i++) {
+ out[n*d_K+i] = (OUT_T)d_FSM.OS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
+ ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
+ }
+ }
+ return nblocks*d_K;
+ } // end blockwise operation
+ else{ // streaming operation
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
+ ST_tmp = d_ST;
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = (OUT_T)d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]];
+ ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
+ }
+ d_ST = ST_tmp;
+ return noutput_items;
+ } // end streaming operation
+ }
+ template class encoder<std::uint8_t, std::uint8_t>;
+ template class encoder<std::uint8_t, std::int16_t>;
+ template class encoder<std::uint8_t, std::int32_t>;
+ template class encoder<std::int16_t, std::int16_t>;
+ template class encoder<std::int16_t, std::int32_t>;
+ template class encoder<std::int32_t, std::int32_t>;
+
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/encoder_XX_impl.h.t b/gr-trellis/lib/encoder_impl.h
index 2b0ff31f4d..5832b9d848 100644
--- a/gr-trellis/lib/encoder_XX_impl.h.t
+++ b/gr-trellis/lib/encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,28 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef ENCODER_IMPL_H
+#define ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class encoder_impl : public encoder<IN_T,OUT_T>
{
private:
fsm d_FSM;
int d_ST;
int d_K;
bool d_B;
-
+
public:
- @IMPL_NAME@(const fsm &FSM, int ST, int K, bool B);
- ~@IMPL_NAME@();
+ encoder_impl(const fsm &FSM, int ST, int K, bool B);
+ ~encoder_impl();
fsm FSM() const { return d_FSM;; }
int ST() const { return d_ST; }
@@ -57,4 +56,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/metrics_X_impl.cc.t b/gr-trellis/lib/metrics_impl.cc
index 5e74e4b2fc..cf0697c521 100644
--- a/gr-trellis/lib/metrics_X_impl.cc.t
+++ b/gr-trellis/lib/metrics_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "metrics_impl.h"
#include <gnuradio/io_signature.h>
#include <assert.h>
#include <stdexcept>
@@ -35,61 +34,69 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ template <class T>
+ typename metrics<T>::sptr
+ metrics<T>::make(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(O,D,TABLE,TYPE));
+ (new metrics_impl<T>(O,D,TABLE,TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ template <class T>
+ metrics_impl<T>::metrics_impl(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE)
- : block("@BASE_NAME@",
- io_signature::make(1, -1, sizeof (@I_TYPE@)),
+ : block("metrics",
+ io_signature::make(1, -1, sizeof (T)),
io_signature::make(1, -1, sizeof (float))),
d_O(O), d_D(D), d_TYPE(TYPE), d_TABLE(TABLE)
{
- set_relative_rate (1.0 * d_O / ((double) d_D));
- set_output_multiple ((int)d_O);
+ this->set_relative_rate (1.0 * d_O / ((double) d_D));
+ this->set_output_multiple ((int)d_O);
}
- void @IMPL_NAME@::set_O(int O)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_O = O;
- set_relative_rate (1.0 * d_O / ((double) d_D));
- set_output_multiple ((int)d_O);
+ template <class T>
+ void metrics_impl<T>::set_O(int O)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_O = O;
+ this->set_relative_rate (1.0 * d_O / ((double) d_D));
+ this->set_output_multiple ((int)d_O);
}
- void @IMPL_NAME@::set_D(int D)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_D = D;
- set_relative_rate (1.0 * d_O / ((double) d_D));
+ template <class T>
+ void metrics_impl<T>::set_D(int D)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_D = D;
+ this->set_relative_rate (1.0 * d_O / ((double) d_D));
}
+ template <class T>
void
- @IMPL_NAME@::set_TYPE(digital::trellis_metric_type_t type)
+ metrics_impl<T>::set_TYPE(digital::trellis_metric_type_t type)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_TYPE = type;
}
+ template <class T>
void
- @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
+ metrics_impl<T>::set_TABLE(const std::vector<T> &table)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_TABLE = table;
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ metrics_impl<T>::~metrics_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ metrics_impl<T>::forecast(int noutput_items, gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items / d_O;
unsigned ninputs = ninput_items_required.size();
@@ -97,17 +104,18 @@ namespace gr {
ninput_items_required[i] = input_required;
}
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ metrics_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nstreams = input_items.size();
for(int m = 0; m < nstreams; m++) {
- const @I_TYPE@ *in = (@I_TYPE@*)input_items[m];
+ const T *in = (T*)input_items[m];
float *out = (float*)output_items[m];
for(int i = 0; i < noutput_items / d_O ; i++) {
@@ -115,9 +123,13 @@ namespace gr {
}
}
- consume_each(d_D * noutput_items / d_O);
+ this->consume_each(d_D * noutput_items / d_O);
return noutput_items;
}
+template class metrics<std::int16_t>;
+template class metrics<std::int32_t>;
+template class metrics<float>;
+template class metrics<gr_complex>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/metrics_X_impl.h.t b/gr-trellis/lib/metrics_impl.h
index 9323ae4645..95c5f44845 100644
--- a/gr-trellis/lib/metrics_X_impl.h.t
+++ b/gr-trellis/lib/metrics_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,38 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef METRICS_IMPL_H
+#define METRICS_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/metrics.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class metrics_impl : public metrics<T>
{
private:
int d_O;
int d_D;
digital::trellis_metric_type_t d_TYPE;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<T> d_TABLE;
public:
- @IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ metrics_impl(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE);
- ~@IMPL_NAME@();
+ ~metrics_impl();
int O() const { return d_O; }
int D() const { return d_D; }
digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<T> TABLE() const { return d_TABLE; }
void set_O(int O);
void set_D(int D);
void set_TYPE(digital::trellis_metric_type_t type);
- void set_TABLE(const std::vector<@I_TYPE@> &table);
+ void set_TABLE(const std::vector<T> &table);
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
@@ -65,4 +65,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* METRICS_IMPL_H */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.cc.t b/gr-trellis/lib/pccc_decoder_blk_impl.cc
index 4f80598540..3cadff97ea 100644
--- a/gr-trellis/lib/pccc_decoder_X_impl.cc.t
+++ b/gr-trellis/lib/pccc_decoder_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_decoder_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,8 +33,9 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM1, int ST10, int ST1K,
+ template <class T>
+ typename pccc_decoder_blk<T>::sptr
+ pccc_decoder_blk<T>::make(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
@@ -43,7 +43,7 @@ namespace gr {
siso_type_t SISO_TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM1, ST10, ST1K,
+ (new pccc_decoder_blk_impl<T>(FSM1, ST10, ST1K,
FSM2, ST20, ST2K,
INTERLEAVER,
blocklength,
@@ -51,15 +51,16 @@ namespace gr {
SISO_TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ template <class T>
+ pccc_decoder_blk_impl<T>::pccc_decoder_blk_impl(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE)
- : block("@BASE_NAME@",
+ : block("pccc_decoder_blk",
io_signature::make(1, 1, sizeof(float)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ io_signature::make(1, 1, sizeof(T))),
d_FSM1(FSM1), d_ST10(ST10), d_ST1K(ST1K),
d_FSM2(FSM2), d_ST20(ST20), d_ST2K(ST2K),
d_INTERLEAVER(INTERLEAVER),
@@ -67,16 +68,18 @@ namespace gr {
d_repetitions(repetitions),
d_SISO_TYPE(SISO_TYPE)
{
- set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O()));
- set_output_multiple (d_blocklength);
+ this->set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O()));
+ this->set_output_multiple (d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ pccc_decoder_blk_impl<T>::~pccc_decoder_blk_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ pccc_decoder_blk_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items;
@@ -85,8 +88,9 @@ namespace gr {
//===========================================================
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ pccc_decoder_blk_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -100,7 +104,7 @@ namespace gr {
p2min = &min_star;
const float *in = (const float *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ T *out = (T *) output_items[0];
for(int n=0;n<nblocks;n++) {
pccc_decoder(d_FSM1, d_ST10, d_ST1K,
d_FSM2, d_ST20, d_ST2K,
@@ -110,9 +114,12 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_FSM1.O() * d_FSM2.O() * noutput_items);
+ this->consume_each(d_FSM1.O() * d_FSM2.O() * noutput_items);
return noutput_items;
}
+template class pccc_decoder_blk<std::uint8_t>;
+template class pccc_decoder_blk<std::int16_t>;
+template class pccc_decoder_blk<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.h.t b/gr-trellis/lib/pccc_decoder_blk_impl.h
index 43a7257fc5..ed4e2d24a6 100644
--- a/gr-trellis/lib/pccc_decoder_X_impl.h.t
+++ b/gr-trellis/lib/pccc_decoder_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PCCC_DECODER_BLK_IMPL_H
+#define PCCC_DECODER_BLK_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_decoder_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class pccc_decoder_blk_impl : public pccc_decoder_blk<T>
{
private:
fsm d_FSM1;
@@ -46,13 +46,13 @@ namespace gr {
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ pccc_decoder_blk_impl(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE);
- ~@IMPL_NAME@();
+ ~pccc_decoder_blk_impl();
fsm FSM1() const { return d_FSM1; }
fsm FSM2() const { return d_FSM2; }
@@ -77,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_BLK_IMPL_H */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/pccc_decoder_combined_blk_impl.cc
index 6841066416..a985c0d9c0 100644
--- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t
+++ b/gr-trellis/lib/pccc_decoder_combined_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_decoder_combined_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,37 +32,39 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T,class OUT_T>
+ typename pccc_decoder_combined_blk<IN_T,OUT_T>::sptr
+ pccc_decoder_combined_blk<IN_T,OUT_T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
{
return gnuradio::get_initial_sptr
- (new @NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new pccc_decoder_combined_blk_impl<IN_T,OUT_T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T,class OUT_T>
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::pccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : block("pccc_decoder_combined_blk<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -77,23 +77,26 @@ namespace gr {
d_scaling(scaling)
{
assert(d_FSMo.I() == d_FSMi.I());
- set_relative_rate (1.0 / ((double) d_D));
- set_output_multiple (d_blocklength);
+ this->set_relative_rate (1.0 / ((double) d_D));
+ this->set_output_multiple (d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T,class OUT_T>
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::~pccc_decoder_combined_blk_impl()
{
}
+ template <class IN_T,class OUT_T>
void
- @IMPL_NAME@::set_scaling(float scaling)
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::set_scaling(float scaling)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_scaling = scaling;
}
+ template <class IN_T,class OUT_T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items;
@@ -102,13 +105,14 @@ namespace gr {
//===========================================================
+ template <class IN_T,class OUT_T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nblocks = noutput_items / d_blocklength;
float (*p2min)(float, float) = NULL;
@@ -117,8 +121,8 @@ namespace gr {
else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
p2min = &min_star;
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ const IN_T *in = (const IN_T *) input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
for (int n=0;n<nblocks;n++) {
pccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
d_FSMi, d_STi0, d_STiK,
@@ -131,9 +135,16 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_D * noutput_items);
+ this->consume_each(d_D * noutput_items);
return noutput_items;
}
+ template class pccc_decoder_combined_blk<float, std::uint8_t>;
+ template class pccc_decoder_combined_blk<float, std::int16_t>;
+ template class pccc_decoder_combined_blk<float, std::int32_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::uint8_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::int16_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::int32_t>;
+
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/pccc_decoder_combined_blk_impl.h
index 7606017547..544a965607 100644
--- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t
+++ b/gr-trellis/lib/pccc_decoder_combined_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef PCCC_DECODER_COMBINED_BLK_IMPL_H
+#define PCCC_DECODER_COMBINED_BLK_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_decoder_combined_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T,class OUT_T>
+ class pccc_decoder_combined_blk_impl : public pccc_decoder_combined_blk<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -44,23 +43,23 @@ namespace gr {
int d_repetitions;
siso_type_t d_SISO_TYPE;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_METRIC_TYPE;
float d_scaling;
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ pccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
- ~@IMPL_NAME@();
+ ~pccc_decoder_combined_blk_impl();
fsm FSM1() const { return d_FSMo; }
fsm FSM2() const { return d_FSMi; }
@@ -72,7 +71,7 @@ namespace gr {
int blocklength() const { return d_blocklength; }
int repetitions() const { return d_repetitions; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
float scaling() const { return d_scaling; }
@@ -90,4 +89,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_COMBINED_BLK_IMPL_H */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t b/gr-trellis/lib/pccc_encoder_impl.cc
index 8fd143ca9d..2804f4b39c 100644
--- a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t
+++ b/gr-trellis/lib/pccc_encoder_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,58 +20,60 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_encoder_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM1, int ST1,
+ template <class IN_T, class OUT_T>
+ typename pccc_encoder<IN_T,OUT_T>::sptr
+ pccc_encoder<IN_T,OUT_T>::make(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM1, ST1, FSM2, ST2, INTERLEAVER, blocklength));
+ (new pccc_encoder_impl<IN_T,OUT_T>(FSM1, ST1, FSM2, ST2, INTERLEAVER, blocklength));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST1,
+ template <class IN_T, class OUT_T>
+ pccc_encoder_impl<IN_T,OUT_T>::pccc_encoder_impl(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : sync_block("pccc_encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSM1(FSM1), d_ST1(ST1),
d_FSM2(FSM2), d_ST2(ST2),
d_INTERLEAVER(INTERLEAVER),
d_blocklength(blocklength)
{
assert(d_FSM1.I() == d_FSM2.I());
- set_output_multiple(d_blocklength);
+ this->set_output_multiple(d_blocklength);
d_buffer.resize(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ pccc_encoder_impl<IN_T,OUT_T>::~pccc_encoder_impl()
{
}
+ template <class IN_T, class OUT_T>
int
- @NAME@::work(int noutput_items,
+ pccc_encoder_impl<IN_T,OUT_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
for(int b = 0 ; b<noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+ const IN_T *in = (const IN_T*)input_items[0]+b*d_blocklength;
+ OUT_T *out = (OUT_T*)output_items[0]+b*d_blocklength;
int ST1_tmp = d_ST1;
int ST2_tmp = d_ST2;
@@ -81,11 +83,17 @@ namespace gr {
ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]];
int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]];
ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]];
- out[i] = (@O_TYPE@) (o1*d_FSM2.O() + o2);
+ out[i] = (OUT_T) (o1*d_FSM2.O() + o2);
}
}
return noutput_items;
}
+ template class pccc_encoder<std::uint8_t, std::uint8_t>;
+ template class pccc_encoder<std::uint8_t, std::int16_t>;
+ template class pccc_encoder<std::uint8_t, std::int32_t>;
+ template class pccc_encoder<std::int16_t, std::int16_t>;
+ template class pccc_encoder<std::int16_t, std::int32_t>;
+ template class pccc_encoder<std::int32_t, std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.h.t b/gr-trellis/lib/pccc_encoder_impl.h
index 5561b716d3..834e8986c4 100644
--- a/gr-trellis/lib/pccc_encoder_XX_impl.h.t
+++ b/gr-trellis/lib/pccc_encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef PCCC_ENCODER_IMPL_H
+#define PCCC_ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class pccc_encoder_impl : public pccc_encoder<IN_T,OUT_T>
{
private:
fsm d_FSM1;
@@ -42,11 +41,11 @@ namespace gr {
std::vector<int> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSM1, int ST1,
+ pccc_encoder_impl(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength);
- ~@IMPL_NAME@();
+ ~pccc_encoder_impl();
fsm FSM1() const { return d_FSM1; }
int ST1() const { return d_ST1; }
@@ -63,4 +62,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.cc.t b/gr-trellis/lib/sccc_decoder_blk_impl.cc
index 6f1bac585a..7855f9f0fe 100644
--- a/gr-trellis/lib/sccc_decoder_X_impl.cc.t
+++ b/gr-trellis/lib/sccc_decoder_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_decoder_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,8 +33,9 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class T>
+ typename sccc_decoder_blk<T>::sptr
+ sccc_decoder_blk<T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
@@ -43,20 +43,21 @@ namespace gr {
siso_type_t SISO_TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new sccc_decoder_blk_impl<T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class T>
+ sccc_decoder_blk_impl<T>::sccc_decoder_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE)
- : block("@BASE_NAME@",
+ : block("sccc_decoder_blk",
io_signature::make(1, 1, sizeof(float)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ io_signature::make(1, 1, sizeof(T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -64,16 +65,18 @@ namespace gr {
d_repetitions(repetitions),
d_SISO_TYPE(SISO_TYPE)
{
- set_relative_rate(1.0 / ((double) d_FSMi.O()));
- set_output_multiple(d_blocklength);
+ this->set_relative_rate(1.0 / ((double) d_FSMi.O()));
+ this->set_output_multiple(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ sccc_decoder_blk_impl<T>::~sccc_decoder_blk_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ sccc_decoder_blk_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSMi.O() * noutput_items ;
@@ -82,8 +85,9 @@ namespace gr {
//===========================================================
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ sccc_decoder_blk_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -97,7 +101,7 @@ namespace gr {
p2min = &min_star;
const float *in = (const float*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+ T *out = (T*)output_items[0];
for(int n = 0; n < nblocks; n++) {
sccc_decoder(d_FSMo, d_STo0, d_SToK,
@@ -108,9 +112,12 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_FSMi.O() * noutput_items );
+ this->consume_each(d_FSMi.O() * noutput_items );
return noutput_items;
}
+template class sccc_decoder_blk<std::uint8_t>;
+template class sccc_decoder_blk<std::int16_t>;
+template class sccc_decoder_blk<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.h.t b/gr-trellis/lib/sccc_decoder_blk_impl.h
index c79e6ebbab..0c3e2d9310 100644
--- a/gr-trellis/lib/sccc_decoder_X_impl.h.t
+++ b/gr-trellis/lib/sccc_decoder_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SCCC_DECODER_BLK_IMPL_H
+#define SCCC_DECODER_BLK_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_decoder_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class sccc_decoder_blk_impl : public sccc_decoder_blk<T>
{
private:
fsm d_FSMo;
@@ -46,13 +46,13 @@ namespace gr {
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ sccc_decoder_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE);
- ~@IMPL_NAME@();
+ ~sccc_decoder_blk_impl();
fsm FSMo() const { return d_FSMo; }
fsm FSMi() const { return d_FSMi; }
@@ -77,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_BLK_IMPL_H */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/sccc_decoder_combined_blk_impl.cc
index 224c5f8027..bf8845ce52 100644
--- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t
+++ b/gr-trellis/lib/sccc_decoder_combined_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_decoder_combined_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,37 +32,39 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T, class OUT_T>
+ typename sccc_decoder_combined_blk<IN_T,OUT_T>::sptr
+ sccc_decoder_combined_blk<IN_T,OUT_T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new sccc_decoder_combined_blk_impl<IN_T,OUT_T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T, class OUT_T>
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::sccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : block("sccc_decoder_combined_blk<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -76,23 +76,26 @@ namespace gr {
d_METRIC_TYPE(METRIC_TYPE),
d_scaling(scaling)
{
- set_relative_rate(1.0 / ((double) d_D));
- set_output_multiple(d_blocklength);
+ this->set_relative_rate(1.0 / ((double) d_D));
+ this->set_output_multiple(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::~sccc_decoder_combined_blk_impl()
{
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::set_scaling(float scaling)
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::set_scaling(float scaling)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_scaling = scaling;
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items ;
@@ -101,13 +104,14 @@ namespace gr {
//===========================================================
+ template <class IN_T, class OUT_T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nblocks = noutput_items / d_blocklength;
float (*p2min)(float, float) = NULL;
@@ -116,8 +120,8 @@ namespace gr {
else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
p2min = &min_star;
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T*)output_items[0];
for(int n = 0; n < nblocks; n++) {
sccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
@@ -131,9 +135,17 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_D * noutput_items);
+ this->consume_each(d_D * noutput_items);
return noutput_items;
}
+ template class sccc_decoder_combined_blk<float, std::uint8_t>;
+ template class sccc_decoder_combined_blk<float, std::int16_t>;
+ template class sccc_decoder_combined_blk<float, std::int32_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::uint8_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::int16_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::int32_t>;
+
+
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/sccc_decoder_combined_blk_impl.h
index 6a38f0114f..8236c79a49 100644
--- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t
+++ b/gr-trellis/lib/sccc_decoder_combined_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef SCCC_DECODER_COMBINED_BLK_IMPL_H
+#define SCCC_DECODER_COMBINED_BLK_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_decoder_combined_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class sccc_decoder_combined_blk_impl : public sccc_decoder_combined_blk<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -44,23 +43,23 @@ namespace gr {
int d_repetitions;
siso_type_t d_SISO_TYPE;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_METRIC_TYPE;
float d_scaling;
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ sccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
- ~@IMPL_NAME@();
+ ~sccc_decoder_combined_blk_impl();
fsm FSMo() const { return d_FSMo; }
fsm FSMi() const { return d_FSMi; }
@@ -72,7 +71,7 @@ namespace gr {
int blocklength() const { return d_blocklength; }
int repetitions() const { return d_repetitions; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
float scaling() const { return d_scaling; }
@@ -90,4 +89,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_COMBINED_BLK_IMPL_H */
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t b/gr-trellis/lib/sccc_encoder_impl.cc
index 9924b3c7d2..9c3e1da2d5 100644
--- a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t
+++ b/gr-trellis/lib/sccc_encoder_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,57 +20,59 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_encoder_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo,
+ template <class IN_T, class OUT_T>
+ typename sccc_encoder<IN_T,OUT_T>::sptr
+ sccc_encoder<IN_T,OUT_T>::make(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo, FSMi, STi, INTERLEAVER, blocklength));
+ (new sccc_encoder_impl<IN_T,OUT_T>(FSMo, STo, FSMi, STi, INTERLEAVER, blocklength));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo,
+ template <class IN_T, class OUT_T>
+ sccc_encoder_impl<IN_T,OUT_T>::sccc_encoder_impl(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : sync_block("sccc_encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo(STo),
d_FSMi(FSMi), d_STi(STi),
d_INTERLEAVER(INTERLEAVER),
d_blocklength(blocklength)
{
- set_output_multiple(d_blocklength);
+ this->set_output_multiple(d_blocklength);
d_buffer.resize(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ sccc_encoder_impl<IN_T,OUT_T>::~sccc_encoder_impl()
{
}
+ template <class IN_T, class OUT_T>
int
- @IMPL_NAME@::work(int noutput_items,
+ sccc_encoder_impl<IN_T,OUT_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
for(int b = 0; b < noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+ const IN_T *in = (const IN_T*)input_items[0]+b*d_blocklength;
+ OUT_T *out = (OUT_T*)output_items[0]+b*d_blocklength;
int STo_tmp = d_STo;
for(int i = 0; i < d_blocklength; i++) {
@@ -81,13 +83,19 @@ namespace gr {
int STi_tmp = d_STi;
for(int i = 0; i < d_blocklength; i++) {
int k = d_INTERLEAVER.INTER()[i];
- out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ out[i] = (OUT_T) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
}
}
return noutput_items;
}
+ template class sccc_encoder<std::uint8_t, std::uint8_t>;
+ template class sccc_encoder<std::uint8_t, std::int16_t>;
+ template class sccc_encoder<std::uint8_t, std::int32_t>;
+ template class sccc_encoder<std::int16_t, std::int16_t>;
+ template class sccc_encoder<std::int16_t, std::int32_t>;
+ template class sccc_encoder<std::int32_t, std::int32_t>;
+
} /* namespace trellis */
} /* namespace gr */
-
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.h.t b/gr-trellis/lib/sccc_encoder_impl.h
index fc64f2ade8..40968906dc 100644
--- a/gr-trellis/lib/sccc_encoder_XX_impl.h.t
+++ b/gr-trellis/lib/sccc_encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef SCCC_ENCODER_IMPL_H
+#define SCCC_ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class sccc_encoder_impl : public sccc_encoder<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -42,11 +41,11 @@ namespace gr {
std::vector<int> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo,
+ sccc_encoder_impl(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength);
- ~@IMPL_NAME@();
+ ~sccc_encoder_impl();
fsm FSMo() const { return d_FSMo; }
int STo() const { return d_STo; }
@@ -63,4 +62,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
deleted file mode 100644
index 6d83dc4402..0000000000
--- a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <iostream>
-
-namespace gr {
- namespace trellis {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int K,
- int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
- digital::trellis_metric_type_t TYPE)
- {
- return gnuradio::get_initial_sptr
- (new @NAME@(FSM, K, S0, SK, D, TABLE,TYPE));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
- int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
- digital::trellis_metric_type_t TYPE)
- : block("@BASE_NAME@",
- io_signature::make(1, -1, sizeof(@I_TYPE@)),
- io_signature::make(1, -1, sizeof(@O_TYPE@))),
- d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D),
- d_TABLE(TABLE), d_TYPE(TYPE)//,
- //d_trace(FSM.S()*K)
- {
- set_relative_rate(1.0 / ((double)d_D));
- set_output_multiple(d_K);
- }
-
- void
- @IMPL_NAME@::set_K(int K)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_K = K;
- set_output_multiple(d_K);
- }
-
- void
- @IMPL_NAME@::set_D(int D)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_D = D;
- set_relative_rate(1.0 / ((double)d_D));
- }
-
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_FSM = FSM;
- }
-
- void @IMPL_NAME@::set_S0(int S0)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_S0 = S0;
- }
-
- void @IMPL_NAME@::set_SK(int SK)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_SK = SK;
- }
-
- void
- @IMPL_NAME@::set_TYPE(digital::trellis_metric_type_t type)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TYPE = type;
- }
-
- void
- @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TABLE = table;
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::forecast(int noutput_items,
- gr_vector_int &ninput_items_required)
- {
- int input_required = d_D * noutput_items;
- unsigned ninputs = ninput_items_required.size();
- for(unsigned int i = 0; i < ninputs; i++) {
- ninput_items_required[i] = input_required;
- }
- }
-
- int
- @IMPL_NAME@::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock guard(d_setlock);
- int nstreams = input_items.size();
- int nblocks = noutput_items / d_K;
-
- for(int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[m];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[m];
-
- for(int n=0;n<nblocks;n++) {
- viterbi_algorithm_combined(d_FSM.I(), d_FSM.S(), d_FSM.O(),
- d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
- d_FSM.PI(), d_K,d_S0, d_SK, d_D,
- d_TABLE, d_TYPE,
- &(in[n*d_K*d_D]), &(out[n*d_K]));
- }
- }
-
- consume_each(d_D * noutput_items);
- return noutput_items;
- }
-
- } /* namespace trellis */
-} /* namespace gr */
-
diff --git a/gr-trellis/lib/viterbi_combined_impl.cc b/gr-trellis/lib/viterbi_combined_impl.cc
new file mode 100644
index 0000000000..e552f5a9b9
--- /dev/null
+++ b/gr-trellis/lib/viterbi_combined_impl.cc
@@ -0,0 +1,176 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 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 3, 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., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "viterbi_combined_impl.h"
+#include <gnuradio/io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ template <class IN_T,class OUT_T>
+ typename viterbi_combined<IN_T,OUT_T>::sptr
+ viterbi_combined<IN_T,OUT_T>::make(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<IN_T> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new viterbi_combined_impl<IN_T,OUT_T>(FSM, K, S0, SK, D, TABLE,TYPE));
+ }
+
+ template <class IN_T,class OUT_T>
+ viterbi_combined_impl<IN_T,OUT_T>::viterbi_combined_impl(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<IN_T> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ : block("viterbi_combined<IN_T,OUT_T>",
+ io_signature::make(1, -1, sizeof(IN_T)),
+ io_signature::make(1, -1, sizeof(OUT_T))),
+ d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D),
+ d_TABLE(TABLE), d_TYPE(TYPE)//,
+ //d_trace(FSM.S()*K)
+ {
+ this->set_relative_rate(1.0 / ((double)d_D));
+ this->set_output_multiple(d_K);
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_K(int K)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_K = K;
+ this->set_output_multiple(d_K);
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_D(int D)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_D = D;
+ this->set_relative_rate(1.0 / ((double)d_D));
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_FSM(const fsm &FSM)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_FSM = FSM;
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_S0(int S0)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_S0 = S0;
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_SK(int SK)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_SK = SK;
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_TYPE(digital::trellis_metric_type_t type)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_TYPE = type;
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_TABLE(const std::vector<IN_T> &table)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_TABLE = table;
+ }
+
+ template <class IN_T,class OUT_T>
+ viterbi_combined_impl<IN_T,OUT_T>::~viterbi_combined_impl()
+ {
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ }
+ }
+
+ template <class IN_T,class OUT_T>
+ int
+ viterbi_combined_impl<IN_T,OUT_T>::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ int nstreams = input_items.size();
+ int nblocks = noutput_items / d_K;
+
+ for(int m=0;m<nstreams;m++) {
+ const IN_T *in = (const IN_T*)input_items[m];
+ OUT_T *out = (OUT_T*)output_items[m];
+
+ for(int n=0;n<nblocks;n++) {
+ viterbi_algorithm_combined(d_FSM.I(), d_FSM.S(), d_FSM.O(),
+ d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
+ d_FSM.PI(), d_K,d_S0, d_SK, d_D,
+ d_TABLE, d_TYPE,
+ &(in[n*d_K*d_D]), &(out[n*d_K]));
+ }
+ }
+
+ this->consume_each(d_D * noutput_items);
+ return noutput_items;
+ }
+
+ template class viterbi_combined<std::int16_t, std::uint8_t>;
+ template class viterbi_combined<std::int16_t, std::int16_t>;
+ template class viterbi_combined<std::int16_t, std::int32_t>;
+ template class viterbi_combined<std::int32_t, std::uint8_t>;
+ template class viterbi_combined<std::int32_t, std::int16_t>;
+ template class viterbi_combined<std::int32_t, std::int32_t>;
+ template class viterbi_combined<float, std::uint8_t>;
+ template class viterbi_combined<float, std::int16_t>;
+ template class viterbi_combined<float, std::int32_t>;
+ template class viterbi_combined<gr_complex, std::uint8_t>;
+ template class viterbi_combined<gr_complex, std::int16_t>;
+ template class viterbi_combined<gr_complex, std::int32_t>;
+
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.h.t b/gr-trellis/lib/viterbi_combined_impl.h
index 788e609895..e83114673f 100644
--- a/gr-trellis/lib/viterbi_combined_XX_impl.h.t
+++ b/gr-trellis/lib/viterbi_combined_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef VITERBI_COMBINED_IMPL_H
+#define VITERBI_COMBINED_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/viterbi_combined.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T,class OUT_T>
+ class viterbi_combined_impl : public viterbi_combined<IN_T,OUT_T>
{
private:
fsm d_FSM;
@@ -38,23 +37,23 @@ namespace gr {
int d_S0;
int d_SK;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_TYPE;
//std::vector<int> d_trace;
public:
- @IMPL_NAME@(const fsm &FSM, int K,
+ viterbi_combined_impl(const fsm &FSM, int K,
int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t TYPE);
- ~@IMPL_NAME@();
+ ~viterbi_combined_impl();
fsm FSM() const { return d_FSM; }
int K() const { return d_K; }
int S0() const { return d_S0; }
int SK() const { return d_SK; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
//std::vector<int> trace() const { return d_trace; }
@@ -63,7 +62,7 @@ namespace gr {
void set_S0(int S0);
void set_SK(int SK);
void set_D(int D);
- void set_TABLE(const std::vector<@I_TYPE@> &table);
+ void set_TABLE(const std::vector<IN_T> &table);
void set_TYPE(digital::trellis_metric_type_t type);
void forecast(int noutput_items,
@@ -78,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_COMBINED_IMPL_H */
diff --git a/gr-trellis/lib/viterbi_X_impl.cc.t b/gr-trellis/lib/viterbi_impl.cc
index d5949f0321..4b5f428d60 100644
--- a/gr-trellis/lib/viterbi_X_impl.cc.t
+++ b/gr-trellis/lib/viterbi_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,71 +20,78 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "viterbi_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int K,
+ template <class T>
+ typename viterbi<T>::sptr
+ viterbi<T>::make(const fsm &FSM, int K,
int S0, int SK)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM, K, S0, SK));
+ (new viterbi_impl<T>(FSM, K, S0, SK));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
+ template <class T>
+ viterbi_impl<T>::viterbi_impl(const fsm &FSM, int K,
int S0, int SK)
- : block("@BASE_NAME@",
+ : block("viterbi",
io_signature::make(1, -1, sizeof(float)),
- io_signature::make(1, -1, sizeof(@TYPE@))),
+ io_signature::make(1, -1, sizeof(T))),
d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK)//,
//d_trace(FSM.S()*K)
{
- set_relative_rate(1.0 / ((double)d_FSM.O()));
- set_output_multiple(d_K);
+ this->set_relative_rate(1.0 / ((double)d_FSM.O()));
+ this->set_output_multiple(d_K);
}
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
+ template <class T>
+ void viterbi_impl<T>::set_FSM(const fsm &FSM)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_FSM = FSM;
- set_relative_rate(1.0 / ((double)d_FSM.O()));
+ this->set_relative_rate(1.0 / ((double)d_FSM.O()));
}
- void @IMPL_NAME@::set_K(int K)
+ template <class T>
+ void viterbi_impl<T>::set_K(int K)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_K = K;
- set_output_multiple(d_K);
+ this->set_output_multiple(d_K);
}
- void @IMPL_NAME@::set_S0(int S0)
+ template <class T>
+ void viterbi_impl<T>::set_S0(int S0)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_S0 = S0;
}
- void @IMPL_NAME@::set_SK(int SK)
+ template <class T>
+ void viterbi_impl<T>::set_SK(int SK)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_SK = SK;
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ viterbi_impl<T>::~viterbi_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ viterbi_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSM.O() * noutput_items;
@@ -94,19 +101,20 @@ namespace gr {
}
}
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ viterbi_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nstreams = input_items.size();
int nblocks = noutput_items / d_K;
for(int m = 0; m < nstreams; m++) {
const float *in = (const float*)input_items[m];
- @TYPE@ *out = (@TYPE@*)output_items[m];
+ T *out = (T*)output_items[m];
for(int n = 0; n < nblocks; n++) {
viterbi_algorithm(d_FSM.I(), d_FSM.S(), d_FSM.O(),
@@ -116,9 +124,12 @@ namespace gr {
}
}
- consume_each(d_FSM.O() * noutput_items);
+ this->consume_each(d_FSM.O() * noutput_items);
return noutput_items;
}
+template class viterbi<std::uint8_t>;
+template class viterbi<std::int16_t>;
+template class viterbi<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/viterbi_X_impl.h.t b/gr-trellis/lib/viterbi_impl.h
index 1479ad5a3f..c9f40a0b79 100644
--- a/gr-trellis/lib/viterbi_X_impl.h.t
+++ b/gr-trellis/lib/viterbi_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VITERBI_IMPL_H
+#define VITERBI_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/viterbi.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class viterbi_impl : public viterbi<T>
{
private:
fsm d_FSM;
@@ -40,9 +40,9 @@ namespace gr {
//std::vector<int> d_trace;
public:
- @IMPL_NAME@(const fsm &FSM, int K,
+ viterbi_impl(const fsm &FSM, int K,
int S0, int SK);
- ~@IMPL_NAME@();
+ ~viterbi_impl();
fsm FSM() const { return d_FSM; }
int K() const { return d_K; }
@@ -66,4 +66,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_IMPL_H */
diff --git a/gr-trellis/swig/CMakeLists.txt b/gr-trellis/swig/CMakeLists.txt
index 14012abad5..1f9b7679df 100644
--- a/gr-trellis/swig/CMakeLists.txt
+++ b/gr-trellis/swig/CMakeLists.txt
@@ -59,7 +59,6 @@ foreach(swigfile ${GR_SWIG_TRELLIS_IFILES})
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/trellis
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
- set(GR_SWIG_TARGET_DEPS trellis_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital)
GR_SWIG_MAKE(${swigfile} ${swigfile}.i)
diff --git a/gr-trellis/swig/trellis_swig0.i b/gr-trellis/swig/trellis_swig0.i
index 9f309c5ca3..596a043db4 100644
--- a/gr-trellis/swig/trellis_swig0.i
+++ b/gr-trellis/swig/trellis_swig0.i
@@ -38,80 +38,44 @@
#include "gnuradio/trellis/permutation.h"
#include "gnuradio/trellis/siso_combined_f.h"
#include "gnuradio/trellis/siso_f.h"
-#include "gnuradio/trellis/encoder_bb.h"
-#include "gnuradio/trellis/encoder_bs.h"
-#include "gnuradio/trellis/encoder_bi.h"
-#include "gnuradio/trellis/encoder_ss.h"
-#include "gnuradio/trellis/encoder_si.h"
-#include "gnuradio/trellis/encoder_ii.h"
-#include "gnuradio/trellis/sccc_encoder_bb.h"
-#include "gnuradio/trellis/sccc_encoder_bs.h"
-#include "gnuradio/trellis/sccc_encoder_bi.h"
-#include "gnuradio/trellis/sccc_encoder_ss.h"
-#include "gnuradio/trellis/sccc_encoder_si.h"
-#include "gnuradio/trellis/sccc_encoder_ii.h"
-#include "gnuradio/trellis/pccc_encoder_bb.h"
-#include "gnuradio/trellis/pccc_encoder_bs.h"
-#include "gnuradio/trellis/pccc_encoder_bi.h"
-#include "gnuradio/trellis/pccc_encoder_ss.h"
-#include "gnuradio/trellis/pccc_encoder_si.h"
-#include "gnuradio/trellis/pccc_encoder_ii.h"
-#include "gnuradio/trellis/metrics_s.h"
-#include "gnuradio/trellis/metrics_i.h"
-#include "gnuradio/trellis/metrics_f.h"
-#include "gnuradio/trellis/metrics_c.h"
+#include "gnuradio/trellis/encoder.h"
+#include "gnuradio/trellis/sccc_encoder.h"
+#include "gnuradio/trellis/pccc_encoder.h"
+#include "gnuradio/trellis/metrics.h"
%}
%include "gnuradio/trellis/constellation_metrics_cf.h"
%include "gnuradio/trellis/permutation.h"
%include "gnuradio/trellis/siso_combined_f.h"
%include "gnuradio/trellis/siso_f.h"
-%include "gnuradio/trellis/encoder_bb.h"
-%include "gnuradio/trellis/encoder_bs.h"
-%include "gnuradio/trellis/encoder_bi.h"
-%include "gnuradio/trellis/encoder_ss.h"
-%include "gnuradio/trellis/encoder_si.h"
-%include "gnuradio/trellis/encoder_ii.h"
-%include "gnuradio/trellis/sccc_encoder_bb.h"
-%include "gnuradio/trellis/sccc_encoder_bs.h"
-%include "gnuradio/trellis/sccc_encoder_bi.h"
-%include "gnuradio/trellis/sccc_encoder_ss.h"
-%include "gnuradio/trellis/sccc_encoder_si.h"
-%include "gnuradio/trellis/sccc_encoder_ii.h"
-%include "gnuradio/trellis/pccc_encoder_bb.h"
-%include "gnuradio/trellis/pccc_encoder_bs.h"
-%include "gnuradio/trellis/pccc_encoder_bi.h"
-%include "gnuradio/trellis/pccc_encoder_ss.h"
-%include "gnuradio/trellis/pccc_encoder_si.h"
-%include "gnuradio/trellis/pccc_encoder_ii.h"
-%include "gnuradio/trellis/metrics_s.h"
-%include "gnuradio/trellis/metrics_i.h"
-%include "gnuradio/trellis/metrics_f.h"
-%include "gnuradio/trellis/metrics_c.h"
+%include "gnuradio/trellis/encoder.h"
+%include "gnuradio/trellis/sccc_encoder.h"
+%include "gnuradio/trellis/pccc_encoder.h"
+%include "gnuradio/trellis/metrics.h"
GR_SWIG_BLOCK_MAGIC2(trellis, constellation_metrics_cf);
GR_SWIG_BLOCK_MAGIC2(trellis, permutation);
GR_SWIG_BLOCK_MAGIC2(trellis, siso_combined_f);
GR_SWIG_BLOCK_MAGIC2(trellis, siso_f);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bb);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bs);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bi);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_ss);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_si);
-GR_SWIG_BLOCK_MAGIC2(trellis, encoder_ii);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bb);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bs);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bi);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_ss);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_si);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_ii);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bb);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bs);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bi);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_ss);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_si);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_ii);
-GR_SWIG_BLOCK_MAGIC2(trellis, metrics_s);
-GR_SWIG_BLOCK_MAGIC2(trellis, metrics_i);
-GR_SWIG_BLOCK_MAGIC2(trellis, metrics_f);
-GR_SWIG_BLOCK_MAGIC2(trellis, metrics_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_bb, encoder<std::uint8_t,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_bs, encoder<std::uint8_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_bi, encoder<std::uint8_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_ss, encoder<std::int16_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_si, encoder<std::int16_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, encoder_ii, encoder<std::int32_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_bb, sccc_encoder<std::uint8_t,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_bs, sccc_encoder<std::uint8_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_bi, sccc_encoder<std::uint8_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_ss, sccc_encoder<std::int16_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_si, sccc_encoder<std::int16_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_encoder_ii, sccc_encoder<std::int32_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_bb, pccc_encoder<std::uint8_t,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_bs, pccc_encoder<std::uint8_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_bi, pccc_encoder<std::uint8_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_ss, pccc_encoder<std::int16_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_si, pccc_encoder<std::int16_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_encoder_ii, pccc_encoder<std::int32_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, metrics_s, metrics<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, metrics_i, metrics<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, metrics_f, metrics<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, metrics_c, metrics<gr_complex>);
diff --git a/gr-trellis/swig/trellis_swig1.i b/gr-trellis/swig/trellis_swig1.i
index 6481aee245..7a8728efd2 100644
--- a/gr-trellis/swig/trellis_swig1.i
+++ b/gr-trellis/swig/trellis_swig1.i
@@ -33,105 +33,52 @@
%include "gnuradio/trellis/interleaver.h"
%{
-#include "gnuradio/trellis/pccc_decoder_b.h"
-#include "gnuradio/trellis/pccc_decoder_s.h"
-#include "gnuradio/trellis/pccc_decoder_i.h"
-#include "gnuradio/trellis/pccc_decoder_combined_fb.h"
-#include "gnuradio/trellis/pccc_decoder_combined_fs.h"
-#include "gnuradio/trellis/pccc_decoder_combined_fi.h"
-#include "gnuradio/trellis/pccc_decoder_combined_cb.h"
-#include "gnuradio/trellis/pccc_decoder_combined_cs.h"
-#include "gnuradio/trellis/pccc_decoder_combined_ci.h"
-#include "gnuradio/trellis/viterbi_b.h"
-#include "gnuradio/trellis/viterbi_s.h"
-#include "gnuradio/trellis/viterbi_i.h"
-#include "gnuradio/trellis/viterbi_combined_sb.h"
-#include "gnuradio/trellis/viterbi_combined_ss.h"
-#include "gnuradio/trellis/viterbi_combined_si.h"
-#include "gnuradio/trellis/viterbi_combined_ib.h"
-#include "gnuradio/trellis/viterbi_combined_is.h"
-#include "gnuradio/trellis/viterbi_combined_ii.h"
-#include "gnuradio/trellis/viterbi_combined_fb.h"
-#include "gnuradio/trellis/viterbi_combined_fs.h"
-#include "gnuradio/trellis/viterbi_combined_fi.h"
-#include "gnuradio/trellis/viterbi_combined_cb.h"
-#include "gnuradio/trellis/viterbi_combined_cs.h"
-#include "gnuradio/trellis/viterbi_combined_ci.h"
-#include "gnuradio/trellis/sccc_decoder_b.h"
-#include "gnuradio/trellis/sccc_decoder_s.h"
-#include "gnuradio/trellis/sccc_decoder_i.h"
-#include "gnuradio/trellis/sccc_decoder_combined_fb.h"
-#include "gnuradio/trellis/sccc_decoder_combined_fs.h"
-#include "gnuradio/trellis/sccc_decoder_combined_fi.h"
-#include "gnuradio/trellis/sccc_decoder_combined_cb.h"
-#include "gnuradio/trellis/sccc_decoder_combined_cs.h"
-#include "gnuradio/trellis/sccc_decoder_combined_ci.h"
+#include "gnuradio/trellis/pccc_decoder_blk.h"
+#include "gnuradio/trellis/pccc_decoder_combined_blk.h"
+#include "gnuradio/trellis/viterbi.h"
+#include "gnuradio/trellis/viterbi_combined.h"
+#include "gnuradio/trellis/sccc_decoder_blk.h"
+#include "gnuradio/trellis/sccc_decoder_combined_blk.h"
%}
-%include "gnuradio/trellis/pccc_decoder_b.h"
-%include "gnuradio/trellis/pccc_decoder_s.h"
-%include "gnuradio/trellis/pccc_decoder_i.h"
-%include "gnuradio/trellis/pccc_decoder_combined_fb.h"
-%include "gnuradio/trellis/pccc_decoder_combined_fs.h"
-%include "gnuradio/trellis/pccc_decoder_combined_fi.h"
-%include "gnuradio/trellis/pccc_decoder_combined_cb.h"
-%include "gnuradio/trellis/pccc_decoder_combined_cs.h"
-%include "gnuradio/trellis/pccc_decoder_combined_ci.h"
-%include "gnuradio/trellis/viterbi_b.h"
-%include "gnuradio/trellis/viterbi_s.h"
-%include "gnuradio/trellis/viterbi_i.h"
-%include "gnuradio/trellis/viterbi_combined_sb.h"
-%include "gnuradio/trellis/viterbi_combined_ss.h"
-%include "gnuradio/trellis/viterbi_combined_si.h"
-%include "gnuradio/trellis/viterbi_combined_ib.h"
-%include "gnuradio/trellis/viterbi_combined_is.h"
-%include "gnuradio/trellis/viterbi_combined_ii.h"
-%include "gnuradio/trellis/viterbi_combined_fb.h"
-%include "gnuradio/trellis/viterbi_combined_fs.h"
-%include "gnuradio/trellis/viterbi_combined_fi.h"
-%include "gnuradio/trellis/viterbi_combined_cb.h"
-%include "gnuradio/trellis/viterbi_combined_cs.h"
-%include "gnuradio/trellis/viterbi_combined_ci.h"
-%include "gnuradio/trellis/sccc_decoder_b.h"
-%include "gnuradio/trellis/sccc_decoder_s.h"
-%include "gnuradio/trellis/sccc_decoder_i.h"
-%include "gnuradio/trellis/sccc_decoder_combined_fb.h"
-%include "gnuradio/trellis/sccc_decoder_combined_fs.h"
-%include "gnuradio/trellis/sccc_decoder_combined_fi.h"
-%include "gnuradio/trellis/sccc_decoder_combined_cb.h"
-%include "gnuradio/trellis/sccc_decoder_combined_cs.h"
-%include "gnuradio/trellis/sccc_decoder_combined_ci.h"
+%include "gnuradio/trellis/pccc_decoder_blk.h"
+%include "gnuradio/trellis/pccc_decoder_combined_blk.h"
+%include "gnuradio/trellis/viterbi.h"
+%include "gnuradio/trellis/viterbi_combined.h"
+%include "gnuradio/trellis/sccc_decoder_blk.h"
+%include "gnuradio/trellis/sccc_decoder_combined_blk.h"
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_b);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_s);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_i);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fb);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fs);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fi);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_cb);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_cs);
-GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_ci);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_b);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_s);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_i);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_sb);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ss);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_si);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ib);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_is);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ii);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fb);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fs);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fi);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_cb);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_cs);
-GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ci);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_b);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_s);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_i);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fb);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fs);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fi);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_cb);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_cs);
-GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_ci);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_b, pccc_decoder_blk<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_s, pccc_decoder_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_i, pccc_decoder_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_b, viterbi<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_s, viterbi<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_i, viterbi<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_sb, viterbi_combined<std::int16_t,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_ss, viterbi_combined<std::int16_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_si, viterbi_combined<std::int16_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_ib, viterbi_combined<std::int32_t,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_is, viterbi_combined<std::int32_t,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_ii, viterbi_combined<std::int32_t,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_fb, viterbi_combined<float,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_fs, viterbi_combined<float,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_fi, viterbi_combined<float,std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_cb, viterbi_combined<gr_complex,std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_cs, viterbi_combined<gr_complex,std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, viterbi_combined_ci, viterbi_combined<gr_complex,std::int32_t>);
+
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_b, sccc_decoder_blk<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_s, sccc_decoder_blk<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_i, sccc_decoder_blk<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_fb, sccc_decoder_combined_blk<float, std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_fs, sccc_decoder_combined_blk<float, std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_fi, sccc_decoder_combined_blk<float, std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_cb, sccc_decoder_combined_blk<gr_complex, std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_cs, sccc_decoder_combined_blk<gr_complex, std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, sccc_decoder_combined_ci, sccc_decoder_combined_blk<gr_complex, std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_fb, pccc_decoder_combined_blk<float, std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_fs, pccc_decoder_combined_blk<float, std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_fi, pccc_decoder_combined_blk<float, std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_cb, pccc_decoder_combined_blk<gr_complex, std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_cs, pccc_decoder_combined_blk<gr_complex, std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(trellis, pccc_decoder_combined_ci, pccc_decoder_combined_blk<gr_complex, std::int32_t>);
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
index cc8e7c17dc..beeeebe72a 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -303,179 +303,3 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread)
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
-
-########################################################################
-# Macros to generate source and header files from template
-########################################################################
-macro(GR_EXPAND_X_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated headers
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the headers
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #install rules for the generated headers
- list(APPEND generated_includes ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_H)
-
-macro(GR_EXPAND_X_CC_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_impl_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the source files
- add_custom_command(
- OUTPUT ${expanded_files_cc}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.cc.t ${ARGN}
- )
-
- #create a command to generate the header files
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #make source files depends on headers to force generation
- set_source_files_properties(${expanded_files_cc}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc})
- list(APPEND generated_headers ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_CC_H)
-
-macro(GR_EXPAND_X_CC_H_IMPL component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, '${component}')
- build_utils.expand_template(d, inp, '_impl')
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc_impl)
- unset(expanded_files_h_impl)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc)
- list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the _impl.cc files
- add_custom_command(
- OUTPUT ${expanded_files_cc_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.cc.t ${ARGN}
- )
-
- #create a command to generate the _impl.h files
- add_custom_command(
- OUTPUT ${expanded_files_h_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.h.t ${ARGN}
- )
-
- #make _impl.cc source files depend on _impl.h to force generation
- set_source_files_properties(${expanded_files_cc_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}"
- )
-
- #make _impl.h source files depend on headers to force generation
- set_source_files_properties(${expanded_files_h_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc_impl})
- list(APPEND generated_headers ${expanded_files_h_impl})
-
-endmacro(GR_EXPAND_X_CC_H_IMPL)
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils.py b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
deleted file mode 100644
index 0b26844cbf..0000000000
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils.py
+++ /dev/null
@@ -1,228 +0,0 @@
-#
-# Copyright 2004,2009,2012 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 3, 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-"""Misc utilities used at build time
-"""
-from __future__ import absolute_import
-from __future__ import unicode_literals
-
-import re, os, os.path
-from .build_utils_codes import *
-
-
-# set srcdir to the directory that contains Makefile.am
-try:
- srcdir = os.environ['srcdir']
-except KeyError as e:
- srcdir = "."
-srcdir = srcdir + '/'
-
-# set do_makefile to either true or false dependeing on the environment
-try:
- if os.environ['do_makefile'] == '0':
- do_makefile = False
- else:
- do_makefile = True
-except KeyError as e:
- do_makefile = False
-
-# set do_sources to either true or false dependeing on the environment
-try:
- if os.environ['do_sources'] == '0':
- do_sources = False
- else:
- do_sources = True
-except KeyError as e:
- do_sources = True
-
-name_dict = {}
-
-def log_output_name (name):
- (base, ext) = os.path.splitext (name)
- ext = ext[1:] # drop the leading '.'
-
- entry = name_dict.setdefault (ext, [])
- entry.append (name)
-
-def open_and_log_name (name, dir):
- global do_sources
- if do_sources:
- f = open (name, dir)
- else:
- f = None
- log_output_name (name)
- return f
-
-def expand_template (d, template_filename, extra = ""):
- '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
- '''
- global do_sources
- output_extension = extract_extension (template_filename)
- template = open_src (template_filename, 'r')
- output_name = d['NAME'] + extra + '.' + output_extension
- log_output_name (output_name)
- if do_sources:
- output = open (output_name, 'w')
- do_substitution (d, template, output)
- output.close ()
- template.close ()
-
-def output_glue (dirname):
- output_makefile_fragment ()
- output_ifile_include (dirname)
-
-def output_makefile_fragment ():
- global do_makefile
- if not do_makefile:
- return
-# overwrite the source, which must be writable; this should have been
-# checked for beforehand in the top-level Makefile.gen.gen .
- f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
- f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
- output_subfrag (f, 'h')
- output_subfrag (f, 'i')
- output_subfrag (f, 'cc')
- f.close ()
-
-def output_ifile_include (dirname):
- global do_sources
- if do_sources:
- f = open ('%s_generated.i' % (dirname,), 'w')
- f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
- files = name_dict.setdefault ('i', [])
- files.sort ()
- f.write ('%{\n')
- for file in files:
- f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
- f.write ('%}\n\n')
- for file in files:
- f.write ('%%include <%s>\n' % (file,))
-
-def output_subfrag (f, ext):
- files = name_dict.setdefault (ext, [])
- files.sort ()
- f.write ("GENERATED_%s =" % (ext.upper ()))
- for file in files:
- f.write (" \\\n\t%s" % (file,))
- f.write ("\n\n")
-
-def extract_extension (template_name):
- # template name is something like: GrFIRfilterXXX.h.t
- # we return everything between the penultimate . and .t
- mo = re.search (r'\.([a-z]+)\.t$', template_name)
- if not mo:
- raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
- return mo.group (1)
-
-def open_src (name, mode):
- global srcdir
- return open (os.path.join (srcdir, name), mode)
-
-def do_substitution (d, in_file, out_file):
- def repl (match_obj):
- key = match_obj.group (1)
- # print key
- return d[key]
-
- inp = in_file.read ()
- out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
- out_file.write (out)
-
-
-
-copyright = '''/* -*- c++ -*- */
-/*
- * Copyright 2003,2004 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 3, 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., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-'''
-
-def is_complex (code3):
- if i_code (code3) == 'c' or o_code (code3) == 'c':
- return '1'
- else:
- return '0'
-
-
-def standard_dict (name, code3, package='gr'):
- d = {}
- d['NAME'] = name
- d['NAME_IMPL'] = name+'_impl'
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
- d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
- d['SPTR_NAME'] = '%s_sptr' % name
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-
-def standard_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['BASE_NAME'] = name
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-def standard_impl_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['IMPL_NAME'] = name
- d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['FIR_TYPE'] = "fir_filter_" + code3
- d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
deleted file mode 100644
index 22a6bdb99b..0000000000
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from __future__ import unicode_literals
-#
-# Copyright 2004 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 3, 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-def i_code (code3):
- return code3[0]
-
-def o_code (code3):
- if len (code3) >= 2:
- return code3[1]
- else:
- return code3[0]
-
-def tap_code (code3):
- if len (code3) >= 3:
- return code3[2]
- else:
- return code3[0]
-
-def i_type (code3):
- return char_to_type[i_code (code3)]
-
-def o_type (code3):
- return char_to_type[o_code (code3)]
-
-def tap_type (code3):
- return char_to_type[tap_code (code3)]
-
-
-char_to_type = {}
-char_to_type['s'] = 'short'
-char_to_type['i'] = 'int'
-char_to_type['f'] = 'float'
-char_to_type['c'] = 'gr_complex'
-char_to_type['b'] = 'unsigned char'
diff --git a/gr-video-sdl/swig/CMakeLists.txt b/gr-video-sdl/swig/CMakeLists.txt
index 0d5974f21c..a39ace4565 100644
--- a/gr-video-sdl/swig/CMakeLists.txt
+++ b/gr-video-sdl/swig/CMakeLists.txt
@@ -36,7 +36,6 @@ if(ENABLE_GR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
# Setup swig docs to depend on includes and pull in from build directory
-set(GR_SWIG_TARGET_DEPS video_sdl_generated_includes)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/video_sdl)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt
index 9f1d41f3bc..aa9fea01c0 100644
--- a/gr-wavelet/lib/CMakeLists.txt
+++ b/gr-wavelet/lib/CMakeLists.txt
@@ -80,7 +80,7 @@ endif()
GR_LIBRARY_FOO(gnuradio-wavelet)
add_dependencies(gnuradio-wavelet
- wavelet_generated_includes wavelet_generated_swigs
+ wavelet_generated_swigs
gnuradio-runtime)
if(ENABLE_STATIC_LIBS)
@@ -97,7 +97,7 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-wavelet_static STATIC ${gr_wavelet_sources})
- add_dependencies(gnuradio-wavelet_static wavelet_generated_includes
+ add_dependencies(gnuradio-wavelet_static
gnuradio-runtime_static)
if(NOT WIN32)
diff --git a/tools/template_convert.py b/tools/template_convert.py
new file mode 100755
index 0000000000..edc81135da
--- /dev/null
+++ b/tools/template_convert.py
@@ -0,0 +1,282 @@
+#!/usr/bin/env python3
+
+import os
+import re
+from argparse import ArgumentParser
+
+template_keywords = [
+ "GR_EXPAND_X_H", "GR_EXPAND_CC_H", "GR_EXPAND_X_CC_H_IMPL", "GR_EXPAND_X_CC_H"
+]
+template_regex = re.compile(
+ "^(?P<template_type>" + "|".join(template_keywords) + ")\(" +
+ "(?P<category>\w+)\s+(?P<name>\w+_XX?X?)(_impl)?\s+(?P<types>[\w\s]+)" + "\)$")
+
+cpp_keywords = ["abs", "add", "and", "max", "min" "not" "xor"]
+types = {"s": "std::int16_t", "i": "std::int32_t", "b": "std::uint8_t", "c": "gr_complex", "f": "float"}
+
+
+def get_real_name(block_definition):
+ """
+ Return the base name of the template blocks (e.g. foo_XXX)
+ """
+ return "_".join(block_definition.get("name").split("_")[:-1])
+
+
+def rewrite_cmakelists(block_definition):
+ """
+ Remove gengen template invokations from CMakeLists.txt
+ """
+ with open(
+ os.path.join(block_definition.get("path"), "CMakeLists.txt"),
+ "r") as f:
+ cmakelists = f.readlines()
+ cmakelists_new = []
+ for line in cmakelists:
+ if line.startswith(
+ block_definition.get("template_type") + "(" + block_definition.
+ get("category") + " " + block_definition.get("name")):
+ continue
+ cmakelists_new.append(line)
+ with open(
+ os.path.join(block_definition.get("path"), "CMakeLists.txt"),
+ "w") as f:
+ f.writelines(cmakelists_new)
+
+
+def convert_public_header(block_definition):
+ """
+ Replace template arguments with the correct C++ template
+ expressions
+ """
+ real_name = get_real_name(block_definition)
+ original_name = real_name
+ cpp_keyword = False
+ if real_name in cpp_keywords:
+ real_name += "_blk"
+ cpp_keyword = True
+ target_file = os.path.join(block_definition.get("path"), real_name + ".h")
+ source_file = os.path.join(
+ block_definition.get("path"),
+ block_definition.get("name") + ".h.t")
+ os.rename(source_file, target_file)
+
+ with open(target_file, "r") as f:
+ content = f.readlines()
+
+ with open(target_file, "w") as f:
+ new_content = []
+ typedefs = False
+ for line in content:
+ line = line.replace("@GUARD_NAME@", "_".join([real_name,
+ "h"]).upper())
+ if "typedef" in line:
+ line = line.replace("@NAME@", " " + real_name + "<T> ")
+ line = line.replace("@BASE_NAME@", " " + real_name + "<T> ")
+ else:
+ line = line.replace("@NAME@", real_name)
+ line = line.replace("@BASE_NAME@", real_name)
+
+ line = line.replace("@I_TYPE@", "T")
+ line = line.replace("@O_TYPE@", "T")
+ line = line.replace("@TYPE@", "T")
+ if "@WARNING@" in line:
+ continue
+ if "class" in line:
+ new_content.append("template<class T>\n")
+ if not typedefs and "} /* namespace" in line:
+ for t in block_definition.get("types"):
+ new_content.append("typedef " + real_name + "<" +
+ types[t[0]] + "> " + original_name + "_" + t + ";\n")
+ typedefs = True
+ new_content.append(line)
+ f.writelines(new_content)
+
+
+def convert_impl_header(block_definition):
+ """
+ Replace template arguments with the correct C++ template
+ expressions
+ """
+ real_name = get_real_name(block_definition)
+ cpp_keyword = False
+ if real_name in cpp_keywords:
+ real_name += "_blk"
+ cpp_keyword = True
+ target_header = os.path.join(
+ block_definition.get("path"), real_name + "_impl.h")
+ source_header = os.path.join(
+ block_definition.get("path"),
+ block_definition.get("name") + "_impl.h.t")
+ os.rename(source_header, target_header)
+ with open(target_header, "r") as f:
+ content = f.readlines()
+
+ with open(target_header, "w") as f:
+ new_content = []
+ for line in content:
+ line = line.replace("@GUARD_NAME_IMPL@",
+ "_".join([real_name, "impl_h"]).upper())
+ line = line.replace("@GUARD_NAME@",
+ "_".join([real_name, "impl_h"]).upper())
+ if "typedef" in line or "class" in line:
+ line = line.replace("@NAME@", " " + real_name + "<T> ")
+ line = line.replace("@BASE_NAME@", " " + real_name + "<T> ")
+ line = line.replace("@NAME_IMPL@", real_name + "_impl<T> ")
+ line = line.replace("@IMPL_NAME@", real_name + "_impl<T> ")
+ else:
+ line = line.replace("@NAME@", real_name)
+ line = line.replace("@BASE_NAME@", real_name)
+ line = line.replace("@NAME_IMPL@", real_name + "_impl ")
+ line = line.replace("@IMPL_NAME@", real_name + "_impl")
+
+ line = line.replace("@I_TYPE@", "T")
+ line = line.replace("@O_TYPE@", "T")
+ line = line.replace("@TYPE@", "T")
+ if "@WARNING@" in line:
+ continue
+ if "class" in line:
+ new_content.append("template<class T>\n")
+ new_content.append(line)
+ f.writelines(new_content)
+
+
+def convert_impl_impl(block_definition):
+ """
+ Replace template arguments with the correct C++ template
+ expressions
+ """
+ real_name = get_real_name(block_definition)
+ cpp_keyword = False
+ if real_name in cpp_keywords:
+ real_name += "_blk"
+ cpp_keyword = True
+
+ target_impl = os.path.join(
+ block_definition.get("path"), real_name + "_impl.cc")
+ source_impl = os.path.join(
+ block_definition.get("path"),
+ block_definition.get("name") + "_impl.cc.t")
+
+ os.rename(source_impl, target_impl)
+ with open(target_impl, "r") as f:
+ content = f.readlines()
+
+ with open(target_impl, "w") as f:
+ new_content = []
+ instantiated = False
+ for line in content:
+ line = line.replace("@GUARD_NAME_IMPL@",
+ "_".join([real_name, "impl_h"]).upper())
+ if "typedef" in line or "class" in line:
+ line = line.replace("@NAME@", " " + real_name + "<T> ")
+ line = line.replace("@BASE_NAME@", " " + real_name + "<T> ")
+ else:
+ line = line.replace("@NAME@", real_name)
+ line = line.replace("@BASE_NAME@", real_name)
+ line = line.replace("@IMPL_NAME@", real_name + "_impl<T>")
+ line = line.replace("@NAME_IMPL@", real_name + "_impl<T> ")
+ line = line.replace("@I_TYPE@", "T")
+ line = line.replace("@O_TYPE@", "T")
+ line = line.replace("@TYPE@", "T")
+ if "@WARNING@" in line:
+ continue
+ if "class" in line:
+ new_content.append("template<class T>\n")
+ if not instantiated and "} /* namespace" in line:
+ for t in block_definition.get("types"):
+ new_content.append("template class " + real_name + "<" +
+ types[t[0]] + ">;\n")
+ instantiated = True
+ new_content.append(line)
+ f.writelines(new_content)
+
+
+def convert_impl(block_definition):
+ """
+ Convert the impl header and implementation
+ """
+ convert_impl_header(block_definition)
+ convert_impl_impl(block_definition)
+
+
+def handle_template_conversion(block_definition):
+ """
+ Convert gengen templates to C++ templates for simple cases
+ which only have one type for input and output
+ """
+ if block_definition.get("single_type", None) == True:
+ if block_definition.get("template_type") == "GR_EXPAND_X_H":
+ convert_public_header(block_definition)
+ elif block_definition.get(
+ "template_type"
+ ) == "GR_EXPAND_X_CC_H_IMPL" or block_definition.get(
+ "template_type") == "GR_EXPAND_X_CC_H":
+ convert_impl(block_definition)
+ rewrite_cmakelists(block_definition)
+
+
+def find_template_blocks(cmake_file):
+ """
+ Match every line in a CMakeLists.txt file with a template regex
+ """
+ blocks = []
+ with open(cmake_file, "r") as f:
+ for line in f:
+ result = re.match(template_regex, line)
+ if result is not None:
+ r = result.groupdict()
+ r["types"] = r.get("types", "").split(" ")
+ if all([(t[1:] == t[:-1] or len(t) == 1) for t in r["types"]]):
+ r["single_type"] = True
+ else:
+ r["single_type"] = False
+ blocks.append(r)
+ return blocks
+
+
+def walk_and_find(root):
+ """
+ Identify templated blocks by looking in the CMakeLists
+ """
+ all_blocks = []
+ for (dirpath, dirnames, filenames) in os.walk(root):
+ if "CMakeLists.txt" in filenames:
+ blocks = find_template_blocks(
+ os.path.join(dirpath, "CMakeLists.txt"))
+ all_blocks.extend([{**block, "path": dirpath} for block in blocks])
+ return all_blocks
+
+
+def parse_args():
+ parser = ArgumentParser()
+ parser.add_argument(
+ '--directory_root',
+ "-d",
+ help="Root directory to start search",
+ default=os.environ.get("PWD"))
+ parser.add_argument(
+ "--no_changes",
+ "-n",
+ dest="no_changes",
+ default=False,
+ action="store_true",
+ help="Only show found templated blocks, don't apply changes")
+ return parser.parse_args()
+
+
+def main():
+ """
+ Run this if the program was invoked on the commandline
+ """
+ args = parse_args()
+ all_blocks = walk_and_find(args.directory_root)
+ for block in all_blocks:
+ if not args.no_changes:
+ handle_template_conversion(block)
+ else:
+ print(block)
+ return True
+
+
+if __name__ == "__main__":
+ exit(not (main()))