Loading...
Searching...
No Matches
parallelDataManagerVector.h
Go to the documentation of this file.
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_EXEC_VDF_PARALLEL_DATA_MANAGER_VECTOR_H
8#define PXR_EXEC_VDF_PARALLEL_DATA_MANAGER_VECTOR_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/vdf/api.h"
16#include "pxr/exec/vdf/parallelExecutorDataVector.h"
17#include "pxr/exec/vdf/types.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
22class VdfExecutorInvalidationData;
23class VdfNetwork;
25
32template<>
34
39
40};
41
51class VDF_API_TYPE VdfParallelDataManagerVector :
52 public VdfParallelExecutorDataManager<VdfParallelDataManagerVector>
53{
54public:
55
58 typedef
61
64 typedef
68
71 VdfParallelDataManagerVector() : _data(nullptr) {}
72
75 VDF_API
77
83 VDF_API
84 void Resize(const VdfNetwork &network);
85
92 bool IsValidDataHandle(const DataHandle handle) const {
94 }
95
105 inline DataHandle GetOrCreateDataHandle(const VdfId outputId) const {
106 return _data->GetOrCreateDataHandle(outputId);
107 }
108
113 inline DataHandle GetDataHandle(const VdfId outputId) const {
114 return _data
115 ? _data->GetDataHandle(outputId)
117 }
118
125 return _data->GetPrivateBufferData(handle);
126 }
127
134 return _data->GetScratchBufferData(handle);
135 }
136
143 return _data->GetPublicBufferData(handle);
144 }
145
154 void PublishPrivateBufferData(const DataHandle handle) const {
155 _data->PublishPrivateBufferData(handle);
156 }
157
166 void PublishScratchBufferData(const DataHandle handle) const {
167 _data->PublishScratchBufferData(handle);
168 }
169
178 const DataHandle handle) const {
179 return _data->GetTransferredBufferData(handle);
180 }
181
195 const DataHandle handle,
196 VdfVector *value,
197 const VdfMask &mask) {
198 return _data->TransferBufferData(handle, value, mask);
199 }
200
209 _data->ResetTransferredBufferData(handle);
210 }
211
218 VdfExecutorInvalidationData *GetInvalidationData(
219 const DataHandle handle) const {
220 return _data->GetInvalidationData(handle);
221 }
222
225 using Base::GetInvalidationTimestamp;
226
234 const DataHandle handle) const {
235 return _data->GetInvalidationTimestamp(handle);
236 }
237
244 const DataHandle handle,
245 VdfInvalidationTimestamp timestamp) {
246 _data->SetInvalidationTimestamp(handle, timestamp);
247 }
248
252 bool IsTouched(const VdfId outputId) const {
253 return _data->IsTouched(outputId);
254 }
255
259 void Touch(const VdfId outputId) const {
260 _data->Touch(outputId);
261 }
262
266 bool Untouch(const VdfId outputId) {
267 return _data->Untouch(outputId);
268 }
269
275 VDF_API
276 void ClearDataForOutput(const VdfId outputId);
277
283 VDF_API
284 void Clear();
285
288 bool IsEmpty() const {
289 return !_data || _data->GetNumData() == 0;
290 }
291
292
293private:
294
295 // Pointer the the executor data vector.
296 mutable Vdf_ParallelExecutorDataVector *_data;
297
298};
299
301
302PXR_NAMESPACE_CLOSE_SCOPE
303
304#endif
This is a data container for executor data managers that uses data stored in vectors indexed by outpu...
size_t DataHandle
The data handle type is an index into the internal data vector.
static const size_t InvalidHandle
This sentinel index denotes an invalid handle.
This object is responsible for storing the executor buffer data, comprised of the executor cache vect...
A VdfMask is placed on connections to specify the data flowing through them.
Definition: mask.h:37
A VdfNetwork is a collection of VdfNodes and their connections.
Definition: network.h:60
This is a data manager for executors that uses data stored in a vector indexed by output ids.
VdfExecutorBufferData * GetScratchBufferData(const DataHandle handle) const
Returns the VdfExecutorBufferData associated with the given handle.
VDF_API void Resize(const VdfNetwork &network)
Resize the data manager to accommodate the given network.
void PublishScratchBufferData(const DataHandle handle) const
Publishes the scratch VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData.
VDF_API void ClearDataForOutput(const VdfId outputId)
Clears the executor data for a specific output.
void Touch(const VdfId outputId) const
Marks the data at the given outputId as having been touched by evaluation.
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.
void ResetTransferredBufferData(const DataHandle handle)
Resets the transferred buffer associated with the given handle.
VDF_API ~VdfParallelDataManagerVector()
Destructor.
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.
DataHandle GetOrCreateDataHandle(const VdfId outputId) const
Returns an existing data handle, or creates a new one for the given outputId.
bool Untouch(const VdfId outputId)
Marks the data at the given outputId as not having been touched by evaluation.
VdfExecutorBufferData * GetPrivateBufferData(const DataHandle handle) const
Returns the VdfExecutorBufferData associated with the given handle.
bool IsEmpty() const
Returns true if this data manager is empty.
void PublishPrivateBufferData(const DataHandle handle) const
Publishes the private VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData.
VdfExecutorBufferData * GetTransferredBufferData(const DataHandle handle) const
Returns the transferred VdfExecutorBufferData associated with the given handle.
DataHandle GetDataHandle(const VdfId outputId) const
Returns an existing data handle for the given outputId.
bool IsTouched(const VdfId outputId) const
Returns true if the data at the given outputId has been touched by evaluation.
VdfExecutorBufferData * GetPublicBufferData(const DataHandle handle) const
Returns the VdfExecutorBufferData associated with the given handle.
VDF_API void Clear()
Clears all the data from this manager.
Vdf_ParallelExecutorDataManagerTraits< VdfParallelDataManagerVector >::DataHandle DataHandle
The data handle type from the type traits class.
bool TransferBufferData(const DataHandle handle, VdfVector *value, const VdfMask &mask)
Transfers ownership of the value to the output associated with handle.
VdfParallelExecutorDataManager< VdfParallelDataManagerVector > Base
The base class.
This class provides functionality to manage executor data stored as VdfExecutorData from multiple thr...
This class is used to abstract away knowledge of the cache data used for each node.
Definition: vector.h:56
uint64_t VdfId
The unique identifier type for Vdf objects.
Definition: types.h:107
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.
Definition: types.h:74
Vdf_ParallelExecutorDataVector::DataHandle DataHandle
The data handle type.
Forward definition of the traits class, which will be specialized by the derived data manager impleme...