ifw-ccf 5.0.2
|
IFW CTD Multiprocessing Toolkit Message Bus. More...
#include <messageBus.hpp>
Public Member Functions | |
MessageBus () | |
~MessageBus () | |
void | Reset () |
Reset the internal message queues and other objects. | |
MessageBus & | RegisterThread (const std::string &thread_name) |
Register thread which will send/receive messages on the Message Bus. | |
bool | ThreadRegistered (const std::string &thread_name) const |
Check if thread has been registered as participant in the Message Bus instance. | |
void | SendMessage (const Message &message) |
Send a message on the Message Bus. | |
bool | ReceiveMessage (const std::string &receiver_thread_name, const double timeout, bool &timed_out, Message &message) |
Check for a message for this thread. Returns true if message available. | |
void | SendResponse (Response &response) |
Send a response to a message received on the Message Bus. | |
bool | ReceiveResponse (const std::string &msg_sender_thread_name, const double timeout, bool &timed_out, Response &response) |
Check for a message for this thread. Returns true if message available. | |
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. | |
std::string | ToString () const |
Generate ASCII output providing a status of the object (to the extend possible). | |
IFW CTD Multiprocessing Toolkit Message Bus.
The MPTK Message Bus is used for the inter-thread communication and synchronisation.
ifw::ccf::mptk::MessageBus::MessageBus | ( | ) |
ifw::ccf::mptk::MessageBus::~MessageBus | ( | ) |
bool ifw::ccf::mptk::MessageBus::ReceiveMessage | ( | const std::string & | receiver_thread_name, |
const double | timeout, | ||
bool & | timed_out, | ||
Message & | message ) |
Check for a message for this thread. Returns true if message available.
receiver_thread_name | Thread ID of receiver (thread checking for messages). |
timeout | Timeout to apply (NO_TIMEOUT, 0: return immediately, >0: Timeout in seconds). |
timed_out | True if waiting for a message timed out. |
message | Message received (if any). |
bool ifw::ccf::mptk::MessageBus::ReceiveResponse | ( | const std::string & | msg_sender_thread_name, |
const double | timeout, | ||
bool & | timed_out, | ||
Response & | response ) |
Check for a message for this thread. Returns true if message available.
bool ifw::ccf::mptk::MessageBus::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.
TODO: Handle priority.
MessageBus & ifw::ccf::mptk::MessageBus::RegisterThread | ( | const std::string & | thread_name | ) |
Register thread which will send/receive messages on the Message Bus.
void ifw::ccf::mptk::MessageBus::Reset | ( | ) |
Reset the internal message queues and other objects.
void ifw::ccf::mptk::MessageBus::SendMessage | ( | const Message & | message | ) |
Send a message on the Message Bus.
void ifw::ccf::mptk::MessageBus::SendResponse | ( | Response & | response | ) |
Send a response to a message received on the Message Bus.
bool ifw::ccf::mptk::MessageBus::ThreadRegistered | ( | const std::string & | thread_name | ) | const |
Check if thread has been registered as participant in the Message Bus instance.
std::string ifw::ccf::mptk::MessageBus::ToString | ( | ) | const |
Generate ASCII output providing a status of the object (to the extend possible).