]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/tgdb/TileCache.hxx
Remove using std:: from the metar header, remove HTTP support, add very basic unit...
[simgear.git] / simgear / scene / tgdb / TileCache.hxx
index 6e137d0ad66f67a3aeb0e9b5a240ab1a86016d28..5b6619644ad96fd5adcd1e2fb4e053a12cd25463 100644 (file)
@@ -1,4 +1,4 @@
-// newcache.hxx -- routines to handle scenery tile caching
+// TileCache.hxx -- routines to handle scenery tile caching
 //
 // Written by Curtis Olson, started December 2000.
 //
 #include <map>
 
 #include <simgear/bucket/newbucket.hxx>
-#include <simgear/math/point3d.hxx>
 #include <simgear/scene/tgdb/TileEntry.hxx>
 
-SG_USING_STD(map);
+using std::map;
 
 namespace simgear {
 
@@ -50,6 +49,8 @@ private:
     // pointers to allow an external linear traversal of cache entries
     tile_map_iterator current;
 
+    double current_time;
+
     // Free a tile cache entry
     void entry_free( long cache_index );
 
@@ -71,18 +72,20 @@ public:
     // Check if the specified "bucket" exists in the cache
     bool exists( const SGBucket& b ) const;
 
-    // Return the index of the oldest tile in the cache, return -1 if
+    // Return the index of a tile to be dropped from the cache, return -1 if
     // nothing available to be removed.
-    long get_oldest_tile();
-
-    // Clear the inner ring flag for all tiles in the cache so that
-    // the external tile scheduler can flag the inner ring correctly.
-    void clear_inner_ring_flags();
+    long get_drop_tile();
+    
+    // Clear all flags indicating tiles belonging to the current view
+    void clear_current_view();
 
     // Clear a cache entry, note that the cache only holds pointers
     // and this does not free the object which is pointed to.
     void clear_entry( long cache_entry );
 
+    // Refresh/reload a tile when it's already in memory.
+    void refresh_tile(long tile_index);
+
     // Clear all completely loaded tiles (ignores partially loaded tiles)
     void clear_cache();
 
@@ -122,6 +125,12 @@ public:
      * @return success/failure
      */
     bool insert_tile( simgear::TileEntry* e );
+
+    void set_current_time(double val) { current_time = val; }
+    double get_current_time() const { return current_time; }
+
+    // update tile's priority and expiry time according to current request
+    void request_tile(TileEntry* t,float priority,bool current_view,double requesttime);
 };
 
 }