Commit 942b4d97 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel

Add command Event::list

parent 67b23caa
......@@ -23,6 +23,7 @@
#include <dynamic-graph/signal-time-dependent.h>
#include <dynamic-graph/pool.h>
#include <dynamic-graph/command-bind.h>
#include <dynamic-graph/command-getter.h>
#include <sot/hpp/config.hh>
......@@ -50,6 +51,12 @@ namespace dynamicgraph {
" Add a signal\n";
addCommand ("addSignal", makeCommandVoid1
(*this, &Event::addSignal, docstring));
docstring =
"\n"
" Get list of signals\n";
addCommand ("list", new command::Getter<Event, std::string>
(*this, &Event::getSignalsByName, docstring));
}
~Event () {}
......@@ -68,6 +75,18 @@ namespace dynamicgraph {
triggers.push_back(&PoolStorage::getInstance()->getSignal (iss));
}
// Returns the Python string representation of the list of signal names.
std::string getSignalsByName () const
{
std::ostringstream oss;
oss << "(";
for (Triggers_t::const_iterator _sig = triggers.begin();
_sig != triggers.end(); ++_sig)
oss << '\'' << (*_sig)->getName() << "\', ";
oss << ")";
return oss.str();
}
private:
typedef SignalBase<int>* Trigger_t;
typedef std::vector<Trigger_t> Triggers_t;
......
Markdown is supported
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