diff options
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_runtime.i | 13 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_runtime_impl.cc | 2 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gr/hier_block2.py | 12 | ||||
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gr/qa_runtime.py | 2 |
4 files changed, 17 insertions, 12 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_runtime.i b/gnuradio-core/src/lib/runtime/gr_runtime.i index 496adff37..2933c7187 100644 --- a/gnuradio-core/src/lib/runtime/gr_runtime.i +++ b/gnuradio-core/src/lib/runtime/gr_runtime.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2006 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,7 +24,6 @@ class gr_runtime; typedef boost::shared_ptr<gr_runtime> gr_runtime_sptr; %template(gr_runtime_sptr) boost::shared_ptr<gr_runtime>; -%rename(runtime) gr_make_runtime; gr_runtime_sptr gr_make_runtime(gr_hier_block2_sptr top_block); class gr_runtime @@ -33,10 +32,8 @@ protected: gr_runtime(gr_hier_block2_sptr top_block); public: - void start() - throw (std::runtime_error); - void stop(); - void wait(); - void run() - throw (std::runtime_error); + void run() throw (std::runtime_error); + void start() throw (std::runtime_error); + void stop() throw (std::runtime_error); + void wait() throw (std::runtime_error); }; diff --git a/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc b/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc index 2b104cd99..ffc897b8b 100644 --- a/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc +++ b/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc @@ -76,7 +76,7 @@ void gr_runtime_impl::stop() { if (!d_running) - return; + throw std::runtime_error("not running"); for (gr_scheduler_thread_viter_t p = d_threads.begin(); p != d_threads.end(); p++) diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index c44e6f071..cd185d168 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio_swig_python import hier_block2_swig +from gnuradio_swig_python import hier_block2_swig, gr_make_runtime # # This hack forces a 'has-a' relationship to look like an 'is-a' one. @@ -38,3 +38,13 @@ class hier_block2(object): def define_component(self, name, comp): return self._hb.define_component(name, comp.basic_block()) + +class runtime(object): + def __init__(self, top_block): + if (isinstance(top_block, hier_block2)): + self._r = gr_make_runtime(top_block._hb) + else: + self._r = gr_make_runtime(top_block) + + def run(self): + self._r.run() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py b/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py index 3e7f4e5f9..1951afa8e 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py @@ -10,7 +10,6 @@ class test_runtime(gr_unittest.TestCase): def tearDown(self): pass - """ def test_001_run(self): hblock = gr.hier_block2("test_block", gr.io_signature(0,0,0), @@ -25,7 +24,6 @@ class test_runtime(gr_unittest.TestCase): runtime = gr.runtime(hblock) runtime.run() self.assertRaises(RuntimeError, lambda: runtime.run()) - """ if __name__ == "__main__": gr_unittest.main() |