summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime/gr_block.cc
diff options
context:
space:
mode:
authorTom Rondeau2012-06-04 18:22:48 -0400
committerTom Rondeau2012-06-04 18:22:48 -0400
commitea4ea222dd41f45b370b0bb322b1f63f76a77a34 (patch)
tree1cc849b102636bf5f0ef31a5196a15f18e7acfe8 /gnuradio-core/src/lib/runtime/gr_block.cc
parentb40ccb1d3f12a6837df235ccbceee5180c711efa (diff)
downloadgnuradio-ea4ea222dd41f45b370b0bb322b1f63f76a77a34.tar.gz
gnuradio-ea4ea222dd41f45b370b0bb322b1f63f76a77a34.tar.bz2
gnuradio-ea4ea222dd41f45b370b0bb322b1f63f76a77a34.zip
runtime: added ability for blocks to have their own max_noutput_items.
Setting a max_noutput_items for an individual block will override the global max that can be passed to the start/run method of the top_block. Also adds QA code for testing that these features run and complete a flowgraph.
Diffstat (limited to 'gnuradio-core/src/lib/runtime/gr_block.cc')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 9a5255a93..7e01c0ba8 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -40,6 +40,8 @@ gr_block::gr_block (const std::string &name,
d_relative_rate (1.0),
d_history(1),
d_fixed_rate(false),
+ d_max_noutput_items_set(false),
+ d_max_noutput_items(0),
d_tag_propagation_policy(TPP_ALL_TO_ALL)
{
}
@@ -208,6 +210,35 @@ gr_block::set_tag_propagation_policy(tag_propagation_policy_t p)
d_tag_propagation_policy = p;
}
+
+int
+gr_block::max_noutput_items()
+{
+ return d_max_noutput_items;
+}
+
+void
+gr_block::set_max_noutput_items(int m)
+{
+ if(m <= 0)
+ throw std::runtime_error("gr_block::set_max_noutput_items: value for max_noutput_items must be greater than 0.\n");
+
+ d_max_noutput_items = m;
+ d_max_noutput_items_set = true;
+}
+
+void
+gr_block::unset_max_noutput_items()
+{
+ d_max_noutput_items_set = false;
+}
+
+bool
+gr_block::is_set_max_noutput_items()
+{
+ return d_max_noutput_items_set;
+}
+
std::ostream&
operator << (std::ostream& os, const gr_block *m)
{