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 TfDelegatedCountIncrement(Sdf_Identity*);
63 friend void TfDelegatedCountDecrement(Sdf_Identity*)
noexcept;
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)
76 mutable std::atomic_int _refCount;
78 Sdf_IdRegistryImpl *_regImpl;
82inline void TfDelegatedCountIncrement(PXR_NS::Sdf_Identity* p) {
85inline void TfDelegatedCountDecrement(PXR_NS::Sdf_Identity* p)
noexcept {
90 Sdf_Identity *self = p;
91 Sdf_IdRegistryImpl *reg = p->_regImpl;
92 if (--p->_refCount == 0) {
94 Sdf_Identity::_UnregisterOrDelete(reg, self);
98class Sdf_IdentityRegistry {
99 Sdf_IdentityRegistry(
const Sdf_IdentityRegistry&) =
delete;
100 Sdf_IdentityRegistry& operator=(
const Sdf_IdentityRegistry&) =
delete;
102 Sdf_IdentityRegistry(
const SdfLayerHandle &layer);
103 ~Sdf_IdentityRegistry();
106 const SdfLayerHandle &GetLayer()
const {
117 void MoveIdentity(
const SdfPath &oldPath,
const SdfPath &newPath);
120 friend class Sdf_Identity;
122 friend class Sdf_IdRegistryImpl;
127 void _UnregisterOrDelete();
131 const SdfLayerHandle _layer;
134 const std::unique_ptr<Sdf_IdRegistryImpl> _impl;
137PXR_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.