|
Event-Driven Programming in C++ 1.0
A case study on event-driven programming in C++
|
Provides functionality for handling event callbacks. More...
Classes | |
| class | Event |
| A simple class for handling callback events. More... | |
Provides functionality for handling event callbacks.
The callbacks namespace encapsulates a simple mechanism for event-driven programming using callbacks. It defines classes and functions that allow a callback function to be registered and triggered at a later point. The primary class in this namespace is the Event class, which uses a std::function<void()> to store a callback. This design enables decoupling of the event producer from the event consumer.
The Event class provides methods such as:
setCallback(): to assign a callback function.trigger(): to invoke the assigned callback.This mechanism is useful for asynchronous event handling in scenarios where you want to notify parts of your application when certain events occur without tightly coupling components.