From e3b866883186ed2fbf125964a7ca3a3a3022675c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 17:02:10 -0400 Subject: Fix to get_tags_in_range. Returns proper list and handles times when list is empty. --- gnuradio-core/src/lib/runtime/gr_block.cc | 6 ++++-- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index a2b495867..f3e0ecc91 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -118,12 +118,14 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) } gr_uint64 -gr_block::n_items_read(unsigned int which_input) { +gr_block::n_items_read(unsigned int which_input) +{ return d_detail->n_items_read(which_input); } gr_uint64 -gr_block::n_items_written(unsigned int which_output) { +gr_block::n_items_written(unsigned int which_output) +{ return d_detail->n_items_written(which_output); } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index dbe49f37c..6a920f7c0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -164,19 +164,20 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, std::list found_items; std::list::iterator itr = d_item_tags.begin(); - gr_uint64 item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + gr_uint64 item_time; while(itr != d_item_tags.end()) { - if((item_time < start) && (item_time < end)) { - found_items.push_back(*itr); - } - - itr++; item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); // items are pushed onto list in sequential order; stop if we're past end if(item_time > end) { break; } + + if((item_time > start) && (item_time < end)) { + found_items.push_back(*itr); + } + + itr++; } return found_items; -- cgit