Ptex
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
PtexCacheImpl Class Reference

Ptex cache implementation. More...

#include <PtexCache.h>

Inheritance diagram for PtexCacheImpl:
PtexCache PtexReaderCache

Public Member Functions

 PtexCacheImpl (int maxFiles, int maxMem)
 
virtual void release ()
 Release resources held by this pointer (pointer becomes invalid). More...
 
void setPendingDelete ()
 
void handlePendingDelete ()
 
void setFileInUse (PtexLruItem *file)
 
void setFileUnused (PtexLruItem *file)
 
void removeFile ()
 
void setDataInUse (PtexLruItem *data, int size)
 
void setDataUnused (PtexLruItem *data, int size)
 
void removeData (int size)
 
void purgeFiles ()
 
void purgeData ()
 
- Public Member Functions inherited from PtexCache
virtual void setSearchPath (const char *path)=0
 Set a search path for finding textures. More...
 
virtual const char * getSearchPath ()=0
 Query the search path. More...
 
virtual PtexTextureget (const char *path, Ptex::String &error)=0
 Open a texture. More...
 
virtual void purge (PtexTexture *texture)=0
 Remove a texture file from the cache. More...
 
virtual void purge (const char *path)=0
 Remove a texture file from the cache by pathname. More...
 
virtual void purgeAll ()=0
 Remove all texture files from the cache. More...
 

Static Public Member Functions

static void addFile ()
 
static void addData ()
 
- Static Public Member Functions inherited from PtexCache
static PtexCachecreate (int maxFiles=0, int maxMem=0, bool premultiply=false, PtexInputHandler *handler=0)
 Create a cache with the specified limits. More...
 

Public Attributes

Mutex openlock
 
CacheLock cachelock
 

Protected Member Functions

 ~PtexCacheImpl ()
 
- Protected Member Functions inherited from PtexCache
virtual ~PtexCache ()
 Destructor not for public use. Use release() instead. More...
 

Private Attributes

bool _pendingDelete
 
int _maxFiles
 
int _unusedFileCount
 
long int _maxDataSize
 
long int _unusedDataSize
 
int _minDataCount
 
int _unusedDataCount
 
PtexLruList _unusedFiles
 
PtexLruList _unusedData
 

Detailed Description

Ptex cache implementation.

Maintains a file and memory cache within set limits

Definition at line 192 of file PtexCache.h.

Constructor & Destructor Documentation

PtexCacheImpl::PtexCacheImpl ( int  maxFiles,
int  maxMem 
)
inline

Definition at line 194 of file PtexCache.h.

PtexCacheImpl::~PtexCacheImpl ( )
protected

Definition at line 146 of file PtexCache.cpp.

References _unusedData, _unusedFiles, cachelock, and PtexLruList::pop().

Member Function Documentation

static void PtexCacheImpl::addData ( )
inlinestatic

Definition at line 227 of file PtexCache.h.

References STATS_INC.

static void PtexCacheImpl::addFile ( )
inlinestatic

Definition at line 223 of file PtexCache.h.

References STATS_INC.

void PtexCacheImpl::handlePendingDelete ( )
inline

Definition at line 220 of file PtexCache.h.

Referenced by PtexReader::release(), and PtexReader::TiledFaceBase::release().

void PtexCacheImpl::purgeData ( )
inline
void PtexCacheImpl::purgeFiles ( )
inline

Definition at line 232 of file PtexCache.h.

Referenced by PtexReaderCache::get().

virtual void PtexCacheImpl::release ( )
inlinevirtual

Release resources held by this pointer (pointer becomes invalid).

Implements PtexCache.

Definition at line 213 of file PtexCache.h.

void PtexCacheImpl::removeData ( int  size)

Definition at line 192 of file PtexCache.cpp.

References _unusedDataCount, _unusedDataSize, and STATS_INC.

void PtexCacheImpl::removeFile ( )

Definition at line 169 of file PtexCache.cpp.

References _unusedFileCount, and STATS_INC.

void PtexCacheImpl::setDataInUse ( PtexLruItem data,
int  size 
)
void PtexCacheImpl::setDataUnused ( PtexLruItem data,
int  size 
)
void PtexCacheImpl::setFileInUse ( PtexLruItem file)

Definition at line 155 of file PtexCache.cpp.

References _unusedFileCount, _unusedFiles, cachelock, and PtexLruList::extract().

void PtexCacheImpl::setFileUnused ( PtexLruItem file)

Definition at line 162 of file PtexCache.cpp.

References _unusedFileCount, _unusedFiles, cachelock, and PtexLruList::push().

void PtexCacheImpl::setPendingDelete ( )
inline

Definition at line 219 of file PtexCache.h.

Referenced by PtexReader::~PtexReader().

Member Data Documentation

long int PtexCacheImpl::_maxDataSize
private

Definition at line 258 of file PtexCache.h.

int PtexCacheImpl::_maxFiles
private

Definition at line 257 of file PtexCache.h.

int PtexCacheImpl::_minDataCount
private

Definition at line 259 of file PtexCache.h.

bool PtexCacheImpl::_pendingDelete
private

Definition at line 255 of file PtexCache.h.

PtexLruList PtexCacheImpl::_unusedData
private

Definition at line 260 of file PtexCache.h.

Referenced by setDataInUse(), setDataUnused(), and ~PtexCacheImpl().

int PtexCacheImpl::_unusedDataCount
private

Definition at line 259 of file PtexCache.h.

Referenced by removeData(), setDataInUse(), and setDataUnused().

long int PtexCacheImpl::_unusedDataSize
private

Definition at line 258 of file PtexCache.h.

Referenced by removeData(), setDataInUse(), and setDataUnused().

int PtexCacheImpl::_unusedFileCount
private

Definition at line 257 of file PtexCache.h.

Referenced by removeFile(), setFileInUse(), and setFileUnused().

PtexLruList PtexCacheImpl::_unusedFiles
private

Definition at line 260 of file PtexCache.h.

Referenced by setFileInUse(), setFileUnused(), and ~PtexCacheImpl().

CacheLock PtexCacheImpl::cachelock
Mutex PtexCacheImpl::openlock

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