1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025765: Coding rules - clean up code from obsolete macro checks

Unused code paths (including definition of these macros and meaningless comments) were eliminated.
This commit is contained in:
apn
2015-02-24 19:27:20 +03:00
committed by bugmaster
parent f1b0b4f9c6
commit d2094e110f
130 changed files with 11 additions and 1775 deletions

View File

@@ -37,7 +37,6 @@
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#define OCC351
#ifdef OCCT_DEBUG
//#define MDTV_DEB_SC
#ifdef OCCT_DEBUG_SC
@@ -768,7 +767,6 @@ void TNaming_Localizer::FindShapeContext (const Handle(TNaming_NamedShape)& NS,
}
}
// end szy
#ifdef OCC351
if (!SC.IsNull()) {
Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(SC,Father);
if (!aNS.IsNull()) {
@@ -789,7 +787,6 @@ void TNaming_Localizer::FindShapeContext (const Handle(TNaming_NamedShape)& NS,
}
}
}
#endif
}

View File

@@ -67,11 +67,7 @@
#include <TNaming_NCollections.hxx>
#define BUC60925
#define OCC352
#ifdef OCCT_DEBUG_DBGTOOLS_WRITE
//#define OCC355
#define MDTV_DEB
#define MDTV_DEB_OR
#define MDTV_DEB_UNN
@@ -392,8 +388,6 @@ static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
return TopoDS_Shape();
}
#ifdef OCC352
//=======================================================================
//function : ShapeWithType
//purpose : Tries to make shape with given type from the given shape
@@ -497,8 +491,6 @@ static TopoDS_Shape ShapeWithType(const TopoDS_Shape theShape,
return theShape;
}
#endif
//=======================================================================
//function : FindModifUntil
//purpose :
@@ -613,9 +605,7 @@ static Standard_Boolean ModifUntil (const TDF_Label& L,
{
TopTools_MapOfShape MS;
TDF_LabelMap Forbiden;
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
TNaming_NamingTool::BuildDescendants (Stop, Forbiden); // fills Forbidden from Stop
#ifdef OCCT_DEBUG_GEN
@@ -662,9 +652,7 @@ static Standard_Boolean ConstShape (const TDF_Label& L,
{
TopTools_MapOfShape MS;
TDF_LabelMap Forbiden;
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);
TopoDS_Shape S;
@@ -711,9 +699,7 @@ static Standard_Boolean Intersection (const TDF_Label& L,
const Standard_Integer Index)
{
if (Args.IsEmpty()) return Standard_False;
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
TNaming_ListIteratorOfListOfNamedShape it(Args);
TopTools_MapOfShape MS;
TDF_LabelMap Forbiden;
@@ -901,9 +887,7 @@ static Standard_Boolean Union (const TDF_Label& L,
const TDF_Label& ContextLabel)
{
if (Args.IsEmpty()) return Standard_False;
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
// temporary solution for Orientation name
Standard_Boolean isOr(Standard_True);
/* not completed
@@ -1043,7 +1027,6 @@ static Standard_Boolean Union (const TDF_Label& L,
else cout << "UNION: Shape is NOT found in Context" <<endl;
}
#endif
#ifdef OCC352
if(found)
B.Select(aCand, aCand);
else {
@@ -1065,15 +1048,6 @@ static Standard_Boolean Union (const TDF_Label& L,
#endif
B.Select(aShape,aShape);
}
#else
for (TopTools_MapIteratorOfMapOfShape itM(S.Map()); itM.More(); itM.Next()) {
const TopoDS_Shape& S = itM.Key();
B.Select(S,S);
}
#endif
return Standard_True;
}
@@ -1135,9 +1109,7 @@ static Standard_Boolean Generated (const TDF_Label& L,
// First argument : label of generation
// Next arguments : generators.
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
TDF_Label LabelOfGeneration = Args.First()->Label();
#ifdef OCCT_DEBUG_GEN
@@ -1341,9 +1313,7 @@ static Standard_Boolean Identity (const TDF_Label& L,
if (Args.Extent() > 2) {
Standard_ConstructionError::Raise("TNaming_Name::Solve");
}
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
const Handle(TNaming_NamedShape)& A = Args.First();
TopTools_MapOfShape MS;
TDF_LabelMap Forbiden;
@@ -1355,11 +1325,7 @@ static Standard_Boolean Identity (const TDF_Label& L,
#endif
TNaming_Builder B(L);
for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
#ifdef OCC352
const TopoDS_Shape& S = ShapeWithType(itM.Key(),ShapeType);
#else
const TopoDS_Shape& S = itM.Key();
#endif
#ifdef OCCT_DEBUG_SOL2
//TopAbs_Orientation Or = S.Orientation();
#endif
@@ -1386,9 +1352,7 @@ static Standard_Boolean FilterByNeighbourgs (const TDF_Label& L,
TNaming_Builder B(L);
TDF_LabelMap Forbiden;
#ifdef BUC60925
if(!ValidArgs(Args)) return Standard_False;
#endif
TNaming_NamingTool::BuildDescendants (Stop, Forbiden); //all descendants of Stop (New shapes) are forbidden
if (!Stop.IsNull()) Forbiden.Remove(Stop->Label());
//----------------------------------------

View File

@@ -48,7 +48,6 @@
#include <Standard.hxx>
#include <TNaming_CopyShape.hxx>
#define BUC60921 //SRN 15/05/01 : Fixes the memory leak due to pointer to RefShape is not deleted
//#define MDTV_DEB_HASL
//=======================================================================
//function : GetID
@@ -190,14 +189,12 @@ static void RemoveNode(Standard_Boolean MapExist ,
// le shape disparait
if (MapExist)
M.UnBind(pos->Shape());
//#ifdef BUC60921
N->myOld = 0L;
if(pos != N->myNew)
{
delete pos;
pos = 0L;
}
//#endif
}
}
else {

View File

@@ -62,11 +62,7 @@ typedef TNaming_MapOfShape::Iterator TNaming_MapIteratorOfMapOfShape;
typedef NCollection_DataMap<TopoDS_Shape, TNaming_MapOfShape> TNaming_DataMapOfShapeMapOfShape;
typedef TNaming_DataMapOfShapeMapOfShape::Iterator TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape;
// The bug concerns access to a null object in the method Filter():
#define BUC60847
#define OCC273
#define OCC350
#define OCC352
#define ALLOW_CHILD_NBS
//#define MDTV_DEB_CC
//#define MDTV_DEB_OR
@@ -262,8 +258,6 @@ static Standard_Boolean CompareInGeneration (const Handle(TNaming_NamedShape)& N
return 1;
}
#ifdef OCC350
//=======================================================================
//function : GetShapeEvolutions
//purpose : returns Standard_True, if target has parent in source; list contains inheritance chain
@@ -367,7 +361,6 @@ static Handle(TNaming_NamedShape) CompareInModification (const Handle(TNaming_Na
}
return aResult;
}
#endif
//=======================================================================
static Standard_Boolean FillSMap(const TopoDS_Shape& S, TopTools_MapOfShape& MS)
@@ -448,7 +441,6 @@ static Standard_Boolean TestSolution(const TNaming_Scope& MDF,
Write(S, "TSol_S.brep");
Write(Res, "TSol_Res.brep");
#endif
#ifdef OCC352
if ((S.ShapeType() == TopAbs_FACE ||
S.ShapeType() == TopAbs_EDGE ||
@@ -471,18 +463,6 @@ static Standard_Boolean TestSolution(const TNaming_Scope& MDF,
return aMS.IsEmpty();
} else {
#else
if (S.ShapeType() == TopAbs_SOLID ||
S.ShapeType() == TopAbs_FACE ||
S.ShapeType() == TopAbs_EDGE ||
S.ShapeType() == TopAbs_VERTEX ) {
return (Res.IsSame(S));
}
else {
#endif
TopTools_MapOfShape MS;
Standard_Boolean isHom = FillSMap(S, MS);
TopAbs_ShapeEnum aType(TopAbs_SHAPE);
@@ -682,7 +662,6 @@ static Standard_Boolean Filter (const TDF_Label& F,
Write(S, "FNBS_S.brep");
Write(Neighbourg, "NBS");
#endif
#ifdef OCC273
// mpv : NS and shape must be the same
Standard_Boolean isIn = Standard_False;
TNaming_Iterator anIter(NS);
@@ -697,14 +676,11 @@ static Standard_Boolean Filter (const TDF_Label& F,
}
if (!isIn) if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
// if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
#endif
if (Neighbourg.IsEmpty()) {
// Recherche du vrai context. (Research of context truth)
Handle(TNaming_NamedShape) GenS = TNaming_Tool::NamedShape(S,NS->Label());
#ifdef BUC60847
if (GenS.IsNull()) return Standard_False;
#endif
TDF_Label Father = (GenS->Label()).Father();
Father.FindAttribute(TNaming_NamedShape::GetID(),GenS);
TopoDS_Shape GoodContext = TNaming_Tool::GetShape(GenS);
@@ -1079,9 +1055,7 @@ static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F
// pour construire le nom correspondant a S.
//-------------------------------------------------
#ifdef OCC273
if(NS.IsNull()) return NS;
#endif
TNaming_Localizer Localizer;
TNaming_Iterator itNS(NS);
@@ -1090,8 +1064,6 @@ static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F
// Check + Filtre
//----------------
#ifdef OCC350
Standard_Boolean StandardFilter = !IsGeneration;
if (IsGeneration) {
if (!CompareInGeneration (NS,Selection)) {
@@ -1131,24 +1103,6 @@ static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F
if (StandardFilter) if (!Compare (NS,MDF,Stop,Selection)) {
Filter (F,MDF,Selection,Context,Localizer,NS,0);
}
#else
if (IsGeneration) {
if (!CompareInGeneration (NS,Selection)) {
TopoDS_Shape NewContext;
Handle(TNaming_NamedShape) NewStop;
FindNewShapeInFather (Ident.NamedShapeOfGeneration(),NewContext);
Filter (F,MDF,Selection,NewContext,Localizer,NS,0);
}
}
else {
if (!Compare (NS,MDF,Stop,Selection))
Filter (F,MDF,Selection,Context,Localizer,NS,0);
}
#endif
}
}
if (MDF.WithValid()) MDF.Valid(NS->Label());
@@ -1815,16 +1769,9 @@ Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
BuildScope (MDF,Context,F);
Handle(TNaming_NamedShape) Stop;
#ifdef OCC352
if ((S.ShapeType() == TopAbs_SOLID && !TNaming_Tool::NamedShape(S,F).IsNull()) ||
#else
if (S.ShapeType() == TopAbs_SOLID ||
#endif
S.ShapeType() == TopAbs_FACE ||
S.ShapeType() == TopAbs_EDGE ||
S.ShapeType() == TopAbs_VERTEX ) {
@@ -1849,7 +1796,6 @@ Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
if(S.ShapeType() != TopAbs_WIRE)
theName.Type(TNaming_UNION);
#ifdef OCC352
TopAbs_ShapeEnum atomType;
switch (S.ShapeType()) {
case TopAbs_COMPSOLID:
@@ -1894,20 +1840,13 @@ Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
}
}
}
#else
for (TopoDS_Iterator it(S) ; it.More(); it.Next()) {
theName.Append(BuildName (Naming->Label(),MDF,it.Value(),Context,Stop,Geom));
}
#endif
//Naming->Update();
Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
if (Geom) return NS;
#ifdef OCC273
if(NS.IsNull()) return BuildNS (F,S, TNaming_UNKNOWN);
#endif
if (!Geom && TestSolution(MDF,NS,S)) return NS;
}

View File

@@ -30,9 +30,6 @@
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#define BUC60862
#define OCC273
#define OCC351
//#define MDTV_DEB_SEL
#ifdef OCCT_DEBUG_SEL
@@ -251,15 +248,11 @@ Standard_Boolean TNaming_Selector::IsIdentified (const TDF_Label& L,
else {
NS = Ident.FeatureArg();
#ifdef OCC273
// mpv : external condition
TDF_LabelMap Forbiden,Valid;
TopTools_MapOfShape MS;
TNaming_NamingTool::CurrentShape(Valid,Forbiden,NS,MS);
return (MS.Contains(Selection) && MS.Extent() == 1);
#else
return Standard_True;
#endif
}
}
else if(Ident.Type() == TNaming_GENERATION) {
@@ -372,7 +365,6 @@ Standard_Boolean TNaming_Selector::Select (const TopoDS_Shape& Selection,
// namedshape with SELECTED Evolution
//
TNaming_Builder B (myLabel);
#ifdef OCC351
// mpv: if oldShape for selection is some shape from used map of shapes,
// then naming structure becomes more complex, can be cycles
const TopoDS_Shape& aSelection = TNaming_Tool::CurrentShape(NS); //szy
@@ -388,9 +380,6 @@ Standard_Boolean TNaming_Selector::Select (const TopoDS_Shape& Selection,
B.Select(aSelection,aSelection); // type migration
else
B.Select(Selection,Selection);
#else
B.Select(Selection,Context);
#endif
//
// naming with IDENTITY NameType
//
@@ -398,10 +387,8 @@ Standard_Boolean TNaming_Selector::Select (const TopoDS_Shape& Selection,
N->ChangeName().Type(TNaming_IDENTITY);
N->ChangeName().Append(NS);
N->ChangeName().Orientation(Selection.Orientation());
#ifdef BUC60862
// inserted by vro 06.09.00:
N->ChangeName().ShapeType(Selection.ShapeType());
#endif
myLabel.AddAttribute(N);
return Standard_True;

View File

@@ -22,7 +22,6 @@
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#define BUC60862
//#define MDTV_DEB_INT
//=======================================================================
//function : TNaming_ShapesSet
@@ -51,7 +50,6 @@ TNaming_ShapesSet::TNaming_ShapesSet (const TopoDS_Shape& CS,
}
else {
#ifdef BUC60862
// corrected by vro 13.09.00:
if (Type > CS.ShapeType()) {
for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
@@ -67,12 +65,6 @@ TNaming_ShapesSet::TNaming_ShapesSet (const TopoDS_Shape& CS,
Add(CS);
}
// end of correction by vro.
#else
for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
Add(exp.Current());
}
#endif
}
}

View File

@@ -28,9 +28,6 @@
#include <Standard_NoSuchObject.hxx>
#define BUC60862
#ifdef BUC60862
#include <TNaming_Naming.hxx>
#include <TNaming_ListOfNamedShape.hxx>
#include <TDF_AttributeMap.hxx>
@@ -39,7 +36,6 @@
#include <TDF_ChildIterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
#endif
//=======================================================================
//function : LastModif
@@ -555,7 +551,6 @@ void TNamingTool_Write (const TopoDS_Shape& S,
#endif
#ifdef BUC60862
//=======================================================================
//function : FindShape
//purpose : ANaming
@@ -677,4 +672,3 @@ void TNaming_Tool::FindShape(const TDF_LabelMap& Valid,
#endif
}
#endif

View File

@@ -20,13 +20,8 @@
#include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
#include <TNaming_RefShape.hxx>
#include <TNaming_PtrNode.hxx>
#define BUC60862
#ifdef BUC60862
#include <TopoDS_Shape.hxx>
#endif
#define BUC60921 //SRN 15/05/01 : Fixes the memory leak due to pointer to RefShape is not deleted
//=======================================================================
//function : GetID
@@ -77,11 +72,7 @@ Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
void TNaming_UsedShapes::BeforeRemoval()
{
#ifdef BUC60921
Destroy();
#else
myMap.Clear();
#endif
}
@@ -157,7 +148,6 @@ void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&,
Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
{
#ifdef BUC60862
anOS<<"The content of UsedShapes attribute:"<<endl;
TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
for (; itr.More(); itr.Next()) {
@@ -169,7 +159,6 @@ Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();
anOS<<endl;
}
#endif
return anOS;
}