Loading...
Searching...
No Matches
speculationExecutorBase.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_SPECULATION_EXECUTOR_BASE_H
8#define PXR_EXEC_VDF_SPECULATION_EXECUTOR_BASE_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/vdf/api.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
25class VDF_API_TYPE VdfSpeculationExecutorBase : public VdfExecutorInterface
26{
27public:
28
31 VDF_API
32 virtual ~VdfSpeculationExecutorBase();
33
37 inline bool IsSpeculatingNode(const VdfNode *node) const;
38
42 const VdfExecutorInterface *GetNonSpeculationParentExecutor() const {
43 return _parentNonSpeculationExecutor;
44 }
45
46protected:
47
50 VDF_API
51 explicit VdfSpeculationExecutorBase(
52 const VdfExecutorInterface *parentExecutor);
53
56 void _SetSpeculationNode(const VdfNode *speculationNode) {
57 _speculationNode = speculationNode;
58 }
59
60private:
61
62 // The speculation node using this executor.
63 const VdfNode *_speculationNode;
64
65 // The parent speculation executor.
66 const VdfSpeculationExecutorBase *_parentSpeculationExecutor;
67
68 // The first parent executor that is not a speculation executor.
69 const VdfExecutorInterface *_parentNonSpeculationExecutor;
70
71};
72
74
75bool
76VdfSpeculationExecutorBase::IsSpeculatingNode(const VdfNode *node) const
77{
78 bool isSpeculatingNode = false;
79 const VdfSpeculationExecutorBase *speculationExecutor = this;
80 while (speculationExecutor) {
81 isSpeculatingNode |= (node == speculationExecutor->_speculationNode);
82 speculationExecutor = speculationExecutor->_parentSpeculationExecutor;
83 }
84 return isSpeculatingNode;
85}
86
87PXR_NAMESPACE_CLOSE_SCOPE
88
89#endif
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
This is the base class for all nodes in a VdfNetwork.
Definition: node.h:53