]> git.mxchange.org Git - simgear.git/blobdiff - simgear/metar/MetarStation.h
MSVC warning fixes
[simgear.git] / simgear / metar / MetarStation.h
index 299e5e175dc3215576a2b574d85bdc7c36b877ed..d551c596480e8263e2c6aae556597a7d8ec535ab 100644 (file)
@@ -3,17 +3,26 @@
 // METAR station information is kept in this file:
 //   http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.gz
 //   http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.txt
-// This class looks for the file FG_ROOT/Weather/MetarStations instread of nsd_cccc.
+
 
 #ifndef _MetarStation_
 #define _MetarStation_
 
-#include <iostream>
-#include <string>
+#include <simgear/compiler.h>
+
+#include STL_IOSTREAM
+#include STL_STRING
 #include <vector>
-#include <Math/point3d.hxx>
-#include <Math/polar3d.hxx>
-//using namespace std;
+#include <map>
+
+#include <simgear/math/point3d.hxx>
+#include <simgear/math/polar3d.hxx>
+
+SG_USING_STD(string);
+SG_USING_STD(vector);
+SG_USING_STD(map);
+
+class CMetarStationDB;
 
 class CMetarStation
 {
@@ -32,14 +41,12 @@ private:
        int m_altitude;
        int m_upperAltitude;
        char m_pFlag;
-
-       static int initialized;
-       static std::string tempName;
-
+       
        // Operations
 private:
        double decodeDMS( char *b );
-       static int sameName( CMetarStation *m );
+
+
 
        CMetarStation( 
                char *s );
@@ -57,6 +64,8 @@ public:
        std::string &state() { return m_state; }
        std::string &country() { return m_country; }
        int region() { return m_region; }
+       unsigned int Altitude() { //Returns the stations height above MSL in M.
+                       return m_altitude;}
        Point3D &locationPolar() { return m_locationPolar; }
        Point3D &upperLocationPolar() { return m_upperLocationPolar; }
        Point3D &locationCart() { return m_locationCart; }
@@ -64,12 +73,11 @@ public:
        char pFlag() { return m_pFlag; }
                        // Get attributes
 
-    friend std::ostream& operator << ( std::ostream&, const CMetarStation& );
+    friend ostream& operator << ( ostream&, const CMetarStation& );
        void dump();
        
-       static CMetarStation *find( std::string stationID );
-       static CMetarStation *find( Point3D locationCart );
-       static void for_each( void f( CMetarStation *s ) );
+
+       
 
 private:
        CMetarStation(
@@ -80,8 +88,23 @@ private:
                const CMetarStation &rObj );
                        // Assignment operator.  Not implemented.
 
-       static int initialize();
+       friend class CMetarStationDB;
 };
 
 
+class CMetarStationDB 
+{
+
+ private:
+    std::string databasePath;  //The path of the database file.
+    std::map<std::string , CMetarStation *> METAR_Stations;
+    CMetarStation * bestStation;
+
+ public:
+     CMetarStation *find( std::string stationID );
+     CMetarStation * find( Point3D locationCart );
+     CMetarStationDB(const char * dbFile);
+     ~CMetarStationDB();
+};
+
 #endif