]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGWindItem.h
5bd7e9ff7a8f8d04fb650de612ba9ce527e73702
[flightgear.git] / src / WeatherCM / FGWindItem.h
1 /*****************************************************************************
2
3  Header:       FGWindItem.h     
4  Author:       Christian Mayer
5  Date started: 28.05.99
6
7  ---------- Copyright (C) 1999  Christian Mayer (vader@t-online.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 wind 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 10.10.1999 Christian Mayer      added mutable for gcc 2.95 portability
36 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
37                                 suggestion
38 *****************************************************************************/
39
40 /****************************************************************************/
41 /* SENTRY                                                                   */
42 /****************************************************************************/
43 #ifndef FGWindItem_H
44 #define FGWindItem_H
45
46 /****************************************************************************/
47 /* INCLUDES                                                                 */
48 /****************************************************************************/
49 #include <Math/point3d.hxx>
50 #include "FGWeatherDefs.h"
51
52 //for the case that mutable isn't supported:
53 #include "Include/compiler.h"
54                 
55 /****************************************************************************/
56 /* DEFINES                                                                  */
57 /****************************************************************************/
58 class FGWindItem;
59 FGWindItem operator-(const FGWindItem& arg);
60
61 /****************************************************************************/
62 /* CLASS DECLARATION                                                        */
63 /****************************************************************************/
64 class FGWindItem
65 {
66 private:
67     mutable Point3D value;
68     WeatherPrecition alt;
69
70 protected:
71 public:
72
73     FGWindItem(const WeatherPrecition& a, const Point3D& v) {alt = a; value = v;}
74     FGWindItem(const Point3D& v)                            {alt = 0.0; value = v;}
75     FGWindItem()                                            {alt = 0.0; value = Point3D(0.0);}
76
77     Point3D          getValue() const { return value; };
78     WeatherPrecition getAlt()   const { return alt;   };
79
80     FGWindItem& operator*= (const WeatherPrecition& arg);
81     FGWindItem& operator+= (const FGWindItem& arg);
82     FGWindItem& operator-= (const FGWindItem& arg);
83
84     friend bool operator<(const FGWindItem& arg1, const FGWindItem& arg2);
85     friend FGWindItem operator-(const FGWindItem& arg);
86
87 };
88
89 inline FGWindItem& FGWindItem::operator*= (const WeatherPrecition& arg)
90 {
91   value *= arg;
92   return *this;
93 }
94
95 inline FGWindItem& FGWindItem::operator+= (const FGWindItem& arg)
96 {
97   value += arg.value;
98   return *this;
99 }
100
101 inline FGWindItem& FGWindItem::operator-= (const FGWindItem& arg)
102 {
103   value -= arg.value;
104   return *this;
105 }
106
107
108 inline FGWindItem operator-(const FGWindItem& arg)
109 {
110     return FGWindItem(arg.alt, -arg.value);
111 }
112 /****************************************************************************/
113 #endif /*FGWindItem_H*/