HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
registry.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_VALIDATION_USD_VALIDATION_REGISTRY_H
8 #define PXR_USD_VALIDATION_USD_VALIDATION_REGISTRY_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/base/tf/singleton.h"
14 
15 #include <memory>
16 #include <shared_mutex>
17 #include <unordered_map>
18 
19 /// \file
20 
22 
23 /// \class UsdValidationRegistry
24 ///
25 /// UsdValidationRegistry manages and provides access to UsdValidationValidator
26 /// / UsdValidationValidatorSuite for USD Validation.
27 ///
28 /// UsdValidationRegistry is a singleton class, which serves as a central
29 /// registry to hold / own all validators and validatorSuites by their names.
30 /// UsdValidationRegistry is also immortal and its singleton instance is never
31 /// destroyed. This is to ensure that all validators and suites registered with
32 /// the registry are available throughout the lifetime of the application.
33 ///
34 /// Both Core USD and client-provided validators are registered with the
35 /// registry. Validators can be registered and retrieved dynamically, supporting
36 /// complex validation scenarios across different modules or plugins.
37 ///
38 /// Clients of USD can register validators either via plugin infrastructure,
39 /// which results in lazy loading of the validators, or explicitly register
40 /// validators in their code via appropriate APIs.
41 ///
42 /// As discussed in UsdValidationValidator, validators are associated with
43 /// UsdValidateLayerTaskFn, UsdValidateStageTaskFn or UsdValidatePrimTaskFn,
44 /// which govern how a layer, stage or a prim needs to be validated.
45 /// UsdValidationValidator / UsdValidationValidatorSuite also have metadata,
46 /// which can either be provided in the plugInfo.json when registering the
47 /// validators via plugin mechanism, or by providing metadata field when
48 /// registering validators.
49 ///
50 /// Example of registering a validator named "StageMetadataValidator" with
51 /// doc metadata using plufInfo.json:
52 ///
53 /// \code
54 /// {
55 /// "Plugins": [
56 /// {
57 /// "Info": {
58 /// "Name": "usd"
59 /// "LibraryPath": "@PLUG_INFO_LIBRARY_PATH",
60 /// ....
61 /// ....
62 /// ....
63 /// "Validators": {
64 /// "keywords" : ["UsdCoreValidators"],
65 /// ...
66 /// "StageMetadataValidator": {
67 /// "doc": "Validates stage metadata."
68 /// },
69 /// ...
70 /// ...
71 /// ...
72 /// }
73 /// }
74 /// } ]
75 /// }
76 /// \endcode
77 ///
78 /// The above example can then be registered in the plugin:
79 ///
80 /// ```cpp
81 /// TF_REGISTRY_FUNCTION(UsdValidationRegistry)
82 /// {
83 /// UsdValidationRegistry& registry = UsdValidationRegistry::GetInstance();
84 /// const TfToken validatorName("usdValidation:StageMetadataValidator");
85 /// const UsdValidateStageTaskFn stageTaskFn =
86 /// [](const UsdStagePtr &usdStage,
87 /// const UsdValidationTimeRange &timeRange) {
88 /// UsdValidationErrorVector errors;
89 /// if (!usdStage->GetDefaultPrim()) {
90 /// errors.emplace_back(UsdValidationErrorType::Error,
91 /// {UsdValidationErrorSite(usdStage, SdfPath("/"))},
92 /// "Stage has missing or invalid defaultPrim.");
93 /// }
94 /// if (!usdStage->HasAuthoredMetadata(
95 /// UsdGeomTokens->metersPerUnit)) {
96 /// errors.emplace_back(UsdValidationErrorType::Error,
97 /// {UsdValidationErrorSite(usdStage, SdfPath("/"))},
98 /// "Stage does not specify its linear scale in "
99 /// "metersPerUnit.");
100 /// }
101 /// if (!usdStage->HasAuthoredMetadata(
102 /// UsdGeomTokens->upAxis)) {
103 /// errors.emplace_back(UsdValidationErrorType::Error,
104 /// {UsdValidationErrorSite(usdStage, SdfPath("/"))},
105 /// "Stage does not specify an upAxis.");
106 /// }
107 /// return errors;
108 /// };
109 /// registry.RegisterPluginValidator(validatorName, stageTaskFn);
110 /// }
111 /// ```
112 ///
113 /// Clients can also register validators by explicitly providing
114 /// UsdValidationValidatorMetadata, instead of relying on plugInfo.json for the
115 /// same. Though its recommended to use appropriate APIs when validator metadata
116 /// is being provided in the plugInfo.json.
117 ///
118 /// Example of validator registration by explicitly providing metadata, when its
119 /// not available in the plugInfo.json:
120 ///
121 /// ```cpp
122 /// {
123 /// UsdValidationRegistry& registry = UsdValidationRegistry::GetInstance();
124 /// const UsdValidationValidatorMetadata &metadata =
125 /// GetMetadataToBeRegistered(); const UsdValidateLayerTaskFn &layerTask =
126 /// GetLayerTaskForValidator(); registry.RegisterValidator(metadata,
127 /// layerTask);
128 /// }
129 /// ```
130 ///
131 /// Usage:
132 ///
133 /// As shown above, UsdValidationValidator or UsdValidationValidatorSuite can be
134 /// registered using specific metadata or names, and retrieved by their name.
135 /// The registry also provides functionality to check the existence of a
136 /// validator / suite, load validators / suites dynamically if they are not in
137 /// the registry.
138 ///
139 /// Clients can also retrieve metadata for validators associated with a
140 /// specific plugin, keywords or schemaTypes, this can help clients filter out
141 /// relevant validators they need to validate their context / scene.
142 ///
143 /// Note that this class is designed to be thread-safe:
144 /// Querying of validator metadata, registering new validator (hence mutating
145 /// the registry) or retrieving previously registered validator are designed to
146 /// be thread-safe.
147 ///
148 /// \sa UsdValidationValidator
149 /// \sa UsdValidationValidatorSuite
151 {
153  UsdValidationRegistry &operator=(const UsdValidationRegistry &) = delete;
154 
155 public:
158  {
160  }
161 
162  /// Register UsdValidationValidator defined in a plugin using \p
163  /// validatorName and \p layerTaskFn with the UsdValidationRegistry.
164  ///
165  /// Here \p validatorName should include the name of the plugin the
166  /// validator belongs to, delimited by ":".
167  ///
168  /// Note calling RegisterPluginValidator with a validatorName which is
169  /// already registered will result in a coding error. HasValidator can be
170  /// used to determine if a validator is already registered and associated
171  /// with validatorName.
172  ///
173  /// Also note any other failure to register a validator results in a coding
174  /// error.
175  ///
176  /// \sa HasValidator
178  void RegisterPluginValidator(const TfToken &validatorName,
179  const UsdValidateLayerTaskFn &layerTaskFn);
180 
181  /// Register UsdValidationValidator defined in a plugin using \p
182  /// validatorName and \p stageTaskFn with the UsdValidationRegistry.
183  ///
184  /// Here \p validatorName should include the name of the plugin the
185  /// validator belongs to, delimited by ":".
186  ///
187  /// Note calling RegisterPluginValidator with a validatorName which is
188  /// already registered will result in a coding error. HasValidator can be
189  /// used to determine if a validator is already registered and associated
190  /// with validatorName.
191  ///
192  /// Also note any other failure to register a validator results in a coding
193  /// error.
194  ///
195  /// \sa HasValidator
197  void RegisterPluginValidator(const TfToken &validatorName,
198  const UsdValidateStageTaskFn &stageTaskFn);
199 
200  /// Register UsdValidationValidator defined in a plugin using \p
201  /// validatorName and \p primTaskFn with the UsdValidationRegistry.
202  ///
203  /// Here \p validatorName should include the name of the plugin the
204  /// validator belongs to, delimited by ":".
205  ///
206  /// Note calling RegisterPluginValidator with a validatorName which is
207  /// already registered will result in a coding error. HasValidator can be
208  /// used to determine if a validator is already registered and associated
209  /// with validatorName.
210  ///
211  /// Also note any other failure to register a validator results in a coding
212  /// error.
213  ///
214  /// \sa HasValidator
216  void RegisterPluginValidator(const TfToken &validatorName,
217  const UsdValidatePrimTaskFn &primTaskFn);
218 
219  /// Register UsdValidationValidator using \p metadata and \p layerTaskFn
220  /// with the UsdValidationRegistry.
221  ///
222  /// Clients can explicitly provide validator metadata, which is then used to
223  /// register a validator and associate it with name metadata. The metadata
224  /// here is not specified in a plugInfo.
225  ///
226  /// Note calling RegisterValidator with a validator name which is already
227  /// registered will result in a coding error. HasValidator can be used to
228  /// determine if a validator is already registered and associated with
229  /// validatorName.
230  ///
231  /// Also note any other failure to register a validator results in a coding
232  /// error.
233  ///
234  /// \sa HasValidator
237  const UsdValidateLayerTaskFn &layerTaskFn);
238 
239  /// Register UsdValidationValidator using \p metadata and \p stageTaskFn
240  /// with the UsdValidationRegistry.
241  ///
242  /// Clients can explicitly provide validator metadata, which is then used to
243  /// register a validator and associate it with name metadata. The metadata
244  /// here is not specified in a plugInfo.
245  ///
246  /// Note calling RegisterValidator with a validator name which is already
247  /// registered will result in a coding error. HasValidator can be used to
248  /// determine if a validator is already registered and associated with
249  /// validatorName.
250  ///
251  /// Also note any other failure to register a validator results in a coding
252  /// error.
253  ///
254  /// \sa HasValidator
257  const UsdValidateStageTaskFn &stageTaskFn);
258 
259  /// Register UsdValidationValidator using \p metadata and \p primTaskFn
260  /// with the UsdValidationRegistry.
261  ///
262  /// Clients can explicitly provide validator metadata, which is then used to
263  /// register a validator and associate it with name metadata. The metadata
264  /// here is not specified in a plugInfo.
265  ///
266  /// Note calling RegisterValidator with a validator name which is already
267  /// registered will result in a coding error. HasValidator can be used to
268  /// determine if a validator is already registered and associated with
269  /// validatorName.
270  ///
271  /// Also note any other failure to register a validator results in a coding
272  /// error.
273  ///
274  /// \sa HasValidator
277  const UsdValidatePrimTaskFn &primTaskFn);
278 
279  /// Register UsdValidationValidatorSuite defined in a plugin using
280  /// \p validatorSuiteName and \p containedValidators with the
281  /// UsdValidationRegistry.
282  ///
283  /// Here \p validatorSuiteName should include the name of the plugin the
284  /// validator belongs to, delimited by ":".
285  ///
286  /// Note UsdValidationValidatorMetadata::isSuite must be set to true in the
287  /// plugInfo, else the validatorSuite will not be registered.
288  ///
289  /// Note calling RegisterPluginValidatorSuite with a validatorSuiteName
290  /// which is already registered will result in a coding error.
291  /// HasValidatorSuite can be used to determine if a validator is already
292  /// registered and associated with validatorName.
293  ///
294  /// Also note any other failure to register a validator results in a coding
295  /// error.
296  ///
297  /// \sa HasValidatorSuite
300  const TfToken &validatorSuiteName,
301  const std::vector<const UsdValidationValidator *> &containedValidators);
302 
303  /// Register UsdValidationValidatorSuite using \p metadata and
304  /// \p containedValidators with the UsdValidationRegistry.
305  ///
306  /// Clients can explicitly provide validator metadata, which is then used to
307  /// register a suite and associate it with name metadata. The metadata
308  /// here is not specified in a plugInfo.
309  ///
310  /// Note UsdValidationValidatorMetadata::isSuite must be set to true in the
311  /// plugInfo, else the validatorSuite will not be registered.
312  ///
313  /// Note calling RegisterPluginValidatorSuite with a validatorSuiteName
314  /// which is already registered will result in a coding error.
315  /// HasValidatorSuite can be used to determine if a validator is already
316  /// registered and associated with validatorName.
317  ///
318  /// Also note any other failure to register a validator results in a coding
319  /// error.
320  ///
321  /// \sa HasValidatorSuite
324  const UsdValidationValidatorMetadata &metadata,
325  const std::vector<const UsdValidationValidator *> &containedValidators);
326 
327  /// Return true if a UsdValidationValidator is registered with the name \p
328  /// validatorName; false otherwise.
330  bool HasValidator(const TfToken &validatorName) const;
331 
332  /// Return true if a UsdValidationValidatorSuite is registered with the name
333  /// \p validatorSuiteName; false otherwise.
335  bool HasValidatorSuite(const TfToken &suiteName) const;
336 
337  /// Returns a vector of const pointer to UsdValidationValidator
338  /// corresponding to all validators registered in the UsdValidationRegistry.
339  ///
340  /// If a validator is not found in the registry, this method will load
341  /// appropriate plugins, if the validator is made available via a plugin.
342  ///
343  /// Note that this call will load in many plugins which provide a
344  /// UsdValidationValidator, if not already loaded. Also note that returned
345  /// validators will only include validators defined in plugins or any
346  /// explicitly registered validators before this call.
348  std::vector<const UsdValidationValidator *> GetOrLoadAllValidators();
349 
350  /// Returns a const pointer to UsdValidationValidator if \p validatorName is
351  /// found in the registry.
352  ///
353  /// If a validator is not found in the registry, this method will load
354  /// appropriate plugins, if the validator is made available via a plugin.
355  ///
356  /// Returns a nullptr if no validator is found.
358  const UsdValidationValidator *
359  GetOrLoadValidatorByName(const TfToken &validatorName);
360 
361  /// Returns a vector of const pointer to UsdValidationValidator
362  /// corresponding to \p validatorNames found in the registry.
363  ///
364  /// If a validator is not found in the registry, this method will load
365  /// appropriate plugins, if the validator is made available via a plugin.
366  ///
367  /// Size of returned vector might be less than the size of the input
368  /// validatorNames, in case of missing validators.
370  std::vector<const UsdValidationValidator *>
371  GetOrLoadValidatorsByName(const TfTokenVector &validatorNames);
372 
373  /// Returns a vector of const pointer to UsdValidationValidatorSuite
374  /// corresponding to all validator suites registered in the
375  /// UsdValidationRegistry.
376  ///
377  /// If a suite is not found in the registry, this method will load
378  /// appropriate plugins, if the suite is made available via a plugin.
379  ///
380  /// Note that this call might load in many plugins which provide a
381  /// UsdValidationValidatorSuite, if not already loaded. Also note that
382  /// returned suites will only include suites defined in plugins or any
383  /// explicitly registered suites before this call.
385  std::vector<const UsdValidationValidatorSuite *>
387 
388  /// Returns a const pointer to UsdValidationValidatorSuite if \p suiteName
389  /// is found in the registry.
390  ///
391  /// If a suite is not found in the registry, this method will load
392  /// appropriate plugins, if the suite is made available via a plugin.
393  ///
394  /// Returns a nullptr if no validator is found.
397  GetOrLoadValidatorSuiteByName(const TfToken &suiteName);
398 
399  /// Returns a vector of const pointer to UsdValidationValidatorSuite
400  /// corresponding to \p suiteNames found in the registry.
401  ///
402  /// If a suite is not found in the registry, this method will load
403  /// appropriate plugins, if the suite is made available via a plugin.
404  ///
405  /// Size of returned vector might be less than the size of the input
406  /// suiteNames, in case of missing validators.
408  std::vector<const UsdValidationValidatorSuite *>
410 
411  /// Returns true if metadata is found in the _validatorNameToMetadata for
412  /// a validator/suite name, false otherwise.
413  ///
414  /// \p metadata parameter is used as an out parameter here.
416  bool GetValidatorMetadata(const TfToken &name,
417  UsdValidationValidatorMetadata *metadata) const;
418 
419  /// Return vector of all UsdValidationValidatorMetadata known to the
420  /// registry
423 
424  /// Returns vector of UsdValidationValidatorMetadata associated with the
425  /// Validators which belong to the \p pluginName.
426  ///
427  /// This API can be used to curate a vector of validator metadata, that
428  /// clients may want to load and use in their validation context.
429  ///
430  /// Note that this method does not result in any plugins to be loaded.
433  GetValidatorMetadataForPlugin(const TfToken &pluginName) const;
434 
435  /// Returns vector of UsdValidationValidatorMetadata associated with the
436  /// Validators which has the \p keyword.
437  ///
438  /// This API can be used to curate a vector of validator metadata, that
439  /// clients may want to load and use in their validation context.
440  ///
441  /// Note that this method does not result in any plugins to be loaded.
444  GetValidatorMetadataForKeyword(const TfToken &keyword) const;
445 
446  /// Returns vector of UsdValidationValidatorMetadata associated with the
447  /// Validators which has the \p schemaType.
448  ///
449  /// This API can be used to curate a vector of validator metadata, that
450  /// clients may want to load and use in their validation context.
451  ///
452  /// Note that this method does not result in any plugins to be loaded.
455  GetValidatorMetadataForSchemaType(const TfToken &schemaType) const;
456 
457  /// Returns vector of UsdValidationValidatorMetadata associated with the
458  /// Validators which belong to the \p pluginNames.
459  ///
460  /// The returned vector is a union of all UsdValidationValidatorMetadata
461  /// associated with the plugins.
462  ///
463  /// This API can be used to curate a vector of validator metadata, that
464  /// clients may want to load and use in their validation context.
465  ///
466  /// Note that this method does not result in any plugins to be loaded.
469  GetValidatorMetadataForPlugins(const TfTokenVector &pluginNames) const;
470 
471  /// Returns vector of UsdValidationValidatorMetadata associated with the
472  /// Validators which has at least one of the \p keywords.
473  ///
474  /// The returned vector is a union of all UsdValidationValidatorMetadata
475  /// associated with the keywords.
476  ///
477  /// This API can be used to curate a vector of validator metadata, that
478  /// clients may want to load and use in their validation context.
479  ///
480  /// Note that this method does not result in any plugins to be loaded.
483  GetValidatorMetadataForKeywords(const TfTokenVector &keywords) const;
484 
485  /// Returns vector of UsdValidationValidatorMetadata associated with the
486  /// Validators which has at least one of the \p schameTypes.
487  ///
488  /// The returned vector is a union of all UsdValidationValidatorMetadata
489  /// associated with the schemaTypes.
490  ///
491  /// This API can be used to curate a vector of validator metadata, that
492  /// clients may want to load and use in their validation context.
493  ///
494  /// Note that this method does not result in any plugins to be loaded.
497  GetValidatorMetadataForSchemaTypes(const TfTokenVector &schemaTypes) const;
498 
499 private:
501 
503 
504  // Initialize _validatorNameToMetadata, _keywordToValidatorNames and
505  // _schemaTypeToValidatorNames by parsing all plugInfo.json, find all
506  // Validators.
507  void _PopulateMetadataFromPlugInfo();
508 
509  // Templated method to register validator, called by appropriate
510  // RegisterValidator methods, providing UsdValidateLayerTaskFn,
511  // UsdValidateStageTaskFn or UsdValidatePrimTaskFn.
512  template <typename ValidateTaskFn>
513  void _RegisterPluginValidator(const TfToken &validatorName,
514  const ValidateTaskFn &taskFn);
515 
516  // Overloaded templated _RegisterValidator, where metadata is explicitly
517  // provided.
518  template <typename ValidateTaskFn>
519  void _RegisterValidator(const UsdValidationValidatorMetadata &metadata,
520  const ValidateTaskFn &taskFn,
521  bool addMetadata = true);
522 
523  void _RegisterValidatorSuite(
524  const UsdValidationValidatorMetadata &metadata,
525  const std::vector<const UsdValidationValidator *> &containedValidators,
526  bool addMetadata = true);
527 
528  // makes sure metadata provided is legal
529  // checkForPrimTask parameter is used to determine if schemaTypes metadata
530  // is provided and if the task being registered for the validator is
531  // UsdValidatePrimTaskFn.
532  // expectSuite parameter is used to determine if the isSuite metadata is
533  // appropriately set (for UsdValidationValidatorSuite) or not (for
534  // UsdValidationValidator).
535  static bool _CheckMetadata(const UsdValidationValidatorMetadata &metadata,
536  bool checkForPrimTask, bool expectSuite = false);
537 
538  // Add validator metadata to _validatorNameToMetadata, also updates
539  // _schemaTypeToValidatorNames and _keywordToValidatorNames, for easy access
540  // to what validators are linked to specific schemaTypes or keywords.
541  // _mutex must be acquired before calling this method.
542  bool _AddValidatorMetadata(const UsdValidationValidatorMetadata &metadata);
543 
544  using _ValidatorNameToValidatorMap
545  = std::unordered_map<TfToken, std::unique_ptr<UsdValidationValidator>,
547  using _ValidatorSuiteNameToValidatorSuiteMap
548  = std::unordered_map<TfToken,
549  std::unique_ptr<UsdValidationValidatorSuite>,
551  using _ValidatorNameToMetadataMap
552  = std::unordered_map<TfToken, UsdValidationValidatorMetadata,
554  using _TokenToValidatorNamesMap
555  = std::unordered_map<TfToken, TfTokenVector, TfToken::HashFunctor>;
556 
557  // Helper to query
558  UsdValidationValidatorMetadataVector _GetValidatorMetadataForToken(
559  const _TokenToValidatorNamesMap &tokenToValidatorNames,
560  const TfTokenVector &tokens) const;
561 
562  // Helper to populate _keywordToValidatorNames and
563  // _schemaTypeToValidatorNames
564  // _mutex must be acquired before calling this method.
565  static void
566  _UpdateValidatorNamesMappings(_TokenToValidatorNamesMap &tokenMap,
567  const TfToken &validatorName,
568  const TfTokenVector &tokens);
569 
570  // Main datastructure which holds validatorName to
571  // std::unique_ptr<UsdValidationValidator>
572  _ValidatorNameToValidatorMap _validators;
573  // Main datastructure which holds suiteName to
574  // std::unique_ptr<UsdValidationValidatorSuite>
575  _ValidatorSuiteNameToValidatorSuiteMap _validatorSuites;
576 
577  // ValidatorName to ValidatorMetadata map
578  _ValidatorNameToMetadataMap _validatorNameToMetadata;
579 
580  // Following 3 are helper data structures to easy lookup for Validators,
581  // when queried for keywords, schemaType or pluginName.
582 
583  // This map stores the mapping from keyword to validator names. It may get
584  // updated as validators can be registered dynamically outside of the plugin
585  // infrastructure.
586  _TokenToValidatorNamesMap _keywordToValidatorNames;
587 
588  // This map stores the mapping from schemaTypes to validator names. It may
589  // get updated as validators can be registered dynamically outside of the
590  // plugin infrastructure.
591  _TokenToValidatorNamesMap _schemaTypeToValidatorNames;
592 
593  // This map stores the mapping from plugin names to validator names.
594  // It is populated during the initialization of UsdValidationRegistry
595  // and remains constant thereafter.
596  _TokenToValidatorNamesMap _pluginNameToValidatorNames;
597 
598  // Mutex to protect access to all data members.
599  mutable std::shared_mutex _mutex;
600 };
601 
602 // Specialize and delete the DeleteInstance function to prevent destruction.
603 // This will prevent the singleton instance for UsdValidationRegistry from
604 // being destroyed and hence making it immortal.
605 template <> void TfSingleton<UsdValidationRegistry>::DeleteInstance() = delete;
606 
608 
610 
611 #endif // PXR_USD_VALIDATION_USD_VALIDATION_REGISTRY_H
USDVALIDATION_API std::vector< const UsdValidationValidator * > GetOrLoadAllValidators()
static T & GetInstance()
Definition: singleton.h:120
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForKeywords(const TfTokenVector &keywords) const
USDVALIDATION_API_TEMPLATE_CLASS(TfSingleton< UsdValidationRegistry >)
std::vector< UsdValidationValidatorMetadata > UsdValidationValidatorMetadataVector
Definition: validator.h:91
USDVALIDATION_API UsdValidationValidatorMetadataVector GetAllValidatorMetadata() const
USDVALIDATION_API const UsdValidationValidator * GetOrLoadValidatorByName(const TfToken &validatorName)
static USDVALIDATION_API UsdValidationRegistry & GetInstance()
Definition: registry.h:157
USDVALIDATION_API void RegisterValidator(const UsdValidationValidatorMetadata &metadata, const UsdValidateLayerTaskFn &layerTaskFn)
Functor to use for hash maps from tokens to other things.
Definition: token.h:149
USDVALIDATION_API bool HasValidator(const TfToken &validatorName) const
std::function< UsdValidationErrorVector(const UsdStagePtr &, const UsdValidationTimeRange)> UsdValidateStageTaskFn
UsdValidateStageTaskFn: Validation logic operating on a given UsdStage.
Definition: validator.h:107
#define USDVALIDATION_API
Definition: api.h:25
std::function< UsdValidationErrorVector(const SdfLayerHandle &)> UsdValidateLayerTaskFn
UsdValidateLayerTaskFn: Validation logic operating on a given SdfLayerHandle.
Definition: validator.h:104
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForKeyword(const TfToken &keyword) const
USDVALIDATION_API void RegisterPluginValidator(const TfToken &validatorName, const UsdValidateLayerTaskFn &layerTaskFn)
Definition: token.h:70
USDVALIDATION_API void RegisterPluginValidatorSuite(const TfToken &validatorSuiteName, const std::vector< const UsdValidationValidator * > &containedValidators)
USDVALIDATION_API bool HasValidatorSuite(const TfToken &suiteName) const
USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > GetOrLoadAllValidatorSuites()
USDVALIDATION_API void RegisterValidatorSuite(const UsdValidationValidatorMetadata &metadata, const std::vector< const UsdValidationValidator * > &containedValidators)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
GLuint const GLchar * name
Definition: glcorearb.h:786
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForPlugin(const TfToken &pluginName) const
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForSchemaType(const TfToken &schemaType) const
USDVALIDATION_API bool GetValidatorMetadata(const TfToken &name, UsdValidationValidatorMetadata *metadata) const
USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > GetOrLoadValidatorSuitesByName(const TfTokenVector &suiteNames)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
std::function< UsdValidationErrorVector(const UsdPrim &, const UsdValidationTimeRange)> UsdValidatePrimTaskFn
UsdValidatePrimTaskFn: Validation logic operating on a given UsdPrim.
Definition: validator.h:110
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDVALIDATION_API std::vector< const UsdValidationValidator * > GetOrLoadValidatorsByName(const TfTokenVector &validatorNames)
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForSchemaTypes(const TfTokenVector &schemaTypes) const
USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForPlugins(const TfTokenVector &pluginNames) const
static void DeleteInstance()
USDVALIDATION_API const UsdValidationValidatorSuite * GetOrLoadValidatorSuiteByName(const TfToken &suiteName)