]> git.mxchange.org Git - flightgear.git/blob - src/Aircraft/replay.hxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / Aircraft / replay.hxx
1 // replay.hxx - a system to record and replay FlightGear flights
2 //
3 // Written by Curtis Olson, started Juley 2003.
4 //
5 // Copyright (C) 2003  Curtis L. Olson  - http://www.flightgear.org/~curt
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 Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_REPLAY_HXX
25 #define _FG_REPLAY_HXX 1
26
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #include <simgear/compiler.h>
32
33 #include <deque>
34
35 #include <simgear/math/sg_types.hxx>
36 #include <simgear/props/props.hxx>
37 #include <simgear/structure/subsystem_mgr.hxx>
38
39 #include <Network/net_ctrls.hxx>
40 #include <Network/net_fdm.hxx>
41
42 using std::deque;
43
44
45 class FGReplayData {
46
47 public:
48
49     double sim_time;
50     FGNetFDM fdm;
51     FGNetCtrls ctrls;
52 };
53
54 typedef deque < FGReplayData *> replay_list_type;
55
56
57
58 /**
59  * A recording/replay module for FlightGear flights
60  * 
61  */
62
63 class FGReplay : public SGSubsystem
64 {
65
66 public:
67
68     FGReplay ();
69     virtual ~FGReplay();
70
71     virtual void init();
72     virtual void bind();
73     virtual void unbind();
74     virtual void update( double dt );
75
76     void replay( double time );
77     double get_start_time();
78     double get_end_time();
79     
80 private:
81
82     static const double st_list_time;   // 60 secs of high res data
83     static const double mt_list_time;  // 10 mins of 1 fps data
84     static const double lt_list_time; // 1 hr of 10 spf data
85
86     // short term sample rate is as every frame
87     static const double mt_dt; // medium term sample rate (sec)
88     static const double lt_dt; // long term sample rate (sec)
89
90     double sim_time;
91     double last_mt_time;
92     double last_lt_time;
93
94     replay_list_type short_term;
95     replay_list_type medium_term;
96     replay_list_type long_term;
97     replay_list_type recycler;
98     SGPropertyNode_ptr disable_replay;
99 };
100
101
102 #endif // _FG_REPLAY_HXX