Loading...
Searching...
No Matches
dataManagerBasedSubExecutor.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_DATA_MANAGER_BASED_SUB_EXECUTOR_H
8#define PXR_EXEC_VDF_DATA_MANAGER_BASED_SUB_EXECUTOR_H
9
11
12#include "pxr/pxr.h"
13
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20class VdfNode;
21
29
30template < typename DataManagerType, typename BaseClass >
31class VdfDataManagerBasedSubExecutor :
32 public VdfDataManagerBasedExecutor < DataManagerType, BaseClass >
33{
34 // Base type definition
36
37public:
38
41 VdfDataManagerBasedSubExecutor() {}
42
45 explicit VdfDataManagerBasedSubExecutor(
46 const VdfExecutorInterface *parentExecutor) :
47 Base(parentExecutor)
48 {}
49
52 virtual ~VdfDataManagerBasedSubExecutor() {}
53
54protected:
55
58 virtual const VdfVector *_GetInputValue(
59 const VdfConnection &connection,
60 const VdfMask &mask) const override {
61 // Lookup the output value in the local data manager, first!
62 if (const VdfVector *data =
63 Base::_dataManager.GetInputValue(connection, mask)) {
64 return data;
65 }
66
67 // If available, also check the parent executor for the output value.
68 return _GetParentExecutorValue(connection.GetSourceOutput(), mask);
69 }
70
74 const VdfOutput &output,
75 const VdfMask &mask ) const override {
76 // Lookup the output value in the local data manager, first!
77 if (const VdfVector *data =
78 Base::_dataManager.GetOutputValueForReading(
79 Base::_dataManager.GetDataHandle(output.GetId()), mask)) {
80 return data;
81 }
82
83 // If available, also check the parent executor for the output value.
84 return _GetParentExecutorValue(output, mask);
85 }
86
87private:
88
89 // Query the parent executor for an output value.
90 const VdfVector *_GetParentExecutorValue(
91 const VdfOutput &output,
92 const VdfMask &mask) const {
93 const VdfExecutorInterface *parentExecutor = Base::GetParentExecutor();
94 return parentExecutor
95 ? parentExecutor->GetOutputValue(output, mask)
96 : nullptr;
97 }
98
99};
100
101PXR_NAMESPACE_CLOSE_SCOPE
102
103#endif
A class that fully represents a connection between two VdfNodes.
Definition: connection.h:30
const VdfOutput & GetSourceOutput() const
Returns the output (ie. source) for this connection.
Definition: connection.h:63
Base class for executors that use a data manager.
virtual const VdfVector * _GetOutputValueForReading(const VdfOutput &output, const VdfMask &mask) const override
Returns an output value for reading.
virtual const VdfVector * _GetInputValue(const VdfConnection &connection, const VdfMask &mask) const override
Returns value for the cache that flows across connection.
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
const VdfVector * GetOutputValue(const VdfOutput &output, const VdfMask &mask) const
Returns the cached value for a given output if it has a cache that contains all values specified by m...
A VdfMask is placed on connections to specify the data flowing through them.
Definition: mask.h:37
This is the base class for all nodes in a VdfNetwork.
Definition: node.h:53
A VdfOutput represents an output on a node.
Definition: output.h:32
VdfId GetId() const
The unique id of this output.
Definition: output.h:100
This class is used to abstract away knowledge of the cache data used for each node.
Definition: vector.h:56