7 #ifndef PXR_EXEC_EXEC_COMPUTATION_BUILDERS_H
8 #define PXR_EXEC_EXEC_COMPUTATION_BUILDERS_H
36 #include <type_traits>
209 return static_cast<unsigned char>(
a) & static_cast<unsigned char>(b);
212 template <Exec_ComputationBuilderProv
iderTypes allowed>
220 template <Exec_ComputationBuilderProv
iderTypes allowed>
240 const TfToken &computationName,
244 const TfToken &disambiguatingId);
248 const Exec_ComputationBuilderValueSpecifierBase&);
268 void _GetInputKey(Exec_InputKey *inputKey)
const;
274 const std::unique_ptr<_Data> _data;
299 template <Exec_ComputationBuilderProv
iderTypes allowed>
304 const TfToken &computationName,
309 computationName, resultType,
310 std::move(providerResolution),
430 : _localTraversal(localTraversal)
436 return _localTraversal;
461 std::move(_constantValue));
481 template <Exec_ComputationBuilderProv
iderTypes allowed>
497 template <
typename ResultType>
502 "VtArray is not a supported result type");
512 template <
typename ResultType>
525 template <
typename ResultType>
530 "VtArray is not a supported result type");
532 return _GetMetadataValueSpecifier<allowed>(
542 template <Exec_ComputationBuilderProv
iderTypes allowed>
553 template <Exec_ComputationBuilderProv
iderTypes allowed>
569 template <
typename ResultType>
588 template <Exec_ComputationBuilderProv
iderTypes allowed>
633 template <
typename ResultType>
652 namespace exec_registration {
658 Exec_ComputationBuilderProviderTypes::Prim>
688 SdfPath::ReflexiveRelativePath().AppendProperty(attributeName))
699 Exec_ComputationBuilderProviderTypes::Prim>
713 SdfPath::ReflexiveRelativePath().AppendProperty(
725 Exec_ComputationBuilderProviderTypes::Attribute>
784 template <
typename ValueType>
790 .InputName(attributeName);
800 Exec_ComputationBuilderProviderTypes::Any>
844 template <
typename ResultType>
847 Exec_ComputationBuilderProviderTypes::Any>
881 CheckForRegistration<ResultType>(),
891 template <
typename ValueType>
894 Exec_ComputationBuilderProviderTypes::Any>
924 SdfPath::ReflexiveRelativePath(),
928 "VtArray is not a supported result type");
937 template <
typename ValueType>
1045 VtValue(std::move(constantValue)),
1050 !std::is_same_v<std::decay_t<ValueType>,
char*> &&
1051 !std::is_same_v<std::decay_t<ValueType>,
const char*>,
1052 "Must use std::string to represent string literal types.");
1054 VtIsHashable<ValueType>(),
1055 "Types used to provide constant input values must be hashable.");
1066 !std::is_same_v<std::decay_t<ValueType>,
char*> &&
1067 !std::is_same_v<std::decay_t<ValueType>,
const char*>,
1068 "Must use std::string to represent string literal types.");
1070 VtIsHashable<ValueType>(),
1071 "Types used to provide constant input values must be hashable.");
1079 Constant(
const char *) -> Constant<std::string>;
1080 Constant(
char *) -> Constant<std::string>;
1088 template <
typename ResultType>
1091 Exec_ComputationBuilderProviderTypes::Prim>
1128 CheckForRegistration<ResultType>(),
1182 template <
typename ValueType>
1188 .InputName(attributeName);
1235 template <
typename ResultType>
1286 template <
typename ResultType>
1329 static ExecComputationBuilder
1331 return ExecComputationBuilder(schemaType);
1375 const TfToken &computationName);
1471 template <
class... DispatchedOntoSchemaTypes>
1474 const TfToken &computationName,
1475 DispatchedOntoSchemaTypes &&...schemaTypes);
1481 const TfToken &computationName,
1516 template <
class... DispatchedOntoSchemaTypes>
1519 const TfToken &computationName,
1520 DispatchedOntoSchemaTypes &&...schemaTypes);
1526 const TfToken &computationName,
1545 const TfToken &computationName,
1558 template <Exec_ComputationBuilderProv
iderTypes allowed,
typename T>
1573 std::unique_ptr<ExecDispatchesOntoSchemas>
1583 const std::unique_ptr<_Data> _data;
1588 template <
typename Derived>
1592 struct _UnspecifiedType {};
1599 const TfToken &computationName,
1662 typename ResultType = _UnspecifiedType,
1663 typename ReturnType = _UnspecifiedType>
1679 const TfToken &computationName,
1680 bool dispatched =
false,
1709 template <
typename... Args>
1726 const TfToken &computationName,
1727 bool dispatched =
false,
1760 template <
typename... Args>
1806 template <
typename... Args>
1816 template <Exec_ComputationBuilderProv
iderTypes allowed,
typename T>
1819 using regType = std::decay_t<T>;
1821 !std::is_base_of_v<Exec_ComputationBuilderAccessorBase, regType>,
1822 "Accessor can't provide an input value.");
1824 !std::is_same_v<Exec_ComputationBuilderConstantAccessorBase, regType>,
1825 "Constant(value) must be followed by .InputName(inputNameToken)");
1827 std::is_base_of_v<Exec_ComputationBuilderValueSpecifierBase, regType>,
1828 "Invalid type used as an input registration.");
1830 regType::allowedProviders & allowed,
1831 "Input is not allowed on a provider of this type.");
1838 template <
typename Derived>
1839 template <
typename InputResultType,
typename ReturnType>
1851 std::is_same_v<InputResultType, _UnspecifiedType>,
1856 !std::is_void_v<ResultType> ||
1857 std::is_convertible_v<ReturnType, ResultType>,
1858 "Callback return type must be convertible to the computation result "
1861 !std::is_reference_v<ResultType>,
1862 "Callback functions must return by value");
1865 "VtArray is not a supported result type");
1867 const TfType resultType =
1873 if constexpr (std::is_void_v<ReturnType>) {
1874 _AddCallback(callback, resultType);
1878 ctx.
SetOutput<ResultType>(callback(ctx));
1883 return *
static_cast<Derived*
>(
this);
1890 template <
typename... Args>
1909 template <
typename... Args>
1928 template <
typename... Args>
1947 template <
class... DispatchedOntoSchemaTypes>
1950 const TfToken &computationName,
1951 DispatchedOntoSchemaTypes &&...schemaTypes)
1955 std::decay_t<DispatchedOntoSchemaTypes>,
TfType> && ...));
1959 {std::forward<DispatchedOntoSchemaTypes>(schemaTypes)...});
1962 template <
class... DispatchedOntoSchemaTypes>
1965 const TfToken &computationName,
1966 DispatchedOntoSchemaTypes &&...schemaTypes)
1970 std::decay_t<DispatchedOntoSchemaTypes>,
TfType> && ...));
1974 {std::forward<DispatchedOntoSchemaTypes>(schemaTypes)...});
Exec_ComputationBuilderPropertyAccessor(const SdfPath &localTraversal)
EXEC_API ~ExecComputationBuilder()
auto IncomingConnections(const TfToken &computationName)
NamespaceAncestor(const TfToken &computationName)
EXEC_API ~Exec_ComputationBuilderCRTPBase()
Exec_ComputationBuilderAttributeAccessor(const SdfPath &localTraversal)
Class used to build prim computation definitions.
EXEC_API ExecPrimComputationBuilder PrimComputation(const TfToken &computationName)
static constexpr Exec_ComputationBuilderProviderTypes allowedProviders
Computation(const TfToken &computationName)
ExecPrimComputationBuilder & Inputs(Args &&...args)
Exec_ComputationBuilderAccessorBase(const SdfPath &localTraversal)
typename std::conditional< B, T, F >::type conditional_t
auto AttributeValue(const TfToken &attributeName)
See AttributeValue()
#define PXR_NAMESPACE_OPEN_SCOPE
ExecAttributeComputationBuilder & Inputs(Args &&...args)
EXEC_API void _SetInputName(const TfToken &inputName)
EXEC_API Exec_ComputationBuilderCRTPBase(const TfToken &attributeName, TfType schemaType, const TfToken &computationName, bool dispatched, ExecDispatchesOntoSchemas &&dispatchesOntoSchemas)
GLboolean GLboolean GLboolean GLboolean a
~Exec_ComputationBuilderBase()
void SetOutput(const TfToken &outputName, const T &value) const
auto Connections(const TfToken &computationName)
EXEC_API ~ExecAttributeComputationBuilder()
Attribute accessor, valid for providing input to a prim computation.
EXEC_API Exec_ComputationBuilderConstantValueSpecifier(const TfType resultType, const SdfPath &localTraversal, const TfToken &inputName, VtValue &&constantValue)
Exec_ComputationBuilderComputationValueSpecifier(const TfToken &computationName, const TfType resultType, ExecProviderResolution &&providerResolution, const TfToken &disambiguatingId=TfToken())
ValueSpecifier IncomingConnections(const TfToken &computationName)
See IncomingConnections()
ValueSpecifier Metadata(const TfToken &metadataKey)
See Metadata()
EXEC_API void _SetFallsBackToDispatched(bool fallsBackToDispatched)
ExecAttributeComputationBuilder DispatchedAttributeComputation(const TfToken &computationName, DispatchedOntoSchemaTypes &&...schemaTypes)
Exec_ComputationBuilderComputationValueSpecifier< allowed > ValueSpecifier
static ExecComputationBuilder Construct(TfType schemaType)
The localTraversal path directly indicates the computation provider.
ExecAttributeExpressionBuilder & Inputs(Args &&...args)
static constexpr Exec_ComputationBuilderProviderTypes allowedProviders
EXEC_API ~Exec_ComputationBuilderValueSpecifierBase()
constexpr bool operator&(const Exec_ComputationBuilderProviderTypes a, const Exec_ComputationBuilderProviderTypes b)
std::unique_ptr< ExecDispatchesOntoSchemas > _GetDispatchesOntoSchemas()
std::function< void(const class VdfContext &context)> ExecCallbackFn
Function type used for computation callbacks.
Exec_ComputationBuilderProviderTypes
Exec_ComputationBuilderRelationshipAccessor(const SdfPath &localTraversal)
EXEC_API TfStaticData< Exec_BuiltinComputationTokens > ExecBuiltinComputations
ValueSpecifier TargetedObjects(const TfToken &computationName)
Prim accessor, valid for providing input to an attribute computation.
Relationship accessor, valid for providing input to a prim computation.
GLboolean GLboolean GLboolean b
EXEC_API void _AddInputKey(const Exec_ComputationBuilderValueSpecifierBase *valueSpecifier)
static EXEC_API const ExecTypeRegistry & GetInstance()
Constant(const char *) -> Constant< std::string >
Constant(const ValueType &constantValue)
SDF_API SdfPath AppendProperty(TfToken const &propName) const
Exec_ComputationBuilderAttributeAccessor< Exec_ComputationBuilderProviderTypes::Attribute > Attribute(const TfToken &attributeName)
See Attribute()
A trait to detect instantiations of VtArray, specialized in array.h.
TfType CheckForRegistration() const
ValueSpecifier Computation(const TfToken &computationName)
See Computation()
Exec_ComputationBuilderComputationValueSpecifier< allowed > ValueSpecifier
Constant(ValueType &&constantValue)
Exec_ComputationBuilderConstantValueSpecifier InputName(const TfToken &inputName)&&
Exec_ComputationBuilderComputationValueSpecifier< allowed > ValueSpecifier
Metadata(const TfToken &metadataKey)
Find the provider by traversing upward in namespace.
Computation value specifier, valid for providing input to any computation.
#define PXR_NAMESPACE_CLOSE_SCOPE
Exec_ComputationBuilderRelationshipAccessor< Exec_ComputationBuilderProviderTypes::Attribute > Relationship(const TfToken &relationshipName)
See Relationship()
EXEC_API ~ExecAttributeExpressionBuilder()
auto AttributeValue(const TfToken &attributeName)
**If you just want to fire and args
ValueSpecifier Connections(const TfToken &computationName)
See Connections()
EXEC_API void _AddCallback(ExecCallbackFn &&calback, TfType resultType)
EXEC_API Exec_ComputationBuilderConstantAccessorBase(VtValue &&constantValue, TfType valueType)
EXEC_API void _SetOptional(const bool optional)
EXEC_API ~ExecPrimComputationBuilder()
EXEC_API Exec_ComputationBuilderBase(const TfToken &attributeName, TfType schemaType, const TfToken &computationName, bool dispatched, ExecDispatchesOntoSchemas &&dispatchesOntoSchemas)
EXEC_API ExecAttributeComputationBuilder AttributeComputation(const TfToken &attributeName, const TfToken &computationName)
static SDF_API const SdfPath & ReflexiveRelativePath()
The relative path representing "self".
EXEC_API Exec_ComputationBuilderValueSpecifierBase(const TfToken &computationName, TfType resultType, ExecProviderResolution &&providerResolution, const TfToken &inputName, const TfToken &disambiguatingId)
Attribute(const TfToken &attributeName)
Class used to build attribute expression definitions.
const SdfPath & _GetLocalTraversal() const
static void _ValidateInputs()
Provides access to the stage, valid for providing input to any computation.
Exec_ComputationBuilderAccessor(const SdfPath &localTraversal)
Derived & Callback(ReturnType(*callback)(const VdfContext &))
Class used to build attribute computation definitions.
static EXEC_API Exec_ComputationBuilderComputationValueSpecifier< allowed > _GetMetadataValueSpecifier(const TfType resultType, const SdfPath &localTraversal, const TfToken &metadataKey)
EXEC_API ExecAttributeExpressionBuilder AttributeExpression(const TfToken &attributeName)
ExecPrimComputationBuilder DispatchedPrimComputation(const TfToken &computationName, DispatchedOntoSchemaTypes &&...schemaTypes)
Exec_ComputationBuilderComputationValueSpecifier< allowed > This
Relationship(const TfToken &relationshipName)