HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
systemSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_IMAGING_HDAR_SYSTEM_SCHEMA_H
19 #define PXR_IMAGING_HDAR_SYSTEM_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hdar/api.h"
24 
25 #include "pxr/imaging/hd/schema.h"
26 
27 // --(BEGIN CUSTOM CODE: Includes)--
29 // --(END CUSTOM CODE: Includes)--
30 
32 
33 // --(BEGIN CUSTOM CODE: Declares)--
35 // --(END CUSTOM CODE: Declares)--
36 
37 #define HDAR_SYSTEM_SCHEMA_TOKENS \
38  (assetResolution) \
39  (resolverContext) \
40 
41 TF_DECLARE_PUBLIC_TOKENS(HdarSystemSchemaTokens, HDAR_API,
43 
44 //-----------------------------------------------------------------------------
45 
46 // The HdarSystemSchema specifies a container that will hold "system" data
47 // that is relevant to asset resolution.
48 //
49 
50 class HdarSystemSchema : public HdSchema
51 {
52 public:
53  /// \name Schema retrieval
54  /// @{
55 
56  HdarSystemSchema(HdContainerDataSourceHandle container)
57  : HdSchema(container) {}
58 
59  /// Retrieves a container data source with the schema's default name token
60  /// "assetResolution" from the parent container and constructs a
61  /// HdarSystemSchema instance.
62  /// Because the requested container data source may not exist, the result
63  /// should be checked with IsDefined() or a bool comparison before use.
64  HDAR_API
66  const HdContainerDataSourceHandle &fromParentContainer);
67 
68  /// @}
69 
70 // --(BEGIN CUSTOM CODE: Schema Methods)--
71 
72  /// Evaluates the asset resolution "system" data source for \p fromPath.
73  ///
74  /// If found, the return value will be non-null and \p foundAtPath
75  /// will contain the path at which the non-null result was found.
76  /// Otherwise, this returns null.
77  ///
78  /// This operation will be linear in the length of \p fromPath.
79  HDAR_API
80  static HdContainerDataSourceHandle GetFromPath(
81  HdSceneIndexBaseRefPtr const &inputScene,
82  SdfPath const &fromPath,
83  SdfPath *foundAtPath);
84 
85 // --(END CUSTOM CODE: Schema Methods)--
86 
87  /// \name Member accessor
88  /// @{
89 
90  HDAR_API
92 
93  /// @}
94 
95  /// \name Schema location
96  /// @{
97 
98  /// Returns a token where the container representing this schema is found in
99  /// a container by default.
100  HDAR_API
101  static const TfToken &GetSchemaToken();
102 
103  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
104  /// where the container representing this schema is found by default.
105  HDAR_API
106  static const HdDataSourceLocator &GetDefaultLocator();
107 
108  /// @}
109 
110  /// \name Schema construction
111  /// @{
112 
113  /// \deprecated Use Builder instead.
114  ///
115  /// Builds a container data source which includes the provided child data
116  /// sources. Parameters with nullptr values are excluded. This is a
117  /// low-level interface. For cases in which it's desired to define
118  /// the container with a sparse set of child fields, the Builder class
119  /// is often more convenient and readable.
120  HDAR_API
121  static HdContainerDataSourceHandle
123  const HdResolverContextDataSourceHandle &resolverContext
124  );
125 
126  /// \class HdarSystemSchema::Builder
127  ///
128  /// Utility class for setting sparse sets of child data source fields to be
129  /// filled as arguments into BuildRetained. Because all setter methods
130  /// return a reference to the instance, this can be used in the "builder
131  /// pattern" form.
132  class Builder
133  {
134  public:
135  HDAR_API
137  const HdResolverContextDataSourceHandle &resolverContext);
138 
139  /// Returns a container data source containing the members set thus far.
140  HDAR_API
141  HdContainerDataSourceHandle Build();
142 
143  private:
144  HdResolverContextDataSourceHandle _resolverContext;
145 
146  };
147 
148  /// @}
149 };
150 
152 
153 #endif
HDAR_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_REF_PTRS(HdSceneIndexBase)
static HDAR_API const TfToken & GetSchemaToken()
static HDAR_API HdarSystemSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HDAR_API HdContainerDataSourceHandle BuildRetained(const HdResolverContextDataSourceHandle &resolverContext)
Definition: token.h:70
Definition: path.h:273
HdResolverContextDataSource::Handle HdResolverContextDataSourceHandle
#define HDAR_SYSTEM_SCHEMA_TOKENS
Definition: systemSchema.h:37
static HDAR_API HdContainerDataSourceHandle GetFromPath(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, SdfPath *foundAtPath)
HdarSystemSchema(HdContainerDataSourceHandle container)
Definition: systemSchema.h:56
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
TF_DECLARE_PUBLIC_TOKENS(HdSystemSchemaTokens, HD_API, HD_SYSTEM_SCHEMA_TOKENS)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDAR_API HdResolverContextDataSourceHandle GetResolverContext() const
HDAR_API Builder & SetResolverContext(const HdResolverContextDataSourceHandle &resolverContext)
static HDAR_API const HdDataSourceLocator & GetDefaultLocator()
#define HDAR_API
Definition: api.h:23