mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #852 Const-correctness.
This commit is contained in:
@@ -53,13 +53,13 @@ namespace BlackMisc
|
|||||||
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
||||||
|
|
||||||
// find the first situation not in the correct order, keep only the situations before that one
|
// find the first situation not in the correct order, keep only the situations before that one
|
||||||
auto end = std::is_sorted_until(situations.begin(), situations.end(), [](auto && a, auto && b) { return b.getAdjustedMSecsSinceEpoch() < a.getAdjustedMSecsSinceEpoch(); });
|
const auto end = std::is_sorted_until(situations.begin(), situations.end(), [](auto && a, auto && b) { return b.getAdjustedMSecsSinceEpoch() < a.getAdjustedMSecsSinceEpoch(); });
|
||||||
auto validSituations = makeRange(situations.begin(), end);
|
const auto validSituations = makeRange(situations.begin(), end);
|
||||||
|
|
||||||
// find the first situation earlier than the current time
|
// find the first situation earlier than the current time
|
||||||
auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto && s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
|
const auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto && s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
|
||||||
auto situationsNewer = makeRange(validSituations.begin(), pivot);
|
const auto situationsNewer = makeRange(validSituations.begin(), pivot);
|
||||||
auto situationsOlder = makeRange(pivot, validSituations.end());
|
const auto situationsOlder = makeRange(pivot, validSituations.end());
|
||||||
|
|
||||||
// interpolation situations
|
// interpolation situations
|
||||||
CAircraftSituation oldSituation;
|
CAircraftSituation oldSituation;
|
||||||
@@ -108,7 +108,7 @@ namespace BlackMisc
|
|||||||
CCoordinateGeodetic currentPosition;
|
CCoordinateGeodetic currentPosition;
|
||||||
|
|
||||||
// Time between start and end packet
|
// Time between start and end packet
|
||||||
double deltaTime = std::abs(oldSituation.getAdjustedMSecsSinceEpoch() - newSituation.getAdjustedMSecsSinceEpoch());
|
const double deltaTime = std::abs(oldSituation.getAdjustedMSecsSinceEpoch() - newSituation.getAdjustedMSecsSinceEpoch());
|
||||||
|
|
||||||
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
||||||
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackmisc/iterator.h"
|
#include "blackmisc/iterator.h"
|
||||||
#include "blackmisc/metaclassprivate.h"
|
|
||||||
#include "blackmisc/range.h"
|
#include "blackmisc/range.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||||
@@ -23,7 +22,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CSimulatorPluginInfoList::CSimulatorPluginInfoList() { }
|
CSimulatorPluginInfoList::CSimulatorPluginInfoList() { }
|
||||||
|
|
||||||
bool CSimulatorPluginInfoList::supportsSimulator(const QString &simulator)
|
bool CSimulatorPluginInfoList::supportsSimulator(const QString &simulator) const
|
||||||
{
|
{
|
||||||
return std::find_if(begin(), end(), [&simulator](const CSimulatorPluginInfo & info)
|
return std::find_if(begin(), end(), [&simulator](const CSimulatorPluginInfo & info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace BlackMisc
|
|||||||
CSimulatorPluginInfoList(const CSequence<CSimulatorPluginInfo> &other);
|
CSimulatorPluginInfoList(const CSequence<CSimulatorPluginInfo> &other);
|
||||||
|
|
||||||
//! Is simulator supported
|
//! Is simulator supported
|
||||||
bool supportsSimulator(const QString &simulator);
|
bool supportsSimulator(const QString &simulator) const;
|
||||||
|
|
||||||
//! String list with meaningful representations
|
//! String list with meaningful representations
|
||||||
QStringList toStringList(bool i18n = false) const;
|
QStringList toStringList(bool i18n = false) const;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ namespace XBus
|
|||||||
{
|
{
|
||||||
BlackMisc::Simulation::IInterpolator::InterpolationStatus status;
|
BlackMisc::Simulation::IInterpolator::InterpolationStatus status;
|
||||||
const BlackMisc::Simulation::CInterpolationHints hints;
|
const BlackMisc::Simulation::CInterpolationHints hints;
|
||||||
auto situation = m_interpolator->getInterpolatedSituation(plane->situations, -1, hints, status);
|
const auto situation = m_interpolator->getInterpolatedSituation(plane->situations, -1, hints, status);
|
||||||
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
||||||
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user