25#ifndef OPENSUBDIV3_BFR_SURFACE_FACTORY_CACHE_H
26#define OPENSUBDIV3_BFR_SURFACE_FACTORY_CACHE_H
28#include "../version.h"
30#include "../bfr/irregularPatchType.h"
36namespace OPENSUBDIV_VERSION {
72 typedef std::uint64_t KeyType;
73 typedef internal::IrregularPatchSharedPtr DataType;
78 size_t Size()
const {
return _map.size(); }
83 virtual DataType Find(KeyType
const & key)
const;
84 virtual DataType Add(KeyType
const & key, DataType
const & data);
89 DataType find(KeyType
const & key)
const;
90 DataType add(KeyType
const & key, DataType
const & data);
94 typedef std::map<KeyType, DataType> MapType;
116template <
class MUTEX_TYPE,
class READ_LOCK_GUARD_TYPE,
117 class WRITE_LOCK_GUARD_TYPE>
128 DataType Find(KeyType
const & key)
const override {
129 READ_LOCK_GUARD_TYPE lockGuard(_mutex);
133 DataType Add(KeyType
const & key, DataType
const & data)
override {
134 WRITE_LOCK_GUARD_TYPE lockGuard(_mutex);
135 return add(key, data);
140 MUTEX_TYPE
mutable _mutex;
146using namespace OPENSUBDIV_VERSION;
Base class providing initialization of a Surface for each face of a mesh.
Container used internally by SurfaceFactory to store reusable information.
virtual ~SurfaceFactoryCache()
SurfaceFactoryCache(SurfaceFactoryCache const &)=delete
SurfaceFactoryCache & operator=(SurfaceFactoryCache const &)=delete
Template for declaring thread-safe subclasses of SurfaceFactoryCache.
SurfaceFactoryCacheThreaded()
~SurfaceFactoryCacheThreaded() override=default