swift
Loading...
Searching...
No Matches
interpolationlogger.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2014 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_INTERPOLATIONLOGGER_H
7#define SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATIONLOGGER_H
8
9#include <QObject>
10#include <QStringList>
11#include <QtGlobal>
12
18
19namespace swift::misc
20{
21 class CWorker;
22 namespace simulation
23 {
26 {
28 qint64 tsCurrent = -1;
29 qint64 tsInterpolated = -1;
30 double groundFactor = -1;
31 double simTimeFraction = -1;
32 double deltaSampleTimesMs = -1;
33 bool useParts = false;
34 bool interpolantRecalc = false;
49
51 double deltaCurrentToInterpolatedTime() const { return static_cast<double>(tsCurrent - tsInterpolated); }
52
54 const QString &interpolationType() const;
55
58 {
59 return interpolationSituations.frontOrDefault();
60 }
61
64 {
65 return interpolationSituations.backOrDefault();
66 }
67
69 const aviation::CAircraftSituation &secondInterpolationSituation() const;
70
72 QString toQString(bool withSetup, bool withCurrentSituation, bool withElevation, bool withOtherPositions,
73 bool withDeltaTimes, const QString &separator = { " " }) const;
74 };
75
78 {
79 qint64 tsCurrent = -1;
80 bool empty = false;
84
86 QString toQString(const QString &separator = { " " }) const;
87 };
88
91 {
93
94 public:
97
99 static const QStringList &getLogCategories();
100
103
105 void clearLog();
106
109
111 static QString getLogDirectory();
112
116 void logInterpolation(const SituationLog &log);
117
121 void logParts(const PartsLog &log);
122
124 void setMaxSituations(int max);
125
129
133
137
141
145
149
153
157
161
165
169
173
175 static const QString &filePatternInterpolationLog();
176
178 static const QString &filePatternPartsLog();
179
181 static const QStringList &filePatterns();
182
184 static QString msSinceEpochToTime(qint64 ms);
185
187 static QString msSinceEpochToTimeAndTimestamp(qint64 ms);
188
190 static QString msSinceEpochToTime(qint64 t1, qint64 t2, qint64 t3 = -1);
191
192 private:
194 static QString getHtmlInterpolationLog(const QList<SituationLog> &logs);
195
197 static QString getKmlChangedSituations(const QList<SituationLog> &logs);
198
200 static QString getKmlElevations(const QList<SituationLog> &logs);
201
203 static QString getKmlInterpolatedSituations(const QList<SituationLog> &logs);
204
206 static QString getHtmlPartsLog(const QList<PartsLog> &logs);
207
209 static CStatusMessageList writeLogFiles(const QList<SituationLog> &interpolation,
211
213 static CStatusMessage logStatusFileWriting(bool success, const QString &fileName);
214
215 mutable QReadWriteLock m_lockSituations;
216 mutable QReadWriteLock m_lockParts;
217 int m_maxSituations = 2500;
218 QList<PartsLog> m_partsLogs;
219 QList<SituationLog> m_situationLogs;
220 };
221 } // namespace simulation
222} // namespace swift::misc
223#endif // SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATIONLOGGER_H
Streamable status message, e.g.
Status messages, e.g. from Core -> GUI.
Class for doing some arbitrary parcel of work in its own thread.
Definition worker.h:230
Value object encapsulating information of aircraft's parts.
Value object about changes in situations.
Value object encapsulating information of an aircraft's situation.
Value object encapsulating information of a callsign.
Definition callsign.h:30
Physical unit length (length).
Definition length.h:18
Value object for interpolator and rendering per callsign.
static const QStringList & filePatterns()
All log.file patterns.
static QString msSinceEpochToTime(qint64 ms)
Create readable time.
CInterpolationLogger(QObject *parent=nullptr)
Constructor.
static const QString & filePatternPartsLog()
File pattern for parts log.
void setMaxSituations(int max)
Max.situations logged.
static QString msSinceEpochToTimeAndTimestamp(qint64 ms)
Create readable time plus timestamp.
aviation::CAircraftParts getLastParts() const
Get last parts.
static QString getLogDirectory()
Get the log directory.
static const QStringList & getLogCategories()
Log categories.
void logInterpolation(const SituationLog &log)
Log current interpolation cycle, only stores in memory, for performance reasons.
SituationLog getLastSituationLog() const
Get last log.
static QStringList getLatestLogFiles()
Latest log files: 0: Interpolation / 1: Parts.
CWorker * writeLogInBackground(bool clearLog)
Write a log in background.
aviation::CAircraftSituation getLastSituation() const
Get last situation.
QList< PartsLog > getPartsLog() const
All parts logs.
static const QString & filePatternInterpolationLog()
File pattern for interpolation log.
QList< SituationLog > getSituationsLog() const
All situation logs.
void logParts(const PartsLog &log)
Log current parts cycle, only stores in memory, for performance reasons.
Free functions in swift::misc.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
Log entry for parts interpolation.
int noNetworkParts
available network situations
aviation::CAircraftParts parts
parts to be logged
aviation::CCallsign callsign
current callsign
QString toQString(const QString &separator={ " " }) const
To string.
Log entry for situation interpolation.
double deltaCurrentToInterpolatedTime() const
Delta time between interpolation and current time.
QChar interpolator
what interpolator is used
aviation::CAircraftSituationList interpolationSituations
the interpolator uses 2, 3 situations (latest at end)
physical_quantities::CLength sceneryOffset
scenery offset
aviation::CCallsign callsign
current callsign
aviation::CAircraftSituation situationCurrent
interpolated situation
int noNetworkSituations
available network situations
const aviation::CAircraftSituation & newestInterpolationSituation() const
The newest situation.
const aviation::CAircraftSituation & oldestInterpolationSituation() const
The oldest situation.
qint64 tsInterpolated
timestamp interpolated
QString elevationInfo
info about elevation retrieval
double deltaSampleTimesMs
delta time between samples (i.e.
aviation::CAircraftSituationChange change
change
bool useParts
supporting aircraft parts
double groundFactor
current ground factor
physical_quantities::CLength cgAboveGround
center of gravity (CG)
double simTimeFraction
time fraction, expected 0..1
aviation::CAircraftParts parts
corresponding parts used in interpolator
bool interpolantRecalc
interpolant recalculated
QString altCorrection
info about altitude correction as CAircraftSituation::AltitudeCorrection
int noInvalidSituations
invalid situations, missing situations for timestampd
CInterpolationAndRenderingSetupPerCallsign usedSetup
used setup
#define SWIFT_MISC_EXPORT
Export a class or function from the library.