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

#include <colorSpaceAPI.h>

+ Inheritance diagram for UsdColorSpaceAPI::ColorSpaceHashCache:

Public Member Functions

 ColorSpaceHashCache ()=default
 
 ~ColorSpaceHashCache ()=default
 
TfToken Find (const SdfPath &prim) override
 
void Insert (const SdfPath &prim, const TfToken &colorSpace) override
 
- Public Member Functions inherited from UsdColorSpaceAPI::ColorSpaceCache
 ColorSpaceCache ()=default
 
virtual ~ColorSpaceCache ()=default
 

Protected Attributes

TfHashMap< SdfPath, TfToken,
SdfPath::Hash
_cache
 
TfBigRWMutex _mutex
 

Detailed Description

This is a simple example of a color space cache implementation. An application can use this cache to avoid redundant color space lookups, but may substitute its own cache implementation if desired. This implementation does not track changes to the color space properties, so it is the application's responsibility to clear or update the cache when necessary.

A more sophisticated cache implementation might also be intelligent about caching locally defined color spaces and their computed GfColorSpaces. It might also be aware of changes to the scene hierarchy and update the cache accordingly.

As it is, this simple cache will be efficient in a typical scene using built in color spaces. It uses TfBigRWMutex to enable many-reader single-writer thread safety; however this example does not provide a guarantee of thread-efficiency for any given cache access pattern.

Definition at line 269 of file colorSpaceAPI.h.

Constructor & Destructor Documentation

UsdColorSpaceAPI::ColorSpaceHashCache::ColorSpaceHashCache ( )
default
UsdColorSpaceAPI::ColorSpaceHashCache::~ColorSpaceHashCache ( )
default

Member Function Documentation

TfToken UsdColorSpaceAPI::ColorSpaceHashCache::Find ( const SdfPath prim)
inlineoverridevirtual

Implements UsdColorSpaceAPI::ColorSpaceCache.

Definition at line 277 of file colorSpaceAPI.h.

void UsdColorSpaceAPI::ColorSpaceHashCache::Insert ( const SdfPath prim,
const TfToken colorSpace 
)
inlineoverridevirtual

Implements UsdColorSpaceAPI::ColorSpaceCache.

Definition at line 286 of file colorSpaceAPI.h.

Member Data Documentation

TfHashMap<SdfPath, TfToken, SdfPath::Hash> UsdColorSpaceAPI::ColorSpaceHashCache::_cache
protected

Definition at line 271 of file colorSpaceAPI.h.

TfBigRWMutex UsdColorSpaceAPI::ColorSpaceHashCache::_mutex
mutableprotected

Definition at line 272 of file colorSpaceAPI.h.


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