1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead of "unsigned int"

Code has been updated to remove no-op casts and implicit casts to Standard_Boolean.

Places of inproper use of Standard_Boolean instead of Standard_Integer
have been corrected:
- Bnd_Box, Bnd_Box2d
  Bit flags are now defined as private enum
- HLRAlgo_BiPoint, HLRAlgo_EdgesBlock, HLRBRep_EdgeData, HLRBRep_FaceData
  Bit flags are now defined as enum
- HLRAlgo_EdgeStatus, HLRBRep_BiPnt2D, HLRBRep_BiPoint
  Bit flags are now defined as bool fields
- HLRAlgo_PolyData
  Bit flags are now defined as Standard_Integer
- OSD_DirectoryIterator, OSD_FileIterator
  Boolean flag is now defined as Standard_Boolean
- ShapeAnalysis_Surface::SurfaceNewton()
  now returns Standard_Integer (values 0, 1 or 3)
- ChFi2d_FilletAlgo
  now uses TColStd_SequenceOfBoolean instead of TColStd_SequenceOfInteger
  for storing boolean flags

Method IFSelect_Dispatch::PacketsCount() has been dropped from interface.

ShapeFix_Solid::Status() has been fixed to decode requested status
instead of returning integer value.

TopOpeBRepBuild_Builder1 now defines map storing Standard_Boolean values
instead of Standard_Integer.

Persistence for Standard_Boolean type has been corrected
to keep backward compatibility:
- BinMDataStd, BinTools, FSD_BinaryFile

Broken Draw Harness commands vdisplaymode and verasemode have been removed.

BRepMesh_FastDiscretFace::initDataStructure() - workaround old gcc limitations

BRepMesh_IncrementalMesh::clear() - avoid ambiguity
This commit is contained in:
kgv
2016-08-25 14:58:51 +03:00
committed by abv
parent 3fe9ce0edd
commit dde6883382
211 changed files with 1324 additions and 2667 deletions

View File

@@ -502,12 +502,9 @@ Standard_Boolean TopOpeBRepBuild_Builder::Reverse(const TopAbs_State ToBuild1,co
//=======================================================================
TopAbs_Orientation TopOpeBRepBuild_Builder::Orient(const TopAbs_Orientation Ori,const Standard_Boolean Reverse)
{
TopAbs_Orientation result=TopAbs_FORWARD;
switch (Reverse) {
case Standard_True : result = TopAbs::Complement(Ori); break;
case Standard_False : result = Ori; break;
}
return result;
return !Reverse
? Ori
: TopAbs::Complement(Ori);
}
//=======================================================================

View File

@@ -555,9 +555,8 @@ void TopOpeBRepBuild_Builder1::GFillFaceSameDomSFS(const TopoDS_Shape& FOR,
Standard_Boolean rev = Standard_False;
for(Standard_Integer i = 1; i <= aEM.Extent(); i++) {
const TopoDS_Shape& anEdge = aEM(i);
if(myMapOfEdgeWithFaceState.IsBound(anEdge)) {
rev = (Standard_Boolean)myMapOfEdgeWithFaceState.Find(anEdge);
break;
if (myMapOfEdgeWithFaceState.Find (anEdge, rev)) {
break;
}
}
if(OrigRev)
@@ -671,7 +670,7 @@ void TopOpeBRepBuild_Builder1::GFillFaceSameDomWES(const TopoDS_Shape& FOR1,
WES.AddStartElement(EOR);
}
myMapOfEdgeWithFaceState.Bind(EOR, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (EOR, stateOfFaceOri);
}
if(!UseEdges) {
@@ -740,7 +739,7 @@ void TopOpeBRepBuild_Builder1::GFillWireSameDomWES(const TopoDS_Shape& W,
OrientateEdgeOnFace(TopoDS::Edge(EOR), TopoDS::Face(myBaseFaceToFill),
TopoDS::Face(mySDFaceToFill), G1, stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind(EOR, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (EOR, stateOfFaceOri);
WES.AddElement(EOR);
}
}
@@ -796,7 +795,7 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape& EOR,
Standard_Boolean stateOfFaceOri = Standard_False;
OrientateEdgeOnFace(newE, TopoDS::Face(myBaseFaceToFill),
TopoDS::Face(mySDFaceToFill), G1, stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind(newE, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (newE, stateOfFaceOri);
WES.AddStartElement(newE);
}
@@ -849,7 +848,7 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape& EOR,
if(!IsRev)
aPieceToKeep.Reverse();
myMapOfEdgeWithFaceState.Bind(aPieceToKeep, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (aPieceToKeep, stateOfFaceOri);
WES.AddStartElement(aPieceToKeep);
}
@@ -980,7 +979,7 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape& EOR,
Standard_Boolean stateOfFaceOri = Standard_False;
OrientateEdgeOnFace(aSplitPart, TopoDS::Face(myBaseFaceToFill),
TopoDS::Face(mySDFaceToFill), G1, stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind(aSplitPart, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (aSplitPart, stateOfFaceOri);
WES.AddStartElement(aSplitPart);
}
@@ -1003,7 +1002,7 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape& EOR,
//compute orientation of the future face
Standard_Boolean stateOfFaceOri = Standard_False;
OrientateEdgeOnFace(aSplitPart, TopoDS::Face(myBaseFaceToFill), aSDFace, G1, stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind(aSplitPart, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (aSplitPart, stateOfFaceOri);
if(myBaseFaceToFill == mySDFaceToFill) {
mySourceShapes.Add(aSplitPart);
@@ -1179,7 +1178,7 @@ void TopOpeBRepBuild_Builder1::PerformONParts(const TopoDS_Shape& FOR1,
}
newE.Orientation(neworiE);
myMapOfEdgeWithFaceState.Bind(newE, (Standard_Integer)stateOfFaceOri);
myMapOfEdgeWithFaceState.Bind (newE, stateOfFaceOri);
WES.AddStartElement(newE);
}
}//end iteration on splON

View File

@@ -134,26 +134,17 @@ protected:
private:
TopTools_IndexedMapOfShape mySameDomMap;
TopoDS_Shape mySDFaceToFill;
TopoDS_Shape myBaseFaceToFill;
TopTools_IndexedDataMapOfShapeListOfShape myMapOfEdgeFaces;
TopTools_DataMapOfOrientedShapeInteger myMapOfEdgeWithFaceState;
NCollection_DataMap<TopoDS_Shape, Standard_Boolean, TopTools_OrientedShapeMapHasher> myMapOfEdgeWithFaceState;
TopTools_IndexedMapOfShape myProcessedPartsOut2d;
TopTools_IndexedMapOfShape myProcessedPartsON2d;
TopTools_IndexedMapOfShape mySplitsONtoKeep;
TopTools_IndexedMapOfOrientedShape mySourceShapes;
TopTools_IndexedDataMapOfShapeShape myMapOfCorrect2dEdges;
};
#endif // _TopOpeBRepBuild_Builder1_HeaderFile

View File

@@ -26,9 +26,9 @@
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusUnsh
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,0,0,
0,0,1,
0,1,0,
return TopOpeBRepBuild_GTopo(false, false, false,
false, false, true,
false, true, false,
t1,t2,
TopOpeBRepDS_UNSHGEOMETRY,TopOpeBRepDS_UNSHGEOMETRY);
}
@@ -41,9 +41,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusUnsh
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusSame
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,0,0,
0,1,1,
0,1,0,
return TopOpeBRepBuild_GTopo(false, false, false,
false, true, true,
false, true, false,
t1,t2,
TopOpeBRepDS_SAMEORIENTED,TopOpeBRepDS_SAMEORIENTED);
}
@@ -56,9 +56,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusSame
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusDiff
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,0,0,
0,0,1,
0,1,0,
return TopOpeBRepBuild_GTopo(false, false, false,
false, false, true,
false, true, false,
t1,t2,
TopOpeBRepDS_DIFFORIENTED,TopOpeBRepDS_SAMEORIENTED);
}
@@ -71,9 +71,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GFusDiff
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutUnsh
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
0,0,1,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
false, false, true,
false, false, false,
t1,t2,
TopOpeBRepDS_UNSHGEOMETRY,TopOpeBRepDS_UNSHGEOMETRY);
}
@@ -86,9 +86,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutUnsh
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutSame
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
0,0,1,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
false, false, true,
false, false, false,
t1,t2,
TopOpeBRepDS_SAMEORIENTED,TopOpeBRepDS_SAMEORIENTED);
}
@@ -101,9 +101,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutSame
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutDiff
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
0,1,1,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
false, true, true,
false, false, false,
t1,t2,
TopOpeBRepDS_DIFFORIENTED,TopOpeBRepDS_SAMEORIENTED);
}
@@ -117,9 +117,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GCutDiff
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GComUnsh
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
1,0,0,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
true, false, false,
false, false, false,
t1,t2,
TopOpeBRepDS_UNSHGEOMETRY,TopOpeBRepDS_UNSHGEOMETRY);
}
@@ -132,9 +132,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GComUnsh
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GComSame
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
1,1,0,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
true, true, false,
false, false, false,
t1,t2,
TopOpeBRepDS_SAMEORIENTED,TopOpeBRepDS_SAMEORIENTED);
}
@@ -147,9 +147,9 @@ TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GComSame
TopOpeBRepBuild_GTopo TopOpeBRepBuild_GTool::GComDiff
(const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2)
{
return TopOpeBRepBuild_GTopo(0,1,0,
1,0,0,
0,0,0,
return TopOpeBRepBuild_GTopo(false, true, false,
true, false, false,
false, false, false,
t1,t2,
TopOpeBRepDS_DIFFORIENTED,TopOpeBRepDS_SAMEORIENTED);
}

View File

@@ -36,16 +36,16 @@ TopOpeBRepBuild_GTopo::TopOpeBRepBuild_GTopo()
//=======================================================================
TopOpeBRepBuild_GTopo::TopOpeBRepBuild_GTopo
(const Standard_Integer ii,const Standard_Integer in,const Standard_Integer io,
const Standard_Integer ni,const Standard_Integer nn,const Standard_Integer no,
const Standard_Integer oi,const Standard_Integer on,const Standard_Integer oo,
(const Standard_Boolean ii,const Standard_Boolean in,const Standard_Boolean io,
const Standard_Boolean ni,const Standard_Boolean nn,const Standard_Boolean no,
const Standard_Boolean oi,const Standard_Boolean on,const Standard_Boolean oo,
const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2,
const TopOpeBRepDS_Config C1, const TopOpeBRepDS_Config C2)
{
Reset();
Set((Standard_Boolean)ii,(Standard_Boolean)in,(Standard_Boolean)io,
(Standard_Boolean)ni,(Standard_Boolean)nn,(Standard_Boolean)no,
(Standard_Boolean)oi,(Standard_Boolean)on,(Standard_Boolean)oo);
Set (ii, in, io,
ni, nn, no,
oi, on, oo);
myt1 = t1;
myt2 = t2;
myConfig1 = C1;

View File

@@ -40,8 +40,12 @@ public:
Standard_EXPORT TopOpeBRepBuild_GTopo();
Standard_EXPORT TopOpeBRepBuild_GTopo(const Standard_Integer II, const Standard_Integer IN, const Standard_Integer IO, const Standard_Integer NI, const Standard_Integer NN, const Standard_Integer NO, const Standard_Integer OI, const Standard_Integer ON, const Standard_Integer OO, const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2, const TopOpeBRepDS_Config C1, const TopOpeBRepDS_Config C2);
Standard_EXPORT TopOpeBRepBuild_GTopo (const Standard_Boolean II, const Standard_Boolean IN, const Standard_Boolean IO,
const Standard_Boolean NI, const Standard_Boolean NN, const Standard_Boolean NO,
const Standard_Boolean OI, const Standard_Boolean ON, const Standard_Boolean OO,
const TopAbs_ShapeEnum t1, const TopAbs_ShapeEnum t2,
const TopOpeBRepDS_Config C1, const TopOpeBRepDS_Config C2);
Standard_EXPORT void Reset();
Standard_EXPORT void Set (const Standard_Boolean II, const Standard_Boolean IN, const Standard_Boolean IO, const Standard_Boolean NI, const Standard_Boolean NN, const Standard_Boolean NO, const Standard_Boolean OI, const Standard_Boolean ON, const Standard_Boolean OO);

View File

@@ -297,7 +297,7 @@ static Standard_Boolean FUN_changev(const Handle(TopOpeBRepDS_HDataStructure)& H
if (!changev) return Standard_False;
changev = HDS->HasSameDomain(v);
if (!changev) return Standard_False;
Standard_Boolean rankv = HDS->DS().AncestorRank(v);
Standard_Integer rankv = HDS->DS().AncestorRank(v);
changev = (rankv == 2);
return changev;
}
@@ -1113,14 +1113,11 @@ Standard_Integer TopOpeBRepBuild_Builder::KPisfafa()
/*#ifdef OCCT_DEBUG
Standard_Boolean TKPB = TopOpeBRepBuild_GettraceKPB();
#endif*/
Standard_Boolean iskp1 = KPisfafash(myShape1);
if ( !iskp1 ) return 0;
Standard_Boolean iskp2 = KPisfafash(myShape2);
if ( !iskp2 ) return 0;
return 1;
return KPisfafash(myShape1) != 0
&& KPisfafash(myShape2) != 0
? 1
: 0;
}
//=======================================================================
@@ -1133,14 +1130,11 @@ Standard_Integer TopOpeBRepBuild_Builder::KPissoso()
/*#ifdef OCCT_DEBUG
Standard_Boolean TKPB = TopOpeBRepBuild_GettraceKPB();
#endif*/
Standard_Boolean iskp1 = KPissososh(myShape1);
if ( !iskp1 ) return 0;
Standard_Boolean iskp2 = KPissososh(myShape2);
if ( !iskp2 ) return 0;
return 1;
return KPissososh(myShape1) != 0
&& KPissososh(myShape2) != 0
? 1
: 0;
}
//=======================================================================