HDK
|
#include <RE_BufferCache.h>
Public Member Functions | |
int64 | getMaxSizeB () const |
Maximum cache size, in bytes. More... | |
void | setMaxSizeB (int64 maxsize) |
Set the maximum size of the cache, in bytes. More... | |
int64 | getCurSizeB () const |
Current cache size, in bytes. More... | |
void | cacheBuffer (const UT_StringHolder &name, const RE_OGLBufferHandle &buf) |
Put a buffer in the cache. Will replace any buffer with the same name. More... | |
bool | findBuffer (const UT_StringRef &name, RE_OGLBufferHandle &bufh) |
Return a cached buffer in 'bufh' and true, or false if not found. More... | |
bool | moveToUsed (const UT_StringRef &name) |
Move item to the used list from unused. Returns false if not found. More... | |
bool | moveToUnused (const UT_StringRef &name) |
Move item to the unused list from used. Returns false if not found. More... | |
bool | removeBuffer (const UT_StringRef &name) |
Remove a buffer from the cache. Returns true if it existed in the cache. More... | |
void | updateBufferSize (int64 delta_size) |
call if a cached buffer changes size, with the change in size. More... | |
void | pruneCache () |
void | pruneUnusedBuffers () |
Explicitly prune all unused buffer. More... | |
void | dumpCache () |
Debug dump of the cache contents. More... | |
Public Member Functions inherited from UT_Cache | |
UT_Cache () | |
virtual | ~UT_Cache () |
UT_Cache (const UT_Cache &)=delete | |
UT_Cache & | operator= (const UT_Cache &)=delete |
void | utClearCache () |
virtual bool | utHasMinSize () const |
virtual void | utSetMinSize (int64) |
virtual bool | utUpdateCacheInfo () |
Static Public Member Functions | |
static RE_BufferCache * | getCache () |
Static Public Member Functions inherited from UT_Cache | |
static const UT_ValArray < UT_Cache * > & | utGetCacheList () |
get the list of caches More... | |
static void | setCacheAddRemoveCB (void(*callback)(void *), void *data) |
callback to be called when a cache is added or deleted. More... | |
static int64 | utClearSpaceFromCaches (int64 amount) |
this method attempts to free up 'amount' bytes from all the caches. More... | |
Protected Member Functions | |
RE_BufferCache (int64 maxsize) | |
~RE_BufferCache () override | |
const char * | utGetCacheName () const override |
required - return the english name for this cache. More... | |
int64 | utGetCurrentSize () const override |
required - return the current cache size, in bytes More... | |
int64 | utReduceCacheSizeBy (int64 amount) override |
bool | utHasMaxSize () const override |
optional - override if the cache has a well defined maximum size More... | |
int64 | utGetMaxSize () const override |
void | utSetMaxSize (int64 size) override |
int64 | utGetMinSize () const override |
Definition at line 25 of file RE_BufferCache.h.
|
protected |
|
overrideprotected |
void RE_BufferCache::cacheBuffer | ( | const UT_StringHolder & | name, |
const RE_OGLBufferHandle & | buf | ||
) |
Put a buffer in the cache. Will replace any buffer with the same name.
void RE_BufferCache::dumpCache | ( | ) |
Debug dump of the cache contents.
bool RE_BufferCache::findBuffer | ( | const UT_StringRef & | name, |
RE_OGLBufferHandle & | bufh | ||
) |
Return a cached buffer in 'bufh' and true, or false if not found.
|
static |
|
inline |
Current cache size, in bytes.
Definition at line 41 of file RE_BufferCache.h.
|
inline |
Maximum cache size, in bytes.
Definition at line 35 of file RE_BufferCache.h.
bool RE_BufferCache::moveToUnused | ( | const UT_StringRef & | name | ) |
Move item to the unused list from used. Returns false if not found.
bool RE_BufferCache::moveToUsed | ( | const UT_StringRef & | name | ) |
Move item to the used list from unused. Returns false if not found.
void RE_BufferCache::pruneCache | ( | ) |
Explicitly prune the cache if beyond its max size. This does not happen automatically.
void RE_BufferCache::pruneUnusedBuffers | ( | ) |
Explicitly prune all unused buffer.
bool RE_BufferCache::removeBuffer | ( | const UT_StringRef & | name | ) |
Remove a buffer from the cache. Returns true if it existed in the cache.
call if a cached buffer changes size, with the change in size.
Definition at line 61 of file RE_BufferCache.h.
|
inlineoverrideprotectedvirtual |
required - return the english name for this cache.
Implements UT_Cache.
Definition at line 82 of file RE_BufferCache.h.
|
inlineoverrideprotectedvirtual |
required - return the current cache size, in bytes
Implements UT_Cache.
Definition at line 84 of file RE_BufferCache.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from UT_Cache.
Definition at line 88 of file RE_BufferCache.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from UT_Cache.
Definition at line 91 of file RE_BufferCache.h.
|
inlineoverrideprotectedvirtual |
optional - override if the cache has a well defined maximum size
Reimplemented from UT_Cache.
Definition at line 87 of file RE_BufferCache.h.
required - free contents of the cache by amount
bytes. Returns the amount of memory (in bytes) actually freed. This does not change the cache size
Implements UT_Cache.
Reimplemented from UT_Cache.
Definition at line 89 of file RE_BufferCache.h.