Class TileStorage

Class Documentation

class TileStorage

This class holds a specified number of GDAL tiles in memory.

If the number of tiles added exceeds the max_size attribute, the tile least recently accessed will be removed.

Public Functions

explicit TileStorage(unsigned int max_size)

Constructor.

Parameters

max_size – capacity of the storage.

Throws

std::invalid_argument – if max_size is 0 and the error mode is ErrorMode::DIE.

void add_tile(not_null<std::shared_ptr<Tile>> tile)

Adds a tile to the storage.

Parameters

tile – a shared pointer to the GDAL tile.

size_t get_size() const

Returns the number of tiles currently stored.

Returns

Number of tiles stored.

bool is_stored(const std::string &filename) const

Checks to see if a tile with the given filename is currently stored.

Parameters

filename – the filename of the tile

Returns

true if found, false otherwise.

std::shared_ptr<Tile> get_tile(const std::string &filename) const

Gets the tile with the given filename.

Parameters

filename – filename of the tile

Returns

A shared pointer to the GDAL tile, or nullptr if the filename is not found.