File indexing completed on 2025-01-18 10:05:21
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 TDF_LabelNodeImportMsk = (int) 0x80000000,
0036 TDF_LabelNodeAttModMsk = 0x40000000,
0037 TDF_LabelNodeMayModMsk = 0x20000000,
0038 TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk \
0039 | TDF_LabelNodeAttModMsk \
0040 | TDF_LabelNodeMayModMsk)
0041 };
0042
0043
0044
0045
0046
0047 class TDF_LabelNode {
0048
0049 public :
0050
0051
0052
0053
0054
0055 inline TDF_LabelNode* Father() const
0056 { return myFather; }
0057
0058
0059 inline TDF_LabelNode* Brother() const
0060 { return myBrother; }
0061
0062
0063 inline TDF_LabelNode* FirstChild() const
0064 { return myFirstChild; }
0065
0066
0067 inline const Handle(TDF_Attribute)& FirstAttribute() const
0068 { return myFirstAttribute; }
0069
0070
0071 inline Standard_Integer Tag() const
0072 { return myTag; }
0073
0074
0075 inline Standard_Integer Depth() const
0076 { return (myFlags & ~TDF_LabelNodeFlagsMsk); }
0077
0078
0079 inline Standard_Boolean IsRoot() const
0080 { return myFather == NULL; }
0081
0082
0083 Standard_EXPORT TDF_Data * Data() const;
0084
0085
0086 inline void AttributesModified(const Standard_Boolean aStatus)
0087 {
0088 myFlags = (aStatus) ?
0089 (myFlags | TDF_LabelNodeAttModMsk) :
0090 (myFlags & ~TDF_LabelNodeAttModMsk);
0091 if (aStatus) AllMayBeModified();
0092 }
0093
0094 inline Standard_Boolean AttributesModified() const
0095 { return ((myFlags & TDF_LabelNodeAttModMsk) != 0); }
0096
0097
0098 inline void MayBeModified(const Standard_Boolean aStatus)
0099 { myFlags = (aStatus) ?
0100 (myFlags | TDF_LabelNodeMayModMsk) :
0101 (myFlags & ~TDF_LabelNodeMayModMsk); }
0102
0103 inline Standard_Boolean MayBeModified() const
0104 { return ((myFlags & TDF_LabelNodeMayModMsk) != 0); }
0105
0106 private :
0107
0108
0109 DEFINE_NCOLLECTION_ALLOC
0110
0111
0112 TDF_LabelNode(TDF_Data* Data);
0113
0114
0115 void Destroy (const TDF_HAllocator& theAllocator);
0116
0117
0118
0119
0120 friend class TDF_Data;
0121 friend class TDF_Label;
0122
0123 private :
0124
0125
0126
0127
0128
0129 TDF_LabelNode(const Standard_Integer Tag, TDF_LabelNode* Father);
0130
0131
0132 void AddAttribute(const Handle(TDF_Attribute)& afterAtt,
0133 const Handle(TDF_Attribute)& newAtt);
0134
0135 void RemoveAttribute(const Handle(TDF_Attribute)& afterAtt,
0136 const Handle(TDF_Attribute)& oldAtt);
0137
0138 TDF_LabelNode* RootNode ();
0139
0140 const TDF_LabelNode* RootNode () const;
0141
0142 Standard_EXPORT void AllMayBeModified();
0143
0144
0145 inline void Tag(const Standard_Integer aTag)
0146 { myTag = aTag; }
0147
0148
0149 inline void Depth(const Standard_Integer aDepth)
0150 { myFlags = ((myFlags & TDF_LabelNodeFlagsMsk) | aDepth); }
0151
0152
0153 inline void Imported(const Standard_Boolean aStatus)
0154 { myFlags = (aStatus) ?
0155 (myFlags | TDF_LabelNodeImportMsk) :
0156 (myFlags & ~TDF_LabelNodeImportMsk); }
0157
0158 inline Standard_Boolean IsImported() const
0159 { return ((myFlags & TDF_LabelNodeImportMsk) != 0); }
0160
0161
0162
0163
0164 TDF_LabelNodePtr myFather;
0165 TDF_LabelNodePtr myBrother;
0166 TDF_LabelNodePtr myFirstChild;
0167 Standard_ATOMIC(TDF_LabelNodePtr) myLastFoundChild;
0168 Standard_Integer myTag;
0169 Standard_Integer myFlags;
0170 Handle(TDF_Attribute) myFirstAttribute;
0171 #ifdef KEEP_LOCAL_ROOT
0172 TDF_Data * myData;
0173 #endif
0174 #ifdef OCCT_DEBUG
0175 TCollection_AsciiString myDebugEntry;
0176 #endif
0177 };
0178
0179 #endif