swift
interpolatormulti.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORMULTI_H
7 #define SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORMULTI_H
8 
11 #include "misc/statusmessagelist.h"
12 
13 namespace swift::misc::simulation
14 {
17  {
18  public:
22  CInterpolationLogger *logger = nullptr);
23 
25  CInterpolationResult getInterpolation(qint64 currentTimeSinceEpoch,
27  uint32_t aircraftNumber);
28 
31  getLastInterpolatedSituation(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const;
32 
34  const CStatusMessageList &
35  getInterpolationMessages(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const;
36 
38  void attachLogger(CInterpolationLogger *logger);
39 
41  void initCorrespondingModel(const CAircraftModel &model);
42 
44  QString getInterpolatorInfo(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const;
45 
46  private:
47  CInterpolatorSpline m_spline;
48  CInterpolatorLinear m_linear;
49  };
50 
56  {
57  public:
60 
64  CInterpolationLogger *logger = nullptr);
65 
67  bool hasInterpolator() const { return !m_interpolator.isNull(); }
68 
70  CInterpolatorMulti *interpolator() const { return m_interpolator.data(); }
71 
73  operator CInterpolatorMulti *() const { return this->interpolator(); }
74 
76  operator bool() const { return this->hasInterpolator(); }
77 
79  bool operator!() const { return !this->hasInterpolator(); }
80 
82  CInterpolatorMulti &operator*() const { return *this->interpolator(); }
83 
85  CInterpolatorMulti *operator->() const { return this->interpolator(); }
86 
87  private:
88  QSharedPointer<CInterpolatorMulti>
89  m_interpolator;
90  };
91 } // namespace swift::misc::simulation
92 
93 #endif // SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORMULTI_H
Status messages, e.g. from Core -> GUI.
Value object encapsulating information of an aircraft's situation.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
Aircraft model (used by another pilot, my models on disk)
Definition: aircraftmodel.h:71
Value object for interpolator and rendering per callsign.
Record internal state of interpolator for debugging.
Linear interpolator, calculation inbetween positions.
Multiplexed interpolator which allows switching between modes at runtime.
CInterpolatorMulti which can be used with QMap/QHash.
bool hasInterpolator() const
Has interpolator initialized?
CInterpolatorMulti * interpolator() const
Interpolator.
CInterpolatorMulti * operator->() const
-> operator
Direct in memory access to interpolation setup, normally implemented by simulator.
Direct thread safe in memory access to remote aircraft.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.