3 #include <easylogging++.h>
15 std::queue<std::shared_ptr<Event>> events;
19 auto e = events.front();
29 return !events.empty();
41 void onNotify(std::shared_ptr<Event> event) { events.push(event); }
48 virtual void onNotifyNow(std::shared_ptr<Event> event) = 0;
virtual void onNotifyNow(std::shared_ptr< Event > event)=0
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure ...
virtual void handleQueuedEvent(std::shared_ptr< Event > event)=0
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received...
Interface to be notified of an item's changes.
Definition: observer.h:13
void processEventQueue()
This should be called once ever loop for every Observer to properly use queued events.
Definition: observer.h:60
std::shared_ptr< Event > getEvent()
Definition: observer.h:17
virtual ~Observer()
Definition: observer.h:33
void onNotify(std::shared_ptr< Event > event)
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queu...
Definition: observer.h:41
bool eventsWaiting() const noexcept
Definition: observer.h:28