cast icon indicating copy to clipboard operation
cast copied to clipboard

Callback types only accept free functions

Open MiragonMx opened this issue 1 year ago • 1 comments

As of now, the callback types defined in the API with signatures in cast_cb.h only accept free functions, not any member functions.

Problem According to my understanding, supported, e.g., by this discussion, the current implementation does not support class member functions as callbacks. For use in a bigger research application for real-time processing, this is a problem, as a static instance pointer like in the caster_qt example would be very bad practice.

I would be interested in any errors on my understanding part or any way of modification to make this encapsulated on my user side.

Environment:

  • SDK variant [e.g. python wrappers, iOS Framework]: standard C API
  • Development platform [e.g. Linux, Xcode]: Windows
  • SDK version: 12.0.0
  • Clarius App version: n/a

MiragonMx avatar Dec 11 '24 11:12 MiragonMx

You are correct it is not possible to pass member functions as callback, since this is a C API. There are workarounds like passing a user parameter but would require changes in the current implementation. I will create a feature request for it.

julien-l avatar Dec 11 '24 18:12 julien-l