HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArThreadLocalScopedCache< CachedType > Class Template Reference

#include <threadLocalScopedCache.h>

Public Types

using CachePtr = std::shared_ptr< CachedType >
 

Public Member Functions

void BeginCacheScope (VtValue *cacheScopeData)
 
void EndCacheScope (VtValue *cacheScopeData)
 
CachePtr GetCurrentCache ()
 

Detailed Description

template<class CachedType>
class ArThreadLocalScopedCache< CachedType >

Utility class for custom resolver implementations. This class wraps up a common pattern for implementing thread-local scoped caches for ArResolver::BeginCacheScope and ArResolver::EndCacheScope.

class MyResolver : public ArResolver {
using ResolveCache = ArThreadLocalScopedCache<...>;
ResolveCache _cache;
void BeginCacheScope(VtValue* data) { _cache.BeginCacheScope(data); }
void EndCacheScope(VtValue* data) { _cache.EndCacheScope(data); }
void Resolve(...) {
// If caching is active in this thread, retrieve the current
// cache and use it to lookup/store values.
if (ResolveCache::CachePtr cache = _cache.GetCurrentCache()) {
// ...
}
// Otherwise, caching is not active
// ...
}
};
See Also
Scoped Resolution Cache

Definition at line 66 of file threadLocalScopedCache.h.

Member Typedef Documentation

template<class CachedType>
using ArThreadLocalScopedCache< CachedType >::CachePtr = std::shared_ptr<CachedType>

Definition at line 69 of file threadLocalScopedCache.h.

Member Function Documentation

template<class CachedType>
void ArThreadLocalScopedCache< CachedType >::BeginCacheScope ( VtValue cacheScopeData)
inline

Definition at line 71 of file threadLocalScopedCache.h.

template<class CachedType>
void ArThreadLocalScopedCache< CachedType >::EndCacheScope ( VtValue cacheScopeData)
inline

Definition at line 98 of file threadLocalScopedCache.h.

template<class CachedType>
CachePtr ArThreadLocalScopedCache< CachedType >::GetCurrentCache ( )
inline

Definition at line 106 of file threadLocalScopedCache.h.


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