]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/environment_ctrl.hxx
Don't restore initial screen geometry because there is nothing in fg_os* to resize...
[flightgear.git] / src / Environment / environment_ctrl.hxx
index 054a0a2f9ec3577d35c12183adb04713f6e0a6ae..aee0a368bbf75b54ca5f81c1b2e055ff80f731e8 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -27,7 +27,7 @@
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/environment/metar.hxx>
 
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS)
 # include <simgear/threads/SGThread.hxx>
 # include <simgear/threads/SGQueue.hxx>
 #endif
@@ -47,6 +47,7 @@ SG_USING_STD(vector);
 class SGPropertyNode;
 
 #include "environment.hxx"
+#include "fgmetar.hxx"
 
 
 \f
@@ -63,7 +64,7 @@ public:
 
   virtual void setEnvironment (FGEnvironment * environment);
 
-  virtual FGEnvironment * getEnvironment () const { return _environment; }
+  virtual const FGEnvironment * getEnvironment () const { return _environment; }
 
   virtual void setLongitudeDeg (double lon_deg);
   virtual void setLatitudeDeg (double lat_deg);
@@ -141,16 +142,16 @@ private:
 };
 
 
-// A convenience wrapper around SGMetar
+// A convenience wrapper around FGMetar
 struct FGMetarResult {
     string icao;
-    SGMetar *m;
+    FGMetar *m;
 };
 
 
 \f
 /**
- * Interplation controller using the SGMetar class
+ * Interplation controller using the FGMetar class
  */
 class FGMetarEnvironmentCtrl : public FGEnvironmentCtrl
 {
@@ -172,18 +173,19 @@ private:
     float same_station_interval_sec;
     float search_elapsed;
     float fetch_elapsed;
-    FGAirport last_apt;
+    const FGAirport *last_apt;
     SGPropertyNode *proxy_host;
     SGPropertyNode *proxy_port;
     SGPropertyNode *proxy_auth;
+    SGPropertyNode *metar_max_age;
 
     FGMetarResult fetch_data( const string &icao );
-    virtual void update_metar_properties( SGMetar *m );
+    virtual void update_metar_properties( const FGMetar *m );
     void update_env_config();
 
 private:
 
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS)
     /**
      * FIFO queue which holds a pointer to the fetched metar data.
      */
@@ -192,7 +194,7 @@ private:
     /**
      * FIFO queue which holds a pointer to the fetched metar data.
      */
-    SGBlockingQueue < FGMetarResult > result_queue;
+    SGLockedQueue < FGMetarResult > result_queue;
 #else
     /**
      * FIFO queue which holds a pointer to the fetched metar data.
@@ -205,7 +207,7 @@ private:
     queue < FGMetarResult > result_queue;
 #endif
 
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS)
     /**
      * This class represents the thread of execution responsible for
      * fetching the metar data.
@@ -217,7 +219,7 @@ private:
         ~MetarThread() {}
 
         /**
-         * Fetched the metar data from the NOAA.
+         * Fetche the metar data from the NOAA.
          */
         void run();
 
@@ -238,17 +240,13 @@ private:
      */
     MetarThread* thread;
 
-    /**
-     * Lock and synchronize access to metar queue.
-     */
-    SGMutex mutex;
-    SGPthreadCond metar_cond;
-
-    /**
-     * Thread cleanup handler.
-     */
-    friend void metar_cleanup_handler( void* );
+    void thread_stop();
 #endif // ENABLE_THREADS
+
+    int _error_count;
+    int _stale_count;
+    double _dt;
+    double _error_dt;
 };
 
 #endif // _ENVIRONMENT_CTRL_HXX