diff options
author | Josh Blum | 2012-10-04 20:49:41 -0700 |
---|---|---|
committer | Josh Blum | 2012-10-04 20:49:41 -0700 |
commit | 47985be7403d16049d166ea1da4a94870c2c9606 (patch) | |
tree | 977f63e7e919b60df307baa24f5249a525f6d84e /include | |
parent | d9aad55eb18f8a9dab383a0b0cb8626f12c3fd29 (diff) | |
download | sandhi-47985be7403d16049d166ea1da4a94870c2c9606.tar.gz sandhi-47985be7403d16049d166ea1da4a94870c2c9606.tar.bz2 sandhi-47985be7403d16049d166ea1da4a94870c2c9606.zip |
replaced top block set_buffer_hint with global config
Diffstat (limited to 'include')
-rw-r--r-- | include/gnuradio/block.hpp | 2 | ||||
-rw-r--r-- | include/gnuradio/gr_top_block.h | 26 | ||||
-rw-r--r-- | include/gnuradio/top_block.hpp | 43 |
3 files changed, 45 insertions, 26 deletions
diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp index 0543161..81984f0 100644 --- a/include/gnuradio/block.hpp +++ b/include/gnuradio/block.hpp @@ -78,7 +78,7 @@ struct GRAS_API OutputPortConfig size_t reserve_items; /*! - * Constrain the maximum buffer size that + * Constrain the maximum number of items that * work can be called with for this port. * * Default = 0 aka disabled. diff --git a/include/gnuradio/gr_top_block.h b/include/gnuradio/gr_top_block.h index eb1a9aa..3a56bf6 100644 --- a/include/gnuradio/gr_top_block.h +++ b/include/gnuradio/gr_top_block.h @@ -37,9 +37,29 @@ struct GRAS_API gr_top_block : gnuradio::TopBlock this->update(); } - ///////////// TODO ////////////////////// - int max_noutput_items(){return 0;} - void set_max_noutput_items(int){} + void start(const size_t max_items) + { + this->set_max_noutput_items(max_items); + gnuradio::TopBlock::start(); + } + + void run(const size_t max_items) + { + this->set_max_noutput_items(max_items); + gnuradio::TopBlock::run(); + } + + int max_noutput_items(void) const + { + return this->global_config().maximum_output_items; + } + + void set_max_noutput_items(int max_items) + { + gnuradio::GlobalBlockConfig config = this->global_config(); + config.maximum_output_items = max_items; + this->set_global_config(config); + } }; diff --git a/include/gnuradio/top_block.hpp b/include/gnuradio/top_block.hpp index d755ffc..bab67ee 100644 --- a/include/gnuradio/top_block.hpp +++ b/include/gnuradio/top_block.hpp @@ -22,38 +22,37 @@ namespace gnuradio { +struct GRAS_API GlobalBlockConfig +{ + GlobalBlockConfig(void); + + /*! + * Constrain the maximum number of items that + * work can be called with for all output ports. + * + * Default = 0 aka disabled. + */ + size_t maximum_output_items; +}; + struct GRAS_API TopBlock : HierBlock { TopBlock(void); TopBlock(const std::string &name); + //! Get the global block config settings + const GlobalBlockConfig &global_config(void) const; + + //! Set the global block config settings + void set_global_config(const GlobalBlockConfig &config); + /*! * Commit changes to the overall flow graph. * Call this after modifying connections. - * Update is called automatically by start/stop/run. - */ - void update(void); - - /*! - * Set the buffer allocation hint. - * This affects the size of buffers. + * Commit is called automatically by start/stop/run. */ - void set_buffer_hint(const size_t hint); - - //! Combined hint + start - void start(const size_t hint) - { - this->set_buffer_hint(hint); - this->start(); - } - - //! Combined hint + run - void run(const size_t hint) - { - this->set_buffer_hint(hint); - this->run(); - } + void commit(void); /*! * Run is for finite flow graph executions. |