diff options
Diffstat (limited to 'gnuradio-core/src')
105 files changed, 56 insertions, 6815 deletions
diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc index 31914412bc..a24adfd9e7 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -94,10 +94,10 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> - <value>gr_vector_source_x_0</value> + <value>blocks_vector_source_x_0</value> </param> <param> <key>_enabled</key> @@ -659,10 +659,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -795,7 +795,7 @@ </connection> <connection> <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -824,7 +824,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_vector_source_x_0</source_block_id> + <source_block_id>blocks_vector_source_x_0</source_block_id> <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 5b0bfeb793..da63b4f5b3 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -226,10 +226,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -637,7 +637,7 @@ </connection> <connection> <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py index 8b032acd83..eee88cd34e 100755 --- a/gnuradio-core/src/examples/mp-sched/affinity_set.py +++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py @@ -7,6 +7,7 @@ from gnuradio import eng_notation from gnuradio import gr from gnuradio import blocks +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser @@ -27,21 +28,21 @@ class affinity_set(gr.top_block): ################################################## vec_len = 1 self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) - self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len) - self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len) - self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) - self.gr_filt_1 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) + self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*vec_len) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*vec_len) + self.filter_filt_0 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) + self.filter_filt_1 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) - self.gr_filt_0.set_processor_affinity([0,]) - self.gr_filt_1.set_processor_affinity([0,1]) + self.filter_filt_0.set_processor_affinity([0,]) + self.filter_filt_1.set_processor_affinity([0,1]) ################################################## # Connections ################################################## - self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0)) - self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0)) - self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0)) + self.connect((self.filter_filt_0, 0), (self.gr_filt_1, 0)) + self.connect((self.filter_filt_1, 0), (self.blocks_null_sink_0, 0)) # QT sink close method reimplementation diff --git a/gnuradio-core/src/examples/mp-sched/synthetic.py b/gnuradio-core/src/examples/mp-sched/synthetic.py index 5ce1b5eb89..4b509af228 100755 --- a/gnuradio-core/src/examples/mp-sched/synthetic.py +++ b/gnuradio-core/src/examples/mp-sched/synthetic.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,6 +20,7 @@ # from gnuradio import gr, gru, eng_notation, blks2 +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import os @@ -29,7 +30,7 @@ class pipeline(gr.hier_block2): def __init__(self, nstages, ntaps=256): """ Create a pipeline of nstages of gr.fir_filter_fff's connected in serial - terminating in a gr.null_sink. + terminating in a blocks.null_sink. """ gr.hier_block2.__init__(self, "pipeline", gr.io_signature(1, 1, gr.sizeof_float), @@ -41,7 +42,7 @@ class pipeline(gr.hier_block2): self.connect(upstream, op) upstream = op - self.connect(upstream, gr.null_sink(gr.sizeof_float)) + self.connect(upstream, blocks.null_sink(gr.sizeof_float)) class top(gr.top_block): @@ -75,8 +76,8 @@ class top(gr.top_block): # Something vaguely like floating point ops self.flop = 2 * ntaps * options.npipelines * options.nstages * options.nsamples - src = gr.null_source(gr.sizeof_float) - head = gr.head(gr.sizeof_float, int(options.nsamples)) + src = blocks.null_source(gr.sizeof_float) + head = blocks.head(gr.sizeof_float, int(options.nsamples)) self.connect(src, head) for n in range(options.npipelines): diff --git a/gnuradio-core/src/examples/network/vector_source.py b/gnuradio-core/src/examples/network/vector_source.py index b960a6d96a..568425fd50 100755 --- a/gnuradio-core/src/examples/network/vector_source.py +++ b/gnuradio-core/src/examples/network/vector_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2010 Free Software Foundation, Inc. +# Copyright 2006,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,7 +29,7 @@ class vector_source(gr.top_block): def __init__(self, host, port, pkt_size, eof): gr.top_block.__init__(self, "vector_source") data = [i*0.01 for i in range(1000)] - vec = gr.vector_source_f(data, True) + vec = blocks.vector_source_f(data, True) udp = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(vec, udp) diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py index 0ce25fcc6a..0f2c84100a 100644 --- a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import blocks import math, sys, os, time try: @@ -119,13 +120,13 @@ class helper(gr.top_block): self.op = op self.srcs = [] self.snks = [] - self.head = gr.head(isizeof, N) + self.head = blocks.head(isizeof, N) for n in xrange(nsrcs): - self.srcs.append(gr.null_source(isizeof)) + self.srcs.append(blocks.null_source(isizeof)) for n in xrange(nsnks): - self.snks.append(gr.null_sink(osizeof)) + self.snks.append(blocks.null_sink(osizeof)) self.connect(self.srcs[0], self.head, (self.op,0)) diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 72b9f9bdeb..cb3dd18273 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -29,7 +29,6 @@ GR_INCLUDE_SUBDIRECTORY(missing) GR_INCLUDE_SUBDIRECTORY(runtime) GR_INCLUDE_SUBDIRECTORY(filter) GR_INCLUDE_SUBDIRECTORY(general) -GR_INCLUDE_SUBDIRECTORY(gengen) GR_INCLUDE_SUBDIRECTORY(io) list(APPEND gnuradio_core_sources bug_work_around_6.cc) diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt index a185b06bd5..5c7250c1ea 100644 --- a/gnuradio-core/src/lib/filter/CMakeLists.txt +++ b/gnuradio-core/src/lib/filter/CMakeLists.txt @@ -32,7 +32,6 @@ list(APPEND gnuradio_core_sources # Install runtime headers ######################################################################## install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" diff --git a/gnuradio-core/src/lib/filter/gr_rotator.h b/gnuradio-core/src/lib/filter/gr_rotator.h deleted file mode 100644 index 77946dd397..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rotator.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2008 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 _GR_ROTATOR_H_ -#define _GR_ROTATOR_H_ - -#include <gr_core_api.h> -#include <gr_complex.h> - -class /*GR_CORE_API*/ gr_rotator { - gr_complex d_phase; - gr_complex d_phase_incr; - unsigned int d_counter; - - public: - gr_rotator () : d_phase (1), d_phase_incr (1), d_counter(0) { } - - void set_phase (gr_complex phase) { d_phase = phase / abs(phase); } - void set_phase_incr (gr_complex incr) { d_phase_incr = incr / abs(incr); } - - gr_complex rotate (gr_complex in){ - d_counter++; - - gr_complex z = in * d_phase; // rotate in by phase - d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) - - if ((d_counter % 512) == 0) - d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation - - return z; - } - -}; - -#endif /* _GR_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_rotator.cc b/gnuradio-core/src/lib/filter/qa_rotator.cc deleted file mode 100644 index b722f32c43..0000000000 --- a/gnuradio-core/src/lib/filter/qa_rotator.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_rotator.h> -#include <analog/rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - -namespace gr { - namespace analog { - - // error vector magnitude - __GR_ATTR_UNUSED static float - error_vector_mag(gr_complex a, gr_complex b) - { - return abs(a-b); - } - - void - qa_rotator::t1() - { - static const unsigned int N = 100000; - - rotator r; - - double phase_incr = 2*M_PI / 1003; - double phase = 0; - - // Old code: We increment then return the rotated value, thus we - // need to start one tick back - // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); - - r.set_phase(gr_complex(1,0)); - r.set_phase_incr(gr_expj(phase_incr)); - - for(unsigned i = 0; i < N; i++) { - gr_complex expected = gr_expj(phase); - gr_complex actual = r.rotate(gr_complex(1, 0)); - -#if 0 - float evm = error_vector_mag(expected, actual); - printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", - i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); -#endif - - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); - - phase += phase_incr; - if(phase >= 2*M_PI) - phase -= 2*M_PI; - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gnuradio-core/src/lib/filter/qa_rotator.h b/gnuradio-core/src/lib/filter/qa_rotator.h deleted file mode 100644 index a22e41ec26..0000000000 --- a/gnuradio-core/src/lib/filter/qa_rotator.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 _QA_ANALOG_ROTATOR_H_ -#define _QA_ANALOG_ROTATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -namespace gr { - namespace analog { - - class qa_rotator : public CppUnit::TestCase - { - CPPUNIT_TEST_SUITE(qa_rotator); - CPPUNIT_TEST(t1); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* _QA_ANALOG_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index e3dc18520b..d1cf08103e 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -73,6 +73,7 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_core_api.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_math.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.h @@ -109,25 +110,13 @@ set(gr_core_general_triple_threats gr_block_gateway gr_check_counting_s gr_check_lfsr_32k_s - gr_copy - gr_endian_swap gr_fake_channel_coder_pp gr_feval - gr_head gr_iqcomp_cc - gr_kludge_copy gr_lfsr_32k_source_s - gr_nop - gr_null_sink - gr_null_source gr_pa_2x2_phase_combiner gr_prefs - gr_skiphead gr_test - gr_vector_map - gr_annotator_alltoall - gr_annotator_1to1 - gr_annotator_raw ) if(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index bcf4392bb4..b8b803de98 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -22,60 +22,35 @@ %{ -#include <gr_nop.h> -#include <gr_null_sink.h> -#include <gr_null_source.h> -#include <gr_head.h> -#include <gr_skiphead.h> #include <gr_check_counting_s.h> #include <gr_lfsr_32k_source_s.h> #include <gr_check_lfsr_32k_s.h> #include <gr_align_on_samplenumbers_ss.h> -//#include <gr_endianness.h> -#include <gr_endian_swap.h> #include <gr_fake_channel_coder_pp.h> #include <gr_pa_2x2_phase_combiner.h> -#include <gr_kludge_copy.h> #include <gr_prefs.h> #include <gr_constants.h> #include <gr_test_types.h> #include <gr_test.h> #include <gr_feval.h> -#include <gr_copy.h> #include <complex_vec_test.h> -#include <gr_annotator_alltoall.h> -#include <gr_annotator_1to1.h> -#include <gr_annotator_raw.h> -#include <gr_vector_map.h> +#include <gr_endianness.h> %} -%include "gr_nop.i" -%include "gr_null_sink.i" -%include "gr_null_source.i" -%include "gr_head.i" -%include "gr_skiphead.i" %include "gr_check_counting_s.i" %include "gr_lfsr_32k_source_s.i" %include "gr_check_lfsr_32k_s.i" %include "gr_align_on_samplenumbers_ss.i" -//%include "gr_endianness.i" -%include "gr_endian_swap.i" %include "gr_fake_channel_coder_pp.i" %include "gr_pa_2x2_phase_combiner.i" -%include "gr_kludge_copy.i" %include "gr_prefs.i" %include "gr_constants.i" %include "gr_test_types.h" %include "gr_test.i" %include "gr_feval.i" -%include "gr_copy.i" %include "complex_vec_test.i" -%include "gr_annotator_alltoall.i" -%include "gr_annotator_1to1.i" -%include "gr_annotator_raw.i" -%include "gr_vector_map.i" %include "gr_block_gateway.i" - +%include "gr_endianness.h" #ifdef GR_CTRLPORT diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i deleted file mode 100644 index c3f67e0d47..0000000000 --- a/gnuradio-core/src/lib/general/general_generated.i +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file is machine generated. All edits will be overwritten -// -%{ -#include <gr_vector_sink_b.h> -#include <gr_vector_sink_c.h> -#include <gr_vector_sink_f.h> -#include <gr_vector_sink_i.h> -#include <gr_vector_sink_s.h> -#include <gr_vector_source_b.h> -#include <gr_vector_source_c.h> -#include <gr_vector_source_f.h> -#include <gr_vector_source_i.h> -#include <gr_vector_source_s.h> -%} - -%include <gr_vector_sink_b.i> -%include <gr_vector_sink_c.i> -%include <gr_vector_sink_f.i> -%include <gr_vector_sink_i.i> -%include <gr_vector_sink_s.i> -%include <gr_vector_source_b.i> -%include <gr_vector_source_c.i> -%include <gr_vector_source_f.i> -%include <gr_vector_source_i.i> -%include <gr_vector_source_s.i> diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc deleted file mode 100644 index 1178bdc34f..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 <gr_annotator_1to1.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> - -gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_annotator_1to1 - (when, sizeof_stream_item)); -} - -gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item) - : gr_sync_block ("annotator_1to1", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_when((uint64_t)when) -{ - set_tag_propagation_policy(TPP_ONE_TO_ONE); - - d_tag_counter = 0; - set_relative_rate(1.0); -} - -gr_annotator_1to1::~gr_annotator_1to1 () -{ -} - -int -gr_annotator_1to1::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]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = 0; - int ninputs = input_items.size(); - for(int i = 0; i < ninputs; i++) { - abs_N = nitems_read(i); - - std::vector<gr_tag_t> all_tags; - get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); - - std::vector<gr_tag_t>::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } - } - - // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); - pmt::pmt_t key = pmt::string_to_symbol("seq"); - - // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of d_when - abs_N = nitems_read(0); - int noutputs = output_items.size(); - for(int j = 0; j < noutput_items; j++) { - // the min() is a hack to make sure this doesn't segfault if there are a - // different number of ins and outs. This is specifically designed to test - // the 1-to-1 propagation policy. - for(int i = 0; i < std::min(noutputs, ninputs); i++) { - if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); - add_item_tag(i, abs_N, key, value, srcid); - } - - in = (const float*)input_items[i]; - out = (float*)output_items[i]; - out[j] = in[j]; - } - abs_N++; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h deleted file mode 100644 index 57e5720141..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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_ANNOTATOR_1TO1_H -#define INCLUDED_GR_ANNOTATOR_1TO1_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_annotator_1to1; -typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr; - -// public constructor -GR_CORE_API gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); - -/*! - * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. - * - * This block creates tags to be sent downstream every 10,000 items it sees. The - * tags contain the name and ID of the instantiated block, use "seq" as a key, - * and have a counter that increments by 1 for every tag produced that is used - * as the tag's value. The tags are propagated using the 1-to-1 policy. - * - * It also stores a copy of all tags it sees flow past it. These tags can be - * recalled externally with the data() member. - * - * This block is only meant for testing and showing how to use the tags. - */ -class GR_CORE_API gr_annotator_1to1 : public gr_sync_block -{ - public: - ~gr_annotator_1to1 (); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - std::vector<gr_tag_t> data() const - { - return d_stored_tags; - } - -protected: - gr_annotator_1to1 (int when, size_t sizeof_stream_item); - - private: - size_t d_itemsize; - uint64_t d_when; - uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; - - friend GR_CORE_API gr_annotator_1to1_sptr - gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i deleted file mode 100644 index 2637b8d277..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); - -%include <gr_annotator_1to1.h> diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc deleted file mode 100644 index d8b7e2db7e..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 <gr_annotator_alltoall.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> - -gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_annotator_alltoall - (when, sizeof_stream_item)); -} - -gr_annotator_alltoall::gr_annotator_alltoall (int when, - size_t sizeof_stream_item) - : gr_sync_block ("annotator_alltoall", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_when((uint64_t)when) -{ - set_tag_propagation_policy(TPP_ALL_TO_ALL); - - d_tag_counter = 0; -} - -gr_annotator_alltoall::~gr_annotator_alltoall () -{ -} - -int -gr_annotator_alltoall::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]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = 0, end_N; - int ninputs = input_items.size(); - for(int i = 0; i < ninputs; i++) { - abs_N = nitems_read(i); - end_N = abs_N + (uint64_t)(noutput_items); - - std::vector<gr_tag_t> all_tags; - get_tags_in_range(all_tags, i, abs_N, end_N); - - std::vector<gr_tag_t>::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } - } - - // Source ID and key for any tag that might get applied from this block - pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); - pmt::pmt_t key = pmt::string_to_symbol("seq"); - - // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of d_when - abs_N = nitems_written(0); - int noutputs = output_items.size(); - - for(int j = 0; j < noutput_items; j++) { - for(int i = 0; i < noutputs; i++) { - if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); - add_item_tag(i, abs_N, key, value, srcid); - } - - // Sum all of the inputs together for each output. Just 'cause. - out = (float*)output_items[i]; - out[j] = 0; - for(int ins = 0; ins < ninputs; ins++) { - in = (const float*)input_items[ins]; - out[j] += in[j]; - } - } - abs_N++; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h deleted file mode 100644 index deb5874a49..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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_ANNOTATOR_ALLTOALL_H -#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_annotator_alltoall; -typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr; - -// public constructor -GR_CORE_API gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); - -/*! - * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. - * - * This block creates tags to be sent downstream every 10,000 items it sees. The - * tags contain the name and ID of the instantiated block, use "seq" as a key, - * and have a counter that increments by 1 for every tag produced that is used - * as the tag's value. The tags are propagated using the all-to-all policy. - * - * It also stores a copy of all tags it sees flow past it. These tags can be - * recalled externally with the data() member. - * - * This block is only meant for testing and showing how to use the tags. - */ -class GR_CORE_API gr_annotator_alltoall : public gr_sync_block -{ - public: - ~gr_annotator_alltoall (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - std::vector<gr_tag_t> data() const - { - return d_stored_tags; - } - -protected: - gr_annotator_alltoall (int when, size_t sizeof_stream_item); - - private: - size_t d_itemsize; - uint64_t d_when; - uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; - - friend GR_CORE_API gr_annotator_alltoall_sptr - gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i deleted file mode 100644 index 35190a3d1b..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); - -%include <gr_annotator_alltoall.h> diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.cc b/gnuradio-core/src/lib/general/gr_annotator_raw.cc deleted file mode 100644 index c3aecdd938..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 <gr_annotator_raw.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> -#include <stdexcept> - -using namespace pmt; - -gr_annotator_raw_sptr -gr_make_annotator_raw(size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr(new gr_annotator_raw - (sizeof_stream_item)); -} - -gr_annotator_raw::gr_annotator_raw(size_t sizeof_stream_item) - : gr_sync_block("annotator_raw", - gr_make_io_signature(1, 1, sizeof_stream_item), - gr_make_io_signature(1, 1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item) -{ - set_tag_propagation_policy(TPP_ONE_TO_ONE); - set_relative_rate(1.0); -} - -void gr_annotator_raw::add_tag(uint64_t offset, pmt_t key, pmt_t val) -{ - gruel::scoped_lock l(d_mutex); - - gr_tag_t tag; - tag.srcid = pmt::intern(name()); - tag.key = key; - tag.value = val; - tag.offset = offset; - - // add our new tag - d_queued_tags.push_back(tag); - // make sure our tags are in offset order - std::sort(d_queued_tags.begin(), d_queued_tags.end(), - gr_tag_t::offset_compare); - // make sure we are not adding an item in the past! - if(tag.offset > nitems_read(0)) { - throw std::runtime_error("gr_annotator_raw::add_tag: item added too far in the past\n."); - } -} - -gr_annotator_raw::~gr_annotator_raw() -{ -} - -int -gr_annotator_raw::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock l(d_mutex); - - const char *in = (const char*)input_items[0]; - char *out = (char*)output_items[0]; - - uint64_t start_N = nitems_read(0); - uint64_t end_N = start_N + (uint64_t)(noutput_items); - - // locate queued tags that fall in this range and insert them when appropriate - std::vector<gr_tag_t>::iterator i = d_queued_tags.begin(); - while( i != d_queued_tags.end() ) { - if( (*i).offset >= start_N && (*i).offset < end_N) { - add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid); - i = d_queued_tags.erase(i); - } - else { - break; - } - } - - // copy data across - memcpy(out, in, noutput_items*d_itemsize); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.h b/gnuradio-core/src/lib/general/gr_annotator_raw.h deleted file mode 100644 index 02d0619081..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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_ANNOTATOR_RAW_H -#define INCLUDED_GR_ANNOTATOR_RAW_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_tags.h> -#include <gruel/thread.h> - -class gr_annotator_raw; -typedef boost::shared_ptr<gr_annotator_raw> gr_annotator_raw_sptr; - -// public constructor -GR_CORE_API gr_annotator_raw_sptr -gr_make_annotator_raw(size_t sizeof_stream_item); - -/*! - * \brief raw stream annotator testing block. - * - * This block creates arbitrary tags to be sent downstream - * blocks to be sent are set manually via accessor methods and are sent only once. - * - * This block is intended for testing of tag related blocks - */ -class GR_CORE_API gr_annotator_raw : public gr_sync_block -{ - public: - ~gr_annotator_raw(); - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // insert a tag to be added - void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val); - -protected: - gr_annotator_raw(size_t sizeof_stream_item); - - private: - size_t d_itemsize; - std::vector<gr_tag_t> d_queued_tags; - gruel::mutex d_mutex; - - friend GR_CORE_API gr_annotator_raw_sptr - gr_make_annotator_raw(size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.i b/gnuradio-core/src/lib/general/gr_annotator_raw.i deleted file mode 100644 index 4a58fe7c79..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.i +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_raw); - -%include <gr_tags.i> -%include <gr_annotator_raw.h> diff --git a/gnuradio-core/src/lib/general/gr_copy.cc b/gnuradio-core/src/lib/general/gr_copy.cc deleted file mode 100644 index 0a6f721f94..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_copy.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_copy_sptr -gr_make_copy(size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_copy(itemsize)); -} - -gr_copy::gr_copy(size_t itemsize) - : gr_block ("copy", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize(itemsize), - d_enabled(true) -{ -} - -bool -gr_copy::check_topology(int ninputs, int noutputs) -{ - return ninputs == noutputs; -} - -int -gr_copy::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const uint8_t *in = (const uint8_t *) input_items[0]; - uint8_t *out = (uint8_t *) output_items[0]; - - int n = std::min<int>(ninput_items[0], noutput_items); - int j = 0; - - if (d_enabled) { - memcpy(out, in, n*d_itemsize); - j = n; - } - - consume_each(n); - return j; -} diff --git a/gnuradio-core/src/lib/general/gr_copy.h b/gnuradio-core/src/lib/general/gr_copy.h deleted file mode 100644 index b0769fa2b1..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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_GR_COPY_H -#define INCLUDED_GR_COPY_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_copy; -typedef boost::shared_ptr<gr_copy> gr_copy_sptr; - -GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); - -/*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - * When enabled (default), this block copies its input to its output. - * When disabled, this block drops its input on the floor. - * - */ -class GR_CORE_API gr_copy : public gr_block -{ - size_t d_itemsize; - bool d_enabled; - - friend GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); - gr_copy(size_t itemsize); - - public: - - bool check_topology(int ninputs, int noutputs); - - void set_enabled(bool enable) { d_enabled = enable; } - bool enabled() const { return d_enabled;} - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_copy.i b/gnuradio-core/src/lib/general/gr_copy.i deleted file mode 100644 index 12ddce6aaf..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,copy) - -gr_copy_sptr gr_make_copy(size_t itemsize); - -class gr_copy : public gr_block -{ - private: - gr_copy(size_t itemsize); - -public: - - void set_enabled(bool enabled); - bool enabled(); -}; diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.cc b/gnuradio-core/src/lib/general/gr_endian_swap.cc deleted file mode 100644 index 8bea0ca30d..0000000000 --- a/gnuradio-core/src/lib/general/gr_endian_swap.cc +++ /dev/null @@ -1,101 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_endian_swap.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_endian_swap_sptr -gr_make_endian_swap (size_t item_size_bytes) -{ - return gnuradio::get_initial_sptr(new gr_endian_swap (item_size_bytes)); -} - -gr_endian_swap::gr_endian_swap (size_t item_size_bytes) - : gr_sync_block ("gr_endian_swap", - gr_make_io_signature (1, 1, item_size_bytes), - gr_make_io_signature (1, 1, item_size_bytes)) -{ - const int alignment_multiple = volk_get_alignment(); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_endian_swap::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - int nbytes( output_signature()->sizeof_stream_item(0) ); - if(is_unaligned()) { - switch(nbytes){ - case 1: - memcpy(out,in,noutput_items); - break; - case 2: - memcpy(out,in,2*noutput_items); - volk_16u_byteswap_u((uint16_t*)out,noutput_items); - break; - case 4: - memcpy(out,in,4*noutput_items); - volk_32u_byteswap_u((uint32_t*)out,noutput_items); - break; - case 8: - memcpy(out,in,8*noutput_items); - volk_64u_byteswap_u((uint64_t*)out,noutput_items); - break; - default: - throw std::runtime_error("itemsize is not valid for gr_endian_swap!"); - } - } else { - switch(nbytes){ - case 1: - memcpy(out,in,noutput_items); - break; - case 2: - memcpy(out,in,2*noutput_items); - volk_16u_byteswap_a((uint16_t*)out,noutput_items); - break; - case 4: - memcpy(out,in,4*noutput_items); - volk_32u_byteswap_a((uint32_t*)out,noutput_items); - break; - case 8: - memcpy(out,in,8*noutput_items); - volk_64u_byteswap_a((uint64_t*)out,noutput_items); - break; - default: - throw std::runtime_error("itemsize is not valid for gr_endian_swap!"); - } - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.h b/gnuradio-core/src/lib/general/gr_endian_swap.h deleted file mode 100644 index 0baa3f3389..0000000000 --- a/gnuradio-core/src/lib/general/gr_endian_swap.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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_ENDIAN_SWAP_H -#define INCLUDED_GR_ENDIAN_SWAP_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_endian_swap; -typedef boost::shared_ptr<gr_endian_swap> gr_endian_swap_sptr; - -GR_CORE_API gr_endian_swap_sptr -gr_make_endian_swap (size_t item_size_bytes=1); - -/*! - * \brief Convert stream of items into thier byte swapped version - * - * \param item_size_bytes number of bytes per item, 1=no-op,2=uint16_t,4=uint32_t,8=uint64_t - */ - -class GR_CORE_API gr_endian_swap : public gr_sync_block -{ - private: - friend GR_CORE_API gr_endian_swap_sptr - gr_make_endian_swap (size_t item_size_bytes); - gr_endian_swap (size_t item_size_bytes); - - size_t item_size_bytes; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_ENDIAN_SWAP_H */ diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.i b/gnuradio-core/src/lib/general/gr_endian_swap.i deleted file mode 100644 index 6058b9de77..0000000000 --- a/gnuradio-core/src/lib/general/gr_endian_swap.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,endian_swap) - -gr_endian_swap_sptr -gr_make_endian_swap (size_t bytes_per_item=1); - -class gr_endian_swap : public gr_sync_block -{ -public: -}; diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.h b/gnuradio-core/src/lib/general/gr_endianness.h index c4ecb1383e..c4ecb1383e 100644 --- a/gnuradio-core/src/lib/gengen/gr_endianness.h +++ b/gnuradio-core/src/lib/general/gr_endianness.h diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc deleted file mode 100644 index 1726888113..0000000000 --- a/gnuradio-core/src/lib/general/gr_head.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_head.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> - -gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems) - : gr_sync_block ("head", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (1, 1, sizeof_stream_item)), - d_nitems (nitems), d_ncopied_items (0) -{ -} - -gr_head_sptr -gr_make_head (size_t sizeof_stream_item, unsigned long long nitems) -{ - return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems)); -} - -int -gr_head::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - if (d_ncopied_items >= d_nitems) - return -1; // Done! - - unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items); - - if (n == 0) - return 0; - - memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0)); - d_ncopied_items += n; - - return n; -} diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h deleted file mode 100644 index 48415892dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_head.h +++ /dev/null @@ -1,61 +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_GR_HEAD_H -#define INCLUDED_GR_HEAD_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <stddef.h> // size_t - -class gr_head; -typedef boost::shared_ptr<gr_head> gr_head_sptr; - -/*! - * \brief copies the first N items to the output then signals done - * \ingroup slicedice_blk - * - * Useful for building test cases - */ - -class GR_CORE_API gr_head : public gr_sync_block -{ - friend GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); - gr_head (size_t sizeof_stream_item, unsigned long long nitems); - - unsigned long long d_nitems; - unsigned long long d_ncopied_items; - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { d_ncopied_items = 0; } - void set_length(int nitems) { d_nitems = nitems; } -}; - -GR_CORE_API gr_head_sptr -gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); - - -#endif /* INCLUDED_GR_HEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_head.i b/gnuradio-core/src/lib/general/gr_head.i deleted file mode 100644 index 11f3331d47..0000000000 --- a/gnuradio-core/src/lib/general/gr_head.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,head); - -gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems); - -class gr_head : public gr_block { - gr_head(); -public: - void reset(); - void set_length(int nitems); -}; - diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.cc b/gnuradio-core/src/lib/general/gr_kludge_copy.cc deleted file mode 100644 index f6a8d8af68..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 <gr_kludge_copy.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_kludge_copy_sptr -gr_make_kludge_copy(size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_kludge_copy(itemsize)); -} - -gr_kludge_copy::gr_kludge_copy(size_t itemsize) - : gr_sync_block ("kludge_copy", - gr_make_io_signature (1, -1, itemsize), - gr_make_io_signature (1, -1, itemsize)), - d_itemsize(itemsize) -{ -} - -bool -gr_kludge_copy::check_topology(int ninputs, int noutputs) -{ - return ninputs == noutputs; -} - -int -gr_kludge_copy::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 ninputs = input_items.size(); - for (int i = 0; i < ninputs; i++){ - memcpy(out[i], in[i], noutput_items * d_itemsize); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.h b/gnuradio-core/src/lib/general/gr_kludge_copy.h deleted file mode 100644 index 0bcf144699..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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_KLUDGE_COPY_H -#define INCLUDED_GR_KLUDGE_COPY_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_kludge_copy; -typedef boost::shared_ptr<gr_kludge_copy> gr_kludge_copy_sptr; - -GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - -/*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - * This is a short term kludge to work around a problem with the hierarchical block impl. - */ -class GR_CORE_API gr_kludge_copy : public gr_sync_block -{ - size_t d_itemsize; - - friend GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - gr_kludge_copy(size_t itemsize); - - public: - - bool check_topology(int ninputs, int noutputs); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.i b/gnuradio-core/src/lib/general/gr_kludge_copy.i deleted file mode 100644 index 7ff2b57365..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,kludge_copy) - -gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - -class gr_kludge_copy : public gr_sync_block -{ - private: - gr_kludge_copy(size_t itemsize); -}; diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc deleted file mode 100644 index 164f3ba8dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_nop.h> -#include <gr_io_signature.h> -#include <boost/bind.hpp> - -#ifdef GR_CTRLPORT -#include <rpcregisterhelpers.h> -#endif - -gr_nop_sptr -gr_make_nop (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item)); -} - -gr_nop::gr_nop (size_t sizeof_stream_item) - : gr_block ("nop", - gr_make_io_signature (0, -1, sizeof_stream_item), - gr_make_io_signature (0, -1, sizeof_stream_item)), - d_nmsgs_recvd(0), d_ctrlport_test(0) -{ - // Arrange to have count_received_msgs called when messages are received. - message_port_register_in(pmt::mp("port")); - set_msg_handler(pmt::mp("port"), boost::bind(&gr_nop::count_received_msgs, this, _1)); -} - -// Trivial message handler that just counts them. -// (N.B., This feature is used in qa_set_msg_handler) -void -gr_nop::count_received_msgs(pmt::pmt_t msg) -{ - d_nmsgs_recvd++; -} - -int -gr_nop::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // eat any input that's available - for (unsigned i = 0; i < ninput_items.size (); i++) - consume (i, ninput_items[i]); - - return noutput_items; -} - -void -gr_nop::setup_rpc() -{ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_nop, int>( - alias(), "test", - &gr_nop::ctrlport_test, - pmt::mp(-256), pmt::mp(255), pmt::mp(0), - "", "Simple testing variable", - RPC_PRIVLVL_MIN, DISPNULL))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_nop, int>( - alias(), "test", - &gr_nop::set_ctrlport_test, - pmt::mp(-256), pmt::mp(255), pmt::mp(0), - "", "Simple testing variable", - RPC_PRIVLVL_MIN, DISPNULL))); -#endif /* GR_CTRLPORT */ -} diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h deleted file mode 100644 index 5f1cb13a02..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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_NOP_H -#define INCLUDED_GR_NOP_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <stddef.h> // size_t - -class gr_nop; -typedef boost::shared_ptr<gr_nop> gr_nop_sptr; - -GR_CORE_API gr_nop_sptr -gr_make_nop (size_t sizeof_stream_item); - -/*! - * \brief Does nothing. Used for testing only. - * \ingroup misc_blk - */ -class GR_CORE_API gr_nop : public gr_block -{ - friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); - gr_nop (size_t sizeof_stream_item); - - std::vector<boost::any> d_rpc_vars; - void setup_rpc(); - -protected: - int d_nmsgs_recvd; - int d_ctrlport_test; - - // Method that just counts any received messages. - void count_received_msgs(pmt::pmt_t msg); - - public: - virtual int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int nmsgs_received() const { return d_nmsgs_recvd; } - - int ctrlport_test() { return d_ctrlport_test; } - void set_ctrlport_test(int x) { d_ctrlport_test = x; } -}; - -#endif /* INCLUDED_GR_NOP_H */ diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i deleted file mode 100644 index 73ffa93630..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,nop) - -gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); - -class gr_nop : public gr_block { -public: - int ctrlport_test(); - void set_ctrlport_test(int x); -private: - gr_nop (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_null_sink.cc b/gnuradio-core/src/lib/general/gr_null_sink.cc deleted file mode 100644 index 1836655024..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_sink.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_null_sink.h> -#include <gr_io_signature.h> - -gr_null_sink::gr_null_sink (size_t sizeof_stream_item) - : gr_sync_block ("null_sink", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (0, 0, 0)) -{ -} - -gr_null_sink_sptr -gr_make_null_sink (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_null_sink (sizeof_stream_item)); -} - -int -gr_null_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h deleted file mode 100644 index 7374293295..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_sink.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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_NULL_SINK_H -#define INCLUDED_GR_NULL_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <stddef.h> // size_t - -class gr_null_sink; -typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr; - -GR_CORE_API gr_null_sink_sptr -gr_make_null_sink (size_t sizeof_stream_item); - -/*! - * \brief Bit bucket - * \ingroup sink_blk - */ -class GR_CORE_API gr_null_sink : public gr_sync_block -{ - friend GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - gr_null_sink (size_t sizeof_stream_item); - - public: - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_sink.i b/gnuradio-core/src/lib/general/gr_null_sink.i deleted file mode 100644 index 80411f9b74..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_sink.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,null_sink) - -gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - -class gr_null_sink : public gr_sync_block { -private: - gr_null_sink (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_null_source.cc b/gnuradio-core/src/lib/general/gr_null_source.cc deleted file mode 100644 index 1ad5c351d6..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_source.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_null_source.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_null_source::gr_null_source (size_t sizeof_stream_item) - : gr_sync_block ("null_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof_stream_item)) -{ -} - -gr_null_source_sptr -gr_make_null_source (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_null_source (sizeof_stream_item)); -} - -int -gr_null_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - void *optr = (void *) output_items[0]; - memset (optr, 0, noutput_items * output_signature()->sizeof_stream_item (0)); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h deleted file mode 100644 index 1c64e8bd98..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_source.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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_NULL_SOURCE_H -#define INCLUDED_GR_NULL_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_null_source; -typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr; - -GR_CORE_API gr_null_source_sptr -gr_make_null_source (size_t sizeof_stream_item); - -/*! - * \brief A source of zeros. - * \ingroup source_blk - */ -class GR_CORE_API gr_null_source : public gr_sync_block -{ - friend GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); - - gr_null_source (size_t sizeof_stream_item); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_source.i b/gnuradio-core/src/lib/general/gr_null_source.i deleted file mode 100644 index 120a59999c..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_source.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,null_source) - -gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); - -class gr_null_source : public gr_sync_block { -private: - gr_null_source (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc deleted file mode 100644 index c93478597b..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010 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 <gr_skiphead.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip) - : gr_block ("skiphead", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_nitems_to_skip(nitems_to_skip), d_nitems(0) -{ -} - -gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip) -{ - return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip)); -} - -void -gr_skiphead::set_nitems_to_skip(uint64_t nitems_to_skip) -{ - d_nitems_to_skip = nitems_to_skip; - reset(); -} - -uint64_t -gr_skiphead::nitems_to_skip() const -{ - return d_nitems_to_skip; -} - -uint64_t -gr_skiphead::nitems_skiped() const -{ - return d_nitems; -} - -void -gr_skiphead::reset() -{ - d_nitems = 0; -} - -int -gr_skiphead::general_work(int noutput_items, - gr_vector_int &ninput_items_, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - int ninput_items = std::min(ninput_items_[0], noutput_items); - int ii = 0; // input index - - while (ii < ninput_items){ - - uint64_t ni_total = ii + d_nitems; // total items processed so far - if (ni_total < d_nitems_to_skip){ // need to skip some more - - int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total, - (uint64_t)(ninput_items - ii)); - ii += n_to_skip; - } - - else { // nothing left to skip. copy away - - int n_to_copy = ninput_items - ii; - if (n_to_copy > 0){ - size_t itemsize = output_signature()->sizeof_stream_item(0); - memcpy(out, in + (ii*itemsize), n_to_copy*itemsize); - } - - d_nitems += ninput_items; - consume_each(ninput_items); - return n_to_copy; - } - } - - d_nitems += ninput_items; - consume_each(ninput_items); - return 0; -} diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h deleted file mode 100644 index 710530ff4c..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_SKIPHEAD_H -#define INCLUDED_GR_SKIPHEAD_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <stddef.h> // size_t - -class gr_skiphead; -typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; - -GR_CORE_API gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - -/*! - * \brief skips the first N items, from then on copies items to the output - * \ingroup slicedice_blk - * - * Useful for building test cases and sources which have metadata or junk at the start - */ - -class GR_CORE_API gr_skiphead : public gr_block -{ - friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - uint64_t d_nitems_to_skip; - uint64_t d_nitems; // total items seen - - public: - - /*! - * \brief Sets number of items to skip; resets current skip count to 0. - */ - void set_nitems_to_skip(uint64_t nitems_to_skip); - - /*! - * \brief Gets the number of items to skip. - */ - uint64_t nitems_to_skip() const; - - /*! - * \brief Gets the number of items already skipped. - */ - uint64_t nitems_skiped() const; - - /*! - * \brief Resets number of items skipped to 0. - */ - void reset(); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i deleted file mode 100644 index 8ab23a77a6..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,skiphead); - -gr_skiphead_sptr gr_make_skiphead(size_t itemsize, - uint64_t nitems_to_skip); - -class gr_skiphead : public gr_block -{ -public: - void set_nitems_to_skip(uint64_t nitems_to_skip); - uint64_t nitems_to_skip() const; - uint64_t nitems_skiped() const; - void reset(); -}; diff --git a/gnuradio-core/src/lib/general/gr_vector_map.cc b/gnuradio-core/src/lib/general/gr_vector_map.cc deleted file mode 100644 index 2a13efb06d..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.cc +++ /dev/null @@ -1,117 +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 <gr_vector_map.h> -#include <gr_io_signature.h> -#include <string.h> - -std::vector<int> -get_in_sizeofs(size_t item_size, std::vector<size_t> in_vlens) -{ - std::vector<int> in_sizeofs; - for(unsigned int i = 0; i < in_vlens.size(); i++) { - in_sizeofs.push_back(in_vlens[i]*item_size); - } - return in_sizeofs; -} - -std::vector<int> -get_out_sizeofs(size_t item_size, - std::vector< std::vector< std::vector<size_t> > > mapping) -{ - std::vector<int> out_sizeofs; - for(unsigned int i = 0; i < mapping.size(); i++) { - out_sizeofs.push_back(mapping[i].size()*item_size); - } - return out_sizeofs; -} - -gr_vector_map_sptr -gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping) -{ - return gnuradio::get_initial_sptr(new gr_vector_map(item_size, - in_vlens, - mapping)); -} - -gr_vector_map::gr_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping) - : gr_sync_block("vector_map", - gr_make_io_signaturev(in_vlens.size(), in_vlens.size(), - get_in_sizeofs(item_size, in_vlens)), - gr_make_io_signaturev(mapping.size(), mapping.size(), - get_out_sizeofs(item_size, mapping))), - d_item_size(item_size), d_in_vlens(in_vlens) -{ - set_mapping(mapping); -} - -void -gr_vector_map::set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) { - // Make sure the contents of the mapping vectors are possible. - for(unsigned int i=0; i<mapping.size(); i++) { - for(unsigned int j=0; j<mapping[i].size(); j++) { - if(mapping[i][j].size() != 2) { - throw std::runtime_error("Mapping must be of the form (out_mapping_stream1, out_mapping_stream2, ...), where out_mapping_stream1 is of the form (mapping_element1, mapping_element2, ...), where mapping_element1 is of the form (input_stream, input_element). This error is raised because a mapping_element vector does not contain exactly 2 items."); - } - unsigned int s = mapping[i][j][0]; - unsigned int index = mapping[i][j][1]; - if(s >= d_in_vlens.size()) { - throw std::runtime_error("Stream numbers in mapping must be less than the number of input streams."); - } - if((index < 0) || (index >= d_in_vlens[s])) { - throw std::runtime_error ("Indices in mapping must be greater than 0 and less than the input vector lengths."); - } - } - } - gruel::scoped_lock guard(d_mutex); - d_mapping = mapping; -} - -int -gr_vector_map::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char **inv = (const char **) &input_items[0]; - char **outv = (char **) &output_items[0]; - - for(unsigned int n = 0; n < (unsigned int)(noutput_items); n++) { - for(unsigned int i = 0; i < d_mapping.size(); i++) { - unsigned int out_vlen = d_mapping[i].size(); - for(unsigned int j = 0; j < out_vlen; j++) { - unsigned int s = d_mapping[i][j][0]; - unsigned int k = d_mapping[i][j][1]; - memcpy(outv[i] + out_vlen*d_item_size*n + - d_item_size*j, inv[s] + d_in_vlens[s]*d_item_size*n + - k*d_item_size, d_item_size); - } - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_vector_map.h b/gnuradio-core/src/lib/general/gr_vector_map.h deleted file mode 100644 index f5492b1e3a..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.h +++ /dev/null @@ -1,83 +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_VECTOR_MAP_H -#define INCLUDED_GR_VECTOR_MAP_H - -#include <vector> -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> -#include <gruel/thread.h> - -class gr_vector_map; -typedef boost::shared_ptr<gr_vector_map> gr_vector_map_sptr; - -GR_CORE_API gr_vector_map_sptr -gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - -/*! - * \brief Maps elements from a set of input vectors to a set of output vectors. - * - * If in[i] is the input vector in the i'th stream then the output - * vector in the j'th stream is: - * - * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]] - * - * That is mapping is of the form (out_stream1_mapping, - * out_stream2_mapping, ...) and out_stream1_mapping is of the form - * (element1_mapping, element2_mapping, ...) and element1_mapping is - * of the form (in_stream, in_element). - * - * \param item_size (integer) size of vector elements - * - * \param in_vlens (vector of integers) number of elements in each - * input vector - * - * \param mapping (vector of vectors of vectors of integers) how to - * map elements from input to output vectors - * - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_vector_map : public gr_sync_block -{ - friend GR_CORE_API gr_vector_map_sptr - gr_make_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - size_t d_item_size; - std::vector<size_t> d_in_vlens; - std::vector< std::vector< std::vector<size_t> > > d_mapping; - gruel::mutex d_mutex; // mutex to protect set/work access - - protected: - gr_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping); -}; - -#endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gnuradio-core/src/lib/general/gr_vector_map.i b/gnuradio-core/src/lib/general/gr_vector_map.i deleted file mode 100644 index e9fa3f27e5..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.i +++ /dev/null @@ -1,28 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr, vector_map); - -%template() std::vector<size_t>; -%template() std::vector< std::vector< std::vector<size_t> > >; - -%include "gr_vector_map.h" diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt deleted file mode 100644 index 45834ced5f..0000000000 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright 2010-2011 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 included, use CMake directory variables -######################################################################## -include(GrPython) - -######################################################################## -# generate the python helper script which calls into the build utils -######################################################################## -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_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) - build_utils.expand_template(d, inp) - -") - -######################################################################## -# generation helper macro to generate various files from template -######################################################################## -macro(expand_h_cc_i root) - - foreach(ext h cc i) - #make a list of all the generated files - unset(expanded_files_${ext}) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_${ext}} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.${ext}.t ${ARGN} - ) - endforeach(ext) - - #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 cc, h, and i files - list(APPEND generated_gengen_sources ${expanded_files_cc}) - list(APPEND generated_gengen_includes ${expanded_files_h}) - list(APPEND generated_gengen_swigs ${expanded_files_i}) - -endmacro(expand_h_cc_i) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_h_cc_i(gr_vector_source_X b s i f c) -expand_h_cc_i(gr_vector_insert_X b) -expand_h_cc_i(gr_vector_sink_X b s i f c) - -add_custom_target(gengen_generated DEPENDS - ${generated_gengen_includes} - ${generated_gengen_swigs} -) - -######################################################################## -# Create the master gengen swig include files -######################################################################## -set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i.in) -file(WRITE ${generated_index} " -// -// This file is machine generated. All edits will be overwritten -// -") - -file(APPEND ${generated_index} "%{\n") -foreach(swig_file ${generated_gengen_swigs}) - get_filename_component(name ${swig_file} NAME_WE) - file(APPEND ${generated_index} "#include<${name}.h>\n") -endforeach(swig_file) -file(APPEND ${generated_index} "%}\n") - -foreach(swig_file ${generated_gengen_swigs}) - get_filename_component(name ${swig_file} NAME) - file(APPEND ${generated_index} "%include<${name}>\n") -endforeach(swig_file) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i -) - -######################################################################## -# Handle the generated sources + a few non-generated ones -######################################################################## -list(APPEND gnuradio_core_sources - ${generated_gengen_sources} -) - -install(FILES - ${generated_gengen_includes} - ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -if(ENABLE_PYTHON) - install(FILES - ${generated_gengen_swigs} - ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.i - ${CMAKE_CURRENT_SOURCE_DIR}/gengen.i - ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" - ) -endif(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/gengen/generate_all.py b/gnuradio-core/src/lib/gengen/generate_all.py deleted file mode 100755 index 6b0f20f058..0000000000 --- a/gnuradio-core/src/lib/gengen/generate_all.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from build_utils import output_glue - -import generate_common - -def generate_all (): - generate_common.generate () - output_glue ('gengen') - - -if __name__ == '__main__': - generate_all () diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py deleted file mode 100755 index 68913f9a75..0000000000 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2007,2008,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. -# - -from build_utils import expand_template, standard_dict -from build_utils_codes import * - -import re - - -# sources and sinks -ss_signatures = ['s', 'i', 'f', 'c'] - -ss_roots = [ - 'gr_vector_source_X', - 'gr_vector_sink_X', - ] - -# regular blocks -reg_signatures = ['ss', 'ii', 'ff', 'cc'] - - -def expand_h_cc_i (root, sig): - # root looks like 'gr_vector_sink_X' - name = re.sub ('X+', sig, root) - d = standard_dict (name, sig) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - - -def generate (): - expand_h_cc_i ('gr_vector_sink_X', 'b') - expand_h_cc_i ('gr_vector_source_X', 'b') - for r in ss_roots: - for s in ss_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - - diff --git a/gnuradio-core/src/lib/gengen/gengen.i b/gnuradio-core/src/lib/gengen/gengen.i deleted file mode 100644 index 7d8c27fe68..0000000000 --- a/gnuradio-core/src/lib/gengen/gengen.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 "gr_endianness.h" -%} - -%include "gr_endianness.i" - -%include "gengen_generated.i" diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.i b/gnuradio-core/src/lib/gengen/gr_endianness.i deleted file mode 100644 index 572b7a42fb..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_endianness.i +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -%include <gr_endianness.h> diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t deleted file mode 100644 index 20968afe22..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t +++ /dev/null @@ -1,100 +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@.h> -#include <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> - -#include <stdio.h> - -@NAME@::@NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset) - : gr_block("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof(@TYPE@)), - gr_make_io_signature (1, 1, sizeof(@TYPE@))), - d_data(data), - d_offset(offset), - d_periodicity(periodicity) -{ - //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset); - // some sanity checks - assert(offset < periodicity); - assert(offset >= 0); - assert((size_t)periodicity > data.size()); -} - -int -@NAME@::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]; - - int ii(0), oo(0); - - while((oo < noutput_items) && (ii < ninput_items[0])) { - - //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]); - //printf(", d_periodicity = %d\n", d_periodicity); - - if(d_offset >= ((int)d_data.size())) { // if we are in the copy region - int max_copy = std::min( std::min( noutput_items - oo, ninput_items[0] - ii ), d_periodicity - d_offset ); - //printf("copy %d from input\n", max_copy); - memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy ); - //printf(" * memcpy returned.\n"); - ii += max_copy; - oo += max_copy; - d_offset = (d_offset + max_copy)%d_periodicity; - - } - 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 ); - //printf(" * memcpy returned.\n"); - oo += max_copy; - d_offset = (d_offset + max_copy)%d_periodicity; - //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset); - } - - //printf(" # exit else, on to next loop.\n"); - } - //printf(" # got out of loop\n"); - - //printf("consume = %d, produce = %d\n", ii, oo); - consume_each(ii); - return oo; -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset) -{ - return gnuradio::get_initial_sptr(new @NAME@ (data, periodicity, offset)); -} - diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t deleted file mode 100644 index 26f851700d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t +++ /dev/null @@ -1,61 +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@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief source of @TYPE@'s that gets its data from a vector - * \ingroup source_blk - */ - -class @NAME@ : public gr_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); - - std::vector<@TYPE@> d_data; - int d_offset; - int d_periodicity; - - @NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); - - public: - void rewind() {d_offset=0;} - virtual int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); } -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset=0); - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t deleted file mode 100644 index f3341eec4f..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t +++ /dev/null @@ -1,37 +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@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0) - throw(std::invalid_argument); - -class @NAME@ : public gr_block { - public: - void rewind(); - void set_data(const std::vector<@TYPE@> &data); - private: - @NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t deleted file mode 100644 index 2b8207c027..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2010 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 <algorithm> -#include <gr_io_signature.h> -#include <iostream> - - -@NAME@::@NAME@ (int vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen), - gr_make_io_signature (0, 0, 0)), - d_vlen(vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *iptr = (@TYPE@ *) input_items[0]; - for (int i = 0; i < noutput_items * d_vlen; i++) - d_data.push_back (iptr[i]); - std::vector<gr_tag_t> tags; - get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items); - d_tags.insert(d_tags.end(), tags.begin(), tags.end()); - return noutput_items; -} - - -@NAME@_sptr -gr_make_@BASE_NAME@ (int vlen) -{ - return gnuradio::get_initial_sptr(new @NAME@ (vlen)); -} - -std::vector<@TYPE@> -@NAME@::data () const -{ - return d_data; -} - -std::vector<gr_tag_t> -@NAME@::tags () const -{ - return d_tags; -} diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t deleted file mode 100644 index b7de1d101c..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (int vlen = 1); - - -/*! - * \brief @TYPE@ sink that writes to a vector - * \ingroup sink_blk - */ - -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (int vlen); - std::vector<@TYPE@> d_data; - std::vector<gr_tag_t> d_tags; - int d_vlen; - @NAME@ (int vlen); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() {d_data.clear();} - void clear() {reset(); } // deprecated - std::vector<@TYPE@> data () const; - std::vector<gr_tag_t> tags () const; -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t deleted file mode 100644 index ee0ebf378b..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,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. - */ - -// @WARNING@ - - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1); - -class @NAME@ : public gr_sync_block { - private: - @NAME@ (int vlen); - - public: - void clear(); // deprecated - void reset(); - std::vector<@TYPE@> data () const; - std::vector<gr_tag_t> tags () const; -}; - diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t deleted file mode 100644 index 19272ee24b..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2010 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 <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> - -@NAME@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen)), - d_data (data), - d_repeat (repeat), - d_offset (0), - d_vlen (vlen), - d_tags (tags), - d_tagpos (0) -{ - if (tags.size() == 0) { - d_settags = 0; - } else { - d_settags = 1; - set_output_multiple(data.size() / vlen); - } - if ((data.size() % vlen) != 0) - throw std::invalid_argument("data length must be a multiple of vlen"); -} - -void -@NAME@::set_data (const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags){ - d_data = data; - d_tags = tags; - rewind(); - if (tags.size() == 0) { - d_settags = false; - } else { - d_settags = true; - } -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *optr = (@TYPE@ *) output_items[0]; - - if (d_repeat){ - unsigned int size = d_data.size (); - unsigned int offset = d_offset; - if (size == 0) - return -1; - - if (d_settags) { - 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@)); - optr += size; - for (unsigned t = 0; t < d_tags.size(); t++) { - add_item_tag(0, nitems_written(0)+i+d_tags[t].offset, d_tags[t].key, d_tags[t].value); - } - } - } else { - for (int i = 0; i < noutput_items*d_vlen; i++){ - optr[i] = d_data[offset++]; - if (offset >= size) { - offset = 0; - } - } - } - - - d_offset = offset; - return noutput_items; - } else { - if (d_offset >= d_data.size ()) - return -1; // Done! - - unsigned n = std::min ((unsigned) d_data.size () - d_offset, - (unsigned) noutput_items*d_vlen); - for (unsigned i = 0; i < n; i++) { - optr[i] = d_data[d_offset + i]; - } - 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); - } - d_offset += n; - return n/d_vlen; - } -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags) -{ - return gnuradio::get_initial_sptr(new @NAME@ (data, repeat, vlen, tags)); -} - diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t deleted file mode 100644 index 041cc47a45..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,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@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class GR_CORE_API @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief source of @TYPE@'s that gets its data from a vector - * \ingroup source_blk - */ - -class @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); - - std::vector<@TYPE@> d_data; - bool d_repeat; - unsigned int d_offset; - int d_vlen; - bool d_settags; - std::vector<gr_tag_t> d_tags; - unsigned int d_tagpos; - - @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); - - public: - void rewind() {d_offset=0;} - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - void set_data(const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t deleted file mode 100644 index 1f1479f947..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,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@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1, const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) - throw(std::invalid_argument); - -class @NAME@ : public gr_sync_block { - public: - void rewind(); - void set_data(const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); - private: - @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); -}; diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index a322d1b998..f3982f53cd 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -110,17 +110,9 @@ endif(ENABLE_GR_CTRLPORT) # Append gnuradio-core test sources ######################################################################## list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_logger.cc ) diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 31081698c7..66fb72d87e 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -301,9 +301,9 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ * void msg_handler(pmt::pmt msg); * </pre> * - * (You may want to use boost::bind to massage your callable into the - * correct form. See gr_nop.{h,cc} for an example that sets up a class - * method as the callback.) + * (You may want to use boost::bind to massage your callable into + * the correct form. See gr::blocks::nop for an example that sets + * up a class method as the callback.) * * Blocks that desire to handle messages must call this method in their * constructors to register the handler that will be invoked when messages diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 694e9575b4..9634b53f3c 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. + * Copyright 2007-2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -83,7 +83,7 @@ public: /*! * Wait for a flowgraph to complete. Flowgraphs complete when * either (1) all blocks indicate that they are done (typically only - * when using blocks.file_source, or gr.head, or (2) after stop() has been + * when using blocks.file_source, or blocks.head, or (2) after stop() has been * called to request shutdown. Calling wait on a top_block that is * not running IS NOT an error (wait returns w/o blocking). */ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc deleted file mode 100644 index c3c18cac01..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ /dev/null @@ -1,448 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 <qa_block_tags.h> -#include <gr_block.h> -#include <gr_top_block.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_annotator_alltoall.h> -#include <gr_annotator_1to1.h> -#include <gr_tags.h> - - -// ---------------------------------------------------------------- - -// set to 1 to turn on debug output -// The debug output fully checks that the tags seen are what are expected. While -// this behavior currently works with our implementation, there is no guarentee -// that the tags will be coming in this specific order, so it's dangerous to -// rely on this as a test of the tag system working. We would really want to -// tags we know we should see and then test that they all occur once, but in no -// particular order. -#define QA_TAGS_DEBUG 0 - -void -qa_block_tags::t0 () -{ - unsigned int N = 1000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr snk (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, snk, 0); - - //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error); - //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error); - CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0); - CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0); - - tb->run(); - - CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument); - CPPUNIT_ASSERT(src->nitems_written(0) >= N); - CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000); - CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument); -} - - -void -qa_block_tags::t1 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, ann3, 0); - tb->connect(ann2, 0, ann4, 0); - - tb->connect(ann3, 0, snk0, 0); - tb->connect(ann4, 0, snk1, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt::pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t1" << std::endl; - - // For annotator 3, we know it gets tags from ann0 and ann1, test this - for(size_t i = 0; i < tags3.size(); i++) { - std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); - } - - // For annotator 4, we know it gets tags from ann0 and ann2, test this - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - -void -qa_block_tags::t2 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk2 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann1, 1); - tb->connect(ann1, 0, ann2, 0); - tb->connect(ann1, 1, ann3, 0); - tb->connect(ann1, 2, ann4, 0); - - tb->connect(ann2, 0, snk0, 0); - tb->connect(ann3, 0, snk1, 0); - tb->connect(ann4, 0, snk2, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); - std::vector<gr_tag_t> tags3 = ann4->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); - - // Make sure the rest all have 12 tags - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12); - - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - - pmt::pmt_t expected_tags2[12]; - expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(6)); - expected_tags2[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags2[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags2[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(9)); - expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - pmt::pmt_t expected_tags4[12]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(5)); - expected_tags4[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(8)); - expected_tags4[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags4[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(11)); - expected_tags4[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags4[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t2" << std::endl; - - // For annotator[2-4], we know it gets tags from ann0 and ann1 - // but the tags from the different outputs of ann1 are different for each. - // Just testing ann2 and ann4; if they are correct it would be - // inconceivable for ann3 to have it wrong. - for(size_t i = 0; i < tags2.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); - } - - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - - -void -qa_block_tags::t3 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(head, 0, ann0, 1); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, ann3, 0); - tb->connect(ann2, 0, ann4, 0); - - tb->connect(ann3, 0, snk0, 0); - tb->connect(ann4, 0, snk1, 0); - - tb->run(); - - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt::pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t3" << std::endl; - - // For annotator 3, we know it gets tags from ann0 and ann1, test this - for(size_t i = 0; i < tags3.size(); i++) { - std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); - } - - // For annotator 4, we know it gets tags from ann0 and ann2, test this - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - - -void -qa_block_tags::t4 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - // using 1-to-1 tag propagation without having equal number of - // ins and outs. Make sure this works; will just exit run early. - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, snk0, 0); - tb->connect(ann2, 0, snk1, 0); - - std::cerr << std::endl - << "NOTE: This is supposed to produce an error from gr_block_executor" - << std::endl; - tb->run(); -} - - -/* -void -qa_block_tags::t5 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr head (gr_make_head(sizeof(float), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); - - // Rate change blocks - gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, dec10, 0); - tb->connect(dec10, 0, ann2, 0); - tb->connect(ann2, 0, snk0, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); - - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags1[5]; - expected_tags1[0] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags1[1] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags1[2] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags1[3] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); - - pmt::pmt_t expected_tags2[10]; - expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt::from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt::from_uint64(1000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[4] = mp(pmt::from_uint64(2000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt::from_uint64(2000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[6] = mp(pmt::from_uint64(3000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[7] = mp(pmt::from_uint64(3000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[8] = mp(pmt::from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); - expected_tags2[9] = mp(pmt::from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); - - std::cout << std::endl << "qa_block_tags::t5" << std::endl; - - // annotator 1 gets tags from annotator 0 - std::cout << "tags1.size(): " << tags1.size() << std::endl; - for(size_t i = 0; i < tags1.size(); i++) { - std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags1[i]), pmt::write_string(expected_tags1[i])); - } - - // annotator 2 gets tags from annotators 0 and 1 - std::cout << std::endl; - std::cout << "tags2.size(): " << tags2.size() << std::endl; - for(size_t i = 0; i < tags2.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); - } -#endif -} -*/ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h deleted file mode 100644 index 039d345cdf..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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_BLOCK_TAGS_H -#define INCLUDED_QA_BLOCK_TAGS_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_block_tags : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_block_tags); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - //CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); - //void t5 (); - -}; - - -#endif /* INCLUDED_QA_BLOCK_TAGS_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_block.cc deleted file mode 100644 index aeab5b74a8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <qa_gr_block.h> -#include <gr_block.h> -#include <gr_io_signature.h> -#include <gr_null_sink.h> -#include <gr_null_source.h> - - -// ---------------------------------------------------------------- - - -void -qa_gr_block::t0 () -{ - // test creation of sources - gr_block_sptr src1 (gr_make_null_source (sizeof (int))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ()); - CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof(int), - src1->output_signature()->sizeof_stream_item (0)); - - gr_block_sptr src2 (gr_make_null_source (sizeof (short))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ()); - CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (short), - src2->output_signature()->sizeof_stream_item (0)); -} - - -void -qa_gr_block::t1 () -{ - // test creation of sinks - gr_block_sptr dst1 (gr_make_null_sink (sizeof (int))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ()); - CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (int), - dst1->input_signature()->sizeof_stream_item (0)); - - CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ()); - - gr_block_sptr dst2 (gr_make_null_sink (sizeof (short))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ()); - CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (short), - dst2->input_signature()->sizeof_stream_item (0)); - CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ()); -} - -void -qa_gr_block::t2 () -{ -} - -void -qa_gr_block::t3 () -{ -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.h b/gnuradio-core/src/lib/runtime/qa_gr_block.h deleted file mode 100644 index 14c7c40d1f..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_QA_GR_BLOCK_H -#define INCLUDED_QA_GR_BLOCK_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_block : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_block); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* INCLUDED_QA_GR_BLOCK_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc deleted file mode 100644 index cce83cb0a0..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 (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 <qa_gr_flowgraph.h> -#include <gr_flowgraph.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> - -void qa_gr_flowgraph::t0() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - CPPUNIT_ASSERT(fg); -} - -void qa_gr_flowgraph::t1_connect() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); -} - -void qa_gr_flowgraph::t2_connect_invalid_src_port_neg() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t3_connect_src_port_exceeds() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument); -} - -void qa_gr_flowgraph::t5_connect_dst_port_exceeds() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument); -} - -void qa_gr_flowgraph::t6_connect_dst_in_use() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src1 = gr_make_null_source(sizeof(int)); - gr_block_sptr src2 = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - fg->connect(src1, 0, dst, 0); - CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t7_connect_one_src_two_dst() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst1 = gr_make_null_sink(sizeof(int)); - gr_block_sptr dst2 = gr_make_null_sink(sizeof(int)); - - fg->connect(src, 0, dst1, 0); - fg->connect(src, 0, dst2, 0); -} - -void qa_gr_flowgraph::t8_connect_type_mismatch() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(char)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t9_disconnect() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->disconnect(nop1, 0, nop2, 0); -} - -void qa_gr_flowgraph::t10_disconnect_unconnected_block() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - gr_block_sptr nop3 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t11_disconnect_unconnected_port() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument); -} - -void qa_gr_flowgraph::t12_validate() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->validate(); -} - -void qa_gr_flowgraph::t13_validate_missing_input_assignment() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->connect(nop1, 0, nop2, 2); - CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error); -} - -void qa_gr_flowgraph::t14_validate_missing_output_assignment() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->connect(nop1, 2, nop2, 1); - CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error); -} - -void qa_gr_flowgraph::t15_clear() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - - CPPUNIT_ASSERT(fg->edges().size() == 1); - CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 2); - - fg->clear(); - - CPPUNIT_ASSERT(fg->edges().size() == 0); - CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 0); -} - -void qa_gr_flowgraph::t16_partition() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop11 = gr_make_nop(sizeof(int)); - gr_block_sptr nop12 = gr_make_nop(sizeof(int)); - gr_block_sptr nop13 = gr_make_nop(sizeof(int)); - gr_block_sptr nop14 = gr_make_nop(sizeof(int)); - - gr_block_sptr nop21 = gr_make_nop(sizeof(int)); - gr_block_sptr nop22 = gr_make_nop(sizeof(int)); - gr_block_sptr nop23 = gr_make_nop(sizeof(int)); - - gr_block_sptr nop31 = gr_make_nop(sizeof(int)); - gr_block_sptr nop32 = gr_make_nop(sizeof(int)); - - // Build disjoint graph #1 - fg->connect(nop11, 0, nop12, 0); - fg->connect(nop12, 0, nop13, 0); - fg->connect(nop13, 0, nop14, 0); - - // Build disjoint graph #2 - fg->connect(nop21, 0, nop22, 0); - fg->connect(nop22, 0, nop23, 0); - - // Build disjoint graph #3 - fg->connect(nop31, 0, nop32, 0); - - std::vector<gr_basic_block_vector_t> graphs = fg->partition(); - - CPPUNIT_ASSERT(graphs.size() == 3); - CPPUNIT_ASSERT(graphs[0].size() == 4); - CPPUNIT_ASSERT(graphs[1].size() == 3); - CPPUNIT_ASSERT(graphs[2].size() == 2); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h deleted file mode 100644 index 2c2686f71b..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 (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_GR_FLOWGRAPH_H -#define INCLUDED_QA_GR_FLOWGRAPH_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_flowgraph : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_flowgraph); - - CPPUNIT_TEST(t0); - CPPUNIT_TEST(t1_connect); - CPPUNIT_TEST(t2_connect_invalid_src_port_neg); - CPPUNIT_TEST(t3_connect_src_port_exceeds); - CPPUNIT_TEST(t4_connect_invalid_dst_port_neg); - CPPUNIT_TEST(t5_connect_dst_port_exceeds); - CPPUNIT_TEST(t6_connect_dst_in_use); - CPPUNIT_TEST(t7_connect_one_src_two_dst); - CPPUNIT_TEST(t8_connect_type_mismatch); - CPPUNIT_TEST(t9_disconnect); - CPPUNIT_TEST(t10_disconnect_unconnected_block); - CPPUNIT_TEST(t11_disconnect_unconnected_port); - CPPUNIT_TEST(t12_validate); - CPPUNIT_TEST(t13_validate_missing_input_assignment); - CPPUNIT_TEST(t14_validate_missing_output_assignment); - CPPUNIT_TEST(t15_clear); - CPPUNIT_TEST(t16_partition); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); - void t1_connect(); - void t2_connect_invalid_src_port_neg(); - void t3_connect_src_port_exceeds(); - void t4_connect_invalid_dst_port_neg(); - void t5_connect_dst_port_exceeds(); - void t6_connect_dst_in_use(); - void t7_connect_one_src_two_dst(); - void t8_connect_type_mismatch(); - void t9_disconnect(); - void t10_disconnect_unconnected_block(); - void t11_disconnect_unconnected_port(); - void t12_validate(); - void t13_validate_missing_input_assignment(); - void t14_validate_missing_output_assignment(); - void t15_clear(); - void t16_partition(); -}; - -#endif /* INCLUDED_QA_GR_FLOWGRAPH_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc deleted file mode 100644 index 9844d33814..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_hier_block2.h> -#include <gr_hier_block2.h> -#include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> - -void qa_gr_hier_block2::test_make() -{ - gr_hier_block2_sptr src1(gr_make_hier_block2("test", - gr_make_io_signature(1, 1, 1 * sizeof(int)), - gr_make_io_signature(1, 1, 1 * sizeof(int)))); - - CPPUNIT_ASSERT(src1); - CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name()); - - CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int), - src1->input_signature()->sizeof_stream_item(0)); - - CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->min_streams()); - CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams()); - - - CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int), - src1->output_signature()->sizeof_stream_item(0)); - - CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams()); - CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams()); - -} - - diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h deleted file mode 100644 index 653cd27251..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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_GR_HIER_BLOCK2_H -#define INCLUDED_QA_GR_HIER_BLOCK2_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_hier_block2 : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_hier_block2); - - CPPUNIT_TEST(test_make); - - CPPUNIT_TEST_SUITE_END(); - -private: - void test_make(); -}; - -#endif /* INCLUDED_QA_GR_HIER_BLOCK2_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc deleted file mode 100644 index 060c4e2447..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008 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 <qa_gr_hier_block2_derived.h> -#include <gr_top_block.h> -#include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_kludge_copy.h> - -// Declare a test C++ hierarchical block - -class gr_derived_block; -typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr; -gr_derived_block_sptr gr_make_derived_block(); - -class gr_derived_block : public gr_hier_block2 -{ -private: - friend gr_derived_block_sptr gr_make_derived_block(); - gr_derived_block(); - -public: - ~gr_derived_block(); -}; - - -gr_derived_block_sptr -gr_make_derived_block() -{ - return gnuradio::get_initial_sptr(new gr_derived_block()); -} - -gr_derived_block::gr_derived_block() - : gr_hier_block2("gr_derived_block", - gr_make_io_signature(1, 1, sizeof(int)), // Input signature - gr_make_io_signature(1, 1, sizeof(int))) // Output signature -{ - gr_block_sptr copy(gr_make_kludge_copy(sizeof(int))); - - connect(self(), 0, copy, 0); - connect(copy, 0, self(), 0); -} - -gr_derived_block::~gr_derived_block() -{ -} - -void qa_gr_hier_block2_derived::test_1() -{ - gr_top_block_sptr tb(gr_make_top_block("test")); - - gr_block_sptr src(gr_make_null_source(sizeof(int))); - gr_block_sptr head(gr_make_head(sizeof(int), 1000)); - gr_derived_block_sptr blk(gr_make_derived_block()); - gr_block_sptr dst(gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, blk, 0); - tb->connect(blk, 0, dst, 0); - - tb->run(); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h deleted file mode 100644 index 8e0a1880ce..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008 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_GR_HIER_BLOCK2_DERIVED_H -#define INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -// Declare a QA test case -class qa_gr_hier_block2_derived : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived); - CPPUNIT_TEST(test_1); - CPPUNIT_TEST_SUITE_END(); - -private: - void test_1(); -}; - -#endif /* INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc deleted file mode 100644 index 1d3dafadf8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 (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 <qa_gr_top_block.h> -#include <gr_top_block.h> -#include <gr_head.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <iostream> - -#define VERBOSE 0 - -void qa_gr_top_block::t0() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - CPPUNIT_ASSERT(tb); -} - -void qa_gr_top_block::t1_run() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->run(); -} - -void qa_gr_top_block::t2_start_stop_wait() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - - tb->start(); - tb->stop(); - tb->wait(); -} - -void qa_gr_top_block::t3_lock_unlock() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, dst, 0); - - tb->start(); - - tb->lock(); - tb->unlock(); - - tb->stop(); - tb->wait(); -} - -void qa_gr_top_block::t4_reconfigure() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - - -void qa_gr_top_block::t5_max_noutputs() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t5()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(100); - tb->wait(); -} - -void qa_gr_top_block::t6_reconfig_max_noutputs() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t6()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(100); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->set_max_noutput_items(1000); - head->set_max_noutput_items(500); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t7_max_noutputs_per_block() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t7()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_noutput_items(100); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(); - tb->wait(); -} - -void qa_gr_top_block::t8_reconfig_max_noutputs_per_block() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t8()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_noutput_items(99); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(201); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->set_max_noutput_items(1023); - head->set_max_noutput_items(513); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t9_max_output_buffer() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t9()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_output_buffer(1024); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(); - tb->wait(); -} - -void qa_gr_top_block::t10_reconfig_max_output_buffer() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t10()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_output_buffer(1000); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(201); - - // Reconfigure with gr_head in the middle - tb->lock(); - gr_block_sptr nop = gr_make_nop(sizeof(int)); - nop->set_max_output_buffer(4000); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, nop, 0); - tb->connect(nop, 0, dst, 0); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t11_set_block_affinity() -{ - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr snk (gr_make_null_sink(sizeof(float))); - - std::vector<unsigned int> set(1, 0), ret; - src->set_processor_affinity(set); - - tb->connect(src, 0, snk, 0); - tb->start(); - tb->stop(); - tb->wait(); - - ret = src->processor_affinity(); - - // We only set the core affinity to 0 because we always know at - // least one thread core exists to use. - CPPUNIT_ASSERT_EQUAL(set[0], ret[0]); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h deleted file mode 100644 index 634eeab1f8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 (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_GR_TOP_BLOCK_H -#define INCLUDED_QA_GR_TOP_BLOCK_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_top_block : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_top_block); - - CPPUNIT_TEST(t0); - CPPUNIT_TEST(t1_run); - CPPUNIT_TEST(t2_start_stop_wait); - CPPUNIT_TEST(t3_lock_unlock); - CPPUNIT_TEST(t4_reconfigure); // triggers 'join never returns' bug - CPPUNIT_TEST(t5_max_noutputs); - CPPUNIT_TEST(t6_reconfig_max_noutputs); - CPPUNIT_TEST(t7_max_noutputs_per_block); - CPPUNIT_TEST(t8_reconfig_max_noutputs_per_block); - CPPUNIT_TEST(t9_max_output_buffer); - CPPUNIT_TEST(t10_reconfig_max_output_buffer); - CPPUNIT_TEST(t11_set_block_affinity); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); - void t1_run(); - void t2_start_stop_wait(); - void t3_lock_unlock(); - void t4_reconfigure(); - void t5_max_noutputs(); - void t6_reconfig_max_noutputs(); - void t7_max_noutputs_per_block(); - void t8_reconfig_max_noutputs_per_block(); - void t9_max_output_buffer(); - void t10_reconfig_max_output_buffer(); - void t11_set_block_affinity(); - -}; - -#endif /* INCLUDED_QA_GR_TOP_BLOCK_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc index 62c95ef5c4..f02fbd7d66 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.cc +++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc @@ -32,14 +32,8 @@ #include <qa_runtime.h> #include <qa_gr_vmcircbuf.h> #include <qa_gr_io_signature.h> -#include <qa_gr_block.h> -#include <qa_gr_flowgraph.h> #include <qa_gr_logger.h> -#include <qa_gr_top_block.h> -#include <qa_gr_hier_block2.h> -#include <qa_gr_hier_block2_derived.h> #include <qa_gr_buffer.h> -#include <qa_block_tags.h> #include <qa_set_msg_handler.h> CppUnit::TestSuite * diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc deleted file mode 100644 index ac06a3f8bc..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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 <qa_set_msg_handler.h> -#include <gr_top_block.h> -#include <gr_head.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_nop.h> -#include <gruel/msg_passing.h> -#include <iostream> -#include <boost/thread/thread.hpp> - - -#define VERBOSE 0 - -/* - * The gr_nop block has been instrumented so that it counts - * the number of messages sent to it. We use this feature - * to confirm that gr_nop's call to set_msg_handler is working - * correctly. - */ - -void qa_set_msg_handler::t0() -{ - static const int NMSGS = 10; - - if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_nop_sptr nop = gr_make_nop(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, nop, 0); - tb->connect(nop, 0, dst, 0); - - // Must start graph before sending messages - tb->start(); - - // Send them... - pmt::pmt_t port(pmt::intern("port")); - for (int i = 0; i < NMSGS; i++){ - send(nop, port, pmt::mp(pmt::mp("example-msg"), pmt::mp(i))); - } - - // Give the messages a chance to be processed - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - - tb->stop(); - tb->wait(); - - // Confirm that the nop block received the right number of messages. - CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received()); -} diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h deleted file mode 100644 index 60277a12cc..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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_SET_MSG_HANDLER_H -#define INCLUDED_QA_SET_MSG_HANDLER_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_set_msg_handler : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_set_msg_handler); - - CPPUNIT_TEST(t0); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); -}; - -#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */ diff --git a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc index bb4e863222..0a391c1354 100644 --- a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc +++ b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,16 +21,16 @@ */ #include <gr_shared_block_sptr.h> -#include <gr_vector_source_i.h> +#include <blocks/vector_source_i.h> gr_block_sptr -foo (gr_vector_source_i_sptr s) +foo (gr::blocks::vector_source_i::sptr s) { return gr_block_sptr (s); } -typedef gr_shared_block_sptr<gr_vector_source_i> gr_vector_source_i_ptrX; -//typedef boost::shared_ptr<gr_vector_source_i> gr_vector_source_i_ptrX; +typedef gr_shared_block_sptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; +//typedef boost::shared_ptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; gr_vector_source_i_ptrX bar (gr_vector_source_i *s) diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index 2132e2ca09..a397339eeb 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -58,9 +58,9 @@ link_directories(${Boost_LIBRARY_DIRS}) # ---------------------------------------------------------------- set(GR_SWIG_TARGET_DEPS gnuradio_core_generated_sources - general_generated gengen_generated filter_generated pmt_swig) + general_generated filter_generated pmt_swig) -foreach(what runtime general gengen io) +foreach(what runtime general io) SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i) SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what}) GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py index 1fd558a11b..98e415f31a 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core.py +++ b/gnuradio-core/src/lib/swig/gnuradio_core.py @@ -22,5 +22,4 @@ from gnuradio_core_runtime import * from gnuradio_core_general import * -from gnuradio_core_gengen import * from gnuradio_core_io import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i deleted file mode 100644 index b90a5bab3e..0000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -%include "gengen_swig_doc.i" - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_core_gengen -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "gengen.i" diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index dfa67feffe..8597ca6497 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -206,7 +206,7 @@ class GrDataPlotterC(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -237,7 +237,7 @@ class GrDataPlotterF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -265,7 +265,7 @@ class GrDataPlotterConst(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -304,7 +304,7 @@ class GrDataPlotterPsdC(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.fft_size() @@ -337,7 +337,7 @@ class GrDataPlotterPsdF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.fft_size() @@ -367,7 +367,7 @@ class GrTimeRasterF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.num_cols() @@ -396,7 +396,7 @@ class GrTimeRasterB(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_b([]) + return blocks.vector_source_b([]) def get_npts(self): self._npts = self.snk.num_cols() diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py deleted file mode 100755 index 6de5d5fc9f..0000000000 --- a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -# -# This program tests mixed python and c++ ctrlport exports in a single app -# - -import Ice -import sys, time, random, numpy -from gnuradio import gr, gr_unittest - -from gnuradio.ctrlport import GNURadio -from gnuradio import ctrlport -import os - -def get1(): - return "success" - -def get2(): - return "failure" - -class inc_class: - def __init__(self): - self.val = 1 - def pp(self): - self.val = self.val+1 - return self.val - -get3 = inc_class() - -def get4(): - random.seed(0) - rv = random.random() - return rv - -def get5(): - numpy.random.seed(0) - samp_t = numpy.random.randn(24)+1j*numpy.random.randn(24); - samp_f = numpy.fft.fft(samp_t); - log_pow_f = 20*numpy.log10(numpy.abs(samp_f)) - rv = list(log_pow_f) - return rv; - -def get6(): - numpy.random.seed(0) - samp_t = numpy.random.randn(1024)+1j*numpy.random.randn(1024); - rv = list(samp_t) - return rv; - -class test_cpp_py_binding(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - os.environ['GR_CONF_CONTROLPORT_ON'] = 'True' - - def tearDown(self): - self.tb = None - - def test_001(self): - v1 = gr.RPC_get_string("pyland", "v1", "unit_1_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - v1.activate(get1) - - v2 = gr.RPC_get_string("pyland", "v2", "unit_2_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - v2.activate(get2) - - v3 = gr.RPC_get_int("pyland", "v3", "unit_3_int", - "Python Exported Int", 0, 100, 1, - gr.DISPNULL) - v3.activate(get3.pp) - - v4 = gr.RPC_get_double("pyland", "time", "unit_4_time_double", - "Python Exported Double", 0, 1000, 1, - gr.DISPNULL) - v4.activate(get4) - - v5 = gr.RPC_get_vector_float("pyland", "fvec", "unit_5_float_vector", - "Python Exported Float Vector", [], [], [], - gr.DISPTIME | gr.DISPOPTCPLX) - v5.activate(get5) - - v6 = gr.RPC_get_vector_gr_complex("pyland", "cvec", "unit_6_gr_complex_vector", - "Python Exported Complex Vector", [], [], [], - gr.DISPXY | gr.DISPOPTSCATTER) - v6.activate(get6) - - # print some variables locally - val = get1() - rval = v1.get() - self.assertEqual(val, rval) - - val = get2() - rval = v2.get() - self.assertEqual(val, rval) - - val = get3.pp() - rval = v3.get() - self.assertEqual(val+1, rval) - - val = get4() - rval = v4.get() - self.assertEqual(val, rval) - - val = get5() - rval = v5.get() - self.assertComplexTuplesAlmostEqual(val, rval, 5) - - val = get6() - rval = v6.get() - self.assertComplexTuplesAlmostEqual(val, rval, 5) - - def test_002(self): - data = range(1,9) - - self.src = gr.vector_source_c(data) - self.p1 = gr.ctrlport_probe_c("aaa","C++ exported variable") - self.p2 = gr.ctrlport_probe_c("bbb","C++ exported variable") - probe_name = self.p2.alias() - - self.tb.connect(self.src, self.p1) - self.tb.connect(self.src, self.p2) - self.tb.start() - - # Probes return complex values as list of floats with re, im - # Imaginary parts of this data set are 0. - expected_result = [1, 0, 2, 0, 3, 0, 4, 0, - 5, 0, 6, 0, 7, 0, 8, 0] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::bbb"]) - for name in ret.keys(): - result = ret[name].value - self.assertEqual(result, expected_result) - - self.tb.stop() - -if __name__ == '__main__': - gr_unittest.run(test_cpp_py_binding, "test_cpp_py_binding.xml") - diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py deleted file mode 100755 index 4ca120099c..0000000000 --- a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -# -# This program tests mixed python and c++ GRCP sets in a single app -# - -import Ice -import sys, time, random, numpy -from gnuradio import gr, gr_unittest - -from gnuradio.ctrlport import GNURadio -from gnuradio import ctrlport -import os - -class inc_class: - def __init__(self,val): - self.val = val; - - def _get(self): - #print "returning get (val = %s)"%(str(self.val)); - return self.val; - - def _set(self,val): - #print "updating val to %s"%(str(val)); - self.val = val; - return; - -getset1 = inc_class(10); -getset2 = inc_class(100.0); -getset3 = inc_class("test"); - -class test_cpp_py_binding_set(gr_unittest.TestCase): - def setUp(self): - self.tb = gr.top_block() - os.environ['GR_CONF_CONTROLPORT_ON'] = 'True' - - def tearDown(self): - self.tb = None - - def test_001(self): - - g1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", - "Python Exported Int", 0, 100, 10, - gr.DISPNULL) - g1.activate(getset1._get) - s1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", - "Python Exported Int", 0, 100, 10, - gr.DISPNULL) - s1.activate(getset1._set) - time.sleep(0.01) - - # test int variables - getset1._set(21) - val = getset1._get() - rval = g1.get() - self.assertEqual(val, rval) - - g2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", - "Python Exported Float", -100, 1000.0, 100.0, - gr.DISPNULL) - g2.activate(getset2._get) - s2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", - "Python Exported Float", -100, 1000.0, 100.0, - gr.DISPNULL) - s2.activate(getset2._set) - time.sleep(0.01) - - # test float variables - getset2._set(123.456) - val = getset2._get() - rval = g2.get() - self.assertAlmostEqual(val, rval, 4) - - g3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - g3.activate(getset3._get) - s3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - s3.activate(getset3._set) - time.sleep(0.01) - - # test string variables - getset3._set("third test") - val = getset3._get() - rval = g3.get() - self.assertEqual(val, rval) - - - def test_002(self): - data = range(1, 10) - - self.src = gr.vector_source_c(data, True) - self.p = gr.nop(gr.sizeof_gr_complex) - self.p.set_ctrlport_test(0); - probe_info = self.p.alias() - - self.tb.connect(self.src, self.p) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - self.tb.start() - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get all exported knobs - key_name_test = probe_info+"::test" - ret = radio.get([key_name_test,]) - - ret[key_name_test].value = 10 - radio.set({key_name_test: ret[key_name_test]}) - - ret = radio.get([]) - result_test = ret[key_name_test].value - self.assertEqual(result_test, 10) - - self.tb.stop() - self.tb.wait() - -if __name__ == '__main__': - gr_unittest.run(test_cpp_py_binding_set, "test_cpp_py_binding_set.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py deleted file mode 100644 index 2c8cba5439..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py +++ /dev/null @@ -1,255 +0,0 @@ -# -# Copyright 2011-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. -# - -from gnuradio import gr, gr_unittest -import pmt -import numpy - -class add_2_f32_1_f32(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "add 2 f32", - in_sig = [numpy.float32, numpy.float32], - out_sig = [numpy.float32], - ) - - def work(self, input_items, output_items): - output_items[0][:] = input_items[0] + input_items[1] - return len(output_items[0]) - -class add_2_fc32_1_fc32(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "add 2 fc32", - in_sig = [numpy.complex64, numpy.complex64], - out_sig = [numpy.complex64], - ) - - def work(self, input_items, output_items): - output_items[0][:] = input_items[0] + input_items[1] - return len(output_items[0]) - -class convolve(gr.sync_block): - """ - A demonstration using block history to properly perform a convolution. - """ - def __init__(self): - gr.sync_block.__init__( - self, - name = "convolve", - in_sig = [numpy.float32], - out_sig = [numpy.float32] - ) - self._taps = [1, 0, 0, 0] - self.set_history(len(self._taps)) - - def work(self, input_items, output_items): - output_items[0][:] = numpy.convolve(input_items[0], self._taps, mode='valid') - return len(output_items[0]) - -class decim2x(gr.decim_block): - def __init__(self): - gr.decim_block.__init__( - self, - name = "decim2x", - in_sig = [numpy.float32], - out_sig = [numpy.float32], - decim = 2 - ) - - def work(self, input_items, output_items): - output_items[0][:] = input_items[0][::2] - return len(output_items[0]) - -class interp2x(gr.interp_block): - def __init__(self): - gr.interp_block.__init__( - self, - name = "interp2x", - in_sig = [numpy.float32], - out_sig = [numpy.float32], - interp = 2 - ) - - def work(self, input_items, output_items): - output_items[0][1::2] = input_items[0] - output_items[0][::2] = input_items[0] - return len(output_items[0]) - -class tag_source(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "tag source", - in_sig = None, - out_sig = [numpy.float32], - ) - - def work(self, input_items, output_items): - num_output_items = len(output_items[0]) - - #put code here to fill the output items... - - #make a new tag on the middle element every time work is called - count = self.nitems_written(0) + num_output_items/2 - key = pmt.string_to_symbol("example_key") - value = pmt.string_to_symbol("example_value") - self.add_item_tag(0, count, key, value) - - return num_output_items - -class tag_sink(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "tag sink", - in_sig = [numpy.float32], - out_sig = None, - ) - self.key = None - - def work(self, input_items, output_items): - num_input_items = len(input_items[0]) - - #put code here to process the input items... - - #print all the tags received in this work call - nread = self.nitems_read(0) - tags = self.get_tags_in_range(0, nread, nread+num_input_items) - for tag in tags: - #print tag.offset - #print pmt.symbol_to_string(tag.key) - #print pmt.symbol_to_string(tag.value) - self.key = pmt.symbol_to_string(tag.key) - - return num_input_items - -class fc32_to_f32_2(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "fc32_to_f32_2", - in_sig = [numpy.complex64], - out_sig = [(numpy.float32, 2)], - ) - - def work(self, input_items, output_items): - output_items[0][::,0] = numpy.real(input_items[0]) - output_items[0][::,1] = numpy.imag(input_items[0]) - return len(output_items[0]) - -class vector_to_stream(gr.interp_block): - def __init__(self, itemsize, nitems_per_block): - gr.interp_block.__init__( - self, - name = "vector_to_stream", - in_sig = [(itemsize, nitems_per_block)], - out_sig = [itemsize], - interp = nitems_per_block - ) - self.block_size = nitems_per_block - - def work(self, input_items, output_items): - n = 0 - for i in xrange(len(input_items[0])): - for j in xrange(self.block_size): - output_items[0][n] = input_items[0][i][j] - n += 1 - - return len(output_items[0]) - -class test_block_gateway(gr_unittest.TestCase): - - def test_add_f32(self): - tb = gr.top_block() - src0 = gr.vector_source_f([1, 3, 5, 7, 9], False) - src1 = gr.vector_source_f([0, 2, 4, 6, 8], False) - adder = add_2_f32_1_f32() - sink = gr.vector_sink_f() - tb.connect((src0, 0), (adder, 0)) - tb.connect((src1, 0), (adder, 1)) - tb.connect(adder, sink) - tb.run() - self.assertEqual(sink.data(), (1, 5, 9, 13, 17)) - - def test_add_fc32(self): - tb = gr.top_block() - src0 = gr.vector_source_c([1, 3j, 5, 7j, 9], False) - src1 = gr.vector_source_c([0, 2j, 4, 6j, 8], False) - adder = add_2_fc32_1_fc32() - sink = gr.vector_sink_c() - tb.connect((src0, 0), (adder, 0)) - tb.connect((src1, 0), (adder, 1)) - tb.connect(adder, sink) - tb.run() - self.assertEqual(sink.data(), (1, 5j, 9, 13j, 17)) - - def test_convolve(self): - tb = gr.top_block() - src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) - cv = convolve() - sink = gr.vector_sink_f() - tb.connect(src, cv, sink) - tb.run() - self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8)) - - def test_decim2x(self): - tb = gr.top_block() - src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) - d2x = decim2x() - sink = gr.vector_sink_f() - tb.connect(src, d2x, sink) - tb.run() - self.assertEqual(sink.data(), (1, 3, 5, 7)) - - def test_interp2x(self): - tb = gr.top_block() - src = gr.vector_source_f([1, 3, 5, 7, 9], False) - i2x = interp2x() - sink = gr.vector_sink_f() - tb.connect(src, i2x, sink) - tb.run() - self.assertEqual(sink.data(), (1, 1, 3, 3, 5, 5, 7, 7, 9, 9)) - - def test_tags(self): - src = tag_source() - sink = tag_sink() - head = gr.head(gr.sizeof_float, 50000) #should be enough items to get a tag through - tb = gr.top_block() - tb.connect(src, head, sink) - tb.run() - self.assertEqual(sink.key, "example_key") - - def test_fc32_to_f32_2(self): - tb = gr.top_block() - src = gr.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False) - convert = fc32_to_f32_2() - v2s = vector_to_stream(numpy.float32, 2) - sink = gr.vector_sink_f() - tb.connect(src, convert, v2s, sink) - tb.run() - self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) - -if __name__ == '__main__': - gr_unittest.run(test_block_gateway, "test_block_gateway.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py deleted file mode 100755 index 68c8e451f3..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009,2010 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. -# - -from gnuradio import gr, gr_unittest - -class test_copy(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_copy (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - src = gr.vector_source_b(src_data) - op = gr.copy(gr.sizeof_char) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - dst_data = dst.data() - self.assertEqual(expected_result, dst_data) - - def test_copy_drop (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - expected_result = () - src = gr.vector_source_b(src_data) - op = gr.copy(gr.sizeof_char) - op.set_enabled(False) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - dst_data = dst.data() - self.assertEqual(expected_result, dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_copy, "test_copy.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py b/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py deleted file mode 100644 index 4d2555cc4d..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011,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. -# - -from gnuradio import gr, gr_unittest -import ctypes - -class test_endian_swap (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = [1,2,3,4] - expected_result = [256, 512, 768, 1024]; - - src = gr.vector_source_s(src_data) - op = gr.endian_swap(2) - dst = gr.vector_sink_s() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data = [1,2,3,4] - expected_result = [16777216, 33554432, 50331648, 67108864]; - - src = gr.vector_source_i(src_data) - op = gr.endian_swap(4) - dst = gr.vector_sink_i() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_endian_swap, "test_endian_swap.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_head.py b/gnuradio-core/src/python/gnuradio/gr/qa_head.py deleted file mode 100755 index d7cb354dcb..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_head.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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. -# - -from gnuradio import gr, gr_unittest - -class test_head (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_head (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - expected_result = (1, 2, 3, 4) - src1 = gr.vector_source_i (src_data) - op = gr.head (gr.sizeof_int, 4) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op) - self.tb.connect (op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_head, "test_head.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py deleted file mode 100755 index 9ba48599af..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py +++ /dev/null @@ -1,397 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gr_unittest -import numpy - -class add_ff(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "add_ff", - in_sig = [numpy.float32, numpy.float32], - out_sig = [numpy.float32], - ) - - def work(self, input_items, output_items): - output_items[0][:] = input_items[0] + input_items[1] - return len(output_items[0]) - -class multiply_const_ff(gr.sync_block): - def __init__(self, k): - gr.sync_block.__init__( - self, - name = "multiply_ff", - in_sig = [numpy.float32], - out_sig = [numpy.float32], - ) - self.k = k - - def work(self, input_items, output_items): - output_items[0][:] = map(lambda x: self.k*x, input_items[0]) - return len(output_items[0]) - -class test_hier_block2(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_001_make(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - self.assertEqual("test_block", hblock.name()) - self.assertEqual(1, hblock.input_signature().max_streams()) - self.assertEqual(1, hblock.output_signature().min_streams()) - self.assertEqual(1, hblock.output_signature().max_streams()) - self.assertEqual(gr.sizeof_int, hblock.output_signature().sizeof_stream_item(0)) - - def test_002_connect_input(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - - def test_004_connect_output(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(nop1, hblock) - - def test_005_connect_output_in_use(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) - hblock.connect(nop1, hblock) - self.assertRaises(ValueError, - lambda: hblock.connect(nop2, hblock)) - - def test_006_connect_invalid_src_port_neg(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - self.assertRaises(ValueError, - lambda: hblock.connect((hblock, -1), nop1)) - - def test_005_connect_invalid_src_port_exceeds(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - self.assertRaises(ValueError, - lambda: hblock.connect((hblock, 1), nop1)) - - def test_007_connect_invalid_dst_port_neg(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) - self.assertRaises(ValueError, - lambda: hblock.connect(nop1, (nop2, -1))) - - def test_008_connect_invalid_dst_port_exceeds(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.null_sink(gr.sizeof_int) - nop2 = gr.null_sink(gr.sizeof_int) - self.assertRaises(ValueError, - lambda: hblock.connect(nop1, (nop2, 1))) - - def test_009_check_topology(self): - hblock = gr.top_block("test_block") - hblock.check_topology(0, 0) - - def test_010_run(self): - expected = (1.0, 2.0, 3.0, 4.0) - hblock = gr.top_block("test_block") - src = gr.vector_source_f(expected, False) - sink1 = gr.vector_sink_f() - sink2 = gr.vector_sink_f() - hblock.connect(src, sink1) - hblock.connect(src, sink2) - hblock.run() - actual1 = sink1.data() - actual2 = sink2.data() - self.assertEquals(expected, actual1) - self.assertEquals(expected, actual2) - - def test_012_disconnect_input(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - hblock.disconnect(hblock, nop1) - - def test_013_disconnect_input_not_connected(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - self.assertRaises(ValueError, - lambda: hblock.disconnect(hblock, nop2)) - - def test_014_disconnect_input_neg(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - self.assertRaises(ValueError, - lambda: hblock.disconnect((hblock, -1), nop1)) - - def test_015_disconnect_input_exceeds(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - self.assertRaises(ValueError, - lambda: hblock.disconnect((hblock, 1), nop1)) - - def test_016_disconnect_output(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(nop1, hblock) - hblock.disconnect(nop1, hblock) - - def test_017_disconnect_output_not_connected(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) - hblock.connect(nop1, hblock) - self.assertRaises(ValueError, - lambda: hblock.disconnect(nop2, hblock)) - - def test_018_disconnect_output_neg(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(hblock, nop1) - self.assertRaises(ValueError, - lambda: hblock.disconnect(nop1, (hblock, -1))) - - def test_019_disconnect_output_exceeds(self): - hblock = gr.hier_block2("test_block", - gr.io_signature(1,1,gr.sizeof_int), - gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - hblock.connect(nop1, hblock) - self.assertRaises(ValueError, - lambda: hblock.disconnect(nop1, (hblock, 1))) - - def test_020_run(self): - hblock = gr.top_block("test_block") - data = (1.0, 2.0, 3.0, 4.0) - src = gr.vector_source_f(data, False) - dst = gr.vector_sink_f() - hblock.connect(src, dst) - hblock.run() - self.assertEquals(data, dst.data()) - - def test_021_connect_single(self): - hblock = gr.top_block("test_block") - blk = gr.hier_block2("block", - gr.io_signature(0, 0, 0), - gr.io_signature(0, 0, 0)) - hblock.connect(blk) - - def test_022_connect_single_with_ports(self): - hblock = gr.top_block("test_block") - blk = gr.hier_block2("block", - gr.io_signature(1, 1, 1), - gr.io_signature(1, 1, 1)) - self.assertRaises(ValueError, - lambda: hblock.connect(blk)) - - def test_023_connect_single_twice(self): - hblock = gr.top_block("test_block") - blk = gr.hier_block2("block", - gr.io_signature(0, 0, 0), - gr.io_signature(0, 0, 0)) - hblock.connect(blk) - self.assertRaises(ValueError, - lambda: hblock.connect(blk)) - - def test_024_disconnect_single(self): - hblock = gr.top_block("test_block") - blk = gr.hier_block2("block", - gr.io_signature(0, 0, 0), - gr.io_signature(0, 0, 0)) - hblock.connect(blk) - hblock.disconnect(blk) - - def test_025_disconnect_single_not_connected(self): - hblock = gr.top_block("test_block") - blk = gr.hier_block2("block", - gr.io_signature(0, 0, 0), - gr.io_signature(0, 0, 0)) - self.assertRaises(ValueError, - lambda: hblock.disconnect(blk)) - - def test_026_run_single(self): - expected_data = (1.0,) - tb = gr.top_block("top_block") - hb = gr.hier_block2("block", - gr.io_signature(0, 0, 0), - gr.io_signature(0, 0, 0)) - src = gr.vector_source_f(expected_data) - dst = gr.vector_sink_f() - hb.connect(src, dst) - tb.connect(hb) - tb.run() - self.assertEquals(expected_data, dst.data()) - - def test_027a_internally_unconnected_input(self): - tb = gr.top_block() - hb = gr.hier_block2("block", - gr.io_signature(1, 1, 1), - gr.io_signature(1, 1, 1)) - hsrc = gr.vector_source_b([1,]) - hb.connect(hsrc, hb) # wire output internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() - tb.connect(src, hb, dst) # hb's input is not connected internally - self.assertRaises(RuntimeError, - lambda: tb.run()) - - def test_027b_internally_unconnected_output(self): - tb = gr.top_block() - - hb = gr.hier_block2("block", - gr.io_signature(1, 1, 1), - gr.io_signature(1, 1, 1)) - hdst = gr.vector_sink_b() - hb.connect(hb, hdst) # wire input internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() - tb.connect(src, hb, dst) # hb's output is not connected internally - self.assertRaises(RuntimeError, - lambda: tb.run()) - - def test_027c_fully_unconnected_output(self): - tb = gr.top_block() - hb = gr.hier_block2("block", - gr.io_signature(1, 1, 1), - gr.io_signature(1, 1, 1)) - hsrc = gr.vector_sink_b() - hb.connect(hb, hsrc) # wire input internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() - tb.connect(src, hb) # hb's output is not connected internally or externally - self.assertRaises(RuntimeError, - lambda: tb.run()) - - def test_027d_fully_unconnected_input(self): - tb = gr.top_block() - hb = gr.hier_block2("block", - gr.io_signature(1, 1, 1), - gr.io_signature(1, 1, 1)) - hdst = gr.vector_source_b([1,]) - hb.connect(hdst, hb) # wire output internally - dst = gr.vector_sink_b() - tb.connect(hb, dst) # hb's input is not connected internally or externally - self.assertRaises(RuntimeError, - lambda: tb.run()) - - def test_028_singleton_reconfigure(self): - tb = gr.top_block() - hb = gr.hier_block2("block", - gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0)) - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() - hb.connect(src, dst) - tb.connect(hb) # Singleton connect - tb.lock() - tb.disconnect_all() - tb.connect(src, dst) - tb.unlock() - - def test_029_singleton_disconnect(self): - tb = gr.top_block() - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() - tb.connect(src, dst) - tb.disconnect(src) # Singleton disconnect - tb.connect(src, dst) - tb.run() - self.assertEquals(dst.data(), (1,)) - - def test_030_nested_input(self): - tb = gr.top_block() - src = gr.vector_source_b([1,]) - hb1 = gr.hier_block2("hb1", - gr.io_signature(1, 1, gr.sizeof_char), - gr.io_signature(0, 0, 0)) - hb2 = gr.hier_block2("hb2", - gr.io_signature(1, 1, gr.sizeof_char), - gr.io_signature(0, 0, 0)) - dst = gr.vector_sink_b() - tb.connect(src, hb1) - hb1.connect(hb1, hb2) - hb2.connect(hb2, gr.kludge_copy(gr.sizeof_char), dst) - tb.run() - self.assertEquals(dst.data(), (1,)) - - def test_031_multiple_internal_inputs(self): - tb = gr.top_block() - src = gr.vector_source_f([1.0,]) - hb = gr.hier_block2("hb", - gr.io_signature(1, 1, gr.sizeof_float), - gr.io_signature(1, 1, gr.sizeof_float)) - m1 = multiply_const_ff(1.0) - m2 = multiply_const_ff(2.0) - add = add_ff() - hb.connect(hb, m1) # m1 is connected to hb external input #0 - hb.connect(hb, m2) # m2 is also connected to hb external input #0 - hb.connect(m1, (add, 0)) - hb.connect(m2, (add, 1)) - hb.connect(add, hb) # add is connected to hb external output #0 - dst = gr.vector_sink_f() - tb.connect(src, hb, dst) - tb.run() - self.assertEquals(dst.data(), (3.0,)) - - def test_032_nested_multiple_internal_inputs(self): - tb = gr.top_block() - src = gr.vector_source_f([1.0,]) - hb = gr.hier_block2("hb", - gr.io_signature(1, 1, gr.sizeof_float), - gr.io_signature(1, 1, gr.sizeof_float)) - hb2 = gr.hier_block2("hb", - gr.io_signature(1, 1, gr.sizeof_float), - gr.io_signature(1, 1, gr.sizeof_float)) - - m1 = multiply_const_ff(1.0) - m2 = multiply_const_ff(2.0) - add = add_ff() - hb2.connect(hb2, m1) # m1 is connected to hb2 external input #0 - hb2.connect(hb2, m2) # m2 is also connected to hb2 external input #0 - hb2.connect(m1, (add, 0)) - hb2.connect(m2, (add, 1)) - hb2.connect(add, hb2) # add is connected to hb2 external output #0 - hb.connect(hb, hb2, hb) # hb as hb2 as nested internal block - dst = gr.vector_sink_f() - tb.connect(src, hb, dst) - tb.run() - self.assertEquals(dst.data(), (3.0,)) - - -if __name__ == "__main__": - gr_unittest.run(test_hier_block2, "test_hier_block2.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py deleted file mode 100755 index 2a3aa44b1b..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2010 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. -# - -from gnuradio import gr, gr_unittest -import math -import random - - -class test_kludge_copy(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - self.rng = random.Random() - self.rng.seed(0) - - def tearDown(self): - del self.tb - del self.rng - - def make_random_int_tuple(self, L): - result = [] - for x in range(L): - result.append(self.rng.randint(int(-1e9), int(+1e9))) - return tuple(result) - - - def test_001(self): - # 1 input stream; 1 output stream - src0_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - self.tb.connect(src0, op, dst0) - self.tb.run() - dst0_data = dst0.data() - self.assertEqual(src0_data, dst0_data) - - def test_002(self): - # 2 input streams; 2 output streams - src0_data = self.make_random_int_tuple(16000) - src1_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - src1 = gr.vector_source_i(src1_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - dst1 = gr.vector_sink_i() - self.tb.connect(src0, (op, 0), dst0) - self.tb.connect(src1, (op, 1), dst1) - self.tb.run() - dst0_data = dst0.data() - dst1_data = dst1.data() - self.assertEqual(src0_data, dst0_data) - self.assertEqual(src1_data, dst1_data) - - # Note: this is disabled due to triggering bug in ticket:181 - # It only occurs with new top block code - def xtest_003(self): - # number of input streams != number of output streams - src0_data = self.make_random_int_tuple(16000) - src1_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - src1 = gr.vector_source_i(src1_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - dst1 = gr.vector_sink_i() - self.tb.connect(src0, (op, 0), dst0) - self.tb.connect(src1, (op, 1)) - self.assertRaises(ValueError, self.tb.run) - -if __name__ == '__main__': - gr_unittest.run(test_kludge_copy, "test_kludge_copy.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py b/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py deleted file mode 100644 index 51f8ede4db..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -try: import pmt -except: from gruel import pmt -import numpy -import time - -# Simple block to generate messages -class message_generator(gr.sync_block): - def __init__(self, msg_list, msg_interval): - gr.sync_block.__init__( - self, - name = "message generator", - in_sig = [numpy.float32], - out_sig = None - ) - self.msg_list = msg_list - self.msg_interval = msg_interval - self.msg_ctr = 0 - self.message_port_register_out(pmt.intern('out_port')) - - - def work(self, input_items, output_items): - inLen = len(input_items[0]) - while self.msg_ctr < len(self.msg_list) and \ - (self.msg_ctr * self.msg_interval) < \ - (self.nitems_read(0) + inLen): - self.message_port_pub(pmt.intern('out_port'), - self.msg_list[self.msg_ctr]) - self.msg_ctr += 1 - return inLen - -# Simple block to consume messages -class message_consumer(gr.sync_block): - def __init__(self): - gr.sync_block.__init__( - self, - name = "message consumer", - in_sig = None, - out_sig = None - ) - self.msg_list = [] - self.message_port_register_in(pmt.intern('in_port')) - self.set_msg_handler(pmt.intern('in_port'), - self.handle_msg) - - def handle_msg(self, msg): - # Create a new PMT from long value and put in list - self.msg_list.append(pmt.from_long(pmt.to_long(msg))) - -class test_python_message_passing(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000(self): - num_msgs = 10 - msg_interval = 1000 - msg_list = [] - for i in range(num_msgs): - msg_list.append(pmt.from_long(i)) - - # Create vector source with dummy data to trigger messages - src_data = [] - for i in range(num_msgs*msg_interval): - src_data.append(float(i)) - src = gr.vector_source_f(src_data, False) - msg_gen = message_generator(msg_list, msg_interval) - msg_cons = message_consumer() - - # Connect vector source to message gen - self.tb.connect(src, msg_gen) - - # Connect message generator to message consumer - self.tb.msg_connect(msg_gen, 'out_port', msg_cons, 'in_port') - - # Verify that the messgae port query functions work - self.assertEqual(pmt.symbol_to_string(pmt.vector_ref( - msg_gen.message_ports_out(), 0)), 'out_port') - self.assertEqual(pmt.symbol_to_string(pmt.vector_ref( - msg_cons.message_ports_in(), 0)), 'in_port') - - # Run to verify message passing - self.tb.start() - - # Wait for all messages to be sent - while msg_gen.msg_ctr < num_msgs: - time.sleep(0.5) - self.tb.stop() - self.tb.wait() - - # Verify that the message consumer got all the messages - self.assertEqual(num_msgs, len(msg_cons.msg_list)) - for i in range(num_msgs): - self.assertTrue(pmt.equal(msg_list[i], msg_cons.msg_list[i])) - -if __name__ == '__main__': - gr_unittest.run(test_python_message_passing, - 'test_python_message_passing.xml') diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py deleted file mode 100755 index 1e730398c7..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 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. -# - -from gnuradio import gr, gr_unittest - -class test_skiphead (gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - self.src_data = [int(x) for x in range(65536)] - - def tearDown(self): - self.tb = None - - def test_skip_0(self): - skip_cnt = 0 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_1(self): - skip_cnt = 1 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_1023(self): - skip_cnt = 1023 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_6339(self): - skip_cnt = 6339 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_12678(self): - skip_cnt = 12678 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_all(self): - skip_cnt = len(self.src_data) - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_skiphead, "test_skiphead.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py deleted file mode 100755 index acc06dfded..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_vector_insert(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = [float(x) for x in range(16)] - expected_result = tuple(src_data) - - period = 9177; - offset = 0; - - src = gr.null_source(1) - head = gr.head(1, 10000000); - ins = gr.vector_insert_b([1], period, offset); - dst = gr.vector_sink_b() - - self.tb.connect(src, head, ins, dst) - self.tb.run() - result_data = dst.data() - - for i in range(10000): - if(i%period == offset): - self.assertEqual(1, result_data[i]) - else: - self.assertEqual(0, result_data[i]) - -if __name__ == '__main__': - gr_unittest.run(test_vector_insert, "test_vector_insert.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py deleted file mode 100644 index 12f4be5898..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_vector_map(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_reversing(self): - # Chunk data in blocks of N and reverse the block contents. - N = 5 - src_data = range(0, 20) - expected_result = [] - for i in range(N-1, len(src_data), N): - for j in range(0, N): - expected_result.append(1.0*(i-j)) - mapping = [list(reversed([(0, i) for i in range(0, N)]))] - src = gr.vector_source_f(src_data, False, N) - vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping) - dst = gr.vector_sink_f(N) - self.tb.connect(src, vmap, dst) - self.tb.run() - result_data = list(dst.data()) - self.assertEqual(expected_result, result_data) - - def test_vector_to_streams(self): - # Split an input vector into N streams. - N = 5 - M = 20 - src_data = range(0, M) - expected_results = [] - for n in range(0, N): - expected_results.append(range(n, M, N)) - mapping = [[(0, n)] for n in range(0, N)] - src = gr.vector_source_f(src_data, False, N) - vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping) - dsts = [gr.vector_sink_f(1) for n in range(0, N)] - self.tb.connect(src, vmap) - for n in range(0, N): - self.tb.connect((vmap, n), dsts[n]) - self.tb.run() - for n in range(0, N): - result_data = list(dsts[n].data()) - self.assertEqual(expected_results[n], result_data) - - def test_interleaving(self): - # Takes 3 streams (a, b and c) - # Outputs 2 streams. - # First (d) is interleaving of a and b. - # Second (e) is interleaving of a and b and c. c is taken in - # chunks of 2 which are reversed. - A = (1, 2, 3, 4, 5) - B = (11, 12, 13, 14, 15) - C = (99, 98, 97, 96, 95, 94, 93, 92, 91, 90) - expected_D = (1, 11, 2, 12, 3, 13, 4, 14, 5, 15) - expected_E = (1, 11, 98, 99, 2, 12, 96, 97, 3, 13, 94, 95, - 4, 14, 92, 93, 5, 15, 90, 91) - mapping = [[(0, 0), (1, 0)], # mapping to produce D - [(0, 0), (1, 0), (2, 1), (2, 0)], # mapping to produce E - ] - srcA = gr.vector_source_f(A, False, 1) - srcB = gr.vector_source_f(B, False, 1) - srcC = gr.vector_source_f(C, False, 2) - vmap = gr.vector_map(gr.sizeof_int, (1, 1, 2), mapping) - dstD = gr.vector_sink_f(2) - dstE = gr.vector_sink_f(4) - self.tb.connect(srcA, (vmap, 0)) - self.tb.connect(srcB, (vmap, 1)) - self.tb.connect(srcC, (vmap, 2)) - self.tb.connect((vmap, 0), dstD) - self.tb.connect((vmap, 1), dstE) - self.tb.run() - self.assertEqual(expected_D, dstD.data()) - self.assertEqual(expected_E, dstE.data()) - - - -if __name__ == '__main__': - gr_unittest.run(test_vector_map, "test_vector_map.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py deleted file mode 100755 index 64cbbe72a3..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2010 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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_vector_sink_source(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = [float(x) for x in range(16)] - expected_result = tuple(src_data) - - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() - - self.tb.connect(src, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - def test_002(self): - src_data = [float(x) for x in range(16)] - expected_result = tuple(src_data) - - src = gr.vector_source_f(src_data, False, 2) - dst = gr.vector_sink_f(2) - - self.tb.connect(src, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - def test_003(self): - src_data = [float(x) for x in range(16)] - expected_result = tuple(src_data) - self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data, False, 3)) - -if __name__ == '__main__': - gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml") - diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt index ef58cf9ef5..0c30b15a1d 100644 --- a/gnuradio-core/src/tests/CMakeLists.txt +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -43,7 +43,6 @@ link_directories(${LOG4CPP_LIBRARY_DIRS}) # Build benchmarks and non-registered tests ######################################################################## set(tests_not_run #single source per test - test_runtime.cc test_general.cc test_vmcircbuf.cc ) diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index fb45cbf8f4..f1fbce4e05 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -24,7 +24,6 @@ #include <cppunit/XmlOutputter.h> #include <gr_unittests.h> -#include <qa_runtime.h> #include <qa_general.h> // FIXME add atsc back in. @@ -36,7 +35,6 @@ main (int argc, char **argv) std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); runner.setOutputter(xmlout); diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py index 2664c136c6..e0abb8b304 100755 --- a/gnuradio-core/src/tests/test_buffers.py +++ b/gnuradio-core/src/tests/test_buffers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gru from gnuradio import audio +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -68,7 +69,7 @@ class my_graph(gr.top_block): nsamples=int(sample_rate * seconds) #1 seconds data = sig_source_f(sample_rate, 350, ampl, nsamples) - src0 = gr.vector_source_f(data) + src0 = blocks.vector_source_f(data) # gr.test (const std::string &name=std::string("gr_test"), # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc deleted file mode 100644 index bd5378332e..0000000000 --- a/gnuradio-core/src/tests/test_runtime.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2010,2011 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 <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> - -#include <gr_unittests.h> -#include <qa_runtime.h> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest (qa_runtime::suite ()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run ("", false); - - return was_successful ? 0 : 1; -} |