#pragma once #include #include #include "Event.hpp" #include class VrEventPublisher; class VrEventSubscriber { public: virtual ~VrEventSubscriber() {}; virtual void recieve_event(VrEventPublisher* publisher, std::unique_ptr event) = 0; void subscribe_to_publisher(VrEventPublisher* publisher, vr::Event::EventType type); void subscribe_to_publisher(VrEventPublisher* publisher, std::vector type); protected: std::vector subscribed_event_types; }; class VrEventPublisher { public: virtual ~VrEventPublisher() {}; virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type); virtual void subscribe(VrEventSubscriber *subscriber, std::vector type); virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c); virtual void notify_subscribers(std::unique_ptr event); private: std::map> subscribers; };