|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
9 #ifndef YARP_MANAGER_Executable
10 #define YARP_MANAGER_Executable
30 #define DEF_PERIOD 0.1 //s
31 #define WDOG_PERIOD 5.0 //s
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)();
226 #endif // __YARP_MANAGER_Executable__
void(Executable::* ExecutableFuncPtr)()
A class for thread synchronization and mutual exclusion.
virtual void onCnnStablished(void *which)
Executable(Broker *_broker, MEvent *_event, Module *module, bool bWatchDog=true)
void run() override
Main body of the new thread.
void setOriginalPostStopWait(double t)
void restoreOriginalPostExecWait()
std::vector< Connection > CnnContainer
bool shouldChangeBroker()
~ConcurentRateWrapper() override
void onBrokerStdout(const char *msg) override
void setPostExecWait(double t)
virtual void onCnnReleased(void *which)
ResourceContainer & getResources()
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No)
Constructor.
Singleton class ErrorLogger.
void setStdio(const char *val)
void addResource(ResYarpPort &res)
An abstraction for a thread of execution.
enum yarp::manager::__RSTATE RSTATE
void setPostStopWait(double t)
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
std::vector< ResYarpPort > ResourceContainer
void setHost(const char *val)
void restoreOriginalPostStopWait()
virtual void onExecutableStart(void *which)
std::vector< Executable * >::iterator ExecutablePIterator
virtual void onExecutableDied(void *which)
void setEnv(const char *val)
void addConnection(Connection &cnn)
void run() override
Loop function.
An abstraction for a periodic thread.
const char * getWorkDir()
virtual void onExecutableStdout(void *which, const char *msg)
virtual void onError(void *which)
void disableAutoConnect()
BrokerType getBrokerType()
void setWorkDir(const char *val)
void setOriginalPostExecWait(double t)
virtual void onExecutableStop(void *which)
virtual ~MEvent()=default
ConcurentWrapper(Executable *ptrExecutable, ExecutableFuncPtr ptrLabor)
The main, catch-all namespace for YARP.
const char * getCommand()
void setCommand(const char *val)
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
void setAndInitializeBroker(Broker *_broker)
std::vector< Executable * > ExecutablePContainer
~ConcurentWrapper() override
bool stop()
Stop the thread.
ConcurentRateWrapper(Executable *ptrExecutable, ExecutableFuncPtr ptrLabor)
CnnContainer & getConnections()
virtual void onExecutableFailed(void *which)
void setParam(const char *val)
virtual void onCnnFailed(void *which)