0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
[occt.git] / src / TNaming / TNaming_UsedShapes.cxx
1 // Created on: 1997-02-18
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <TNaming_UsedShapes.ixx>
24
25 #include <TDF_DeltaOnAddition.hxx>
26 #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
27 #include <TNaming_RefShape.hxx>
28 #include <TNaming_PtrNode.hxx>
29 #define BUC60862
30
31 #ifdef BUC60862
32 #include <TopoDS_Shape.hxx>
33 #endif
34
35 #define BUC60921      //SRN 15/05/01 : Fixes the memory leak due to pointer to RefShape is not deleted
36
37 //=======================================================================
38 //function : GetID
39 //purpose  : 
40 //=======================================================================
41
42 const Standard_GUID& TNaming_UsedShapes::GetID() 
43 {
44   static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333");
45   return TNaming_UsedShapesID;
46 }
47
48 //=======================================================================
49 //function : 
50 //purpose  : 
51 //=======================================================================
52
53 TNaming_UsedShapes::TNaming_UsedShapes() 
54 {
55 }
56
57
58 //=======================================================================
59 //function : Destroy
60 //purpose  : 
61 //=======================================================================
62
63 void TNaming_UsedShapes::Destroy() 
64 {
65   myMap.Clear();
66 }
67
68 //=======================================================================
69 //function : BackupCopy
70 //purpose  : No Backup
71 //=======================================================================
72
73 Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
74 {
75   Handle(TNaming_UsedShapes) Att;
76   return Att;
77 }
78
79 //=======================================================================
80 //function : BeforeRemoval
81 //purpose  : 
82 //=======================================================================
83
84 void TNaming_UsedShapes::BeforeRemoval() 
85 {
86 #ifdef BUC60921
87   Destroy();
88 #else
89   myMap.Clear(); 
90 #endif 
91 }
92
93
94 //=======================================================================
95 //function : AfterUndo
96 //purpose  : After application of a TDF_Delta.
97 //=======================================================================
98
99 Standard_Boolean TNaming_UsedShapes::AfterUndo
100 (const Handle(TDF_AttributeDelta)& anAttDelta,
101  const Standard_Boolean /*forceIt*/)
102 {
103   if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
104     anAttDelta->Attribute()->BeforeRemoval();
105   }
106   return Standard_True;
107 }
108
109 //=======================================================================
110 //function : DeltaOnAddition
111 //purpose  : no delta
112 //=======================================================================
113
114 Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const
115
116   Handle(TDF_DeltaOnAddition) aDelta;
117   return aDelta; 
118 }
119 //=======================================================================
120 //function : DeltaOnRemoval
121 //purpose  : no delta
122 //=======================================================================
123
124 Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const
125 {  
126   Handle(TDF_DeltaOnRemoval) aDelta;
127   return aDelta;
128
129
130 //=======================================================================
131 //function : Restore
132 //purpose  : 
133 //=======================================================================
134
135 void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& /*anAttribute*/) 
136 {
137 }
138
139 //=======================================================================
140 //function : NewEmpty 
141 //purpose  : 
142 //=======================================================================
143
144 Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const
145 {
146   return new TNaming_UsedShapes();
147 }
148
149 //=======================================================================
150 //function : Paste
151 //purpose  : 
152 //=======================================================================
153
154 void  TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&,
155                                 const Handle(TDF_RelocationTable)&) const
156
157 }
158
159 //=======================================================================
160 //function : Dump
161 //purpose  : 
162 //=======================================================================
163
164 Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
165 {
166 #ifdef BUC60862
167   anOS<<"The content of UsedShapes attribute:"<<endl;
168   TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
169   for (; itr.More(); itr.Next()) {
170     anOS<<"  ";
171     TopAbs::Print(itr.Key().ShapeType(),anOS);
172     anOS<<"  ";
173     itr.Value()->Label().EntryDump(anOS);
174     anOS << " Key_TShape   = " <<itr.Key().TShape()->This();
175     anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();    
176     anOS<<endl;
177   }
178 #endif
179   return anOS;
180 }
181
182 //=======================================================================
183 //function : References
184 //purpose  : 
185 //=======================================================================
186
187 void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& ) const
188 {
189 }