commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 04/43: gnuradio-runtime: added the individu


From: git
Subject: [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
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 34275a2c3e18c5738ccf02f4c3119efdacd00ae8
Author: Bill Clark <address@hidden>
Date:   Tue Mar 31 21:28:30 2015 -0400

    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
---
 gnuradio-runtime/include/gnuradio/hier_block2.h | 10 +++++++
 gnuradio-runtime/lib/hier_block2.cc             | 18 +++++++++++++
 gnuradio-runtime/lib/hier_block2_detail.cc      | 35 +++++++++++++++++++++++++
 gnuradio-runtime/swig/hier_block2.i             |  2 ++
 4 files changed, 65 insertions(+)

diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h 
b/gnuradio-runtime/include/gnuradio/hier_block2.h
index e547d2f..9a3f113 100644
--- a/gnuradio-runtime/include/gnuradio/hier_block2.h
+++ b/gnuradio-runtime/include/gnuradio/hier_block2.h
@@ -185,6 +185,11 @@ namespace gr {
     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=0);
@@ -194,6 +199,11 @@ namespace gr {
      */
     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.
diff --git a/gnuradio-runtime/lib/hier_block2.cc 
b/gnuradio-runtime/lib/hier_block2.cc
index 5793e1c..130b2a1 100644
--- a/gnuradio-runtime/lib/hier_block2.cc
+++ b/gnuradio-runtime/lib/hier_block2.cc
@@ -203,6 +203,15 @@ namespace gr {
         d_max_output_buffer[idx] = 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())
+      throw std::invalid_argument("hier_block2::max_output_buffer: port out of 
range.");
+    else
+      d_max_output_buffer[port] = max_output_buffer;
+  }
 
   long
   hier_block2::min_output_buffer(size_t i=0)
@@ -223,6 +232,15 @@ namespace gr {
         d_min_output_buffer[idx] = 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())
+      throw std::invalid_argument("hier_block2::min_output_buffer: port out of 
range.");
+    else
+      d_min_output_buffer[port] = min_output_buffer;
+  }
   
   bool
   hier_block2::set_all_min_output_buffer(void)
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc 
b/gnuradio-runtime/lib/hier_block2_detail.cc
index 7210dca..249fccf 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
@@ -685,6 +685,41 @@ namespace gr {
             << " is not connected internally";
         throw std::runtime_error(msg.str());
       }
+      // TODO: Update buffers of just these output blocks
+      if(!set_all_min_buff){
+        min_buff = d_owner->min_output_buffer(i);
+        if(min_buff != -1){
+          block_sptr bb = boost::dynamic_pointer_cast<block>(blk);
+          if(bb != 0){
+            int bb_src_port = d_outputs[i].port();
+            bb->set_min_output_buffer(bb_src_port, min_buff);
+          }
+          else{
+            hier_block2_sptr hh = 
boost::dynamic_pointer_cast<hier_block2>(blk);
+            if(hh != 0){
+              int hh_src_port = d_outputs[i].port();
+              hh->set_min_output_buffer(hh_src_port, min_buff);
+            }
+          }
+        }
+      }
+      if(!set_all_max_buff){
+        max_buff = d_owner->max_output_buffer(i);
+        if(max_buff != -1){
+          block_sptr bb = boost::dynamic_pointer_cast<block>(blk);
+          if(bb != 0){
+            int bb_src_port = d_outputs[i].port();
+            bb->set_max_output_buffer(bb_src_port, max_buff);
+          }
+          else{
+            hier_block2_sptr hh = 
boost::dynamic_pointer_cast<hier_block2>(blk);
+            if(hh != 0){
+              int hh_src_port = d_outputs[i].port();
+              hh->set_max_output_buffer(hh_src_port, max_buff);
+            }
+          }
+        }
+      }
       tmp.push_back(blk);
     }
     sort(tmp.begin(), tmp.end());
diff --git a/gnuradio-runtime/swig/hier_block2.i 
b/gnuradio-runtime/swig/hier_block2.i
index fbe44dc..d2a33b4 100644
--- a/gnuradio-runtime/swig/hier_block2.i
+++ b/gnuradio-runtime/swig/hier_block2.i
@@ -94,8 +94,10 @@ namespace gr {
     // 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
   };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]