From 3cb513c0cb86a614294e20619cc8123fd67c9571 Mon Sep 17 00:00:00 2001 From: aka Date: Fri, 18 Aug 2017 10:54:00 +0300 Subject: [PATCH] Remove static StepEdit, StepProtocol. Mutex for parser --- src/Interface/Interface_InterfaceModel.cxx | 7 + src/RWStepAP214/RWStepAP214.cxx | 11 +- src/RWStepAP214/RWStepAP214.hxx | 3 +- src/RWStepAP214/RWStepAP214_GeneralModule.cxx | 2 - src/STEPControl/STEPControl_Controller.cxx | 86 ++++++--- src/STEPControl/STEPControl_Controller.hxx | 3 +- src/STEPEdit/STEPEdit.cxx | 78 -------- src/STEPEdit/STEPEdit.hxx | 93 --------- src/StepAP214/StepAP214.cxx | 27 --- src/StepAP214/StepAP214.hxx | 153 --------------- src/StepAP214/StepAP214_Protocol.cxx | 11 +- src/StepAP214/StepAP214_Protocol.hxx | 1 + src/StepFile/StepFile_Read.cxx | 178 +++++++++--------- src/XSAlgo/XSAlgo_AlgoContainer.cxx | 2 +- 14 files changed, 172 insertions(+), 483 deletions(-) delete mode 100644 src/STEPEdit/STEPEdit.cxx delete mode 100644 src/STEPEdit/STEPEdit.hxx delete mode 100644 src/StepAP214/StepAP214.cxx delete mode 100644 src/StepAP214/StepAP214.hxx diff --git a/src/Interface/Interface_InterfaceModel.cxx b/src/Interface/Interface_InterfaceModel.cxx index 419941f59e..ff8e4b9f53 100644 --- a/src/Interface/Interface_InterfaceModel.cxx +++ b/src/Interface/Interface_InterfaceModel.cxx @@ -1048,6 +1048,13 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates Handle(Interface_Static) Interface_InterfaceModel::GetParam (const Standard_CString theParamName) { + if (IsEqual(theParamName, "write.step.schema")) + { + Handle(Standard_Transient) result; + myParamMap.Find(theParamName, result); + Standard_Integer anInt = Handle(Interface_Static)::DownCast(result)->IntegerValue(); + + } Handle(Standard_Transient) result; myParamMap.Find(theParamName, result); return Handle(Interface_Static)::DownCast(result); diff --git a/src/RWStepAP214/RWStepAP214.cxx b/src/RWStepAP214/RWStepAP214.cxx index 6693363283..21835951e8 100644 --- a/src/RWStepAP214/RWStepAP214.cxx +++ b/src/RWStepAP214/RWStepAP214.cxx @@ -18,13 +18,11 @@ #include #include #include -#include -#include #include static int THE_RWStepAP214_init = 0; -void RWStepAP214::Init() +void RWStepAP214::Init(const Handle(StepAP214_Protocol)& theProto) { if (THE_RWStepAP214_init) { @@ -32,8 +30,7 @@ void RWStepAP214::Init() } THE_RWStepAP214_init = 1; RWHeaderSection::Init(); - Handle(StepAP214_Protocol) proto = StepAP214::Protocol(); - Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto); - Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); - StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); + Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule, theProto); + Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule, theProto); + StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule, theProto); } diff --git a/src/RWStepAP214/RWStepAP214.hxx b/src/RWStepAP214/RWStepAP214.hxx index af59444314..eece0e0769 100644 --- a/src/RWStepAP214/RWStepAP214.hxx +++ b/src/RWStepAP214/RWStepAP214.hxx @@ -20,6 +20,7 @@ #include #include #include +#include class RWStepAP214_ReadWriteModule; class RWStepAP214_GeneralModule; @@ -60,7 +61,7 @@ public: //! enforced the initialisation of the libraries - Standard_EXPORT static void Init(); + Standard_EXPORT static void Init(const Handle(StepAP214_Protocol)& theProto); diff --git a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx index b10c5c27aa..05081cb5ad 100644 --- a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx +++ b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx @@ -555,7 +555,6 @@ #include #include #include -#include #include #include #include @@ -1375,7 +1374,6 @@ RWStepAP214_GeneralModule::RWStepAP214_GeneralModule () catstr = Interface_Category::Number("Structure"); catdsc = Interface_Category::Number("Description"); cataux = Interface_Category::Number("Auxiliary"); -//// Interface_GeneralLib::SetGlobal(Handle(RWStepAP214_GeneralModule)::DownCast(This()), StepAP214::Protocol()); } diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index 700b0d1aa0..bd16d3d529 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -30,12 +31,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -60,7 +61,10 @@ IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller) STEPControl_Controller::STEPControl_Controller() : XSControl_Controller("STEP", "step") { - RWHeaderSection::Init(); RWStepAP214::Init(); + RWHeaderSection::Init(); + + myAdaptorProtocol = new StepAP214_Protocol(); + RWStepAP214::Init(Handle(StepAP214_Protocol)::DownCast(myAdaptorProtocol)); Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite; myAdaptorWrite = ActWrite; @@ -68,9 +72,11 @@ STEPControl_Controller::STEPControl_Controller() Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary; swl->SetDumpLabel(1); myAdaptorLibrary = swl; - myAdaptorProtocol = STEPEdit::Protocol(); myAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize + myStepType = new StepSelect_StepType; + myStepType->SetProtocol(myAdaptorProtocol); + SetModeWrite (0,4); SetModeWriteHelp (0,"As Is"); SetModeWriteHelp (1,"Faceted Brep"); @@ -82,9 +88,8 @@ STEPControl_Controller::STEPControl_Controller() DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots")); if (!xmr.IsNull()) { - Handle(IFSelect_Signature) sty = STEPEdit::SignType(); - AddSessionItem (sty,"step-type"); - Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True); + AddSessionItem (myStepType,"step-type"); + Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(myStepType,Standard_False,Standard_True); AddSessionItem (tys,"step-types"); //szv:mySignType = sty; @@ -93,16 +98,32 @@ STEPControl_Controller::STEPControl_Controller() AddSessionItem (new IFSelect_SignAncestor(),"xst-derived"); Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived(); - stdvar->SetProtocol(STEPEdit::Protocol()); + stdvar->SetProtocol(myAdaptorProtocol); AddSessionItem (stdvar,"step-derived"); - Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR(); + //Creates a Selection for ShapeDefinitionRepresentation + Handle(IFSelect_SelectSignature) selsdr = new IFSelect_SelectSignature + (myStepType, "SHAPE_DEFINITION_REPRESENTATION"); selsdr->SetInput (xmr); AddSessionItem (selsdr,"step-shape-def-repr"); - AddSessionItem (STEPEdit::NewSelectPlacedItem(),"step-placed-items"); - // input deja pret avec ModelAll - AddSessionItem (STEPEdit::NewSelectShapeRepr(),"step-shape-repr"); + // Creates a Selection for Placed Items, i.e. MappedItem or + // ContextDependentShapeRepresentation, which itself refers to a + // RepresentationRelationship with possible subtypes (Shape... + // and/or ...WithTransformation) + Handle(IFSelect_SelectSignature) selrrs = new IFSelect_SelectSignature + (myStepType, "MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION", Standard_False); + selrrs->SetInput(new IFSelect_SelectModelEntities); + AddSessionItem (selrrs,"step-placed-items"); + + // Creates a Selection for ShapeRepresentation and its sub - types, + // plus ContextDependentShapeRepresentation (which is not a + // sub-type of ShapeRepresentation) + Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature + (myStepType, "SHAPE_REPRESENTATION", Standard_False); + // REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION + sel->SetInput(new IFSelect_SelectModelEntities); + AddSessionItem (sel,"step-shape-repr"); } //pdn @@ -143,7 +164,8 @@ STEPControl_Controller::STEPControl_Controller() Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const { - return STEPEdit::NewModel(); + APIHeaderSection_MakeHeader head; + return head.NewModel(myAdaptorProtocol); } // #### PROVISOIRE ??? #### @@ -210,29 +232,43 @@ void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) WS->AddNamedItem ("xst-transferrable-roots",st1); if (!slr.IsNull()) { - Handle(IFSelect_Signature) sty = STEPEdit::SignType(); - WS->AddNamedItem ("step-type",sty); + WS->AddNamedItem ("step-type", myStepType); - Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True); + Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(myStepType,Standard_False,Standard_True); WS->AddNamedItem ("step-types",tys); //szv:mySignType = sty; - WS->SetSignType( sty ); + WS->SetSignType(myStepType); //pdn S4133 18.02.99 WS->AddNamedItem ("xst-derived",new IFSelect_SignAncestor()); Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived(); - stdvar->SetProtocol(STEPEdit::Protocol()); + stdvar->SetProtocol(myAdaptorProtocol); WS->AddNamedItem ("step-derived",stdvar); - - Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR(); - selsdr->SetInput (slr); - WS->AddNamedItem ("step-shape-def-repr",selsdr); - Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem(); + + //Creates a Selection for ShapeDefinitionRepresentation + Handle(IFSelect_SelectSignature) selsdr = new IFSelect_SelectSignature + (myStepType, "SHAPE_DEFINITION_REPRESENTATION"); + selsdr->SetInput(slr); + WS->AddNamedItem("step-shape-def-repr", selsdr); + + // Creates a Selection for Placed Items, i.e. MappedItem or + // ContextDependentShapeRepresentation, which itself refers to a + // RepresentationRelationship with possible subtypes (Shape... + // and/or ...WithTransformation) + Handle(IFSelect_SelectSignature) selrrs = new IFSelect_SelectSignature + (myStepType, "MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION", Standard_False); + selrrs->SetInput(new IFSelect_SelectModelEntities); WS->AddNamedItem ("step-placed-items",selrrs); - Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr(); - // input deja pret avec ModelAll - WS->AddNamedItem ("step-shape-repr",selsr); + + // Creates a Selection for ShapeRepresentation and its sub - types, + // plus ContextDependentShapeRepresentation (which is not a + // sub-type of ShapeRepresentation) + Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature + (myStepType, "SHAPE_REPRESENTATION", Standard_False); + // REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION + sel->SetInput(new IFSelect_SelectModelEntities); + WS->AddNamedItem ("step-shape-repr", sel); } //pdn diff --git a/src/STEPControl/STEPControl_Controller.hxx b/src/STEPControl/STEPControl_Controller.hxx index db27a4a5c6..071b934250 100644 --- a/src/STEPControl/STEPControl_Controller.hxx +++ b/src/STEPControl/STEPControl_Controller.hxx @@ -24,6 +24,7 @@ #include #include #include +#include class Interface_InterfaceModel; class Transfer_ActorOfTransientProcess; class XSControl_WorkSession; @@ -71,7 +72,7 @@ protected: private: - + Handle(StepSelect_StepType) myStepType; }; diff --git a/src/STEPEdit/STEPEdit.cxx b/src/STEPEdit/STEPEdit.cxx deleted file mode 100644 index 42e1295cf6..0000000000 --- a/src/STEPEdit/STEPEdit.cxx +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -Handle(Interface_Protocol) STEPEdit::Protocol () -{ -/* - static Handle(StepData_FileProtocol) proto; - if (!proto.IsNull()) return proto; - proto = new StepData_FileProtocol; - proto->Add (StepAP214::Protocol()); - proto->Add (HeaderSection::Protocol()); - return proto; -*/ - return StepAP214::Protocol(); -} - -Handle(StepData_StepModel) STEPEdit::NewModel () -{ - APIHeaderSection_MakeHeader head; - return head.NewModel(STEPEdit::Protocol()); -} - -Handle(IFSelect_Signature) STEPEdit::SignType () -{ - static Handle(StepSelect_StepType) sty; - if (!sty.IsNull()) return sty; - sty = new StepSelect_StepType; - sty->SetProtocol (STEPEdit::Protocol()); - return sty; -} - -Handle(IFSelect_SelectSignature) STEPEdit::NewSelectSDR () -{ - Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature - (STEPEdit::SignType(),"SHAPE_DEFINITION_REPRESENTATION"); - sel->SetInput (new IFSelect_SelectModelRoots); - return sel; -} - -Handle(IFSelect_SelectSignature) STEPEdit::NewSelectPlacedItem () -{ - Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature - (STEPEdit::SignType(),"MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",Standard_False); - sel->SetInput (new IFSelect_SelectModelEntities); - return sel; -} - -Handle(IFSelect_SelectSignature) STEPEdit::NewSelectShapeRepr () -{ - Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature - (STEPEdit::SignType(),"SHAPE_REPRESENTATION",Standard_False); -// REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION - sel->SetInput (new IFSelect_SelectModelEntities); - return sel; -} diff --git a/src/STEPEdit/STEPEdit.hxx b/src/STEPEdit/STEPEdit.hxx deleted file mode 100644 index 5e323a6ba6..0000000000 --- a/src/STEPEdit/STEPEdit.hxx +++ /dev/null @@ -1,93 +0,0 @@ -// Created on: 1998-07-29 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _STEPEdit_HeaderFile -#define _STEPEdit_HeaderFile - -#include -#include -#include - -class Interface_Protocol; -class StepData_StepModel; -class IFSelect_Signature; -class IFSelect_SelectSignature; -class STEPEdit_EditContext; -class STEPEdit_EditSDR; - - -//! Provides tools to exploit and edit a set of STEP data : -//! editors, selections .. -class STEPEdit -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Returns a Protocol fit for STEP (creates the first time) - Standard_EXPORT static Handle(Interface_Protocol) Protocol(); - - //! Returns a new empty StepModel fit for STEP - //! i.e. with its header determined from Protocol - Standard_EXPORT static Handle(StepData_StepModel) NewModel(); - - //! Returns a SignType fit for STEP (creates the first time) - Standard_EXPORT static Handle(IFSelect_Signature) SignType(); - - //! Creates a Selection for ShapeDefinitionRepresentation - //! By default searches among root entities - Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectSDR(); - - //! Creates a Selection for Placed Items, i.e. MappedItem or - //! ContextDependentShapeRepresentation, which itself refers to a - //! RepresentationRelationship with possible subtypes (Shape... - //! and/or ...WithTransformation) - //! By default in the whole StepModel - Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectPlacedItem(); - - //! Creates a Selection for ShapeRepresentation and its sub-types, - //! plus ContextDependentShapeRepresentation (which is not a - //! sub-type of ShapeRepresentation) - //! By default in the whole StepModel - Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectShapeRepr(); - - - - -protected: - - - - - -private: - - - - -friend class STEPEdit_EditContext; -friend class STEPEdit_EditSDR; - -}; - - - - - - - -#endif // _STEPEdit_HeaderFile diff --git a/src/StepAP214/StepAP214.cxx b/src/StepAP214/StepAP214.cxx deleted file mode 100644 index 77702ead72..0000000000 --- a/src/StepAP214/StepAP214.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include - -StaticHandle(StepAP214_Protocol, proto); - -Handle(StepAP214_Protocol) StepAP214::Protocol() - - { - InitHandleVoid(StepAP214_Protocol, proto); - return proto; - } - diff --git a/src/StepAP214/StepAP214.hxx b/src/StepAP214/StepAP214.hxx deleted file mode 100644 index c603454984..0000000000 --- a/src/StepAP214/StepAP214.hxx +++ /dev/null @@ -1,153 +0,0 @@ -// Created on: 1995-12-01 -// Created by: EXPRESS->CDL V0.2 Translator -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _StepAP214_HeaderFile -#define _StepAP214_HeaderFile - -#include -#include -#include - -class StepAP214_Protocol; -class StepAP214_AutoDesignDateAndPersonItem; -class StepAP214_AutoDesignDateAndTimeItem; -class StepAP214_AutoDesignDatedItem; -class StepAP214_AutoDesignGeneralOrgItem; -class StepAP214_AutoDesignOrganizationItem; -class StepAP214_AutoDesignGroupedItem; -class StepAP214_AutoDesignPresentedItemSelect; -class StepAP214_AutoDesignReferencingItem; -class StepAP214_DateAndTimeItem; -class StepAP214_DateItem; -class StepAP214_ApprovalItem; -class StepAP214_OrganizationItem; -class StepAP214_DocumentReferenceItem; -class StepAP214_GroupItem; -class StepAP214_PersonAndOrganizationItem; -class StepAP214_PresentedItemSelect; -class StepAP214_SecurityClassificationItem; -class StepAP214_Protocol; -class StepAP214_AutoDesignApprovalAssignment; -class StepAP214_AutoDesignActualDateAndTimeAssignment; -class StepAP214_AutoDesignNominalDateAndTimeAssignment; -class StepAP214_AutoDesignActualDateAssignment; -class StepAP214_AutoDesignNominalDateAssignment; -class StepAP214_AutoDesignGroupAssignment; -class StepAP214_AutoDesignOrganizationAssignment; -class StepAP214_AutoDesignDateAndPersonAssignment; -class StepAP214_AutoDesignPersonAndOrganizationAssignment; -class StepAP214_AutoDesignPresentedItem; -class StepAP214_AutoDesignSecurityClassificationAssignment; -class StepAP214_AutoDesignDocumentReference; -class StepAP214_AppliedApprovalAssignment; -class StepAP214_AppliedDateAndTimeAssignment; -class StepAP214_AppliedDateAssignment; -class StepAP214_AppliedGroupAssignment; -class StepAP214_AppliedOrganizationAssignment; -class StepAP214_AppliedPersonAndOrganizationAssignment; -class StepAP214_AppliedPresentedItem; -class StepAP214_AppliedSecurityClassificationAssignment; -class StepAP214_AppliedDocumentReference; -class StepAP214_AppliedExternalIdentificationAssignment; -class StepAP214_Class; -class StepAP214_ExternalIdentificationItem; -class StepAP214_ExternallyDefinedClass; -class StepAP214_ExternallyDefinedGeneralProperty; -class StepAP214_RepItemGroup; - - -//! Complete AP214 CC1 , Revision 4 -//! Upgrading from Revision 2 to Revision 4 : 26 Mar 1997 -//! Splitting in sub-schemas : 5 Nov 1997 -class StepAP214 -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! creates a Protocol - Standard_EXPORT static Handle(StepAP214_Protocol) Protocol(); - - - - -protected: - - - - - -private: - - - - -friend class StepAP214_AutoDesignDateAndPersonItem; -friend class StepAP214_AutoDesignDateAndTimeItem; -friend class StepAP214_AutoDesignDatedItem; -friend class StepAP214_AutoDesignGeneralOrgItem; -friend class StepAP214_AutoDesignOrganizationItem; -friend class StepAP214_AutoDesignGroupedItem; -friend class StepAP214_AutoDesignPresentedItemSelect; -friend class StepAP214_AutoDesignReferencingItem; -friend class StepAP214_DateAndTimeItem; -friend class StepAP214_DateItem; -friend class StepAP214_ApprovalItem; -friend class StepAP214_OrganizationItem; -friend class StepAP214_DocumentReferenceItem; -friend class StepAP214_GroupItem; -friend class StepAP214_PersonAndOrganizationItem; -friend class StepAP214_PresentedItemSelect; -friend class StepAP214_SecurityClassificationItem; -friend class StepAP214_Protocol; -friend class StepAP214_AutoDesignApprovalAssignment; -friend class StepAP214_AutoDesignActualDateAndTimeAssignment; -friend class StepAP214_AutoDesignNominalDateAndTimeAssignment; -friend class StepAP214_AutoDesignActualDateAssignment; -friend class StepAP214_AutoDesignNominalDateAssignment; -friend class StepAP214_AutoDesignGroupAssignment; -friend class StepAP214_AutoDesignOrganizationAssignment; -friend class StepAP214_AutoDesignDateAndPersonAssignment; -friend class StepAP214_AutoDesignPersonAndOrganizationAssignment; -friend class StepAP214_AutoDesignPresentedItem; -friend class StepAP214_AutoDesignSecurityClassificationAssignment; -friend class StepAP214_AutoDesignDocumentReference; -friend class StepAP214_AppliedApprovalAssignment; -friend class StepAP214_AppliedDateAndTimeAssignment; -friend class StepAP214_AppliedDateAssignment; -friend class StepAP214_AppliedGroupAssignment; -friend class StepAP214_AppliedOrganizationAssignment; -friend class StepAP214_AppliedPersonAndOrganizationAssignment; -friend class StepAP214_AppliedPresentedItem; -friend class StepAP214_AppliedSecurityClassificationAssignment; -friend class StepAP214_AppliedDocumentReference; -friend class StepAP214_AppliedExternalIdentificationAssignment; -friend class StepAP214_Class; -friend class StepAP214_ExternalIdentificationItem; -friend class StepAP214_ExternallyDefinedClass; -friend class StepAP214_ExternallyDefinedGeneralProperty; -friend class StepAP214_RepItemGroup; - -}; - - - - - - - -#endif // _StepAP214_HeaderFile diff --git a/src/StepAP214/StepAP214_Protocol.cxx b/src/StepAP214/StepAP214_Protocol.cxx index 0653fcbff0..a92f41fc8f 100644 --- a/src/StepAP214/StepAP214_Protocol.cxx +++ b/src/StepAP214/StepAP214_Protocol.cxx @@ -749,8 +749,6 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI #include #include -static int THE_StepAP214_Protocol_init = 0; -static Interface_DataMapOfTransientInteger types(800); //======================================================================= //function : StepAP214_Protocol @@ -758,14 +756,9 @@ static Interface_DataMapOfTransientInteger types(800); //======================================================================= StepAP214_Protocol::StepAP214_Protocol () : - myShemaName(schemaAP214IS) + myShemaName(schemaAP214IS), + types(800) { - if (THE_StepAP214_Protocol_init) - { - return; - } - THE_StepAP214_Protocol_init = 1; - types.Bind (STANDARD_TYPE(StepBasic_Address), 1); types.Bind (STANDARD_TYPE(StepShape_AdvancedBrepShapeRepresentation), 2); types.Bind (STANDARD_TYPE(StepShape_AdvancedFace), 3); diff --git a/src/StepAP214/StepAP214_Protocol.hxx b/src/StepAP214/StepAP214_Protocol.hxx index cb0f01f5ec..3d491f1356 100644 --- a/src/StepAP214/StepAP214_Protocol.hxx +++ b/src/StepAP214/StepAP214_Protocol.hxx @@ -64,6 +64,7 @@ protected: private: Standard_CString myShemaName; + Interface_DataMapOfTransientInteger types; }; diff --git a/src/StepFile/StepFile_Read.cxx b/src/StepFile/StepFile_Read.cxx index 9ce43273dc..1ef93d5ad0 100644 --- a/src/StepFile/StepFile_Read.cxx +++ b/src/StepFile/StepFile_Read.cxx @@ -47,6 +47,7 @@ extern "C" void recfile_modeprint (int mode); // controle trace recfile #include #include +#include #ifdef OCCT_DEBUG #define CHRONOMESURE @@ -117,115 +118,120 @@ Standard_Integer StepFile_Read const Handle(StepData_FileRecognizer)& recodata) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - char *ficnom = nomfic ; // because const (non reconnu par C) - - checkread->Clear(); - recfile_modeprint ( (modepr > 0 ? modepr-1 : 0) ); - FILE* newin = stepread_setinput(ficnom); - if (!newin) return -1; + static Standard_Mutex aPars; + { + Standard_Mutex::Sentry aLock(aPars); + + Handle(Message_Messenger) sout = Message::DefaultMessenger(); + char *ficnom = nomfic; // because const (non reconnu par C) + + checkread->Clear(); + recfile_modeprint(( modepr > 0 ? modepr - 1 : 0 )); + FILE* newin = stepread_setinput(ficnom); + if (!newin) return -1; #ifdef CHRONOMESURE - Standard_Integer n ; - OSD_Timer c ; - c.Reset () ; - c.Start(); - sout << " ... Step File Reading : " << ficnom << "" << endl; + Standard_Integer n; + OSD_Timer c; + c.Reset(); + c.Start(); + sout << " ... Step File Reading : " << ficnom << "" << endl; #endif - try { - OCC_CATCH_SIGNALS - if (stepread () != 0) { lir_file_fin(3); stepread_endinput (newin,ficnom); return 1; } - } - catch (Standard_Failure const& anException) { + try { + OCC_CATCH_SIGNALS + if (stepread() != 0) { lir_file_fin(3); stepread_endinput(newin, ficnom); return 1; } + } + catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG - sout << " ... Exception Raised while reading Step File : " << ficnom << ":\n" << endl; - sout << anException.GetMessageString(); - sout << " ..." << endl; + sout << " ... Exception Raised while reading Step File : " << ficnom << ":\n" << endl; + sout << anException.GetMessageString(); + sout << " ..." << endl; #endif - (void)anException; - lir_file_fin(3); - stepread_endinput (newin,ficnom); - return 1; - } - // Continue reading of file despite of possible fails - //if (checkread->HasFailed()) { lir_file_fin(3); stepread_endinput (newin,ficnom); return 1; } + (void)anException; + lir_file_fin(3); + stepread_endinput(newin, ficnom); + return 1; + } + // Continue reading of file despite of possible fails + //if (checkread->HasFailed()) { lir_file_fin(3); stepread_endinput (newin,ficnom); return 1; } #ifdef CHRONOMESURE - sout << " ... STEP File Read ... " << endl; - c.Show(); + sout << " ... STEP File Read ... " << endl; + c.Show(); #endif -// Creation du StepReaderData - - LesTypes[rec_argNondef] = Interface_ParamVoid ; - LesTypes[rec_argSub] = Interface_ParamSub ; - LesTypes[rec_argIdent] = Interface_ParamIdent ; - LesTypes[rec_argInteger] = Interface_ParamInteger ; - LesTypes[rec_argFloat] = Interface_ParamReal ; - LesTypes[rec_argEnum] = Interface_ParamEnum ; - LesTypes[rec_argBinary] = Interface_ParamBinary ; - LesTypes[rec_argText] = Interface_ParamText ; - LesTypes[rec_argHexa] = Interface_ParamHexa ; - LesTypes[rec_argMisc] = Interface_ParamMisc ; - - Standard_Integer nbhead, nbrec, nbpar; - lir_file_nbr (&nbhead,&nbrec,&nbpar); // renvoi par lex/yacc - Handle(StepData_StepReaderData) undirec = - new StepData_StepReaderData(nbhead,nbrec,nbpar); // creation tableau de records - - for ( Standard_Integer nr = 1; nr <= nbrec; nr ++) { - int nbarg; char* ident; char* typrec = 0; - lir_file_rec (&ident, &typrec, &nbarg); - undirec->SetRecord (nr, ident, typrec, nbarg); - - if (nbarg>0) { - int typa; char* val; - Interface_ParamType newtype; - while(lir_file_arg (&typa, &val) == 1) { - newtype = LesTypes[typa] ; - undirec->AddStepParam (nr, val, newtype); + // Creation du StepReaderData + + LesTypes[rec_argNondef] = Interface_ParamVoid; + LesTypes[rec_argSub] = Interface_ParamSub; + LesTypes[rec_argIdent] = Interface_ParamIdent; + LesTypes[rec_argInteger] = Interface_ParamInteger; + LesTypes[rec_argFloat] = Interface_ParamReal; + LesTypes[rec_argEnum] = Interface_ParamEnum; + LesTypes[rec_argBinary] = Interface_ParamBinary; + LesTypes[rec_argText] = Interface_ParamText; + LesTypes[rec_argHexa] = Interface_ParamHexa; + LesTypes[rec_argMisc] = Interface_ParamMisc; + + Standard_Integer nbhead, nbrec, nbpar; + lir_file_nbr(&nbhead, &nbrec, &nbpar); // renvoi par lex/yacc + Handle(StepData_StepReaderData) undirec = + new StepData_StepReaderData(nbhead, nbrec, nbpar); // creation tableau de records + + for (Standard_Integer nr = 1; nr <= nbrec; nr++) { + int nbarg; char* ident; char* typrec = 0; + lir_file_rec(&ident, &typrec, &nbarg); + undirec->SetRecord(nr, ident, typrec, nbarg); + + if (nbarg > 0) { + int typa; char* val; + Interface_ParamType newtype; + while (lir_file_arg(&typa, &val) == 1) { + newtype = LesTypes[typa]; + undirec->AddStepParam(nr, val, newtype); + } } + undirec->InitParams(nr); + lir_file_finrec(); } - undirec->InitParams(nr); - lir_file_finrec(); - } - lir_file_fin(1); -// on a undirec pret pour la suite + lir_file_fin(1); + // on a undirec pret pour la suite #ifdef CHRONOMESURE - sout << " ... Step File loaded ... " << endl; - c.Show(); - sout << " "<< undirec->NbRecords () << - " records (entities,sub-lists,scopes), "<< nbpar << " parameters\n" << endl; + sout << " ... Step File loaded ... " << endl; + c.Show(); + sout << " " << undirec->NbRecords() << + " records (entities,sub-lists,scopes), " << nbpar << " parameters\n" << endl; #endif -// Analyse : par StepReaderTool + // Analyse : par StepReaderTool - StepData_StepReaderTool readtool (undirec,protocol); - readtool.SetErrorHandle (Standard_True); + StepData_StepReaderTool readtool(undirec, protocol); + readtool.SetErrorHandle(Standard_True); - readtool.PrepareHeader(recoheader); // Header. reco nul -> pour Protocol - readtool.Prepare(recodata); // Data. reco nul -> pour Protocol + readtool.PrepareHeader(recoheader); // Header. reco nul -> pour Protocol + readtool.Prepare(recodata); // Data. reco nul -> pour Protocol #ifdef CHRONOMESURE - sout << " ... Parameters prepared ... "; - c.Show(); + sout << " ... Parameters prepared ... "; + c.Show(); #endif - readtool.LoadModel(stepmodel); - if (stepmodel->Protocol().IsNull()) stepmodel->SetProtocol (protocol); - lir_file_fin(2); - - readtool.Clear(); - undirec.Nullify(); + readtool.LoadModel(stepmodel); + if (stepmodel->Protocol().IsNull()) stepmodel->SetProtocol(protocol); + lir_file_fin(2); + + readtool.Clear(); + undirec.Nullify(); #ifdef CHRONOMESURE - sout << " ... Objets analysed ... " << endl; - c.Show(); - n = stepmodel->NbEntities() ; - sout << " STEP Loading done : " << n << " Entities" << endl; + sout << " ... Objets analysed ... " << endl; + c.Show(); + n = stepmodel->NbEntities(); + sout << " STEP Loading done : " << n << " Entities" << endl; #endif - - stepread_endinput (newin,ficnom); return 0 ; + + stepread_endinput(newin, ficnom); return 0; + } } void StepFile_Interrupt (char* mess) diff --git a/src/XSAlgo/XSAlgo_AlgoContainer.cxx b/src/XSAlgo/XSAlgo_AlgoContainer.cxx index 89b6243d88..a38666fa89 100644 --- a/src/XSAlgo/XSAlgo_AlgoContainer.cxx +++ b/src/XSAlgo/XSAlgo_AlgoContainer.cxx @@ -137,7 +137,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape, try { OCC_CATCH_SIGNALS Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator; - Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape(); + Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;// ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape(); sfs->Init ( shape ); sfs->SetMsgRegistrator ( msg ); sfs->SetPrecision ( Prec ); -- 2.39.5