24 #ifndef PXR_USD_SDF_IDENTITY_H
25 #define PXR_USD_SDF_IDENTITY_H
28 #include "pxr/base/tf/hashmap.h"
29 #include "pxr/usd/sdf/api.h"
31 #include "pxr/usd/sdf/path.h"
33 #include <boost/intrusive_ptr.hpp>
34 #include <boost/noncopyable.hpp>
35 #include <tbb/spin_mutex.h>
37 PXR_NAMESPACE_OPEN_SCOPE
39 class Sdf_IdentityRegistry;
48 class Sdf_Identity :
public boost::noncopyable {
52 const SdfLayerHandle &GetLayer()
const;
55 const SdfPath &GetPath()
const {
61 friend void intrusive_ptr_add_ref(Sdf_Identity*);
62 friend void intrusive_ptr_release(Sdf_Identity*);
64 friend class Sdf_IdentityRegistry;
67 Sdf_Identity(Sdf_IdentityRegistry *registry,
const SdfPath &path);
73 mutable std::atomic_int _refCount;
74 Sdf_IdentityRegistry *_registry;
79 inline void intrusive_ptr_add_ref(PXR_NS::Sdf_Identity* p) {
82 inline void intrusive_ptr_release(PXR_NS::Sdf_Identity* p) {
83 if (--p->_refCount == 0) {
88 class Sdf_IdentityRegistry :
public boost::noncopyable {
90 Sdf_IdentityRegistry(
const SdfLayerHandle &layer);
91 ~Sdf_IdentityRegistry();
94 const SdfLayerHandle &GetLayer()
const {
102 Sdf_IdentityRefPtr Identify(
const SdfPath &path);
105 void MoveIdentity(
const SdfPath &oldPath,
const SdfPath &newPath);
109 friend class Sdf_Identity;
113 void _Remove(
const SdfPath &path, Sdf_Identity *
id);
117 const SdfLayerHandle _layer;
120 typedef TfHashMap<SdfPath, Sdf_Identity*, SdfPath::Hash> _IdMap;
124 Sdf_IdentityRefPtr _lastId;
127 tbb::spin_mutex _idsMutex;
130 PXR_NAMESPACE_CLOSE_SCOPE
132 #endif // PXR_USD_SDF_IDENTITY_H
A unit of scene description that you combine with other units of scene description to form a shot...
A path value used to locate objects in layers or scenegraphs.