Commit 0f16bc14 authored by florent's avatar florent
Browse files

Add recompute method in SignalBase python class.

    * src/dynamic-graph-py.cc,
    * src/dynamic_graph/signal_base.py,
    * src/signal-base-py.cc.
parent 01830171
......@@ -21,6 +21,7 @@ namespace dynamicgraph {
extern PyObject* getTime(PyObject* self, PyObject* args);
extern PyObject* getValue(PyObject* self, PyObject* args);
extern PyObject* setValue(PyObject* self, PyObject* args);
extern PyObject* recompute(PyObject* self, PyObject* args);
}
namespace entity {
extern PyObject* create(PyObject* self, PyObject* args);
......@@ -128,6 +129,8 @@ static PyMethodDef dynamicGraphMethods[] = {
METH_VARARGS, "Read the value of a signal"},
{"signal_base_set_value", dynamicgraph::python::signalBase::setValue,
METH_VARARGS, "Set the value of a signal"},
{"signal_base_recompute", dynamicgraph::python::signalBase::recompute,
METH_VARARGS, "Recompute the signal at given time"},
// Entity
{"create_entity", dynamicgraph::python::entity::create, METH_VARARGS,
"create an Entity C++ object"},
......
......@@ -199,3 +199,9 @@ class SignalBase (object) :
"""
string = objectToString(val)
return wrap.signal_base_set_value(self.obj, string)
def recompute(self, time):
"""
Force signal to recompute the value at given time.
"""
return wrap.signal_base_recompute(self.obj, time)
......@@ -123,6 +123,22 @@ namespace dynamicgraph {
return Py_BuildValue("");
}
PyObject* recompute(PyObject* self, PyObject* args)
{
void * pointer = NULL;
PyObject* object = NULL;
unsigned int time;
if (!PyArg_ParseTuple(args,"OI", &object, &time))
return NULL;
if (!PyCObject_Check(object))
return NULL;
pointer = PyCObject_AsVoidPtr(object);
SignalBase<int>* signal = (SignalBase<int>*)pointer;
signal->recompute(time);
return Py_BuildValue("");
}
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment