AliceVision
Photogrammetric Computer Vision Framework
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
aliceVision::image::TileCacheManager Class Reference

#include <cache.hpp>

Inheritance diagram for aliceVision::image::TileCacheManager:
aliceVision::image::CacheManager

Public Types

using shared_ptr = std::shared_ptr< TileCacheManager >
 
using MapCachedTile = std::map< size_t, CachedTile::weak_pointer >
 
- Public Types inherited from aliceVision::image::CacheManager
using IndexedStoragePaths = std::unordered_map< size_t, std::string >
 
using IndexedFreeBlocks = std::unordered_map< size_t, std::list< size_t > >
 
using MemoryMap = std::map< size_t, MemoryItem >
 
using MRUType = boost::multi_index::multi_index_container< MRUItem, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_unique< boost::multi_index::member< MRUItem, size_t, &MRUItem::objectId > >> >
 

Public Member Functions

void notifyDestroy (size_t tileId)
 
bool acquire (size_t tileId)
 
std::shared_ptr< CachedTilerequireNewCachedTile (size_t width, size_t height, size_t blockCount)
 
template<class T >
std::shared_ptr< CachedTilerequireNewCachedTile (size_t width, size_t height)
 
size_t getTileWidth () const
 
size_t getTileHeight () const
 
- Public Member Functions inherited from aliceVision::image::CacheManager
 CacheManager (const std::string &pathStorage, size_t blockSize, size_t maxBlocksPerIndex)
 
void setMaxMemory (size_t maxMemorySize)
 
void setInCoreMaxObjectCount (size_t max)
 
bool createObject (size_t &objectId, size_t blockCount)
 
bool acquireObject (std::unique_ptr< unsigned char > &data, size_t objectId)
 
size_t getActiveBlocks () const
 

Static Public Member Functions

static std::shared_ptr< TileCacheManagercreate (const std::string &pathStorage, size_t tileWidth, size_t tileHeight, size_t maxTilesPerIndex)
 

Protected Member Functions

 TileCacheManager (const std::string &pathStorage, size_t tileWidth, size_t tileHeight, size_t maxTilesPerIndex)
 
virtual void onRemovedFromMRU (size_t objectId)
 
- Protected Member Functions inherited from aliceVision::image::CacheManager
std::string getPathForIndex (size_t indexId)
 
void deleteIndexFiles ()
 
void wipe ()
 
bool prepareBlockGroup (size_t startBlockId, size_t blocksCount)
 
std::unique_ptr< unsigned char > load (size_t startBlockId, size_t blocksCount)
 
bool save (std::unique_ptr< unsigned char > &&data, size_t startBlockId, size_t blockCount)
 
bool saveObject (std::unique_ptr< unsigned char > &&data, size_t objectId)
 
void addFreeBlock (size_t blockId, size_t blockCount)
 
size_t getFreeBlockId (size_t blockCount)
 

Protected Attributes

size_t _tileWidth
 
size_t _tileHeight
 
MapCachedTile _objectMap
 
- Protected Attributes inherited from aliceVision::image::CacheManager
size_t _blockSize {0}
 
size_t _incoreBlockUsageCount {0}
 
size_t _incoreBlockUsageMax {0}
 
size_t _blockCountPerIndex {0}
 
size_t _nextStartBlockId {0}
 
size_t _nextObjectId {0}
 
std::string _basePathStorage
 
IndexedStoragePaths _indexPaths
 
IndexedFreeBlocks _freeBlocks
 
MRUType _mru
 
MemoryMap _memoryMap
 

Detailed Description

A cache manager specialized for image tiles All tiles in this image have a size multiple of a given base tile size.

Member Function Documentation

◆ acquire()

bool aliceVision::image::TileCacheManager::acquire ( size_t  tileId)

Acquire a given tile

Parameters
tileIdthe tile index to acquire
Returns
true if the tile was acquired

◆ create()

std::shared_ptr< TileCacheManager > aliceVision::image::TileCacheManager::create ( const std::string &  pathStorage,
size_t  tileWidth,
size_t  tileHeight,
size_t  maxTilesPerIndex 
)
static

There is no explicit constructor. We want to force the use of shared pointer for the manager

Parameters
pathStoragethe path to the directory where the file will be stored
tileWidththe base width of a tile
tileWidththe base height of a tile
maxTilesPerIndexthe maximal number of tiles for a given file (give a maximal size for a cache file) @retuurn the manager shared pointer

◆ getTileHeight()

size_t aliceVision::image::TileCacheManager::getTileHeight ( ) const
inline

Return the base tile height

Returns
a width

◆ getTileWidth()

size_t aliceVision::image::TileCacheManager::getTileWidth ( ) const
inline

Return the base tile width

Returns
a width

◆ notifyDestroy()

void aliceVision::image::TileCacheManager::notifyDestroy ( size_t  tileId)

Notify the manager that a given tile was destroyed.

Parameters
tileIdthe tile index which was destroyed
Note
this method should not be explicitly called except by CachedTile

◆ requireNewCachedTile()

std::shared_ptr< CachedTile > aliceVision::image::TileCacheManager::requireNewCachedTile ( size_t  width,
size_t  height,
size_t  blockCount 
)

Acquire a given tile

Parameters
widththe requested tile size (less or equal to the base tile size)
heightthe requested tile size (less or equal to the base tile size)
blockCountthe requested tile size in depth
Returns
a pointer to the cached tile created

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