HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_BufferCache Class Reference

#include <RE_BufferCache.h>

+ Inheritance diagram for RE_BufferCache:

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_Cacheoperator= (const UT_Cache &)=delete
 
void utClearCache ()
 
virtual bool utHasMinSize () const
 
virtual void utSetMinSize (int64)
 
virtual bool utUpdateCacheInfo ()
 

Static Public Member Functions

static RE_BufferCachegetCache ()
 
- 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
 

Detailed Description

Definition at line 25 of file RE_BufferCache.h.

Constructor & Destructor Documentation

RE_BufferCache::RE_BufferCache ( int64  maxsize)
protected
RE_BufferCache::~RE_BufferCache ( )
overrideprotected

Member Function Documentation

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 RE_BufferCache* RE_BufferCache::getCache ( )
static
int64 RE_BufferCache::getCurSizeB ( ) const
inline

Current cache size, in bytes.

Definition at line 41 of file RE_BufferCache.h.

int64 RE_BufferCache::getMaxSizeB ( ) const
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.

void RE_BufferCache::setMaxSizeB ( int64  maxsize)

Set the maximum size of the cache, in bytes.

void RE_BufferCache::updateBufferSize ( int64  delta_size)
inline

call if a cached buffer changes size, with the change in size.

Definition at line 61 of file RE_BufferCache.h.

const char* RE_BufferCache::utGetCacheName ( ) const
inlineoverrideprotectedvirtual

required - return the english name for this cache.

Implements UT_Cache.

Definition at line 82 of file RE_BufferCache.h.

int64 RE_BufferCache::utGetCurrentSize ( ) const
inlineoverrideprotectedvirtual

required - return the current cache size, in bytes

Implements UT_Cache.

Definition at line 84 of file RE_BufferCache.h.

int64 RE_BufferCache::utGetMaxSize ( ) const
inlineoverrideprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 88 of file RE_BufferCache.h.

int64 RE_BufferCache::utGetMinSize ( ) const
inlineoverrideprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 91 of file RE_BufferCache.h.

bool RE_BufferCache::utHasMaxSize ( ) const
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.

int64 RE_BufferCache::utReduceCacheSizeBy ( int64  amount)
overrideprotectedvirtual

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.

void RE_BufferCache::utSetMaxSize ( int64  size)
inlineoverrideprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 89 of file RE_BufferCache.h.


The documentation for this class was generated from the following file: