HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stage.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 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_EXEC_ESF_STAGE_H
8 #define PXR_EXEC_ESF_STAGE_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
15 
16 #include "pxr/base/tf/token.h"
17 #include "pxr/base/tf/type.h"
18 
19 #include <utility>
20 
22 
23 class EsfAttribute;
24 class EsfJournal;
25 class EsfObject;
26 class EsfPrim;
27 class EsfProperty;
28 class EsfRelationship;
29 class SdfPath;
30 
31 /// Stage abstraction for scene adapter implementations.
32 ///
33 /// The stage abstraction closely resembles the read-only interface of UsdStage.
34 ///
35 /// The public methods of this class are called by the exec network compiler.
36 /// Each method takes an argument of type EsfJournal* which captures the
37 /// conditions for recompilation.
38 ///
39 /// This class is compatible with EsfFixedSizePolymorphicHolder.
40 ///
42 {
43 public:
44  ESF_API ~EsfStageInterface() override;
45 
46  /// \see UsdStage::GetAttributeAtPath
47  ESF_API EsfAttribute GetAttributeAtPath(
48  const SdfPath &path,
49  EsfJournal *journal) const;
50 
51  /// \see UsdStage::GetObjectAtPath
52  ESF_API EsfObject GetObjectAtPath(
53  const SdfPath &path,
54  EsfJournal *journal) const;
55 
56  /// \see UsdStage::GetPrimAtPath
57  ESF_API EsfPrim GetPrimAtPath(
58  const SdfPath &path,
59  EsfJournal *journal) const;
60 
61  /// \see UsdStage::GetPropertyAtPath
62  ESF_API EsfProperty GetPropertyAtPath(
63  const SdfPath &path,
64  EsfJournal *journal) const;
65 
66  /// \see UsdStage::GetRelationshipAtPath
67  ESF_API EsfRelationship GetRelationshipAtPath(
68  const SdfPath &path,
69  EsfJournal *journal) const;
70 
71  /// \see UsdSchemaRegistry::GetTypeNameAndInstance
72  std::pair<TfToken, TfToken> GetTypeNameAndInstance(
73  const TfToken &apiSchemaName) const {
74  return _GetTypeNameAndInstance(apiSchemaName);
75  }
76 
77  /// \see UsdSchemaRegistry::GetAPITypeFromSchemaTypeName
79  const TfToken &schemaTypeName) const {
80  return _GetAPITypeFromSchemaTypeName(schemaTypeName);
81  }
82 
83 private:
84  // These methods must be implemented by the scene adapter implementation.
85  virtual EsfAttribute _GetAttributeAtPath(
86  const SdfPath &path) const = 0;
87  virtual EsfObject _GetObjectAtPath(
88  const SdfPath &path) const = 0;
89  virtual EsfPrim _GetPrimAtPath(
90  const SdfPath &path) const = 0;
91  virtual EsfProperty _GetPropertyAtPath(
92  const SdfPath &path) const = 0;
93  virtual EsfRelationship _GetRelationshipAtPath(
94  const SdfPath &path) const = 0;
95  virtual std::pair<TfToken, TfToken> _GetTypeNameAndInstance(
96  const TfToken &apiSchemaName) const = 0;
97  virtual TfType _GetAPITypeFromSchemaTypeName(
98  const TfToken &schemaTypeName) const = 0;
99 };
100 
101 /// Holds an implementation of EsfStageInterface in a fixed-size buffer.
102 ///
103 /// The buffer is large enough to fit an implementation that wraps a
104 /// UsdStageConstRefPtr. The size is specified as an integer literal to prevent
105 /// introducing Usd as a dependency.
106 ///
107 class EsfStage : public EsfFixedSizePolymorphicHolder<EsfStageInterface, 16>
108 {
109 public:
111 };
112 
114 
115 #endif
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
TfType GetAPITypeFromSchemaTypeName(const TfToken &schemaTypeName) const
Definition: stage.h:78
#define ESF_API_TYPE
Definition: api.h:26
Definition: prim.h:84
Definition: token.h:70
Definition: path.h:280
std::pair< TfToken, TfToken > GetTypeNameAndInstance(const TfToken &apiSchemaName) const
Definition: stage.h:72
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
#define ESF_API
Definition: api.h:25