5 #ifndef IFW_CTD_MPTK_THREAD_HPP_
6 #define IFW_CTD_MPTK_THREAD_HPP_
11 #include "rad/Logger.hpp"
12 #include "rad/Exceptions.hpp"
14 #include "ctd/mptk/MessageBus.hpp"
37 Thread(
const std::string& thread_id,
39 const double period = 0.1);
84 std::string
Print()
const;
87 std::string m_thread_id;
91 double m_previous_start_time;
92 double m_next_execution;
93 bool m_thread_terminated;
95 std::shared_ptr<std::thread> m_sys_thread;
102 #endif // IFW_CTD_MPTK_THREAD_HPP_
Definition: Thread.hpp:27
std::string Id()
Return the thread ID.
Definition: Thread.cpp:53
Definition: Thread.hpp:28
ThreadExecControl GetExecFlag() const
Return the value of the Thread Execution Flag.
Definition: Thread.cpp:85
static const std::string THREAD_REGISTRY
Definition: Thread.hpp:23
bool Terminated() const
Returns true if thread no longer running.
Definition: Thread.cpp:138
MessageBus & MsgBus()
Get acces to the MessageBus associated with this thread object.
Definition: Thread.cpp:132
ThreadExecControl
Thread execution control/status.
Definition: Thread.hpp:26
bool CheckExecFlag()
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread...
Definition: Thread.cpp:113
IFW CTD Multiprocessing Toolkit Message Bus.
Definition: MessageBus.hpp:22
void Loop()
Method to invoke the user provided business logic of the thread.
Definition: Thread.cpp:59
Definition: Thread.hpp:29
void Pause()
Pause the thread execution.
Definition: Thread.cpp:107
static std::map< std::string, Thread * > s_thread_registry
Definition: Thread.hpp:22
void Start()
Start the thread execution.
Definition: Thread.cpp:91
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.
Definition: Thread.cpp:78
virtual ~Thread()
Definition: Thread.cpp:47
Thread(const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
Constructor method, setting up the internal members.
Definition: Thread.cpp:26
void Stop()
Stop the thread execution.
Definition: Thread.cpp:101
std::string Print() const
Generate ASCII output providing a status of the object.