Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Event notification and handling
The S3FC Event notification and handling infrastructure provides a mechanism for generating events and for handlers to intercept and act on these events. Events are instances and are characterised on their (C++) type. The type of an event can range from the standard built-in C++ types to classes.The only restiction is that it must be possible to instantiate an instance of the event type or derived class thererof.
When some state of affairs needs to be indicated, an event (or derived class type) is instantiated and then dispatched to a number of registered event handlers. The dispatch causes the handler to execute a function that accepts the event as a single parameter. This handler function has the same name in all handlers. A dispatcher and a handler can only dispatch and handle events of a single type, that is determined at compile-time. A derived-class event can, however, be handled using a base-class event handler and dispatcher.
The following components are supplied:
- Event dispatcher: A base class that is templated on the type of event it is capable of dispatching. It allows an s3_event_handler to subscribe and unsubscribe and dispatches, upon request, an instance of an event to all registered Event handlers.[ s3_event_dispatcher ]
- Event handler: An ABC (Abstract Base Class) that is templated on the type of event it handles (receives) and supplies the interface to the function that is called to handle the event. [ s3_event_handler ]