1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef TDF_LabelNode_HeaderFile
17 #define TDF_LabelNode_HeaderFile
19 #include <TCollection_AsciiString.hxx>
20 #include <TDF_Attribute.hxx>
21 #include <TDF_LabelNodePtr.hxx>
22 #include <TDF_HAllocator.hxx>
23 #include <NCollection_DefineAlloc.hxx>
26 class TDF_AttributeIterator;
27 class TDF_ChildIterator;
31 #define KEEP_LOCAL_ROOT
34 TDF_LabelNodeImportMsk = (int) 0x80000000, // Because the sign bit (HP).
35 TDF_LabelNodeAttModMsk = 0x40000000,
36 TDF_LabelNodeMayModMsk = 0x20000000,
37 TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk \
38 | TDF_LabelNodeAttModMsk \
39 | TDF_LabelNodeMayModMsk)
42 //=======================================================================
43 //class: TDF_LabelNode
44 //=======================================================================
51 // --------------------------------------------------------------------------
54 inline TDF_LabelNode* Father() const
58 inline TDF_LabelNode* Brother() const
62 inline TDF_LabelNode* FirstChild() const
63 { return myFirstChild; }
66 inline const Handle(TDF_Attribute)& FirstAttribute() const
67 { return myFirstAttribute; }
70 inline Standard_Integer Tag() const
74 inline Standard_Integer Depth() const
75 { return (myFlags & ~TDF_LabelNodeFlagsMsk); }
78 inline Standard_Boolean IsRoot() const
79 { return myFather == NULL; }
82 Standard_EXPORT TDF_Data * Data() const;
84 // Flag AttributesModified access
85 inline void AttributesModified(const Standard_Boolean aStatus)
88 (myFlags | TDF_LabelNodeAttModMsk) :
89 (myFlags & ~TDF_LabelNodeAttModMsk);
90 if (aStatus) AllMayBeModified();
93 inline Standard_Boolean AttributesModified() const
94 { return ((myFlags & TDF_LabelNodeAttModMsk) != 0); }
96 // Flag MayBeModified access
97 inline void MayBeModified(const Standard_Boolean aStatus)
98 { myFlags = (aStatus) ?
99 (myFlags | TDF_LabelNodeMayModMsk) :
100 (myFlags & ~TDF_LabelNodeMayModMsk); }
102 inline Standard_Boolean MayBeModified() const
103 { return ((myFlags & TDF_LabelNodeMayModMsk) != 0); }
108 DEFINE_NCOLLECTION_ALLOC
111 TDF_LabelNode(TDF_Data* Data);
113 // Destructor and deallocator
114 void Destroy (const TDF_HAllocator& theAllocator);
117 // --------------------------------------------------------------------------
119 friend class TDF_Data;
120 friend class TDF_Label;
125 // --------------------------------------------------------------------------
128 TDF_LabelNode(const Standard_Integer Tag, TDF_LabelNode* Father);
131 void AddAttribute(const Handle(TDF_Attribute)& afterAtt,
132 const Handle(TDF_Attribute)& newAtt);
134 void RemoveAttribute(const Handle(TDF_Attribute)& afterAtt,
135 const Handle(TDF_Attribute)& oldAtt);
137 TDF_LabelNode* RootNode ();
139 const TDF_LabelNode* RootNode () const;
141 Standard_EXPORT void AllMayBeModified();
144 inline void Tag(const Standard_Integer aTag)
147 // Depth modification
148 inline void Depth(const Standard_Integer aDepth)
149 { myFlags = ((myFlags & TDF_LabelNodeFlagsMsk) | aDepth); }
151 // Flag Imported access
152 inline void Imported(const Standard_Boolean aStatus)
153 { myFlags = (aStatus) ?
154 (myFlags | TDF_LabelNodeImportMsk) :
155 (myFlags & ~TDF_LabelNodeImportMsk); }
157 inline Standard_Boolean IsImported() const
158 { return ((myFlags & TDF_LabelNodeImportMsk) != 0); }
161 // --------------------------------------------------------------------------
163 TDF_LabelNodePtr myFather;
164 TDF_LabelNodePtr myBrother;
165 TDF_LabelNodePtr myFirstChild;
166 TDF_LabelNodePtr myLastFoundChild; //jfa 10.01.2003
167 Standard_Integer myTag;
168 Standard_Integer myFlags; // Flags & Depth
169 Handle(TDF_Attribute) myFirstAttribute;
170 #ifdef KEEP_LOCAL_ROOT
174 TCollection_AsciiString myDebugEntry;