ifw-ccf  3.0.0-pre2
Public Member Functions | List of all members
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. More...
 
MessageBusRegisterThread (const std::string &thread_name)
 Register thread which will send/receive messages on the Message Bus. More...
 
bool ThreadRegistered (const std::string &thread_name) const
 Check if thread has been registered as participant in the Message Bus instance. More...
 
void SendMessage (const Message &message)
 Send a message on the Message Bus. More...
 
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. More...
 
void SendResponse (Response &response)
 Send a response to a message received on the Message Bus. More...
 
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. More...
 
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. More...
 
std::string ToString () const
 Generate ASCII output providing a status of the object (to the extend possible). More...
 

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

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

◆ ~MessageBus()

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

Member Function Documentation

◆ ReceiveMessage()

bool 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.
Todo:
: Handle priority.

◆ ReceiveResponse()

bool 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
ccf::mptk::MessageBus::ReceiveMessage().
Todo:
: Handle priority.

◆ ReceiveResponseByMsgId()

bool 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
ccf::mptk::MessageBus::ReceiveMessage().

TODO: Handle priority.

◆ RegisterThread()

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

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

◆ Reset()

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

Reset the internal message queues and other objects.

◆ SendMessage()

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

Send a message on the Message Bus.

◆ SendResponse()

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

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

◆ ThreadRegistered()

bool 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 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: