ST_engine
0.3-ALPHA
|
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 |
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.
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 destructor. Clears all subscribers and sets the init flag to false to allow later initialization.
Definition at line 54 of file message_bus.cpp.
void message_bus::clear | ( | ) |
Removes all subscribers from the message bus.
Definition at line 62 of file message_bus.cpp.
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.
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.
msg | The type of the message. |
sub | The subscriber object. |
Definition at line 71 of file message_bus.cpp.