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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 /* ************************************************************************** */
27 /* ** This file is generated by a script. Do not edit directly. Edit ** */
28 /* ** defs.py or the (*)Schema.template.h files to make changes. ** */
29 /* ************************************************************************** */
30 
31 #ifndef PXR_IMAGING_HDAR_SYSTEM_SCHEMA_H
32 #define PXR_IMAGING_HDAR_SYSTEM_SCHEMA_H
33 
34 #include "pxr/imaging/hdar/api.h"
35 
36 #include "pxr/imaging/hd/schema.h"
37 
39 
41 
42 //-----------------------------------------------------------------------------
43 
44 #define HDARSYSTEM_SCHEMA_TOKENS \
45  (assetResolution) \
46  (resolverContext) \
47 
48 TF_DECLARE_PUBLIC_TOKENS(HdarSystemSchemaTokens, HDAR_API,
50 
51 //-----------------------------------------------------------------------------
52 
54 
55 /// The HdarSystemSchema specifies a container that will hold "system"
56 /// data that is relevant to asset resolution.
57 class HdarSystemSchema : public HdSchema
58 {
59 public:
60  HdarSystemSchema(HdContainerDataSourceHandle container)
61  : HdSchema(container) {}
62 
63  //ACCESSORS
64 
65  HDAR_API
67 
68  // RETRIEVING AND CONSTRUCTING
69 
70  /// Builds a container data source which includes the provided child data
71  /// sources. Parameters with nullptr values are excluded. This is a
72  /// low-level interface. For cases in which it's desired to define
73  /// the container with a sparse set of child fields, the Builder class
74  /// is often more convenient and readable.
75  HDAR_API
76  static HdContainerDataSourceHandle
78  const HdResolverContextDataSourceHandle &resolverContext
79  );
80 
81  /// \class HdarSystemSchema::Builder
82  ///
83  /// Utility class for setting sparse sets of child data source fields to be
84  /// filled as arguments into BuildRetained. Because all setter methods
85  /// return a reference to the instance, this can be used in the "builder
86  /// pattern" form.
87  class Builder
88  {
89  public:
90  HDAR_API
92  const HdResolverContextDataSourceHandle &resolverContext);
93 
94  /// Returns a container data source containing the members set thus far.
95  HDAR_API
96  HdContainerDataSourceHandle Build();
97 
98  private:
99  HdResolverContextDataSourceHandle _resolverContext;
100  };
101 
102  /// Evaluates the asset resolution "system" data source for \p fromPath.
103  ///
104  /// If found, the return value will be non-null and \p foundAtPath
105  /// will contain the path at which the non-null result was found.
106  /// Otherwise, this returns null.
107  ///
108  /// This operation will be linear in the length of \p fromPath.
109  HD_API
110  static HdContainerDataSourceHandle GetFromPath(
111  HdSceneIndexBaseRefPtr const &inputScene,
112  SdfPath const &fromPath,
113  SdfPath *foundAtPath);
114 
115  /// Retrieves a container data source with the schema's default name token
116  /// "assetResolution" from the parent container and constructs a
117  /// HdarSystemSchema instance.
118  /// Because the requested container data source may not exist, the result
119  /// should be checked with IsDefined() or a bool comparison before use.
120  HDAR_API
122  const HdContainerDataSourceHandle &fromParentContainer);
123 
124  /// Returns a token where the container representing this schema is found in
125  /// a container by default.
126  HDAR_API
127  static const TfToken &GetSchemaToken();
128 
129  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
130  /// where the container representing this schema is found by default.
131  HDAR_API
132  static const HdDataSourceLocator &GetDefaultLocator();
133 
134 };
135 
137 
138 #endif
HDAR_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
#define HD_API
Definition: api.h:40
TF_DECLARE_PUBLIC_TOKENS(HdSystemSchemaTokens, HD_API, HDSYSTEM_SCHEMA_TOKENS)
static HDAR_API const TfToken & GetSchemaToken()
HDAR_API HdResolverContextDataSourceHandle GetResolverContext()
static HDAR_API HdarSystemSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HDAR_API HdContainerDataSourceHandle BuildRetained(const HdResolverContextDataSourceHandle &resolverContext)
Definition: token.h:87
static HD_API HdContainerDataSourceHandle GetFromPath(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, SdfPath *foundAtPath)
Definition: path.h:291
HdResolverContextDataSource::Handle HdResolverContextDataSourceHandle
HdarSystemSchema(HdContainerDataSourceHandle container)
Definition: systemSchema.h:60
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
TF_DECLARE_REF_PTRS(HdSceneIndexBase)
HDAR_API Builder & SetResolverContext(const HdResolverContextDataSourceHandle &resolverContext)
#define HDARSYSTEM_SCHEMA_TOKENS
Definition: systemSchema.h:44
static HDAR_API const HdDataSourceLocator & GetDefaultLocator()
#define HDAR_API
Definition: api.h:40