HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 RE_BufferCacheKey &name, const RE_OGLBufferHandle &buf)
 Put a buffer in the cache. Will replace any buffer with the same name. More...
 
bool findBuffer (const RE_BufferCacheKey &name, RE_OGLBufferHandle &bufh)
 Return a cached buffer in 'bufh' and true, or false if not found. More...
 
void recacheBuffer (const RE_BufferCacheKey &old_name, const RE_BufferCacheKey &new_name)
 Change the key of a cached buffer. More...
 
bool moveToUsed (const RE_BufferCacheKey &name)
 Move item to the used list from unused. Returns false if not found. More...
 
bool moveToUnused (const RE_BufferCacheKey &name)
 Move item to the unused list from used. Returns false if not found. More...
 
bool removeBuffer (const RE_BufferCacheKey &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 ()
 
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 ()
 
virtual const char * utGetCacheName () const
 required - return the english name for this cache. More...
 
virtual int64 utGetCurrentSize () const
 required - return the current cache size, in bytes More...
 
virtual int64 utReduceCacheSizeBy (int64 amount)
 
virtual bool utHasMaxSize () const
 optional - override if the cache has a well defined maximum size More...
 
virtual int64 utGetMaxSize () const
 
virtual void utSetMaxSize (int64 size)
 
virtual int64 utGetMinSize () const
 

Detailed Description

Definition at line 26 of file RE_BufferCache.h.

Constructor & Destructor Documentation

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

Member Function Documentation

void RE_BufferCache::cacheBuffer ( const RE_BufferCacheKey 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 RE_BufferCacheKey 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 38 of file RE_BufferCache.h.

int64 RE_BufferCache::getMaxSizeB ( ) const
inline

Maximum cache size, in bytes.

Definition at line 32 of file RE_BufferCache.h.

bool RE_BufferCache::moveToUnused ( const RE_BufferCacheKey name)

Move item to the unused list from used. Returns false if not found.

bool RE_BufferCache::moveToUsed ( const RE_BufferCacheKey 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.

void RE_BufferCache::recacheBuffer ( const RE_BufferCacheKey old_name,
const RE_BufferCacheKey new_name 
)

Change the key of a cached buffer.

bool RE_BufferCache::removeBuffer ( const RE_BufferCacheKey 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 62 of file RE_BufferCache.h.

virtual const char* RE_BufferCache::utGetCacheName ( ) const
inlineprotectedvirtual

required - return the english name for this cache.

Implements UT_Cache.

Definition at line 83 of file RE_BufferCache.h.

virtual int64 RE_BufferCache::utGetCurrentSize ( ) const
inlineprotectedvirtual

required - return the current cache size, in bytes

Implements UT_Cache.

Definition at line 84 of file RE_BufferCache.h.

virtual int64 RE_BufferCache::utGetMaxSize ( ) const
inlineprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 88 of file RE_BufferCache.h.

virtual int64 RE_BufferCache::utGetMinSize ( ) const
inlineprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 91 of file RE_BufferCache.h.

virtual bool RE_BufferCache::utHasMaxSize ( ) const
inlineprotectedvirtual

optional - override if the cache has a well defined maximum size

Reimplemented from UT_Cache.

Definition at line 87 of file RE_BufferCache.h.

virtual int64 RE_BufferCache::utReduceCacheSizeBy ( int64  amount)
protectedvirtual

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.

virtual void RE_BufferCache::utSetMaxSize ( int64  size)
inlineprotectedvirtual

Reimplemented from UT_Cache.

Definition at line 89 of file RE_BufferCache.h.


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