#pragma once #include "ircmsg.hpp" #include #include enum class EventOutcome { Pass, Consume, }; enum class ThreadOutcome { Continue, Finish, }; struct Event { virtual ~Event() {} }; struct Thread { using priority_type = std::uint64_t; using callback_result = std::pair; virtual ~Thread() {} virtual auto on_event(Event const& event) -> callback_result { return {}; }; virtual auto priority() const -> priority_type = 0; }; struct Dispatcher { std::vector> threads_; std::vector> events_; bool dispatching_; /// Apply a function to all the threads in priority order auto dispatch(std::shared_ptr event) -> void; auto add_thread(std::shared_ptr thread) -> void; };