SourceXtractorPlusPlus  0.15
Please provide a description of the project.
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
SourceXtractor::TileManager Class Reference

#include <TileManager.h>

Collaboration diagram for SourceXtractor::TileManager:
[legend]

Public Member Functions

 TileManager ()
 
virtual ~TileManager ()
 
void setOptions (int tile_width, int tile_height, int max_memory)
 
void flush ()
 
std::shared_ptr< ImageTilegetTileForPixel (int x, int y, std::shared_ptr< const ImageSource > source)
 
void saveAllTiles ()
 
int getTileWidth () const
 
int getTileHeight () const
 

Static Public Member Functions

static std::shared_ptr< TileManagergetInstance ()
 

Private Member Functions

std::shared_ptr< ImageTiletryTileFromCache (const TileKey &key)
 
std::shared_ptr< boost::mutex > & getMutexForImageSource (const ImageSource *)
 
void removeTile (TileKey tile_key)
 
void removeExtraTiles ()
 
void addTile (TileKey key, std::shared_ptr< ImageTile > tile)
 

Private Attributes

int m_tile_width
 
int m_tile_height
 
long m_max_memory
 
long m_total_memory_used
 
std::unordered_map< TileKey, std::shared_ptr< ImageTile > > m_tile_map
 
std::unordered_map< const ImageSource *, std::shared_ptr< boost::mutex > > m_mutex_map
 
std::list< TileKeym_tile_list
 
boost::shared_mutex m_mutex
 

Detailed Description

Definition at line 75 of file TileManager.h.

Constructor & Destructor Documentation

◆ TileManager()

SourceXtractor::TileManager::TileManager ( )

Definition at line 42 of file TileManager.cpp.

◆ ~TileManager()

SourceXtractor::TileManager::~TileManager ( )
virtual

Definition at line 46 of file TileManager.cpp.

References saveAllTiles().

Here is the call graph for this function:

Member Function Documentation

◆ addTile()

void SourceXtractor::TileManager::addTile ( TileKey  key,
std::shared_ptr< ImageTile tile 
)
private

Definition at line 181 of file TileManager.cpp.

References Elements::Logging::debug(), m_tile_list, m_tile_map, m_total_memory_used, and SourceXtractor::s_tile_logger.

Referenced by getTileForPixel().

Here is the call graph for this function:

◆ flush()

void SourceXtractor::TileManager::flush ( )

Definition at line 59 of file TileManager.cpp.

References m_mutex, m_tile_list, m_tile_map, m_total_memory_used, and saveAllTiles().

Referenced by setOptions().

Here is the call graph for this function:

◆ getInstance()

std::shared_ptr< TileManager > SourceXtractor::TileManager::getInstance ( )
static

◆ getMutexForImageSource()

std::shared_ptr< boost::mutex > & SourceXtractor::TileManager::getMutexForImageSource ( const ImageSource src_ptr)
private

Definition at line 90 of file TileManager.cpp.

References m_mutex, and m_mutex_map.

Referenced by getTileForPixel().

◆ getTileForPixel()

std::shared_ptr< ImageTile > SourceXtractor::TileManager::getTileForPixel ( int  x,
int  y,
std::shared_ptr< const ImageSource source 
)

Definition at line 100 of file TileManager.cpp.

References addTile(), std::shared_ptr< T >::get(), getMutexForImageSource(), m_mutex, m_tile_height, m_tile_width, std::min(), removeExtraTiles(), tryTileFromCache(), x, and y.

Here is the call graph for this function:

◆ getTileHeight()

int SourceXtractor::TileManager::getTileHeight ( ) const

Definition at line 155 of file TileManager.cpp.

References m_tile_height.

◆ getTileWidth()

int SourceXtractor::TileManager::getTileWidth ( ) const

Definition at line 151 of file TileManager.cpp.

References m_tile_width.

◆ removeExtraTiles()

void SourceXtractor::TileManager::removeExtraTiles ( )
private

Definition at line 172 of file TileManager.cpp.

References m_max_memory, m_tile_list, m_total_memory_used, and removeTile().

Referenced by getTileForPixel().

Here is the call graph for this function:

◆ removeTile()

void SourceXtractor::TileManager::removeTile ( TileKey  tile_key)
private

Definition at line 159 of file TileManager.cpp.

References Elements::Logging::debug(), m_tile_map, m_total_memory_used, and SourceXtractor::s_tile_logger.

Referenced by removeExtraTiles().

Here is the call graph for this function:

◆ saveAllTiles()

void SourceXtractor::TileManager::saveAllTiles ( )

Definition at line 143 of file TileManager.cpp.

References m_mutex, m_tile_list, and m_tile_map.

Referenced by flush(), and ~TileManager().

◆ setOptions()

void SourceXtractor::TileManager::setOptions ( int  tile_width,
int  tile_height,
int  max_memory 
)

Definition at line 50 of file TileManager.cpp.

References flush(), m_max_memory, m_mutex, m_tile_height, and m_tile_width.

Here is the call graph for this function:

◆ tryTileFromCache()

std::shared_ptr< ImageTile > SourceXtractor::TileManager::tryTileFromCache ( const TileKey key)
private

Definition at line 74 of file TileManager.cpp.

References Elements::Logging::debug(), m_mutex, m_tile_map, and SourceXtractor::s_tile_logger.

Referenced by getTileForPixel().

Here is the call graph for this function:

Member Data Documentation

◆ m_max_memory

long SourceXtractor::TileManager::m_max_memory
private

Definition at line 111 of file TileManager.h.

Referenced by removeExtraTiles(), and setOptions().

◆ m_mutex

boost::shared_mutex SourceXtractor::TileManager::m_mutex
private

◆ m_mutex_map

std::unordered_map<const ImageSource*, std::shared_ptr<boost::mutex> > SourceXtractor::TileManager::m_mutex_map
private

Definition at line 115 of file TileManager.h.

Referenced by getMutexForImageSource().

◆ m_tile_height

int SourceXtractor::TileManager::m_tile_height
private

Definition at line 110 of file TileManager.h.

Referenced by getTileForPixel(), getTileHeight(), and setOptions().

◆ m_tile_list

std::list<TileKey> SourceXtractor::TileManager::m_tile_list
private

Definition at line 116 of file TileManager.h.

Referenced by addTile(), flush(), removeExtraTiles(), and saveAllTiles().

◆ m_tile_map

std::unordered_map<TileKey, std::shared_ptr<ImageTile> > SourceXtractor::TileManager::m_tile_map
private

Definition at line 114 of file TileManager.h.

Referenced by addTile(), flush(), removeTile(), saveAllTiles(), and tryTileFromCache().

◆ m_tile_width

int SourceXtractor::TileManager::m_tile_width
private

Definition at line 110 of file TileManager.h.

Referenced by getTileForPixel(), getTileWidth(), and setOptions().

◆ m_total_memory_used

long SourceXtractor::TileManager::m_total_memory_used
private

Definition at line 112 of file TileManager.h.

Referenced by addTile(), flush(), removeExtraTiles(), and removeTile().


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