24 #ifndef PXR_USD_SDF_PATH_NODE_H
25 #define PXR_USD_SDF_PATH_NODE_H
31 #include "pxr/base/tf/mallocTag.h"
33 #include <hboost/intrusive_ptr.hpp>
174 static std::pair<Sdf_PathNode const *, Sdf_PathNode const *>
177 bool stopAtRootPrim);
237 template <
class Less>
243 return _refCount.load(std::memory_order_relaxed) &
RefCountMask;
250 , _elementCount(parent ? parent->_elementCount + 1 : 1)
251 , _nodeType(nodeType)
253 (parent ? parent->_nodeFlags : 0) | _NodeTypeToFlags(nodeType))
261 if (_refCount.load(std::memory_order_relaxed) &
HasTokenBit) {
277 template <
class Buffer>
282 template <
class Buffer>
286 template <
class Buffer>
306 static constexpr uint8_t _NodeTypeToFlags(
NodeType nt) {
317 template <
class Derived>
318 Derived
const *_Downcast()
const {
319 return static_cast<Derived
const *
>(
this);
323 bool _IsNamespacedImpl()
const;
334 mutable std::atomic<uint32_t> _refCount;
336 const uint16_t _elementCount;
338 const uint8_t _nodeFlags;
344 using Sdf_PathNode::Sdf_PathNode;
345 SDF_API void operator delete (
void *p);
350 using Sdf_PathNode::Sdf_PathNode;
351 SDF_API void operator delete (
void *p);
388 const ComparisonType &_GetComparisonValue()
const {
return _name; }
415 const ComparisonType &_GetComparisonValue()
const {
return _name; }
428 template <
class Buffer>
440 return *_variantSelection;
448 std::unique_ptr<VariantSelectionType> _variantSelection;
456 template <
class Buffer>
463 , _targetPath(targetPath) {}
467 const ComparisonType& _GetComparisonValue()
const {
return _targetPath; }
490 const ComparisonType& _GetComparisonValue()
const {
return _name; }
505 template <
class Buffer>
512 , _targetPath(targetPath) {}
516 const ComparisonType& _GetComparisonValue()
const {
return _targetPath; }
531 template <
class Buffer>
542 const ComparisonType& _GetComparisonValue()
const {
return _name; }
557 template <
class Buffer>
576 template <
int nodeType>
607 template <
int nodeType,
class Comp>
612 return Comp()(
static_cast<const Type&
>(lhs)._GetComparisonValue(),
613 static_cast<const Type&
>(rhs)._GetComparisonValue());
617 template <
class Comp>
630 if (nodeType != rhsNodeType) {
631 return Comp()(nodeType, rhsNodeType);
675 return delete _Downcast<Sdf_RootPathNode>();
677 return delete _Downcast<Sdf_PrimPathNode>();
679 return delete _Downcast<Sdf_PrimPropertyPathNode>();
681 return delete _Downcast<Sdf_PrimVariantSelectionNode>();
683 return delete _Downcast<Sdf_TargetPathNode>();
685 return delete _Downcast<Sdf_RelationalAttributePathNode>();
687 return delete _Downcast<Sdf_MapperPathNode>();
689 return delete _Downcast<Sdf_MapperArgPathNode>();
691 return delete _Downcast<Sdf_ExpressionPathNode>();
702 return SdfPathTokens->empty;
705 SdfPathTokens->absoluteIndicator : SdfPathTokens->relativeRoot;
707 return _Downcast<Sdf_PrimPathNode>()->_name;
709 return _Downcast<Sdf_PrimPropertyPathNode>()->_name;
711 return _Downcast<Sdf_PrimVariantSelectionNode>()->_GetNameImpl();
713 return _Downcast<Sdf_RelationalAttributePathNode>()->_name;
715 return _Downcast<Sdf_MapperArgPathNode>()->_name;
717 return SdfPathTokens->expressionIndicator;
728 return _Downcast<Sdf_TargetPathNode>()->_targetPath;
730 return _Downcast<Sdf_MapperPathNode>()->_targetPath;
738 return *_Downcast<Sdf_PrimVariantSelectionNode>()->_variantSelection;
740 return _GetEmptyVariantSelection();
750 return _Downcast<Sdf_PrimPathNode>()->_name;
760 p->_refCount.fetch_add(1, std::memory_order_relaxed);
763 if ((p->_refCount.fetch_sub(1) & PXR_NS::Sdf_PathNode::RefCountMask) == 1) {
770 #endif // PXR_USD_SDF_PATH_NODE_H
friend struct Sdf_PathNodePrivateAccess
void _WriteText(Buffer &out) const
static TfToken _CreatePathToken(Sdf_PathNode const *primPart, Sdf_PathNode const *propPart)
static Sdf_PathPrimNodeHandle FindOrCreatePrimVariantSelection(Sdf_PathNode const *parent, const TfToken &variantSet, const TfToken &variant, TfFunctionRef< bool()> isValid)
static Sdf_PathPropNodeHandle FindOrCreateMapper(Sdf_PathNode const *parent, SdfPath const &targetPath, TfFunctionRef< bool()> isValid)
static SDF_API TfToken GetPathAsToken(Sdf_PathNode const *primPart, Sdf_PathNode const *propPart)
static Sdf_PathPropNodeHandle FindOrCreateTarget(Sdf_PathNode const *parent, SdfPath const &targetPath, TfFunctionRef< bool()> isValid)
static Sdf_PathNode const * GetAbsoluteRootNode()
GLsizei const GLchar *const * path
static constexpr uint8_t IsAbsoluteFlag
bool ContainsPrimVariantSelection() const
void _WriteTextImpl(Buffer &out) const
std::pair< TfToken, TfToken > VariantSelectionType
TfToken _GetElementImpl() const
GLboolean GLboolean GLboolean GLboolean a
static const NodeType nodeType
static constexpr uint32_t RefCountMask
Sdf_PathNode(Sdf_PathNode const *parent, NodeType nodeType)
Sdf_ExpressionPathNode Type
static void _WriteTextToBuffer(Sdf_PathNode const *primPart, Sdf_PathNode const *propPart, Buffer &out)
void _WriteTextImpl(Buffer &out) const
void _WriteTextImpl(Buffer &out) const
friend struct Sdf_PathNodePrivateAccess
NodeType GetNodeType() const
friend struct Sdf_PathNodePrivateAccess
static Sdf_PathPrimNodeHandle FindOrCreatePrim(Sdf_PathNode const *parent, const TfToken &name, TfFunctionRef< bool()> isValid)
static const NodeType nodeType
static SDF_API const SdfPath & EmptyPath()
The empty path value, equivalent to SdfPath().
static std::pair< Sdf_PathNode const *, Sdf_PathNode const * > RemoveCommonSuffix(Sdf_PathNode const *a, Sdf_PathNode const *b, bool stopAtRootPrim)
bool operator()(const Sdf_PathNode &lhs, const Sdf_PathNode &rhs) const
static Sdf_PathPropNodeHandle FindOrCreateMapperArg(Sdf_PathNode const *parent, const TfToken &name, TfFunctionRef< bool()> isValid)
Sdf_PrimVariantSelectionNode Type
void _WriteTextImpl(Buffer &out) const
static const NodeType nodeType
const SdfPath & GetTargetPath() const
bool Compare(const Sdf_PathNode &rhs) const
friend struct Sdf_PathNodePrivateAccess
Sdf_MapperArgPathNode Type
friend struct Sdf_PathNodePrivateAccess
friend struct Sdf_PathNodePrivateAccess
static const NodeType nodeType
const VariantSelectionType & GetVariantSelection() const
static char const * GetDebugText(Sdf_PathNode const *primPart, Sdf_PathNode const *propPart)
static Sdf_PathPropNodeHandle FindOrCreateExpression(Sdf_PathNode const *parent, TfFunctionRef< bool()> isValid)
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
TfToken GetElement() const
bool IsAbsoluteRoot() const
static const NodeType nodeType
static const NodeType nodeType
static Sdf_PathNode const * GetRelativeRootNode()
uint32_t GetCurrentRefCount() const
hboost::intrusive_ptr< const Sdf_PathNode > Sdf_PathNodeConstRefPtr
bool operator()(T const &a, T const &b) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
const TfToken & GetName() const
void _WriteTextImpl(Buffer &out) const
friend void intrusive_ptr_add_ref(const Sdf_PathNode *)
#define PXR_NAMESPACE_CLOSE_SCOPE
void intrusive_ptr_release(const PXR_NS::Sdf_PathNode *p)
friend struct Sdf_PathNodePrivateAccess
bool operator()(T const &a, T const &b) const
bool IsNamespaced() const
SDF_API void _RemovePathTokenFromTable() const
SDF_API void Sdf_DumpPathStats()
Diagnostic output.
static Sdf_PathPropNodeHandle FindOrCreatePrimProperty(Sdf_PathNode const *parent, const TfToken &name, TfFunctionRef< bool()> isValid)
Sdf_PrimPropertyPathNode Type
friend struct Sdf_PathNodePrivateAccess
static SDF_API Sdf_PathNode const * New(bool isAbsolute)
void intrusive_ptr_add_ref(const PXR_NS::Sdf_PathNode *p)
static constexpr uint8_t ContainsPrimVarSelFlag
Sdf_RelationalAttributePathNode Type
static const NodeType nodeType
VariantSelectionType ComparisonType
bool IsAbsolutePath() const
static const NodeType nodeType
friend void intrusive_ptr_release(const Sdf_PathNode *)
const TfToken & _GetNameImpl() const
static constexpr uint8_t ContainsTargetPathFlag
static SDF_API const TfToken & GetPathToken(Sdf_PathNode const *primPart, Sdf_PathNode const *propPart)
bool ContainsTargetPath() const
size_t GetElementCount() const
friend struct Sdf_PathNodePrivateAccess
Sdf_PathNode const * GetParentNode() const
static const NodeType nodeType
static constexpr uint32_t HasTokenBit
static Sdf_PathPropNodeHandle FindOrCreateRelationalAttribute(Sdf_PathNode const *parent, const TfToken &name, TfFunctionRef< bool()> isValid)