![]() |
|
UsdValidationRegistry manages and provides access to UsdValidator / UsdValidatorSuite for USD Validation. More...
#include <validationRegistry.h>
Public Member Functions | |
| USD_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidateLayerTaskFn &layerTaskFn) |
Register UsdValidator defined in a plugin using validatorName and layerTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidateStageTaskFn &stageTaskFn) |
Register UsdValidator defined in a plugin using validatorName and stageTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidatePrimTaskFn &primTaskFn) |
Register UsdValidator defined in a plugin using validatorName and primTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterValidator (const UsdValidatorMetadata &metadata, const UsdValidateLayerTaskFn &layerTaskFn) |
Register UsdValidator using metadata and layerTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterValidator (const UsdValidatorMetadata &metadata, const UsdValidateStageTaskFn &stageTaskFn) |
Register UsdValidator using metadata and stageTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterValidator (const UsdValidatorMetadata &metadata, const UsdValidatePrimTaskFn &primTaskFn) |
Register UsdValidator using metadata and primTaskFn with the UsdValidationRegistry. | |
| USD_API void | RegisterPluginValidatorSuite (const TfToken &validatorSuiteName, const std::vector< const UsdValidator * > &containedValidators) |
Register UsdValidatorSuite defined in a plugin using validatorSuiteName and containedValidators with the UsdValidationRegistry. | |
| USD_API void | RegisterValidatorSuite (const UsdValidatorMetadata &metadata, const std::vector< const UsdValidator * > &containedValidators) |
Register UsdValidatorSuite using metadata and containedValidators with the UsdValidationRegistry. | |
| bool | HasValidator (const TfToken &validatorName) const |
Return true if a UsdValidator is registered with the name validatorName; false otherwise. | |
| bool | HasValidatorSuite (const TfToken &suiteName) const |
Return true if a UsdValidatorSuite is registered with the name validatorSuiteName; false otherwise. | |
| USD_API std::vector< const UsdValidator * > | GetOrLoadAllValidators () |
| Returns a vector of const pointer to UsdValidator corresponding to all validators registered in the UsdValidationRegistry. | |
| USD_API const UsdValidator * | GetOrLoadValidatorByName (const TfToken &validatorName) |
Returns a const pointer to UsdValidator if validatorName is found in the registry. | |
| USD_API std::vector< const UsdValidator * > | GetOrLoadValidatorsByName (const TfTokenVector &validatorNames) |
Returns a vector of const pointer to UsdValidator corresponding to validatorNames found in the registry. | |
| USD_API std::vector< const UsdValidatorSuite * > | GetOrLoadAllValidatorSuites () |
| Returns a vector of const pointer to UsdValidatorSuite corresponding to all validator suites registered in the UsdValidationRegistry. | |
| USD_API const UsdValidatorSuite * | GetOrLoadValidatorSuiteByName (const TfToken &suiteName) |
Returns a const pointer to UsdValidatorSuite if suiteName is found in the registry. | |
| USD_API std::vector< const UsdValidatorSuite * > | GetOrLoadValidatorSuitesByName (const TfTokenVector &suiteNames) |
Returns a vector of const pointer to UsdValidatorSuite corresponding to suiteNames found in the registry. | |
| USD_API bool | GetValidatorMetadata (const TfToken &name, UsdValidatorMetadata *metadata) const |
| Returns true if metadata is found in the _validatorNameToMetadata for a validator/suite name, false otherwise. | |
| USD_API UsdValidatorMetadataVector | GetAllValidatorMetadata () const |
| Return vector of all UsdValidatorMetadata known to the registry. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForPlugin (const TfToken &pluginName) const |
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginName. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForKeyword (const TfToken &keyword) const |
Returns vector of UsdValidatorMetadata associated with the Validators which has the keyword. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForSchemaType (const TfToken &schemaType) const |
Returns vector of UsdValidatorMetadata associated with the Validators which has the schemaType. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForPlugins (const TfTokenVector &pluginNames) const |
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginNames. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForKeywords (const TfTokenVector &keywords) const |
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the keywords. | |
| USD_API UsdValidatorMetadataVector | GetValidatorMetadataForSchemaTypes (const TfTokenVector &schemaTypes) const |
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the schameTypes. | |
Static Public Member Functions | |
| static USD_API UsdValidationRegistry & | GetInstance () |
Friends | |
| class | TfSingleton< UsdValidationRegistry > |
UsdValidationRegistry manages and provides access to UsdValidator / UsdValidatorSuite for USD Validation.
UsdValidationRegistry is a singleton class, which serves as a central registry to hold / own all validators and validatorSuites by their names. Both Core USD and client-provided validators are registered with the registry. Validators can be registered and retrieved dynamically, supporting complex validation scenarios across different modules or plugins.
Clients of USD can register validators either via plugin infrastructure, which results in lazy loading of the validators, or explicitly register validators in their code via appropriate APIs.
As discussed in UsdValidator, validators are associated with UsdValidateLayerTaskFn, UsdValidateStageTaskFn or UsdValidatePrimTaskFn, which govern how a layer, stage or a prim needs to be validated. UsdValidator / UsdValidatorSuite also have metadata, which can either be provided in the plugInfo.json when registering the validators via plugin mechanism, or by providing metadata field when registering validators.
Example of registering a validator named "StageMetadataValidator" with doc metadata using plufInfo.json:
The above example can then be registered in the plugin:
Clients can also register validators by explicitly providing UsdValidatorMetadata, instead of relying on plugInfo.json for the same. Though its recommended to use appropriate APIs when validator metadata is being provided in the plugInfo.json.
Example of validator registration by explicitly providing metadata, when its not available in the plugInfo.json:
Usage:
As shown above, UsdValidator or UsdValidatorSuite can be registered using specific metadata or names, and retrieved by their name. The registry also provides functionality to check the existence of a validator / suite, load validators / suites dynamically if they are not in the registry.
Clients can also retrieve metadata for validators associated with a specific plugin, keywords or schemaTypes, this can help clients filter out relevant validators they need to validate their context / scene.
Note that this class is designed to be thread-safe: Querying of validator metadata, registering new validator (hence mutating the registry) or retrieving previously registered validator are designed to be thread-safe.
Definition at line 142 of file validationRegistry.h.
| USD_API UsdValidatorMetadataVector GetAllValidatorMetadata | ( | ) | const |
Return vector of all UsdValidatorMetadata known to the registry.
|
inlinestatic |
Definition at line 148 of file validationRegistry.h.
| USD_API std::vector< const UsdValidator * > GetOrLoadAllValidators | ( | ) |
Returns a vector of const pointer to UsdValidator corresponding to all validators registered in the UsdValidationRegistry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Note that this call will load in many plugins which provide a UsdValidator, if not already loaded. Also note that returned validators will only include validators defined in plugins or any explicitly registered validators before this call.
| USD_API std::vector< const UsdValidatorSuite * > GetOrLoadAllValidatorSuites | ( | ) |
Returns a vector of const pointer to UsdValidatorSuite corresponding to all validator suites registered in the UsdValidationRegistry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Note that this call might load in many plugins which provide a UsdValidatorSuite, if not already loaded. Also note that returned suites will only include suites defined in plugins or any explicitly registered suites before this call.
| USD_API const UsdValidator * GetOrLoadValidatorByName | ( | const TfToken & | validatorName | ) |
Returns a const pointer to UsdValidator if validatorName is found in the registry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Returns a nullptr if no validator is found.
| USD_API std::vector< const UsdValidator * > GetOrLoadValidatorsByName | ( | const TfTokenVector & | validatorNames | ) |
Returns a vector of const pointer to UsdValidator corresponding to validatorNames found in the registry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Size of returned vector might be less than the size of the input validatorNames, in case of missing validators.
| USD_API const UsdValidatorSuite * GetOrLoadValidatorSuiteByName | ( | const TfToken & | suiteName | ) |
Returns a const pointer to UsdValidatorSuite if suiteName is found in the registry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Returns a nullptr if no validator is found.
| USD_API std::vector< const UsdValidatorSuite * > GetOrLoadValidatorSuitesByName | ( | const TfTokenVector & | suiteNames | ) |
Returns a vector of const pointer to UsdValidatorSuite corresponding to suiteNames found in the registry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Size of returned vector might be less than the size of the input suiteNames, in case of missing validators.
| USD_API bool GetValidatorMetadata | ( | const TfToken & | name, |
| UsdValidatorMetadata * | metadata | ||
| ) | const |
Returns true if metadata is found in the _validatorNameToMetadata for a validator/suite name, false otherwise.
metadata parameter is used as an out parameter here.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForKeyword | ( | const TfToken & | keyword | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which has the keyword.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForKeywords | ( | const TfTokenVector & | keywords | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the keywords.
The returned vector is a union of all UsdValidatorMetadata associated with the keywords.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForPlugin | ( | const TfToken & | pluginName | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginName.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForPlugins | ( | const TfTokenVector & | pluginNames | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginNames.
The returned vector is a union of all UsdValidatorMetadata associated with the plugins.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForSchemaType | ( | const TfToken & | schemaType | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which has the schemaType.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USD_API UsdValidatorMetadataVector GetValidatorMetadataForSchemaTypes | ( | const TfTokenVector & | schemaTypes | ) | const |
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the schameTypes.
The returned vector is a union of all UsdValidatorMetadata associated with the schemaTypes.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| bool HasValidator | ( | const TfToken & | validatorName | ) | const |
Return true if a UsdValidator is registered with the name validatorName; false otherwise.
| bool HasValidatorSuite | ( | const TfToken & | suiteName | ) | const |
Return true if a UsdValidatorSuite is registered with the name validatorSuiteName; false otherwise.
| USD_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidateLayerTaskFn & | layerTaskFn | ||
| ) |
Register UsdValidator defined in a plugin using validatorName and layerTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidatePrimTaskFn & | primTaskFn | ||
| ) |
Register UsdValidator defined in a plugin using validatorName and primTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidateStageTaskFn & | stageTaskFn | ||
| ) |
Register UsdValidator defined in a plugin using validatorName and stageTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterPluginValidatorSuite | ( | const TfToken & | validatorSuiteName, |
| const std::vector< const UsdValidator * > & | containedValidators | ||
| ) |
Register UsdValidatorSuite defined in a plugin using validatorSuiteName and containedValidators with the UsdValidationRegistry.
Here validatorSuiteName should include the name of the plugin the validator belongs to, delimited by ":".
Note UsdValidatorMetadata::isSuite must be set to true in the plugInfo, else the validatorSuite will not be registered.
Note calling RegisterPluginValidatorSuite with a validatorSuiteName which is already registered will result in a coding error. HasValidatorSuite can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterValidator | ( | const UsdValidatorMetadata & | metadata, |
| const UsdValidateLayerTaskFn & | layerTaskFn | ||
| ) |
Register UsdValidator using metadata and layerTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterValidator | ( | const UsdValidatorMetadata & | metadata, |
| const UsdValidatePrimTaskFn & | primTaskFn | ||
| ) |
Register UsdValidator using metadata and primTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterValidator | ( | const UsdValidatorMetadata & | metadata, |
| const UsdValidateStageTaskFn & | stageTaskFn | ||
| ) |
Register UsdValidator using metadata and stageTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USD_API void RegisterValidatorSuite | ( | const UsdValidatorMetadata & | metadata, |
| const std::vector< const UsdValidator * > & | containedValidators | ||
| ) |
Register UsdValidatorSuite using metadata and containedValidators with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a suite and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note UsdValidatorMetadata::isSuite must be set to true in the plugInfo, else the validatorSuite will not be registered.
Note calling RegisterPluginValidatorSuite with a validatorSuiteName which is already registered will result in a coding error. HasValidatorSuite can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
|
friend |
Definition at line 480 of file validationRegistry.h.