]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBsim/FGState.h
7ac238e74b4490fa107cf1c18c34230cb02f9d24
[flightgear.git] / src / FDM / JSBsim / FGState.h
1 /*******************************************************************************
2
3  Header:       FGState.h
4  Author:       Jon S. Berndt
5  Date started: 11/17/98
6
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 --------------------------------------------------------------------------------
28
29 Based on Flightgear code, which is based on LaRCSim. This class wraps all
30 global state variables (such as velocity, position, orientation, etc.).
31
32 HISTORY
33 --------------------------------------------------------------------------------
34 11/17/98   JSB   Created
35
36 ********************************************************************************
37 SENTRY
38 *******************************************************************************/
39
40 #ifndef FGSTATE_H
41 #define FGSTATE_H
42
43 /*******************************************************************************
44 INCLUDES
45 *******************************************************************************/
46
47 #ifdef FGFS
48 #  include <Include/compiler.h>
49 #  include STL_STRING
50 #  ifdef FG_HAVE_STD_INCLUDES
51 #    include <fstream>
52 #  else
53 #    include <fstream.h>
54 #  endif
55    FG_USING_STD(string);
56 #else
57 #  include <string>
58 #  include <fstream>
59 #endif
60
61 #include "FGDefs.h"
62
63 /*******************************************************************************
64 DEFINES
65 *******************************************************************************/
66
67 using namespace std;
68
69 /*******************************************************************************
70 CLASS DECLARATION
71 *******************************************************************************/
72
73 class FGFDMExec;
74 class FGState
75 {
76 public:
77    FGState(FGFDMExec*);
78   ~FGState(void);
79
80   bool Reset(string, string);
81   bool StoreData(string);
82   bool DumpData(string);
83   bool DisplayData(void);
84
85   inline float GetVt(void) {return Vt;}
86
87   inline float Getlatitude(void) {return latitude;}
88   inline float Getlongitude(void) {return longitude;}
89   inline float GetGeodeticLat(void) {return GeodeticLat;}
90
91   inline float Getadot(void) {return adot;}
92   inline float Getbdot(void) {return bdot;}
93
94   inline float Geth(void) {return h;}
95   inline float Geta(void) {return a;}
96   inline float GetMach(void) {return Mach;}
97
98   inline float Getsim_time(void) {return sim_time;}
99   inline float Getdt(void) {return dt;}
100
101   inline float Getqbar(void) {return qbar;}
102
103   inline void SetVt(float tt) {Vt = tt;}
104
105   inline void Setlatitude(float tt) {latitude = tt;}
106   inline void Setlongitude(float tt) {longitude = tt;}
107   inline void SetGeodeticLat(float tt) {GeodeticLat = tt;}
108
109   inline void Setadot(float tt) {adot = tt;}
110   inline void Setbdot(float tt) {bdot = tt;}
111
112   inline void Setqbar(float tt) {qbar = tt;}
113
114   inline void Seth(float tt) {h = tt;}
115   inline void Seta(float tt) {a = tt;}
116   inline void SetMach(float tt) {Mach = tt;}
117
118   inline float Setsim_time(float tt) {sim_time = tt; return sim_time;}
119   inline void  Setdt(float tt) {dt = tt;}
120
121   inline float IncrTime(void) {sim_time+=dt;return sim_time;}
122
123 private:
124
125   float Vt;                         // Total velocity
126   float latitude, longitude;        // position
127   float GeodeticLat;                // Geodetic Latitude
128   float adot, bdot;                 // alpha dot and beta dot
129   float h, a;                       // altitude above sea level, speed of sound
130   float qbar;                       // dynamic pressure
131   float sim_time, dt;
132   float Mach;                       // Mach number
133
134   FGFDMExec* FDMExec;
135
136 protected:
137
138 };
139
140 /******************************************************************************/
141 #endif