6 #ifndef YARP_MANAGER_Executable
7 #define YARP_MANAGER_Executable
27 #define DEF_PERIOD 0.1
28 #define WDOG_PERIOD 5.0
65 class ConcurentWrapper;
66 class ConcurentRateWrapper;
81 void setID(
int id) { theID = id;}
82 void setCommand(
const char* val) {
if(val) { strCommand = val; } }
83 void setParam(
const char* val) {
if(val) { strParam = val; } }
84 void setHost(
const char* val) {
if(val) { strHost = val; } }
85 void setStdio(
const char* val) {
if(val) { strStdio = val; } }
86 void setWorkDir(
const char* val) {
if(val) { strWorkdir = val; } }
87 void setEnv(
const char* val) {
if(val) { strEnv = val; } }
103 const char*
getParam() {
return strParam.c_str(); }
104 const char*
getHost() {
return strHost.c_str(); }
105 const char*
getStdio() {
return strStdio.c_str(); }
107 const char*
getEnv() {
return strEnv.c_str(); }
133 std::string strCommand;
134 std::string strParam;
136 std::string strStdio;
137 std::string strWorkdir;
142 double originalWaitStart;
143 double originalWaitStop;
159 void startImplement();
160 void stopImplement();
161 void killImplement();
162 void watchdogImplement();
175 : labor(ptrLabor), executable(ptrExecutable) { }
181 if(labor && executable) {
182 (executable->*labor)();
206 if(labor && executable) {
207 (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.
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative)
Constructor.
bool isRunning() const
Returns true when the thread is started, false otherwise.
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.