13 template <
typename TCallbackType>
17 typedef TCallbackType CallbackType;
19 virtual void Register(CallbackType& callback) = 0;
21 virtual void Unregister(CallbackType& callback) = 0;
31 virtual void Raise()
const = 0;
34 template <
typename TParam0>
38 typedef TParam0 Param0;
43 virtual void Raise(Param0& param0)
const = 0;
48 template <
typename TEventInterface>
52 typedef typename TEventInterface::CallbackType CallbackType;
53 typedef std::vector<CallbackType*> CallbackVector;
55 void Register(CallbackType& callback)
57 m_callbacks.push_back(&callback);
60 void Unregister(CallbackType& callback)
62 m_callbacks.erase(std::remove(m_callbacks.begin(), m_callbacks.end(), &callback), m_callbacks.end());
68 CallbackVector m_callbacks;
71 template <
typename TInterface>
75 typedef TInterface InterfaceType;
80 for (
auto callback : this->m_callbacks)
87 template <
typename TInterface>
91 typedef TInterface InterfaceType;
94 void Raise(
typename TInterface::Param0& param0)
const
96 for (
auto callback : this->m_callbacks)
105 template <
typename TInterface>
109 typedef typename TInterface::CallbackType CallbackType;
110 typedef TInterface InterfaceType;
113 : m_callback(
nullptr)
116 void Register(CallbackType& callback)
118 Eegeo_ASSERT(m_callback ==
nullptr);
119 m_callback = &callback;
122 void Unregister(CallbackType& callback)
124 Eegeo_ASSERT(m_callback == &callback);
125 m_callback =
nullptr;
130 CallbackType* m_callback;
133 template <
typename TInterface>
137 typedef TInterface InterfaceType;
141 if (this->m_callback !=
nullptr)
143 (*this->m_callback)();
148 template <
typename TInterface>
152 typedef TInterface InterfaceType;
154 void Raise(
typename TInterface::Param0& param0)
const
156 if (this->m_callback !=
nullptr)
158 (*this->m_callback)(param0);