orocos-bayesian-filtering icon indicating copy to clipboard operation
orocos-bayesian-filtering copied to clipboard

Several functions give runtime not-implemented errors

Open kunaltyagi opened this issue 7 years ago • 2 comments

It's preferable to have compile time errors than to have runtime errors. Lots of classes which act as pure virtual in BFL instead are just virtual. The relevant functions have a ```cerr`` with exit which doesn't make sense specially with C++.

I propose we make such functions pure virtual.

kunaltyagi avatar Feb 13 '18 01:02 kunaltyagi

Agree, AFAICT only the following files are affected

pdf/analyticconditionalgaussian.cpp: exit(-BFL_ERRMISUSE); pdf/filterproposaldensity.cpp: exit(-BFL_ERRMISUSE); pdf/pdf.h: exit(-BFL_ERRMISUSE); pdf/pdf.h: exit(-BFL_ERRMISUSE); pdf/pdf.h: exit(-BFL_ERRMISUSE); pdf/pdf.h: exit(-BFL_ERRMISUSE);

toeklk avatar Feb 20 '18 13:02 toeklk

Making them pure virtual would impact several child classes of pdf. However, we should be able to push error code to them making it clearer to the user in case of run-time error.

Prediction: Would impact almost the entire pdf section of bfl, rewriting ~10-20% of code in this section. Benefit: once the functions are pure virtual, no need of dynamic_cast making filters easier to implement

If we were to do this large refactor, we might want to look into addressing concerns of

  • Real Time usage
  • Thread safety
  • Memory ownership

kunaltyagi avatar Feb 26 '18 05:02 kunaltyagi