|
UCILoader 1.1.2
Small C++ library that allows user to connect to a chess engines via UCI protocol.
|
Base class for events emitted by an EngineInstance. More...
#include <EngineEvent.h>
Public Member Functions | |
| virtual | ~EngineEvent () |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual uint32_t | getType () const =0 |
| Get the type code of this event. | |
| virtual const void * | getPayload () const =0 |
| Get the payload data associated with this event. | |
Base class for events emitted by an EngineInstance.
EngineEvent is the foundation of the asynchronous event system. Each event has a unique type code with exactly one bit set (power of 2), enabling efficient filtering and matching using bitwise operations.
Event Type Codes: All event type codes are defined in the NamedEngineEvents namespace as powers of 2, allowing safe bitwise OR operations to create event filters.
Event Payloads: Some events carry associated data (payload) accessible via getPayload(). Others have no payload and return nullptr. The specific event type determines both whether a payload exists and its data type.
Typical Usage:
|
pure virtual |
Get the payload data associated with this event.
Different event types carry different payload types. When a non-null pointer is returned, it points to an internally managed payload object. The caller must:
Payload Type Reference: See NamedEngineEvents namespace documentation for which events have payloads and their types. For example:
Example Usage:
Implemented in UCILoader::ConcreteEvent< Payload, EventCode >, and UCILoader::NoPayloadEvent.
|
pure virtual |
Get the type code of this event.
Each event type is represented by a unique power-of-2 value, enabling efficient bitwise filtering. Type codes are defined in the NamedEngineEvents namespace.
Bitwise Filtering Example:
Implemented in UCILoader::ConcreteEvent< Payload, EventCode >, and UCILoader::NoPayloadEvent.