1 |
|
|
// Copyright (c) 2018, Joseph Mirabel |
2 |
|
|
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) |
3 |
|
|
|
4 |
|
|
#include "dynamic-graph/python/signal-wrapper.hh" |
5 |
|
|
|
6 |
|
|
#include <dynamic-graph/command-bind.h> |
7 |
|
|
#include <dynamic-graph/factory.h> |
8 |
|
|
|
9 |
|
|
namespace dynamicgraph { |
10 |
|
|
namespace python { |
11 |
|
|
void PythonSignalContainer::signalRegistration( |
12 |
|
|
const SignalArray<int>& signals) { |
13 |
|
|
Entity::signalRegistration(signals); |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
void PythonSignalContainer::rmSignal(const std::string& name) { |
17 |
|
|
Entity::signalDeregistration(name); |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(PythonSignalContainer, |
21 |
|
|
"PythonSignalContainer"); |
22 |
|
|
|
23 |
|
|
template <class T, class Time> |
24 |
|
|
bool SignalWrapper<T, Time>::checkCallable(pyobject c, std::string& error) { |
25 |
|
|
if (PyCallable_Check(c.ptr()) == 0) { |
26 |
|
|
error = boost::python::extract<std::string>(c.attr("__str__")()); |
27 |
|
|
error += " is not callable"; |
28 |
|
|
return false; |
29 |
|
|
} |
30 |
|
|
return true; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
template class SignalWrapper<bool, int>; |
34 |
|
|
template class SignalWrapper<int, int>; |
35 |
|
|
template class SignalWrapper<float, int>; |
36 |
|
|
template class SignalWrapper<double, int>; |
37 |
|
|
template class SignalWrapper<Vector, int>; |
38 |
|
|
} // namespace python |
39 |
|
|
} // namespace dynamicgraph |