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

Coding - Remove static global variables #238

Refactor IGES Protocols to eliminate redundant type registrations
This commit is contained in:
dpasukhi
2025-01-04 21:39:32 +00:00
parent 0665ef79f8
commit a4443d74ad
8 changed files with 357 additions and 445 deletions

View File

@@ -11,6 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <IGESSolid_Protocol.hxx>
#include <IGESGeom.hxx>
#include <IGESGeom_Protocol.hxx>
@@ -25,7 +26,6 @@
#include <IGESSolid_Loop.hxx>
#include <IGESSolid_ManifoldSolid.hxx>
#include <IGESSolid_PlaneSurface.hxx>
#include <IGESSolid_Protocol.hxx>
#include <IGESSolid_RightAngularWedge.hxx>
#include <IGESSolid_SelectedComponent.hxx>
#include <IGESSolid_Shell.hxx>
@@ -41,82 +41,71 @@
#include <Interface_Protocol.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_Protocol,IGESData_Protocol)
static int THE_IGESSolid_Protocol_deja = 0;
static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06,
atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15,
atype16,atype17,atype18,atype19,atype20,atype21,atype22,atype23,atype24;
IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_Protocol, IGESData_Protocol)
IGESSolid_Protocol::IGESSolid_Protocol()
{}
Standard_Integer IGESSolid_Protocol::NbResources() const
{
if (THE_IGESSolid_Protocol_deja)
{
return;
}
THE_IGESSolid_Protocol_deja = 1;
atype01 = STANDARD_TYPE(IGESSolid_Block);
atype02 = STANDARD_TYPE(IGESSolid_BooleanTree);
atype03 = STANDARD_TYPE(IGESSolid_ConeFrustum);
atype04 = STANDARD_TYPE(IGESSolid_ConicalSurface);
atype05 = STANDARD_TYPE(IGESSolid_Cylinder);
atype06 = STANDARD_TYPE(IGESSolid_CylindricalSurface);
atype07 = STANDARD_TYPE(IGESSolid_EdgeList);
atype08 = STANDARD_TYPE(IGESSolid_Ellipsoid);
atype09 = STANDARD_TYPE(IGESSolid_Face);
atype10 = STANDARD_TYPE(IGESSolid_Loop);
atype11 = STANDARD_TYPE(IGESSolid_ManifoldSolid);
atype12 = STANDARD_TYPE(IGESSolid_PlaneSurface);
atype13 = STANDARD_TYPE(IGESSolid_RightAngularWedge);
atype14 = STANDARD_TYPE(IGESSolid_SelectedComponent);
atype15 = STANDARD_TYPE(IGESSolid_Shell);
atype16 = STANDARD_TYPE(IGESSolid_SolidAssembly);
atype17 = STANDARD_TYPE(IGESSolid_SolidInstance);
atype18 = STANDARD_TYPE(IGESSolid_SolidOfLinearExtrusion);
atype19 = STANDARD_TYPE(IGESSolid_SolidOfRevolution);
atype20 = STANDARD_TYPE(IGESSolid_Sphere);
atype21 = STANDARD_TYPE(IGESSolid_SphericalSurface);
atype22 = STANDARD_TYPE(IGESSolid_ToroidalSurface);
atype23 = STANDARD_TYPE(IGESSolid_Torus);
atype24 = STANDARD_TYPE(IGESSolid_VertexList);
return 1;
}
Standard_Integer IGESSolid_Protocol::NbResources () const
{ return 1; }
Handle(Interface_Protocol) IGESSolid_Protocol::Resource
(const Standard_Integer /*num*/) const
Handle(Interface_Protocol) IGESSolid_Protocol::Resource(const Standard_Integer /*num*/) const
{
Handle(Interface_Protocol) res = IGESGeom::Protocol();
return res;
}
Standard_Integer IGESSolid_Protocol::TypeNumber
(const Handle(Standard_Type)& atype) const
Standard_Integer IGESSolid_Protocol::TypeNumber(const Handle(Standard_Type)& atype) const
{
if (atype == atype01) return 1;
else if (atype == atype02) return 2;
else if (atype == atype03) return 3;
else if (atype == atype04) return 4;
else if (atype == atype05) return 5;
else if (atype == atype06) return 6;
else if (atype == atype07) return 7;
else if (atype == atype08) return 8;
else if (atype == atype09) return 9;
else if (atype == atype10) return 10;
else if (atype == atype11) return 11;
else if (atype == atype12) return 12;
else if (atype == atype13) return 13;
else if (atype == atype14) return 14;
else if (atype == atype15) return 15;
else if (atype == atype16) return 16;
else if (atype == atype17) return 17;
else if (atype == atype18) return 18;
else if (atype == atype19) return 19;
else if (atype == atype20) return 20;
else if (atype == atype21) return 21;
else if (atype == atype22) return 22;
else if (atype == atype23) return 23;
else if (atype == atype24) return 24;
if (atype == STANDARD_TYPE(IGESSolid_Block))
return 1;
else if (atype == STANDARD_TYPE(IGESSolid_BooleanTree))
return 2;
else if (atype == STANDARD_TYPE(IGESSolid_ConeFrustum))
return 3;
else if (atype == STANDARD_TYPE(IGESSolid_ConicalSurface))
return 4;
else if (atype == STANDARD_TYPE(IGESSolid_Cylinder))
return 5;
else if (atype == STANDARD_TYPE(IGESSolid_CylindricalSurface))
return 6;
else if (atype == STANDARD_TYPE(IGESSolid_EdgeList))
return 7;
else if (atype == STANDARD_TYPE(IGESSolid_Ellipsoid))
return 8;
else if (atype == STANDARD_TYPE(IGESSolid_Face))
return 9;
else if (atype == STANDARD_TYPE(IGESSolid_Loop))
return 10;
else if (atype == STANDARD_TYPE(IGESSolid_ManifoldSolid))
return 11;
else if (atype == STANDARD_TYPE(IGESSolid_PlaneSurface))
return 12;
else if (atype == STANDARD_TYPE(IGESSolid_RightAngularWedge))
return 13;
else if (atype == STANDARD_TYPE(IGESSolid_SelectedComponent))
return 14;
else if (atype == STANDARD_TYPE(IGESSolid_Shell))
return 15;
else if (atype == STANDARD_TYPE(IGESSolid_SolidAssembly))
return 16;
else if (atype == STANDARD_TYPE(IGESSolid_SolidInstance))
return 17;
else if (atype == STANDARD_TYPE(IGESSolid_SolidOfLinearExtrusion))
return 18;
else if (atype == STANDARD_TYPE(IGESSolid_SolidOfRevolution))
return 19;
else if (atype == STANDARD_TYPE(IGESSolid_Sphere))
return 20;
else if (atype == STANDARD_TYPE(IGESSolid_SphericalSurface))
return 21;
else if (atype == STANDARD_TYPE(IGESSolid_ToroidalSurface))
return 22;
else if (atype == STANDARD_TYPE(IGESSolid_Torus))
return 23;
else if (atype == STANDARD_TYPE(IGESSolid_VertexList))
return 24;
return 0;
}