class utils::EventHandler — HIRO 0.7.0 documentation

# class utils::EventHandler

## Overview

Provides an interface for registering and processing events for inherited classes. More…

    #include <EventHandler.h>

    class EventHandler {
    public:
        // structs

        struct Event;

        // methods

        virtual void PollEvents();

    protected:
        // typedefs

        typedef std::string EventId;

        // methods

        virtual void ProcessEvent(] const Event* e);

        template <typename T = Event, typename... Args>
        void RegisterEvent(Args... args);
    };

## Detailed Documentation

Provides an interface for registering and processing events for inherited classes.

Children of this class can register events at any time, but process them together when user requests to.

This class is thread safe and can be called from asynchronous processes.

### Typedefs

    typedef std::string EventId

Unique identifier of event.

### Methods

    virtual void PollEvents()

Request to process all registered events.

    virtual void ProcessEvent(] const Event* e)

Process a single event during polling.

    template <typename T = Event, typename... Args>
    void RegisterEvent(Args... args)

Adds new event to the event queue.