ifw
0.0.1-dev
|
IFW CTD Multiprocessing Toolkit Thread base class. More...
#include <Thread.hpp>
Public Types | |
enum | ThreadExecControl { THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED } |
Thread execution control/status. More... | |
enum | ThreadExecControl { THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED } |
Thread execution control/status. More... | |
enum | ThreadExecControl { THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED } |
Thread execution control/status. More... | |
Public Member Functions | |
Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1) | |
Constructor method, setting up the internal members. More... | |
virtual | ~Thread () |
std::string | Id () |
Return the thread ID. More... | |
void | Loop () |
Method to invoke the user provided business logic of the thread. More... | |
virtual void | UserLogic () |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More... | |
void | Start () |
Start the thread execution. More... | |
void | Stop () |
Stop the thread execution. More... | |
void | Pause () |
Pause the thread execution. More... | |
bool | CheckExecFlag () |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More... | |
ThreadExecControl | GetExecFlag () const |
Return the value of the Thread Execution Flag. More... | |
bool | Terminated () const |
Returns true if thread no longer running. More... | |
MessageBus & | MsgBus () |
Get acces to the MessageBus associated with this thread object. More... | |
std::string | Print () const |
Generate ASCII output providing a status of the object. More... | |
Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1) | |
Constructor method, setting up the internal members. More... | |
virtual | ~Thread () |
std::string | Id () |
Return the thread ID. More... | |
void | Loop () |
Method to invoke the user provided business logic of the thread. More... | |
virtual void | UserLogic () |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More... | |
void | Start () |
Start the thread execution. More... | |
void | Stop () |
Stop the thread execution. More... | |
void | Pause () |
Pause the thread execution. More... | |
bool | CheckExecFlag () |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More... | |
ThreadExecControl | GetExecFlag () const |
Return the value of the Thread Execution Flag. More... | |
bool | Terminated () const |
Returns true if thread no longer running. More... | |
MessageBus & | MsgBus () |
Get acces to the MessageBus associated with this thread object. More... | |
std::string | Print () const |
Generate ASCII output providing a status of the object. More... | |
Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1) | |
Constructor method, setting up the internal members. More... | |
virtual | ~Thread () |
std::string | Id () |
Return the thread ID. More... | |
void | Loop () |
Method to invoke the user provided business logic of the thread. More... | |
virtual void | UserLogic () |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More... | |
void | Start () |
Start the thread execution. More... | |
void | Stop () |
Stop the thread execution. More... | |
void | Pause () |
Pause the thread execution. More... | |
bool | CheckExecFlag () |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More... | |
ThreadExecControl | GetExecFlag () const |
Return the value of the Thread Execution Flag. More... | |
bool | Terminated () const |
Returns true if thread no longer running. More... | |
MessageBus & | MsgBus () |
Get acces to the MessageBus associated with this thread object. More... | |
std::string | Print () const |
Generate ASCII output providing a status of the object. More... | |
Static Public Attributes | |
static std::map< std::string, Thread * > | s_thread_registry |
static const std::string | THREAD_REGISTRY = "ThreadRegistry" |
IFW CTD Multiprocessing Toolkit Thread base class.
Thread execution control/status.
Enumerator | |
---|---|
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED |
Thread execution control/status.
Enumerator | |
---|---|
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED |
Thread execution control/status.
Enumerator | |
---|---|
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED | |
THREAD_EXEC_STOPPED | |
THREAD_EXEC_RUNNING | |
THREAD_EXEC_PAUSED |
ctd::mptk::Thread::Thread | ( | const std::string & | thread_id, |
MessageBus & | message_bus, | ||
const double | period = 0.1 |
||
) |
Constructor method, setting up the internal members.
thread_id | The ID of the thread. |
period | Period (s) (soft realtime) execution time for the thread loop (if relevant). |
|
virtual |
ctd::mptk::Thread::Thread | ( | const std::string & | thread_id, |
MessageBus & | message_bus, | ||
const double | period = 0.1 |
||
) |
Constructor method, setting up the internal members.
thread_id | The ID of the thread. |
period | Period (s) (soft realtime) execution time for the thread loop (if relevant). |
|
virtual |
ctd::mptk::Thread::Thread | ( | const std::string & | thread_id, |
MessageBus & | message_bus, | ||
const double | period = 0.1 |
||
) |
Constructor method, setting up the internal members.
thread_id | The ID of the thread. |
period | Period (s) (soft realtime) execution time for the thread loop (if relevant). |
|
virtual |
bool ctd::mptk::Thread::CheckExecFlag | ( | ) |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.
bool ctd::mptk::Thread::CheckExecFlag | ( | ) |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.
bool ctd::mptk::Thread::CheckExecFlag | ( | ) |
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.
Thread::ThreadExecControl ctd::mptk::Thread::GetExecFlag | ( | ) | const |
Return the value of the Thread Execution Flag.
ThreadExecControl ctd::mptk::Thread::GetExecFlag | ( | ) | const |
Return the value of the Thread Execution Flag.
ThreadExecControl ctd::mptk::Thread::GetExecFlag | ( | ) | const |
Return the value of the Thread Execution Flag.
std::string ctd::mptk::Thread::Id | ( | ) |
Return the thread ID.
std::string ctd::mptk::Thread::Id | ( | ) |
Return the thread ID.
std::string ctd::mptk::Thread::Id | ( | ) |
Return the thread ID.
void ctd::mptk::Thread::Loop | ( | ) |
void ctd::mptk::Thread::Loop | ( | ) |
Method to invoke the user provided business logic of the thread.
void ctd::mptk::Thread::Loop | ( | ) |
Method to invoke the user provided business logic of the thread.
MessageBus& ctd::mptk::Thread::MsgBus | ( | ) |
Get acces to the MessageBus associated with this thread object.
MessageBus& ctd::mptk::Thread::MsgBus | ( | ) |
Get acces to the MessageBus associated with this thread object.
MessageBus & ctd::mptk::Thread::MsgBus | ( | ) |
Get acces to the MessageBus associated with this thread object.
void ctd::mptk::Thread::Pause | ( | ) |
Pause the thread execution.
void ctd::mptk::Thread::Pause | ( | ) |
Pause the thread execution.
void ctd::mptk::Thread::Pause | ( | ) |
Pause the thread execution.
std::string ctd::mptk::Thread::Print | ( | ) | const |
Generate ASCII output providing a status of the object.
std::string ctd::mptk::Thread::Print | ( | ) | const |
Generate ASCII output providing a status of the object.
std::string ctd::mptk::Thread::Print | ( | ) | const |
Generate ASCII output providing a status of the object.
void ctd::mptk::Thread::Start | ( | ) |
Start the thread execution.
void ctd::mptk::Thread::Start | ( | ) |
Start the thread execution.
void ctd::mptk::Thread::Start | ( | ) |
Start the thread execution.
void ctd::mptk::Thread::Stop | ( | ) |
Stop the thread execution.
void ctd::mptk::Thread::Stop | ( | ) |
Stop the thread execution.
void ctd::mptk::Thread::Stop | ( | ) |
Stop the thread execution.
bool ctd::mptk::Thread::Terminated | ( | ) | const |
Returns true if thread no longer running.
bool ctd::mptk::Thread::Terminated | ( | ) | const |
Returns true if thread no longer running.
bool ctd::mptk::Thread::Terminated | ( | ) | const |
Returns true if thread no longer running.
|
virtual |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.
Reimplemented in TestThread, and TestThread1.
|
virtual |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.
Reimplemented in TestThread, and TestThread1.
|
virtual |
User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.
Reimplemented in TestThread, and TestThread1.
|
static |
|
static |