7#ifndef PXR_USD_USD_VALIDATION_REGISTRY_H
8#define PXR_USD_USD_VALIDATION_REGISTRY_H
11#include "pxr/usd/usd/api.h"
15#include <shared_mutex>
17#include <unordered_map>
21PXR_NAMESPACE_OPEN_SCOPE
294 const std::vector<const UsdValidator*>&
295 containedValidators);
318 const std::vector<const UsdValidator*>&
319 containedValidators);
363 std::vector<const UsdValidator*>
399 std::vector<const UsdValidatorSuite*>
423 const TfToken &pluginName)
const;
445 const TfToken &schemaType)
const;
497 void _PopulateMetadataFromPlugInfo();
502 template<
typename Val
idateTaskFn>
503 void _RegisterPluginValidator(
const TfToken &validatorName,
504 const ValidateTaskFn &taskFn);
508 template<
typename Val
idateTaskFn>
510 const ValidateTaskFn &taskFn,
bool addMetadata =
true);
513 const std::vector<const UsdValidator*>& containedValidators,
514 bool addMetadata =
true);
524 bool checkForPrimTask,
bool expectSuite =
false);
532 using _ValidatorNameToValidatorMap =
533 std::unordered_map<TfToken, std::unique_ptr<UsdValidator>,
535 using _ValidatorSuiteNameToValidatorSuiteMap =
536 std::unordered_map<TfToken, std::unique_ptr<UsdValidatorSuite>,
538 using _ValidatorNameToMetadataMap =
539 std::unordered_map<TfToken, UsdValidatorMetadata, TfToken::HashFunctor>;
540 using _TokenToValidatorNamesMap =
541 std::unordered_map<TfToken, TfTokenVector, TfToken::HashFunctor>;
544 UsdValidatorMetadataVector _GetValidatorMetadataForToken(
545 const _TokenToValidatorNamesMap &tokenToValidatorNames,
552 void _UpdateValidatorNamesMappings(_TokenToValidatorNamesMap &tokenMap,
557 _ValidatorNameToValidatorMap _validators;
560 _ValidatorSuiteNameToValidatorSuiteMap _validatorSuites;
563 _ValidatorNameToMetadataMap _validatorNameToMetadata;
571 _TokenToValidatorNamesMap _keywordToValidatorNames;
576 _TokenToValidatorNamesMap _schemaTypeToValidatorNames;
581 _TokenToValidatorNamesMap _pluginNameToValidatorNames;
584 mutable std::shared_mutex _mutex;
595PXR_NAMESPACE_CLOSE_SCOPE
Manage a single instance of an object (see.
static void DeleteInstance()
Destroy the sole instance object of type T, if it exists.
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
Token for efficient comparison, assignment, and hashing of known strings.
UsdValidationRegistry manages and provides access to UsdValidator / UsdValidatorSuite for USD Validat...
USD_API UsdValidatorMetadataVector GetValidatorMetadataForSchemaType(const TfToken &schemaType) const
Returns vector of UsdValidatorMetadata associated with the Validators which has the schemaType.
USD_API void RegisterValidator(const UsdValidatorMetadata &metadata, const UsdValidatePrimTaskFn &primTaskFn)
Register UsdValidator using metadata and primTaskFn with the UsdValidationRegistry.
USD_API std::vector< const UsdValidatorSuite * > GetOrLoadValidatorSuitesByName(const TfTokenVector &suiteNames)
Returns a vector of const pointer to UsdValidatorSuite corresponding to suiteNames found in the regis...
USD_API bool HasValidatorSuite(const TfToken &suiteName) const
Return true if a UsdValidatorSuite is registered with the name validatorSuiteName; false otherwise.
USD_API UsdValidatorMetadataVector GetValidatorMetadataForKeywords(const TfTokenVector &keywords) const
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the k...
USD_API void RegisterValidator(const UsdValidatorMetadata &metadata, const UsdValidateLayerTaskFn &layerTaskFn)
Register UsdValidator using metadata and layerTaskFn with the UsdValidationRegistry.
USD_API UsdValidatorMetadataVector GetValidatorMetadataForSchemaTypes(const TfTokenVector &schemaTypes) const
Returns vector of UsdValidatorMetadata associated with the Validators which has at least one of the s...
USD_API UsdValidatorMetadataVector GetValidatorMetadataForPlugin(const TfToken &pluginName) const
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginName.
USD_API UsdValidatorMetadataVector GetValidatorMetadataForPlugins(const TfTokenVector &pluginNames) const
Returns vector of UsdValidatorMetadata associated with the Validators which belong to the pluginNames...
USD_API bool GetValidatorMetadata(const TfToken &name, UsdValidatorMetadata *metadata) const
Returns true if metadata is found in the _validatorNameToMetadata for a validator/suite name,...
USD_API void RegisterValidatorSuite(const UsdValidatorMetadata &metadata, const std::vector< const UsdValidator * > &containedValidators)
Register UsdValidatorSuite using metadata and containedValidators with the UsdValidationRegistry.
USD_API UsdValidatorMetadataVector GetAllValidatorMetadata() const
Return vector of all UsdValidatorMetadata known to 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 regist...
USD_API void RegisterPluginValidatorSuite(const TfToken &validatorSuiteName, const std::vector< const UsdValidator * > &containedValidators)
Register UsdValidatorSuite defined in a plugin using validatorSuiteName and containedValidators with ...
USD_API void RegisterPluginValidator(const TfToken &validatorName, const UsdValidatePrimTaskFn &primTaskFn)
Register UsdValidator defined in a plugin using validatorName and primTaskFn with the UsdValidationRe...
USD_API void RegisterValidator(const UsdValidatorMetadata &metadata, const UsdValidateStageTaskFn &stageTaskFn)
Register UsdValidator using metadata and stageTaskFn with the UsdValidationRegistry.
USD_API void RegisterPluginValidator(const TfToken &validatorName, const UsdValidateLayerTaskFn &layerTaskFn)
Register UsdValidator defined in a plugin using validatorName and layerTaskFn with the UsdValidationR...
USD_API const UsdValidator * GetOrLoadValidatorByName(const TfToken &validatorName)
Returns a const pointer to UsdValidator if validatorName is found in the registry.
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 UsdValidator * > GetOrLoadAllValidators()
Returns a vector of const pointer to UsdValidator corresponding to all validators registered in the U...
USD_API std::vector< const UsdValidatorSuite * > GetOrLoadAllValidatorSuites()
Returns a vector of const pointer to UsdValidatorSuite corresponding to all validator suites register...
USD_API UsdValidatorMetadataVector GetValidatorMetadataForKeyword(const TfToken &keyword) const
Returns vector of UsdValidatorMetadata associated with the Validators which has the keyword.
USD_API bool HasValidator(const TfToken &validatorName) const
Return true if a UsdValidator is registered with the name validatorName; false otherwise.
USD_API void RegisterPluginValidator(const TfToken &validatorName, const UsdValidateStageTaskFn &stageTaskFn)
Register UsdValidator defined in a plugin using validatorName and stageTaskFn with the UsdValidationR...
UsdValidator is a class describing a single test.
UsdValidatorSuite acts like a suite for a collection of tests, which clients can use to bundle all te...
std::function< UsdValidationErrorVector(const UsdStagePtr &)> UsdValidateStageTaskFn
UsdValidateStageTaskFn: Validation logic operating on a given UsdStage.
std::function< UsdValidationErrorVector(const SdfLayerHandle &)> UsdValidateLayerTaskFn
UsdValidateLayerTaskFn: Validation logic operating on a given SdfLayerHandle.
std::function< UsdValidationErrorVector(const UsdPrim &)> UsdValidatePrimTaskFn
UsdValidatePrimTaskFn: Validation logic operating on a given UsdPrim.
Manage a single instance of an object.
Functor to use for hash maps from tokens to other things.
std::vector< TfToken > TfTokenVector
Convenience types.