]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGTurbulenceItem.h
Added first stab at a socket class.
[flightgear.git] / src / WeatherCM / FGTurbulenceItem.h
1 /*****************************************************************************
2
3  Header:       FGTurbulenceItem.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 turbulence item that gets stored in the micro weather class
29
30 HISTORY
31 ------------------------------------------------------------------------------
32 28.05.1999 Christian Mayer      Created
33 16.06.1999 Durk Talsma          Portability for Linux
34 20.06.1999 Christian Mayer      added lots of consts
35 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
36                                 suggestion
37 19.10.1999 Christian Mayer      change to use PLIB's sg instead of Point[2/3]D
38                                 and lots of wee code cleaning
39 *****************************************************************************/
40
41 /****************************************************************************/
42 /* SENTRY                                                                   */
43 /****************************************************************************/
44 #ifndef FGTurbulenceItem_H
45 #define FGTurbulenceItem_H
46
47 /****************************************************************************/
48 /* INCLUDES                                                                 */
49 /****************************************************************************/
50
51 #ifdef HAVE_CONFIG_H
52 #  include <config.h>
53 #endif
54
55 #include <Include/compiler.h>
56
57 #ifdef HAVE_WINDOWS_H
58 #  include <windows.h>
59 #endif
60
61 #include "sg.h"
62
63 #include "FGWeatherDefs.h"
64
65 /****************************************************************************/
66 /* DEFINES                                                                  */
67 /****************************************************************************/
68 class FGTurbulenceItem;
69 FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
70
71 /****************************************************************************/
72 /* CLASS DECLARATION                                                        */
73 /****************************************************************************/
74 class FGTurbulenceItem
75 {
76 private:
77     sgVec3 value;
78
79 protected:
80 public:
81     FGTurbulenceItem(const sgVec3& v)   { sgCopyVec3(value, v);}
82     FGTurbulenceItem()                  { sgZeroVec3(value);   }
83
84     void          getValue(sgVec3 ret) const { sgCopyVec3(ret, value); };
85     const sgVec3* getValue(void)       const { return &value; };
86
87     WeatherPrecision x(void) const { return value[0]; };
88     WeatherPrecision y(void) const { return value[1]; };
89     WeatherPrecision z(void) const { return value[2]; };
90
91     FGTurbulenceItem& operator*= (const WeatherPrecision  arg);
92     FGTurbulenceItem& operator+= (const FGTurbulenceItem& arg);
93     FGTurbulenceItem& operator-= (const FGTurbulenceItem& arg);
94
95     friend FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
96 };
97
98 inline FGTurbulenceItem& FGTurbulenceItem::operator*= (const WeatherPrecision arg)
99 {
100   sgScaleVec3(value, arg);
101   return *this;
102 }
103
104 inline FGTurbulenceItem& FGTurbulenceItem::operator+= (const FGTurbulenceItem& arg)
105 {
106   sgAddVec3(value, *arg.getValue());
107   return *this;
108 }
109
110 inline FGTurbulenceItem& FGTurbulenceItem::operator-= (const FGTurbulenceItem& arg)
111 {
112   sgSubVec3(value, *arg.getValue());
113   return *this;
114 }
115
116 inline FGTurbulenceItem operator-(const FGTurbulenceItem& arg)
117 {
118     sgVec3 temp;
119
120     sgNegateVec3(temp, *arg.getValue());
121
122     return FGTurbulenceItem(temp);
123 }
124
125 /****************************************************************************/
126 #endif /*FGTurbulenceItem_H*/
127
128
129
130