3 // Written by Thorsten Brehm, started August 2011.
5 // Copyright (C) 2011 Thorsten Brehm - brehmt (at) gmail com
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.
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.
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.
21 ///////////////////////////////////////////////////////////////////////////////
23 #ifndef FLIGHTRECORDER_HXX_
24 #define FLIGHTRECORDER_HXX_
26 #include <simgear/props/props.hxx>
29 namespace FlightRecorder
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
42 SGPropertyNode_ptr Signal;
43 TInterpolation Interpolation;
46 typedef std::vector<TCapture> TSignalList;
50 class FGFlightRecorder
53 FGFlightRecorder(const char* pConfigName);
54 virtual ~FGFlightRecorder();
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);
63 int getRecordSize (void) { return m_TotalRecordSize;}
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);
75 SGPropertyNode_ptr m_RecorderNode;
76 SGPropertyNode_ptr m_ConfigNode;
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;
85 int m_TotalRecordSize;
89 #endif /* FLIGHTRECORDER_HXX_ */