HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
typed.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USD_GENERATED_TYPED_H
8 #define USD_GENERATED_TYPED_H
9 
10 /// \file usd/typed.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usd/api.h"
14 #include "pxr/usd/usd/schemaBase.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 
18 #include "pxr/base/vt/value.h"
19 
20 #include "pxr/base/gf/vec3d.h"
21 #include "pxr/base/gf/vec3f.h"
22 #include "pxr/base/gf/matrix4d.h"
23 
24 #include "pxr/base/tf/token.h"
25 #include "pxr/base/tf/type.h"
26 
28 
29 class SdfAssetPath;
30 
31 // -------------------------------------------------------------------------- //
32 // TYPED //
33 // -------------------------------------------------------------------------- //
34 
35 /// \class UsdTyped
36 ///
37 /// The base class for all \em typed schemas (those that can impart a
38 /// typeName to a UsdPrim), and therefore the base class for all
39 /// concrete, instantiable "IsA" schemas.
40 ///
41 /// UsdTyped implements a typeName-based query for its override of
42 /// UsdSchemaBase::_IsCompatible(). It provides no other behavior.
43 ///
44 class UsdTyped : public UsdSchemaBase
45 {
46 public:
47  /// Compile time constant representing what kind of schema this class is.
48  ///
49  /// \sa UsdSchemaKind
51 
52  /// Construct a UsdTyped on UsdPrim \p prim .
53  /// Equivalent to UsdTyped::Get(prim.GetStage(), prim.GetPath())
54  /// for a \em valid \p prim, but will not immediately throw an error for
55  /// an invalid \p prim
56  explicit UsdTyped(const UsdPrim& prim=UsdPrim())
57  : UsdSchemaBase(prim)
58  {
59  }
60 
61  /// Construct a UsdTyped on the prim held by \p schemaObj .
62  /// Should be preferred over UsdTyped(schemaObj.GetPrim()),
63  /// as it preserves SchemaBase state.
64  explicit UsdTyped(const UsdSchemaBase& schemaObj)
65  : UsdSchemaBase(schemaObj)
66  {
67  }
68 
69  /// Destructor.
70  USD_API
71  virtual ~UsdTyped();
72 
73  /// Return a vector of names of all pre-declared attributes for this schema
74  /// class and all its ancestor classes. Does not include attributes that
75  /// may be authored by custom/extended methods of the schemas involved.
76  USD_API
77  static const TfTokenVector &
78  GetSchemaAttributeNames(bool includeInherited=true);
79 
80  /// Return a UsdTyped holding the prim adhering to this
81  /// schema at \p path on \p stage. If no prim exists at \p path on
82  /// \p stage, or if the prim at that path does not adhere to this schema,
83  /// return an invalid schema object. This is shorthand for the following:
84  ///
85  /// \code
86  /// UsdTyped(stage->GetPrimAtPath(path));
87  /// \endcode
88  ///
89  USD_API
90  static UsdTyped
91  Get(const UsdStagePtr &stage, const SdfPath &path);
92 
93 
94 protected:
95  /// Returns the kind of schema this class belongs to.
96  ///
97  /// \sa UsdSchemaKind
98  USD_API
99  UsdSchemaKind _GetSchemaKind() const override;
100 
101 private:
102  // needs to invoke _GetStaticTfType.
103  friend class UsdSchemaRegistry;
104  USD_API
105  static const TfType &_GetStaticTfType();
106 
107  static bool _IsTypedSchema();
108 
109  // override SchemaBase virtuals.
110  USD_API
111  const TfType &_GetTfType() const override;
112 
113 public:
114  // ===================================================================== //
115  // Feel free to add custom code below this line, it will be preserved by
116  // the code generator.
117  //
118  // Just remember to:
119  // - Close the class declaration with };
120  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
121  // - Close the include guard with #endif
122  // ===================================================================== //
123  // --(BEGIN CUSTOM CODE)--
124 
125 protected:
126  USD_API
127  bool _IsCompatible() const override;
128 };
129 
131 
132 #endif
UsdTyped(const UsdPrim &prim=UsdPrim())
Definition: typed.h:56
#define USD_API
Definition: api.h:23
static const UsdSchemaKind schemaKind
Definition: typed.h:50
UsdTyped(const UsdSchemaBase &schemaObj)
Definition: typed.h:64
USD_API UsdSchemaKind _GetSchemaKind() const override
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
Definition: prim.h:116
Definition: typed.h:44
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
static USD_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Definition: path.h:273
virtual USD_API ~UsdTyped()
Destructor.
UsdSchemaKind
Definition: common.h:112
static USD_API UsdTyped Get(const UsdStagePtr &stage, const SdfPath &path)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USD_API bool _IsCompatible() const override
Definition: type.h:47