7 #ifndef PXR_USD_SDF_PATH_NODE_H
8 #define PXR_USD_SDF_PATH_NODE_H
15 #include "pxr/base/tf/mallocTag.h"
156 static std::pair<Sdf_PathNode const *, Sdf_PathNode const *>
159 bool stopAtRootPrim);
219 template <
class Less>
225 return _refCount.load(std::memory_order_relaxed) &
RefCountMask;
232 , _elementCount(parent ? parent->_elementCount + 1 : 1)
233 , _nodeType(nodeType)
235 (parent ? parent->_nodeFlags : 0) | _NodeTypeToFlags(nodeType))
243 if (_refCount.load(std::memory_order_relaxed) &
HasTokenBit) {
259 template <
class Buffer>
264 template <
class Buffer>
268 template <
class Buffer>
288 static constexpr uint8_t _NodeTypeToFlags(
NodeType nt) {
299 template <
class Derived>
300 Derived
const *_Downcast()
const {
301 return static_cast<Derived
const *
>(
this);
305 bool _IsNamespacedImpl()
const;
316 mutable std::atomic<uint32_t> _refCount;
318 const uint16_t _elementCount;
320 const uint8_t _nodeFlags;
326 using Sdf_PathNode::Sdf_PathNode;
327 SDF_API void operator delete (
void *p);
332 using Sdf_PathNode::Sdf_PathNode;
333 SDF_API void operator delete (
void *p);
370 const ComparisonType &_GetComparisonValue()
const {
return _name; }
397 const ComparisonType &_GetComparisonValue()
const {
return _name; }
410 template <
class Buffer>
422 return *_variantSelection;
430 std::unique_ptr<VariantSelectionType> _variantSelection;
438 template <
class Buffer>
445 , _targetPath(targetPath) {}
449 const ComparisonType& _GetComparisonValue()
const {
return _targetPath; }
472 const ComparisonType& _GetComparisonValue()
const {
return _name; }
487 template <
class Buffer>
494 , _targetPath(targetPath) {}
498 const ComparisonType& _GetComparisonValue()
const {
return _targetPath; }
513 template <
class Buffer>
524 const ComparisonType& _GetComparisonValue()
const {
return _name; }
539 template <
class Buffer>
558 template <
int nodeType>
589 template <
int nodeType,
class Comp>
594 return Comp()(
static_cast<const Type&
>(lhs)._GetComparisonValue(),
595 static_cast<const Type&
>(rhs)._GetComparisonValue());
599 template <
class Comp>
612 if (nodeType != rhsNodeType) {
613 return Comp()(nodeType, rhsNodeType);
657 return delete _Downcast<Sdf_RootPathNode>();
659 return delete _Downcast<Sdf_PrimPathNode>();
661 return delete _Downcast<Sdf_PrimPropertyPathNode>();
663 return delete _Downcast<Sdf_PrimVariantSelectionNode>();
665 return delete _Downcast<Sdf_TargetPathNode>();
667 return delete _Downcast<Sdf_RelationalAttributePathNode>();
669 return delete _Downcast<Sdf_MapperPathNode>();
671 return delete _Downcast<Sdf_MapperArgPathNode>();
673 return delete _Downcast<Sdf_ExpressionPathNode>();
684 return SdfPathTokens->empty;
687 SdfPathTokens->absoluteIndicator : SdfPathTokens->relativeRoot;
689 return _Downcast<Sdf_PrimPathNode>()->_name;
691 return _Downcast<Sdf_PrimPropertyPathNode>()->_name;
693 return _Downcast<Sdf_PrimVariantSelectionNode>()->_GetNameImpl();
695 return _Downcast<Sdf_RelationalAttributePathNode>()->_name;
697 return _Downcast<Sdf_MapperArgPathNode>()->_name;
699 return SdfPathTokens->expressionIndicator;
710 return _Downcast<Sdf_TargetPathNode>()->_targetPath;
712 return _Downcast<Sdf_MapperPathNode>()->_targetPath;
720 return *_Downcast<Sdf_PrimVariantSelectionNode>()->_variantSelection;
722 return _GetEmptyVariantSelection();
732 return _Downcast<Sdf_PrimPathNode>()->_name;
742 p->_refCount.fetch_add(1, std::memory_order_relaxed);
745 if ((p->_refCount.fetch_sub(1) & PXR_NS::Sdf_PathNode::RefCountMask) == 1) {
752 #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
friend void TfDelegatedCountIncrement(const Sdf_PathNode *) noexcept
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)
RawPtrType get() const noexcept
Return the underlying pointer.
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
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
#define PXR_NAMESPACE_CLOSE_SCOPE
friend struct Sdf_PathNodePrivateAccess
bool operator()(T const &a, T const &b) const
bool IsNamespaced() const
friend void TfDelegatedCountDecrement(const Sdf_PathNode *) noexcept
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 TfDelegatedCountIncrement(const PXR_NS::Sdf_PathNode *p) noexcept
static constexpr uint8_t ContainsPrimVarSelFlag
Sdf_RelationalAttributePathNode Type
static const NodeType nodeType
VariantSelectionType ComparisonType
void TfDelegatedCountDecrement(const PXR_NS::Sdf_PathNode *p) noexcept
bool IsAbsolutePath() const
static const NodeType nodeType
PXR_NAMESPACE_OPEN_SCOPE constexpr struct TfDelegatedCountIncrementTagType TfDelegatedCountIncrementTag
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)