[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10915 - in gnuradio/branches/releases/3.2: . gnuradio
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r10915 - in gnuradio/branches/releases/3.2: . gnuradio-core/src/lib/runtime gnuradio-core/src/python/gnuradio/gr gr-qtgui/src/python gr-wxgui/src/python gr-wxgui/src/python/plotter grc/data/platforms/python/blocks |
Date: |
Sun, 26 Apr 2009 14:16:45 -0600 (MDT) |
Author: jcorgan
Date: 2009-04-26 14:16:45 -0600 (Sun, 26 Apr 2009)
New Revision: 10915
Modified:
gnuradio/branches/releases/3.2/
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/prefs.py
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/pubsub.py
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/top_block.py
gnuradio/branches/releases/3.2/gr-qtgui/src/python/usrp_display.py
gnuradio/branches/releases/3.2/gr-wxgui/src/python/fftsink_gl.py
gnuradio/branches/releases/3.2/gr-wxgui/src/python/plotter/grid_plotter_base.py
gnuradio/branches/releases/3.2/gr-wxgui/src/python/scopesink_gl.py
gnuradio/branches/releases/3.2/gr-wxgui/src/python/waterfallsink_gl.py
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_add_xx.xml
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_channel_model.xml
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_multiply_xx.xml
Log:
Applied changesets r10865, r10869, r10870:10872, r10906:10908 to release-3.2
branch. Branch passes distcheck.
Property changes on: gnuradio/branches/releases/3.2
___________________________________________________________________
Modified: svn:mergeinfo
- /gnuradio/branches/developers/eb/t348:10638-10648
/gnuradio/branches/developers/eb/t378:10683-10688
/gnuradio/branches/developers/jblum/gui_guts:10464-10658
/gnuradio/branches/developers/jblum/vlen:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier:10818-10858
/gnuradio/branches/developers/jcorgan/fw-optimize:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2:10713-10765
/gnuradio/branches/developers/michaelld/am_swig_4:10555-10595
/gnuradio/branches/developers/michaelld/two_mods:10540-10546
/gnuradio/trunk:10356-10359,10481-10482,10497-10499,10506-10507,10511,10514,10521,10523-10524,10529,10531,10535,10537-10538,10550-10551,10556,10558-10560,10562-10563,10565,10574-10576,10578-10579,10581-10582,10585,10587,10596-10600,10623-10624,10629,10632-10634,10645-10646,10649-10650,10653-10655,10660-10661,10671,10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864,10884
+ /gnuradio/branches/developers/eb/t348:10638-10648
/gnuradio/branches/developers/eb/t378:10683-10688
/gnuradio/branches/developers/jblum/gui_guts:10464-10658
/gnuradio/branches/developers/jblum/vlen:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier:10818-10858
/gnuradio/branches/developers/jcorgan/fw-optimize:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2:10713-10765
/gnuradio/branches/developers/jcorgan/t161:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4:10555-10595
/gnuradio/branches/developers/michaelld/two_mods:10540-10546
/gnuradio/trunk:10356-10359,10481-10482,10497-10499,10506-10507,10511,10514,10521,10523-10524,10529,10531,10535,10537-10538,10550-10551,10556,10558-10560,10562-10563,10565,10574-10576,10578-10579,10581-10582,10585,10587,10596-10600,10623-10624,10629,10632-10634,10645-10646,10649-10650,10653-10655,10660-10661,10671,10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
2009-04-26 20:16:45 UTC (rev 10915)
@@ -49,7 +49,7 @@
throw std::runtime_error(msg.str());
}
- d_inputs = gr_endpoint_vector_t(max_inputs);
+ d_inputs = std::vector<gr_endpoint_vector_t>(max_inputs);
d_outputs = gr_endpoint_vector_t(max_outputs);
}
@@ -76,6 +76,14 @@
throw std::invalid_argument(msg.str());
}
+ gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block));
+
+ if (hblock && hblock.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: block is hierarchical, setting parent to " <<
this << std::endl;
+ hblock->d_detail->d_parent_detail = this;
+ }
+
d_blocks.push_back(block);
}
@@ -138,16 +146,44 @@
void
gr_hier_block2_detail::disconnect(gr_basic_block_sptr block)
{
+ // Check on singleton list
for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
if (*p == block) {
d_blocks.erase(p);
+
+ gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block));
+ if (block && block.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: block is hierarchical, clearing parent" <<
std::endl;
+ hblock->d_detail->d_parent_detail = 0;
+ }
+
return;
}
}
- std::stringstream msg;
- msg << "cannot disconnect block " << block << ", not found";
- throw std::invalid_argument(msg.str());
+ // Otherwise find all edges containing block
+ gr_edge_vector_t edges, tmp = d_fg->edges();
+ gr_edge_vector_t::iterator p;
+ for (p = tmp.begin(); p != tmp.end(); p++) {
+ if ((*p).src().block() == block || (*p).dst().block() == block) {
+ edges.push_back(*p);
+
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: block found in edge " << (*p) << std::endl;
+ }
+ }
+
+ if (edges.size() == 0) {
+ std::stringstream msg;
+ msg << "cannot disconnect block " << block << ", not found";
+ throw std::invalid_argument(msg.str());
+ }
+
+ for (p = edges.begin(); p != edges.end(); p++) {
+ disconnect((*p).src().block(), (*p).src().port(),
+ (*p).dst().block(), (*p).dst().port());
+ }
}
void
@@ -166,13 +202,13 @@
if (src_block && src.get() != d_owner) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
- std::cout << "connect: src is hierarchical, clearing parent" <<
std::endl;
+ std::cout << "disconnect: src is hierarchical, clearing parent" <<
std::endl;
src_block->d_detail->d_parent_detail = 0;
}
if (dst_block && dst.get() != d_owner) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
- std::cout << "connect: dst is hierarchical, clearing parent" <<
std::endl;
+ std::cout << "disconnect: dst is hierarchical, clearing parent" <<
std::endl;
dst_block->d_detail->d_parent_detail = 0;
}
@@ -186,7 +222,6 @@
d_fg->disconnect(src, src_port, dst, dst_port);
}
-// FIXME: ticket:161 will be implemented here
void
gr_hier_block2_detail::connect_input(int my_port, int port,
gr_basic_block_sptr block)
{
@@ -197,13 +232,16 @@
throw std::invalid_argument(msg.str());
}
- if (d_inputs[my_port].block()) {
- msg << "external input port " << my_port << " already wired to "
- << d_inputs[my_port];
+ gr_endpoint_vector_t &endps = d_inputs[my_port];
+ gr_endpoint endp(block, port);
+
+ gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp);
+ if (p != endps.end()) {
+ msg << "external input port " << my_port << " already wired to " << endp;
throw std::invalid_argument(msg.str());
}
-
- d_inputs[my_port] = gr_endpoint(block, port);
+
+ endps.push_back(endp);
}
void
@@ -235,13 +273,16 @@
throw std::invalid_argument(msg.str());
}
- if (d_inputs[my_port].block() != block) {
- msg << "block " << block << " not assigned to input "
- << my_port << ", can't disconnect";
+ gr_endpoint_vector_t &endps = d_inputs[my_port];
+ gr_endpoint endp(block, port);
+
+ gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp);
+ if (p == endps.end()) {
+ msg << "external input port " << my_port << " not connected to " << endp;
throw std::invalid_argument(msg.str());
}
-
- d_inputs[my_port] = gr_endpoint();
+
+ endps.erase(p);
}
void
@@ -263,7 +304,7 @@
d_outputs[my_port] = gr_endpoint();
}
-gr_endpoint
+gr_endpoint_vector_t
gr_hier_block2_detail::resolve_port(int port, bool is_input)
{
std::stringstream msg;
@@ -273,7 +314,7 @@
<< (is_input ? "input" : "output")
<< " of " << d_owner->name() << std::endl;
- gr_endpoint result;
+ gr_endpoint_vector_t result;
if (is_input) {
if (port < 0 || port >= (signed)d_inputs.size()) {
@@ -281,13 +322,18 @@
throw std::runtime_error(msg.str());
}
- if (d_inputs[port] == gr_endpoint()) {
+ if (d_inputs[port].empty()) {
msg << "hierarchical block '" << d_owner->name() << "' input " << port
<< " is not connected internally";
throw std::runtime_error(msg.str());
}
- result = resolve_endpoint(d_inputs[port], true);
+ gr_endpoint_vector_t &endps = d_inputs[port];
+ gr_endpoint_viter_t p;
+ for (p = endps.begin(); p != endps.end(); p++) {
+ gr_endpoint_vector_t tmp = resolve_endpoint(*p, true);
+ std::copy(tmp.begin(), tmp.end(), back_inserter(result));
+ }
}
else {
if (port < 0 || port >= (signed)d_outputs.size()) {
@@ -304,7 +350,7 @@
result = resolve_endpoint(d_outputs[port], false);
}
- if (!result.block()) {
+ if (result.empty()) {
msg << "unable to resolve "
<< (is_input ? "input port " : "output port ")
<< port;
@@ -323,15 +369,20 @@
d_outputs.clear();
}
-gr_endpoint
+gr_endpoint_vector_t
gr_hier_block2_detail::resolve_endpoint(const gr_endpoint &endp, bool
is_input) const
{
std::stringstream msg;
+ gr_endpoint_vector_t result;
// Check if endpoint is a leaf node
- if (cast_to_block_sptr(endp.block()))
- return endp;
-
+ if (cast_to_block_sptr(endp.block())) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Block " << endp.block() << " is a leaf node, returning."
<< std::endl;
+ result.push_back(endp);
+ return result;
+ }
+
// Check if endpoint is a hierarchical block
gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(endp.block()));
if (hier_block2) {
@@ -351,35 +402,61 @@
gr_hier_block2_detail::flatten_aux(gr_flat_flowgraph_sptr sfg) const
{
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
- std::cout << "flattening " << d_owner->name() << std::endl;
+ std::cout << "Flattening " << d_owner->name() << std::endl;
// Add my edges to the flow graph, resolving references to actual endpoints
gr_edge_vector_t edges = d_fg->edges();
+ gr_edge_viter_t p;
- for (gr_edge_viter_t p = edges.begin(); p != edges.end(); p++) {
+ for (p = edges.begin(); p != edges.end(); p++) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
std::cout << "Flattening edge " << (*p) << std::endl;
- gr_endpoint src_endp = resolve_endpoint(p->src(), false);
- gr_endpoint dst_endp = resolve_endpoint(p->dst(), true);
- sfg->connect(src_endp, dst_endp);
+ gr_endpoint_vector_t src_endps = resolve_endpoint(p->src(), false);
+ gr_endpoint_vector_t dst_endps = resolve_endpoint(p->dst(), true);
+
+ gr_endpoint_viter_t s, d;
+ for (s = src_endps.begin(); s != src_endps.end(); s++) {
+ for (d = dst_endps.begin(); d != dst_endps.end(); d++) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << (*s) << "->" << (*d) << std::endl;
+ sfg->connect(*s, *d);
+ }
+ }
+
}
- // Construct unique list of blocks used either in edges or
- // by themselves. I hate STL.
+ // Construct unique list of blocks used either in edges, inputs,
+ // outputs, or by themselves. I still hate STL.
gr_basic_block_vector_t blocks, tmp = d_fg->calc_used_blocks();
+
+ std::vector<gr_basic_block_sptr>::const_iterator b; // Because flatten_aux
is const
+ for (b = d_blocks.begin(); b != d_blocks.end(); b++)
+ tmp.push_back(*b);
+
+ std::vector<gr_endpoint_vector_t>::const_iterator ep; // Because flatten_aux
is const
+ std::vector<gr_endpoint>::const_iterator e; // Because flatten_aux
is const
+
+ for (ep = d_inputs.begin(); ep != d_inputs.end(); ep++)
+ for (e = (*ep).begin(); e != (*ep).end(); e++)
+ tmp.push_back((*e).block());
+
+ for (e = d_outputs.begin(); e != d_outputs.end(); e++)
+ tmp.push_back((*e).block());
+
+ sort(tmp.begin(), tmp.end());
+
std::insert_iterator<gr_basic_block_vector_t> inserter(blocks,
blocks.begin());
- std::vector<gr_basic_block_sptr>::const_iterator p; // Because flatten_aux
is const
- for (p = d_blocks.begin(); p != d_blocks.end(); p++)
- tmp.push_back(*p);
- sort(tmp.begin(), tmp.end());
unique_copy(tmp.begin(), tmp.end(), inserter);
// Recurse hierarchical children
for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(*p));
- if (hier_block2)
+ if (hier_block2) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "flatten_aux: recursing into hierarchical block " <<
hier_block2 << std::endl;
hier_block2->d_detail->flatten_aux(sfg);
+ }
}
}
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
2009-04-26 20:16:45 UTC (rev 10915)
@@ -1,5 +1,6 @@
+/* -*- c++ -*- */
/*
- * Copyright 2006,2007 Free Software Foundation, Inc.
+ * Copyright 2006,2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -48,16 +49,17 @@
gr_hier_block2 *d_owner;
gr_hier_block2_detail *d_parent_detail;
gr_flowgraph_sptr d_fg;
- gr_endpoint_vector_t d_inputs;
- gr_endpoint_vector_t d_outputs;
+ std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints
per external input
+ gr_endpoint_vector_t d_outputs; // Single internal endpoint per
external output
gr_basic_block_vector_t d_blocks;
void connect_input(int my_port, int port, gr_basic_block_sptr block);
void connect_output(int my_port, int port, gr_basic_block_sptr block);
void disconnect_input(int my_port, int port, gr_basic_block_sptr block);
void disconnect_output(int my_port, int port, gr_basic_block_sptr block);
- gr_endpoint resolve_port(int port, bool is_input);
- gr_endpoint resolve_endpoint(const gr_endpoint &endp, bool is_input) const;
+
+ gr_endpoint_vector_t resolve_port(int port, bool is_input);
+ gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool
is_input) const;
};
#endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -45,6 +45,8 @@
"""
Pass-through member requests to the C++ object.
"""
+ if not hasattr(self, "_hb"):
+ raise RuntimeError("hier_block2: invalid state--did you forget to
call gr.hier_block2.__init__ in a derived class?")
return getattr(self._hb, name)
def connect(self, *points):
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/prefs.py
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/prefs.py
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/prefs.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -1,5 +1,5 @@
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -53,8 +53,9 @@
invoke the methods in this python class.
"""
def __init__(self):
- _prefs_base.__init__(self)
- self.cp = ConfigParser.RawConfigParser()
+ _prefs_base.__init__(self)
+ self.cp = ConfigParser.RawConfigParser()
+ self.__getattr__ = lambda self, name: getattr(self.cp, name)
def _sys_prefs_filenames(self):
dir = _sys_prefs_dirname()
@@ -65,16 +66,12 @@
fnames.sort()
return [os.path.join(dir, f) for f in fnames]
-
def _read_files(self):
filenames = self._sys_prefs_filenames()
filenames.append(_user_prefs_filename())
#print "filenames: ", filenames
self.cp.read(filenames)
- def __getattr__(self, name):
- return getattr(self.cp, name)
-
# ----------------------------------------------------------------
# These methods override the C++ virtual methods of the same name
# ----------------------------------------------------------------
Property changes on:
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/pubsub.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10638-10648
/gnuradio/branches/developers/eb/t378/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10683-10688
/gnuradio/branches/developers/jblum/vlen/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10713-10765
/gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10653-10655,10660-10661,10671,10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864,10884
+
/gnuradio/branches/developers/eb/t348/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10638-10648
/gnuradio/branches/developers/eb/t378/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10683-10688
/gnuradio/branches/developers/jblum/vlen/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10713-10765
/gnuradio/branches/developers/jcorgan/t161/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10876-10880
/gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/pubsub.py:10653-10655,10660-10661,10671,10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -27,16 +27,6 @@
nop1 = gr.nop(gr.sizeof_int)
hblock.connect(hblock, nop1)
- def test_003_connect_input_in_use(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = gr.nop(gr.sizeof_int)
- nop2 = gr.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
- self.assertRaises(ValueError,
- lambda: hblock.connect(hblock, nop2))
-
def test_004_connect_output(self):
hblock = gr.hier_block2("test_block",
gr.io_signature(1,1,gr.sizeof_int),
@@ -251,6 +241,88 @@
self.assertRaises(RuntimeError,
lambda: tb.run())
+ def test_028_singleton_reconfigure(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0))
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ hb.connect(src, dst)
+ tb.connect(hb) # Singleton connect
+ tb.lock()
+ tb.disconnect_all()
+ tb.connect(src, dst)
+ tb.unlock()
+
+ def test_029_singleton_disconnect(self):
+ tb = gr.top_block()
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ tb.connect(src, dst)
+ tb.disconnect(src) # Singleton disconnect
+ tb.connect(src, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_030_nested_input(self):
+ tb = gr.top_block()
+ src = gr.vector_source_b([1,])
+ hb1 = gr.hier_block2("hb1",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ hb2 = gr.hier_block2("hb2",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ dst = gr.vector_sink_b()
+ tb.connect(src, hb1)
+ hb1.connect(hb1, hb2)
+ hb2.connect(hb2, gr.kludge_copy(gr.sizeof_char), dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_031_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ m1 = gr.multiply_const_ff(1.0)
+ m2 = gr.multiply_const_ff(2.0)
+ add = gr.add_ff()
+ hb.connect(hb, m1) # m1 is connected to hb external input #0
+ hb.connect(hb, m2) # m2 is also connected to hb external input #0
+ hb.connect(m1, (add, 0))
+ hb.connect(m2, (add, 1))
+ hb.connect(add, hb) # add is connected to hb external output #0
+ dst = gr.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
+ def test_032_nested_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ hb2 = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+
+ m1 = gr.multiply_const_ff(1.0)
+ m2 = gr.multiply_const_ff(2.0)
+ add = gr.add_ff()
+ hb2.connect(hb2, m1) # m1 is connected to hb2 external input #0
+ hb2.connect(hb2, m2) # m2 is also connected to hb2 external
input #0
+ hb2.connect(m1, (add, 0))
+ hb2.connect(m2, (add, 1))
+ hb2.connect(add, hb2) # add is connected to hb2 external output #0
+ hb.connect(hb, hb2, hb) # hb as hb2 as nested internal block
+ dst = gr.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
if __name__ == "__main__":
gr_unittest.main()
Modified:
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/top_block.py
===================================================================
---
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/top_block.py
2009-04-26 19:57:57 UTC (rev 10914)
+++
gnuradio/branches/releases/3.2/gnuradio-core/src/python/gnuradio/gr/top_block.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -89,6 +89,8 @@
self._tb = top_block_swig(name)
def __getattr__(self, name):
+ if not hasattr(self, "_tb"):
+ raise RuntimeError("top_block: invalid state--did you forget to
call gr.top_block.__init__ in a derived class?")
return getattr(self._tb, name)
def start(self):
Property changes on:
gnuradio/branches/releases/3.2/gr-qtgui/src/python/usrp_display.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/jcorgan/cpphier/gr-qtgui/src/python/usrp_display.py:10818-10858
/gnuradio/trunk/gr-qtgui/src/python/usrp_display.py:10826,10853,10859,10861-10862,10864,10884
+
/gnuradio/branches/developers/jcorgan/cpphier/gr-qtgui/src/python/usrp_display.py:10818-10858
/gnuradio/branches/developers/jcorgan/t161/gr-qtgui/src/python/usrp_display.py:10876-10880
/gnuradio/trunk/gr-qtgui/src/python/usrp_display.py:10826,10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
Modified: gnuradio/branches/releases/3.2/gr-wxgui/src/python/fftsink_gl.py
===================================================================
--- gnuradio/branches/releases/3.2/gr-wxgui/src/python/fftsink_gl.py
2009-04-26 19:57:57 UTC (rev 10914)
+++ gnuradio/branches/releases/3.2/gr-wxgui/src/python/fftsink_gl.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -63,7 +63,6 @@
gr.io_signature(0, 0, 0),
)
#blocks
- copy = gr.kludge_copy(self._item_size)
fft = self._fft_chain(
sample_rate=sample_rate,
fft_size=fft_size,
@@ -75,7 +74,7 @@
msgq = gr.msg_queue(2)
sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
#connect
- self.connect(self, copy, fft, sink)
+ self.connect(self, fft, sink)
#controller
self.controller = pubsub()
self.controller.subscribe(AVERAGE_KEY, fft.set_average)
Property changes on:
gnuradio/branches/releases/3.2/gr-wxgui/src/python/plotter/grid_plotter_base.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t378/gr-wxgui/src/python/plotter/grid_plotter_base.py:10683-10688
/gnuradio/branches/developers/jblum/vlen/gr-wxgui/src/python/plotter/grid_plotter_base.py:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/gr-wxgui/src/python/plotter/grid_plotter_base.py:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/gr-wxgui/src/python/plotter/grid_plotter_base.py:10713-10765
/gnuradio/trunk/gr-wxgui/src/python/plotter/grid_plotter_base.py:10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864,10884
+
/gnuradio/branches/developers/eb/t378/gr-wxgui/src/python/plotter/grid_plotter_base.py:10683-10688
/gnuradio/branches/developers/jblum/vlen/gr-wxgui/src/python/plotter/grid_plotter_base.py:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/gr-wxgui/src/python/plotter/grid_plotter_base.py:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/gr-wxgui/src/python/plotter/grid_plotter_base.py:10713-10765
/gnuradio/branches/developers/jcorgan/t161/gr-wxgui/src/python/plotter/grid_plotter_base.py:10876-10880
/gnuradio/trunk/gr-wxgui/src/python/plotter/grid_plotter_base.py:10673,10678,10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
Modified: gnuradio/branches/releases/3.2/gr-wxgui/src/python/scopesink_gl.py
===================================================================
--- gnuradio/branches/releases/3.2/gr-wxgui/src/python/scopesink_gl.py
2009-04-26 19:57:57 UTC (rev 10914)
+++ gnuradio/branches/releases/3.2/gr-wxgui/src/python/scopesink_gl.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -42,13 +42,12 @@
gr.io_signature(1, 1, gr.sizeof_float),
)
#blocks
- copy = gr.kludge_copy(gr.sizeof_float)
lpf = gr.single_pole_iir_filter_ff(0.0)
sub = gr.sub_ff()
mute = gr.mute_ff()
#connect
- self.connect(self, copy, sub, self)
- self.connect(copy, lpf, mute, (sub, 1))
+ self.connect(self, sub, self)
+ self.connect(self, lpf, mute, (sub, 1))
#subscribe
controller.subscribe(ac_couple_key, lambda x: mute.set_mute(not
x))
controller.subscribe(sample_rate_key, lambda x:
lpf.set_taps(2.0/x))
Modified: gnuradio/branches/releases/3.2/gr-wxgui/src/python/waterfallsink_gl.py
===================================================================
--- gnuradio/branches/releases/3.2/gr-wxgui/src/python/waterfallsink_gl.py
2009-04-26 19:57:57 UTC (rev 10914)
+++ gnuradio/branches/releases/3.2/gr-wxgui/src/python/waterfallsink_gl.py
2009-04-26 20:16:45 UTC (rev 10915)
@@ -63,7 +63,6 @@
gr.io_signature(0, 0, 0),
)
#blocks
- copy = gr.kludge_copy(self._item_size)
fft = self._fft_chain(
sample_rate=sample_rate,
fft_size=fft_size,
@@ -75,7 +74,7 @@
msgq = gr.msg_queue(2)
sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
#connect
- self.connect(self, copy, fft, sink)
+ self.connect(self, fft, sink)
#controller
self.controller = pubsub()
self.controller.subscribe(AVERAGE_KEY, fft.set_average)
Property changes on:
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_add_xx.xml
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/gr_add_vxx.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/gr_add_xx.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/gr_add_vxx.xml:10464-10658
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/gr_add_xx.xml:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/gr_add_xx.xml:10713-10765
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/gr_add_vxx.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/gr_add_vxx.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_add_xx.xml:10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864,10884
+
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/gr_add_vxx.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/gr_add_xx.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/gr_add_vxx.xml:10464-10658
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/gr_add_xx.xml:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/gr_add_xx.xml:10713-10765
/gnuradio/branches/developers/jcorgan/t161/grc/data/platforms/python/blocks/gr_add_xx.xml:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/gr_add_vxx.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/gr_add_vxx.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_add_xx.xml:10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
Property changes on:
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_channel_model.xml
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/blks2_channel_model.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/blks2_channel_model.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/blks2_channel_model.xml:10464-10658
/gnuradio/branches/developers/jblum/vlen/grc/data/platforms/python/blocks/blks2_channel_model.xml:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/blks2_channel_model.xml:10818-10858
/gnuradio/branches/developers/jcorgan/fw-optimize/grc/data/platforms/python/blocks/blks2_channel_model.xml:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/blks2_channel_model.xml:10713-10765
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/blks2_channel_model.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/blks2_channel_model.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_channel_model.xml:10826,10853,10864,10884
+
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/blks2_channel_model.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/blks2_channel_model.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/blks2_channel_model.xml:10464-10658
/gnuradio/branches/developers/jblum/vlen/grc/data/platforms/python/blocks/blks2_channel_model.xml:10667-10677
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/blks2_channel_model.xml:10818-10858
/gnuradio/branches/developers/jcorgan/fw-optimize/grc/data/platforms/python/blocks/blks2_channel_model.xml:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/blks2_channel_model.xml:10713-10765
/gnuradio/branches/developers/jcorgan/t161/grc/data/platforms/python/blocks/gr_channel_model.xml:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/blks2_channel_model.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/blks2_channel_model.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_channel_model.xml:10826,10853,10864-10865,10869,10871-10872,10881,10884,10907-10908
Property changes on:
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/gr_multiply_xx.xml
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10464-10658
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10713-10765
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864,10884
+
/gnuradio/branches/developers/eb/t348/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10638-10648
/gnuradio/branches/developers/eb/t378/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10683-10688
/gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10464-10658
/gnuradio/branches/developers/jcorgan/cpphier/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10818-10858
/gnuradio/branches/developers/jcorgan/gpio2/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10713-10765
/gnuradio/branches/developers/jcorgan/t161/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/grc/data/platforms/python/blocks/gr_multiply_vxx.xml:10540-10546
/gnuradio/trunk/grc/data/platforms/python/blocks/gr_multiply_xx.xml:10681,10686,10689,10691,10701-10702,10707-10710,10714-10721,10725,10728-10736,10739-10751,10759-10762,10766,10768-10769,10778-10779,10787-10789,10793,10826,10847-10848,10850,10852-10853,10859,10861-10862,10864-10865,10869,10871-10872,10881,10884,10907-10908
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10915 - in gnuradio/branches/releases/3.2: . gnuradio-core/src/lib/runtime gnuradio-core/src/python/gnuradio/gr gr-qtgui/src/python gr-wxgui/src/python gr-wxgui/src/python/plotter grc/data/platforms/python/blocks,
jcorgan <=