ST_engine  0.3-ALPHA
Public Member Functions | Friends | List of all members
message_bus Class Reference

The central messaging system of the engine. All subsystem make extensive use of it. More...

#include <message_bus.hpp>

Public Member Functions

 message_bus ()
 
 ~message_bus ()
 
void clear ()
 
void send_msg (message *msg)
 
void subscribe (uint8_t msg, subscriber *sub)
 

Friends

class message_bus_tests
 

Detailed Description

The central messaging system of the engine. All subsystem make extensive use of it.

Handles all passing of messages to subscribers.

Definition at line 29 of file message_bus.hpp.

Constructor & Destructor Documentation

◆ message_bus()

message_bus::message_bus ( )

Default constructor for the message bus. Throws an exception if initialized twice.

Definition at line 41 of file message_bus.cpp.

◆ ~message_bus()

message_bus::~message_bus ( )

Message bus destructor. Clears all subscribers and sets the init flag to false to allow later initialization.

Definition at line 54 of file message_bus.cpp.

Member Function Documentation

◆ clear()

void message_bus::clear ( )

Removes all subscribers from the message bus.

Definition at line 62 of file message_bus.cpp.

◆ send_msg()

void message_bus::send_msg ( message arg)

Sends a message to all subscribers of that message type. Creates a copy of the message if it has more than one subscriber.

Definition at line 19 of file message_bus.cpp.

◆ subscribe()

void message_bus::subscribe ( uint8_t  msg,
subscriber sub 
)

Subscribe to a message type - adds the subscriber object to the list of subscribers for the given message type.

Parameters
msgThe type of the message.
subThe subscriber object.

Definition at line 71 of file message_bus.cpp.


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