diff options
author | Tom Rondeau | 2010-11-13 14:27:54 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-11-13 14:27:54 -0500 |
commit | 74d17ff495c97fbb9eb3bd3cacf08a8dcdf677b6 (patch) | |
tree | 74253ca9548759fe78773148d85ca9e3d9d978db /gnuradio-core/src/lib/general | |
parent | 7ca96ad8b48b3426b470e87042c8e982664f3b9b (diff) | |
download | gnuradio-74d17ff495c97fbb9eb3bd3cacf08a8dcdf677b6.tar.gz gnuradio-74d17ff495c97fbb9eb3bd3cacf08a8dcdf677b6.tar.bz2 gnuradio-74d17ff495c97fbb9eb3bd3cacf08a8dcdf677b6.zip |
Fixing how 1-to-1 annotator handles inputs to better test propagataion method.
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 7ecadcd2c..273f684ed 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -64,12 +64,16 @@ gr_annotator_1to1::general_work (int noutput_items, std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = nitems_read(0); - std::vector<pmt::pmt_t> all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); + uint64_t abs_N = 0; + int ninputs = ninput_items.size(); + for(int i = 0; i < ninputs; i++) { + abs_N = nitems_read(i); + std::vector<pmt::pmt_t> all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); - std::vector<pmt::pmt_t>::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); + std::vector<pmt::pmt_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 @@ -78,12 +82,16 @@ gr_annotator_1to1::general_work (int noutput_items, // 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 N + abs_N = nitems_read(0); uint64_t N = 10000; int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { abs_N++; - for(int i = 0; i < noutputs; i++) { + // 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 % N == 0) { pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); |