![]() |
|
A context is the parameter bundle passed to callbacks of computations. More...
#include <context.h>
Public Member Functions | |
| VdfContext (const VdfContext &rhs)=delete | |
| VdfContext & | operator= (const VdfContext &rhs)=delete |
| VdfContext (const VdfEvaluationState &state, const VdfNode &node) | |
Constructs a VdfContext for the given node with the current evaluation state. | |
| 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. | |
| template<typename T > | |
| VdfByValueOrConstRef< T > | GetInputValue (const TfToken &name) const |
Returns a value from the input named name of type T. | |
| template<typename T > | |
| 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, otherwise returns nullptr. | |
| template<typename T > | |
| const T * | GetInputValuePtr (const TfToken &name, const T *defPtr) const |
Returns a pointer to the value from the input named name if the input has a valid value, otherwise returns defPtr. | |
| template<typename T > | |
| bool | HasInputValue (const TfToken &name) const |
Returns true, if there are input values from the input named name of type T. | |
| VDF_API bool | IsOutputRequested (const TfToken &outputName) const |
Returns true if the output named outputName is requested by at least one downstream node, or false if there are no consumers for the output or if outputName isn't a valid output on this node. | |
| template<typename T > | |
| void | SetOutput (const TfToken &outputName, const T &value) const |
Sets the value of the output named outputName to value. | |
| template<typename T > | |
| void | SetOutput (const T &value) const |
Sets the value of the output to value. | |
| template<typename T > | |
| void | SetOutput (T &&value) const |
Sets the value of the output to value. | |
| template<typename T > | |
| void | SetOutput (const TfToken &outputName, T &&value) const |
Sets the value of the output named outputName to value. | |
| template<typename T > | |
| void | SetEmptyOutput () const |
| Sets an empty value on the output. | |
| template<typename T > | |
| void | SetEmptyOutput (const TfToken &outputName) const |
Sets an empty value on the output named outputName. | |
| 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 input inputName. | |
Error Reporting | |
| VDF_API void | Warn (const char *fmt,...) const ARCH_PRINTF_FUNCTION(2 |
| Reports a warning to the system that was encountered at runtime. | |
Debugging | |
| VDF_API std::string | GetNodeDebugName () const |
| Returns the debug name for the node for this context. | |
| 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 currently referencing. | |
Friends | |
| class | VdfIterator |
| class | VdfSpeculationNode |
A context is the parameter bundle passed to callbacks of computations.
It is the only API through which functions have access to their inputs.
|
inline |
Constructs a VdfContext for the given node with the current evaluation state.
|
inline |
Constructs a VdfContext for the given node and node invocation with the current evaluation state.
| VDF_API void CodingError | ( | const char * | fmt, |
| ... | |||
| ) | const |
Invokes a coding error with an error message and a graph around the node that this context is currently referencing.
It takes a printf-style format specification.
|
inline |
|
inline |
|
inline |
| VDF_API std::string GetNodeDebugName | ( | ) | const |
Returns the debug name for the node for this context.
|
inline |
| VDF_API bool IsOutputRequested | ( | const TfToken & | outputName | ) | const |
Returns true if the output named outputName is requested by at least one downstream node, or false if there are no consumers for the output or if outputName isn't a valid output on this node.
This can be used by the node callback to avoid computing expensive outputs that are not needed.
NOTE: It's far preferred for computations to be designed with appropriate granularity, but this may be used in cases where the computation of multiple outputs isn't feasibly separable.
|
inline |
|
inline |
|
inline |
Sets the value of the output to value.
This can be used when the node already has all the answers and doesn't want to bother with iterators.
Note that this method currently always performs a full copy, because it can't tell if we are allowed to take ownership of the given output.
It is invalid to call this method on any node that does not have exactly one output.
|
inline |
Sets the value of the output named outputName to value.
This can be used when the node already has all the answers and doesn't want to bother with iterators.
Note that this method currently always performs a full copy, because it can't tell if we are allowed to take ownership of the given output.
|
inline |
Sets the value of the output named outputName to value.
This can be used when the node already has all the answers and doesn't want to bother with iterators.
This method moves the data into the output, and thus avoids a copy. However, note that value will no longer contain any meaningful data after this method returned.
|
inline |
Sets the value of the output to value.
This can be used when the node already has all the answers and doesn't want to bother with iterators.
This method moves the data into the output, and thus avoids a copy. However, note that value will no longer contain any meaningful data after this method returned.
It is invalid to call this method on any node that does not have exactly one 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 input inputName.
Calling this method when the input doesn't need to be modified gives the system an opportunity to apply some optimizations when possible.
Note that this optimization might not take effect in certain circumstances.
| VDF_API void Warn | ( | const char * | fmt, |
| ... | |||
| ) | const |
Reports a warning to the system that was encountered at runtime.
Exactly how the warning is presented to the user, if at all, is up to the host system.
Multiple calls to Warn() from the same node will cause the messages to be concatenated.
|
friend |
|
friend |