Go to the documentation of this file.
5 #ifndef CCF_MPTK_MESSAGE_BUS_HPP_
6 #define CCF_MPTK_MESSAGE_BUS_HPP_
13 #include <boost/interprocess/sync/interprocess_semaphore.hpp>
15 #include <core/utils/base/base.hpp>
86 std::map<std::string, std::list<Message>> m_message_registry;
88 std::map<std::string, boost::interprocess::interprocess_semaphore*> m_message_registry_sem;
91 std::map<std::string, std::list<Response>> m_response_registry;
93 std::map<std::string, boost::interprocess::interprocess_semaphore*> m_response_registry_sem;
96 std::map<std::string, Response*> m_response_msg_id_registry;
98 std::vector<std::string> m_threads;
103 #endif // CCF_MPTK_MESSAGE_BUS_HPP_
MessageBus & RegisterThread(const std::string &thread_id)
Register thread which will send/receive messages on the Message Bus.
Definition: messageBus.cpp:64
Definition: manager.hpp:15
MessageBus()
Definition: messageBus.cpp:27
bool ReceiveResponseByMsgId(const std::string &msg_id, const double timeout, bool &timed_out, Response &response)
Check for a message for this thread. Returns true if message available.
Definition: messageBus.cpp:206
~MessageBus()
Definition: messageBus.cpp:35
void SplitDblTime(const double time, int64_t &secs, int64_t &nano_secs)
Definition: messageBus.cpp:20
void SendResponse(Response &response)
Send a response to a message received on the Message Bus.
Definition: messageBus.cpp:144
void Reset()
Reset the internal message queues and other objects.
Definition: messageBus.cpp:45
IFW CTD Multiprocessing Toolkit Message Bus.
Definition: messageBus.hpp:30
IFW CTD Multiprocessing Toolkit Message class.
Definition: message.hpp:19
IFW CTD Multiprocessing Toolkit Response class.
Definition: response.hpp:20
bool ReceiveResponse(const std::string &msg_sender_thread_id, const double timeout, bool &timed_out, Response &response)
Check for a message for this thread. Returns true if message available.
Definition: messageBus.cpp:155
void SendMessage(const Message &message)
Send a message on the Message Bus.
Definition: messageBus.cpp:80
std::string ToString() const
Generate ASCII output providing a status of the object (to the extend possible).
bool ThreadRegistered(const std::string &thread_id) const
Check if thread has been registered as participant in the Message Bus instance.
Definition: messageBus.cpp:56
bool ReceiveMessage(const std::string &receiver_thread_id, const double timeout, bool &timed_out, Message &message)
Check for a message for this thread. Returns true if message available.
Definition: messageBus.cpp:91