[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3943 - in gnuradio/branches/developers/jcorgan/hier/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3943 - in gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src: lib/runtime python/gnuradio/gr |
Date: |
Sun, 5 Nov 2006 12:37:31 -0700 (MST) |
Author: jcorgan
Date: 2006-11-05 12:37:31 -0700 (Sun, 05 Nov 2006)
New Revision: 3943
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
Log:
Work in progress.
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
2006-11-05 19:37:31 UTC (rev 3943)
@@ -43,8 +43,23 @@
delete d_impl;
}
+void gr_runtime::start()
+{
+ d_impl->start();
+}
+
+void gr_runtime::stop()
+{
+ d_impl->stop();
+}
+
+void gr_runtime::wait()
+{
+ d_impl->wait();
+}
+
void gr_runtime::run()
{
- if (GR_RUNTIME_DEBUG)
- std::cout << "gr_runtime::run() called." << std::endl;
+ start();
+ wait();
}
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
2006-11-05 19:37:31 UTC (rev 3943)
@@ -42,6 +42,10 @@
public:
~gr_runtime();
+
+ void start();
+ void stop();
+ void wait();
void run();
};
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
2006-11-05 19:37:31 UTC (rev 3943)
@@ -33,5 +33,9 @@
gr_runtime(gr_hier_block2_sptr top_block);
public:
- void run();
+ void start();
+ void stop();
+ void wait();
+ void run()
+ throw (std::runtime_error);
};
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2006-11-05 19:37:31 UTC (rev 3943)
@@ -25,13 +25,50 @@
#endif
#include <gr_runtime_impl.h>
-#include <iostream.h>
+#include <stdexcept>
+#include <iostream>
gr_runtime_impl::gr_runtime_impl(gr_hier_block2_sptr top_block) :
-d_top_block(top_block)
+d_top_block(top_block),
+d_running(false)
{
+ if (GR_RUNTIME_IMPL_DEBUG)
+ std::cout << "gr_runtime_impl::gr_runtime_impl()" << std::endl;
}
gr_runtime_impl::~gr_runtime_impl()
{
+ if (GR_RUNTIME_IMPL_DEBUG)
+ std::cout << "gr_runtime_impl::~gr_runtime_impl()" << std::endl;
}
+
+void gr_runtime_impl::start()
+{
+ if (GR_RUNTIME_IMPL_DEBUG)
+ std::cout << "gr_runtime_impl::start()" << std::endl;
+
+ if (d_running)
+ throw std::runtime_error("Already running");
+ else
+ d_running = true;
+
+ // Start
+}
+
+void gr_runtime_impl::stop()
+{
+ if (GR_RUNTIME_IMPL_DEBUG)
+ std::cout << "gr_runtime_impl::stop()" << std::endl;
+ if (!d_running)
+ return;
+
+ // Stop
+
+ d_running = false;
+}
+
+void gr_runtime_impl::wait()
+{
+ if (GR_RUNTIME_IMPL_DEBUG)
+ std::cout << "gr_runtime_impl::wait()" << std::endl;
+}
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
2006-11-05 19:37:31 UTC (rev 3943)
@@ -34,10 +34,16 @@
gr_runtime_impl(gr_hier_block2_sptr top_block);
friend class gr_runtime;
+ bool d_running;
gr_hier_block2_sptr d_top_block;
+
+ void start();
+ void stop();
+ void wait();
public:
~gr_runtime_impl();
+
};
#endif /* INCLUDED_GR_RUNTIME_IMPL_H */
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2006-11-04 22:54:32 UTC (rev 3942)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2006-11-05 19:37:31 UTC (rev 3943)
@@ -168,7 +168,21 @@
nop1 = gr.nop(gr.sizeof_char)
hblock.define_component("nop1", nop1)
self.assertRaises(ValueError, lambda: hblock.connect("nop1", 0,
"self-out", 0))
+
+ def test_018_runtime_run(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(0,0,0),
+ gr.io_signature(0,0,0))
+ runtime = gr.runtime(hblock)
+ runtime.run()
+
+ def test_019_runtime_run_twice(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(0,0,0),
+ gr.io_signature(0,0,0))
+ runtime = gr.runtime(hblock)
+ runtime.run()
+ self.assertRaises(RuntimeError, lambda: runtime.run())
-
if __name__ == "__main__":
gr_unittest.main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3943 - in gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src: lib/runtime python/gnuradio/gr,
jcorgan <=