-
-
Notifications
You must be signed in to change notification settings - Fork 744
Enhance Data Retrieval Accuracy with MatchType in TimeseriesRef #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
look at CI... |
- Added an enumeration MatchType with options Exact and Nearest. - Modified atTime and getRawIndexAtTime in TimeseriesRef to support MatchType, allowing callers to specify whether they need an exact timestamp match or the nearest available match. - Adjusted the atTime method to throw an error when an exact match is required but not found, enhancing error handling for strict match requirements.
|
I have resolved the compilation issues. However, I have a question regarding the proposal to pass an enum class |
| if (match_type == MatchType::Exact) | ||
| { | ||
| auto it = std::find_if(_plot_data->begin(), _plot_data->end(), | ||
| [t](const auto& point) { return point.x == t; }); |
Check notice
Code scanning / CodeQL
Equality test on floating-point values Note
| void set(unsigned index, double x, double y); | ||
|
|
||
| double atTime(double t) const; | ||
| double atTime(double t, MatchType match_type) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding new argument breaks older scripts. The best way it should be a default value but ain't sure it's possible with lua.
Maybe you should define standalone functions like Uncle bob once said. In this way you should add three functions:
|
|
the timeseries class will be completely refactored in the next months and will include native types. closing this. Thanks anyway 😄 |
This MR introduces the
MatchTypeenumeration toTimeseriesRef, providing the option to choose between exact and nearest time matching. Changes include updates to theatTimeandgetRawIndexAtTimemethods to support this new functionality.For a detailed problem description see: #968