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.
23 //Version Date Purpose
24 // 0.0 Feb 6 1997 Creation
26 //#include <TDF_Data.hxx>
28 #ifndef TDF_LabelNode_HeaderFile
29 #define TDF_LabelNode_HeaderFile
31 #include <TCollection_AsciiString.hxx>
32 #include <TDF_Attribute.hxx>
33 #include <TDF_LabelNodePtr.hxx>
34 #include <NCollection_IncAllocator.hxx>
37 class TDF_AttributeIterator;
38 class TDF_ChildIterator;
40 class Handle_TDF_Data;
43 #define KEEP_LOCAL_ROOT
46 TDF_LabelNodeImportMsk = (int) 0x80000000, // Because the sign bit (HP).
47 TDF_LabelNodeAttModMsk = 0x40000000,
48 TDF_LabelNodeMayModMsk = 0x20000000,
49 TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk \
50 | TDF_LabelNodeAttModMsk \
51 | TDF_LabelNodeMayModMsk)
54 //=======================================================================
55 //class: TDF_LabelNode
56 //=======================================================================
63 // --------------------------------------------------------------------------
66 inline TDF_LabelNode* Father() const
70 inline TDF_LabelNode* Brother() const
71 { return myBrother; };
74 inline TDF_LabelNode* FirstChild() const
75 { return myFirstChild; };
78 inline const Handle(TDF_Attribute)& FirstAttribute() const
79 { return myFirstAttribute; };
82 inline Standard_Integer Tag() const
86 inline Standard_Integer Depth() const
87 { return (myFlags & ~TDF_LabelNodeFlagsMsk); };
90 inline Standard_Boolean IsRoot() const
91 { return myFather == NULL; };
94 Standard_EXPORT TDF_Data * Data() const;
96 // Flag AttributesModified access
97 inline void AttributesModified(const Standard_Boolean aStatus)
100 (myFlags | TDF_LabelNodeAttModMsk) :
101 (myFlags & ~TDF_LabelNodeAttModMsk);
102 if (aStatus) AllMayBeModified();
105 inline Standard_Boolean AttributesModified() const
106 { return ((myFlags & TDF_LabelNodeAttModMsk) != 0); };
108 // Flag MayBeModified access
109 inline void MayBeModified(const Standard_Boolean aStatus)
110 { myFlags = (aStatus) ?
111 (myFlags | TDF_LabelNodeMayModMsk) :
112 (myFlags & ~TDF_LabelNodeMayModMsk); };
114 inline Standard_Boolean MayBeModified() const
115 { return ((myFlags & TDF_LabelNodeMayModMsk) != 0); };
118 TDF_LabelNode(TDF_Data* Data); // Useful for root node.
124 void * operator new (size_t aSize,
125 const Handle(NCollection_IncAllocator)& anAlloc)
126 { return anAlloc -> Allocate (aSize); }
127 #if !defined(__BORLANDC__) && (!defined(__SUNPRO_CC) || (__SUNPRO_CC > 0x530))
128 void operator delete (void* theAddress,
129 const Handle(NCollection_IncAllocator)& anAlloc)
133 void operator delete(void *) { }
134 // nothing to do in operator delete since IncAllocator does not need it
136 // --------------------------------------------------------------------------
138 friend class TDF_Data;
139 friend class TDF_Label;
143 void* operator new(size_t);
146 // --------------------------------------------------------------------------
149 TDF_LabelNode(const Standard_Integer Tag, TDF_LabelNode* Father);
152 void AddAttribute(const Handle(TDF_Attribute)& afterAtt,
153 const Handle(TDF_Attribute)& newAtt);
155 void RemoveAttribute(const Handle(TDF_Attribute)& afterAtt,
156 const Handle(TDF_Attribute)& oldAtt);
158 TDF_LabelNode* RootNode ();
160 const TDF_LabelNode* RootNode () const;
162 Standard_EXPORT void AllMayBeModified();
165 inline void Tag(const Standard_Integer aTag)
168 // Depth modification
169 inline void Depth(const Standard_Integer aDepth)
170 { myFlags = ((myFlags & TDF_LabelNodeFlagsMsk) | aDepth); };
172 // Flag Imported access
173 inline void Imported(const Standard_Boolean aStatus)
174 { myFlags = (aStatus) ?
175 (myFlags | TDF_LabelNodeImportMsk) :
176 (myFlags & ~TDF_LabelNodeImportMsk); };
178 inline Standard_Boolean IsImported() const
179 { return ((myFlags & TDF_LabelNodeImportMsk) != 0); };
182 // --------------------------------------------------------------------------
184 TDF_LabelNodePtr myFather;
185 TDF_LabelNodePtr myBrother;
186 TDF_LabelNodePtr myFirstChild;
187 TDF_LabelNodePtr myLastFoundChild; //jfa 10.01.2003
188 Standard_Integer myTag;
189 Standard_Integer myFlags; // Flags & Depth
190 Handle(TDF_Attribute) myFirstAttribute;
191 #ifdef KEEP_LOCAL_ROOT
195 TCollection_AsciiString myDebugEntry;