Loading...
Searching...
No Matches
firstValidInputValue.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_EF_FIRST_VALID_INPUT_VALUE_H
8
#define PXR_EXEC_EF_FIRST_VALID_INPUT_VALUE_H
9
11
12
#include "
pxr/pxr.h
"
13
14
#include "
pxr/exec/vdf/context.h
"
15
#include "
pxr/exec/vdf/executionTypeRegistry.h
"
16
#include "
pxr/exec/vdf/iterator.h
"
17
#include "
pxr/exec/vdf/node.h
"
18
19
PXR_NAMESPACE_OPEN_SCOPE
20
31
template
<
typename
Type>
32
Type
33
EfGetFirstValidInputValue
(
const
VdfContext
&context)
34
{
35
struct
ContextAccess final :
public
VdfIterator
{
36
const
VdfNode
&GetNode(
const
VdfContext
&context) {
37
return
_GetNode
(context);
38
}
39
};
40
41
// Iterate over all inputs, and return the first valid input value.
42
const
VdfNode
&node = ContextAccess().GetNode(context);
43
for
(
const
std::pair<TfToken, VdfInput *> &in : node.
GetInputsIterator
()) {
44
if
(
const
Type *value = context.
GetInputValuePtr
<Type>(in.first)) {
45
return
*value;
46
}
47
}
48
49
// Ask the type registry for the fallback value to use.
50
return
VdfExecutionTypeRegistry::GetInstance
().
GetFallback
<Type>();
51
}
52
53
PXR_NAMESPACE_CLOSE_SCOPE
54
55
#endif
VdfContext
A context is the parameter bundle passed to callbacks of computations.
Definition:
context.h:40
VdfContext::GetInputValuePtr
const T * GetInputValuePtr(const TfToken &name) const
Returns a pointer to the value from the input named name if the input has a valid value,...
Definition:
context.h:319
VdfExecutionTypeRegistry::GetFallback
const T & GetFallback() const
Returns the registered fallback value for T from the registry.
Definition:
executionTypeRegistry.h:270
VdfExecutionTypeRegistry::GetInstance
static VDF_API VdfExecutionTypeRegistry & GetInstance()
Returns the VdfExecutionTypeRegistry singleton instance.
VdfIterator
Base class for libVdf iterators.
Definition:
iterator.h:36
VdfIterator::_GetNode
const VdfNode & _GetNode(const VdfContext &context) const
Returns the current node being run.
Definition:
iterator.h:45
VdfNode
This is the base class for all nodes in a VdfNetwork.
Definition:
node.h:53
VdfNode::GetInputsIterator
const InputMapIterator GetInputsIterator() const
Returns an iterator class that can be used with TF_FOR_ALL to iterate through the inputs.
Definition:
node.h:177
context.h
iterator.h
node.h
executionTypeRegistry.h
EfGetFirstValidInputValue
Type EfGetFirstValidInputValue(const VdfContext &context)
A function that may be used as a callback (or in a callback) to return the first valid input value.
Definition:
firstValidInputValue.h:33
pxr.h
pxr
exec
ef
firstValidInputValue.h
© Copyright 2025, Pixar Animation Studios. |
Terms of Use
| Generated on Tue Nov 18 2025 10:36:06 by
1.9.6