7#ifndef PXR_EXEC_VDF_CONTEXT_H
8#define PXR_EXEC_VDF_CONTEXT_H
14#include "pxr/exec/vdf/api.h"
16#include "pxr/exec/vdf/error.h"
30PXR_NAMESPACE_OPEN_SCOPE
53 VdfContext(state, node, VdfScheduleTaskInvalid)
65 _invocation(invocation)
120 const T &value)
const;
134 inline void SetOutput(
const T &value)
const;
239 inline const T *_GetFirstInputValue(const
TfToken &name) const;
248 bool _GetOutputMasks(
251 const
VdfMask **affectsMask) const;
258 bool _IsRequiredOutput(const
VdfOutput &output) const;
267 const
VdfNode &_GetNode()
const {
return _node; }
305 if (
const T *value = _GetFirstInputValue<T>(name)) {
310 "No input value for token '%s' on node '%s'",
321 return _GetFirstInputValue<T>(name);
328 const T *value = _GetFirstInputValue<T>(name);
329 return value ? value : defPtr;
347 return _GetFirstInputValue<T>(name);
352VdfContext::_GetFirstInputValue(
const TfToken &name)
const
368 const VdfMask &mask = connection->GetMask();
370 if (firstIndex < mask.
GetSize()) {
382 return &accessor[firstIndex];
395 const T &value)
const
402 if (output && _IsRequiredOutput(*output))
403 if (
VdfVector *v = _GetExecutor()._GetOutputValueForWriting(*output))
418 if (
VdfVector *v = _GetExecutor()._GetOutputValueForWriting(*output))
434 _GetExecutor()._GetOutputValueForWriting(*output))
435 v->Set(std::forward<T>(value));
448 if (output && _IsRequiredOutput(*output))
449 if (
VdfVector *v = _GetExecutor()._GetOutputValueForWriting(*output))
450 v->Set(std::forward<T>(value));
467 VDF_FATAL_ERROR(_GetNode(),
"Couldn't get output vector.");
479 if (!(output && _IsRequiredOutput(*output))) {
485 VDF_FATAL_ERROR(_GetNode(),
"Couldn't get output vector.");
491PXR_NAMESPACE_CLOSE_SCOPE
Define function attributes.
#define ARCH_PRINTF_FUNCTION(_fmt, _firstArg)
Macro used to indicate a function takes a printf-like specification.
Token for efficient comparison, assignment, and hashing of known strings.
char const * GetText() const
Return the text that this token represents.
A class that fully represents a connection between two VdfNodes.
A context is the parameter bundle passed to callbacks of computations.
VDF_API void CodingError(const char *fmt,...) const ARCH_PRINTF_FUNCTION(2
Invokes a coding error with an error message and a graph around the node that this context is current...
VDF_API void Warn(const char *fmt,...) const ARCH_PRINTF_FUNCTION(2
Reports a warning to the system that was encountered at runtime.
VdfByValueOrConstRef< T > GetInputValue(const TfToken &name) const
Returns a value from the input named name of type T.
VDF_API std::string GetNodeDebugName() const
Returns the debug name for the node for this context.
VdfContext(const VdfEvaluationState &state, const VdfNode &node, const VdfScheduleTaskIndex invocation)
Constructs a VdfContext for the given node and node invocation with the current evaluation state.
VdfContext(const VdfEvaluationState &state, const VdfNode &node)
Constructs a VdfContext for the given node with the current evaluation state.
void SetEmptyOutput() const
Sets an empty value on the output.
VDF_API void SetOutputToReferenceInput(const TfToken &inputName) const
Sets the one and only output to have the same output value as the value on the output connected to in...
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,...
VDF_API bool IsOutputRequested(const TfToken &outputName) const
Returns true if the output named outputName is requested by at least one downstream node,...
bool HasInputValue(const TfToken &name) const
Returns true, if there are input values from the input named name of type T.
void SetOutput(const TfToken &outputName, const T &value) const
Sets the value of the output named outputName to value.
This object holds state that remains persistent during one round of network evaluation.
VdfExecutorErrorLogger * GetErrorLogger() const
The executor error logger.
const VdfSchedule & GetSchedule() const
The schedule used for evaluation.
const VdfExecutorInterface & GetExecutor() const
The executor used for evaluation.
const T & GetFallback() const
Returns the registered fallback value for T from the registry.
static VDF_API VdfExecutionTypeRegistry & GetInstance()
Returns the VdfExecutionTypeRegistry singleton instance.
A client may instantiate an object of this class and set it in an executor, to collect errors that ma...
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
virtual const VdfVector * _GetInputValue(const VdfConnection &connection, const VdfMask &mask) const =0
Returns a value for the cache that flows across connection.
virtual VdfVector * _GetOutputValueForWriting(const VdfOutput &output) const =0
Returns an output value for writing.
Base class for libVdf iterators.
A VdfMask is placed on connections to specify the data flowing through them.
size_t GetSize() const
Returns the size of the mask.
size_t GetFirstSet() const
Returns the first set bit in the mask.
This is the base class for all nodes in a VdfNetwork.
const VdfOutput * GetOutput(const TfToken &name) const
Returns the output object named name.
const VdfInput * GetInput(const TfToken &inputName) const
Returns the connector named inputName, returns NULL if no input of that name exists.
A VdfOutput represents an output on a node.
Contains a specification of how to execute a particular VdfNetwork.
A node that pulls on a vector of value that are downstream of the current execution position.
A VdfTypedVector implements a VdfVector with a specific type.
A read-only accessor for low-level acces to the contents of the VdfVector.
size_t GetNumValues() const
Returns the size of the vector, i.e.
This class is used to abstract away knowledge of the cache data used for each node.
ReadAccessor< TYPE > GetReadAccessor() const
GetReadAccessor() allows low level read-only access to the content of of the VdfVector via the Vdf_Ve...
typename std::conditional_t< std::is_pointer_v< T >||Vdf_AndTypeIsSmall< T, std::is_arithmetic_v< T > >||Vdf_AndTypeIsSmall< T, std::is_enum_v< T > >, T, const T & > VdfByValueOrConstRef
Template that evaluates to either T or const T & depending on whether T best be passed as value or co...
Define preprocessor function name macros.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
uint32_t VdfScheduleTaskIndex
Type describing a task index.