|
UCILoader 1.1.2
Small C++ library that allows user to connect to a chess engines via UCI protocol.
|
Adapter class that wraps a callback function as an EventReceiver. More...
#include <EngineEvent.h>
Public Member Functions | |
| FunctionCallbackEventReceiver (std::function< void(const EngineEvent *)> callback, uint32_t allowedEvents) | |
| Constructor for callbacks that receive the full event. | |
| FunctionCallbackEventReceiver (std::function< void()> callback, uint32_t allowedEvents) | |
| Constructor for simple parameterless callbacks. | |
| virtual void | receiveEvent (const EngineEvent *event) override |
| Handle the event by invoking the stored callback. | |
| virtual uint32_t | eventFilter () override |
| Get the event filter bitmask. | |
Public Member Functions inherited from UCILoader::EventReceiver | |
| virtual | ~EventReceiver () |
| Virtual destructor that disconnects from all connected emitters. | |
| void | unlinkAll () |
| Disconnect this receiver from all connected emitters. | |
| virtual uint32_t | eventFilter ()=0 |
| Get the event filter bitmask for this receiver. | |
| virtual void | receiveEvent (const EngineEvent *event)=0 |
| Handle an incoming event. | |
Adapter class that wraps a callback function as an EventReceiver.
FunctionCallbackEventReceiver allows simple function or lambda callbacks to be used with the event system without creating a full EventReceiver subclass.
Typically used via EventEmitter::connect() overloads:
|
inline |
Constructor for callbacks that receive the full event.
| callback | Function to invoke for each matching event (receives EngineEvent*) |
| allowedEvents | Bitmask of event types to pass to the callback |
|
inline |
Constructor for simple parameterless callbacks.
| callback | Function to invoke for each matching event (receives no parameters) |
| allowedEvents | Bitmask of event types to trigger the callback |
|
inlineoverridevirtual |
Get the event filter bitmask.
Implements UCILoader::EventReceiver.
|
overridevirtual |
Handle the event by invoking the stored callback.
| event | The EngineEvent to process |
Implements UCILoader::EventReceiver.