ome-files  0.5.0
Public Types | Public Member Functions | Private Attributes | List of all members
ome::files::TileCache Class Reference

Tile cache. More...

#include <ome/files/TileCache.h>

+ Collaboration diagram for ome::files::TileCache:

Public Types

typedef dimension_size_type key_type
 Tile index type.
 
typedef std::shared_ptr< TileBuffervalue_type
 Tile buffer type.
 

Public Member Functions

 TileCache ()
 Constructor.
 
virtual ~TileCache ()
 Destructor.
 
SKIP bool insert (key_type tileindex, value_type tilebuffer)
 Insert a tile into the tile cache. More...
 
void erase (key_type tileindex)
 Remove a tile from the tile cache. More...
 
value_type find (key_type tileindex)
 Find a tile in the tile cache. More...
 
const value_type find (key_type tileindex) const
 Find a tile in the tile cache. More...
 
dimension_size_type size () const
 Get the tile cache size. More...
 
void clear ()
 Clear the tile cache.
 
value_typeoperator[] (key_type tileindex)
 Get a tile from the tile cache. More...
 

Private Attributes

std::map< key_type, value_typecache
 Mapping of tile number to tile buffer.
 

Detailed Description

Tile cache.

This is a collection of TileBuffer objects indexed by tile number.

Member Function Documentation

◆ erase()

void ome::files::TileCache::erase ( key_type  tileindex)

Remove a tile from the tile cache.

Parameters
tileindexthe tile to remove.

References cache.

◆ find() [1/2]

TileCache::value_type ome::files::TileCache::find ( key_type  tileindex)

Find a tile in the tile cache.

Parameters
tileindexthe tile index to find.
Returns
the tile buffer corresponding to the specified index. If the tile index was not found, this will be null.

References cache.

◆ find() [2/2]

const TileCache::value_type ome::files::TileCache::find ( key_type  tileindex) const

Find a tile in the tile cache.

Parameters
tileindexthe tile index to find.
Returns
the tile buffer corresponding to the specified tile index. If the tile index was not found, this will be null.

References cache.

◆ insert()

bool ome::files::TileCache::insert ( key_type  tileindex,
value_type  tilebuffer 
)

Insert a tile into the tile cache.

The tile index must not already be present in the tile cache. If it is already present, the insert will fail.

The tilebuffer must not be null. If the tilebuffer is null the insert will fail.

Parameters
tileindexthe tile index of the tile buffer.
tilebufferthe buffered tile pixel data.
Returns
true if the insert succeeded, false otherwise.

References cache.

◆ operator[]()

TileCache::value_type & ome::files::TileCache::operator[] ( key_type  tileindex)

Get a tile from the tile cache.

If the tile index is not found, it will be inserted into the cache with a null tile buffer; since this is returned by reference it may be assigned a new tile buffer directly.

Parameters
tileindexthe tile index to get.
Returns
the tile buffer corresponding to the specified tile index. If the tile index was not found, this will be null.

References cache.

◆ size()

dimension_size_type ome::files::TileCache::size ( ) const

Get the tile cache size.

Returns
the tile cache size.

References cache.


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