File indexing completed on 2026-09-09 09:17:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef TDF_LabelNode_HeaderFile
0017 #define TDF_LabelNode_HeaderFile
0018
0019 #include <TCollection_AsciiString.hxx>
0020 #include <TDF_Attribute.hxx>
0021 #include <TDF_LabelNodePtr.hxx>
0022 #include <TDF_HAllocator.hxx>
0023 #include <NCollection_DefineAlloc.hxx>
0024
0025 #ifdef Standard_HASATOMIC
0026 #include <atomic>
0027 #endif
0028
0029 class TDF_Attribute;
0030 class TDF_Data;
0031
0032 #define KEEP_LOCAL_ROOT
0033
0034 enum
0035 {
0036 TDF_LabelNodeImportMsk = (int)0x80000000,
0037 TDF_LabelNodeAttModMsk = 0x40000000,
0038 TDF_LabelNodeMayModMsk = 0x20000000,
0039 TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk | TDF_LabelNodeAttModMsk | TDF_LabelNodeMayModMsk)
0040 };
0041
0042
0043
0044
0045
0046 class TDF_LabelNode
0047 {
0048
0049 public:
0050
0051
0052
0053
0054 inline TDF_LabelNode* Father() const { return myFather; }
0055
0056
0057 inline TDF_LabelNode* Brother() const { return myBrother; }
0058
0059
0060 inline TDF_LabelNode* FirstChild() const { return myFirstChild; }
0061
0062
0063 inline const Handle(TDF_Attribute)& FirstAttribute() const { return myFirstAttribute; }
0064
0065
0066 inline Standard_Integer Tag() const { return myTag; }
0067
0068
0069 inline Standard_Integer Depth() const { return (myFlags & ~TDF_LabelNodeFlagsMsk); }
0070
0071
0072 inline Standard_Boolean IsRoot() const { return myFather == NULL; }
0073
0074
0075 Standard_EXPORT TDF_Data* Data() const;
0076
0077
0078 inline void AttributesModified(const Standard_Boolean aStatus)
0079 {
0080 myFlags = (aStatus) ? (myFlags | TDF_LabelNodeAttModMsk) : (myFlags & ~TDF_LabelNodeAttModMsk);
0081 if (aStatus)
0082 AllMayBeModified();
0083 }
0084
0085 inline Standard_Boolean AttributesModified() const
0086 {
0087 return ((myFlags & TDF_LabelNodeAttModMsk) != 0);
0088 }
0089
0090
0091 inline void MayBeModified(const Standard_Boolean aStatus)
0092 {
0093 myFlags = (aStatus) ? (myFlags | TDF_LabelNodeMayModMsk) : (myFlags & ~TDF_LabelNodeMayModMsk);
0094 }
0095
0096 inline Standard_Boolean MayBeModified() const
0097 {
0098 return ((myFlags & TDF_LabelNodeMayModMsk) != 0);
0099 }
0100
0101 private:
0102
0103 DEFINE_NCOLLECTION_ALLOC
0104
0105
0106 TDF_LabelNode(TDF_Data* Data);
0107
0108
0109 void Destroy(const TDF_HAllocator& theAllocator);
0110
0111
0112
0113
0114 friend class TDF_Data;
0115 friend class TDF_Label;
0116
0117 private:
0118
0119
0120
0121
0122 TDF_LabelNode(const Standard_Integer Tag, TDF_LabelNode* Father);
0123
0124
0125 void AddAttribute(const Handle(TDF_Attribute)& afterAtt, const Handle(TDF_Attribute)& newAtt);
0126
0127 void RemoveAttribute(const Handle(TDF_Attribute)& afterAtt, const Handle(TDF_Attribute)& oldAtt);
0128
0129 TDF_LabelNode* RootNode();
0130
0131 const TDF_LabelNode* RootNode() const;
0132
0133 Standard_EXPORT void AllMayBeModified();
0134
0135
0136 inline void Tag(const Standard_Integer aTag) { myTag = aTag; }
0137
0138
0139 inline void Depth(const Standard_Integer aDepth)
0140 {
0141 myFlags = ((myFlags & TDF_LabelNodeFlagsMsk) | aDepth);
0142 }
0143
0144
0145 inline void Imported(const Standard_Boolean aStatus)
0146 {
0147 myFlags = (aStatus) ? (myFlags | TDF_LabelNodeImportMsk) : (myFlags & ~TDF_LabelNodeImportMsk);
0148 }
0149
0150 inline Standard_Boolean IsImported() const { return ((myFlags & TDF_LabelNodeImportMsk) != 0); }
0151
0152
0153
0154
0155 TDF_LabelNodePtr myFather;
0156 TDF_LabelNodePtr myBrother;
0157 TDF_LabelNodePtr myFirstChild;
0158 Standard_ATOMIC(TDF_LabelNodePtr) myLastFoundChild;
0159 Standard_Integer myTag;
0160 Standard_Integer myFlags;
0161 Handle(TDF_Attribute) myFirstAttribute;
0162 #ifdef KEEP_LOCAL_ROOT
0163 TDF_Data* myData;
0164 #endif
0165 #ifdef OCCT_DEBUG
0166 TCollection_AsciiString myDebugEntry;
0167 #endif
0168 };
0169
0170 #endif