@@ -56,7 +56,7 @@ namespace SHOT
5656class EventHandler
5757{
5858public:
59- inline EventHandler (EnvironmentPtr envPtr) : env(envPtr) {} ;
59+ EventHandler (EnvironmentPtr envPtr);
6060
6161 /* *
6262 * @brief Unified callback registration method
@@ -134,31 +134,14 @@ class EventHandler
134134 * @param event The event type to notify
135135 * @param args Arguments to pass to the callbacks (wrapped in std::any)
136136 */
137- void notify (const E_EventType& event, std::any args) const
138- {
139- env->output ->outputTrace (
140- " Notifying callbacks for event: " + std::to_string (static_cast <int >(event)) + " (args)" );
141- auto it = notificationCallbacks.find (event);
142- if (it != notificationCallbacks.end ())
143- {
144- for (const auto & callback : it->second )
145- {
146- callback (args);
147- }
148- }
149- }
137+ void notify (const E_EventType& event, std::any args) const ;
150138
151139 /* *
152140 * @brief Notify callbacks with no arguments
153141 *
154142 * @param event The event type to notify
155143 */
156- void notify (const E_EventType& event) const
157- {
158- env->output ->outputTrace (
159- " Notifying callbacks for event: " + std::to_string (static_cast <int >(event)) + " (no args)" );
160- notify (event, std::any ());
161- }
144+ void notify (const E_EventType& event) const ;
162145
163146 /* *
164147 * @brief Request data from a registered data provider (no arguments)
@@ -217,34 +200,23 @@ class EventHandler
217200 * @param event The event type to check
218201 * @return true if a data provider is registered, false otherwise
219202 */
220- bool hasDataProvider (const E_EventType& event) const
221- {
222- return dataProviders.find (event) != dataProviders.end ()
223- || parameterizedDataProviders.find (event) != parameterizedDataProviders.end ();
224- }
203+ bool hasDataProvider (const E_EventType& event) const ;
225204
226205 /* *
227206 * @brief Check if notification callbacks are registered for an event
228207 *
229208 * @param event The event type to check
230209 * @return true if notification callbacks are registered, false otherwise
231210 */
232- bool hasNotificationCallbacks (const E_EventType& event) const
233- {
234- auto it = notificationCallbacks.find (event);
235- return it != notificationCallbacks.end () && !it->second .empty ();
236- }
211+ bool hasNotificationCallbacks (const E_EventType& event) const ;
237212
238213 /* *
239214 * @brief Check if any callbacks (data providers or notifications) are registered for an event
240215 *
241216 * @param event The event type to check
242217 * @return true if any callbacks are registered, false otherwise
243218 */
244- bool hasAnyCallbacks (const E_EventType& event) const
245- {
246- return hasDataProvider (event) || hasNotificationCallbacks (event);
247- }
219+ bool hasAnyCallbacks (const E_EventType& event) const ;
248220
249221private:
250222 // / Map of event types to their registered notification callbacks
0 commit comments