]> git.mxchange.org Git - flightgear.git/blob - src/Aircraft/flightrecorder.hxx
Remove unnecessary includes/using
[flightgear.git] / src / Aircraft / flightrecorder.hxx
1 // flightrecorder.hxx
2 //
3 // Written by Thorsten Brehm, started August 2011.
4 //
5 // Copyright (C) 2011 Thorsten Brehm - brehmt (at) gmail com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #ifndef FLIGHTRECORDER_HXX_
24 #define FLIGHTRECORDER_HXX_
25
26 #include <simgear/props/props.hxx>
27 #include "replay.hxx"
28
29 namespace FlightRecorder
30 {
31
32     typedef enum
33     {
34         discrete    = 0,   // no interpolation
35         linear      = 1,  // linear interpolation
36         angular_rad = 2,  // angular interpolation, value in radians
37         angular_deg = 3   // angular interpolation, value in degrees
38     } TInterpolation;
39
40     typedef struct
41     {
42         SGPropertyNode_ptr  Signal;
43         TInterpolation      Interpolation;
44     } TCapture;
45
46     typedef std::vector<TCapture> TSignalList;
47
48 }
49
50 class FGFlightRecorder
51 {
52 public:
53     FGFlightRecorder(const char* pConfigName);
54     virtual ~FGFlightRecorder();
55
56     void            reinit              (void);
57     void            reinit              (SGPropertyNode_ptr ConfigNode);
58     FGReplayData*   createEmptyRecord   (void);
59     FGReplayData*   capture             (double SimTime, FGReplayData* pRecycledBuffer);
60     void            replay              (double SimTime, const FGReplayData* pNextBuffer,
61                                          const FGReplayData* pLastBuffer = NULL);
62     void            deleteRecord        (FGReplayData* pRecord);
63
64     int             getRecordSize       (void) { return m_TotalRecordSize;}
65     void            getConfig           (SGPropertyNode* root);
66
67 private:
68     SGPropertyNode_ptr getDefault(void);
69     void initSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
70                         SGPropertyNode_ptr BaseNode);
71     void processSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
72                            SGPropertyNode_ptr SignalListNode,
73                            std::string PropPrefix="", int Count = 1);
74     bool haveProperty(FlightRecorder::TSignalList& Capture,SGPropertyNode* pProperty);
75     bool haveProperty(SGPropertyNode* pProperty);
76
77     int  getConfig(SGPropertyNode* root, const char* typeStr, const FlightRecorder::TSignalList& SignalList);
78
79     SGPropertyNode_ptr m_RecorderNode;
80     SGPropertyNode_ptr m_ConfigNode;
81
82     FlightRecorder::TSignalList m_CaptureDouble;
83     FlightRecorder::TSignalList m_CaptureFloat;
84     FlightRecorder::TSignalList m_CaptureInteger;
85     FlightRecorder::TSignalList m_CaptureInt16;
86     FlightRecorder::TSignalList m_CaptureInt8;
87     FlightRecorder::TSignalList m_CaptureBool;
88
89     int m_TotalRecordSize;
90     std::string m_ConfigName;
91     bool m_usingDefaultConfig;
92 };
93
94 #endif /* FLIGHTRECORDER_HXX_ */