1 #ifndef __lib_python_connections_h
2 #define __lib_python_connections_h
4 #include <libsig_comp.h>
6 #include <lib/python/python.h>
15 void callPython(SWIG_PYOBJECT(ePyObject) tuple);
17 PyObject *getSteal(bool clear=false);
22 inline PyObject *PyFrom(int v)
24 return PyInt_FromLong(v);
27 inline PyObject *PyFrom(const char *c)
29 return PyString_FromString(c);
33 class PSignal0: public PSignal, public Signal0<R>
40 PyObject *pArgs = PyTuple_New(0);
44 return Signal0<R>::operator()();
48 template <class R, class V0>
49 class PSignal1: public PSignal, public Signal1<R,V0>
56 PyObject *pArgs = PyTuple_New(1);
57 PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
61 return Signal1<R,V0>::operator()(a0);
65 template <class R, class V0, class V1>
66 class PSignal2: public PSignal, public Signal2<R,V0,V1>
69 R operator()(V0 a0, V1 a1)
73 PyObject *pArgs = PyTuple_New(2);
74 PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
75 PyTuple_SET_ITEM(pArgs, 1, PyFrom(a1));
79 return Signal2<R,V0,V1>::operator()(a0, a1);