libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::DataTileCache Class Reference

Data cache using tile based cache pages. More...

#include <DataTileCache.h>

Public Member Functions

void CleanupCache ()
 Cleanup the cache. More...
 
 DataTileCache (size_t cacheSize)
 Create a new tile cache with the given cache size. More...
 
TileRef GetCachedTile (const TileId &id) const
 Return the cache tiles with the given id. More...
 
size_t GetSize () const
 
TileRef GetTile (const TileId &id) const
 Return the tile with the given id. More...
 
void GetTilesForBoundingBox (const Magnification &magnification, const GeoBox &boundingBox, std::list< TileRef > &tiles) const
 Return all tile necessary for covering the given boundingbox using the given magnification. More...
 
void InvalidateCache ()
 Mark all tiles as in cache as "incomplete". More...
 
void PrefillDataFromCache (Tile &tile, const TypeInfoSet &nodeTypes, const TypeInfoSet &wayTypes, const TypeInfoSet &areaTypes, const TypeInfoSet &optimizedWayTypes, const TypeInfoSet &optimizedAreaTypes)
 (Partially) prefill the given tiles with data already cached with data of the given types. More...
 
void SetSize (size_t cacheSize)
 Change the size of the cache. More...
 

Detailed Description

Data cache using tile based cache pages.

The cache holds a number of of tiles. The maximum number of tiles hold can be configured. Tiles however will only be freed if a cleanup is explicitely triggered. So temporary overbooking can happen. This should assure that prefilling of tiles is possible even with a very low limit.

The cache will free least recently used tiles first,

Constructor & Destructor Documentation

osmscout::DataTileCache::DataTileCache ( size_t  cacheSize)

Create a new tile cache with the given cache size.

Member Function Documentation

void osmscout::DataTileCache::CleanupCache ( )

Cleanup the cache.

Free least recently used tiles until the given maximum cache size is reached again.

Referenced by osmscout::MapService::CleanupTileCache(), and SetSize().

TileRef osmscout::DataTileCache::GetCachedTile ( const TileId id) const

Return the cache tiles with the given id.

If the tiles is not cache, an empty reference will be returned.

Referenced by PrefillDataFromCache().

size_t osmscout::DataTileCache::GetSize ( ) const
inline
TileRef osmscout::DataTileCache::GetTile ( const TileId id) const

Return the tile with the given id.

If the tile is not currently cached return an empty and unassigned tile and move it to the front of the cache.

Referenced by GetTilesForBoundingBox(), and osmscout::MapService::LookupTile().

void osmscout::DataTileCache::GetTilesForBoundingBox ( const Magnification magnification,
const GeoBox &  boundingBox,
std::list< TileRef > &  tiles 
) const

Return all tile necessary for covering the given boundingbox using the given magnification.

References osmscout::cellDimension, osmscout::Magnification::GetLevel(), GetTile(), osmscout::CellDimension::height, and osmscout::CellDimension::width.

Referenced by osmscout::MapService::LookupTiles().

void osmscout::DataTileCache::InvalidateCache ( )

Mark all tiles as in cache as "incomplete".

Referenced by osmscout::MapService::InvalidateTileCache().

void osmscout::DataTileCache::PrefillDataFromCache ( Tile tile,
const TypeInfoSet &  nodeTypes,
const TypeInfoSet &  wayTypes,
const TypeInfoSet &  areaTypes,
const TypeInfoSet &  optimizedWayTypes,
const TypeInfoSet &  optimizedAreaTypes 
)

(Partially) prefill the given tiles with data already cached with data of the given types.

Currently prefill is done by looking for the parent tile in the cache and copying data that intersects the bounding box of the given tile.

References osmscout::Tile::GetBoundingBox(), GetCachedTile(), osmscout::Tile::GetId(), osmscout::TileId::GetLevel(), and osmscout::TileId::GetParent().

void osmscout::DataTileCache::SetSize ( size_t  cacheSize)

Change the size of the cache.

Cache will be cleaned immediately.

References CleanupCache().

Referenced by osmscout::MapService::FlushTileCache(), and osmscout::MapService::SetCacheSize().


The documentation for this class was generated from the following files: