37#ifndef _OPENLCB_EVENTHANDLERCONTAINER_HXX_
38#define _OPENLCB_EVENTHANDLERCONTAINER_HXX_
42#include <forward_list>
90 : container_(container) {
94 if (it_ == container_->end())
return nullptr;
100 it_ = container_->end();
103 it_ = container_->begin();
107 typename C::iterator it_;
127 handlers_.push_front(entry);
131 uint32_t user_arg_mask = 0)
OVERRIDE
134 handlers_.remove_if([handler, user_arg, user_arg_mask](
137 ((e.
user_arg & user_arg_mask) == (user_arg & user_arg_mask));
143 typedef std::forward_list<EventRegistryEntry> HandlersList;
144 HandlersList handlers_;
158 uint32_t user_arg_mask = 0)
OVERRIDE;
183 typedef std::map<uint8_t, OneMaskMap> MaskLookupMap;
See OSMutexLock in os/OS.hxx.
Lightweight locking class for protecting small critical sections.
An mostly std::set<> compatible class that stores the internal data in a sorted vector.
Abstract base class for all event handlers.
Abstract class for representing iteration through a container for event handlers.
EventIterator()
Creates an EventIterator.
virtual EventRegistryEntry * next_entry()=0
Steps the iteration.
virtual void clear_iteration()=0
Stops iteration and resets iteration variables.
virtual void init_iteration(EventReport *event)=0
Starts the iteration.
Structure used in registering event handlers.
EventHandler * handler
Pointer to the handler.
uint32_t user_arg
Opaque user argument.
EventId event
Stores the event ID or beginning of range for which to register the given handler.
Global static object for registering event handlers.
void set_dirty()
Implementations must call this function from register and unregister handler to mark iterators being ...
EventIterator that produces every single entry in a given container (which can be any STL-compatible ...
void init_iteration(EventReport *) OVERRIDE
Starts the iteration.
void clear_iteration() OVERRIDE
Stops iteration and resets iteration variables.
EventRegistryEntry * next_entry() OVERRIDE
Steps the iteration.
Class representing the iteration state on the binary tree-based event handler registry.
EventRegistry implementation that keeps event handlers in a SortedListMap and filters the event handl...
void register_handler(const EventRegistryEntry &entry, unsigned mask) OVERRIDE
Adds a new event handler to the registry.
void unregister_handler(EventHandler *handler, uint32_t user_arg=0, uint32_t user_arg_mask=0) OVERRIDE
Removes all registered instances of a given event handler pointer.
void reserve(size_t count) OVERRIDE
Prepares storage for adding many event handlers.
MaskLookupMap handlers_
The registered handlers.
EventIterator * create_iterator() OVERRIDE
Creates a new event iterator. Caller takes ownership of object.
EventRegistry implementation that keeps all event handlers in a vector and forwards every single call...
EventIterator * create_iterator() OVERRIDE
Creates a new event iterator. Caller takes ownership of object.
void unregister_handler(EventHandler *handler, uint32_t user_arg=0, uint32_t user_arg_mask=0) OVERRIDE
Removes all registered instances of a given event handler pointer.
void register_handler(const EventRegistryEntry &entry, unsigned mask) OVERRIDE
Adds a new event handler to the registry.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
Shared notification structure that is assembled for each incoming event-related message,...
Comparison operator for event registry entries.