ezEngine  Milestone 7
Event.h
1 #pragma once
2 
3 #include <Foundation/Types/Delegate.h>
4 #include <Foundation/Containers/DynamicArray.h>
5 #include <Foundation/Threading/Lock.h>
6 #include <Foundation/Threading/Mutex.h>
7 
18 template <typename EventData, typename MutexType>
20 {
21 protected:
23  ezEventBase(ezAllocatorBase* pAllocator);
24 
25 public:
28 
30  void Broadcast(EventData pEventData); // [tested]
31 
33  void AddEventHandler(Handler handler) const; // [tested]
34 
36  void RemoveEventHandler(Handler handler) const; // [tested]
37 
38  EZ_DISALLOW_COPY_AND_ASSIGN(ezEventBase);
39 
40 private:
43 
44  mutable MutexType m_Mutex;
45 
48 };
49 
51 template <typename EventData, typename MutexType = ezNoMutex, typename AllocatorWrapper = ezDefaultAllocatorWrapper>
52 class ezEvent : public ezEventBase<EventData, MutexType>
53 {
54 public:
55  ezEvent();
56  ezEvent(ezAllocatorBase* pAllocator);
57 };
58 
59 #include <Foundation/Communication/Implementation/Event_inl.h>
60