summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h22
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.h4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc22
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h19
-rw-r--r--gnuradio-core/src/lib/runtime/gr_random_annotator.cc2
7 files changed, 25 insertions, 48 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 94cf23103..b3e6b0edc 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -37,7 +37,7 @@ gr_block::gr_block (const std::string &name,
d_relative_rate (1.0),
d_history(1),
d_fixed_rate(false),
- d_tag_handling_method(TAGS_ALL_TO_ALL)
+ d_tag_handling_method(TPP_ALL_TO_ALL)
{
}
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index e278e8e9c..be39a7b95 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -25,12 +25,6 @@
#include <gr_basic_block.h>
-enum {
- TAGS_NONE = 0,
- TAGS_ALL_TO_ALL = 1,
- TAGS_ONE_TO_ONE = 2
-};
-
/*!
* \brief The abstract base class for all 'terminal' processing blocks.
* \ingroup base_blk
@@ -69,6 +63,12 @@ class gr_block : public gr_basic_block {
WORK_DONE = -1
};
+ enum TAG_PROPOGATION_POLICY {
+ TPP_DONT = 0,
+ TPP_ALL_TO_ALL = 1,
+ TPP_ONE_TO_ONE = 2
+ };
+
virtual ~gr_block ();
/*!
@@ -247,12 +247,10 @@ class gr_block : public gr_basic_block {
/*!
* \brief Adds a new tag onto the given output buffer.
*
- * This is a call-through method to gr_block_detail.
- *
* \param which_ouput an integer of which output stream to attach the tag
* \param abs_offset a uint64 number of the absolute item number
* assicated with the tag. Can get from nitems_written.
- * \param key a PMT symbol holding the key name
+ * \param key the tag key as a PMT symbol
* \param value any PMT holding any value for the given key
* \param srcid optional source ID specifier; defaults to PMT_F
*/
@@ -265,8 +263,7 @@ class gr_block : public gr_basic_block {
/*!
* \brief Given a [start,end), returns a vector of all tags in the range.
*
- * Pass-through function to gr_block_detail. Range of counts is from
- * start to end-1.
+ * Range of counts is from start to end-1.
*
* Tags are tuples of:
* (item count, source id, key, value)
@@ -283,8 +280,7 @@ class gr_block : public gr_basic_block {
* \brief Given a [start,end), returns a vector of all tags in the range
* with a given key.
*
- * Pass-through function to gr_block_detail. Range of counts is from
- * start to end-1.
+ * Range of counts is from start to end-1.
*
* Tags are tuples of:
* (item count, source id, key, value)
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
index 1888b8839..4f3ffc8dc 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
@@ -157,7 +157,7 @@ gr_block_detail::add_item_tag(unsigned int which_output,
const pmt_t &srcid)
{
if(!pmt_is_symbol(key)) {
- throw pmt_wrong_type("gr_block_detail::set_item_tag key", key);
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", key);
}
else {
// build tag tuple
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h
index 929e36fc8..5902d1559 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h
@@ -105,7 +105,7 @@ class gr_block_detail {
* \param which_ouput an integer of which output stream to attach the tag
* \param abs_offset a uint64 number of the absolute item number
* assicated with the tag. Can get from nitems_written.
- * \param key a PMT symbol holding the key name (i.e., a string)
+ * \param key the tag key as a PMT symbol
* \param value any PMT holding any value for the given key
* \param srcid a PMT source ID specifier
*/
@@ -146,7 +146,7 @@ class gr_block_detail {
* \param which_input an integer of which input stream to pull from
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
- * \param key a PMT symbol key to select only tags of this key
+ * \param key a PMT symbol to select only tags of this key
*/
std::vector<pmt::pmt_t> get_tags_in_range(unsigned int which_input,
uint64_t abs_start,
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index 3fc536845..c43f22895 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -295,9 +295,10 @@ gr_block_executor::run_one_iteration()
d_output_items[i] = d->output(i)->write_pointer();
// store number of items consumed so far on in stream
- std::vector<uint64_t> start_count;
+ std::vector<uint64_t> d_start_nitems_read;
+ d_start_nitems_read.resize(d->ninputs());
for (int i = 0; i < d->ninputs(); i++)
- start_count.push_back(d->nitems_read(i));
+ d_start_nitems_read[i] = d->nitems_read(i);
// Do the actual work of the block
int n = m->general_work (noutput_items, d_ninput_items,
@@ -305,20 +306,15 @@ gr_block_executor::run_one_iteration()
LOG(*d_log << " general_work: noutput_items = " << noutput_items
<< " result = " << n << std::endl);
- // store number of items consumed after work
- std::vector<uint64_t> end_count;
- for (int i = 0; i < d->ninputs (); i++)
- end_count.push_back(d->nitems_read(i));
-
// Move tags downstream
// if a sink, we don't need to move downstream;
// and do not bother if block uses TAGS_NONE attribute
- if(!d->sink_p() && (m->tag_handling_method() != TAGS_NONE)) {
+ if(!d->sink_p() && (m->tag_handling_method() != gr_block::TPP_DONT)) {
// every tag on every input propogates to everyone downstream
- if(m->tag_handling_method() == TAGS_ALL_TO_ALL) {
+ if(m->tag_handling_method() == gr_block::TPP_ALL_TO_ALL) {
for(int i = 0; i < d->ninputs(); i++) {
- std::vector<pmt::pmt_t> tuple = d->get_tags_in_range(i, start_count[i], end_count[i]);
+ std::vector<pmt::pmt_t> tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i));
std::vector<pmt::pmt_t>::iterator t;
for(t = tuple.begin(); t != tuple.end(); t++ ) {
for(int o = 0; o < d->noutputs(); o++)
@@ -330,10 +326,10 @@ gr_block_executor::run_one_iteration()
// tags from input i only go to output i
// this requires d->ninputs() == d->noutputs; this is checked when this
// type of tag-handling system is selected in gr_block_detail
- else if(m->tag_handling_method() == TAGS_ONE_TO_ONE) {
- if(d->ninputs() != d->noutputs()) {
+ else if(m->tag_handling_method() == gr_block::TPP_ONE_TO_ONE) {
+ if(d->ninputs() == d->noutputs()) {
for(int i = 0; i < d->ninputs(); i++) {
- std::vector<pmt::pmt_t> tuple = d->get_tags_in_range(i, start_count[i], end_count[i]);
+ std::vector<pmt::pmt_t> tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i));
std::vector<pmt::pmt_t>::iterator t;
for(t = tuple.begin(); t != tuple.end(); t++ ) {
d->output(i)->add_item_tag(*t);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index 5b8f21c94..5f11b4581 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -102,17 +102,6 @@ class gr_buffer {
std::deque<pmt::pmt_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
std::deque<pmt::pmt_t>::iterator get_tags_end() { return d_item_tags.end(); }
- bool get_tag(size_t n, pmt::pmt_t &t)
- {
- if(n < d_item_tags.size()) {
- t = d_item_tags[n];
- return true;
- }
- else {
- return false;
- }
- }
-
// -------------------------------------------------------------------------
private:
@@ -130,7 +119,8 @@ class gr_buffer {
std::vector<gr_buffer_reader *> d_readers;
boost::weak_ptr<gr_block> d_link; // block that writes to this buffer
- std::deque<pmt::pmt_t> d_item_tags; // temp. store tags until moved to reader
+ std::deque<pmt::pmt_t> d_item_tags;
+
//
// The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's
@@ -272,11 +262,6 @@ class gr_buffer_reader {
std::vector<pmt::pmt_t> get_tags_in_range(uint64_t abs_start,
uint64_t abs_end);
- bool get_tag(size_t n, pmt::pmt_t &t)
- {
- return d_buffer->get_tag(n, t);
- }
-
// -------------------------------------------------------------------------
private:
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
index d360c13a5..08589984e 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
+++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
@@ -60,7 +60,7 @@ gr_random_annotator::work (int noutput_items,
std::stringstream str;
str << name() << unique_id();
- uint64_t abs_N = nitems_written(0);
+ uint64_t abs_N = nitems_read(0) + noutput_items;
std::vector<pmt::pmt_t> all_tags = get_tags_in_range(0, (uint64_t)0, abs_N);
std::vector<pmt::pmt_t>::iterator itr;