7#ifndef PXR_USD_SDF_IDENTITY_H
8#define PXR_USD_SDF_IDENTITY_H
11#include "pxr/usd/sdf/api.h"
13#include "pxr/usd/sdf/path.h"
17PXR_NAMESPACE_OPEN_SCOPE
19class Sdf_IdentityRegistry;
20class Sdf_IdRegistryImpl;
31 Sdf_Identity(Sdf_Identity
const &) =
delete;
32 Sdf_Identity &operator=(Sdf_Identity
const &) =
delete;
36 const SdfLayerHandle &GetLayer()
const;
39 const SdfPath &GetPath()
const {
45 friend void TfDelegatedCountIncrement(Sdf_Identity*);
46 friend void TfDelegatedCountDecrement(Sdf_Identity*)
noexcept;
48 friend class Sdf_IdentityRegistry;
49 friend class Sdf_IdRegistryImpl;
51 Sdf_Identity(Sdf_IdRegistryImpl *regImpl,
const SdfPath &path)
52 : _refCount(0), _path(path), _regImpl(regImpl) {}
55 static void _UnregisterOrDelete(Sdf_IdRegistryImpl *reg, Sdf_Identity *
id)
59 mutable std::atomic_int _refCount;
61 Sdf_IdRegistryImpl *_regImpl;
65inline void TfDelegatedCountIncrement(PXR_NS::Sdf_Identity* p) {
68inline void TfDelegatedCountDecrement(PXR_NS::Sdf_Identity* p)
noexcept {
73 Sdf_Identity *self = p;
74 Sdf_IdRegistryImpl *reg = p->_regImpl;
75 if (--p->_refCount == 0) {
77 Sdf_Identity::_UnregisterOrDelete(reg, self);
81class Sdf_IdentityRegistry {
82 Sdf_IdentityRegistry(
const Sdf_IdentityRegistry&) =
delete;
83 Sdf_IdentityRegistry& operator=(
const Sdf_IdentityRegistry&) =
delete;
85 Sdf_IdentityRegistry(
const SdfLayerHandle &layer);
86 ~Sdf_IdentityRegistry();
89 const SdfLayerHandle &GetLayer()
const {
100 void MoveIdentity(
const SdfPath &oldPath,
const SdfPath &newPath);
103 friend class Sdf_Identity;
105 friend class Sdf_IdRegistryImpl;
110 void _UnregisterOrDelete();
114 const SdfLayerHandle _layer;
117 const std::unique_ptr<Sdf_IdRegistryImpl> _impl;
120PXR_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.