#5031 Summary Data Cache : Remove static set of instances

This commit is contained in:
Magne Sjaastad 2019-11-12 17:47:41 +01:00
parent 2c115278ab
commit e7edb34404
3 changed files with 4 additions and 35 deletions

View File

@ -84,5 +84,4 @@ void RicSummaryCurveCreatorDialog::slotDialogFinished()
{
plotwindow->cleanUpTemporaryWidgets();
}
RifReaderEclipseSummary::purgeCache();
}

View File

@ -570,14 +570,6 @@ void RifReaderEclipseSummary::markForCachePurge( const RifEclipseSummaryAddress&
m_valuesCache->markAddressForPurge( address );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseSummary::purgeCache()
{
ValuesCache::purge();
}
#if 0
//--------------------------------------------------------------------------------------------------
///
@ -597,26 +589,17 @@ void RifReaderEclipseSummary::populateVectorFromStringList(stringlist_type* stri
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double> RifReaderEclipseSummary::ValuesCache::EMPTY_VECTOR;
std::set<RifReaderEclipseSummary::ValuesCache*> RifReaderEclipseSummary::ValuesCache::m_instances;
const std::vector<double> RifReaderEclipseSummary::ValuesCache::EMPTY_VECTOR;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary::ValuesCache::ValuesCache()
{
// Register instance
m_instances.insert( this );
}
RifReaderEclipseSummary::ValuesCache::ValuesCache() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary::ValuesCache::~ValuesCache()
{
// Deregister instance
m_instances.erase( this );
}
RifReaderEclipseSummary::ValuesCache::~ValuesCache() {}
//--------------------------------------------------------------------------------------------------
///
@ -648,15 +631,6 @@ void RifReaderEclipseSummary::ValuesCache::markAddressForPurge( const RifEclipse
m_purgeList.insert( address );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseSummary::ValuesCache::purge()
{
for ( auto instance : m_instances )
instance->purgeData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -84,8 +84,7 @@ public:
return m_warnings;
}
void markForCachePurge( const RifEclipseSummaryAddress& address ) override;
static void purgeCache();
void markForCachePurge( const RifEclipseSummaryAddress& address ) override;
private:
int timeStepCount() const;
@ -122,15 +121,12 @@ private:
void insertValues( const RifEclipseSummaryAddress& address, const std::vector<double>& values );
const std::vector<double>& getValues( const RifEclipseSummaryAddress& address ) const;
void markAddressForPurge( const RifEclipseSummaryAddress& address );
static void purge();
private:
void purgeData();
std::map<const RifEclipseSummaryAddress, std::vector<double>> m_cachedValues;
std::set<RifEclipseSummaryAddress> m_purgeList;
static std::set<ValuesCache*> m_instances;
};
std::unique_ptr<ValuesCache> m_valuesCache;