aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/eventManager.h
blob: 93def3644323ee33fd6c0db802cdc96e2068c107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include <unordered_map>
#include <memory>
#include "event.h"
#include "eventHandler.h"
using EventType = int;
using EventId = int;
class EventManager{
	public: 
		
		void subscribe(EventId eventId,std::unique_ptr<IEventHandlerWrapper>&& handler);
		void unsubscribe(EventId eventId, const std::string& handlerName);
		void dispatchEvents();
		void triggerEvent(EventId eventId);
		void queueEvent();
	private:
		std::unordered_map<EventType, std::vector<std::unique_ptr<IEventHandlerWrapper>>> m_subscribers;
};