5 #include "IGenericEventProvider.h"
8 #include <unordered_map>
14 template <
typename TEvent>
19 using ParamType =
typename TEvent::Param0;
21 virtual TEvent& GetEvent(
const typename GenericEventProxy::KeyType& key)
override
23 auto itr = m_eventMap.find(key);
24 if (itr == m_eventMap.end())
26 itr = m_eventMap.emplace(std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(*
this, key)).first;
31 virtual void operator()(ParamType& key)
const override
33 auto itr = m_eventMap.find(key);
34 if (itr != m_eventMap.end())
36 itr->second.Raise(key);
43 struct ConcreteEvent :
public TEvent1<TEvent>
50 void Unregister(
typename TEvent::CallbackType& callback)
override
53 if (this->m_callbacks.empty())
55 parent.m_eventMap.erase(key);
63 std::unordered_map<typename GenericEventProxy::KeyType, ConcreteEvent> m_eventMap;