Audacity 3.2.0
|
#include <GraphicsDataCache.h>
Public Types | |
using | ElementFactory = std::function< std::unique_ptr< CacheElementType >()> |
using | Initializer = std::function< bool(const GraphicsDataCacheKey &Key, CacheElementType &element)> |
Public Member Functions | |
GraphicsDataCache (const GraphicsDataCache &)=delete | |
GraphicsDataCache & | operator= (const GraphicsDataCache &)=delete |
GraphicsDataCache (double scaledSampleRate, ElementFactory elementFactory) | |
~GraphicsDataCache () override | |
IteratorRange< GraphicsDataCacheIterator< CacheElementType > > | PerformLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
const CacheElementType * | PerformLookup (GraphicsDataCacheKey key) |
void | setInitializer (Initializer initializer) |
Public Member Functions inherited from GraphicsDataCacheBase | |
virtual | ~GraphicsDataCacheBase ()=default |
void | Invalidate () |
Invalidate the cache content. More... | |
double | GetScaledSampleRate () const noexcept |
Returns the sample rate associated with cache. More... | |
void | UpdateViewportWidth (int64_t width) noexcept |
int64_t | GetMaxViewportWidth () const noexcept |
Protected Member Functions | |
virtual void | CheckCache (const ZoomInfo &, double, double) |
virtual bool | InitializeElement (const GraphicsDataCacheKey &key, CacheElementType &element) |
Protected Member Functions inherited from GraphicsDataCacheBase | |
GraphicsDataCacheBase (double scaledSampleRate) | |
void | SetScaledSampleRate (double scaledSampleRate) |
virtual GraphicsDataCacheElementBase * | CreateElement (const GraphicsDataCacheKey &key)=0 |
Create a new Cache element. Implementation is responsible of the lifetime control. More... | |
virtual void | DisposeElement (GraphicsDataCacheElementBase *element)=0 |
This method is called, when the cache element should be evicted. Implementation may not deallocate the object. More... | |
virtual bool | UpdateElement (const GraphicsDataCacheKey &key, GraphicsDataCacheElementBase &element)=0 |
This method is called on all elements matching the request that are not complete (i. e. IsComplete if false). More... | |
BaseLookupResult | PerformBaseLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
Perform a lookup inside the cache. This method modifies mLookup and invalidates any previous result. More... | |
const GraphicsDataCacheElementBase * | PerformBaseLookup (GraphicsDataCacheKey key) |
Perform a lookup for the given key. This method modifies mLookup and invalidates any previous result. More... | |
Private Member Functions | |
GraphicsDataCacheElementBase * | CreateElement (const GraphicsDataCacheKey &key) override |
Create a new Cache element. Implementation is responsible of the lifetime control. More... | |
void | DisposeElement (GraphicsDataCacheElementBase *element) override |
This method is called, when the cache element should be evicted. Implementation may not deallocate the object. More... | |
bool | UpdateElement (const GraphicsDataCacheKey &key, GraphicsDataCacheElementBase &element) override |
This method is called on all elements matching the request that are not complete (i. e. IsComplete if false). More... | |
Private Attributes | |
Initializer | mInitializer |
ElementFactory | mElementFactory |
std::deque< std::unique_ptr< CacheElementType > > | mCache |
std::vector< CacheElementType * > | mFreeList |
Additional Inherited Members | |
Static Public Attributes inherited from GraphicsDataCacheBase | |
static constexpr uint32_t | CacheElementWidth = 256 |
Protected Types inherited from GraphicsDataCacheBase | |
using | Lookup = std::vector< LookupElement > |
Cache lookup is a vector, with items sorted using Key. More... | |
Definition at line 231 of file GraphicsDataCache.h.
using GraphicsDataCache< CacheElementType >::ElementFactory = std::function<std::unique_ptr<CacheElementType>()> |
Definition at line 234 of file GraphicsDataCache.h.
using GraphicsDataCache< CacheElementType >::Initializer = std::function<bool(const GraphicsDataCacheKey& Key, CacheElementType& element)> |
Definition at line 239 of file GraphicsDataCache.h.
|
delete |
|
inlineexplicit |
Definition at line 241 of file GraphicsDataCache.h.
|
inlineoverride |
Definition at line 246 of file GraphicsDataCache.h.
References GraphicsDataCacheBase::Invalidate().
|
inlineprotectedvirtual |
Reimplemented in WaveBitmapCache.
Definition at line 273 of file GraphicsDataCache.h.
Referenced by GraphicsDataCache< CacheElementType >::PerformLookup().
|
inlineoverrideprivatevirtual |
Create a new Cache element. Implementation is responsible of the lifetime control.
Implements GraphicsDataCacheBase.
Definition at line 299 of file GraphicsDataCache.h.
References GraphicsDataCache< CacheElementType >::DisposeElement(), GraphicsDataCache< CacheElementType >::InitializeElement(), key, GraphicsDataCache< CacheElementType >::mCache, GraphicsDataCache< CacheElementType >::mElementFactory, GraphicsDataCache< CacheElementType >::mFreeList, and GraphicsDataCache< CacheElementType >::mInitializer.
|
inlineoverrideprivatevirtual |
This method is called, when the cache element should be evicted. Implementation may not deallocate the object.
Implements GraphicsDataCacheBase.
Definition at line 335 of file GraphicsDataCache.h.
References GraphicsDataCacheElementBase::Dispose(), and GraphicsDataCache< CacheElementType >::mFreeList.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement().
|
inlineprotectedvirtual |
Reimplemented in WaveBitmapCache, and WaveDataCache.
Definition at line 278 of file GraphicsDataCache.h.
References key.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement(), and GraphicsDataCache< CacheElementType >::UpdateElement().
|
delete |
|
inline |
Definition at line 252 of file GraphicsDataCache.h.
References GraphicsDataCache< CacheElementType >::CheckCache(), and GraphicsDataCacheBase::PerformBaseLookup().
Referenced by anonymous_namespace{GraphicsDataCacheTests.cpp}::CheckCacheElementLookup().
|
inline |
Definition at line 261 of file GraphicsDataCache.h.
References key, and GraphicsDataCacheBase::PerformBaseLookup().
|
inline |
Definition at line 266 of file GraphicsDataCache.h.
References Journal::Events::anonymous_namespace{JournalEvents.cpp}::initializer, and GraphicsDataCache< CacheElementType >::mInitializer.
|
inlineoverrideprivatevirtual |
This method is called on all elements matching the request that are not complete (i. e. IsComplete if false).
Implements GraphicsDataCacheBase.
Definition at line 345 of file GraphicsDataCache.h.
References GraphicsDataCache< CacheElementType >::InitializeElement(), and key.
|
private |
Definition at line 355 of file GraphicsDataCache.h.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement().
|
private |
Definition at line 354 of file GraphicsDataCache.h.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement().
|
private |
Definition at line 356 of file GraphicsDataCache.h.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement(), and GraphicsDataCache< CacheElementType >::DisposeElement().
|
private |
Definition at line 352 of file GraphicsDataCache.h.
Referenced by GraphicsDataCache< CacheElementType >::CreateElement(), and GraphicsDataCache< CacheElementType >::setInitializer().