June 2018
Intermediate to advanced
348 pages
8h 45m
English
The Event bus acts as a intermediary between event sources and event sinks. An event source, or producer, emits the events to a bus, and classes that have subscribed to events (consumers) will get notified. The pattern could be an instance of the Mediator design pattern. In an Event bus implementation, we have the following archetypes
In the implementation that follows, we have omitted the implementation of Controllers. The following code implements a toy version of an Event bus:
//----------- EventBus.cpp #include <rxcpp/rx.hpp> #include <memory> #include <map> #include <algorithm> ...