FlightGear next
flightrecorder.hxx
Go to the documentation of this file.
1/*
2 * SPDX-FileName: flightrecorder.hxx
3 * SPDX-FileCopyrightText: Copyright (C) 2011 Thorsten Brehm - brehmt (at) gmail com
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#pragma once
8
10#include <simgear/props/props.hxx>
11
12#include "replay-internal.hxx"
13
14namespace FlightRecorder {
15
16typedef enum {
17 discrete = 0, // no interpolation
18 linear = 1, // linear interpolation
19 angular_rad = 2, // angular interpolation, value in radians
20 angular_deg = 3 // angular interpolation, value in degrees
22
23typedef struct
24{
25 SGPropertyNode_ptr Signal;
27} TCapture;
28
29typedef std::vector<TCapture> TSignalList;
30
31} // namespace FlightRecorder
32
34{
35public:
36 explicit FGFlightRecorder(const char* pConfigName);
37 virtual ~FGFlightRecorder();
38
39 void reinit();
40 void reinit(SGPropertyNode_ptr ConfigNode);
41 FGReplayData* capture(double SimTime, FGReplayData* pRecycledBuffer);
42
43 // Updates main_window_* out-params if we find window move/resize events
44 // and replay of such events is enabled.
45 void replay(double SimTime, const FGReplayData* pNextBuffer,
46 const FGReplayData* pLastBuffer,
47 int* main_window_xpos,
48 int* main_window_ypos,
49 int* main_window_xsize,
50 int* main_window_ysize);
51 int getRecordSize() { return m_TotalRecordSize; }
52 void getConfig(SGPropertyNode* root);
54
55private:
56 SGPropertyNode_ptr getDefault();
57 void initSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
58 SGPropertyNode_ptr BaseNode);
59 void processSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
60 SGPropertyNode_ptr SignalListNode,
61 std::string PropPrefix = "", int Count = 1);
62 bool haveProperty(FlightRecorder::TSignalList& Capture, const SGPropertyNode* pProperty);
63 bool haveProperty(const SGPropertyNode* pProperty);
64
65 int getConfig(SGPropertyNode* root, const char* typeStr, const FlightRecorder::TSignalList& SignalList);
66
67 SGPropertyNode_ptr m_RecorderNode;
68 SGPropertyNode_ptr m_ConfigNode;
69
70 SGPropertyNode_ptr m_ReplayMultiplayer;
71 SGPropertyNode_ptr m_ReplayExtraProperties;
72 SGPropertyNode_ptr m_ReplayMainView;
73 SGPropertyNode_ptr m_ReplayMainWindowPosition;
74 SGPropertyNode_ptr m_ReplayMainWindowSize;
75
76 SGPropertyNode_ptr m_RecordContinuous;
77 SGPropertyNode_ptr m_RecordExtraProperties;
78
79 SGPropertyNode_ptr m_LogRawSpeed;
80
81 // This contains copy of all properties that we are recording, so that we
82 // can send only differences.
83 //
84 SGPropertyNode_ptr m_RecordExtraPropertiesReference;
85
86 FlightRecorder::TSignalList m_CaptureDouble;
87 FlightRecorder::TSignalList m_CaptureFloat;
88 FlightRecorder::TSignalList m_CaptureInteger;
89 FlightRecorder::TSignalList m_CaptureInt16;
90 FlightRecorder::TSignalList m_CaptureInt8;
91 FlightRecorder::TSignalList m_CaptureBool;
92
93 unsigned m_TotalRecordSize;
94 std::string m_ConfigName;
95 bool m_usingDefaultConfig;
96 FGMultiplayMgr* m_MultiplayMgr;
97};
FGFlightRecorder(const char *pConfigName)
void getConfig(SGPropertyNode *root)
virtual ~FGFlightRecorder()
FGReplayData * capture(double SimTime, FGReplayData *pRecycledBuffer)
Capture data.
void replay(double SimTime, const FGReplayData *pNextBuffer, const FGReplayData *pLastBuffer, int *main_window_xpos, int *main_window_ypos, int *main_window_xsize, int *main_window_ysize)
Replay.
std::vector< TCapture > TSignalList
SGPropertyNode_ptr Signal