]> git.mxchange.org Git - simgear.git/blob - simgear/metar/MetarStation.h
Changes for the native Irix CC compiler contributed by Erik Hofman.
[simgear.git] / simgear / metar / MetarStation.h
1 // Class encapulating the metar station information
2 //
3 // METAR station information is kept in this file:
4 //   http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.gz
5 //   http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.txt
6
7
8 #ifndef _MetarStation_
9 #define _MetarStation_
10
11 #include <iostream>
12 #include <string>
13 #include <vector>
14 #include <map>
15 #include <simgear/math/point3d.hxx>
16 #include <simgear/math/polar3d.hxx>
17 //using namespace std;
18
19 class CMetarStationDB;
20
21 class CMetarStation
22 {
23         // Attributes
24 private:
25         std::string m_ID;
26         unsigned long m_number;
27         std::string m_name;
28         std::string m_state;
29         std::string m_country;
30         int m_region;
31         Point3D m_locationPolar;
32         Point3D m_upperLocationPolar;
33         Point3D m_locationCart;
34         Point3D m_upperLocationCart;
35         int m_altitude;
36         int m_upperAltitude;
37         char m_pFlag;
38         
39         // Operations
40 private:
41         double decodeDMS( char *b );
42
43
44
45         CMetarStation( 
46                 char *s );
47                         // Constructor
48
49         ~CMetarStation()
50         {
51         }
52                         // Destructor
53
54 public:
55         std::string &ID() { return m_ID; }
56         unsigned long number() { return m_number; }
57         std::string &name() { return m_name; }
58         std::string &state() { return m_state; }
59         std::string &country() { return m_country; }
60         int region() { return m_region; }
61         unsigned int Altitude() { //Returns the stations height above MSL in M.
62                         return m_altitude;}
63         Point3D &locationPolar() { return m_locationPolar; }
64         Point3D &upperLocationPolar() { return m_upperLocationPolar; }
65         Point3D &locationCart() { return m_locationCart; }
66         Point3D &upperLocationCart() { return m_upperLocationCart; }
67         char pFlag() { return m_pFlag; }
68                         // Get attributes
69
70     friend std::ostream& operator << ( std::ostream&, const CMetarStation& );
71         void dump();
72         
73
74         
75
76 private:
77         CMetarStation(
78                 const CMetarStation &rNewObj );
79                         // Copy constructor.  Not implemented.
80
81         CMetarStation &operator =(
82                 const CMetarStation &rObj );
83                         // Assignment operator.  Not implemented.
84
85         friend CMetarStationDB;
86 };
87
88
89 class CMetarStationDB 
90 {
91
92  private:
93     std::string databasePath;  //The path of the database file.
94     std::map<std::string , CMetarStation *> METAR_Stations;
95     CMetarStation * bestStation;
96
97  public:
98      CMetarStation *find( std::string stationID );
99      CMetarStation * find( Point3D locationCart );
100      CMetarStationDB(const char * dbFile);
101      ~CMetarStationDB();
102 };
103
104 #endif