7#ifndef PXR_EXEC_EF_OUTPUT_VALUE_CACHE_H
8#define PXR_EXEC_EF_OUTPUT_VALUE_CACHE_H
14#include "pxr/exec/ef/api.h"
16#include "pxr/base/tf/bits.h"
18#include "pxr/base/tf/hashmap.h"
23#include <tbb/spin_rw_mutex.h>
25PXR_NAMESPACE_OPEN_SCOPE
66 _lock(cache->_mutex, true)
72 return _cache->_IsEmpty();
79 return _cache->_IsUncached(request);
86 const VdfRequest &request)
const {
87 return _cache->_GetUncached(request);
96 return _cache->_GetValue(output, mask);
110 return _cache->_SetValue(output, value, mask);
117 return _cache->_Invalidate(output);
125 return _cache->_Invalidate(outputs);
132 return _cache->_Clear();
137 tbb::spin_rw_mutex::scoped_lock _lock;
156 _lock(cache->_mutex, false)
165 return _cache->_GetValue(output, mask);
170 tbb::spin_rw_mutex::scoped_lock _lock;
176 bool _ContainsOutput(
const VdfOutput &output)
const;
179 void _AddOutput(
const VdfOutput &output);
182 void _RemoveOutput(
const VdfOutput &output);
200 size_t _Invalidate(
const VdfOutput &outut);
203 size_t _Invalidate(
const VdfMaskedOutputVector &outputs);
209 bool _IsEmpty()
const;
212 bool _IsUncached(
const VdfRequest &request)
const;
215 VdfRequest _GetUncached(
const VdfRequest &request)
const;
228 size_t GetNumBytes()
const;
231 const VdfMask &GetMask()
const {
257 size_t Invalidate(
const VdfMask &mask);
273 TfHashMap<const VdfOutput *, _Entry, TfHash>
277 _OutputsMap _outputs;
283 tbb::spin_rw_mutex _mutex;
287PXR_NAMESPACE_CLOSE_SCOPE
An accessor that provides exclusive read/write access to the cache.
ExclusiveAccess(Ef_OutputValueCache *cache)
Constructor.
size_t SetValue(const VdfOutput &output, const VdfVector &value, const VdfMask &mask)
Sets the cached values for a given output and mask.
bool IsEmpty() const
Returns true if the cache is empty at this time.
VdfRequest GetUncached(const VdfRequest &request) const
Returns a request of outputs that are not currently cached.
ExclusiveAccess(const ExclusiveAccess &)=delete
Non-copyable.
size_t Invalidate(const VdfOutput &output)
Invalidate an output by removing all the data stored at the output.
size_t Invalidate(const VdfMaskedOutputVector &outputs)
Invalidate a vector of outputs and masks by removing the data from the cache.
const VdfVector * GetValue(const VdfOutput &output, const VdfMask &mask) const
Returns the cached value for a given output and mask, if it exists.
bool IsUncached(const VdfRequest &request) const
Returns true if any outputs in the request are not currently cached.
size_t Clear()
Clears the entire cache.
This accessor grants shared read access to the cache, preventing any concurrent write access.
SharedAccess(Ef_OutputValueCache *cache)
Constructor.
SharedAccess(const SharedAccess &)=delete
Non-copyable.
const VdfVector * GetValue(const VdfOutput &output, const VdfMask &mask) const
Returns the cached value for a given output and mask, if it exists.
An output-to-value storage for caching.
EF_API ~Ef_OutputValueCache()
Destructor.
EF_API Ef_OutputValueCache()
Constructor.
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
A VdfMask is placed on connections to specify the data flowing through them.
This is the base class for all nodes in a VdfNetwork.
A VdfOutput represents an output on a node.
This class is used to abstract away knowledge of the cache data used for each node.