]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGAirPressureItem.h
Major weather update from Christian Mayer, tying the weather code into
[flightgear.git] / src / WeatherCM / FGAirPressureItem.h
1 /*****************************************************************************
2
3  Header:       FGAirPressureItem.h      
4  Author:       Christian Mayer
5  Date started: 28.05.99
6
7  -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
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 Air pressure item that is stored in the micro weather class
29
30 HISTORY
31 ------------------------------------------------------------------------------
32 28.05.1999 Christian Mayer      Created
33 08.06.1999 Christian Mayer      Added international air preasure formula
34 16.06.1999 Durk Talsma          Portability for Linux
35 20.06.1999 Christian Mayer      added lots of consts
36 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
37                                 suggestion
38 19.10.1999 Christian Mayer      change to use PLIB's sg instead of Point[2/3]D
39                                 and lots of wee code cleaning
40 15.12.1999 Christian Mayer      changed the air pressure calculation to a much
41                                 more realistic formula. But as I need for that
42                                 the temperature I moved the code to 
43                                 FGPhysicalProperties
44 *****************************************************************************/
45
46 /****************************************************************************/
47 /* SENTRY                                                                   */
48 /****************************************************************************/
49 #ifndef FGAirPressureItem_H
50 #define FGAirPressureItem_H
51
52 /****************************************************************************/
53 /* INCLUDES                                                                 */
54 /****************************************************************************/
55 #include <math.h>
56
57 #include "FGWeatherDefs.h"
58                 
59 /****************************************************************************/
60 /* DEFINES                                                                  */
61 /****************************************************************************/
62 class FGAirPressureItem;
63 FGAirPressureItem operator-(const FGAirPressureItem& arg);
64
65 /****************************************************************************/
66 /* CLASS DECLARATION                                                        */
67 /* NOTE: The value stored in 'value' is the air preasure that we'd have at  */
68 /*       an altitude of 0.0 The correct airpreasure at the stored altitude  */
69 /*       gets  calulated in  FGPhyiscalProperties  as  I need  to know  the */
70 /*       temperatures at the different altitudes for that.                  */
71 /****************************************************************************/
72 class FGAirPressureItem
73 {
74 private:
75     WeatherPrecision value; //that's the airpressure at 0 metres
76
77 protected:
78 public:
79
80     FGAirPressureItem(const WeatherPrecision v) {value = v;                             }
81     FGAirPressureItem()                         {value = FG_WEATHER_DEFAULT_AIRPRESSURE;}
82
83     WeatherPrecision getValue() const
84     { 
85         return value;
86     };
87
88     void setValue(WeatherPrecision p) 
89     { 
90         value = p;
91     };
92
93     FGAirPressureItem& operator*=(const WeatherPrecision   arg);
94     FGAirPressureItem& operator+=(const FGAirPressureItem& arg);
95     FGAirPressureItem& operator-=(const FGAirPressureItem& arg);
96
97     friend FGAirPressureItem operator-(const FGAirPressureItem& arg);
98 };
99
100 inline FGAirPressureItem& FGAirPressureItem::operator*= (const WeatherPrecision arg)
101 {
102   value *= arg;
103   return *this;
104 }
105
106 inline FGAirPressureItem& FGAirPressureItem::operator+= (const FGAirPressureItem& arg)
107 {
108   value += arg.value;
109   return *this;
110 }
111
112 inline FGAirPressureItem& FGAirPressureItem::operator-= (const FGAirPressureItem& arg)
113 {
114   value -= arg.value;
115   return *this;
116 }
117
118 inline FGAirPressureItem operator-(const FGAirPressureItem& arg)
119 {
120     return FGAirPressureItem(-arg.value);
121 }
122
123 /****************************************************************************/
124 #endif /*FGAirPressureItem_H*/
125
126
127
128
129
130