4 #ifndef DGPY_SIGNAL_WRAPPER
5 #define DGPY_SIGNAL_WRAPPER
7 #include <boost/python.hpp>
9 #include <dynamic-graph/linear-algebra.h>
10 #include <dynamic-graph/signal.h>
11 #include <dynamic-graph/entity.h>
18 DYNAMIC_GRAPH_ENTITY_DECL();
25 void rmSignal(
const std::string& name);
28 template <
class T,
class Time>
37 typedef boost::function2<T&, T&, Time> function_t;
38 function_t f = boost::bind(&SignalWrapper::call,
this, _1, _2);
45 T& call(T& value, Time t) {
46 PyGILState_STATE gstate;
47 gstate = PyGILState_Ensure();
48 if (PyGILState_GetThisThreadState() == NULL) {
49 dgDEBUG(10) <<
"python thread not initialized" << std::endl;
52 value = boost::python::extract<T>(obj);
53 PyGILState_Release(gstate);