depthai-core
depthai-core copied to clipboard
`CalibrationHandler` missing `const` on member functions - cascades to apps
Throughout CalibrationHandler
the member functions are not declared const
which prevents apps from using const calibration handlers. This cascades up to app classes containing a CalibrationHandler to be non-const, and further up the chain. Or cascades sideways to force app member functions to be non-const so they can call these handler functions. It metastasizes.
The hope of related https://github.com/luxonis/depthai-core/issues/10 didn't happen. 😢
Setup
- all
Repro
Found while writing my app. And then depthai-core
code review.
Here are four examples of errant functions in CalibrationHandler... there are substantially more.
dai::CameraBoardSocket CalibrationHandler::getStereoRightCameraId();
float CalibrationHandler::getBaselineDistance(...);
std::vector<std::vector<float>> CalibrationHandler::getCameraIntrinsics(...);
float CalibrationHandler::getFov(...);
...
Fix
Often just adding const
to the end of the member function signatures. There maybe a small subset which need minor changes. This is less than a day's work.
Workaround
None pretty. It might include making things mutable
and removing const
from member functions from apps, which then makes the app's code harder to maintain. :-/