orocos / orocos-bayesian-filtering

The orocos Bayesian Filtering Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Several functions give runtime not-implemented errors

kunaltyagi opened this issue · 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.

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);

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