52 EventHandler *handler, uint32_t user_arg, uint32_t user_arg_mask)
56 LOG(
VERBOSE,
"%p: unregister %p",
this, handler);
59 auto begin_it = r->second.begin();
60 auto end_it = r->second.end();
61 auto erase_it = std::remove_if(begin_it, end_it,
65 (user_arg & user_arg_mask));
67 if (erase_it != end_it)
69 r->second.erase(erase_it, end_it);
96 while (maskIterator_ != parent_->
handlers_.end())
101 if (maskIterator_ != parent_->
handlers_.end())
103 setup_current_mask();
120 maskIterator_ = parent_->
handlers_.end();
126 maskIterator_ = parent_->
handlers_.begin();
127 setup_current_mask();
131 void setup_current_mask()
133 if (maskIterator_->first == 64)
136 it_ = maskIterator_->second.begin();
137 end_ = maskIterator_->second.end();
140 unsigned mask_log = maskIterator_->first;
141 uint64_t current_mask = (1ULL << mask_log) - 1;
142 uint64_t eventid_key = currentReport_->
event & (~current_mask);
143 it_ = maskIterator_->second.lower_bound(eventid_key);
144 eventid_key = currentReport_->
event + currentReport_->
mask;
145 end_ = maskIterator_->second.upper_bound(eventid_key);
147 TreeEventHandlers *parent_;
148 EventReport *currentReport_;
149 MaskLookupMap::iterator maskIterator_;
159TreeEventHandlers::TreeEventHandlers()
See OSMutexLock in os/OS.hxx.
container_type::iterator iterator
Iterator type.
Abstract base class for all event handlers.
Abstract class for representing iteration through a container for event handlers.
Structure used in registering event handlers.
EventHandler * handler
Pointer to the handler.
uint32_t user_arg
Opaque user argument.
void set_dirty()
Implementations must call this function from register and unregister handler to mark iterators being ...
Class representing the iteration state on the binary tree-based event handler registry.
EventRegistryEntry * next_entry() OVERRIDE
Steps the iteration.
void clear_iteration() OVERRIDE
Stops iteration and resets iteration variables.
void init_iteration(EventReport *r) OVERRIDE
Starts the iteration.
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.
#define LOG(level, message...)
Conditionally write a message to the logging output.
static const int VERBOSE
Loglevel that is usually not printed, reporting debugging information.
#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,...
EventId mask
Specifies the mask in case the request is for an event range.
EventId event
The event ID from the incoming message.