mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refactor: Use dynamic lookup with pure virtual methods
This makes it clearer what an IInterpolant and Interpolator must implemented. But it should be checked if using virtual here is okay performance-wise.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
namespace BlackMisc::Simulation
|
||||
{
|
||||
//! Cubic spline interpolator
|
||||
class BLACKMISC_EXPORT CInterpolatorSpline : public CInterpolator<CInterpolatorSpline>
|
||||
class BLACKMISC_EXPORT CInterpolatorSpline : public CInterpolator
|
||||
{
|
||||
virtual void anchor() override;
|
||||
|
||||
@@ -63,13 +63,11 @@ namespace BlackMisc::Simulation
|
||||
//! Constructor
|
||||
CInterpolant(const PosArray &pa, const PhysicalQuantities::CLengthUnit &altitudeUnit, const CInterpolatorLinearPbh &pbh);
|
||||
|
||||
//! Perform the interpolation
|
||||
//! \param situation situation used as a base for interpolation. Contains for example the already interpolated PBH.
|
||||
//! \return \p situation with interpolated position and altitude and updated timestamp
|
||||
std::tuple<Geo::CCoordinateGeodetic, Aviation::CAltitude> interpolatePositionAndAltitude() const;
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolant::interpolatePositionAndAltitude
|
||||
std::tuple<Geo::CCoordinateGeodetic, Aviation::CAltitude> interpolatePositionAndAltitude() const override;
|
||||
|
||||
//! Interpolate the ground information/factor
|
||||
Aviation::COnGroundInfo interpolateGroundFactor() const;
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolant::interpolateGroundFactor
|
||||
Aviation::COnGroundInfo interpolateGroundFactor() const override;
|
||||
|
||||
//! Set the time values
|
||||
void setTimes(qint64 currentTimeMs, double timeFraction, qint64 interpolatedTimeMs);
|
||||
@@ -77,7 +75,8 @@ namespace BlackMisc::Simulation
|
||||
//! \private UNIT tests/ASSERT only
|
||||
const PosArray &getPa() const { return m_pa; }
|
||||
|
||||
const IInterpolatorPbh &pbh() const { return m_pbh; }
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolant::pbh
|
||||
const IInterpolatorPbh &pbh() const override { return m_pbh; }
|
||||
|
||||
private:
|
||||
PosArray m_pa; //!< current positions array, latest values last
|
||||
@@ -86,8 +85,8 @@ namespace BlackMisc::Simulation
|
||||
CInterpolatorLinearPbh m_pbh; //!< the used PBH interpolator
|
||||
};
|
||||
|
||||
//! Strategy used by CInterpolator::getInterpolatedSituation
|
||||
CInterpolant getInterpolant(SituationLog &log);
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolant
|
||||
const IInterpolant &getInterpolant(SituationLog &log) override;
|
||||
|
||||
private:
|
||||
//! Update the elevations used in CInterpolatorSpline::m_s
|
||||
|
||||
Reference in New Issue
Block a user