![]() |
Maria GDK 5.0.0.738
Documentation of native code in develop branch
|
#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) | |
IMapTileProvider * | GetMapTileProvider (const Maria::MapContentQuery &mcq) const |
std::shared_ptr< ITileDataRequestHandler > | GetTileDataRequestHandler () |
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::TileCache > | GetTileCache (const MapContentQuery &mcq) const |
std::shared_ptr< Maria::TileCache > | GetOrCreateTileCache (const MapContentQuery &mcq, std::shared_ptr< TileDataFactory > tdf) |
void | RemoveTileCache (const MapContentQuery &mcq) |
std::vector< TileCacheStats > | GetStatistics () |
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 |
TileCacheManager - Short description. Detailed description.
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.
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.
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.
void TileCacheManager::RemoveTileCache | ( | const MapContentQuery & | mcq | ) |
Delete tile cache if it exists.