template <typename Function>

class EventHook

Defined at line 32 of file ../../src/connectivity/network/drivers/network-device/device/event_hook.h

An event hook class used to install event hooks for testing purposes. A hook is represented by a

fit::function (or any other callable that allows sharing). For example:

EventHook

<fit

::function

<void

(SomeParam*)>> some_param_event_;

To install a hook, do:

some_param_event_.Set([](SomeParam* param) { InspectParam(param); });

And the code that triggers the event would look like this:

some_param_event_.Trigger(

&param

);

The call to Trigger will efficiently (without locks) return early if no event hook has been

installed.

Public Methods

void Set (Function && function)

Defined at line 34 of file ../../src/connectivity/network/drivers/network-device/device/event_hook.h

template <typename... Args>
void Trigger (Args... args)

The event hook is currently limited in that return values from the function will be ignored.

This is because the call to Trigger has to be able to return if the handler is no longer valid.

There is currently no need for return types so to make things easy Trigger just returns void.

Defined at line 44 of file ../../src/connectivity/network/drivers/network-device/device/event_hook.h