openMSX
MSXEventDistributor.hh
Go to the documentation of this file.
1 #ifndef MSXEVENTDISTRIBUTOR_HH
2 #define MSXEVENTDISTRIBUTOR_HH
3 
4 #include "EmuTime.hh"
5 #include <vector>
6 
7 namespace openmsx {
8 
9 class MSXEventListener;
10 class Event;
11 
13 {
14 public:
17 
18  MSXEventDistributor() = default;
20 
26 
32 
40  void distributeEvent(const Event& event, EmuTime::param time);
41 
42 private:
43  [[nodiscard]] bool isRegistered(MSXEventListener* listener) const;
44 
45 private:
46  std::vector<MSXEventListener*> listeners; // unordered
47  std::vector<MSXEventListener*> listenersCopy; // see distributeEvent()
48 };
49 
50 } // namespace openmsx
51 
52 #endif
void registerEventListener(MSXEventListener &listener)
Registers a given object to receive certain events.
void distributeEvent(const Event &event, EmuTime::param time)
Deliver the event to all registered listeners.
MSXEventDistributor(const MSXEventDistributor &)=delete
void unregisterEventListener(MSXEventListener &listener)
Unregisters a previously registered event listener.
MSXEventDistributor & operator=(const MSXEventDistributor &)=delete
This file implemented 3 utility functions:
Definition: Autofire.cc:9