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