24#ifndef PXR_USD_SDF_IDENTITY_H
25#define PXR_USD_SDF_IDENTITY_H
28#include "pxr/usd/sdf/api.h"
30#include "pxr/usd/sdf/path.h"
34PXR_NAMESPACE_OPEN_SCOPE
36class Sdf_IdentityRegistry;
37class Sdf_IdRegistryImpl;
48 Sdf_Identity(Sdf_Identity
const &) =
delete;
49 Sdf_Identity &operator=(Sdf_Identity
const &) =
delete;
53 const SdfLayerHandle &GetLayer()
const;
56 const SdfPath &GetPath()
const {
62 friend void intrusive_ptr_add_ref(Sdf_Identity*);
63 friend void intrusive_ptr_release(Sdf_Identity*);
65 friend class Sdf_IdentityRegistry;
66 friend class Sdf_IdRegistryImpl;
68 Sdf_Identity(Sdf_IdRegistryImpl *regImpl,
const SdfPath &path)
69 : _refCount(0), _path(path), _regImpl(regImpl) {}
72 static void _UnregisterOrDelete(Sdf_IdRegistryImpl *reg, Sdf_Identity *
id);
75 mutable std::atomic_int _refCount;
77 Sdf_IdRegistryImpl *_regImpl;
81inline void intrusive_ptr_add_ref(PXR_NS::Sdf_Identity* p) {
84inline void intrusive_ptr_release(PXR_NS::Sdf_Identity* p) {
89 Sdf_Identity *self = p;
90 Sdf_IdRegistryImpl *reg = p->_regImpl;
91 if (--p->_refCount == 0) {
93 Sdf_Identity::_UnregisterOrDelete(reg, self);
97class Sdf_IdentityRegistry {
98 Sdf_IdentityRegistry(
const Sdf_IdentityRegistry&) =
delete;
99 Sdf_IdentityRegistry& operator=(
const Sdf_IdentityRegistry&) =
delete;
101 Sdf_IdentityRegistry(
const SdfLayerHandle &layer);
102 ~Sdf_IdentityRegistry();
105 const SdfLayerHandle &GetLayer()
const {
113 Sdf_IdentityRefPtr Identify(
const SdfPath &path);
116 void MoveIdentity(
const SdfPath &oldPath,
const SdfPath &newPath);
119 friend class Sdf_Identity;
121 friend class Sdf_IdRegistryImpl;
126 void _UnregisterOrDelete();
130 const SdfLayerHandle _layer;
133 const std::unique_ptr<Sdf_IdRegistryImpl> _impl;
136PXR_NAMESPACE_CLOSE_SCOPE
A scene description container that can combine with other such containers to form simple component as...
A path value used to locate objects in layers or scenegraphs.