1 // File: TNaming_UsedShapes.cxx
2 // Created: Tue Feb 18 15:33:00 1997
3 // Author: Yves FRICAUD
4 // <yfr@claquox.paris1.matra-dtv.fr>
7 #include <TNaming_UsedShapes.ixx>
9 #include <TDF_DeltaOnAddition.hxx>
10 #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
11 #include <TNaming_RefShape.hxx>
12 #include <TNaming_PtrNode.hxx>
16 #include <TopoDS_Shape.hxx>
19 #define BUC60921 //SRN 15/05/01 : Fixes the memory leak due to pointer to RefShape is not deleted
21 //=======================================================================
24 //=======================================================================
26 const Standard_GUID& TNaming_UsedShapes::GetID()
28 static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333");
29 return TNaming_UsedShapesID;
32 //=======================================================================
35 //=======================================================================
37 TNaming_UsedShapes::TNaming_UsedShapes()
42 //=======================================================================
45 //=======================================================================
47 void TNaming_UsedShapes::Destroy()
52 //=======================================================================
53 //function : BackupCopy
55 //=======================================================================
57 Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
59 Handle(TNaming_UsedShapes) Att;
63 //=======================================================================
64 //function : BeforeRemoval
66 //=======================================================================
68 void TNaming_UsedShapes::BeforeRemoval()
78 //=======================================================================
79 //function : AfterUndo
80 //purpose : After application of a TDF_Delta.
81 //=======================================================================
83 Standard_Boolean TNaming_UsedShapes::AfterUndo
84 (const Handle(TDF_AttributeDelta)& anAttDelta,
85 const Standard_Boolean forceIt)
87 if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
88 anAttDelta->Attribute()->BeforeRemoval();
93 //=======================================================================
94 //function : DeltaOnAddition
96 //=======================================================================
98 Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const
100 Handle(TDF_DeltaOnAddition) aDelta;
103 //=======================================================================
104 //function : DeltaOnRemoval
106 //=======================================================================
108 Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const
110 Handle(TDF_DeltaOnRemoval) aDelta;
114 //=======================================================================
117 //=======================================================================
119 void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& anAttribute)
123 //=======================================================================
124 //function : NewEmpty
126 //=======================================================================
128 Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const
130 return new TNaming_UsedShapes();
133 //=======================================================================
136 //=======================================================================
138 void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)& into,
139 const Handle(TDF_RelocationTable)& Tab) const
143 //=======================================================================
146 //=======================================================================
148 Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
151 anOS<<"The content of UsedShapes attribute:"<<endl;
152 TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
153 for (; itr.More(); itr.Next()) {
155 TopAbs::Print(itr.Key().ShapeType(),anOS);
157 itr.Value()->Label().EntryDump(anOS);
158 anOS << " Key_TShape = " <<itr.Key().TShape()->This();
159 anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();
166 //=======================================================================
167 //function : References
169 //=======================================================================
171 void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& aDataSet) const