1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #ifndef TDF_LabelNode_HeaderFile
21 #define TDF_LabelNode_HeaderFile
23 #include <TCollection_AsciiString.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <TDF_LabelNodePtr.hxx>
26 #include <TDF_HAllocator.hxx>
27 #include <NCollection_DefineAlloc.hxx>
30 class TDF_AttributeIterator;
31 class TDF_ChildIterator;
33 class Handle_TDF_Data;
36 #define KEEP_LOCAL_ROOT
39 TDF_LabelNodeImportMsk = (int) 0x80000000, // Because the sign bit (HP).
40 TDF_LabelNodeAttModMsk = 0x40000000,
41 TDF_LabelNodeMayModMsk = 0x20000000,
42 TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk \
43 | TDF_LabelNodeAttModMsk \
44 | TDF_LabelNodeMayModMsk)
47 //=======================================================================
48 //class: TDF_LabelNode
49 //=======================================================================
56 // --------------------------------------------------------------------------
59 inline TDF_LabelNode* Father() const
63 inline TDF_LabelNode* Brother() const
64 { return myBrother; };
67 inline TDF_LabelNode* FirstChild() const
68 { return myFirstChild; };
71 inline const Handle(TDF_Attribute)& FirstAttribute() const
72 { return myFirstAttribute; };
75 inline Standard_Integer Tag() const
79 inline Standard_Integer Depth() const
80 { return (myFlags & ~TDF_LabelNodeFlagsMsk); };
83 inline Standard_Boolean IsRoot() const
84 { return myFather == NULL; };
87 Standard_EXPORT TDF_Data * Data() const;
89 // Flag AttributesModified access
90 inline void AttributesModified(const Standard_Boolean aStatus)
93 (myFlags | TDF_LabelNodeAttModMsk) :
94 (myFlags & ~TDF_LabelNodeAttModMsk);
95 if (aStatus) AllMayBeModified();
98 inline Standard_Boolean AttributesModified() const
99 { return ((myFlags & TDF_LabelNodeAttModMsk) != 0); };
101 // Flag MayBeModified access
102 inline void MayBeModified(const Standard_Boolean aStatus)
103 { myFlags = (aStatus) ?
104 (myFlags | TDF_LabelNodeMayModMsk) :
105 (myFlags & ~TDF_LabelNodeMayModMsk); };
107 inline Standard_Boolean MayBeModified() const
108 { return ((myFlags & TDF_LabelNodeMayModMsk) != 0); };
113 DEFINE_NCOLLECTION_ALLOC
116 TDF_LabelNode(TDF_Data* Data);
118 // Destructor and deallocator
119 void Destroy (const TDF_HAllocator& theAllocator);
122 // --------------------------------------------------------------------------
124 friend class TDF_Data;
125 friend class TDF_Label;
130 // --------------------------------------------------------------------------
133 TDF_LabelNode(const Standard_Integer Tag, TDF_LabelNode* Father);
136 void AddAttribute(const Handle(TDF_Attribute)& afterAtt,
137 const Handle(TDF_Attribute)& newAtt);
139 void RemoveAttribute(const Handle(TDF_Attribute)& afterAtt,
140 const Handle(TDF_Attribute)& oldAtt);
142 TDF_LabelNode* RootNode ();
144 const TDF_LabelNode* RootNode () const;
146 Standard_EXPORT void AllMayBeModified();
149 inline void Tag(const Standard_Integer aTag)
152 // Depth modification
153 inline void Depth(const Standard_Integer aDepth)
154 { myFlags = ((myFlags & TDF_LabelNodeFlagsMsk) | aDepth); };
156 // Flag Imported access
157 inline void Imported(const Standard_Boolean aStatus)
158 { myFlags = (aStatus) ?
159 (myFlags | TDF_LabelNodeImportMsk) :
160 (myFlags & ~TDF_LabelNodeImportMsk); };
162 inline Standard_Boolean IsImported() const
163 { return ((myFlags & TDF_LabelNodeImportMsk) != 0); };
166 // --------------------------------------------------------------------------
168 TDF_LabelNodePtr myFather;
169 TDF_LabelNodePtr myBrother;
170 TDF_LabelNodePtr myFirstChild;
171 TDF_LabelNodePtr myLastFoundChild; //jfa 10.01.2003
172 Standard_Integer myTag;
173 Standard_Integer myFlags; // Flags & Depth
174 Handle(TDF_Attribute) myFirstAttribute;
175 #ifdef KEEP_LOCAL_ROOT
179 TCollection_AsciiString myDebugEntry;