Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::TileCacheManager Class Reference

#include <MTileCacheManager.h>

Public Member Functions

 TileCacheManager (std::shared_ptr< Maria::SystemTicker > systemTicker, std::shared_ptr< Maria::IMapTileProviderCatalog > providerCatalog, std::shared_ptr< Maria::ITileDataRequestHandler > requestHandler, int maxMemoryUsage=200000000)
 
IMapTileProviderGetMapTileProvider (const Maria::MapContentQuery &mcq) const
 
std::shared_ptr< ITileDataRequestHandlerGetTileDataRequestHandler ()
 
bool HasProvider (MapContentType wantedMapContentType) const
 
void AddMapTileProvider (std::shared_ptr< IMapTileProvider > mapTileProvider)
 
bool HasFactory (Maria::MapContentType mct) const
 
void AddTileFactory (Maria::MapContentType mct, std::shared_ptr< TileDataFactory > fac)
 
void ScanProviderMapEntries (bool force)
 
std::shared_ptr< Maria::TileCacheGetTileCache (const MapContentQuery &mcq) const
 
std::shared_ptr< Maria::TileCacheGetOrCreateTileCache (const MapContentQuery &mcq, std::shared_ptr< TileDataFactory > tdf)
 
void RemoveTileCache (const MapContentQuery &mcq)
 
std::vector< TileCacheStatsGetStatistics ()
 
int GetMaxMemoryUsage () const
 Returns the maximum tile cache size in bytes.
 
void SetMaxMemoryUsage (int maxMemoryUsage)
 Sets the maximum tile cache size in bytes.
 
int GetMemoryUsage () const
 Gets current tile cache memory usage in bytes.
 
int Cleanup (int64_t currTime)
 
void ClearTileCaches ()
 
const std::map< size_t, std::shared_ptr< Maria::TileCache > > & GetTileCaches () const
 
bool GetMapEntry (const Maria::MapContentQuery &mcq, MapEntry &me) const
 
void GetMapEntries (std::vector< MapEntry > &mapEntries) const
 

Protected Attributes

std::mutex _cacheLock
 
std::shared_ptr< Maria::SystemTicker_systemTicker
 
std::map< size_t, std::shared_ptr< Maria::TileCache > > _tileCaches
 
std::shared_ptr< ITileDataRequestHandler_requestHandler
 
std::shared_ptr< IMapTileProviderCatalog_providerCatalog
 
std::map< Maria::MapContentType, std::shared_ptr< TileDataFactory > > _tileFactories
 
int _maxMemoryUsage
 

Detailed Description

TileCacheManager - Short description. Detailed description.

Member Function Documentation

◆ ClearTileCaches()

void TileCacheManager::ClearTileCaches ( )

Clear all tile data from all tile caches. You also need to make sure that any pending requests or external references to the tile data are handled correctly. This method will simply remove the reference from the tile cache.

◆ GetOrCreateTileCache()

std::shared_ptr< TileCache > TileCacheManager::GetOrCreateTileCache ( const MapContentQuery mcq,
std::shared_ptr< TileDataFactory tdf 
)

Get or create tile cache. Returns the tile cache corresponding to the given map content query if any, and creates a new one, of no such cache exists. Note that the TileDataFactory and MapDataProvider parameters are not considered if the cache already exists. In this case you must make sure that the returned cache uses the correct provider and factory, if these have changed since the cache was originally created.

TODO: Rewrite, we should not be able to get in the situation where we get a tile cache with different provider and factory.

◆ GetTileCache()

std::shared_ptr< TileCache > TileCacheManager::GetTileCache ( const MapContentQuery mcq) const

Get existing tile cache. Returns the tile cache corresponding to the given map content query if any. Returns null if no such cache exists.

◆ RemoveTileCache()

void TileCacheManager::RemoveTileCache ( const MapContentQuery mcq)

Delete tile cache if it exists.


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