orocos / orocos-bayesian-filtering

The orocos Bayesian Filtering Library
149 stars 59 forks source link

Several functions give runtime not-implemented errors #39

Open kunaltyagi opened 6 years ago

kunaltyagi commented 6 years ago

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.

toeklk commented 6 years ago

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

kunaltyagi commented 6 years ago

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