[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/43: gnuradio-runtime: trying to see if t
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/43: gnuradio-runtime: trying to see if this will handle the output buffer size of hier blocks; trying to find the proper casting methods |
Date: |
Thu, 2 Apr 2015 19:15:49 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 50f96a451847d5d835866dfbb1a5eb64cd41b95d
Author: Bill Clark <address@hidden>
Date: Mon Mar 30 20:39:41 2015 -0400
gnuradio-runtime: trying to see if this will handle the output buffer size
of hier blocks; trying to find the proper casting methods
---
gnuradio-runtime/include/gnuradio/hier_block2.h | 33 +++++++++++++
gnuradio-runtime/lib/hier_block2.cc | 65 ++++++++++++++++++++++++-
gnuradio-runtime/lib/hier_block2_detail.cc | 13 +++++
gnuradio-runtime/lib/hier_block2_detail.h | 1 +
gnuradio-runtime/swig/hier_block2.i | 8 +++
5 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h
b/gnuradio-runtime/include/gnuradio/hier_block2.h
index 1bf8ddd..01c18e0 100644
--- a/gnuradio-runtime/include/gnuradio/hier_block2.h
+++ b/gnuradio-runtime/include/gnuradio/hier_block2.h
@@ -56,6 +56,9 @@ namespace gr {
* \brief Private implementation details of gr::hier_block2
*/
hier_block2_detail *d_detail;
+
+ std::vector<long> d_max_output_buffer;
+ std::vector<long> d_min_output_buffer;
protected:
hier_block2(void) {} // allows pure virtual interface sub-classes
@@ -170,6 +173,36 @@ namespace gr {
*/
virtual void unlock();
+ /*!
+ * \brief Returns max buffer size on output port \p i.
+ */
+ long max_output_buffer(size_t i);
+
+ /*!
+ * \brief Sets max buffer size on all output ports.
+ */
+ void set_max_output_buffer(long max_output_buffer);
+
+ /*!
+ * \brief Sets max buffer size on output port \p port.
+ */
+ void set_max_output_buffer(int port, long max_output_buffer);
+
+ /*!
+ * \brief Returns min buffer size on output port \p i.
+ */
+ long min_output_buffer(size_t i);
+
+ /*!
+ * \brief Sets min buffer size on all output ports.
+ */
+ void set_min_output_buffer(long min_output_buffer);
+
+ /*!
+ * \brief Sets min buffer size on output port \p port.
+ */
+ void set_min_output_buffer(int port, long min_output_buffer);
+
// This is a public method for ease of code organization, but should be
// ignored by the user.
flat_flowgraph_sptr flatten() const;
diff --git a/gnuradio-runtime/lib/hier_block2.cc
b/gnuradio-runtime/lib/hier_block2.cc
index f145b93..4345e2d 100644
--- a/gnuradio-runtime/lib/hier_block2.cc
+++ b/gnuradio-runtime/lib/hier_block2.cc
@@ -49,7 +49,9 @@ namespace gr {
: basic_block(name, input_signature, output_signature),
d_detail(new hier_block2_detail(this)),
hier_message_ports_in(pmt::PMT_NIL),
- hier_message_ports_out(pmt::PMT_NIL)
+ hier_message_ports_out(pmt::PMT_NIL),
+ d_max_output_buffer(std::max(output_signature->max_streams(),1), -1),
+ d_min_output_buffer(std::max(output_signature->max_streams(),1), -1)
{
// This bit of magic ensures that self() works in the constructors of
derived classes.
gnuradio::detail::sptr_magic::create_and_stash_initial_sptr(this);
@@ -182,4 +184,65 @@ namespace gr {
return dot_graph_fg(hierblock2->flatten());
}
+ long
+ hier_block2::max_output_buffer(size_t i)
+ {
+ /*if(i >= d_max_output_buffer.size())
+ throw std::invalid_argument("basic_block::max_output_buffer: port out of
range.");
+ return d_max_output_buffer[i];*/
+ if(d_max_output_buffer.size() == 0)
+ throw std::invalid_argument("hier_block2::max_output_buffer: port out of
range.");
+ return d_max_output_buffer[0];
+ }
+
+ void
+ hier_block2::set_max_output_buffer(long max_output_buffer)
+ {
+ /*for(int i = 0; i < output_signature()->max_streams(); i++) {
+ set_max_output_buffer(i, max_output_buffer);
+ }*/
+ if(output_signature()->max_streams()>0)
+ set_max_output_buffer(0,max_output_buffer);
+ }
+
+ void
+ hier_block2::set_max_output_buffer(int port, long max_output_buffer)
+ {
+ if((size_t)port >= d_max_output_buffer.size())
+ d_max_output_buffer.push_back(max_output_buffer);
+ else
+ d_max_output_buffer[port] = max_output_buffer;
+ }
+
+ long
+ hier_block2::min_output_buffer(size_t i)
+ {
+ /*if(i >= d_min_output_buffer.size())
+ throw std::invalid_argument("basic_block::min_output_buffer: port out of
range.");
+ return d_min_output_buffer[i];*/
+ if(d_min_output_buffer.size() == 0)
+ throw std::invalid_argument("hier_block2::min_output_buffer: port out of
range.");
+ return d_min_output_buffer[0];
+ }
+
+ void
+ hier_block2::set_min_output_buffer(long min_output_buffer)
+ {
+ /*std::cout << "set_min_output_buffer on block " << unique_id() << " to "
<< min_output_buffer << std::endl;
+ for(int i=0; i<output_signature()->max_streams(); i++) {
+ set_min_output_buffer(i, min_output_buffer);
+ }*/
+ if(output_signature()->max_streams()>0)
+ set_min_output_buffer(0,min_output_buffer);
+ }
+
+ void
+ hier_block2::set_min_output_buffer(int port, long min_output_buffer)
+ {
+ if((size_t)port >= d_min_output_buffer.size())
+ d_min_output_buffer.push_back(min_output_buffer);
+ else
+ d_min_output_buffer[port] = min_output_buffer;
+ }
+
} /* namespace gr */
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc
b/gnuradio-runtime/lib/hier_block2_detail.cc
index ad8fc87..f58c24a 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
@@ -513,6 +513,9 @@ namespace gr {
// Only run setup_rpc if ControlPort config param is enabled.
bool ctrlport_on = prefs::singleton()->get_bool("ControlPort", "on",
false);
+
+ long min_buff = d_owner->min_output_buffer(0);
+ long max_buff = d_owner->max_output_buffer(0);
// For every block (gr::block and gr::hier_block2), set up the RPC
// interface.
@@ -526,6 +529,16 @@ namespace gr {
b->rpc_set();
}
}
+ if(min_buff != -1){
+ if((boost::static_pointer_cast<block>(b) != nullptr) ||
(boost::static_pointer_cast<hier_block2>(b) != nullptr)){
+ b->set_min_output_buffer(min_buff);
+ }
+ }
+ if(max_buff != -1){
+ if((boost::static_pointer_cast<block>(b) != nullptr) ||
(boost::static_pointer_cast<hier_block2>(b) != nullptr)){
+ b->set_max_output_buffer(max_buff);
+ }
+ }
b = p->dst().block();
if(ctrlport_on) {
diff --git a/gnuradio-runtime/lib/hier_block2_detail.h
b/gnuradio-runtime/lib/hier_block2_detail.h
index 8067383..df2d088 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.h
+++ b/gnuradio-runtime/lib/hier_block2_detail.h
@@ -25,6 +25,7 @@
#include <gnuradio/api.h>
#include <gnuradio/hier_block2.h>
+#include <gnuradio/block.h>
#include <flat_flowgraph.h>
#include <boost/utility.hpp>
diff --git a/gnuradio-runtime/swig/hier_block2.i
b/gnuradio-runtime/swig/hier_block2.i
index 053f247..d2a33b4 100644
--- a/gnuradio-runtime/swig/hier_block2.i
+++ b/gnuradio-runtime/swig/hier_block2.i
@@ -91,6 +91,14 @@ namespace gr {
void unset_processor_affinity();
std::vector<int> processor_affinity();
+ // Methods to manage block's min/max buffer sizes.
+ long max_output_buffer(int i);
+ void set_max_output_buffer(long max_output_buffer);
+ void set_max_output_buffer(int port, long max_output_buffer);
+ long min_output_buffer(int i);
+ void set_min_output_buffer(long min_output_buffer);
+ void set_min_output_buffer(int port, long min_output_buffer);
+
gr::hier_block2_sptr to_hier_block2(); // Needed for Python type coercion
};
- [Commit-gnuradio] [gnuradio] 16/43: fec: LDPC async decoder now running, (continued)
- [Commit-gnuradio] [gnuradio] 16/43: fec: LDPC async decoder now running, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 04/43: gnuradio-runtime: added the individual port assignments to the hier_block2 max/min_output_buffer size; if output ports have different size assignments only the block directly connected to the output port is changed otherwise every block within the hier is set to that output buffer size; therefore single output hier blocks will always set every block within to the output buffer size, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 17/43: gnuradio-runtume: hier_block2 output buffer lengths - clean up of debug output, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 26/43: grc: no shebang for hier blocks; use python2, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 15/43: fec: ldpc encoder now working in async encoder interface, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 06/43: gnuradio-runtime: (option 1) The hier block can now take a generic min/max output buffer length and assign it to every block within the hier (assumes all output buffers have the same min/max values set); (option 2) sets only the blocks connected to hier output ports and does not set the other internal blocks (requires that each port has different values); for single port output hier blocks only option 1 is possible., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 07/43: gnuradio-runtime: non-helpful debug outputs removed from hier_block2 and hier_block2_detail, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 27/43: grc: optional thread-safe setters in generated code (#748), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 19/43: gnuradio-runtime: added logger to flat_flowgraph and print out a warning for when the max_output_buffer isn't set to the requested value, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 28/43: grc: don't try to open missing files, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 01/43: gnuradio-runtime: trying to see if this will handle the output buffer size of hier blocks; trying to find the proper casting methods,
git <=
- [Commit-gnuradio] [gnuradio] 10/43: fec: cleaning up LDPC warnings, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 18/43: fec: ldpc works, add iterations meta tag, etc, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 34/43: Merge remote-tracking branch 'saikwolf/logging_flat_flowgraph', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 03/43: gnuradio-runtime:: removed the individual port setting on hier_block2, current operation assuming the buffers are being set for latency and therefore all blocks are being set to a small amount, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 11/43: fec: LDPC cleaning up comments, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 30/43: grc: clean-up 'gnuradio-companion', add mode 'run from source', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 12/43: fec: re-shuffling LDPC make helper, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 31/43: grc: PropsDialog: apply button and hotkey (Ctrl+Enter), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 40/43: fec: Move the definition of yp_kernel from the class into a temp variable in the main code. This variable is used just to find the actual Volk kernel, and its current use is not c++11 complaint. Moving it makes the code c++11 complaint on both GCC / libstdc++ and Clang / libc++., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 35/43: Merge remote-tracking branch 'osh/ldpc_add', git, 2015/04/02