5 #ifndef IFW_CTD_MPTK_MANAGER_HPP_
6 #define IFW_CTD_MPTK_MANAGER_HPP_
8 #include "ctd/mptk/Message.hpp"
9 #include "ctd/mptk/Thread.hpp"
42 std::string
Print()
const;
46 template <
class THREAD_TYPE>
void CreateThread(
const std::string& thread_id,
48 const double period = 0.1) {
49 THREAD_TYPE* thread_ptr =
new THREAD_TYPE(thread_id, message_bus, period);
50 m_threads[thread_id] = thread_ptr;
56 std::map<std::string, Thread*> m_threads;
62 #endif // IFW_CTD_MPTK_MANAGER_HPP_
~Manager()
Definition: Manager.cpp:16
void StartThreads()
Execute all threads registered.
Definition: Manager.cpp:24
MessageBus & MsgBus()
Get reference to Message Bus.
Definition: Manager.cpp:75
IFW CTD Multiprocessing Toolkit Message Bus.
Definition: MessageBus.hpp:22
void PauseThreads()
Pause the threads.
Definition: Manager.cpp:59
std::string Print() const
Generate ASCII output providing a status of the object.
int16_t WaitForThreadTerm(const double time_out=ctd::defines::NO_TIMEOUT)
Wait for threads to terminate execution. Returns the number of threads running.
Definition: Manager.cpp:32
MessageBus & RegisterThread(const std::string &thread_id)
Register thread which will send/receive messages on the Message Bus.
Definition: MessageBus.cpp:27
Manager()
Definition: Manager.cpp:12
int16_t NbOfThreadsRunning() const
Returns the number of threads running; this includes the ones that may be paused. ...
Definition: Manager.cpp:49
void StopThreads()
Request threads to end execution.
Definition: Manager.cpp:67
void CreateThread(const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
Allocate new MPTK thread object of the given type. The allocated thread object is handled internally ...
Definition: Manager.hpp:46
const int64_t NO_TIMEOUT
Definition: defines.hpp:206