ifw-ccf 5.0.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ifw::ccf::mptk::MessageBus Class Reference

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.
 
MessageBusRegisterThread (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).
 

Detailed Description

IFW CTD Multiprocessing Toolkit Message Bus.

The MPTK Message Bus is used for the inter-thread communication and synchronisation.

Constructor & Destructor Documentation

◆ MessageBus()

ifw::ccf::mptk::MessageBus::MessageBus ( )

◆ ~MessageBus()

ifw::ccf::mptk::MessageBus::~MessageBus ( )

Member Function Documentation

◆ ReceiveMessage()

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.

Parameters
receiver_thread_nameThread ID of receiver (thread checking for messages).
timeoutTimeout to apply (NO_TIMEOUT, 0: return immediately, >0: Timeout in seconds).
timed_outTrue if waiting for a message timed out.
messageMessage received (if any).
Returns
True if a message is available for the given thread.

◆ ReceiveResponse()

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.

See also
ifw::ccf::mptk::MessageBus::ReceiveMessage().
Todo
: Handle priority.

◆ ReceiveResponseByMsgId()

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.

See also
ifw::ccf::mptk::MessageBus::ReceiveMessage().

TODO: Handle priority.

◆ RegisterThread()

MessageBus & ifw::ccf::mptk::MessageBus::RegisterThread ( const std::string & thread_name)

Register thread which will send/receive messages on the Message Bus.

◆ Reset()

void ifw::ccf::mptk::MessageBus::Reset ( )

Reset the internal message queues and other objects.

◆ SendMessage()

void ifw::ccf::mptk::MessageBus::SendMessage ( const Message & message)

Send a message on the Message Bus.

◆ SendResponse()

void ifw::ccf::mptk::MessageBus::SendResponse ( Response & response)

Send a response to a message received on the Message Bus.

◆ ThreadRegistered()

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.

◆ ToString()

std::string ifw::ccf::mptk::MessageBus::ToString ( ) const

Generate ASCII output providing a status of the object (to the extend possible).


The documentation for this class was generated from the following files: