From b22efee47c7d891a8c10b1493f20976534fdb751 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 26 Oct 2010 19:59:42 -0400 Subject: Giving gr_block_detail a list of pmt tuples to hold item tagging information. Adds ability to add new tags from a block. --- gnuradio-core/src/lib/runtime/gr_block.cc | 8 ++++++++ gnuradio-core/src/lib/runtime/gr_block.h | 5 +++++ gnuradio-core/src/lib/runtime/gr_block_detail.cc | 18 ++++++++++++++++++ gnuradio-core/src/lib/runtime/gr_block_detail.h | 7 +++++++ 4 files changed, 38 insertions(+) (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 83cc58738..ed848e3ed 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -127,6 +127,14 @@ gr_block::n_items_written(unsigned int which_output) { return d_detail->n_items_written(which_output); } +void +gr_block::add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value) +{ + d_detail->add_item_tag(which_output, offset, key, value); +} + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 22e60da57..c4d639314 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -204,6 +204,11 @@ class gr_block : public gr_basic_block { // Return the number of items written on output stream which_output gr_uint64 n_items_written(unsigned int which_output); + void add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value); + + // ---------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 1f80fe2d4..656cdb13a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -138,3 +138,21 @@ gr_block_detail::_post(pmt::pmt_t msg) { d_tpb.insert_tail(msg); } + +void +gr_block_detail::add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value) +{ + if(pmt::pmt_is_symbol(key) == false) { + throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); + } + else { + pmt::pmt_t nitem = pmt::pmt_from_uint64(offset); + pmt::pmt_t stream = pmt::pmt_string_to_symbol("NULL"); + pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, stream, key, value); + d_item_tags.push_back(tuple); + + // need to add prunning routing + } +} diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index e830ddd47..6a8d94c72 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -101,6 +101,12 @@ class gr_block_detail { throw std::invalid_argument ("gr_block_detail::n_output_items"); return d_n_items_written[which_output]; } + + // Add an item tag tuple to list of tags + // -> is this just based on output stream? how to handle this... + void add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value); gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -114,6 +120,7 @@ class gr_block_detail { std::vector d_output; std::vector d_n_items_read; std::vector d_n_items_written; + std::list d_item_tags; bool d_done; -- cgit