diff options
author | Tom Rondeau | 2010-10-26 19:59:42 -0400 |
---|---|---|
committer | Tom Rondeau | 2010-10-26 19:59:42 -0400 |
commit | b22efee47c7d891a8c10b1493f20976534fdb751 (patch) | |
tree | 8a7f94b94b21c398def266058823561dc57e3f2b | |
parent | 2c544567f5f9322b51b26a32bdb6280ee12f16de (diff) | |
download | gnuradio-b22efee47c7d891a8c10b1493f20976534fdb751.tar.gz gnuradio-b22efee47c7d891a8c10b1493f20976534fdb751.tar.bz2 gnuradio-b22efee47c7d891a8c10b1493f20976534fdb751.zip |
Giving gr_block_detail a list of pmt tuples to hold item tagging information.
Adds ability to add new tags from a block.
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.cc | 8 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.h | 5 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block_detail.cc | 18 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block_detail.h | 7 |
4 files changed, 38 insertions, 0 deletions
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<gr_buffer_sptr> d_output; std::vector<uint64_t> d_n_items_read; std::vector<uint64_t> d_n_items_written; + std::list<pmt::pmt_t> d_item_tags; bool d_done; |