9 #ifndef YARP_MANAGER_Executable
10 #define YARP_MANAGER_Executable
30 #define DEF_PERIOD 0.1
31 #define WDOG_PERIOD 5.0
68 class ConcurentWrapper;
69 class ConcurentRateWrapper;
84 void setID(
int id) { theID = id;}
85 void setCommand(
const char* val) {
if(val) { strCommand = val; } }
86 void setParam(
const char* val) {
if(val) { strParam = val; } }
87 void setHost(
const char* val) {
if(val) { strHost = val; } }
88 void setStdio(
const char* val) {
if(val) { strStdio = val; } }
89 void setWorkDir(
const char* val) {
if(val) { strWorkdir = val; } }
90 void setEnv(
const char* val) {
if(val) { strEnv = val; } }
106 const char*
getParam() {
return strParam.c_str(); }
107 const char*
getHost() {
return strHost.c_str(); }
108 const char*
getStdio() {
return strStdio.c_str(); }
110 const char*
getEnv() {
return strEnv.c_str(); }
136 std::string strCommand;
137 std::string strParam;
139 std::string strStdio;
140 std::string strWorkdir;
145 double originalWaitStart;
146 double originalWaitStop;
162 void startImplement();
163 void stopImplement();
164 void killImplement();
165 void watchdogImplement();
178 : labor(ptrLabor), executable(ptrExecutable) { }
184 if(labor && executable) {
185 (executable->*labor)();
209 if(labor && executable) {
210 (executable->*labor)();
~ConcurentRateWrapper() override
void run() override
Loop function.
ConcurentRateWrapper(Executable *ptrExecutable, ExecutableFuncPtr ptrLabor)
ConcurentWrapper(Executable *ptrExecutable, ExecutableFuncPtr ptrLabor)
void run() override
Main body of the new thread.
~ConcurentWrapper() override
Singleton class ErrorLogger.
void onBrokerStdout(const char *msg) override
void setParam(const char *val)
void setWorkDir(const char *val)
void setOriginalPostStopWait(double t)
void setPostStopWait(double t)
const char * getCommand()
const char * getWorkDir()
void restoreOriginalPostStopWait()
Executable(Broker *_broker, MEvent *_event, Module *module, bool bWatchDog=true)
void setPostExecWait(double t)
ResourceContainer & getResources()
void setOriginalPostExecWait(double t)
CnnContainer & getConnections()
BrokerType getBrokerType()
void setHost(const char *val)
void setStdio(const char *val)
void setEnv(const char *val)
void addResource(ResYarpPort &res)
void setCommand(const char *val)
void disableAutoConnect()
void restoreOriginalPostExecWait()
void addConnection(Connection &cnn)
bool shouldChangeBroker()
void setAndInitializeBroker(Broker *_broker)
virtual void onExecutableStdout(void *which, const char *msg)
virtual void onCnnFailed(void *which)
virtual void onExecutableFailed(void *which)
virtual void onExecutableStop(void *which)
virtual void onExecutableDied(void *which)
virtual void onCnnStablished(void *which)
virtual void onCnnReleased(void *which)
virtual ~MEvent()=default
virtual void onExecutableStart(void *which)
virtual void onError(void *which)
An abstraction for a periodic thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No)
Constructor.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A class for thread synchronization and mutual exclusion.
An abstraction for a thread of execution.
bool stop()
Stop the thread.
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
std::vector< Executable * >::iterator ExecutablePIterator
enum yarp::manager::__RSTATE RSTATE
std::vector< ResYarpPort > ResourceContainer
std::vector< Executable * > ExecutablePContainer
void(Executable::* ExecutableFuncPtr)()
std::vector< Connection > CnnContainer
The main, catch-all namespace for YARP.