summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h8
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc12
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc39
4 files changed, 17 insertions, 46 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 52be37e3b..81a55af9d 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -169,14 +169,14 @@ gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
d_detail->get_tags_in_range(v, which_output, start, end, key);
}
-gr_block::TAG_PROPAGATION_POLICY
+gr_block::tag_propagation_policy_t
gr_block::tag_propagation_policy()
{
return d_tag_propagation_policy;
}
void
-gr_block::set_tag_propagation_policy(TAG_PROPAGATION_POLICY p)
+gr_block::set_tag_propagation_policy(tag_propagation_policy_t p)
{
d_tag_propagation_policy = p;
}
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index 36eed3d10..ad7fa9555 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -63,7 +63,7 @@ class gr_block : public gr_basic_block {
WORK_DONE = -1
};
- enum TAG_PROPAGATION_POLICY {
+ enum tag_propagation_policy_t {
TPP_DONT = 0,
TPP_ALL_TO_ALL = 1,
TPP_ONE_TO_ONE = 2
@@ -217,12 +217,12 @@ class gr_block : public gr_basic_block {
/*!
* \brief Asks for the policy used by the scheduler to moved tags downstream.
*/
- TAG_PROPAGATION_POLICY tag_propagation_policy();
+ tag_propagation_policy_t tag_propagation_policy();
/*!
* \brief Set the policy by the scheduler to determine how tags are moved downstream.
*/
- void set_tag_propagation_policy(TAG_PROPAGATION_POLICY p);
+ void set_tag_propagation_policy(tag_propagation_policy_t p);
// ----------------------------------------------------------------------------
@@ -233,7 +233,7 @@ class gr_block : public gr_basic_block {
gr_block_detail_sptr d_detail; // implementation details
unsigned d_history;
bool d_fixed_rate;
- TAG_PROPAGATION_POLICY d_tag_propagation_policy; // policy for moving tags downstream
+ tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
protected:
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index ea489d079..9c30b1334 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -88,7 +88,7 @@ min_available_space (gr_block_detail *d, int output_multiple)
}
static bool
-propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d,
+propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
const std::vector<uint64_t> &start_nitems_read, double rrate,
std::vector<pmt::pmt_t> &rtags)
{
@@ -100,10 +100,10 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d,
}
switch(policy) {
- case(gr_block::TPP_DONT):
+ case gr_block::TPP_DONT:
return true;
break;
- case(gr_block::TPP_ALL_TO_ALL):
+ case gr_block::TPP_ALL_TO_ALL:
// every tag on every input propogates to everyone downstream
for(int i = 0; i < d->ninputs(); i++) {
d->get_tags_in_range(rtags, i, start_nitems_read[i],
@@ -130,7 +130,7 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d,
}
}
break;
- case(gr_block::TPP_ONE_TO_ONE):
+ case gr_block::TPP_ONE_TO_ONE:
// tags from input i only go to output i
// this requires d->ninputs() == d->noutputs; this is checked when this
// type of tag-propagation system is selected in gr_block_detail
@@ -370,7 +370,7 @@ gr_block_executor::run_one_iteration()
for (int i = 0; i < d->noutputs (); i++)
d_output_items[i] = d->output(i)->write_pointer();
- // determine where to start looking for new tags as 1 past nitems read
+ // determine where to start looking for new tags
for (int i = 0; i < d->ninputs(); i++)
d_start_nitems_read[i] = d->nitems_read(i);
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
index 2092e48ed..14983013c 100644
--- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -31,8 +31,7 @@
#include <gr_head.h>
#include <gr_annotator_alltoall.h>
#include <gr_annotator_1to1.h>
-#include <gr_fir_filter_fff.h>
-#include <gr_interp_fir_filter_fff.h>
+#include <gr_keep_one_in_n.h>
#include <gr_firdes.h>
#include <gruel/pmt.h>
@@ -375,18 +374,14 @@ qa_block_tags::t5 ()
gr_block_sptr snk0 (gr_make_null_sink(sizeof(float)));
// Rate change blocks
- std::vector<float> taps = gr_firdes::low_pass_2(1, 1, 0.4, 0.1, 60);
- gr_fir_filter_fff_sptr fir_dec10 (gr_make_fir_filter_fff(10, taps));
- gr_interp_fir_filter_fff_sptr fir_int2 (gr_make_interp_fir_filter_fff(2, taps));
+ gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10));
tb->connect(src, 0, head, 0);
tb->connect(head, 0, ann0, 0);
tb->connect(ann0, 0, ann1, 0);
- tb->connect(ann1, 0, fir_dec10, 0);
- tb->connect(fir_dec10, 0, ann2, 0);
- tb->connect(ann2, 0, fir_int2, 0);
- tb->connect(fir_int2, 0, ann3, 0);
- tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann1, 0, dec10, 0);
+ tb->connect(dec10, 0, ann2, 0);
+ tb->connect(ann2, 0, snk0, 0);
tb->run();
@@ -414,24 +409,9 @@ qa_block_tags::t5 ()
expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4));
expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4));
- pmt_t expected_tags3[12];
- expected_tags3[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
- expected_tags3[1] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
- expected_tags3[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
- expected_tags3[3] = mp(pmt_from_uint64(2000), mp(str2.str()), mp("seq"), mp(1));
- expected_tags3[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(1));
- expected_tags3[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(1));
- expected_tags3[6] = mp(pmt_from_uint64(4000), mp(str2.str()), mp("seq"), mp(2));
- expected_tags3[7] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(2));
- expected_tags3[8] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(2));
- expected_tags3[9] = mp(pmt_from_uint64(6000), mp(str2.str()), mp("seq"), mp(3));
- expected_tags3[10] = mp(pmt_from_uint64(6000), mp(str1.str()), mp("seq"), mp(3));
- expected_tags3[11] = mp(pmt_from_uint64(6000), mp(str0.str()), mp("seq"), mp(3));
-
std::vector<pmt::pmt_t> tags0 = ann0->data();
std::vector<pmt::pmt_t> tags1 = ann1->data();
std::vector<pmt::pmt_t> tags2 = ann2->data();
- std::vector<pmt::pmt_t> tags3 = ann3->data();
// The first annotator does not receive any tags from the null sink upstream
CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
@@ -453,14 +433,5 @@ qa_block_tags::t5 ()
std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
}
-
- // annotator 3 gets tags from annotators 0, 1, and 2
- std::cout << std::endl;
- std::cout << "tags3.size(): " << tags3.size() << std::endl;
- CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12);
- for(size_t i = 0; i < tags3.size(); i++) {
- std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
- CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
- }
}