|
Krita Source Code Documentation
|
#include <kis_tile_hash_table.h>
Public Types | |
| typedef T | TileType |
| typedef KisSharedPtr< T > | TileTypeSP |
| typedef KisWeakSharedPtr< T > | TileTypeWSP |
Public Member Functions | |
| void | addTile (TileTypeSP tile) |
| void | clear () |
| void | debugMaxListLength (qint32 &min, qint32 &max) |
| void | debugPrintInfo () |
| KisTileData * | defaultTileData () const |
| bool | deleteTile (qint32 col, qint32 row) |
| bool | deleteTile (TileTypeSP tile) |
| TileTypeSP | getExistingTile (qint32 col, qint32 row) |
| TileTypeSP | getReadOnlyTileLazy (qint32 col, qint32 row, bool &existingTile) |
| TileTypeSP | getTileLazy (qint32 col, qint32 row, bool &newTile) |
| bool | isEmpty () |
| KisTileHashTableTraits (const KisTileHashTableTraits< T > &ht, KisMementoManager *mm) | |
| KisTileHashTableTraits (KisMementoManager *mm) | |
| qint32 | numTiles () |
| KisTileData * | refAndFetchDefaultTileData () const |
| void | setDefaultTileData (KisTileData *defaultTileData) |
| bool | tileExists (qint32 col, qint32 row) |
| ~KisTileHashTableTraits () | |
Private Member Functions | |
| qint32 | debugChainLen (qint32 idx) |
| void | debugListLengthDistribution () |
| KisTileData * | defaultTileDataImp () const |
| TileTypeSP | getTile (qint32 col, qint32 row, qint32 idx) |
| TileTypeSP | getTileMinefieldWalk (qint32 col, qint32 row, qint32 idx) |
| void | linkTile (TileTypeSP tile, qint32 idx) |
| void | sanityChecksumCheck () |
| void | setDefaultTileDataImp (KisTileData *defaultTileData) |
| bool | unlinkTile (qint32 col, qint32 row, qint32 idx) |
Static Private Member Functions | |
| static quint32 | calculateHash (qint32 col, qint32 row) |
Private Attributes | |
| KisTileData * | m_defaultTileData |
| TileTypeSP * | m_hashTable |
| QReadWriteLock | m_lock |
| KisMementoManager * | m_mementoManager |
| qint32 | m_numTiles |
Static Private Attributes | |
| static const qint32 | TABLE_SIZE = 1024 |
Friends | |
| template<class U , class LockerType > | |
| class | KisTileHashTableIteratorTraits |
This is a template for a hash table that stores tiles (or some other objects resembling tiles). Actually, this object should only have col()/row() methods and be able to answer setNext()/next() requests to be stored here. It is used in KisTiledDataManager and KisMementoManager.
Definition at line 24 of file kis_tile_hash_table.h.
| typedef T KisTileHashTableTraits< T >::TileType |
Definition at line 27 of file kis_tile_hash_table.h.
| typedef KisSharedPtr<T> KisTileHashTableTraits< T >::TileTypeSP |
Definition at line 28 of file kis_tile_hash_table.h.
| typedef KisWeakSharedPtr<T> KisTileHashTableTraits< T >::TileTypeWSP |
Definition at line 29 of file kis_tile_hash_table.h.
| KisTileHashTableTraits< T >::KisTileHashTableTraits | ( | KisMementoManager * | mm | ) |
Definition at line 16 of file kis_tile_hash_table_p.h.
References KisTileHashTableTraits< T >::m_defaultTileData, KisTileHashTableTraits< T >::m_hashTable, KisTileHashTableTraits< T >::m_mementoManager, KisTileHashTableTraits< T >::m_numTiles, and KisTileHashTableTraits< T >::TABLE_SIZE.
| KisTileHashTableTraits< T >::KisTileHashTableTraits | ( | const KisTileHashTableTraits< T > & | ht, |
| KisMementoManager * | mm ) |
Definition at line 28 of file kis_tile_hash_table_p.h.
| KisTileHashTableTraits< T >::~KisTileHashTableTraits | ( | ) |
Definition at line 63 of file kis_tile_hash_table_p.h.
| void KisTileHashTableTraits< T >::addTile | ( | TileTypeSP | tile | ) |
Definition at line 267 of file kis_tile_hash_table_p.h.
|
inlinestaticprivate |
Definition at line 71 of file kis_tile_hash_table_p.h.
| void KisTileHashTableTraits< T >::clear | ( | ) |
About disconnection of tiles see a comment in unlinkTile()
Definition at line 291 of file kis_tile_hash_table_p.h.
|
inlineprivate |
Definition at line 361 of file kis_tile_hash_table_p.h.
|
private |
Definition at line 389 of file kis_tile_hash_table_p.h.
| void KisTileHashTableTraits< T >::debugMaxListLength | ( | qint32 & | min, |
| qint32 & | max ) |
Definition at line 369 of file kis_tile_hash_table_p.h.
| void KisTileHashTableTraits< T >::debugPrintInfo | ( | ) |
Definition at line 348 of file kis_tile_hash_table_p.h.
| KisTileData * KisTileHashTableTraits< T >::defaultTileData | ( | ) | const |
Definition at line 329 of file kis_tile_hash_table_p.h.
|
inlineprivate |
Definition at line 192 of file kis_tile_hash_table_p.h.
| bool KisTileHashTableTraits< T >::deleteTile | ( | qint32 | col, |
| qint32 | row ) |
Definition at line 276 of file kis_tile_hash_table_p.h.
| bool KisTileHashTableTraits< T >::deleteTile | ( | TileTypeSP | tile | ) |
Definition at line 285 of file kis_tile_hash_table_p.h.
| KisTileHashTableTraits< T >::TileTypeSP KisTileHashTableTraits< T >::getExistingTile | ( | qint32 | col, |
| qint32 | row ) |
Returns a tile in position (col,row). If no tile exists, returns null.
| col | column of the tile |
| row | row of the tile |
Definition at line 206 of file kis_tile_hash_table_p.h.
| KisTileHashTableTraits< T >::TileTypeSP KisTileHashTableTraits< T >::getReadOnlyTileLazy | ( | qint32 | col, |
| qint32 | row, | ||
| bool & | existingTile ) |
Returns a tile in position (col,row). If no tile exists, creates nothing, but returns shared default tile object of the table. Be careful, this object has column and row parameters set to (qint32_MIN, qint32_MIN).
| col | column of the tile |
| row | row of the tile |
| existingTile | returns true if the tile actually exists in the table and it is not a lazily created default wrapper tile |
Definition at line 247 of file kis_tile_hash_table_p.h.
|
private |
Definition at line 113 of file kis_tile_hash_table_p.h.
| KisTileHashTableTraits< T >::TileTypeSP KisTileHashTableTraits< T >::getTileLazy | ( | qint32 | col, |
| qint32 | row, | ||
| bool & | newTile ) |
Returns a tile in position (col,row). If no tile exists, creates a new one, attaches it to the list and returns.
| col | column of the tile |
| row | row of the tile |
| newTile | out-parameter, returns true if a new tile was created |
Definition at line 219 of file kis_tile_hash_table_p.h.
References newTile().
|
private |
This is a special method for dangerous and unsafe access to the tiles table. Thanks to the fact that our shared pointers are thread safe, we can iterate through the linked list without having any locks help. In the worst case, we will miss the needed tile. In that case, the higher level code will do the proper locking and do the second try with all the needed locks held.
Definition at line 78 of file kis_tile_hash_table_p.h.
|
inline |
Definition at line 38 of file kis_tile_hash_table.h.
References KisTileHashTableTraits< T >::m_numTiles.
|
private |
Definition at line 129 of file kis_tile_hash_table_p.h.
|
inline |
Definition at line 83 of file kis_tile_hash_table.h.
References KisTileHashTableTraits< T >::m_numTiles.
|
inline |
Definition at line 336 of file kis_tile_hash_table_p.h.
References KisTileData::ref().
|
private |
We assume that the lock should have already been taken by the code that was going to change the table
Definition at line 417 of file kis_tile_hash_table_p.h.
| void KisTileHashTableTraits< T >::setDefaultTileData | ( | KisTileData * | defaultTileData | ) |
Definition at line 322 of file kis_tile_hash_table_p.h.
|
inlineprivate |
Definition at line 178 of file kis_tile_hash_table_p.h.
References KisTileData::acquire().
| bool KisTileHashTableTraits< T >::tileExists | ( | qint32 | col, |
| qint32 | row ) |
Definition at line 199 of file kis_tile_hash_table_p.h.
|
private |
The shared pointer may still be accessed by someone, so we need to disconnects the tile from memento manager explicitly
Definition at line 144 of file kis_tile_hash_table_p.h.
References KisSharedPtr< T >::clear().
|
friend |
Definition at line 106 of file kis_tile_hash_table.h.
|
private |
Definition at line 112 of file kis_tile_hash_table.h.
|
private |
Definition at line 109 of file kis_tile_hash_table.h.
|
mutableprivate |
Definition at line 115 of file kis_tile_hash_table.h.
|
private |
Definition at line 113 of file kis_tile_hash_table.h.
|
private |
Definition at line 110 of file kis_tile_hash_table.h.
|
staticprivate |
Definition at line 108 of file kis_tile_hash_table.h.