YARP
Yet Another Robot Platform
execstate.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
11 #include <yarp/os/Time.h>
12 
13 #include <iostream>
14 
15 using namespace std;
16 using namespace FSM;
17 using namespace yarp::manager;
18 
19 
24 Event* EventFactory::startEvent = new Event("start");
25 Event* EventFactory::stopEvent = new Event("stop");
26 Event* EventFactory::killEvent = new Event("kill");
27 Event* EventFactory::failedEvent = new Event("failed");
28 Event* EventFactory::recoverEvent = new Event("recover");
29 Event* EventFactory::startModuleEventOk = new Event("startModule:ok");
30 Event* EventFactory::startModuleEventFailed = new Event("startModule:failed");
31 Event* EventFactory::stopModuleEventOk = new Event("stopModule:ok");
32 Event* EventFactory::stopModuleEventFailed = new Event("stopModule:failed");
33 Event* EventFactory::killModuleEventOk = new Event("killModule:ok");
34 Event* EventFactory::killModuleEventFailed = new Event("killModule:failed");
35 Event* EventFactory::connectAllPortsEventOk = new Event("connectAllPorts:ok");
36 Event* EventFactory::connectAllPortsEventFailed = new Event("connectAllPorts:failed");
37 Event* EventFactory::disconnectAllPortsEventOk = new Event("disconnectAllPorts:ok");
38 
39 
40 
44 Suspended::Suspended(Executable* pExecutable, FSM::IEventSink* pEventSink)
45  : StateBase(pEventSink, "SUSPENDED")
46 {
47  executable = pExecutable;
48 }
49 
50 
51 Suspended::~Suspended() = default;
52 
54 {
56 }
57 
59 {
61 }
62 
64 {
66 }
67 
68 void Suspended::moduleFailed() { /* do nothing*/ }
69 
70 
71 // refresh() from Suspended can be used for recovering from
72 // unexptected termination of manager.
74 {
76  int ret = executable->getBroker()->running();
77  if(ret == 1)
78  {
81  }
82  else if(ret == -1)
83  logger->addError(executable->getBroker()->error());
84 }
85 
86 
90 Ready::Ready(Executable* pExecutable, FSM::IEventSink* pEventSink)
91  : StateBase(pEventSink, "READY")
92 {
93  executable = pExecutable;
94  bAborted = false;
95 }
96 
97 
98 Ready::~Ready() = default;
99 
100 bool Ready::checkPriorityPorts()
101 {
102  CnnIterator itr;
103  for(itr=executable->getConnections().begin();
104  itr!=executable->getConnections().end(); itr++)
105  {
106  if((*itr).withPriority()
107  && !executable->getBroker()->exists((*itr).from()))
108  return false;
109  }
110  return true;
111 }
112 
113 bool Ready::checkResources(bool silent)
114 {
115  bool allOK = true;
116  ResourceIterator itr;
117  for(itr=executable->getResources().begin();
118  itr!=executable->getResources().end(); itr++)
119  {
120  if(!executable->getBroker()->exists((*itr).getPort())) {
121  allOK = false;
122  if(silent)
123  return false;
124  else {
125  OSTRINGSTREAM msg;
126  msg<<(*itr).getPort()<<" does not exist";
128  continue;
129  }
130  }
131  // check the rpc request/reply if required
132  if(strlen((*itr).getRequest()) != 0) {
133  const char* reply = executable->getBroker()->requestRpc((*itr).getPort(),
134  (*itr).getRequest(),
135  (*itr).getTimeout());
136  if(reply == nullptr) {
137  allOK = false;
138  OSTRINGSTREAM msg;
139  msg<<"cannot request resource "<<(*itr).getPort()<<" for "<<(*itr).getRequest();
141  if(silent)
142  return false;
143  else
144  continue;
145  }
146 
147  if(!compareString(reply, (*itr).getReply())) {
148  allOK = false;
149  OSTRINGSTREAM msg;
150  msg<<"waiting for the expected reply from resource "<<(*itr).getPort();
151  msg<<" for request "<<(*itr).getRequest();
152  msg<<". (expected="<<(*itr).getReply()<<", received="<<reply<<")";
154  if(silent)
155  return false;
156  else
157  continue;
158  }
159  }
160  }
161  return allOK;
162 }
163 
164 bool Ready::timeout(double base, double timeout)
165 {
167  if((yarp::os::SystemClock::nowSystem()-base) > timeout)
168  return true;
169  return false;
170 }
171 
173 {
174 
176 
177  // wait for priority ports if auto connecte is enabled
178  if(executable->autoConnect())
179  {
180  bAborted = false;
181  while(!checkPriorityPorts())
182  {
184  if(bAborted) return;
185  }
186  }
187 
188  // finding maximum resource-waiting timeout
189  ResourceIterator itr;
190  double maxTimeout = 0;
191  for(itr=executable->getResources().begin();
192  itr!=executable->getResources().end(); itr++)
193  {
194  if((*itr).getTimeout() > maxTimeout)
195  maxTimeout = (*itr).getTimeout();
196  }
197 
198  // waiting for resources
199  double base = yarp::os::SystemClock::nowSystem();
200  while(!checkResources()) {
201  if(bAborted) return;
202 
203  if(timeout(base, maxTimeout)) {
204  // give it the last try and collect the error messages
205  if(!checkResources(false)) {
206  OSTRINGSTREAM msg;
207  msg<<"cannot run "<<executable->getCommand()<<" on "<<executable->getHost();
208  msg<<" : Timeout while waiting for "<<executable->getHost();
209  logger->addError(msg);
210 
212  executable->getEvent()->onExecutableDied(executable);
213  return;
214  }
215  }
216  }
217 
218  if (executable->getPostExecWait() > 0)
219  {
221  }
222  executable->restoreOriginalPostExecWait();
223  if(!executable->getBroker()->start())
224  {
225  OSTRINGSTREAM msg;
226  msg<<"cannot run "<<executable->getCommand()<<" on "<<executable->getHost();
227  if(executable->getBroker()->error())
228  msg<<" : "<<executable->getBroker()->error();
229  logger->addError(msg);
230 
232  executable->getEvent()->onExecutableDied(executable);
233  }
234  else
235  {
237  executable->getEvent()->onExecutableStart(executable);
238  }
239 }
240 
241 
243 {
244  bAborted = true;
246 }
247 
248 void Ready::moduleFailed() { /* do nothing */ }
249 
250 
255  : StateBase(pEventSink, "CONNECTING"),
256  executable(pExecutable),
257  bAborted(false)
258 {}
259 
260 Connecting::~Connecting() = default;
261 
262 bool Connecting::checkNormalPorts()
263 {
264  CnnIterator itr;
265  for(itr=executable->getConnections().begin();
266  itr!=executable->getConnections().end(); itr++)
267  {
268  if(!executable->getBroker()->exists((*itr).to()) ||
269  !executable->getBroker()->exists((*itr).from()))
270  return false;
271  }
272  return true;
273 }
274 
275 
277 {
279  if(executable->autoConnect())
280  {
284  bAborted = false;
285  while(!checkNormalPorts())
286  {
288  if(bAborted) return;
289  }
290 
291  CnnIterator itr;
292  for(itr=executable->getConnections().begin();
293  itr!=executable->getConnections().end(); itr++)
294  {
295  if( !executable->getBroker()->connect((*itr).from(), (*itr).to(),
296  (*itr).carrier()) )
297  {
298  OSTRINGSTREAM msg;
299  msg<<"cannot connect "<<(*itr).from() <<" to "<<(*itr).to();
300  if(executable->getBroker()->error())
301  msg<<" : "<<executable->getBroker()->error();
302  logger->addError(msg);
303  }
304  else
305  executable->getEvent()->onCnnStablished(&(*itr));
306  }
307  }
308 
310 }
311 
313 {
315  int ret = executable->getBroker()->running();
316  if(ret == 0)
318  else if(ret == -1)
319  logger->addError(executable->getBroker()->error());
320 }
321 
323 {
324  bAborted = true;
326 }
327 
329 {
330  bAborted = true;
332  executable->getEvent()->onExecutableFailed(executable);
333 }
334 
335 
339 Running::Running(Executable* pExecutable, FSM::IEventSink* pEventSink)
340  : StateBase(pEventSink, "RUNNING")
341 {
342  executable = pExecutable;
343 }
344 
345 
346 Running::~Running() = default;
347 
349 {
351  int ret = executable->getBroker()->running();
352  if(ret == 0)
354  else if(ret == -1)
355  logger->addError(executable->getBroker()->error());
356 
357 }
358 
360 {
361  executable->getEvent()->onExecutableStart(executable);
362 }
363 
364 
366 {
368 }
369 
371 {
373 }
374 
376 {
378  executable->getEvent()->onExecutableFailed(executable);
379 }
380 
381 void Running::connectionFailed(void* which)
382 {
383  executable->getEvent()->onCnnFailed(which);
384 }
385 
386 
390 Dying::Dying(Executable* pExecutable, FSM::IEventSink* pEventSink)
391  : StateBase(pEventSink, "DYING")
392 {
393  executable = pExecutable;
394 }
395 
396 
397 Dying::~Dying() = default;
398 
400 {
402  if (executable->getPostStopWait() > 0)
403  {
405  }
406  executable->restoreOriginalPostStopWait();
407  if(!executable->getBroker()->stop())
408  {
409  OSTRINGSTREAM msg;
410  msg<<"cannot stop "<<executable->getCommand()<<" on "<<executable->getHost();
411  if(executable->getBroker()->error())
412  msg<<" : "<<executable->getBroker()->error();
413  logger->addError(msg);
414  executable->getEvent()->onError(executable);
416  }
417  else
418  {
420  executable->getEvent()->onExecutableStop(executable);
421  }
422 }
423 
425 {
427  if(!executable->getBroker()->kill())
428  {
429  OSTRINGSTREAM msg;
430  msg<<"cannot kill "<<executable->getCommand()<<" on "<<executable->getHost();
431  if(executable->getBroker()->error())
432  msg<<" : "<<executable->getBroker()->error();
433  logger->addError(msg);
434  executable->getEvent()->onError(executable);
436  }
437  else
438  {
440  executable->getEvent()->onExecutableDied(executable);
441  }
442 }
443 
444 
446 {
448  if(executable->autoConnect())
449  {
450  CnnIterator itr;
451  for(itr=executable->getConnections().begin();
452  itr!=executable->getConnections().end(); itr++)
453  {
454  if( !executable->getBroker()->disconnect((*itr).from(), (*itr).to(), (*itr).carrier()) )
455  {
456  OSTRINGSTREAM msg;
457  msg<<"cannot disconnect "<<(*itr).from() <<" to "<<(*itr).to();
458  if(executable->getBroker()->error())
459  msg<<" : "<<executable->getBroker()->error();
460  logger->addError(msg);
461  }
462  else
463  executable->getEvent()->onCnnReleased(&(*itr));
464  }
465  }
466  // We do not need to handle event disconnectAllPortsEventOk
467 }
468 
470 {
472  int ret = executable->getBroker()->running();
473  if(ret == 0)
475  else if(ret == -1)
476  logger->addError(executable->getBroker()->error());
477 
478 }
479 
480 void Dying::kill() { /* do nothing */ }
481 
483 {
484  // Notice that we should not call onExecutableFailed
485  // in DYING state!
487  executable->getEvent()->onExecutableDied(executable);
488 }
489 
490 
491 
492 
496 Dead::Dead(Executable* pExecutable, FSM::IEventSink* pEventSink)
497  : StateBase(pEventSink, "DEAD")
498 {
499  executable = pExecutable;
500 }
501 
502 
503 Dead::~Dead() = default;
504 
506 {
508 }
509 
511 {
512  executable->getEvent()->onExecutableStop(executable);
513 }
514 
515 
517 {
519 }
520 
521 // refresh() from Dead can be used for recovering from
522 // unexpect termination of manager.
524 {
526  int ret = executable->getBroker()->running();
527  if(ret == 1)
528  {
529  executable->getEvent()->onExecutableStart(executable);
531  }
532  else if(ret == -1)
533  logger->addError(executable->getBroker()->error());
534 }
535 
536 
537 void Dead::moduleFailed() { /* do nothing*/ }
538 
539 
540 
545 {
546  executable = pExecutable;
547  // creating states
548  suspended = new Suspended(executable, this);
549  ready = new Ready(executable, this);
550  connecting = new Connecting(executable, this);
551  running = new Running(executable, this);
552  dying = new Dying(executable, this);
553  dead = new Dead(executable, this);
554 
555  // setting initial state
556  setInitState(suspended);
557 
558  // transitions from suspended
559  addTransition(suspended, EventFactory::startEvent, ready);
560  addTransition(suspended, EventFactory::recoverEvent, running); //recovering
561  addTransition(suspended, EventFactory::killEvent, dying);
563  addTransition(suspended, EventFactory::failedEvent, suspended);
564 
565  // transitions from ready
568  addTransition(ready, EventFactory::killEvent, dying);
570 
571  // transitions from connecting
573  addTransition(connecting, EventFactory::failedEvent, dead);
574  addTransition(connecting, EventFactory::killEvent, dying);
576 
577  // transitions from running
578  addTransition(running, EventFactory::stopEvent, dying);
580  addTransition(running, EventFactory::killEvent, dying);
582 
583  // transitions from dying
591 
592  // transitions from dead
595  addTransition(dead, EventFactory::recoverEvent, running); // recovering
603 
604 }
605 
607 {
608  delete running;
609  delete suspended;
610  delete ready;
611  delete connecting;
612  delete dying;
613  delete dead;
614 }
615 
617 {
618  auto* tr = dynamic_cast<ITransition*>(currentState());
619  if (tr) {
620  tr->refresh();
621  }
622 }
623 
625 {
626  auto* tr = dynamic_cast<ITransition*>(currentState());
627  if (tr) {
628  tr->start();
629  }
630 }
631 
633 {
634  auto* tr = dynamic_cast<ITransition*>(currentState());
635  if (tr) {
636  tr->stop();
637  }
638 }
639 
641 {
642  auto* tr = dynamic_cast<ITransition*>(currentState());
643  if (tr) {
644  tr->kill();
645  }
646 }
647 
649 {
650  auto* tr = dynamic_cast<ITransition*>(currentState());
651  if (tr) {
652  tr->startModule();
653  }
654 }
655 
657 {
658  auto* tr = dynamic_cast<ITransition*>(currentState());
659  if (tr) {
660  tr->stopModule();
661  }
662 }
663 
665 {
666  auto* tr = dynamic_cast<ITransition*>(currentState());
667  if (tr) {
668  tr->killModule();
669  }
670 }
671 
673 {
674  auto* tr = dynamic_cast<ITransition*>(currentState());
675  if (tr) {
676  tr->connectAllPorts();
677  }
678 }
679 
681 {
682  auto* tr = dynamic_cast<ITransition*>(currentState());
683  if (tr) {
684  tr->disconnectAllPorts();
685  }
686 }
687 
689 {
690  auto* tr = dynamic_cast<ITransition*>(currentState());
691  if (tr) {
692  tr->moduleFailed();
693  }
694 }
695 
697 {
698  auto* tr = dynamic_cast<ITransition*>(currentState());
699  if (tr) {
700  tr->connectionFailed(which);
701  }
702 }
703 
704 // For debugging
706  Event* event, StateBase* current)
707 {
708  /*
709  std::cout<<executable->getID()<<": ";
710  std::cout<<"["<<previous->getName()<<"] ";
711  std::cout<<"--- ("<<event->getName()<<"/"<<event->getTimeStamp()<<") --> ";
712  std::cout<<"["<<current->getName()<<"]"<<endl;
713  */
714 }
executable.h
yarp::manager::Connecting::kill
void kill() override
Definition: execstate.cpp:322
yarp::manager::Running::kill
void kill() override
Definition: execstate.cpp:370
FSM::StateMachineBase::currentState
StateBase * currentState()
Definition: fsm.h:118
yarp::manager::Suspended::~Suspended
~Suspended() override
yarp::manager::Connecting
class Connecting
Definition: execstate.h:112
yarp::manager::Connecting::refresh
void refresh() override
Definition: execstate.cpp:312
yarp::manager::Connecting::connectAllPorts
void connectAllPorts() override
Definition: execstate.cpp:276
yarp::manager::Executable::getPostExecWait
double getPostExecWait()
Definition: executable.h:115
yarp::manager::Broker::error
virtual const char * error()=0
yarp::manager::MEvent::onCnnStablished
virtual void onCnnStablished(void *which)
Definition: executable.h:61
yarp::manager::Dead::Dead
Dead(Executable *pExecutable, FSM::IEventSink *pEventSink)
Class Dead.
Definition: execstate.cpp:496
yarp::manager::EventFactory::connectAllPortsEventOk
static FSM::Event * connectAllPortsEventOk
Definition: execstate.h:57
yarp::manager::EventFactory::stopEvent
static FSM::Event * stopEvent
Definition: execstate.h:47
yarp::manager::ExecMachine::startModule
void startModule()
Definition: execstate.cpp:648
FSM::Event
class IEventSink
Definition: fsm.h:32
yarp::manager::Executable::restoreOriginalPostExecWait
void restoreOriginalPostExecWait()
Definition: executable.h:120
yarp::manager::ExecMachine::~ExecMachine
~ExecMachine() override
Definition: execstate.cpp:606
yarp::manager::Broker::running
virtual int running()=0
yarp::manager::Executable::getHost
const char * getHost()
Definition: executable.h:107
yarp::manager::EventFactory::killModuleEventOk
static FSM::Event * killModuleEventOk
Definition: execstate.h:55
execstate.h
yarp::manager::ExecMachine::disconnectAllPorts
void disconnectAllPorts()
Definition: execstate.cpp:680
yarp::manager::OSTRINGSTREAM
std::stringstream OSTRINGSTREAM
Definition: utility.h:52
yarp::manager
Definition: application.h:24
yarp::manager::MEvent::onCnnReleased
virtual void onCnnReleased(void *which)
Definition: executable.h:62
yarp::manager::EventFactory::recoverEvent
static FSM::Event * recoverEvent
Definition: execstate.h:50
yarp::manager::EventFactory::startModuleEventFailed
static FSM::Event * startModuleEventFailed
Definition: execstate.h:52
yarp::manager::EventFactory::startModuleEventOk
static FSM::Event * startModuleEventOk
Definition: execstate.h:51
yarp::manager::Executable::getResources
ResourceContainer & getResources()
Definition: executable.h:95
yarp::manager::ErrorLogger
Singleton class ErrorLogger.
Definition: utility.h:60
yarp::manager::EventFactory::stopModuleEventOk
static FSM::Event * stopModuleEventOk
Definition: execstate.h:53
yarp::manager::Suspended::stop
void stop() override
Definition: execstate.cpp:58
yarp::manager::Dead
class Dead
Definition: execstate.h:179
yarp::manager::Dying::disconnectAllPorts
void disconnectAllPorts() override
Definition: execstate.cpp:445
yarp::manager::ITransition
all transitions are used in state machine
Definition: execstate.h:26
yarp::manager::Connecting::Connecting
Connecting(Executable *pExecutable, FSM::IEventSink *pEventSink)
Class Connecting.
Definition: execstate.cpp:254
yarp::manager::Running::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:375
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
yarp::manager::EventFactory::stopModuleEventFailed
static FSM::Event * stopModuleEventFailed
Definition: execstate.h:54
yarp::manager::CnnIterator
std::vector< Connection >::iterator CnnIterator
Definition: application.h:154
yarp::manager::ITransition::killModule
virtual void killModule()
Definition: execstate.h:37
yarp::manager::Running::start
void start() override
Definition: execstate.cpp:359
yarp::manager::compareString
bool compareString(const char *szFirst, const char *szSecond)
Definition: utility.cpp:305
yarp::manager::Running::Running
Running(Executable *pExecutable, FSM::IEventSink *pEventSink)
Class Running.
Definition: execstate.cpp:339
FSM::StateMachineBase::setInitState
void setInitState(StateBase *pState)
Definition: fsm.h:131
yarp::manager::Suspended::start
void start() override
Definition: execstate.cpp:53
yarp::manager::Ready::kill
void kill() override
Definition: execstate.cpp:242
yarp::manager::ExecMachine::moduleFailed
void moduleFailed()
Definition: execstate.cpp:688
yarp::manager::Running::refresh
void refresh() override
Definition: execstate.cpp:348
yarp::manager::ITransition::startModule
virtual void startModule()
Definition: execstate.h:35
yarp::os::SystemClock::nowSystem
static double nowSystem()
Definition: SystemClock.cpp:37
yarp::manager::Suspended::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:68
yarp::manager::ITransition::moduleFailed
virtual void moduleFailed()=0
yarp::manager::Dying::stopModule
void stopModule() override
Definition: execstate.cpp:399
yarp::manager::ITransition::stop
virtual void stop()
Definition: execstate.h:34
yarp::manager::Dying::kill
void kill() override
Definition: execstate.cpp:480
yarp::manager::Dead::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:537
yarp::manager::ITransition::stopModule
virtual void stopModule()
Definition: execstate.h:36
yarp::manager::Dead::~Dead
~Dead() override
yarp::manager::ExecMachine::kill
void kill()
Definition: execstate.cpp:640
yarp::manager::ErrorLogger::Instance
static ErrorLogger * Instance()
Singleton class ErrorLogger.
Definition: utility.cpp:102
yarp::manager::Running
class Running
Definition: execstate.h:135
yarp::manager::ExecMachine::onTransition
void onTransition(FSM::StateBase *previous, FSM::Event *event, FSM::StateBase *current) override
Callback onTransition represents the change in the states.
Definition: execstate.cpp:705
yarp::manager::ExecMachine::stop
void stop()
Definition: execstate.cpp:632
yarp::manager::Suspended::executable
Executable * executable
Definition: execstate.h:80
yarp::manager::Ready::Ready
Ready(Executable *pExecutable, FSM::IEventSink *pEventSink)
Class Ready.
Definition: execstate.cpp:90
yarp::os::SystemClock::delaySystem
static void delaySystem(double seconds)
Definition: SystemClock.cpp:32
yarp::manager::Suspended::kill
void kill() override
Definition: execstate.cpp:63
yarp::manager::Executable::restoreOriginalPostStopWait
void restoreOriginalPostStopWait()
Definition: executable.h:122
yarp::manager::MEvent::onExecutableStart
virtual void onExecutableStart(void *which)
Definition: executable.h:56
yarp::manager::Broker::kill
virtual bool kill()=0
yarp::manager::Dying::Dying
Dying(Executable *pExecutable, FSM::IEventSink *pEventSink)
Class Dying.
Definition: execstate.cpp:390
yarp::manager::Ready::startModule
void startModule() override
Definition: execstate.cpp:172
yarp::manager::ErrorLogger::addError
void addError(const char *szError)
Definition: utility.cpp:121
yarp::manager::EventFactory::failedEvent
static FSM::Event * failedEvent
Definition: execstate.h:49
yarp::manager::Broker::disconnect
virtual bool disconnect(const char *from, const char *to, const char *carrier)=0
yarp::manager::MEvent::onExecutableDied
virtual void onExecutableDied(void *which)
Definition: executable.h:58
FSM::StateBase
Class StateBase.
Definition: fsm.h:80
yarp::manager::Broker::connect
virtual bool connect(const char *from, const char *to, const char *carrier, bool persist=false)=0
yarp::manager::Dead::stop
void stop() override
Definition: execstate.cpp:510
yarp::manager::Ready::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:248
yarp::manager::Broker::requestRpc
virtual const char * requestRpc(const char *szport, const char *request, double timeout=0.0)=0
yarp::manager::ITransition::disconnectAllPorts
virtual void disconnectAllPorts()
Definition: execstate.h:39
yarp::manager::Dead::kill
void kill() override
Definition: execstate.cpp:516
yarp::manager::Suspended::refresh
void refresh() override
Definition: execstate.cpp:73
yarp::manager::ExecMachine::connectAllPorts
void connectAllPorts()
Definition: execstate.cpp:672
yarp::manager::Running::connectionFailed
void connectionFailed(void *which) override
Definition: execstate.cpp:381
yarp::manager::ITransition::kill
virtual void kill()=0
yarp::manager::Dying::~Dying
~Dying() override
yarp::manager::ErrorLogger::addWarning
void addWarning(const char *szWarning)
Definition: utility.cpp:108
yarp::manager::Running::stop
void stop() override
Definition: execstate.cpp:365
yarp::manager::Executable::getEvent
MEvent * getEvent()
Definition: executable.h:104
yarp::manager::Executable::getBroker
Broker * getBroker()
Definition: executable.h:100
yarp::manager::ExecMachine::killModule
void killModule()
Definition: execstate.cpp:664
yarp::manager::MEvent::onError
virtual void onError(void *which)
Definition: executable.h:64
yarp::manager::EventFactory::startEvent
static FSM::Event * startEvent
Initializing event factory.
Definition: execstate.h:46
FSM::StateMachineBase::addTransition
void addTransition(StateBase *source, Event *event, StateBase *target)
Definition: fsm.h:135
yarp::manager::Dying
class Dying
Definition: execstate.h:157
FSM::IEventSink
class IEventSink
Definition: fsm.h:59
yarp::manager::ITransition::connectAllPorts
virtual void connectAllPorts()
Definition: execstate.h:38
yarp::manager::Dying::killModule
void killModule() override
Definition: execstate.cpp:424
yarp::manager::MEvent::onExecutableStop
virtual void onExecutableStop(void *which)
Definition: executable.h:57
yarp::manager::ExecMachine::refresh
void refresh()
Definition: execstate.cpp:616
yarp::manager::Suspended
class Suspended
Definition: execstate.h:67
yarp::manager::Running::~Running
~Running() override
yarp::manager::ITransition::start
virtual void start()
Definition: execstate.h:33
yarp::manager::Broker::stop
virtual bool stop()=0
yarp::manager::EventFactory::killEvent
static FSM::Event * killEvent
Definition: execstate.h:48
yarp::manager::Dead::start
void start() override
Definition: execstate.cpp:505
yarp::manager::Executable::getCommand
const char * getCommand()
Definition: executable.h:105
yarp::manager::ExecMachine::start
void start()
Definition: execstate.cpp:624
yarp::manager::ExecMachine::ExecMachine
ExecMachine(Executable *pExecutable)
Class ExecMachine.
Definition: execstate.cpp:544
FSM
Definition: fsm.h:20
yarp::manager::Dying::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:482
yarp::manager::EventFactory::killModuleEventFailed
static FSM::Event * killModuleEventFailed
Definition: execstate.h:56
yarp::manager::ITransition::connectionFailed
virtual void connectionFailed(void *which)
Definition: execstate.h:32
Time.h
yarp::manager::ITransition::refresh
virtual void refresh()
Definition: execstate.h:31
yarp::manager::Dying::refresh
void refresh() override
Definition: execstate.cpp:469
yarp::manager::Connecting::~Connecting
~Connecting() override
yarp::manager::Connecting::moduleFailed
void moduleFailed() override
Definition: execstate.cpp:328
yarp::manager::Ready::~Ready
~Ready() override
FSM::StateBase::castEvent
void castEvent(Event *event)
Definition: fsm.h:93
yarp::manager::Executable::getConnections
CnnContainer & getConnections()
Definition: executable.h:93
yarp::manager::ResourceIterator
std::vector< ResYarpPort >::iterator ResourceIterator
Definition: application.h:157
yarp::manager::Broker::exists
virtual bool exists(const char *port)=0
yarp::manager::ExecMachine::stopModule
void stopModule()
Definition: execstate.cpp:656
yarp::manager::ExecMachine::connectionFailed
void connectionFailed(void *which)
Definition: execstate.cpp:696
yarp::manager::Executable
Class Executable.
Definition: executable.h:75
yarp::manager::Ready
class Ready
Definition: execstate.h:88
yarp::manager::Broker::start
virtual bool start()=0
yarp::manager::Dead::refresh
void refresh() override
Definition: execstate.cpp:523
yarp::manager::MEvent::onExecutableFailed
virtual void onExecutableFailed(void *which)
Definition: executable.h:59
yarp::manager::Executable::getPostStopWait
double getPostStopWait()
Definition: executable.h:117
yarp::manager::Executable::autoConnect
bool autoConnect()
Definition: executable.h:126
yarp::manager::MEvent::onCnnFailed
virtual void onCnnFailed(void *which)
Definition: executable.h:63