refactor: Remove clear() method from CInterpolator

clear() was only required by a unittest to execute two tests directly
after another. This can also be done in a cleaner way by creating a new
CInterpolator instead of requiring a separate method for resetting the interpolator.
This commit is contained in:
Lars Toenning
2024-01-04 22:43:12 +01:00
parent e66a089114
commit a599cc2792
3 changed files with 31 additions and 58 deletions

View File

@@ -673,25 +673,6 @@ namespace BlackMisc::Simulation
m_lastSituation.setNull();
}
template <typename Derived>
void CInterpolator<Derived>::clear()
{
this->resetLastInterpolation();
m_model = CAircraftModel();
m_currentSceneryOffset = CLength::null();
m_pastSituationsChange = CAircraftSituationChange::null();
m_currentSituations.clear();
m_currentTimeMsSinceEpoch = -1;
m_situationsLastModified = -1;
m_situationsLastModifiedUsed = -1;
m_currentInterpolationStatus.reset();
m_currentPartsStatus.reset();
m_interpolatedSituationsCounter = 0;
m_invalidSituations = 0;
m_lastInvalidLogTs = -1;
m_interpolationMessages.clear();
}
template <typename Derived>
bool CInterpolator<Derived>::initIniterpolationStepData(qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, int aircraftNumber)
{

View File

@@ -195,16 +195,6 @@ namespace BlackMisc
//! Parts and situation interpolated
CInterpolationResult getInterpolation(qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, uint32_t aircraftNumber);
//! Takes input between 0 and 1 and returns output between 0 and 1 smoothed with an S-shaped curve.
//!
//! Useful for making interpolation seem smoother, efficiently as it just uses simple arithmetic.
//! \see https://en.wikipedia.org/wiki/Smoothstep
//! \see http://sol.gfxile.net/interpolation/
static double smootherStep(double x)
{
return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);
}
//! Attach an observer to read the interpolator's state for debugging
//! \remark parts logging has a \c bool \c log flag
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
@@ -219,11 +209,6 @@ namespace BlackMisc
//! \remark mainly needed in UNIT tests
void resetLastInterpolation();
//! Clear all data
//! \remark mainly needed in UNIT tests
//! \private
void clear();
//! Init, or re-init the corressponding model
//! \remark either by passing a model or using the provider
void initCorrespondingModel(const CAircraftModel &model = {});