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

0033375: Coding - Static Analyzing processing. Performance

Performance update applied:
  - moving to const reference as much as possible
Result of CLANG_TIDY (static analyzing filter: perform*)
This commit is contained in:
dpasukhi
2023-05-06 22:56:45 +00:00
committed by vglukhik
parent c28dd7f1cf
commit b2fedee6a1
265 changed files with 603 additions and 611 deletions

View File

@@ -1166,7 +1166,7 @@ Handle(StepDimTol_HArray1OfDatumReferenceModifier) STEPCAFControl_GDTProperty::
GetDatumRefModifiers(const XCAFDimTolObjects_DatumModifiersSequence& theModifiers,
const XCAFDimTolObjects_DatumModifWithValue& theModifWithVal,
const Standard_Real theValue,
const StepBasic_Unit theUnit)
const StepBasic_Unit& theUnit)
{
if ((theModifiers.Length() == 0) && (theModifWithVal == XCAFDimTolObjects_DatumModifWithValue_None))
return NULL;
@@ -1307,7 +1307,7 @@ Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetTolValueType(con
//function : GetTessellation
//purpose :
//=======================================================================
Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape theShape)
Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape& theShape)
{
// Build coordinate list and curves
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger;

View File

@@ -99,9 +99,9 @@ public:
Standard_EXPORT static Handle(StepDimTol_HArray1OfDatumReferenceModifier) GetDatumRefModifiers(const XCAFDimTolObjects_DatumModifiersSequence& theModifiers,
const XCAFDimTolObjects_DatumModifWithValue& theModifWithVal,
const Standard_Real theValue,
const StepBasic_Unit theUnit);
const StepBasic_Unit& theUnit);
Standard_EXPORT static Handle(StepVisual_TessellatedGeometricSet) GetTessellation(const TopoDS_Shape theShape);
Standard_EXPORT static Handle(StepVisual_TessellatedGeometricSet) GetTessellation(const TopoDS_Shape& theShape);
};

View File

@@ -99,7 +99,7 @@ void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& the
// function : setStatic
// purpose :
//=======================================================================
void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter)
void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection& theParameter)
{
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);

View File

@@ -139,7 +139,7 @@ public:
void initStatic(const Handle(DE_ConfigurationNode)& theNode);
//! Initialize static variables
void setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter);
void setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection& theParameter);
//! Reset used interface static variables
void resetStatic();

View File

@@ -781,7 +781,7 @@ TDF_Label STEPCAFControl_Reader::AddShape(const TopoDS_Shape &S,
// check whether it has associated external ref
TColStd_SequenceOfHAsciiString SHAS;
if (ShapePDMap.IsBound(S) && PDFileMap.IsBound(ShapePDMap.Find(S))) {
Handle(STEPCAFControl_ExternFile) EF = PDFileMap.Find(ShapePDMap.Find(S));
const Handle(STEPCAFControl_ExternFile)& EF = PDFileMap.Find(ShapePDMap.Find(S));
if (!EF.IsNull()) {
// (store information on extern refs in the document)
SHAS.Append(EF->GetName());
@@ -1231,7 +1231,7 @@ static Standard_Boolean IsOverriden(const Interface_Graph& theGraph,
return Standard_True;
}
// for root style returns true only if it is overridden by other root style
auto anItem = anOverRidingStyle->ItemAP242 ().Value ();
const Handle(Standard_Transient)& anItem = anOverRidingStyle->ItemAP242().Value();
if(!anItem.IsNull() && anItem->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation)))
{
return Standard_True;
@@ -1315,7 +1315,7 @@ static TDF_Label GetLabelFromPD(const Handle(StepBasic_ProductDefinition) &PD,
{
TDF_Label L;
if (PDFileMap.IsBound(PD)) {
Handle(STEPCAFControl_ExternFile) EF = PDFileMap.Find(PD);
const Handle(STEPCAFControl_ExternFile)& EF = PDFileMap.Find(PD);
if (!EF.IsNull()) {
L = EF->GetLabel();
if (!L.IsNull()) return L;
@@ -1348,7 +1348,7 @@ TDF_Label STEPCAFControl_Reader::FindInstance(const Handle(StepRepr_NextAssembly
TDF_Label L;
// get shape resulting from CDSR (in fact, only location is interesting)
Handle(Transfer_TransientProcess) TP = Tool.TransientProcess();
const Handle(Transfer_TransientProcess)& TP = Tool.TransientProcess();
Handle(Transfer_Binder) binder = TP->Find(NAUO);
if (binder.IsNull() || !binder->HasResult()) {
#ifdef OCCT_DEBUG
@@ -1468,7 +1468,7 @@ static TDF_Label GetLabelFromPD(const Handle(StepBasic_ProductDefinition) &PD,
{
TDF_Label L;
if (PDFileMap.IsBound(PD)) {
Handle(STEPCAFControl_ExternFile) EF = PDFileMap.Find(PD);
const Handle(STEPCAFControl_ExternFile)& EF = PDFileMap.Find(PD);
if (!EF.IsNull()) {
L = EF->GetLabel();
if (!L.IsNull()) return L;
@@ -2093,7 +2093,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
//function : readAnnotationPlane
//purpose : read annotation plane
//=======================================================================
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) theAnnotationPlane,
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& theAnnotationPlane,
gp_Ax2& thePlane)
{
if (theAnnotationPlane.IsNull())
@@ -2239,7 +2239,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
//purpose : read connection points for given dimension
//=======================================================================
void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
const Handle(Standard_Transient) theGDT,
const Handle(Standard_Transient)& theGDT,
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject)
{
if (theGDT.IsNull() || theDimObject.IsNull())
@@ -2252,7 +2252,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
Handle(StepShape_ShapeDimensionRepresentation) aSDR = NULL;
for (Interface_EntityIterator anIt = aGraph.Sharings(theGDT); aSDR.IsNull() && anIt.More(); anIt.Next()) {
Handle(Standard_Transient) anEnt = anIt.Value();
const Handle(Standard_Transient)& anEnt = anIt.Value();
Handle(StepShape_DimensionalCharacteristicRepresentation) aDCR =
Handle(StepShape_DimensionalCharacteristicRepresentation)::DownCast(anEnt);
if (!aDCR.IsNull())
@@ -2355,7 +2355,7 @@ static Standard_Boolean ReadDatums(const Handle(XCAFDoc_ShapeTool) &STool,
const Interface_Graph &graph,
const Handle(Transfer_TransientProcess) &TP,
const TDF_Label TolerL,
const Handle(StepDimTol_GeometricToleranceWithDatumReference) GTWDR)
const Handle(StepDimTol_GeometricToleranceWithDatumReference)& GTWDR)
{
if (GTWDR.IsNull()) return Standard_False;
Handle(StepDimTol_HArray1OfDatumReference) HADR = GTWDR->DatumSystem();
@@ -2772,14 +2772,14 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
for (anIter.Start(); anIter.More(); anIter.Next()) {
Handle(Standard_Transient) anAtr = anIter.Value();
const Handle(Standard_Transient)& anAtr = anIter.Value();
if (anAtr->IsKind(STANDARD_TYPE(StepDimTol_DatumSystem)))
{
Standard_Integer aPositionCounter = 0;//position on frame
Handle(StepDimTol_DatumSystem) aDS = Handle(StepDimTol_DatumSystem)::DownCast(anAtr);
Interface_EntityIterator anIterDS = aGraph.Sharings(aDS);
for (anIterDS.Start(); anIterDS.More(); anIterDS.Next()) {
Handle(Standard_Transient) anAtrDS = anIterDS.Value();
const Handle(Standard_Transient)& anAtrDS = anIterDS.Value();
if (anAtrDS->IsKind(STANDARD_TYPE(StepAP242_GeometricItemSpecificUsage)))
{
//get axis
@@ -2957,7 +2957,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
// Collect all Shape_Aspect entities
Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
for (anIter.Start(); anIter.More(); anIter.Next()) {
Handle(Standard_Transient) anAtr = anIter.Value();
const Handle(Standard_Transient)& anAtr = anIter.Value();
NCollection_Sequence<Handle(StepRepr_ShapeAspect)> aSAs;
if (anAtr->IsKind(STANDARD_TYPE(StepRepr_ProductDefinitionShape)))
{
@@ -2965,14 +2965,14 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
Interface_EntityIterator anIterSDR = aGraph.Sharings(anAtr);
for (anIterSDR.Start(); anIterSDR.More(); anIterSDR.Next())
{
Handle(Standard_Transient) anAtrSDR = anIterSDR.Value();
const Handle(Standard_Transient)& anAtrSDR = anIterSDR.Value();
if (anAtrSDR->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation)))
{
isAllOver = Standard_True;
Interface_EntityIterator anIterABSR = aGraph.Shareds(anAtrSDR);
for (anIterABSR.Start(); anIterABSR.More(); anIterABSR.Next())
{
Handle(Standard_Transient) anAtrABSR = anIterABSR.Value();
const Handle(Standard_Transient)& anAtrABSR = anIterABSR.Value();
if (anAtrABSR->IsKind(STANDARD_TYPE(StepShape_AdvancedBrepShapeRepresentation)))
{
aSeqRI1.Append(anAtrABSR);
@@ -4416,7 +4416,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
void collectViewShapes(const Handle(XSControl_WorkSession)& theWS,
const Handle(TDocStd_Document)& theDoc,
const Handle(StepRepr_Representation) theRepr,
const Handle(StepRepr_Representation)& theRepr,
TDF_LabelSequence& theShapes)
{
Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
@@ -4451,7 +4451,7 @@ void collectViewShapes(const Handle(XSControl_WorkSession)& theWS,
//=======================================================================
Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel,
TDF_LabelSequence& theClippingPlanes,
const Handle(XCAFDoc_ClippingPlaneTool) theTool)
const Handle(XCAFDoc_ClippingPlaneTool)& theTool)
{
Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString();
NCollection_Sequence<Handle(StepGeom_GeometricRepresentationItem)> aPlanes;
@@ -4790,7 +4790,7 @@ void STEPCAFControl_Reader::ExpandSubShapes(const Handle(XCAFDoc_ShapeTool)& Sha
// topological containers to expand
for (Standard_Integer i = 1; i <= aReprItems.Length(); ++i)
{
Handle(StepRepr_RepresentationItem) aTRepr = aReprItems.Value(i);
const Handle(StepRepr_RepresentationItem)& aTRepr = aReprItems.Value(i);
if (aTRepr->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep)))
aMSBSeq.Append(aTRepr);
else if (aTRepr->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel)))

View File

@@ -318,7 +318,7 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFil
for (NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator anExtFileIter(myFiles);
anExtFileIter.More(); anExtFileIter.Next())
{
Handle(STEPCAFControl_ExternFile) anExtFile = anExtFileIter.Value();
const Handle(STEPCAFControl_ExternFile)& anExtFile = anExtFileIter.Value();
if (anExtFile->GetWriteStatus() != IFSelect_RetVoid)
{
continue;
@@ -1040,7 +1040,7 @@ static Standard_Boolean setDefaultInstanceColor(const Handle(StepVisual_StyledIt
aFatherStyleIter.More(); aFatherStyleIter.Next())
{
StepVisual_PresentationStyleSelect aPSS;
StepVisual_PresentationStyleSelect anOlDPSS = aFatherStyleIter.Value();
const StepVisual_PresentationStyleSelect& anOlDPSS = aFatherStyleIter.Value();
if (!anOlDPSS.PointStyle().IsNull())
aPSS.SetValue(anOlDPSS.PointStyle());
else if (!anOlDPSS.CurveStyle().IsNull())
@@ -1090,7 +1090,7 @@ static void MakeSTEPStyles(STEPConstruct_Styles& theStyles,
if (theInherit) aStyle = *theInherit;
if (theSettings.Contains(theShape))
{
XCAFPrs_Style anOwnStyle = theSettings.FindFromKey(theShape);
const XCAFPrs_Style& anOwnStyle = theSettings.FindFromKey(theShape);
if (!anOwnStyle.IsVisible())
aStyle.SetVisibility(Standard_False);
if (anOwnStyle.IsSetColorCurv())
@@ -2315,7 +2315,7 @@ static StepBasic_Unit GetUnit(const Handle(StepRepr_RepresentationContext)& theR
//purpose : auxiliary
//======================================================================
static Handle(StepRepr_ReprItemAndMeasureWithUnit) CreateDimValue(const Standard_Real theValue,
const StepBasic_Unit theUnit,
const StepBasic_Unit& theUnit,
const Handle(TCollection_HAsciiString)& theName,
const Standard_CString theMeasureName,
const Standard_Boolean theIsAngle,
@@ -2375,7 +2375,7 @@ static Handle(StepRepr_ReprItemAndMeasureWithUnit) CreateDimValue(const Standard
//=======================================================================
Handle(StepRepr_ShapeAspect) STEPCAFControl_Writer::writeShapeAspect(const Handle(XSControl_WorkSession)& theWS,
const TDF_Label theLabel,
const TopoDS_Shape theShape,
const TopoDS_Shape& theShape,
Handle(StepRepr_RepresentationContext)& theRC,
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU)
{
@@ -2432,7 +2432,7 @@ Handle(StepRepr_ShapeAspect) STEPCAFControl_Writer::writeShapeAspect(const Handl
for (Interface_EntityIterator aSharingIter = aGraph.Sharings(aPDS);
aSharingIter.More() && aSDR.IsNull(); aSharingIter.Next())
{
Handle(Standard_Transient) anEntity = aSharingIter.Value();
const Handle(Standard_Transient)& anEntity = aSharingIter.Value();
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(anEntity);
}
if (aSDR.IsNull())
@@ -2457,7 +2457,7 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
const Standard_Boolean theHasPlane,
const gp_Ax2& theAnnotationPlane,
const gp_Pnt& theTextPosition,
const Handle(Standard_Transient) theDimension)
const Handle(Standard_Transient)& theDimension)
{
if (thePresentation.IsNull())
return;
@@ -2509,7 +2509,7 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
// Plane
Handle(StepGeom_Plane) aPlane = new StepGeom_Plane();
GeomToStep_MakeAxis2Placement3d anAxisMaker(theAnnotationPlane);
Handle(StepGeom_Axis2Placement3d) anAxis = anAxisMaker.Value();
const Handle(StepGeom_Axis2Placement3d)& anAxis = anAxisMaker.Value();
// Set text position to plane origin
Handle(StepGeom_CartesianPoint) aTextPos = new StepGeom_CartesianPoint();
Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
@@ -2540,7 +2540,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
const TDF_LabelSequence& theShapeL,
const TDF_Label& theDatumL,
const Standard_Boolean theIsFirstDTarget,
const Handle(StepDimTol_Datum) theWrittenDatum)
const Handle(StepDimTol_Datum)& theWrittenDatum)
{
// Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
@@ -2799,14 +2799,14 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
// qualifiers, modifiers, orientation and tolerance class)
//======================================================================
static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_DimensionObject) theObject,
const Handle(StepRepr_RepresentationContext) theRC,
const StepShape_DimensionalCharacteristic theDimension)
const Handle(XCAFDimTolObjects_DimensionObject)& theObject,
const Handle(StepRepr_RepresentationContext)& theRC,
const StepShape_DimensionalCharacteristic& theDimension)
{
// Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
XCAFDimTolObjects_DimensionModifiersSequence aModifiers = theObject->GetModifiers();
Handle(Standard_Transient) aDim = theDimension.Value();
const Handle(Standard_Transient)& aDim = theDimension.Value();
Standard_Boolean isAngle = aDim->IsKind(STANDARD_TYPE(StepShape_AngularLocation)) ||
aDim->IsKind(STANDARD_TYPE(StepShape_AngularSize));
@@ -2929,7 +2929,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
gp_Dir aDir;
theObject->GetDirection(aDir);
GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0));
Handle(StepGeom_CartesianPoint) aLoc = MkPoint.Value();
const Handle(StepGeom_CartesianPoint)& aLoc = MkPoint.Value();
Handle(StepGeom_Direction) anAxis = new StepGeom_Direction();
Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
aCoords->SetValue(1, aDir.X());
@@ -3022,7 +3022,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
//======================================================================
static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_DimensionObject)& theObject,
const Handle(StepRepr_ConstructiveGeometryRepresentation) theRepr,
const Handle(StepRepr_ConstructiveGeometryRepresentation)& theRepr,
Handle(StepRepr_ShapeAspect)& theFirstSA,
Handle(StepRepr_ShapeAspect)& theSecondSA,
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts)
@@ -3078,8 +3078,8 @@ static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
//======================================================================
static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const Handle(XSControl_WorkSession)& theWS,
const TDF_Label theGeomTolL,
const TDF_LabelSequence theDatumSeq,
const STEPConstruct_DataMapOfAsciiStringTransient theDatumMap,
const TDF_LabelSequence& theDatumSeq,
const STEPConstruct_DataMapOfAsciiStringTransient& theDatumMap,
const Handle(StepRepr_RepresentationContext)& theRC)
{
// Get working data

View File

@@ -237,7 +237,7 @@ protected:
Handle(StepRepr_ShapeAspect) writeShapeAspect(const Handle(XSControl_WorkSession)& theWS,
const TDF_Label theLabel,
const TopoDS_Shape theShape,
const TopoDS_Shape& theShape,
Handle(StepRepr_RepresentationContext)& theRC,
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU);
@@ -248,13 +248,13 @@ protected:
const Standard_Boolean theHasPlane,
const gp_Ax2& theAnnotationPlane,
const gp_Pnt& theTextPosition,
const Handle(Standard_Transient) theDimension);
const Handle(Standard_Transient)& theDimension);
Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theShapeL,
const TDF_Label& theDatumL,
const Standard_Boolean isFirstDTarget,
const Handle(StepDimTol_Datum) theWrittenDatum);
const Handle(StepDimTol_Datum)& theWrittenDatum);
void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,