[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/11: Fixed up the int/size_t handling in
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/11: Fixed up the int/size_t handling in hb2's new max/min_output... methods |
Date: |
Sun, 5 Apr 2015 23:58:07 +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 e4aff27773af60b40c32447b2335d2cf31b62773
Author: Marcus Müller <address@hidden>
Date: Sun Apr 5 22:50:48 2015 +0200
Fixed up the int/size_t handling in hb2's new max/min_output... methods
alongside with minor beautifications.
Fixes all compile warnings related to signed/unsigned comparison.
---
gnuradio-runtime/include/gnuradio/hier_block2.h | 18 +++---
gnuradio-runtime/lib/hier_block2.cc | 78 +++++++++++--------------
gnuradio-runtime/lib/hier_block2_detail.cc | 5 +-
3 files changed, 47 insertions(+), 54 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h
b/gnuradio-runtime/include/gnuradio/hier_block2.h
index 3a74a37..08a5389 100644
--- a/gnuradio-runtime/include/gnuradio/hier_block2.h
+++ b/gnuradio-runtime/include/gnuradio/hier_block2.h
@@ -56,7 +56,7 @@ namespace gr {
* \brief Private implementation details of gr::hier_block2
*/
hier_block2_detail *d_detail;
-
+
protected:
hier_block2(void) {} // allows pure virtual interface sub-classes
@@ -174,32 +174,32 @@ namespace gr {
/*!
* \brief Returns max buffer size (itemcount) on output port \p i.
*/
- size_t max_output_buffer(size_t i=0);
+ int max_output_buffer(size_t port=0);
/*!
* \brief Sets max buffer size (itemcount) on all output ports.
*/
- void set_max_output_buffer(size_t max_output_buffer);
+ void set_max_output_buffer(int max_output_buffer);
/*!
* \brief Sets max buffer size (itemcount) on output port \p port.
*/
- void set_max_output_buffer(int port, size_t max_output_buffer);
+ void set_max_output_buffer(size_t port, int max_output_buffer);
/*!
* \brief Returns min buffer size (itemcount) on output port \p i.
*/
- size_t min_output_buffer(size_t i=0);
+ int min_output_buffer(size_t port=0);
/*!
* \brief Sets min buffer size (itemcount) on all output ports.
*/
- void set_min_output_buffer(size_t min_output_buffer);
+ void set_min_output_buffer(int min_output_buffer);
/*!
* \brief Sets min buffer size (itemcount) on output port \p port.
*/
- void set_min_output_buffer(int port, size_t min_output_buffer);
+ void set_min_output_buffer(size_t port, int min_output_buffer);
// This is a public method for ease of code organization, but should be
@@ -265,7 +265,7 @@ namespace gr {
* call could be misleading.
*/
std::vector<int> processor_affinity();
-
+
/*!
* \brief Get if all block min buffers should be set.
*
@@ -273,7 +273,7 @@ namespace gr {
* should be set or just the block ports connected to the hier ports.
*/
bool all_min_output_buffer_p(void);
-
+
/*!
* \brief Get if all block max buffers should be set.
*
diff --git a/gnuradio-runtime/lib/hier_block2.cc
b/gnuradio-runtime/lib/hier_block2.cc
index 4d2c460..eeb5669 100644
--- a/gnuradio-runtime/lib/hier_block2.cc
+++ b/gnuradio-runtime/lib/hier_block2.cc
@@ -182,97 +182,89 @@ namespace gr {
return dot_graph_fg(hierblock2->flatten());
}
- size_t
- hier_block2::max_output_buffer(size_t i)
+ int
+ hier_block2::max_output_buffer(size_t port)
{
- if(i >= d_detail->d_max_output_buffer.size())
- throw std::invalid_argument("hier_block2::max_output_buffer: port out of
range.");
- return d_detail->d_max_output_buffer[i];
+ if(port >= d_detail->d_max_output_buffer.size())
+ throw std::invalid_argument("hier_block2::max_output_buffer(int): port
out of range.");
+ return d_detail->d_max_output_buffer[port];
}
-
+
void
- hier_block2::set_max_output_buffer(size_t max_output_buffer)
+ hier_block2::set_max_output_buffer(int max_output_buffer)
{
if(output_signature()->max_streams()>0)
{
if(d_detail->d_max_output_buffer.size() == 0)
- throw std::length_error("hier_block2::max_output_buffer: out_sig
greater than zero, buff_vect isn't");
- for(size_t idx = 0; idx < output_signature()->max_streams(); idx++){
+ throw std::length_error("hier_block2::set_max_output_buffer(int):
out_sig greater than zero, buff_vect isn't");
+ for(int idx = 0; idx < output_signature()->max_streams(); idx++){
d_detail->d_max_output_buffer[idx] = max_output_buffer;
}
}
}
-
+
void
- hier_block2::set_max_output_buffer(int port, size_t max_output_buffer)
+ hier_block2::set_max_output_buffer(size_t port, int max_output_buffer)
{
- if((size_t)port >= d_detail->d_max_output_buffer.size())
- throw std::invalid_argument("hier_block2::max_output_buffer: port out of
range.");
+ if(port >= d_detail->d_max_output_buffer.size())
+ throw
std::invalid_argument("hier_block2::set_max_output_buffer(size_t,int): port out
of range.");
else{
d_detail->d_max_output_buffer[port] = max_output_buffer;
}
}
- size_t
- hier_block2::min_output_buffer(size_t i)
+ int
+ hier_block2::min_output_buffer(size_t port)
{
- if(i >= d_detail->d_min_output_buffer.size())
- throw std::invalid_argument("hier_block2::min_output_buffer: port out of
range.");
- return d_detail->d_min_output_buffer[i];
+ if(port >= d_detail->d_min_output_buffer.size())
+ throw std::invalid_argument("hier_block2::min_output_buffer(size_t):
port out of range.");
+ return d_detail->d_min_output_buffer[port];
}
void
- hier_block2::set_min_output_buffer(size_t min_output_buffer)
+ hier_block2::set_min_output_buffer(int min_output_buffer)
{
if(output_signature()->max_streams()>0)
{
if(d_detail->d_min_output_buffer.size() == 0)
- throw std::length_error("hier_block2::min_output_buffer: out_sig
greater than zero, buff_vect isn't");
- for(size_t idx = 0; idx < output_signature()->max_streams(); idx++){
+ throw std::length_error("hier_block2::set_min_output_buffer(int):
out_sig greater than zero, buff_vect isn't");
+ for(int idx = 0; idx < output_signature()->max_streams(); idx++){
d_detail->d_min_output_buffer[idx] = min_output_buffer;
}
}
}
void
- hier_block2::set_min_output_buffer(int port, size_t min_output_buffer)
+ hier_block2::set_min_output_buffer(size_t port, int min_output_buffer)
{
- if((size_t)port >= d_detail->d_min_output_buffer.size())
- throw std::invalid_argument("hier_block2::min_output_buffer: port out of
range.");
+ if(port >= d_detail->d_min_output_buffer.size())
+ throw
std::invalid_argument("hier_block2::set_min_output_buffer(size_t,int): port out
of range.");
else{
d_detail->d_min_output_buffer[port] = min_output_buffer;
}
}
-
+
bool
hier_block2::all_min_output_buffer_p(void)
{
- if(d_detail->d_min_output_buffer.size() > 0){
- bool all_equal = true;
- for(int idx = 1; (idx < d_detail->d_min_output_buffer.size()) &&
all_equal; idx++){
- if(d_detail->d_min_output_buffer[0] !=
d_detail->d_min_output_buffer[idx])
- all_equal = false;
- }
- return all_equal;
- }
- else{
+ if(!d_detail->d_min_output_buffer.size())
return false;
+ for(size_t idx = 1; idx < d_detail->d_min_output_buffer.size(); idx++){
+ if(d_detail->d_min_output_buffer[0] !=
d_detail->d_min_output_buffer[idx])
+ return false;
}
+ return true;
}
bool
hier_block2::all_max_output_buffer_p(void)
{
- if(d_detail->d_max_output_buffer.size() > 0){
- bool all_equal = true;
- for(int idx = 1; (idx < d_detail->d_max_output_buffer.size()) &&
all_equal; idx++){
- if(d_detail->d_max_output_buffer[0] !=
d_detail->d_max_output_buffer[idx])
- all_equal = false;
- }
- return all_equal;
- }
- else{
+ if(!d_detail->d_max_output_buffer.size())
return false;
+ for(size_t idx = 1; idx < d_detail->d_max_output_buffer.size(); idx++){
+ if(d_detail->d_max_output_buffer[0] !=
d_detail->d_max_output_buffer[idx])
+ return false;
}
+ return true;
}
} /* namespace gr */
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc
b/gnuradio-runtime/lib/hier_block2_detail.cc
index a735de3..948c05d 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
@@ -516,8 +516,9 @@ namespace gr {
// Only run setup_rpc if ControlPort config param is enabled.
bool ctrlport_on = prefs::singleton()->get_bool("ControlPort", "on",
false);
-
- size_t min_buff(0), max_buff(0);
+
+ int min_buff = 0;
+ int max_buff = 0;
// Determine how the buffers should be set
bool set_all_min_buff = d_owner->all_min_output_buffer_p();
bool set_all_max_buff = d_owner->all_max_output_buffer_p();
- [Commit-gnuradio] [gnuradio] branch master updated (fa2abde -> cce2347), git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 10/11: Merge remote-tracking branch 'tom/qtgui/time_auto_and_stop', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 08/11: Merge remote-tracking branch 'mmueller/runtime_hier_block2_signage', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 09/11: Merge remote-tracking branch 'mmueller/remove_aadvarkness', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 11/11: Merge remote-tracking branch 'osh/tpc_add', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 03/11: blocks: adding a variable tag_object to help build tags., git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 02/11: fec: TPC now runs happily, encoder produces uint8_t instead of float, decoder GRC def now fixed, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 04/11: fec: TPC adding standard headers, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 05/11: Fixed up the int/size_t handling in hb2's new max/min_output... methods,
git <=
- [Commit-gnuradio] [gnuradio] 07/11: qtgui: adds single-shot autoscale button and stop button to time sink control panel., git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 01/11: fec: adding TPC encoder and decoder, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 06/11: removed doxyxml example, git, 2015/04/05