Loading...
Searching...
No Matches
object.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_OBJECT_H
8#define PXR_EXEC_ESF_OBJECT_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/esf/api.h"
17#include "pxr/exec/esf/stage.h"
18
19#include "pxr/usd/sdf/path.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23class EsfAttribute;
24class EsfJournal;
25class EsfObject;
26class EsfPrim;
27class EsfRelationship;
28class TfToken;
29class TfType;
30class VtValue;
31
45{
46public:
47 ESF_API ~EsfObjectInterface() override;
48
50 ESF_API bool IsValid(EsfJournal *journal) const;
51
53 ESF_API SdfPath GetPath(EsfJournal *journal) const;
54
56 ESF_API TfToken GetName(EsfJournal *journal) const;
57
59 ESF_API EsfPrim GetPrim(EsfJournal *journal) const;
60
63 return _GetStage();
64 }
65
72
75
80 ESF_API VtValue GetMetadata(const TfToken &key) const;
81
85 ESF_API bool IsValidMetadataKey(const TfToken &key) const;
86
91 ESF_API TfType GetMetadataValueType(const TfToken &key) const;
92
94
96 virtual bool IsPrim() const = 0;
97
99 virtual bool IsAttribute() const = 0;
100
102 virtual bool IsRelationship() const = 0;
103
105 virtual EsfObject AsObject() const = 0;
106
108 virtual EsfAttribute AsAttribute() const = 0;
109
111 virtual EsfRelationship AsRelationship() const = 0;
112
114 virtual EsfPrim AsPrim() const = 0;
115
116protected:
118 EsfObjectInterface(const SdfPath &path) : _path(path) {}
119
121 const SdfPath &_GetPath() const { return _path; }
122
123 virtual EsfStage _GetStage() const = 0;
124
125 static EsfSchemaConfigKey CreateSchemaConfigKey(const void *const id) {
126 return EsfSchemaConfigKey(id);
127 }
128
129private:
130 // Object path that will be added to EsfJournals.
131 SdfPath _path;
132
133 // These methods must be implemented by the scene adapter implementation.
134 virtual bool _IsValid() const = 0;
135 virtual TfToken _GetName() const = 0;
136 virtual EsfPrim _GetPrim() const = 0;
137 virtual EsfSchemaConfigKey _GetSchemaConfigKey() const = 0;
138 virtual VtValue _GetMetadata(const TfToken &key) const = 0;
139 virtual bool _IsValidMetadataKey(const TfToken &key) const = 0;
140 virtual TfType _GetMetadataValueType(const TfToken &key) const = 0;
141};
142
149class EsfObject : public EsfFixedSizePolymorphicHolder<EsfObjectInterface, 48>
150{
151public:
153};
154
155PXR_NAMESPACE_CLOSE_SCOPE
156
157#endif
Holds an implementation of EsfAttributeInterface in a fixed-size buffer.
Definition: attribute.h:70
Enables a base class to be used with EsfFixedSizePolymorphicHolder.
Stores polymorphic objects in a fixed-size buffer.
EsfFixedSizePolymorphicHolder()=delete
The default constructor is deleted because instances must always contain a derived object.
Stores a collection of edit reasons associated with scene objects.
Definition: journal.h:38
Holds an implementation of EsfObjectInterface in a fixed-size buffer.
Definition: object.h:150
Scene object abstraction for scene adapter implementations.
Definition: object.h:45
ESF_API bool IsValidMetadataKey(const TfToken &key) const
Returns true if the field indicated by key is a valid metadata field for this object.
virtual EsfAttribute AsAttribute() const =0
virtual bool IsRelationship() const =0
ESF_API EsfPrim GetPrim(EsfJournal *journal) const
ESF_API bool IsValid(EsfJournal *journal) const
virtual EsfPrim AsPrim() const =0
ESF_API EsfSchemaConfigKey GetSchemaConfigKey(EsfJournal *journal) const
Returns an opaque value that is guaranteed to be unique and stable.
virtual bool IsPrim() const =0
EsfObjectInterface(const SdfPath &path)
This constructor may only be called by the scene adapter implementation.
Definition: object.h:118
virtual bool IsAttribute() const =0
const SdfPath & _GetPath() const
Gets the path to this object used for journaling.
Definition: object.h:121
ESF_API VtValue GetMetadata(const TfToken &key) const
Returns the value of the metadata field indicated by key.
ESF_API TfType GetMetadataValueType(const TfToken &key) const
Returns the value type for the indicated key.
ESF_API TfToken GetName(EsfJournal *journal) const
ESF_API SdfPath GetPath(EsfJournal *journal) const
virtual EsfObject AsObject() const =0
EsfStage GetStage() const
Definition: object.h:62
virtual EsfRelationship AsRelationship() const =0
Holds an implementation of EsfPrimInterface in a fixed-size buffer.
Definition: prim.h:85
Holds an implementation of EsfRelationshipInterface in a fixed-size buffer.
Definition: relationship.h:61
An opaque type that can be used to identify the configuration of typed and applied schemas for a prim...
Holds an implementation of EsfStageInterface in a fixed-size buffer.
Definition: stage.h:108
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152