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
Currently the detector callback is initialized in Detector::init(argc, argv, callback), where callback is a c function pointer. The type of the callback is void (*)(const Race*). That does not allow to pass in a custom context which then can be used in the callback implementation.
Solution 1:
Instead, init could be extended with a new parameter context, and this context should be passed as second parameter to the callback function.
Solution 2:
As this is a C++ library anyways, we could instead use a functor (callable object) that internally contains the state. Here, it has to be considered that the init function uses virtual inheritance, hence the functor has to be virtual as well (as no templates can be used).
The text was updated successfully, but these errors were encountered:
Currently the detector callback is initialized in
Detector::init(argc, argv, callback)
, where callback is a c function pointer. The type of the callback isvoid (*)(const Race*)
. That does not allow to pass in a custom context which then can be used in the callback implementation.Solution 1:
Instead, init could be extended with a new parameter
context
, and this context should be passed as second parameter to the callback function.Solution 2:
As this is a C++ library anyways, we could instead use a functor (callable object) that internally contains the state. Here, it has to be considered that the
init
function uses virtual inheritance, hence the functor has to be virtual as well (as no templates can be used).The text was updated successfully, but these errors were encountered: