PtexCachedReader Class Reference

`#include <PtexCache.h>`

Inheritance diagram for PtexCachedReader:

## Public Member Functions

| PtexCachedReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler, PtexReaderCache *cache)
| ~PtexCachedReader ()
void | ref ()
int32_t | unref ()
virtual void | release ()
| Release resources held by this pointer (pointer becomes invalid).
bool | tryPrune (size_t &memUsedChange)
bool | tryPurge (size_t &memUsedChange)
size_t | getMemUsedChange ()
size_t | getOpensChange ()
size_t | getBlockReadsChange ()
Public Member Functions inherited from PtexReader
| PtexReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler)
virtual | ~PtexReader ()
bool | needToOpen () const
bool | open (const char *path, Ptex::String &error)
void | prune ()
void | purge ()
void | setPendingPurge ()
bool | pendingPurge () const
bool | tryClose ()
bool | ok () const
bool | isOpen ()
void | invalidate ()
void | increaseMemUsed (size_t amount)
void | logOpen ()
void | logBlockRead ()
virtual const char * | path ()
| Path that file was opened with.
virtual Info | getInfo ()
virtual Ptex::MeshType | meshType ()
| Type of mesh for which texture data is defined.
virtual Ptex::DataType | dataType ()
| Type of data stored in file.
virtual Ptex::BorderMode | uBorderMode ()
| Mode for filtering texture access beyond mesh border.
virtual Ptex::BorderMode | vBorderMode ()
| Mode for filtering texture access beyond mesh border.
virtual Ptex::EdgeFilterMode | edgeFilterMode ()
| Mode for filtering textures across edges.
virtual int | alphaChannel ()
| Index of alpha channel (if any).
virtual int | numChannels ()
| Number of channels stored in file.
virtual int | numFaces ()
| Number of faces stored in file.
virtual bool | hasEdits ()
| True if the file has edit blocks.
virtual bool | hasMipMaps ()
| True if the file has mipmaps.
virtual PtexMetaData * | getMetaData ()
| Access meta data.
virtual const Ptex::FaceInfo & | getFaceInfo (int faceid)
| Access resolution and adjacency information about a face.
virtual void | getData (int faceid, void *buffer, int stride)
| Access texture data for a face at highest-resolution.
virtual void | getData (int faceid, void *buffer, int stride, Res res)
virtual PtexFaceData * | getData (int faceid)
| Access texture data for a face at highest-resolution as stored on disk.
virtual PtexFaceData * | getData (int faceid, Res res)
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels)
| Access a single texel from the highest resolution texture .
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels, Ptex::Res res)
| Access a single texel for a face at a particular resolution.
DataType | datatype () const
int | nchannels () const
int | pixelsize () const
const Header & | header () const
const ExtHeader & | extheader () const
const LevelInfo & | levelinfo (int level) const
Public Member Functions inherited from PtexTexture
virtual void | getData (int faceid, void *buffer, int stride, Ptex::Res res)=0
| Access texture data for a face at a specific resolution.
virtual PtexFaceData * | getData (int faceid, Ptex::Res res)=0
| Access texture data for a face at a specific resolution as stored on disk.

## Private Member Functions

bool | trylock ()
void | unlock ()

## Private Attributes

PtexReaderCache * | _cache
volatile int32_t | _refCount
size_t | _memUsedAccountedFor
size_t | _opensAccountedFor
size_t | _blockReadsAccountedFor
PtexLruItem | _openFilesItem
PtexLruItem | _activeFilesItem

## Friends

class | PtexReaderCache

## Additional Inherited Members

Static Public Member Functions inherited from PtexTexture
static PtexTexture * | open (const char *path, Ptex::String &error, bool premultiply=0)
| Open a ptex file for reading.
Protected Types inherited from PtexReader
typedef PtexHashMap< ReductionKey, FaceData * > | ReductionMap
Protected Member Functions inherited from PtexReader
void | setError (const char *error)
FilePos | tell ()
void | seek (FilePos pos)
void | closeFP ()
bool | reopenFP ()
bool | readBlock (void *data, int size, bool reportError=true)
bool | readZipBlock (void *data, int zipsize, int unzipsize)
Level * | getLevel (int levelid)
uint8_t * | getConstData ()
FaceData * | getFace (int levelid, Level *level, int faceid, Res res)
void | readFaceInfo ()
void | readLevelInfo ()
void | readConstData ()
void | readLevel (int levelid, Level *&level)
void | readFace (int levelid, Level *level, int faceid, Res res)
void | readFaceData (FilePos pos, FaceDataHeader fdh, Res res, int levelid, FaceData *&face)
void | readMetaData ()
void | readMetaDataBlock (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
void | readLargeMetaDataHeaders (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
void | readEditData ()
void | readEditFaceData ()
void | readEditMetaData ()
FaceData * | errorData (bool deleteOnRelease=false)
void | computeOffsets (FilePos pos, int noffsets, const FaceDataHeader *fdh, FilePos *offsets)
Protected Member Functions inherited from PtexTexture
virtual | ~PtexTexture ()
| Destructor not for public use. Use release() instead.
Protected Attributes inherited from PtexReader
Mutex | readlock
DefaultInputHandler | _defaultIo
PtexInputHandler * | _io
PtexErrorHandler * | _err
bool | _premultiply
bool | _ok
bool | _needToOpen
bool | _pendingPurge
PtexInputHandler::Handle | _fp
FilePos | _pos
std::string | _path
Header | _header
ExtHeader | _extheader
FilePos | _faceinfopos
FilePos | _constdatapos
FilePos | _levelinfopos
FilePos | _leveldatapos
FilePos | _metadatapos
FilePos | _lmdheaderpos
FilePos | _lmddatapos
FilePos | _editdatapos
int | _pixelsize
uint8_t * | _constdata
MetaData * | _metadata
bool | _hasEdits
std::vector< FaceInfo > | _faceinfo
std::vector< uint32_t > | _rfaceids
std::vector< LevelInfo > | _levelinfo
std::vector< FilePos > | _levelpos
std::vector< Level * > | _levels
std::vector< MetaEdit > | _metaedits
std::vector< FaceEdit > | _faceedits
ReductionMap | _reductions
std::vector< char > | _errorPixel
z_stream_s | _zstream
size_t | _baseMemUsed
volatile size_t | _memUsed
volatile size_t | _opens
volatile size_t | _blockReads

## Detailed Description

Definition at line 108 of file PtexCache.h.

## Constructor & Destructor Documentation

## PtexCachedReader()

PtexCachedReader::PtexCachedReader | ( | bool | premultiply,
|  | PtexInputHandler * | inputHandler,
|  | PtexErrorHandler * | errorHandler,
|  | PtexReaderCache * | cache
| ) |  |

inline

Definition at line 130 of file PtexCache.h.

## ~PtexCachedReader()

PtexCachedReader::~PtexCachedReader | ( |  | ) |

inline

Definition at line 136 of file PtexCache.h.

## Member Function Documentation

## getBlockReadsChange()

size_t PtexCachedReader::getBlockReadsChange | ( |  | ) |

inline

Definition at line 187 of file PtexCache.h.

References PtexReader::_blockReads, and _blockReadsAccountedFor.

Referenced by PtexReaderCache::processMru().

## getMemUsedChange()

size_t PtexCachedReader::getMemUsedChange | ( |  | ) |

inline

Definition at line 173 of file PtexCache.h.

References PtexReader::_memUsed, and _memUsedAccountedFor.

Referenced by PtexReaderCache::processMru(), tryPrune(), and tryPurge().

## getOpensChange()

size_t PtexCachedReader::getOpensChange | ( |  | ) |

inline

Definition at line 180 of file PtexCache.h.

References PtexReader::_opens, and _opensAccountedFor.

Referenced by PtexReaderCache::processMru().

## ref()

void PtexCachedReader::ref | ( |  | ) |

inline

Definition at line 138 of file PtexCache.h.

References _refCount, and AtomicCompareAndSwap().

Referenced by PtexReaderCache::get(), and PtexReaderCache::purge().

## release()

PTEX_NAMESPACE_BEGIN void PtexCachedReader::release | ( |  | ) |

virtual

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

Reimplemented from PtexReader.

Definition at line 83 of file PtexCache.cpp.

References _cache, PtexReaderCache::logRecentlyUsed(), and unref().

## trylock()

bool PtexCachedReader::trylock | ( |  | ) |

inlineprivate

Definition at line 119 of file PtexCache.h.

References _refCount, and AtomicCompareAndSwap().

Referenced by tryPrune(), and tryPurge().

## tryPrune()

bool PtexCachedReader::tryPrune | ( | size_t & | memUsedChange | ) |

inline

Definition at line 152 of file PtexCache.h.

References getMemUsedChange(), PtexReader::prune(), trylock(), and unlock().

Referenced by PtexReaderCache::pruneData().

## tryPurge()

bool PtexCachedReader::tryPurge | ( | size_t & | memUsedChange | ) |

inline

Definition at line 162 of file PtexCache.h.

References getMemUsedChange(), PtexReader::purge(), PtexReader::setPendingPurge(), trylock(), and unlock().

Referenced by PtexReaderCache::Purger::operator()(), and PtexReaderCache::purge().

## unlock()

void PtexCachedReader::unlock | ( |  | ) |

inlineprivate

Definition at line 124 of file PtexCache.h.

References _refCount, and AtomicStore().

Referenced by tryPrune(), and tryPurge().

## unref()

int32_t PtexCachedReader::unref | ( |  | ) |

inline

Definition at line 146 of file PtexCache.h.

References _refCount, and AtomicDecrement().

Referenced by PtexReaderCache::get(), PtexReaderCache::purge(), and release().

## Friends And Related Symbol Documentation

## PtexReaderCache

friend class PtexReaderCache

friend

Definition at line 117 of file PtexCache.h.

## Member Data Documentation

## _activeFilesItem

PtexLruItem PtexCachedReader::_activeFilesItem

private

Definition at line 116 of file PtexCache.h.

## _blockReadsAccountedFor

size_t PtexCachedReader::_blockReadsAccountedFor

private

Definition at line 114 of file PtexCache.h.

Referenced by getBlockReadsChange().

## _cache

PtexReaderCache* PtexCachedReader::_cache

private

Definition at line 110 of file PtexCache.h.

Referenced by release().

## _memUsedAccountedFor

size_t PtexCachedReader::_memUsedAccountedFor

private

Definition at line 112 of file PtexCache.h.

Referenced by getMemUsedChange().

## _openFilesItem

PtexLruItem PtexCachedReader::_openFilesItem

private

Definition at line 115 of file PtexCache.h.

## _opensAccountedFor

size_t PtexCachedReader::_opensAccountedFor

private

Definition at line 113 of file PtexCache.h.

Referenced by getOpensChange().

## _refCount

volatile int32_t PtexCachedReader::_refCount

private

Definition at line 111 of file PtexCache.h.

Referenced by ref(), trylock(), unlock(), and unref().

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

- PtexCache.h
- PtexCache.cpp