partway through some documentation and bug fixing
This commit is contained in:
@@ -3,14 +3,53 @@
|
||||
#include "Pub_Sub.h"
|
||||
|
||||
|
||||
/**
|
||||
* Subscriber
|
||||
*/
|
||||
|
||||
VrEventSubscriber::~VrEventSubscriber() {
|
||||
|
||||
// Cycles through the publishers we're subscribed to
|
||||
for (auto const& publisher : subscriptions) {
|
||||
|
||||
// And one by one remove the EventTypes we're subscribed to
|
||||
for (auto event_type: publisher.second) {
|
||||
publisher.first->unsubscribe(this, event_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VrEventSubscriber::subscribe_to_publisher(VrEventPublisher* publisher, vr::Event::EventType type) {
|
||||
|
||||
publisher->subscribe(this, type);
|
||||
|
||||
subscriptions[publisher].push_back(type);
|
||||
}
|
||||
|
||||
void VrEventSubscriber::subscribe_to_publisher(VrEventPublisher* publisher, std::vector<vr::Event::EventType> type) {
|
||||
|
||||
publisher->subscribe(this, type);
|
||||
|
||||
subscriptions[publisher].insert(subscriptions[publisher].end(), type.begin(), type.end());
|
||||
}
|
||||
|
||||
void VrEventSubscriber::unsubscribe(VrEventPublisher* publisher, vr::Event::EventType type){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Publisher
|
||||
*/
|
||||
VrEventPublisher::~VrEventPublisher() {
|
||||
|
||||
// Cycle through the subscribers that are listening to us
|
||||
for (auto const& subscriber_bucket : subscribers) {
|
||||
|
||||
// And one by one remove the
|
||||
for (auto subscriber: subscriber_bucket.second){
|
||||
subscriber.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VrEventPublisher::subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type) {
|
||||
@@ -42,3 +81,4 @@ void VrEventPublisher::notify_subscribers(std::unique_ptr<vr::Event> event) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user