]> git.gag.com Git - debian/gnuradio/commitdiff
Merged jcorgan/sfg changeset r4082 into trunk (fixes gr.runtime parameter typing...
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 14 Dec 2006 16:28:36 +0000 (16:28 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 14 Dec 2006 16:28:36 +0000 (16:28 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4083 221aa14e-8319-0410-a670-987f0aec2ac5

gnuradio-core/src/lib/runtime/gr_runtime.i
gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
gnuradio-core/src/python/gnuradio/gr/hier_block2.py
gnuradio-core/src/python/gnuradio/gr/qa_runtime.py

index 496adff37f574c04654dbbe4f0d381b325029ac9..2933c71871cb43aa9da8db9637385b7d6c576cb9 100644 (file)
@@ -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);
 };
index 2b104cd99e77f0605a5a4954215bb84c6b481199..ffc897b8ba2ff010d349953368e13ead85acf23a 100644 (file)
@@ -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++)
index c44e6f07187d9e423a80c9913f88aecc86154b0d..cd185d168460368ccbd274488375637f7c5ed6ec 100644 (file)
@@ -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()
index 3e7f4e5f9f9f07ac725f1b3038c8595ffb5b1d19..1951afa8e3b3f17ac24443aa1814c8c6f20bdb8a 100755 (executable)
@@ -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()