]> git.mxchange.org Git - flightgear.git/blob - src/Aircraft/flightrecorder.hxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[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., 675 Mass Ave, Cambridge, MA 02139, 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     FGReplayData*   createEmptyRecord   (void);
58     FGReplayData*   capture             (double SimTime, FGReplayData* pRecycledBuffer);
59     void            replay              (double SimTime, const FGReplayData* pNextBuffer,
60                                          const FGReplayData* pLastBuffer = NULL);
61     void            deleteRecord        (FGReplayData* pRecord);
62
63     int             getRecordSize       (void) { return m_TotalRecordSize;}
64
65 private:
66     void initDefault(void);
67     void initSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
68                         SGPropertyNode_ptr BaseNode);
69     void processSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList,
70                            SGPropertyNode_ptr SignalListNode,
71                            string PropPrefix="", int Count = 1);
72     bool haveProperty(FlightRecorder::TSignalList& Capture,SGPropertyNode* pProperty);
73     bool haveProperty(SGPropertyNode* pProperty);
74
75     SGPropertyNode_ptr m_RecorderNode;
76     SGPropertyNode_ptr m_ConfigNode;
77
78     FlightRecorder::TSignalList m_CaptureDouble;
79     FlightRecorder::TSignalList m_CaptureFloat;
80     FlightRecorder::TSignalList m_CaptureInteger;
81     FlightRecorder::TSignalList m_CaptureInt16;
82     FlightRecorder::TSignalList m_CaptureInt8;
83     FlightRecorder::TSignalList m_CaptureBool;
84
85     int m_TotalRecordSize;
86     string m_ConfigName;
87 };
88
89 #endif /* FLIGHTRECORDER_HXX_ */