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
Besides the global event handler (inside Core), EventHandlers could be then used in other places for alternative purposes.
Examples:
Place an event handler within each Workspace (group of processors working on the same physics within a multi physics simulation - yes, I know we still don't support it).
Yes, I would like to have EventHandler be a component as well, but I also like the fact that we can have all components react to an event, by registering in the constructor. I would propose the following solution to have both:
Make the EventHandler constructor public again, and rename the current static instance method to "global_event_handler"
Add a class EventHandlerComponent (better name suggestions welcome) that by default uses the global event handler, but also can be told to create a new event handler and use that one for registration and event raising purposes.
The advantage is that we can now control event handlers through the component interface (the EventHandlerComponent would expose a signal to raise an event, for example) and we can still use the EventHandler singleton for very special purposes, such as the need to register at component construction time. I believe it's safe to leave the global_event_handler singleton method, since the event handler doesn't really have any dependencies other than boost::signal.
An alternative to making the EventHandler constructor public could be to make EventHandlerComponent a friend class of EventHandler.
I would make the current EventHandler a component, therefore allowing different event handlers to coexist, for different purposes.
I would then create a global instance inside Core - I think this will be possible, while avoiding the infinite loop that Bart mentioned.
The text was updated successfully, but these errors were encountered: