Go to the documentation of this file.
74 if (
_next ==
this)
return 0;
82 template<
class T, PtexLruItem T::*item>
100 static const T* dummy = 0;
101 static const std::ptrdiff_t itemOffset = (
const char*)&(dummy->*item) - (
const char*)dummy;
102 return it ? (T*) ((
char*)it - itemOffset) : 0;
225 const char* cp = path;
227 const char* delim = strchr(cp,
':');
232 int len = int(delim-cp);
233 if (len)
_searchdirs.push_back(std::string(cp, len));
247 virtual void purge(
const char* );
249 virtual void getStats(Stats& stats);
PtexLruItem _activeFilesItem
virtual const char * getSearchPath()
Query the search path.
virtual void getStats(Stats &stats)
Get stats.
virtual void release()
Release PtexCache. Cache will be immediately destroyed and all resources will be released.
void adjustMemUsed(size_t amount)
PtexLruList< PtexCachedReader, &PtexCachedReader::_activeFilesItem > _activeFiles
#define PTEX_NAMESPACE_END
File-handle and memory cache for reading ptex files.
PtexCachedReader *volatile files[numMruFiles]
PtexLruList< PtexCachedReader, &PtexCachedReader::_openFilesItem > _openFiles
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
bool tryPrune(size_t &memUsedChange)
virtual void purgeAll()
Remove all texture files from the cache.
size_t _opensAccountedFor
Custom handler interface redirecting Ptex error messages.
MruList *volatile _prevMruList
volatile int32_t _refCount
size_t getMemUsedChange()
size_t getBlockReadsChange()
void operator()(PtexCachedReader *reader)
void push(PtexLruItem *item)
volatile size_t _blockReads
PtexReaderCache(int maxFiles, size_t maxMem, bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler)
Cache for reading Ptex texture files.
PtexHashMap< StringKey, PtexCachedReader * > FileMap
virtual PtexTexture * get(const char *path, Ptex::String &error)
Access a texture.
std::vector< std::string > _searchdirs
CACHE_LINE_PAD(_mruLock, Mutex)
void logRecentlyUsed(PtexCachedReader *reader)
Interface for reading data from a ptex file.
MruList *volatile _mruList
size_t memUsedChangeTotal
volatile size_t _filesOpen
PtexCachedReader(bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler, PtexReaderCache *cache)
virtual void setSearchPath(const char *path)
Set a search path for finding textures.
CACHE_LINE_PAD(_filesOpen, size_t)
void adjustFilesOpen(size_t amount)
PtexLruItem _openFilesItem
Contains PtexHashMap, a lightweight multi-threaded hash table.
bool findFile(const char *&filename, std::string &buffer, Ptex::String &error)
size_t _memUsedAccountedFor
size_t _blockReadsAccountedFor
bool tryPurge(size_t &memUsedChange)
virtual void purge(PtexTexture *)
Remove a texture file from the cache.
CACHE_LINE_PAD(_memUsed, size_t)
static const int numMruFiles