4 #ifndef __SOT_EVENT_H__ 5 #define __SOT_EVENT_H__ 10 #include <dynamic-graph/entity.h> 11 #include <dynamic-graph/pool.h> 14 #include <dynamic-graph/signal.h> 16 #include <sot/core/config.hh> 49 checkSOUT(
"Event(" + name +
")::output(bool)::check"),
50 conditionSIN(NULL,
"Event(" + name +
")::input(bool)::condition"),
53 repeatAfterNIterations_(0) {
54 checkSOUT.setFunction(boost::bind(&
Event::check,
this, _1, _2));
55 signalRegistration(conditionSIN);
56 signalRegistration(checkSOUT);
59 std::string docstring =
62 addCommand(
"addSignal",
67 " Get list of signals\n";
73 " Repease event if input signal remains True for a while\n" 74 " Input: number of iterations before repeating output\n." 75 " 0 for no repetition";
84 return "Send an event when the input changes\n\n" 85 " The signal triggered is called whenever the condition is " 90 std::istringstream iss(signal);
96 std::ostringstream oss;
98 for (Triggers_t::const_iterator _sig = triggers.begin();
99 _sig != triggers.end(); ++_sig)
100 oss <<
'\'' << (*_sig)->getName() <<
"\', ";
106 repeatAfterNIterations_ = nbIterations;
113 bool &
check(
bool &ret,
const int &time);
125 #endif // __SOT_EVENT_H__ Event(const std::string &name)
void addSignal(const std::string &signal)
bool check(const T &value, const T &other)
Signal< bool, int > checkSOUT
virtual std::string getDocString() const
Header documentation of the python class.
void repeat(const int &nbIterations)
CommandVoid1< E, T > * makeCommandVoid1(E &entity, boost::function< void(const T &)> function, const std::string &docString)
SignalBase< int > * Trigger_t
dg::SignalBase< int > * getSignal(dg::Entity &e, const std::string &name)
std::string getSignalsByName() const
#define DYNAMIC_GRAPH_ENTITY_DECL()
static PoolStorage * getInstance()
std::vector< Trigger_t > Triggers_t
SignalPtr< bool, int > conditionSIN
bool & check(bool &ret, const int &time)