partway through some documentation and bug fixing

This commit is contained in:
2018-02-17 01:08:31 -08:00
parent 176d9f7a54
commit 51be54c964
11 changed files with 146 additions and 38 deletions

View File

@@ -9,19 +9,24 @@ class VrEventPublisher;
class VrEventSubscriber {
public:
virtual ~VrEventSubscriber() {};
virtual ~VrEventSubscriber();
virtual void recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event) = 0;
void subscribe_to_publisher(VrEventPublisher* publisher, vr::Event::EventType type);
void subscribe_to_publisher(VrEventPublisher* publisher, std::vector<vr::Event::EventType> type);
void unsubscribe(VrEventPublisher* publisher, vr::Event::EventType type);
protected:
std::vector<vr::Event::EventType> subscribed_event_types;
// When we destroy a subscriber we need to be able to notify the publishers
// We have to keep track of every EventType because of the way EventTypes
// are mapped to subscribers in the publisher
std::map<VrEventPublisher*, std::vector<vr::Event::EventType>> subscriptions;
};
class VrEventPublisher {
public:
virtual ~VrEventPublisher() {};
virtual ~VrEventPublisher();
virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type);
virtual void subscribe(VrEventSubscriber *subscriber, std::vector<vr::Event::EventType> type);
virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c);