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

Utility class for custom resolver implementations. More...

#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
// ...
}
};
Interface for the asset resolution system.
Definition: resolver.h:43
Utility class for custom resolver implementations.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
See also
Scoped Resolution Cache

Definition at line 49 of file threadLocalScopedCache.h.

Member Typedef Documentation

◆ CachePtr

using CachePtr = std::shared_ptr<CachedType>

Definition at line 52 of file threadLocalScopedCache.h.

Member Function Documentation

◆ BeginCacheScope()

void BeginCacheScope ( VtValue cacheScopeData)
inline

Definition at line 54 of file threadLocalScopedCache.h.

◆ EndCacheScope()

void EndCacheScope ( VtValue cacheScopeData)
inline

Definition at line 81 of file threadLocalScopedCache.h.

◆ GetCurrentCache()

CachePtr GetCurrentCache ( )
inline

Definition at line 89 of file threadLocalScopedCache.h.


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