#pragma once #include #include enum class EventId { ClassFileLoadHook, MethodEntry, MethodExit, PreLoad, Loaded }; class EventBus { public: using Dispatcher = eventpp::EventDispatcher; static EventBus& getInstance() { static EventBus instance; return instance; } EventBus(const EventBus&) = delete; EventBus& operator=(const EventBus&) = delete; void post(EventId id, const void* event) { dispatcher.dispatch(id, event); } template auto appendListener(EventId id, const C& callback) { return dispatcher.appendListener(id, callback); } template auto prependListener(EventId id, const C& callback) { return dispatcher.prependListener(id, callback); } bool removeListener(EventId id, Dispatcher::Handle handle) { return dispatcher.removeListener(id, handle); } private: EventBus() = default; Dispatcher dispatcher; };