Go to the documentation of this file.
10 #include <dynamic-graph/factory.h>
11 #include <dynamic-graph/pool.h>
27 outputStreamPtr(NULL),
30 "Sequencer(" +
name +
")::output(dummy)::trigger") {
57 : sotEventAbstract(
name), taskPtr(task), defaultTaskName(
"NULL") {}
59 void init(std::istringstream &cmdArgs) {
64 sotDEBUG(15) <<
"Add task " << taskname << std::endl;
69 virtual void display(std::ostream &os)
const {
75 virtual const std::string &
getName()
const {
79 return defaultTaskName;
87 eventType = EVENT_ADD;
92 sotDEBUG(45) <<
"Sot = " << sotptr <<
". Task = " << taskPtr <<
"."
94 if ((NULL != sotptr) && (NULL != taskPtr)) sotptr->
push(*taskPtr);
98 virtual void display(std::ostream &os)
const {
109 eventType = EVENT_RM;
114 sotDEBUG(45) <<
"Sot = " << sotptr <<
". Task = " << taskPtr <<
"."
116 if ((NULL != sotptr) && (NULL != taskPtr)) sotptr->
remove(*taskPtr);
120 virtual void display(std::ostream &os)
const {
133 : sotEventAbstract(cmdLine +
"<cmd>"), cmd(cmdLine) {
134 eventType = EVENT_CMD;
138 void init(std::istringstream &args) {
140 std::stringbuf *pbuf =
args.rdbuf();
141 const std::size_t
size = (std::size_t)(pbuf->in_avail());
142 char *buffer =
new char[
size + 1];
143 pbuf->sgetn(buffer,
size);
151 virtual void display(std::ostream &os)
const { os <<
"Run: " << cmd; }
153 std::ostringstream onull;
154 onull.clear(std::ios::failbit);
155 std::istringstream iss(cmd);
168 TaskMap::iterator listKey =
taskMap.find(timeSpec);
169 if (
taskMap.end() == listKey) {
170 sotDEBUG(15) <<
"New element at " << timeSpec << std::endl;
171 taskMap[timeSpec].push_back(task);
180 const std::size_t time) {
181 TaskMap::iterator listKey =
taskMap.find(time);
185 for (TaskList::iterator itL = tl.begin(); itL != tl.end(); ++itL) {
186 if ((*itL)->getEventType() == eventType && (*itL)->getName() ==
name) {
193 if (tl.empty())
taskMap.erase(listKey);
199 TaskMap::iterator itM;
201 TaskList::iterator itL;
203 for (itL = currentMap.begin(); itL != currentMap.end(); ++itL)
222 if (
taskMap.end() != listKey) {
224 <<
": we've got a task to do!" << std::endl;
226 for (TaskList::iterator iter = tl.begin(); iter != tl.end(); ++iter) {
228 (*iter)->operator()(
sotPtr);
230 (*outputStreamPtr) <<
"At time t=" << timeSpec <<
": ";
232 (*outputStreamPtr) << std::endl;
250 <<
",mode=" << ((
playMode) ?
"play" :
"pause") <<
"): " << std::endl;
251 for (TaskMap::const_iterator iterMap =
taskMap.begin();
252 iterMap !=
taskMap.end(); iterMap++) {
253 os <<
" - t=" << (iterMap->first) <<
":\t";
254 const TaskList &tl = iterMap->second;
255 for (TaskList::const_iterator iterList = tl.begin(); iterList != tl.end();
257 (*iterList)->display(os);
const std::string defaultTaskName
sotEventTaskBased(const std::string name="", TaskAbstract *task=NULL)
sotEventCmd(const std::string cmdLine="")
const std::string & getEventCmd() const
virtual void display(std::ostream &os) const
sotEventAddATask(const std::string name="", TaskAbstract *task=NULL)
Entity & getEntity(const std::string &name)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(FeaturePosture, "FeaturePosture")
const std::string & getName() const
dynamicgraph::SignalTimeDependent< size_type, sigtime_t > triggerSOUT
This class implements the Stack of Task. It allows to deal with the priority of the controllers throu...
virtual const std::string & getName() const
size_type & trigger(size_type &dummy, const sigtime_t &time)
virtual void remove(const TaskAbstract &task)
Remove a task regardless to its position in the stack. It removes also the signals connected to the o...
#define sotDEBUGOUT(level)
void init(std::istringstream &cmdArgs)
#define sotDEBUGINOUT(level)
virtual void display(std::ostream &os) const
void rmTask(size_type eventType, const std::string &name, const std::size_t time)
#define sotDEBUGIN(level)
void addTask(sotEventAbstract *task, const std::size_t time)
void operator()(Sot *sotptr)
virtual void push(TaskAbstract &task)
Push the task in the stack. It has a lowest priority than the previous ones. If this is the first tas...
SignalArray< sigtime_t > sotNOSIGNAL(0)
void operator()(Sot *sotptr)
virtual void operator()(Sot *)
virtual void display(std::ostream &os) const
std::ostream * outputStreamPtr
virtual void display(std::ostream &os) const
static PoolStorage * getInstance()
Sequencer(const std::string &name)
sotEventRemoveATask(const std::string name="", TaskAbstract *task=NULL)
void init(std::istringstream &args)
std::list< sotEventAbstract * > TaskList
void signalRegistration(const SignalArray< sigtime_t > &signals)
virtual void display(std::ostream &os) const
sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31