9 #ifndef SOT_CORE_VARIADICOP_HH
10 #define SOT_CORE_VARIADICOP_HH
17 #include <dynamic-graph/linear-algebra.h>
20 #include <dynamic-graph/all-signals.h>
21 #include <dynamic-graph/entity.h>
28 #include <boost/function.hpp>
38 template <
typename Tin,
typename Tout,
typename Time>
48 baseSigname(className +
"(" + name +
")::input(" +
getTypeInName() +
50 signalRegistration(
SOUT);
54 for (std::size_t i = 0; i <
signalsIN.size(); ++i) {
61 SignalTimeDependent<Tout, int>
SOUT;
64 std::ostringstream oss;
91 const std::size_t oldSize =
signalsIN.size();
92 for (std::size_t i = n; i < oldSize; ++i) _removeSignal(i);
96 for (std::size_t i = oldSize; i < (std::size_t)n; ++i) {
98 std::ostringstream oss;
99 oss << baseSigname <<
"sin" << i;
113 throw std::out_of_range(
"Wrong signal index");
125 void _removeSignal(
const std::size_t i) {
127 signalDeregistration(
signalsIN[i]->shortName());
132 signalRegistration(*s);
133 SOUT.addDependency(*s);
135 const std::string baseSigname;
138 template <
typename Operator>
140 typename Operator::Tout, int> {
141 typedef typename Operator::Tin Tin;
142 typedef typename Operator::Tout Tout;
159 op.initialize(
this, this->commandMap);
166 std::vector<const Tin *> in(this->signalsIN.size());
167 for (std::size_t i = 0; i < this->signalsIN.size(); ++i) {
168 const Tin &x = this->signalsIN[i]->access(time);
Definition: exception-abstract.hh:36
Definition: variadic-op.hh:39
SignalPtr< Tin, int > signal_t
Definition: variadic-op.hh:57
std::size_t addSignal()
Definition: variadic-op.hh:63
std::vector< signal_t * > signalsIN
Definition: variadic-op.hh:118
virtual ~VariadicAbstract(void)
Definition: variadic-op.hh:53
SignalTimeDependent< Tout, int > SOUT
Definition: variadic-op.hh:61
VariadicAbstract(const std::string &name, const std::string &className)
Definition: variadic-op.hh:44
int getSignalNumber() const
Definition: variadic-op.hh:109
void removeSignal()
Definition: variadic-op.hh:82
virtual void updateSignalNumber(int n)
Definition: variadic-op.hh:122
static std::string getTypeInName(void)
static std::string getTypeOutName(void)
std::size_t addSignal(const std::string &name)
Definition: variadic-op.hh:69
void setSignalNumber(const int &n)
Definition: variadic-op.hh:89
signal_t * getSignalIn(int i)
Definition: variadic-op.hh:111
Definition: variadic-op.hh:140
VariadicOp(const std::string &name)
Definition: variadic-op.hh:157
std::string getDocString() const
Definition: variadic-op.hh:155
virtual const std::string & getClassName() const
Definition: variadic-op.hh:154
static const std::string CLASS_NAME
Definition: variadic-op.hh:153
void updateSignalNumber(int n)
Definition: variadic-op.hh:175
Operator op
Definition: variadic-op.hh:146
Tout & computeOperation(Tout &res, int time)
Definition: variadic-op.hh:165
VariadicAbstract< Tin, Tout, int > Base
Definition: variadic-op.hh:148
virtual ~VariadicOp(void)
Definition: variadic-op.hh:162
Definition: abstract-sot-external-interface.hh:17