7#ifndef PXR_EXEC_VDF_DATA_MANAGER_HASH_TABLE_H
8#define PXR_EXEC_VDF_DATA_MANAGER_HASH_TABLE_H
14#include "pxr/exec/vdf/api.h"
25#include <unordered_map>
27PXR_NAMESPACE_OPEN_SCOPE
46 invalidationTimestamp(
47 VdfExecutorInvalidationData::InitialInvalidationTimestamp),
52 VdfExecutorInvalidationData invalidationData;
54 std::unique_ptr<VdfSMBLData> smblData;
83 using _DataMap = std::unordered_map<VdfId, _OutputData, TfHash>;
113 return handle !=
nullptr;
122 _DataMap::iterator it = _outputData.find(outputId);
123 if (it == _outputData.end()) {
124 it = _outputData.emplace(
125 std::piecewise_construct,
126 std::forward_as_tuple(outputId),
127 std::forward_as_tuple())
147 return &handle->bufferData;
158 return &handle->invalidationData;
173 return handle->invalidationTimestamp;
184 handle->invalidationTimestamp = timestamp;
195 return handle->smblData.get();
205 if (!handle->smblData) {
208 return handle->smblData.get();
218 return handle->touched;
228 handle->touched =
true;
238 const bool wasTouched = handle->touched;
239 handle->touched =
false;
246 _outputData.erase(outputId);
258 return _outputData.empty();
265 mutable _DataMap _outputData;
271PXR_NAMESPACE_CLOSE_SCOPE
This is a data manager for executors that uses data stored in an external hash table.
bool IsTouched(const DataHandle handle) const
Returns true if the data at the given handle has been touched by evaluation.
VDF_API void Resize(const VdfNetwork &network)
Resize the data manager to accommodate all the outputs in the given network.
bool IsValidDataHandle(const DataHandle handle) const
Returns true if the given data handle is valid, i.e.
VdfInvalidationTimestamp GetInvalidationTimestamp(const DataHandle handle) const
Returns the VdfInvalidationTimestamp associated with the given handle.
VdfExecutorBufferData * GetBufferData(const DataHandle handle) const
Returns the VdfExecutorBufferData associated with the given handle.
Vdf_ExecutorDataManagerTraits< VdfDataManagerHashTable >::DataHandle DataHandle
The data handle type from the type traits class.
VdfExecutorInvalidationData * GetInvalidationData(const DataHandle handle) const
Returns the VdfExecutorInvalidationData associated with the given handle.
void SetInvalidationTimestamp(const DataHandle handle, VdfInvalidationTimestamp timestamp)
Sets the invalidation timestamp for the give data handle.
void ClearDataForOutput(const VdfId outputId)
Clears the executor data for a specific output.
VdfExecutorDataManager< VdfDataManagerHashTable > Base
The base class type.
VdfSMBLData * GetSMBLData(const DataHandle handle) const
Returns an existing VdfSMBLData associated with the given handle.
DataHandle GetOrCreateDataHandle(const VdfId outputId) const
Returns an existing data handle, or creates a new one for the given outputId.
bool IsEmpty() const
Returns true if this data manager is empty.
DataHandle GetDataHandle(const VdfId outputId) const
Returns an existing data handle for the given outputId.
void Clear()
Clears all the data from this manager.
bool Untouch(const DataHandle handle)
Marks the data at the given handle as not having been touched by evaluation.
VdfSMBLData * GetOrCreateSMBLData(const DataHandle handle) const
Returns an existing VdfSMBLData associated with the given handle or creates a new one of none exists.
void Touch(const DataHandle handle) const
Marks the data at the given handle as having been touched by evaluation.
This object is responsible for storing the executor buffer data, comprised of the executor cache vect...
This class provides functionality to manage the executor specific data associated with each output in...
VdfInvalidationTimestamp GetInvalidationTimestamp() const
Returns the current invalidation timestamp on this executor.
A VdfNetwork is a collection of VdfNodes and their connections.
A VdfOutput represents an output on a node.
VdfSMBLData holds per-output data that is meant to be consumed by the executor.
OutputData * DataHandle
The data handle type.
uint64_t VdfId
The unique identifier type for Vdf objects.
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.
Container::mapped_type * TfMapLookupPtr(Container &map, Key const &key)
Checks if an item exists in a map or TfHashMap, without copying it.
void TfReset(T &obj)
Reset obj to be an empty, space-optimized object.
Forward definition of the traits class, which will be specialized by the derived data manager impleme...