Skip to content
Permalink
Browse files
VLCache takes ownership of index
  • Loading branch information
m-kuhn authored and Matthias Kuhn committed May 20, 2014
1 parent 73d69f2 commit edbfb57ca179a014c0f521684e98b1d88da8253a
Showing with 11 additions and 1 deletion.
  1. +7 −1 src/core/qgsvectorlayercache.cpp
  2. +4 −0 src/core/qgsvectorlayercache.h
@@ -39,6 +39,12 @@ QgsVectorLayerCache::QgsVectorLayerCache( QgsVectorLayer* layer, int cacheSize,
connect( mLayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ), SLOT( onAttributeValueChanged( QgsFeatureId, int, const QVariant& ) ) );
}

QgsVectorLayerCache::~QgsVectorLayerCache()
{
qDeleteAll( mCacheIndices );
mCacheIndices.clear();
}

void QgsVectorLayerCache::setCacheSize( int cacheSize )
{
mCache.setMaxCost( cacheSize );
@@ -178,7 +184,7 @@ void QgsVectorLayerCache::requestCompleted( QgsFeatureRequest featureRequest, Qg

void QgsVectorLayerCache::featureRemoved( QgsFeatureId fid )
{
foreach ( QgsAbstractCacheIndex* idx, mCacheIndices )
Q_FOREACH( QgsAbstractCacheIndex* idx, mCacheIndices )
{
idx->flushFeature( fid );
}
@@ -86,6 +86,9 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject
*
* @param cacheSize indicates the maximum number of features to keep in the cache
*/

~QgsVectorLayerCache();

void setCacheSize( int cacheSize );

/**
@@ -136,6 +139,7 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject
* @brief
* Adds a {@link QgsAbstractCacheIndex} to this cache. Cache indices know about features present
* in this cache and decide, if enough information is present in the cache to respond to a {@link QgsFeatureRequest}.
* The layer cache will take ownership of the index.
*
* @param cacheIndex The cache index to add.
*/

0 comments on commit edbfb57

Please sign in to comment.