You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sentence=Event-Driven Devleopment Library intended for use with all microcontrollers
6
6
paragraph=This library is intended to be used with the all microcontrollers. It is designed to allow the user to very easily design, structure, and develop your embedded programs using the Event Pattern. This library is intended to be used with PlatformIO and the Arduino framework.
`EventListenerHandler` is returned when invoking `RegisterListener` against any implementor of `IEventListener`.
66
+
`EventListenerHandle` is returned when invoking `RegisterListener` against any implementor of `IEventListener`.
67
67
This class is used to manage the lifetime of the Listener and to unregister the Listener when it is no longer needed.
68
68
You should retain your reference to this Handler and call `Unregister` against it when you are done with the Listener (and on your objects' Destructor if applicable).
69
-
DON'T FORGET: YOUR code takes ownership of the EventListenerHandler, and you must destroy (`delete`) it when you are done with it.
69
+
DON'T FORGET: YOUR code takes ownership of the EventListenerHandle, and you must destroy (`delete`) it when you are done with it.
ReadWriteMutex<bool>* _isRegistered = new ReadWriteMutex(true); // _isRegistered can be altered by multiple threads, so we need to protect it with a Mutex
74
74
IEventListener* _listener; // This is a Weak Reference to the Listener (it will be nullified automatically when the Event Listener is destroyed)
75
75
std::type_index _eventType; // This is the Event Type (Hash) which we can use to quickly look up the Listeners for this Event Type
_eventListenersMutex.lock(); // Because we MIGHT be adding a new Listeners collection, we need to exclusively lock the Mutex
221
221
EventListeners* typeListeners = GetListenersForEventType(eventType); // Get the Listeners collection for this Event Type (will create the Listeners collection if it doesn't exist)
EventListenerContainer<IEvent>* listener = new EventListenerContainer<IEvent>(this, callback, handler, interest, maximumTimeSinceDispatch, customInterestCallback); // Create a new Listener (EventListenerContainer)
226
226
@@ -232,7 +232,7 @@ namespace ESPressio {
232
232
}
233
233
234
234
template <typename EventType>
235
-
IEventListenerHandler* RegisterListener(
235
+
IEventListenerHandle* RegisterListener(
236
236
std::function<void(
237
237
EventType*,
238
238
EventDispatchMethod dispatchMethod,
@@ -245,7 +245,7 @@ namespace ESPressio {
245
245
_eventListenersMutex.lock(); // Because we MIGHT be adding a new Listeners collection, we need to exclusively lock the Mutex
246
246
std::type_index eventType = typeid(EventType);
247
247
EventListeners* typeListeners = GetListenersForEventType(eventType); // Get the Listeners collection for this Event Type (will create the Listeners collection if it doesn't exist)
0 commit comments