mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
30 lines
685 B
C++
30 lines
685 B
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
class EventSubscriptionWatcher
|
|
{
|
|
public:
|
|
~EventSubscriptionWatcher();
|
|
|
|
void Subscribe(const std::string &event_name);
|
|
void Unsubscribe(const std::string &event_name);
|
|
bool IsSubscribed(const std::string &event_name) const;
|
|
|
|
static EventSubscriptionWatcher *Get() {
|
|
static EventSubscriptionWatcher* inst = nullptr;
|
|
if(!inst) {
|
|
inst = new EventSubscriptionWatcher();
|
|
}
|
|
|
|
return inst;
|
|
}
|
|
private:
|
|
EventSubscriptionWatcher() { }
|
|
EventSubscriptionWatcher(const EventSubscriptionWatcher&);
|
|
EventSubscriptionWatcher& operator=(const EventSubscriptionWatcher&);
|
|
|
|
std::unordered_map<std::string, bool> m_subs;
|
|
};
|