HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
purposeSchema.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_HD_PURPOSE_SCHEMA_H
19 #define PXR_IMAGING_HD_PURPOSE_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
24 
25 #include "pxr/imaging/hd/schema.h"
26 
27 // --(BEGIN CUSTOM CODE: Includes)--
28 // --(END CUSTOM CODE: Includes)--
29 
31 
32 // --(BEGIN CUSTOM CODE: Declares)--
33 // --(END CUSTOM CODE: Declares)--
34 
35 #define HD_PURPOSE_SCHEMA_TOKENS \
36  (purpose) \
37 
38 TF_DECLARE_PUBLIC_TOKENS(HdPurposeSchemaTokens, HD_API,
40 
41 //-----------------------------------------------------------------------------
42 
43 
44 class HdPurposeSchema : public HdSchema
45 {
46 public:
47  /// \name Schema retrieval
48  /// @{
49 
50  HdPurposeSchema(HdContainerDataSourceHandle container)
51  : HdSchema(container) {}
52 
53  /// Retrieves a container data source with the schema's default name token
54  /// "purpose" from the parent container and constructs a
55  /// HdPurposeSchema instance.
56  /// Because the requested container data source may not exist, the result
57  /// should be checked with IsDefined() or a bool comparison before use.
58  HD_API
60  const HdContainerDataSourceHandle &fromParentContainer);
61 
62  /// @}
63 
64 // --(BEGIN CUSTOM CODE: Schema Methods)--
65 // --(END CUSTOM CODE: Schema Methods)--
66 
67  /// \name Member accessor
68  /// @{
69 
70  HD_API
72 
73  /// @}
74 
75  /// \name Schema location
76  /// @{
77 
78  /// Returns a token where the container representing this schema is found in
79  /// a container by default.
80  HD_API
81  static const TfToken &GetSchemaToken();
82 
83  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
84  /// where the container representing this schema is found by default.
85  HD_API
86  static const HdDataSourceLocator &GetDefaultLocator();
87 
88  /// @}
89 
90  /// \name Schema construction
91  /// @{
92 
93  /// \deprecated Use Builder instead.
94  ///
95  /// Builds a container data source which includes the provided child data
96  /// sources. Parameters with nullptr values are excluded. This is a
97  /// low-level interface. For cases in which it's desired to define
98  /// the container with a sparse set of child fields, the Builder class
99  /// is often more convenient and readable.
100  HD_API
101  static HdContainerDataSourceHandle
103  const HdTokenDataSourceHandle &purpose
104  );
105 
106  /// \class HdPurposeSchema::Builder
107  ///
108  /// Utility class for setting sparse sets of child data source fields to be
109  /// filled as arguments into BuildRetained. Because all setter methods
110  /// return a reference to the instance, this can be used in the "builder
111  /// pattern" form.
112  class Builder
113  {
114  public:
115  HD_API
117  const HdTokenDataSourceHandle &purpose);
118 
119  /// Returns a container data source containing the members set thus far.
120  HD_API
121  HdContainerDataSourceHandle Build();
122 
123  private:
124  HdTokenDataSourceHandle _purpose;
125 
126  };
127 
128  /// @}
129 };
130 
132 
133 #endif
static HD_API const TfToken & GetSchemaToken()
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
#define HD_PURPOSE_SCHEMA_TOKENS
Definition: purposeSchema.h:35
static HD_API HdPurposeSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
HD_API Builder & SetPurpose(const HdTokenDataSourceHandle &purpose)
HdPurposeSchema(HdContainerDataSourceHandle container)
Definition: purposeSchema.h:50
#define HD_API
Definition: api.h:23
Definition: token.h:70
HD_API HdTokenDataSourceHandle GetPurpose() const
static HD_API HdContainerDataSourceHandle BuildRetained(const HdTokenDataSourceHandle &purpose)
TF_DECLARE_PUBLIC_TOKENS(HdPurposeSchemaTokens, HD_API, HD_PURPOSE_SCHEMA_TOKENS)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static HD_API const HdDataSourceLocator & GetDefaultLocator()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HdTokenDataSource::Handle HdTokenDataSourceHandle