11 #include "threads/CriticalSection.h" 18 template<
typename Event>
22 virtual void HandleEvent(
const Event& event) = 0;
23 virtual void Cancel() = 0;
24 virtual bool IsOwnedBy(
void* obj) = 0;
28 template<
typename Event,
typename Owner>
32 typedef void (Owner::*Fn)(
const Event&);
34 void HandleEvent(
const Event& event)
override;
35 void Cancel()
override;
36 bool IsOwnedBy(
void *obj)
override;
41 CCriticalSection m_criticalSection;
44 template<
typename Event,
typename Owner>
46 : m_owner(owner), m_eventHandler(fn)
49 template<
typename Event,
typename Owner>
52 std::unique_lock<CCriticalSection> lock(m_criticalSection);
53 return obj !=
nullptr && obj == m_owner;
56 template<
typename Event,
typename Owner>
59 std::unique_lock<CCriticalSection> lock(m_criticalSection);
63 template<
typename Event,
typename Owner>
66 std::unique_lock<CCriticalSection> lock(m_criticalSection);
68 (m_owner->*m_eventHandler)(event);
Definition: EventStreamDetail.h:29
Definition: EventStreamDetail.h:15
Definition: EventStreamDetail.h:19