From f7baa387b6946dd353e5f3eacc98d2f20d91fec3 Mon Sep 17 00:00:00 2001 From: aba Date: Wed, 17 Jul 2013 17:29:51 +0400 Subject: [PATCH] Rebase of the "0023997" on the new master --- src/BRepToIGES/BRepToIGES_BREntity.cdl | 8 +- src/BRepToIGES/BRepToIGES_BREntity.cxx | 1 - src/BRepToIGESBRep/BRepToIGESBRep_Entity.cdl | 2 +- src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx | 1 - src/HeaderSection/FILES | 2 + src/HeaderSection/HeaderSection.cdl | 2 +- .../HeaderSection_HeaderRecognizer.cdl | 32 - .../HeaderSection_HeaderRecognizer.cxx | 25 +- .../HeaderSection_HeaderRecognizer.hxx | 43 + src/IFSelect/IFSelect.cdl | 3 - src/IFSelect/IFSelect_FileModifier.cdl | 58 - src/IFSelect/IFSelect_ModelModifier.cdl | 72 - src/IFSelect/IFSelect_ModelModifier.gxx | 41 - src/IFSelect/IFSelect_SelectList.cdl | 67 - src/IFSelect/IFSelect_SelectList.gxx | 44 - src/IGESAppli/IGESAppli_ElementResults.cdl | 24 +- src/IGESAppli/IGESAppli_NodalDisplAndRot.cdl | 26 +- src/IGESBasic/FILES | 12 + src/IGESBasic/IGESBasic.cdl | 28 +- ...GESBasic_HArray1OfHArray1OfIGESEntity.cxx} | 8 +- ...IGESBasic_HArray1OfHArray1OfIGESEntity.hxx | 40 + ...ic_HArray1OfHArray1OfIGESEntity_Handle.hxx | 29 + .../IGESBasic_HArray1OfHArray1OfInteger.cxx | 22 + .../IGESBasic_HArray1OfHArray1OfInteger.hxx | 40 + ...Basic_HArray1OfHArray1OfInteger_Handle.hxx | 29 + .../IGESBasic_HArray1OfHArray1OfReal.cxx | 21 + .../IGESBasic_HArray1OfHArray1OfReal.hxx | 39 + ...GESBasic_HArray1OfHArray1OfReal_Handle.hxx | 29 + .../IGESBasic_HArray1OfHArray1OfXYZ.cxx | 21 + .../IGESBasic_HArray1OfHArray1OfXYZ.hxx | 40 + ...IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx | 29 + src/IGESCAFControl/FILES | 4 + src/IGESCAFControl/IGESCAFControl.cdl | 4 +- src/IGESCAFControl/IGESCAFControl_Reader.cdl | 107 - src/IGESCAFControl/IGESCAFControl_Reader.cxx | 7 +- src/IGESCAFControl/IGESCAFControl_Reader.hxx | 102 + src/IGESCAFControl/IGESCAFControl_Writer.cdl | 125 - src/IGESCAFControl/IGESCAFControl_Writer.cxx | 12 +- src/IGESCAFControl/IGESCAFControl_Writer.hxx | 118 + src/IGESControl/FILES | 9 + src/IGESControl/IGESControl.cdl | 9 +- src/IGESControl/IGESControl_ActorWrite.cdl | 43 - src/IGESControl/IGESControl_ActorWrite.cxx | 23 +- src/IGESControl/IGESControl_ActorWrite.hxx | 60 + src/IGESControl/IGESControl_Controller.cdl | 75 - src/IGESControl/IGESControl_Controller.cxx | 32 +- src/IGESControl/IGESControl_Controller.hxx | 84 + src/IGESControl/IGESControl_Reader.cdl | 101 - src/IGESControl/IGESControl_Reader.cxx | 12 +- src/IGESControl/IGESControl_Reader.hxx | 111 + src/IGESControl/IGESControl_Reader.lxx | 4 +- src/IGESControl/IGESControl_Writer.cdl | 107 - src/IGESControl/IGESControl_Writer.cxx | 7 +- src/IGESControl/IGESControl_Writer.hxx | 116 + src/IGESData/FILES | 8 + src/IGESData/IGESData.cdl | 11 +- .../IGESData_FileRecognizer.cxx} | 9 +- src/IGESData/IGESData_FileRecognizer.hxx | 46 + src/IGESData/IGESData_IGESReaderTool.cdl | 109 - src/IGESData/IGESData_IGESReaderTool.cxx | 11 +- src/IGESData/IGESData_IGESReaderTool.hxx | 139 ++ src/IGESData/IGESData_SpecificLib.cxx | 30 + src/IGESData/IGESData_SpecificLib.hxx | 45 + src/IGESData/IGESData_WriterLib.cxx | 30 + src/IGESData/IGESData_WriterLib.hxx | 47 + src/IGESDefs/FILES | 4 + src/IGESDefs/IGESDefs.cdl | 6 +- src/IGESDefs/IGESDefs_AssociativityDef.cdl | 8 +- src/IGESDefs/IGESDefs_AttributeDef.cdl | 6 +- ..._HArray1OfHArray1OfTextDisplayTemplate.cxx | 21 + ..._HArray1OfHArray1OfTextDisplayTemplate.hxx | 40 + ...1OfHArray1OfTextDisplayTemplate_Handle.hxx | 26 + src/IGESDefs/IGESDefs_TabularData.cdl | 14 +- src/IGESGeom/IGESGeom_Boundary.cdl | 10 +- src/IGESGraph/IGESGraph_TextFontDef.cdl | 18 +- src/IGESGraph/IGESGraph_ToolTextFontDef.cxx | 1 - src/IGESSelect/FILES | 6 + src/IGESSelect/IGESSelect.cdl | 12 +- src/IGESSelect/IGESSelect_AddFileComment.cdl | 65 - src/IGESSelect/IGESSelect_AddFileComment.cxx | 21 +- src/IGESSelect/IGESSelect_AddFileComment.hxx | 76 + src/IGESSelect/IGESSelect_FileModifier.cxx | 34 + src/IGESSelect/IGESSelect_FileModifier.hxx | 48 + src/IGESSelect/IGESSelect_FloatFormat.cdl | 92 - src/IGESSelect/IGESSelect_FloatFormat.cxx | 18 +- src/IGESSelect/IGESSelect_FloatFormat.hxx | 98 + src/IGESSelect/IGESSelect_ModelModifier.cdl | 57 + src/IGESSelect/IGESSelect_ModelModifier.cxx | 56 + src/IGESSolid/IGESSolid.cdl | 6 +- src/IGESSolid/IGESSolid_Loop.cdl | 17 +- src/IGESToBRep/FILES | 4 + src/IGESToBRep/IGESToBRep.cdl | 4 +- src/IGESToBRep/IGESToBRep_Actor.cdl | 57 - src/IGESToBRep/IGESToBRep_Actor.cxx | 21 +- src/IGESToBRep/IGESToBRep_Actor.hxx | 83 + src/IGESToBRep/IGESToBRep_CurveAndSurface.cdl | 8 +- src/IGESToBRep/IGESToBRep_Reader.cdl | 108 - src/IGESToBRep/IGESToBRep_Reader.cxx | 13 +- src/IGESToBRep/IGESToBRep_Reader.hxx | 120 + src/Interface/FILES | 6 + src/Interface/Interface.cdl | 10 +- src/Interface/Interface_GeneralLib.cxx | 30 + src/Interface/Interface_GeneralLib.hxx | 45 + src/Interface/Interface_JaggedArray.cdl | 47 - src/Interface/Interface_JaggedArray.gxx | 39 - src/Interface/Interface_JaggedArray.hxx | 64 + src/Interface/Interface_ReaderLib.cxx | 30 + src/Interface/Interface_ReaderLib.hxx | 41 + src/Interface/Interface_Recognizer.cdl | 79 - src/Interface/Interface_Recognizer.gxx | 61 - src/Interface/Interface_Recognizer.hxx | 85 + src/LibCtl/FILES | 8 +- src/LibCtl/LibCtl.cdl | 3 +- src/LibCtl/LibCtl_GlobalNode.gxx | 48 - src/LibCtl/LibCtl_Library.cdl | 188 -- src/LibCtl/LibCtl_Library.gxx | 157 -- src/LibCtl/LibCtl_Library.hxx | 352 +++ src/LibCtl/LibCtl_Node.gxx | 45 - src/LibCtl/LibCtl_ProtocolTemplate.cdl | 59 - src/MoniTool/MoniTool.cdl | 9 +- src/MoniTool/MoniTool_DataInfo.cdl | 35 - src/MoniTool/MoniTool_Elem.cdl | 62 - src/MoniTool/MoniTool_Elem.gxx | 41 - src/STEPCAFControl/FILES | 8 + src/STEPCAFControl/STEPCAFControl.cdl | 8 +- .../STEPCAFControl_ActorWrite.cdl | 50 - .../STEPCAFControl_ActorWrite.cxx | 18 +- .../STEPCAFControl_ActorWrite.hxx | 68 + .../STEPCAFControl_Controller.cdl | 36 - .../STEPCAFControl_Controller.cxx | 18 +- .../STEPCAFControl_Controller.hxx | 54 + .../STEPCAFControl_ExternFile.cdl | 8 +- src/STEPCAFControl/STEPCAFControl_Reader.cdl | 308 --- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 23 +- src/STEPCAFControl/STEPCAFControl_Reader.hxx | 241 ++ src/STEPCAFControl/STEPCAFControl_Writer.cdl | 227 -- src/STEPCAFControl/STEPCAFControl_Writer.cxx | 13 +- src/STEPCAFControl/STEPCAFControl_Writer.hxx | 197 ++ src/STEPConstruct/STEPConstruct.cdl | 6 +- src/STEPConstruct/STEPConstruct.cxx | 2 + .../STEPConstruct_ExternRefs.cdl | 6 +- src/STEPConstruct/STEPConstruct_Styles.cdl | 10 +- src/STEPConstruct/STEPConstruct_Tool.cdl | 22 +- .../STEPConstruct_ValidationProps.cdl | 10 +- src/STEPControl/FILES | 10 + src/STEPControl/STEPControl.cdl | 12 +- src/STEPControl/STEPControl_ActorRead.cdl | 158 -- src/STEPControl/STEPControl_ActorRead.cxx | 19 +- src/STEPControl/STEPControl_ActorRead.hxx | 153 ++ src/STEPControl/STEPControl_ActorWrite.cdl | 116 - src/STEPControl/STEPControl_ActorWrite.cxx | 17 +- src/STEPControl/STEPControl_ActorWrite.hxx | 118 + src/STEPControl/STEPControl_Controller.cdl | 71 - src/STEPControl/STEPControl_Controller.cxx | 21 +- src/STEPControl/STEPControl_Controller.hxx | 96 + src/STEPControl/STEPControl_Reader.cdl | 102 - src/STEPControl/STEPControl_Reader.cxx | 10 +- src/STEPControl/STEPControl_Reader.hxx | 126 + src/STEPControl/STEPControl_Writer.cdl | 111 - src/STEPControl/STEPControl_Writer.cxx | 6 +- src/STEPControl/STEPControl_Writer.hxx | 130 + src/STEPSelections/FILES | 2 + src/STEPSelections/STEPSelections.cdl | 2 +- .../STEPSelections_SelectForTransfer.cdl | 31 - .../STEPSelections_SelectForTransfer.cxx | 23 +- .../STEPSelections_SelectForTransfer.hxx | 51 + src/StepAP209/StepAP209_Construct.cdl | 6 +- src/StepData/FILES | 6 + src/StepData/StepData.cdl | 8 +- .../StepData_FileRecognizer.cxx} | 11 +- src/StepData/StepData_FileRecognizer.hxx | 46 + src/StepData/StepData_StepReaderTool.cdl | 95 - src/StepData/StepData_StepReaderTool.cxx | 8 +- src/StepData/StepData_StepReaderTool.hxx | 100 + src/StepData/StepData_WriterLib.cxx | 31 + src/StepData/StepData_WriterLib.hxx | 47 + src/StepSelect/FILES | 4 + src/StepSelect/StepSelect.cdl | 7 +- src/StepSelect/StepSelect_FileModifier.cxx | 33 + src/StepSelect/StepSelect_FileModifier.hxx | 52 + src/StepSelect/StepSelect_FloatFormat.cdl | 92 - src/StepSelect/StepSelect_FloatFormat.cxx | 18 +- src/StepSelect/StepSelect_FloatFormat.hxx | 116 + src/StepToTopoDS/StepToTopoDS_Builder.cdl | 30 +- src/StepToTopoDS/StepToTopoDS_Builder.cxx | 1 + .../StepToTopoDS_MakeTransformed.cdl | 4 +- .../StepToTopoDS_MakeTransformed.cxx | 1 + src/StepToTopoDS/StepToTopoDS_Tool.cdl | 10 +- .../StepToTopoDS_TranslateCompositeCurve.cdl | 10 +- .../StepToTopoDS_TranslateCompositeCurve.cxx | 2 +- ...pToTopoDS_TranslateCurveBoundedSurface.cdl | 6 +- ...pToTopoDS_TranslateCurveBoundedSurface.cxx | 1 + src/TopoDSToStep/TopoDSToStep.cdl | 4 +- src/TopoDSToStep/TopoDSToStep.cxx | 1 + src/TopoDSToStep/TopoDSToStep_Builder.cdl | 6 +- src/TopoDSToStep/TopoDSToStep_Builder.cxx | 10 +- .../TopoDSToStep_MakeBrepWithVoids.cdl | 4 +- .../TopoDSToStep_MakeFacetedBrep.cdl | 6 +- ...ToStep_MakeFacetedBrepAndBrepWithVoids.cdl | 4 +- .../TopoDSToStep_MakeGeometricCurveSet.cdl | 4 +- .../TopoDSToStep_MakeManifoldSolidBrep.cdl | 6 +- ...opoDSToStep_MakeShellBasedSurfaceModel.cdl | 8 +- .../TopoDSToStep_MakeStepEdge.cdl | 6 +- .../TopoDSToStep_MakeStepEdge.cxx | 1 + .../TopoDSToStep_MakeStepFace.cdl | 6 +- .../TopoDSToStep_MakeStepFace.cxx | 1 + .../TopoDSToStep_MakeStepVertex.cdl | 6 +- .../TopoDSToStep_MakeStepVertex.cxx | 2 +- .../TopoDSToStep_MakeStepWire.cdl | 6 +- .../TopoDSToStep_MakeStepWire.cxx | 1 + .../TopoDSToStep_WireframeBuilder.cdl | 6 +- src/Transfer/FILES | 28 + src/Transfer/Transfer.cdl | 63 +- src/Transfer/Transfer_Actor.gxx | 68 - src/Transfer/Transfer_Actor.hxx | 147 ++ src/Transfer/Transfer_ActorDispatch.cdl | 73 - src/Transfer/Transfer_ActorDispatch.cxx | 23 +- src/Transfer/Transfer_ActorDispatch.hxx | 94 + .../Transfer_ActorOfFinderProcess.cdl | 54 - .../Transfer_ActorOfFinderProcess.cxx | 31 +- .../Transfer_ActorOfFinderProcess.hxx | 56 + .../Transfer_ActorOfTransientProcess.cdl | 42 - .../Transfer_ActorOfTransientProcess.cxx | 31 +- .../Transfer_ActorOfTransientProcess.hxx | 52 + src/Transfer/Transfer_DispatchControl.cdl | 64 - src/Transfer/Transfer_DispatchControl.cxx | 19 +- src/Transfer/Transfer_DispatchControl.hxx | 71 + src/Transfer/Transfer_FinderProcess.cdl | 71 - src/Transfer/Transfer_FinderProcess.cxx | 320 ++- src/Transfer/Transfer_FinderProcess.hxx | 107 + .../Transfer_FinderProcess_Handle.hxx | 38 + src/Transfer/Transfer_Iterator.gxx | 75 - src/Transfer/Transfer_Iterator.hxx | 95 + .../Transfer_IteratorOfProcessForFinder.hxx | 65 + ...Transfer_IteratorOfProcessForTransient.hxx | 66 + src/Transfer/Transfer_Mapper.cdl | 62 - src/Transfer/Transfer_Mapper.gxx | 41 - src/Transfer/Transfer_Mapper.hxx | 67 + src/Transfer/Transfer_ResultFromModel.cdl | 152 -- src/Transfer/Transfer_ResultFromModel.cxx | 20 +- src/Transfer/Transfer_ResultFromModel.hxx | 158 ++ src/Transfer/Transfer_ResultFromTransient.cdl | 103 - src/Transfer/Transfer_ResultFromTransient.cxx | 22 +- src/Transfer/Transfer_ResultFromTransient.hxx | 114 + src/Transfer/Transfer_SimpleBinder.cdl | 81 - src/Transfer/Transfer_SimpleBinder.gxx | 48 - src/Transfer/Transfer_TransferDispatch.cdl | 66 - src/Transfer/Transfer_TransferDispatch.cxx | 62 +- src/Transfer/Transfer_TransferDispatch.hxx | 77 + src/Transfer/Transfer_TransferInput.cdl | 10 +- src/Transfer/Transfer_TransferInput.cxx | 2 + src/Transfer/Transfer_TransferOutput.cdl | 113 - src/Transfer/Transfer_TransferOutput.cxx | 12 +- src/Transfer/Transfer_TransferOutput.hxx | 123 + src/Transfer/Transfer_TransferProcess.cdl | 733 ------ src/Transfer/Transfer_TransferProcess.gxx | 1567 ------------ src/Transfer/Transfer_TransferProcess.hxx | 2219 +++++++++++++++++ src/Transfer/Transfer_TransientMapper.cxx | 37 + src/Transfer/Transfer_TransientMapper.hxx | 60 + src/Transfer/Transfer_TransientProcess.cdl | 102 - src/Transfer/Transfer_TransientProcess.cxx | 361 ++- src/Transfer/Transfer_TransientProcess.hxx | 146 ++ .../Transfer_TransientProcess_Handle.hxx | 33 + src/TransferBRep/FILES | 9 + src/TransferBRep/TransferBRep.cdl | 40 +- src/TransferBRep/TransferBRep.cxx | 2 + .../TransferBRep_BinderOfShape.cxx | 72 + .../TransferBRep_BinderOfShape.hxx | 61 + src/TransferBRep/TransferBRep_Reader.cdl | 193 -- src/TransferBRep/TransferBRep_Reader.cxx | 12 +- src/TransferBRep/TransferBRep_Reader.hxx | 189 ++ src/TransferBRep/TransferBRep_ShapeBinder.cdl | 51 - src/TransferBRep/TransferBRep_ShapeBinder.cxx | 29 +- src/TransferBRep/TransferBRep_ShapeBinder.hxx | 77 + src/TransferBRep/TransferBRep_ShapeMapper.cxx | 37 + src/TransferBRep/TransferBRep_ShapeMapper.hxx | 60 + .../TransferBRep_ShapeMapper_Handle.hxx | 25 + src/XSAlgo/XSAlgo_AlgoContainer.cdl | 8 +- src/XSAlgo/XSAlgo_AlgoContainer.cxx | 2 + src/XSControl/FILES | 19 + src/XSControl/XSControl.cdl | 23 +- src/XSControl/XSControl_ConnectedShapes.cdl | 66 - src/XSControl/XSControl_ConnectedShapes.cxx | 23 +- src/XSControl/XSControl_ConnectedShapes.hxx | 85 + src/XSControl/XSControl_Controller.cdl | 336 --- src/XSControl/XSControl_Controller.cxx | 31 +- src/XSControl/XSControl_Controller.hxx | 313 +++ src/XSControl/XSControl_FuncShape.cdl | 6 +- src/XSControl/XSControl_Functions.cxx | 1 - src/XSControl/XSControl_Reader.cdl | 251 -- src/XSControl/XSControl_Reader.cxx | 14 +- src/XSControl/XSControl_Reader.hxx | 238 ++ src/XSControl/XSControl_SelectForTransfer.cdl | 79 - src/XSControl/XSControl_SelectForTransfer.cxx | 24 +- src/XSControl/XSControl_SelectForTransfer.hxx | 112 + .../XSControl_SignTransferStatus.cdl | 72 - .../XSControl_SignTransferStatus.cxx | 21 +- .../XSControl_SignTransferStatus.hxx | 85 + src/XSControl/XSControl_TransferReader.cdl | 358 --- src/XSControl/XSControl_TransferReader.cxx | 32 +- src/XSControl/XSControl_TransferReader.hxx | 343 +++ src/XSControl/XSControl_TransferWriter.cdl | 117 - src/XSControl/XSControl_TransferWriter.cxx | 20 +- src/XSControl/XSControl_TransferWriter.hxx | 119 + src/XSControl/XSControl_WorkSession.cdl | 235 -- src/XSControl/XSControl_WorkSession.cxx | 30 +- src/XSControl/XSControl_WorkSession.hxx | 212 ++ .../XSControl_WorkSession_Handle.hxx | 26 + src/XSControl/XSControl_Writer.cdl | 73 - src/XSControl/XSControl_Writer.cxx | 6 +- src/XSControl/XSControl_Writer.hxx | 76 + src/XSDRAW/FILES | 6 + src/XSDRAW/XSDRAW.cdl | 223 -- src/XSDRAW/XSDRAW.cxx | 15 +- src/XSDRAW/XSDRAW.hxx | 215 ++ src/XSDRAW/XSDRAW_Functions.cdl | 37 - src/XSDRAW/XSDRAW_Functions.cxx | 2 +- src/XSDRAW/XSDRAW_Functions.hxx | 44 + src/XSDRAW/XSDRAW_Shape.cdl | 32 - src/XSDRAW/XSDRAW_Shape.cxx | 3 +- src/XSDRAW/XSDRAW_Shape.hxx | 44 + src/XSDRAW/XSDRAW_Vars.cdl | 56 - src/XSDRAW/XSDRAW_Vars.cxx | 38 +- src/XSDRAW/XSDRAW_Vars.hxx | 80 + 324 files changed, 12383 insertions(+), 9937 deletions(-) create mode 100644 src/HeaderSection/FILES delete mode 100644 src/HeaderSection/HeaderSection_HeaderRecognizer.cdl create mode 100644 src/HeaderSection/HeaderSection_HeaderRecognizer.hxx delete mode 100644 src/IFSelect/IFSelect_FileModifier.cdl delete mode 100644 src/IFSelect/IFSelect_ModelModifier.cdl delete mode 100644 src/IFSelect/IFSelect_ModelModifier.gxx delete mode 100644 src/IFSelect/IFSelect_SelectList.cdl delete mode 100644 src/IFSelect/IFSelect_SelectList.gxx create mode 100644 src/IGESBasic/FILES rename src/{IFSelect/IFSelect_FileModifier.gxx => IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.cxx} (74%) create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity_Handle.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.cxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger_Handle.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.cxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal_Handle.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.cxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.hxx create mode 100644 src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx create mode 100644 src/IGESCAFControl/FILES delete mode 100644 src/IGESCAFControl/IGESCAFControl_Reader.cdl create mode 100644 src/IGESCAFControl/IGESCAFControl_Reader.hxx delete mode 100644 src/IGESCAFControl/IGESCAFControl_Writer.cdl create mode 100644 src/IGESCAFControl/IGESCAFControl_Writer.hxx create mode 100644 src/IGESControl/FILES delete mode 100644 src/IGESControl/IGESControl_ActorWrite.cdl create mode 100644 src/IGESControl/IGESControl_ActorWrite.hxx delete mode 100644 src/IGESControl/IGESControl_Controller.cdl create mode 100644 src/IGESControl/IGESControl_Controller.hxx delete mode 100644 src/IGESControl/IGESControl_Reader.cdl create mode 100644 src/IGESControl/IGESControl_Reader.hxx delete mode 100644 src/IGESControl/IGESControl_Writer.cdl create mode 100644 src/IGESControl/IGESControl_Writer.hxx rename src/{LibCtl/LibCtl_ProtocolTemplate.gxx => IGESData/IGESData_FileRecognizer.cxx} (74%) create mode 100644 src/IGESData/IGESData_FileRecognizer.hxx delete mode 100644 src/IGESData/IGESData_IGESReaderTool.cdl create mode 100644 src/IGESData/IGESData_IGESReaderTool.hxx create mode 100644 src/IGESData/IGESData_SpecificLib.cxx create mode 100644 src/IGESData/IGESData_SpecificLib.hxx create mode 100644 src/IGESData/IGESData_WriterLib.cxx create mode 100644 src/IGESData/IGESData_WriterLib.hxx create mode 100644 src/IGESDefs/FILES create mode 100644 src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.cxx create mode 100644 src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.hxx create mode 100644 src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle.hxx create mode 100644 src/IGESSelect/FILES delete mode 100644 src/IGESSelect/IGESSelect_AddFileComment.cdl create mode 100644 src/IGESSelect/IGESSelect_AddFileComment.hxx create mode 100644 src/IGESSelect/IGESSelect_FileModifier.cxx create mode 100644 src/IGESSelect/IGESSelect_FileModifier.hxx delete mode 100644 src/IGESSelect/IGESSelect_FloatFormat.cdl create mode 100644 src/IGESSelect/IGESSelect_FloatFormat.hxx create mode 100644 src/IGESSelect/IGESSelect_ModelModifier.cdl create mode 100644 src/IGESSelect/IGESSelect_ModelModifier.cxx delete mode 100644 src/IGESToBRep/IGESToBRep_Actor.cdl create mode 100644 src/IGESToBRep/IGESToBRep_Actor.hxx delete mode 100644 src/IGESToBRep/IGESToBRep_Reader.cdl create mode 100644 src/IGESToBRep/IGESToBRep_Reader.hxx create mode 100644 src/Interface/Interface_GeneralLib.cxx create mode 100644 src/Interface/Interface_GeneralLib.hxx delete mode 100644 src/Interface/Interface_JaggedArray.cdl delete mode 100644 src/Interface/Interface_JaggedArray.gxx create mode 100644 src/Interface/Interface_JaggedArray.hxx create mode 100644 src/Interface/Interface_ReaderLib.cxx create mode 100644 src/Interface/Interface_ReaderLib.hxx delete mode 100644 src/Interface/Interface_Recognizer.cdl delete mode 100644 src/Interface/Interface_Recognizer.gxx create mode 100644 src/Interface/Interface_Recognizer.hxx delete mode 100644 src/LibCtl/LibCtl_GlobalNode.gxx delete mode 100644 src/LibCtl/LibCtl_Library.cdl delete mode 100644 src/LibCtl/LibCtl_Library.gxx create mode 100644 src/LibCtl/LibCtl_Library.hxx delete mode 100644 src/LibCtl/LibCtl_Node.gxx delete mode 100644 src/LibCtl/LibCtl_ProtocolTemplate.cdl delete mode 100644 src/MoniTool/MoniTool_DataInfo.cdl delete mode 100644 src/MoniTool/MoniTool_Elem.cdl delete mode 100644 src/MoniTool/MoniTool_Elem.gxx create mode 100644 src/STEPCAFControl/FILES delete mode 100644 src/STEPCAFControl/STEPCAFControl_ActorWrite.cdl create mode 100644 src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx delete mode 100644 src/STEPCAFControl/STEPCAFControl_Controller.cdl create mode 100644 src/STEPCAFControl/STEPCAFControl_Controller.hxx delete mode 100644 src/STEPCAFControl/STEPCAFControl_Reader.cdl create mode 100644 src/STEPCAFControl/STEPCAFControl_Reader.hxx delete mode 100644 src/STEPCAFControl/STEPCAFControl_Writer.cdl create mode 100644 src/STEPCAFControl/STEPCAFControl_Writer.hxx create mode 100644 src/STEPControl/FILES delete mode 100644 src/STEPControl/STEPControl_ActorRead.cdl create mode 100644 src/STEPControl/STEPControl_ActorRead.hxx delete mode 100644 src/STEPControl/STEPControl_ActorWrite.cdl create mode 100644 src/STEPControl/STEPControl_ActorWrite.hxx delete mode 100644 src/STEPControl/STEPControl_Controller.cdl create mode 100644 src/STEPControl/STEPControl_Controller.hxx delete mode 100644 src/STEPControl/STEPControl_Reader.cdl create mode 100644 src/STEPControl/STEPControl_Reader.hxx delete mode 100644 src/STEPControl/STEPControl_Writer.cdl create mode 100644 src/STEPControl/STEPControl_Writer.hxx create mode 100644 src/STEPSelections/FILES delete mode 100644 src/STEPSelections/STEPSelections_SelectForTransfer.cdl create mode 100644 src/STEPSelections/STEPSelections_SelectForTransfer.hxx create mode 100644 src/StepData/FILES rename src/{MoniTool/MoniTool_DataInfo.cxx => StepData/StepData_FileRecognizer.cxx} (68%) create mode 100644 src/StepData/StepData_FileRecognizer.hxx delete mode 100644 src/StepData/StepData_StepReaderTool.cdl create mode 100644 src/StepData/StepData_StepReaderTool.hxx create mode 100644 src/StepData/StepData_WriterLib.cxx create mode 100644 src/StepData/StepData_WriterLib.hxx create mode 100644 src/StepSelect/FILES create mode 100644 src/StepSelect/StepSelect_FileModifier.cxx create mode 100644 src/StepSelect/StepSelect_FileModifier.hxx delete mode 100644 src/StepSelect/StepSelect_FloatFormat.cdl create mode 100644 src/StepSelect/StepSelect_FloatFormat.hxx create mode 100644 src/Transfer/FILES delete mode 100644 src/Transfer/Transfer_Actor.gxx create mode 100644 src/Transfer/Transfer_Actor.hxx delete mode 100644 src/Transfer/Transfer_ActorDispatch.cdl create mode 100644 src/Transfer/Transfer_ActorDispatch.hxx delete mode 100644 src/Transfer/Transfer_ActorOfFinderProcess.cdl create mode 100644 src/Transfer/Transfer_ActorOfFinderProcess.hxx delete mode 100644 src/Transfer/Transfer_ActorOfTransientProcess.cdl create mode 100644 src/Transfer/Transfer_ActorOfTransientProcess.hxx delete mode 100644 src/Transfer/Transfer_DispatchControl.cdl create mode 100644 src/Transfer/Transfer_DispatchControl.hxx delete mode 100644 src/Transfer/Transfer_FinderProcess.cdl create mode 100644 src/Transfer/Transfer_FinderProcess.hxx create mode 100644 src/Transfer/Transfer_FinderProcess_Handle.hxx delete mode 100644 src/Transfer/Transfer_Iterator.gxx create mode 100644 src/Transfer/Transfer_Iterator.hxx create mode 100644 src/Transfer/Transfer_IteratorOfProcessForFinder.hxx create mode 100644 src/Transfer/Transfer_IteratorOfProcessForTransient.hxx delete mode 100644 src/Transfer/Transfer_Mapper.cdl delete mode 100644 src/Transfer/Transfer_Mapper.gxx create mode 100644 src/Transfer/Transfer_Mapper.hxx delete mode 100644 src/Transfer/Transfer_ResultFromModel.cdl create mode 100644 src/Transfer/Transfer_ResultFromModel.hxx delete mode 100644 src/Transfer/Transfer_ResultFromTransient.cdl create mode 100644 src/Transfer/Transfer_ResultFromTransient.hxx delete mode 100644 src/Transfer/Transfer_SimpleBinder.cdl delete mode 100644 src/Transfer/Transfer_SimpleBinder.gxx delete mode 100644 src/Transfer/Transfer_TransferDispatch.cdl create mode 100644 src/Transfer/Transfer_TransferDispatch.hxx delete mode 100644 src/Transfer/Transfer_TransferOutput.cdl create mode 100644 src/Transfer/Transfer_TransferOutput.hxx delete mode 100644 src/Transfer/Transfer_TransferProcess.cdl delete mode 100644 src/Transfer/Transfer_TransferProcess.gxx create mode 100644 src/Transfer/Transfer_TransferProcess.hxx create mode 100644 src/Transfer/Transfer_TransientMapper.cxx create mode 100644 src/Transfer/Transfer_TransientMapper.hxx delete mode 100644 src/Transfer/Transfer_TransientProcess.cdl create mode 100644 src/Transfer/Transfer_TransientProcess.hxx create mode 100644 src/Transfer/Transfer_TransientProcess_Handle.hxx create mode 100644 src/TransferBRep/FILES create mode 100644 src/TransferBRep/TransferBRep_BinderOfShape.cxx create mode 100644 src/TransferBRep/TransferBRep_BinderOfShape.hxx delete mode 100644 src/TransferBRep/TransferBRep_Reader.cdl create mode 100644 src/TransferBRep/TransferBRep_Reader.hxx delete mode 100644 src/TransferBRep/TransferBRep_ShapeBinder.cdl create mode 100644 src/TransferBRep/TransferBRep_ShapeBinder.hxx create mode 100644 src/TransferBRep/TransferBRep_ShapeMapper.cxx create mode 100644 src/TransferBRep/TransferBRep_ShapeMapper.hxx create mode 100644 src/TransferBRep/TransferBRep_ShapeMapper_Handle.hxx create mode 100644 src/XSControl/FILES delete mode 100644 src/XSControl/XSControl_ConnectedShapes.cdl create mode 100644 src/XSControl/XSControl_ConnectedShapes.hxx delete mode 100644 src/XSControl/XSControl_Controller.cdl create mode 100644 src/XSControl/XSControl_Controller.hxx delete mode 100644 src/XSControl/XSControl_Reader.cdl create mode 100644 src/XSControl/XSControl_Reader.hxx delete mode 100644 src/XSControl/XSControl_SelectForTransfer.cdl create mode 100644 src/XSControl/XSControl_SelectForTransfer.hxx delete mode 100644 src/XSControl/XSControl_SignTransferStatus.cdl create mode 100644 src/XSControl/XSControl_SignTransferStatus.hxx delete mode 100644 src/XSControl/XSControl_TransferReader.cdl create mode 100644 src/XSControl/XSControl_TransferReader.hxx delete mode 100644 src/XSControl/XSControl_TransferWriter.cdl create mode 100644 src/XSControl/XSControl_TransferWriter.hxx delete mode 100644 src/XSControl/XSControl_WorkSession.cdl create mode 100644 src/XSControl/XSControl_WorkSession.hxx create mode 100644 src/XSControl/XSControl_WorkSession_Handle.hxx delete mode 100644 src/XSControl/XSControl_Writer.cdl create mode 100644 src/XSControl/XSControl_Writer.hxx delete mode 100644 src/XSDRAW/XSDRAW.cdl create mode 100644 src/XSDRAW/XSDRAW.hxx delete mode 100644 src/XSDRAW/XSDRAW_Functions.cdl create mode 100644 src/XSDRAW/XSDRAW_Functions.hxx delete mode 100644 src/XSDRAW/XSDRAW_Shape.cdl create mode 100644 src/XSDRAW/XSDRAW_Shape.hxx delete mode 100644 src/XSDRAW/XSDRAW_Vars.cdl create mode 100644 src/XSDRAW/XSDRAW_Vars.hxx diff --git a/src/BRepToIGES/BRepToIGES_BREntity.cdl b/src/BRepToIGES/BRepToIGES_BREntity.cdl index 06e4720f66..eaf033aa8d 100644 --- a/src/BRepToIGES/BRepToIGES_BREntity.cdl +++ b/src/BRepToIGES/BRepToIGES_BREntity.cdl @@ -24,7 +24,7 @@ uses Shape from TopoDS, IGESEntity from IGESData, IGESModel from IGESData, - FinderProcess from Transfer + FinderProcess_Handle from Transfer is @@ -48,11 +48,11 @@ is ---Purpose : Returns the value of the UnitFlag of the header of the model -- in meters. - SetTransferProcess(me : in out; TP : FinderProcess from Transfer); + SetTransferProcess(me : in out; TP : FinderProcess_Handle from Transfer); ---Purpose : Set the value of "TheMap" GetTransferProcess(me) - returns FinderProcess from Transfer; + returns FinderProcess_Handle from Transfer; ---Purpose : Returns the value of "TheMap" TransferShape(me : in out; start : Shape from TopoDS) @@ -127,6 +127,6 @@ fields myConvSurface : Boolean; myPCurveMode : Boolean; - TheMap : FinderProcess from Transfer; + TheMap : FinderProcess_Handle from Transfer; end BREntity; diff --git a/src/BRepToIGES/BRepToIGES_BREntity.cxx b/src/BRepToIGES/BRepToIGES_BREntity.cxx index 83350df8c3..f2156d2ff4 100644 --- a/src/BRepToIGES/BRepToIGES_BREntity.cxx +++ b/src/BRepToIGES/BRepToIGES_BREntity.cxx @@ -51,7 +51,6 @@ #include #include -#include #include #include diff --git a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cdl b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cdl index c22f4a4a00..f93a54f62b 100644 --- a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cdl +++ b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cdl @@ -42,7 +42,7 @@ uses Shell from IGESSolid, ManifoldSolid from IGESSolid, CString from Standard, - FinderProcess from Transfer + FinderProcess_Handle from Transfer is diff --git a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx index fe15d0c3be..b73e87b556 100644 --- a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx +++ b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx @@ -124,7 +124,6 @@ #include #include -#include #include #include #include diff --git a/src/HeaderSection/FILES b/src/HeaderSection/FILES new file mode 100644 index 0000000000..dfb675e5dc --- /dev/null +++ b/src/HeaderSection/FILES @@ -0,0 +1,2 @@ +HeaderSection_HeaderRecognizer.hxx +HeaderSection_HeaderRecognizer.cxx diff --git a/src/HeaderSection/HeaderSection.cdl b/src/HeaderSection/HeaderSection.cdl index d8ab98ca08..a47110203f 100644 --- a/src/HeaderSection/HeaderSection.cdl +++ b/src/HeaderSection/HeaderSection.cdl @@ -32,7 +32,7 @@ class FileName; class FileDescription; class FileSchema; -class HeaderRecognizer; +imported HeaderRecognizer; --class Array1OfHAsciiString instantiates Array1(HAsciiString); --class HArray1OfHAsciiString instantiates HArray1(HAsciiString,Array1OfHAsciiString from HeaderSection); diff --git a/src/HeaderSection/HeaderSection_HeaderRecognizer.cdl b/src/HeaderSection/HeaderSection_HeaderRecognizer.cdl deleted file mode 100644 index 872bd3681d..0000000000 --- a/src/HeaderSection/HeaderSection_HeaderRecognizer.cdl +++ /dev/null @@ -1,32 +0,0 @@ --- Created on: 1994-06-27 --- Created by: Frederic MAUPAS --- Copyright (c) 1994-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 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. - -class HeaderRecognizer from HeaderSection - inherits FileRecognizer from StepData - - ---Purpose : Recognizes STEP Standard Header Entities - -- (FileName, FileDescription, FileSchema) - -uses AsciiString from TCollection - -is - - Create returns mutable HeaderRecognizer ; - - Eval (me : mutable ; key : AsciiString from TCollection) is protected; - ---Purpose: Recognizes data types of Header STEP Standard - -end HeaderRecognizer; diff --git a/src/HeaderSection/HeaderSection_HeaderRecognizer.cxx b/src/HeaderSection/HeaderSection_HeaderRecognizer.cxx index 0f8d02f278..f138821722 100644 --- a/src/HeaderSection/HeaderSection_HeaderRecognizer.cxx +++ b/src/HeaderSection/HeaderSection_HeaderRecognizer.cxx @@ -14,36 +14,37 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include - +#include #include #include #include - - -static TCollection_AsciiString reco_FileName ("FILE_NAME"); -static TCollection_AsciiString reco_FileSchema ("FILE_SCHEMA"); +static TCollection_AsciiString reco_FileName ("FILE_NAME"); +static TCollection_AsciiString reco_FileSchema ("FILE_SCHEMA"); static TCollection_AsciiString reco_FileDescription ("FILE_DESCRIPTION"); - HeaderSection_HeaderRecognizer::HeaderSection_HeaderRecognizer () { } -void HeaderSection_HeaderRecognizer::Eval - (const TCollection_AsciiString& key) +void HeaderSection_HeaderRecognizer::Eval (const TCollection_AsciiString& key) { - if (key.IsEqual(reco_FileName)) { + if (key.IsEqual(reco_FileName)) + { SetOK(new HeaderSection_FileName); return; } - if (key.IsEqual(reco_FileSchema)) { + if (key.IsEqual(reco_FileSchema)) + { SetOK(new HeaderSection_FileSchema); return; } - if (key.IsEqual(reco_FileDescription)) { + if (key.IsEqual(reco_FileDescription)) + { SetOK(new HeaderSection_FileDescription); return; } } + + IMPLEMENT_STANDARD_HANDLE(HeaderSection_HeaderRecognizer, StepData_FileRecognizer) + IMPLEMENT_STANDARD_RTTIEXT(HeaderSection_HeaderRecognizer, StepData_FileRecognizer) diff --git a/src/HeaderSection/HeaderSection_HeaderRecognizer.hxx b/src/HeaderSection/HeaderSection_HeaderRecognizer.hxx new file mode 100644 index 0000000000..b39f0a7490 --- /dev/null +++ b/src/HeaderSection/HeaderSection_HeaderRecognizer.hxx @@ -0,0 +1,43 @@ +// 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 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 _HeaderSection_HeaderRecognizer_HeaderFile +#define _HeaderSection_HeaderRecognizer_HeaderFile + +#include +#include +#include +#include + +class TCollection_AsciiString; + +//! Recognizes STEP Standard Header Entities
+//! (FileName, FileDescription, FileSchema)
+class HeaderSection_HeaderRecognizer : public StepData_FileRecognizer +{ +public: + Standard_EXPORT HeaderSection_HeaderRecognizer(); + + DEFINE_STANDARD_RTTI(HeaderSection_HeaderRecognizer) + +protected: + + //! Recognizes data types of Header STEP Standard
+ Standard_EXPORT void Eval(const TCollection_AsciiString& key); + +}; + + DEFINE_STANDARD_HANDLE(HeaderSection_HeaderRecognizer, StepData_FileRecognizer) + +#endif diff --git a/src/IFSelect/IFSelect.cdl b/src/IFSelect/IFSelect.cdl index 10986bd5d4..ff6c5c5631 100644 --- a/src/IFSelect/IFSelect.cdl +++ b/src/IFSelect/IFSelect.cdl @@ -75,7 +75,6 @@ is class SelectSharing; -- directly sharing entities deferred class SelectAnyList; -- from a list in an entity deferred class SelectInList; -- from a list of single entities - generic class SelectList; -- from an entity as a list class SelectSuite; -- macro-select-deduct deferred class SelectExtract; -- sorted lists (can be inverted) : @@ -122,8 +121,6 @@ is deferred class Modifier; -- defines modifying actions on transferred model class ModifReorder; -- reorder whole model from roots class ModifEditForm; -- applies an EditForm - deferred generic class FileModifier; -- defines actions on file sending - deferred generic class ModelModifier; -- specific actions on model -- -- Session Management -- -- diff --git a/src/IFSelect/IFSelect_FileModifier.cdl b/src/IFSelect/IFSelect_FileModifier.cdl deleted file mode 100644 index 3268e7c083..0000000000 --- a/src/IFSelect/IFSelect_FileModifier.cdl +++ /dev/null @@ -1,58 +0,0 @@ --- Created on: 1994-03-21 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -deferred generic class FileModifier from IFSelect - (Writer as any) -- according each Interface - inherits GeneralModifier - - ---Purpose : Allows to precise the frame work for File Modifiers able to - -- run with an Interface (such as STEP, VDA, IGES ...) - -- - -- Remember that File Modifiers are activated by a WorkLibrary : - -- if they inherit from an instantiation of FileModifier with the - -- data from this Interface, this will be easier to do. - -- They are activated before sending the file, in the order - -- given by the ModielCopier. - -- - -- For each Interface on which File Modifiers have to be defined, - -- The way to follow is firstly to instantiate FileModifier with - -- its specific data : - -- Model is the InterfaceModel specific to the considered norm - -- Writer is the Writer specific to the considered norm - -- Then to define the various classes which inherit from it and - -- define their method Perform - -uses ContextWrite - -is - - Initialize; - ---Purpose : Sets a File Modifier to keep the graph of dependences - -- unchanges (because it works on the model already produced) - - Perform (me; ctx : in out ContextWrite; writer : in out Writer) - is deferred; - ---Purpose : Perform the action specific to each class of File Modifier - -- is the ContextWrite, which brings : the model, the - -- protocol, the file name, plus the object AppliedModifiers - -- (not used here) and the CheckList - -- Remark that the model has to be casted for specific access - -- - -- is the Writer and is specific to each norm, on which - -- to act - - -end FileModifier; diff --git a/src/IFSelect/IFSelect_ModelModifier.cdl b/src/IFSelect/IFSelect_ModelModifier.cdl deleted file mode 100644 index 8a9e4eed5f..0000000000 --- a/src/IFSelect/IFSelect_ModelModifier.cdl +++ /dev/null @@ -1,72 +0,0 @@ --- Created on: 1994-03-21 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -deferred generic class ModelModifier from IFSelect - (Model as InterfaceModel; Proto as Protocol from Interface) - inherits Modifier - - ---Purpose : Allows to precise the frame work for Model Modifiers able to - -- run with an Interface (such as STEP, VDA, IGES ...) - -- - -- Acts as a Modifier but properly casts Model and Protocol - -- according to each Interface, and refuses to work if cast - -- has failed (i.e. if it is not used in good context) - -- - -- Then, it is finer to make specific Model Modifier inherit - -- from an instantiated ModelModifier, instead of Modifier itself - -- (though it is not mandatory) - -- - -- For each Interface on which Model Modifiers have to be defined, - -- The way to follow is firstly to instantiate ModelModifier with - -- its specific data : - -- Model is the InterfaceModel specific to the considered norm - -- Then to define the various classes which inherit from it and - -- define their method Perform - -uses CString, InterfaceModel, Protocol from Interface, CopyTool, ContextModif - -is - - Initialize (maychangegraph : Boolean); - ---Purpose : Calls inherited Initialize, transmits to it the information - -- - - Perform (me; ctx : in out ContextModif; - target : mutable InterfaceModel; - protocol : Protocol from Interface; - TC : in out CopyTool); - ---Purpose : The inherited Perform does the required cast (and refuses to - -- go further if cast has failed) then calls the instantiated - -- Performing - - PerformProtocol (me; ctx : in out ContextModif; - target : mutable Model; - proto : Proto; - TC : in out CopyTool) is virtual; - ---Purpose : Specific Perform with Protocol. It is defined to let the - -- Protocol unused and to call Performing without Protocol - -- (most current case). It can be redefined if specific action - -- requires Protocol. - - Performing (me; ctx : in out ContextModif; - target : mutable Model; - TC : in out CopyTool) is deferred; - ---Purpose : Specific Perform, without Protocol. If Performing with - -- Protocol is redefined, Performing without Protocol must - -- though be defined to do nothing (not called, but demanded - -- by the linker) - -end ModelModifier; diff --git a/src/IFSelect/IFSelect_ModelModifier.gxx b/src/IFSelect/IFSelect_ModelModifier.gxx deleted file mode 100644 index 0d95b22dd1..0000000000 --- a/src/IFSelect/IFSelect_ModelModifier.gxx +++ /dev/null @@ -1,41 +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 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 - -IFSelect_ModelModifier::IFSelect_ModelModifier (const Standard_Boolean grf) - : IFSelect_Modifier (grf) { } - - void IFSelect_ModelModifier::Perform - (IFSelect_ContextModif& ctx, - const Handle(Interface_InterfaceModel)& target, - const Handle(Interface_Protocol)& protocol, - Interface_CopyTool& TC) const -{ - ctx.TraceModifier(this); - Handle(Model) targ = Handle(Model)::DownCast(target); - Handle(Proto) prot = Handle(Proto)::DownCast(protocol); - if (targ.IsNull()) { - ctx.CCheck()->AddFail("Model to Modify : unproper type"); - return; - } - PerformProtocol (ctx,targ,prot,TC); -} - - void IFSelect_ModelModifier::PerformProtocol - (IFSelect_ContextModif& ctx, - const Handle(Model)& target, - const Handle(Proto)& protocol, - Interface_CopyTool& TC) const -{ ctx.SetProtocol(protocol); Performing (ctx,target,TC); } diff --git a/src/IFSelect/IFSelect_SelectList.cdl b/src/IFSelect/IFSelect_SelectList.cdl deleted file mode 100644 index 22515a1dee..0000000000 --- a/src/IFSelect/IFSelect_SelectList.cdl +++ /dev/null @@ -1,67 +0,0 @@ --- Created on: 1992-11-18 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -generic class SelectList from IFSelect (Entity as Transient) - inherits SelectInList - - - ---Purpose : A SelectList kind Selection selects a part of an Entity, as - -- well as this Entity can be described as an ordered List. - -- That is to say, it must have two methods : - -- - -- NbEntities (me) returns Integer; - -- Entity (me; num : Integer) returns Transient; - -- - -- For each class of Entity for which we want to define a - -- SelectList, we will instanciate this class with the - -- desired class of Entity as definition parameter : the deferred - -- methods NbEntities and ListedEntity are now defined to call - -- the required methods from - -- - -- SelectList works as SelectInList, beeing a sub-class of it - -uses AsciiString from TCollection, Transient, EntityIterator, IntParam - -raises OutOfRange - -is - - Create returns mutable SelectList; - ---Purpose : Creates a SelectList (with no limit); - - KeepInputEntity (me; iter : in out EntityIterator); - ---Purpose : Keeps Input Entity, as having required type - - NbItems (me; ent : Transient) returns Integer; - ---Purpose : Returns count of Entities in the list in the Entity - -- by calling method NbEntity from parameter class Entity - - ListedEntity (me; num : Integer; ent : Transient) - returns Transient raises OutOfRange; - ---Purpose : Returns an Entity of the list in the Entity , by calling - -- method Entity from parameter class Entity - -- Error if has not required type, or if is not in - -- the right range (1,NbEntities), - - ListLabel (me) returns AsciiString from TCollection; - ---Purpose : Returns the specific label for the list - -- then, following cases : - -- " From .. Until .." or "From .." or "Until .." or "Rank no .." - -- Warning : it is not possible to give a character constant to instantiate - -- a generic class, thus "List From Entity" is not adapted : - -- redefine Label if judged necessary - -end SelectList; diff --git a/src/IFSelect/IFSelect_SelectList.gxx b/src/IFSelect/IFSelect_SelectList.gxx deleted file mode 100644 index 520988728a..0000000000 --- a/src/IFSelect/IFSelect_SelectList.gxx +++ /dev/null @@ -1,44 +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 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 - -// .... Instanciation avec "Handle(Entity)" qui offre ces deux methodes : -// nb = ent->NbEntities() et ent_i = ent->InterfaceEntity(i) - - -IFSelect_SelectList::IFSelect_SelectList () { } - - void IFSelect_SelectType::KeepInputEntity (Interface_EntityIterator& iter) - { iter.SelectType(STANDARD_TYPE(Entity)); } - - Standard_Integer IFSelect_SelectList::NbItems - (const Handle(Standard_Transient)& ent) -{ - Handle(Entity) anent = Handle(Entity)::DownCast(ent); - if (anent.IsNull()) return 0; - return anent->NbEntities(); -} - - Handle(Standard_Transient) IFSelect_SelectList::ListedEntity - (const Standard_Integer num, const Handle(Standard_Transient)& ent) -{ - Handle(Entity) anent = Handle(Entity)::DownCast(ent); - if (anent.IsNull()) Standard_OutOfRange::Raise - ("IFSelect SelectType : ListedEntity"); - return anent->InterfacebEntity(num); -} - - - TCollection_AsciiString IFSelect_SelectList::ListLabel () const - { return TCollection_AsciiString(STANDARD_TYPE(Entity)->Name()); } diff --git a/src/IGESAppli/IGESAppli_ElementResults.cdl b/src/IGESAppli/IGESAppli_ElementResults.cdl index 0e084dce5d..3f960225f5 100644 --- a/src/IGESAppli/IGESAppli_ElementResults.cdl +++ b/src/IGESAppli/IGESAppli_ElementResults.cdl @@ -22,14 +22,14 @@ class ElementResults from IGESAppli inherits IGESEntity uses - GeneralNote from IGESDimen, - FiniteElement from IGESAppli, - HAsciiString from TCollection, - HArray1OfFiniteElement from IGESAppli, - HArray1OfInteger from TColStd, - HArray1OfReal from TColStd, - HArray1OfHArray1OfInteger from IGESBasic, - HArray1OfHArray1OfReal from IGESBasic + GeneralNote from IGESDimen, + FiniteElement from IGESAppli, + HAsciiString from TCollection, + HArray1OfFiniteElement from IGESAppli, + HArray1OfInteger from TColStd, + HArray1OfReal from TColStd, + HArray1OfHArray1OfInteger_Handle from IGESBasic, + HArray1OfHArray1OfReal_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -51,8 +51,8 @@ is nbLayers : HArray1OfInteger; allDataLayerFlags : HArray1OfInteger; allnbResDataLocs : HArray1OfInteger; - allResDataLocs : HArray1OfHArray1OfInteger; - allResults : HArray1OfHArray1OfReal) + allResDataLocs : HArray1OfHArray1OfInteger_Handle; + allResults : HArray1OfHArray1OfReal_Handle) ---Purpose : This method is used to set the fields of the class -- ElementResults -- - aNote : GeneralNote Entity describing analysis @@ -196,7 +196,7 @@ fields theNbLayers : HArray1OfInteger; theDataLayerFlags : HArray1OfInteger; theNbResultDataLocs : HArray1OfInteger; - theResultDataLocs : HArray1OfHArray1OfInteger; - theResultData : HArray1OfHArray1OfReal; + theResultDataLocs : HArray1OfHArray1OfInteger_Handle; + theResultData : HArray1OfHArray1OfReal_Handle; end ElementResults; diff --git a/src/IGESAppli/IGESAppli_NodalDisplAndRot.cdl b/src/IGESAppli/IGESAppli_NodalDisplAndRot.cdl index 0d24e33982..cff14d37be 100644 --- a/src/IGESAppli/IGESAppli_NodalDisplAndRot.cdl +++ b/src/IGESAppli/IGESAppli_NodalDisplAndRot.cdl @@ -23,15 +23,15 @@ class NodalDisplAndRot from IGESAppli inherits IGESEntity uses - GeneralNote from IGESDimen, - Node from IGESAppli, - HArray1OfGeneralNote from IGESDimen, - HArray1OfNode from IGESAppli, - HArray1OfReal from TColStd, - XYZ from gp, - HArray1OfInteger from TColStd, - HArray1OfXYZ from TColgp, - HArray1OfHArray1OfXYZ from IGESBasic + GeneralNote from IGESDimen, + Node from IGESAppli, + HArray1OfGeneralNote from IGESDimen, + HArray1OfNode from IGESAppli, + HArray1OfReal from TColStd, + XYZ from gp, + HArray1OfInteger from TColStd, + HArray1OfXYZ from TColgp, + HArray1OfHArray1OfXYZ_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -45,8 +45,8 @@ is allNotes : HArray1OfGeneralNote; allIdentifiers : HArray1OfInteger; allNodes : HArray1OfNode; - allRotParams : HArray1OfHArray1OfXYZ; - allTransParams : HArray1OfHArray1OfXYZ) + allRotParams : HArray1OfHArray1OfXYZ_Handle; + allTransParams : HArray1OfHArray1OfXYZ_Handle) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class -- NodalDisplAndRot @@ -113,7 +113,7 @@ fields theNotes : HArray1OfGeneralNote; theNodeIdentifiers : HArray1OfInteger; theNodes : HArray1OfNode; - theTransParam : HArray1OfHArray1OfXYZ; - theRotParam : HArray1OfHArray1OfXYZ; + theTransParam : HArray1OfHArray1OfXYZ_Handle; + theRotParam : HArray1OfHArray1OfXYZ_Handle; end NodalDisplAndRot; diff --git a/src/IGESBasic/FILES b/src/IGESBasic/FILES new file mode 100644 index 0000000000..9f88854c54 --- /dev/null +++ b/src/IGESBasic/FILES @@ -0,0 +1,12 @@ +IGESBasic_HArray1OfHArray1OfIGESEntity.hxx +IGESBasic_HArray1OfHArray1OfIGESEntity.cxx +IGESBasic_HArray1OfHArray1OfInteger.hxx +IGESBasic_HArray1OfHArray1OfInteger.cxx +IGESBasic_HArray1OfHArray1OfReal.hxx +IGESBasic_HArray1OfHArray1OfReal.cxx +IGESBasic_HArray1OfHArray1OfXYZ.hxx +IGESBasic_HArray1OfHArray1OfXYZ.cxx +IGESBasic_HArray1OfHArray1OfIGESEntity_Handle.hxx +IGESBasic_HArray1OfHArray1OfInteger_Handle.hxx +IGESBasic_HArray1OfHArray1OfReal_Handle.hxx +IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx \ No newline at end of file diff --git a/src/IGESBasic/IGESBasic.cdl b/src/IGESBasic/IGESBasic.cdl index 4779a0f9cd..4ab5819db6 100644 --- a/src/IGESBasic/IGESBasic.cdl +++ b/src/IGESBasic/IGESBasic.cdl @@ -160,26 +160,20 @@ is class Array1OfLineFontEntity instantiates Array1 from TCollection (LineFontEntity from IGESData); - class HArray1OfHArray1OfInteger instantiates - -- HArray1 from TCollection (HArray1OfInteger from TColStd,Array1OfHArray1OfInteger); - JaggedArray from Interface (HArray1OfInteger from TColStd); - class HArray1OfHArray1OfReal instantiates - -- HArray1 from TCollection (HArray1OfReal from TColStd,Array1OfHArray1OfReal); - JaggedArray from Interface (HArray1OfReal from TColStd); - class HArray1OfHArray1OfXY instantiates - -- HArray1 from TCollection (HArray1OfXY from TColgp, Array1OfHArray1OfXY); - JaggedArray from Interface (HArray1OfXY from TColgp); - class HArray1OfHArray1OfXYZ instantiates - -- HArray1 from TCollection (HArray1OfXYZ from TColgp, Array1OfHArray1OfXYZ); - JaggedArray from Interface (HArray1OfXYZ from TColgp); + -- Instantiation of template class Interface_JaggedArray + imported HArray1OfHArray1OfIGESEntity; + imported HArray1OfHArray1OfInteger; + imported HArray1OfHArray1OfReal; + imported HArray1OfHArray1OfXYZ; + + --Workaround to use in cdl classes handles of none-cdl classes + imported HArray1OfHArray1OfIGESEntity_Handle; + imported HArray1OfHArray1OfInteger_Handle; + imported HArray1OfHArray1OfReal_Handle; + imported HArray1OfHArray1OfXYZ_Handle; class HArray2OfHArray1OfReal instantiates HArray2 from TCollection (HArray1OfReal from TColStd,Array2OfHArray1OfReal); - - class HArray1OfHArray1OfIGESEntity instantiates - -- HArray1 from TCollection (HArray1OfIGESEntity from IGESData,Array1OfHArray1OfIGESEntity); - JaggedArray from Interface (HArray1OfIGESEntity from IGESData); - class HArray1OfLineFontEntity instantiates HArray1 from TCollection (LineFontEntity from IGESData,Array1OfLineFontEntity); diff --git a/src/IFSelect/IFSelect_FileModifier.gxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.cxx similarity index 74% rename from src/IFSelect/IFSelect_FileModifier.gxx rename to src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.cxx index cae298ee96..54dfe76243 100644 --- a/src/IFSelect/IFSelect_FileModifier.gxx +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.cxx @@ -11,9 +11,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//#include + +#include + + IMPLEMENT_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfIGESEntity, MMgt_TShared) + IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_HArray1OfHArray1OfIGESEntity, MMgt_TShared) -IFSelect_FileModifier::IFSelect_FileModifier () - : IFSelect_GeneralModifier (Standard_False) { } diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.hxx new file mode 100644 index 0000000000..380185f08f --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity.hxx @@ -0,0 +1,40 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESBasic_HArray1OfHArray1OfIGESEntity_HeaderFile +#define _IGESBasic_HArray1OfHArray1OfIGESEntity_HeaderFile + +#include +#include +#include + +class IGESData_HArray1OfIGESEntity; + +class IGESBasic_HArray1OfHArray1OfIGESEntity : public Interface_JaggedArray +{ +public: + Standard_EXPORT IGESBasic_HArray1OfHArray1OfIGESEntity + (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + :Interface_JaggedArray(theLowerIndex, theUpperIndex) + {} + DEFINE_STANDARD_RTTI(IGESBasic_HArray1OfHArray1OfIGESEntity ); +}; + + DEFINE_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfIGESEntity, MMgt_TShared) + +#endif diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity_Handle.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity_Handle.hxx new file mode 100644 index 0000000000..3249bd7b75 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfIGESEntity_Handle.hxx @@ -0,0 +1,29 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl ones. + +#ifndef _IGESBasic_HArray1OfHArray1IGESEntity_Handle_HeaderFile +#define _IGESBasic_HArray1OfHArray1IGESEntity_Handle_HeaderFile + +#include + +typedef Handle(IGESBasic_HArray1OfHArray1OfIGESEntity) IGESBasic_HArray1OfHArray1OfIGESEntity_Handle; + +#endif \ No newline at end of file diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.cxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.cxx new file mode 100644 index 0000000000..bfe8a5d8ed --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.cxx @@ -0,0 +1,22 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +IMPLEMENT_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfInteger, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_HArray1OfHArray1OfInteger, MMgt_TShared) + diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.hxx new file mode 100644 index 0000000000..5ffad9dccf --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger.hxx @@ -0,0 +1,40 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESBasic_HArray1OfHArray1OfInteger_HeaderFile +#define _IGESBasic_HArray1OfHArray1OfInteger_HeaderFile + +#include +#include +#include + +class TColStd_HArray1OfInteger; + +class IGESBasic_HArray1OfHArray1OfInteger : public Interface_JaggedArray +{ +public: + Standard_EXPORT IGESBasic_HArray1OfHArray1OfInteger + (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + :Interface_JaggedArray(theLowerIndex, theUpperIndex) + {} + DEFINE_STANDARD_RTTI(IGESBasic_HArray1OfHArray1OfInteger); +}; + +DEFINE_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfInteger, MMgt_TShared) + +#endif diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger_Handle.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger_Handle.hxx new file mode 100644 index 0000000000..6710f72ae7 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfInteger_Handle.hxx @@ -0,0 +1,29 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl ones. + +#ifndef _IGESBasic_HArray1OfHArray1Integer_Handle_HeaderFile +#define _IGESBasic_HArray1OfHArray1Integer_Handle_HeaderFile + +#include + +typedef Handle(IGESBasic_HArray1OfHArray1OfInteger) IGESBasic_HArray1OfHArray1OfInteger_Handle; + +#endif \ No newline at end of file diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.cxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.cxx new file mode 100644 index 0000000000..61749199a6 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.cxx @@ -0,0 +1,21 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +IMPLEMENT_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfReal, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_HArray1OfHArray1OfReal, MMgt_TShared) diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.hxx new file mode 100644 index 0000000000..b944f1b3b4 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal.hxx @@ -0,0 +1,39 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESBasic_HArray1OfHArray1OfReal_HeaderFile +#define _IGESBasic_HArray1OfHArray1OfReal_HeaderFile + +#include +#include +#include +class TColStd_HArray1OfReal; + +class IGESBasic_HArray1OfHArray1OfReal : public Interface_JaggedArray +{ +public: + Standard_EXPORT IGESBasic_HArray1OfHArray1OfReal + (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + :Interface_JaggedArray (theLowerIndex, theUpperIndex) + {} + DEFINE_STANDARD_RTTI(IGESBasic_HArray1OfHArray1OfReal); +}; + +DEFINE_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfReal, MMgt_TShared) + +#endif \ No newline at end of file diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal_Handle.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal_Handle.hxx new file mode 100644 index 0000000000..74012a8b04 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfReal_Handle.hxx @@ -0,0 +1,29 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl ones. + +#ifndef _IGESBasic_HArray1OfHArray1Real_Handle_HeaderFile +#define _IGESBasic_HArray1OfHArray1Real_Handle_HeaderFile + +#include + +typedef Handle(IGESBasic_HArray1OfHArray1OfReal) IGESBasic_HArray1OfHArray1OfReal_Handle; + +#endif \ No newline at end of file diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.cxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.cxx new file mode 100644 index 0000000000..1fc1e90755 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.cxx @@ -0,0 +1,21 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +IMPLEMENT_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfXYZ, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_HArray1OfHArray1OfXYZ, MMgt_TShared) diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.hxx new file mode 100644 index 0000000000..78e9149cba --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ.hxx @@ -0,0 +1,40 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESBasic_HArray1OfHArray1OfXYZ_HeaderFile +#define _IGESBasic_HArray1OfHArray1OfXYZ_HeaderFile + +#include +#include +#include + +class TColgp_HArray1OfXYZ; + +class IGESBasic_HArray1OfHArray1OfXYZ : public Interface_JaggedArray +{ +public: + Standard_EXPORT IGESBasic_HArray1OfHArray1OfXYZ + (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + :Interface_JaggedArray (theLowerIndex, theUpperIndex) + {} + DEFINE_STANDARD_RTTI(IGESBasic_HArray1OfHArray1OfXYZ); +}; + +DEFINE_STANDARD_HANDLE(IGESBasic_HArray1OfHArray1OfXYZ,MMgt_TShared) + +#endif diff --git a/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx new file mode 100644 index 0000000000..c4e7763da4 --- /dev/null +++ b/src/IGESBasic/IGESBasic_HArray1OfHArray1OfXYZ_Handle.hxx @@ -0,0 +1,29 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl ones. + +#ifndef _IGESBasic_HArray1OfHArray1XYZ_Handle_HeaderFile +#define _IGESBasic_HArray1OfHArray1XYZ_Handle_HeaderFile + +#include + +typedef Handle(IGESBasic_HArray1OfHArray1OfXYZ) IGESBasic_HArray1OfHArray1OfXYZ_Handle; + +#endif \ No newline at end of file diff --git a/src/IGESCAFControl/FILES b/src/IGESCAFControl/FILES new file mode 100644 index 0000000000..9ba7883fb0 --- /dev/null +++ b/src/IGESCAFControl/FILES @@ -0,0 +1,4 @@ +IGESCAFControl_Reader.hxx +IGESCAFControl_Reader.cxx +IGESCAFControl_Writer.hxx +IGESCAFControl_Writer.cxx \ No newline at end of file diff --git a/src/IGESCAFControl/IGESCAFControl.cdl b/src/IGESCAFControl/IGESCAFControl.cdl index 9b4c903dee..5cd927dcd6 100644 --- a/src/IGESCAFControl/IGESCAFControl.cdl +++ b/src/IGESCAFControl/IGESCAFControl.cdl @@ -32,10 +32,10 @@ uses is - class Reader; + imported Reader; ---Purpose: Provides a tool for reading IGES file - class Writer; + imported Writer; ---Purpose: Provides a tool for writing IGES file DecodeColor (col: Integer) returns Color from Quantity; diff --git a/src/IGESCAFControl/IGESCAFControl_Reader.cdl b/src/IGESCAFControl/IGESCAFControl_Reader.cdl deleted file mode 100644 index 3ff8b3dc3d..0000000000 --- a/src/IGESCAFControl/IGESCAFControl_Reader.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Created on: 2000-08-15 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class Reader from IGESCAFControl inherits Reader from IGESControl - - ---Purpose: Provides a tool to read IGES file and put it into - -- DECAF document. Besides transfer of shapes (including - -- assemblies) provided by IGESControl, supports also - -- colors and part names - -- IGESCAFControl_Reader reader; Methods for translation of an IGES file: - -- reader.ReadFile("filename"); - -- reader.Transfer(Document); or - -- reader.Perform("filename",doc); - -- Methods for managing reading attributes. - -- Colors - -- reader.SetColorMode(colormode); - -- Standard_Boolean colormode = reader.GetColorMode(); - -- Layers - -- reader.SetLayerMode(layermode); - -- Standard_Boolean layermode = reader.GetLayerMode(); - -- Names - -- reader.SetNameMode(namemode); - -- Standard_Boolean namemode = reader.GetNameMode(); - -uses - AsciiString from TCollection, - WorkSession from XSControl, - Document from TDocStd - -is - - Create returns Reader; - ---Purpose: Creates a reader with an empty - -- IGES model and sets ColorMode, LayerMode and NameMode to Standard_True. - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Reader; - ---Purpose: Creates a reader tool and attaches it to an already existing Session - -- Clears the session if it was not yet set for IGES - - Transfer (me: in out; doc: in out Document from TDocStd) - returns Boolean; - ---Purpose: Translates currently loaded IGES file into the document - -- Returns True if succeeded, and False in case of fail - - Perform (me: in out; filename: AsciiString from TCollection; - doc: in out Document from TDocStd) returns Boolean; - - Perform (me: in out; filename: CString; doc: in out Document from TDocStd) - returns Boolean; - ---Purpose: Translate IGES file given by filename into the document - -- Return True if succeeded, and False in case of fail - - ---Scope: protected methods - - ReadColors (me; doc: in out Document from TDocStd) - returns Boolean is protected; - ---Purpose: Reads colors of IGES entities and sets - -- corresponding color assignments in the DECAF document - - ReadNames (me; doc: in out Document from TDocStd) - returns Boolean is protected; - ---Purpose: Reads Names of IGES entities and sets - -- corresponding name to label with shape in the DECAF document - - ReadLayers (me; doc: in out Document from TDocStd) - returns Boolean is protected; - ---Purpose: Reads layers of parts defined in the IGES model and - -- set reference between shape and layers in the DECAF document - - --- Work with fileds for different mode of reading IGES file. - - SetColorMode(me: in out; colormode: Boolean from Standard); - ---Purpose: Set ColorMode for indicate read Colors or not. - - GetColorMode(me) returns Boolean; - - SetNameMode(me: in out; namemode: Boolean from Standard); - ---Purpose: Set NameMode for indicate read Name or not. - - GetNameMode(me) returns Boolean; - - SetLayerMode(me: in out; layermode: Boolean from Standard); - ---Purpose: Set LayerMode for indicate read Layers or not. - - GetLayerMode(me) returns Boolean; - -fields - - myColorMode: Boolean; - myNameMode: Boolean; - myLayerMode: Boolean; - -end Reader; - diff --git a/src/IGESCAFControl/IGESCAFControl_Reader.cxx b/src/IGESCAFControl/IGESCAFControl_Reader.cxx index 94a529ee63..7ee491ab80 100644 --- a/src/IGESCAFControl/IGESCAFControl_Reader.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Reader.cxx @@ -14,7 +14,7 @@ // commercial license or contractual agreement. #include -#include +#include #include #include #include @@ -37,9 +37,14 @@ #include #include #include + #include #include +#include +#include +#include + //======================================================================= //function : IGESCAFControl_Reader //purpose : diff --git a/src/IGESCAFControl/IGESCAFControl_Reader.hxx b/src/IGESCAFControl/IGESCAFControl_Reader.hxx new file mode 100644 index 0000000000..2c5a95735b --- /dev/null +++ b/src/IGESCAFControl/IGESCAFControl_Reader.hxx @@ -0,0 +1,102 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESCAFControl_Reader_HeaderFile +#define _IGESCAFControl_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class TDocStd_Document; +class TCollection_AsciiString; + +//! Provides a tool to read IGES file and put it into
+//! DECAF document. Besides transfer of shapes (including
+//! assemblies) provided by IGESControl, supports also
+//! colors and part names
+//! IGESCAFControl_Reader reader; Methods for translation of an IGES file:
+//! reader.ReadFile("filename");
+//! reader.Transfer(Document); or
+//! reader.Perform("filename",doc);
+//! Methods for managing reading attributes.
+//! Colors
+//! reader.SetColorMode(colormode);
+//! Standard_Boolean colormode = reader.GetColorMode();
+//! Layers
+//! reader.SetLayerMode(layermode);
+//! Standard_Boolean layermode = reader.GetLayerMode();
+//! Names
+//! reader.SetNameMode(namemode);
+//! Standard_Boolean namemode = reader.GetNameMode();
+class IGESCAFControl_Reader : public IGESControl_Reader +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a reader with an empty
+ //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
+ Standard_EXPORT IGESCAFControl_Reader(); + //! Creates a reader tool and attaches it to an already existing Session
+ //! Clears the session if it was not yet set for IGES
+ Standard_EXPORT IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Translates currently loaded IGES file into the document
+ //! Returns True if succeeded, and False in case of fail
+ Standard_EXPORT Standard_Boolean Transfer(Handle(TDocStd_Document)& doc) ; + + Standard_EXPORT Standard_Boolean Perform(const TCollection_AsciiString& filename,Handle(TDocStd_Document)& doc) ; + //! Translate IGES file given by filename into the document
+ //! Return True if succeeded, and False in case of fail
+ Standard_EXPORT Standard_Boolean Perform(const Standard_CString filename,Handle(TDocStd_Document)& doc) ; + //! Set ColorMode for indicate read Colors or not.
+ Standard_EXPORT void SetColorMode(const Standard_Boolean colormode) ; + + Standard_EXPORT Standard_Boolean GetColorMode() const; + //! Set NameMode for indicate read Name or not.
+ Standard_EXPORT void SetNameMode(const Standard_Boolean namemode) ; + + Standard_EXPORT Standard_Boolean GetNameMode() const; + //! Set LayerMode for indicate read Layers or not.
+ Standard_EXPORT void SetLayerMode(const Standard_Boolean layermode) ; + + Standard_EXPORT Standard_Boolean GetLayerMode() const; + +protected: + //! Reads colors of IGES entities and sets
+ //! corresponding color assignments in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadColors(Handle(TDocStd_Document)& doc) const; + //! Reads Names of IGES entities and sets
+ //! corresponding name to label with shape in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadNames(Handle(TDocStd_Document)& doc) const; + //! Reads layers of parts defined in the IGES model and
+ //! set reference between shape and layers in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadLayers(Handle(TDocStd_Document)& doc) const; + +private: + Standard_Boolean myColorMode; + Standard_Boolean myNameMode; + Standard_Boolean myLayerMode; + +}; +#endif diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.cdl b/src/IGESCAFControl/IGESCAFControl_Writer.cdl deleted file mode 100644 index fddb82e2a8..0000000000 --- a/src/IGESCAFControl/IGESCAFControl_Writer.cdl +++ /dev/null @@ -1,125 +0,0 @@ --- Created on: 2000-08-17 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class Writer from IGESCAFControl inherits Writer from IGESControl - - ---Purpose: Provides a tool to write DECAF document to the - -- IGES file. Besides transfer of shapes (including - -- assemblies) provided by IGESControl, supports also - -- colors and part names - -- IGESCAFControl_Writer writer(); - -- Methods for writing IGES file: - -- writer.Transfer (Document); - -- writer.Write("filename") or writer.Write(OStream) or - -- writer.Perform(Document,"filename"); - -- Methods for managing the writing of attributes. - -- Colors - -- writer.SetColorMode(colormode); - -- Standard_Boolean colormode = writer.GetColorMode(); - -- Layers - -- writer.SetLayerMode(layermode); - -- Standard_Boolean layermode = writer.GetLayerMode(); - -- Names - -- writer.SetNameMode(namemode); - -- Standard_Boolean namemode = writer.GetNameMode(); - -uses - AsciiString from TCollection, - Shape from TopoDS, - MapOfShape from TopTools, - WorkSession from XSControl, - Document from TDocStd, - LabelSequence from TDF, - Style from XCAFPrs, - DataMapOfShapeStyle from XCAFPrs, - DataMapOfStyleTransient from XCAFPrs -is - - Create returns Writer; - ---Purpose: Creates a writer with an empty - -- IGES model and sets ColorMode, LayerMode and NameMode to Standard_True. - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Writer; - ---Purpose: Creates a reader tool and attaches it to an already existing Session - -- Clears the session if it was not yet set for IGES - - Transfer (me : in out; doc : Document from TDocStd) - returns Boolean; - ---Purpose: Transfers a document to a IGES model - -- Returns True if translation is OK - - Perform (me : in out; doc : Document from TDocStd; - filename: AsciiString from TCollection) - returns Boolean; - - Perform (me : in out; doc : Document from TDocStd; filename: CString) - returns Boolean; - ---Purpose : Transfers a document and writes it to a IGES file - -- Returns True if translation is OK - - ---Scope: Internal methods - - Transfer (me : in out; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Transfers labels to a IGES model - -- Returns True if translation is OK - - WriteAttributes (me: in out; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Reads colors from DECAF document and assigns them - -- to corresponding IGES entities - - MakeColors (me: in out; S: Shape from TopoDS; settings: DataMapOfShapeStyle from XCAFPrs; - colors: in out DataMapOfStyleTransient from XCAFPrs; - Map: in out MapOfShape from TopTools; - inherit: Style from XCAFPrs) is private; - ---Purpose: Recursively iterates on subshapes and assigns colors - -- to faces and edges (if set) - - WriteLayers (me: in out; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Reads layers from DECAF document and assigns them - -- to corresponding IGES entities - - WriteNames (me: in out; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Recursivile iterates on subshapes and assign names - -- to IGES entity - - --- Work with fileds for different mode of writing IGES file. - - SetColorMode(me: in out; colormode: Boolean from Standard); - ---Purpose: Set ColorMode for indicate write Colors or not. - - GetColorMode(me) returns Boolean; - - SetNameMode(me: in out; namemode: Boolean from Standard); - ---Purpose: Set NameMode for indicate write Name or not. - - GetNameMode(me) returns Boolean; - - SetLayerMode(me: in out; layermode: Boolean from Standard); - ---Purpose: Set LayerMode for indicate write Layers or not. - - GetLayerMode(me) returns Boolean; - -fields - - myColorMode: Boolean; - myNameMode: Boolean; - myLayerMode: Boolean; - -end Writer; diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/IGESCAFControl/IGESCAFControl_Writer.cxx index 7a9cf18638..6b1fe59f2b 100644 --- a/src/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -13,7 +13,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include @@ -43,6 +43,16 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //======================================================================= //function : IGESCAFControl_Writer diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.hxx b/src/IGESCAFControl/IGESCAFControl_Writer.hxx new file mode 100644 index 0000000000..f15f1e596b --- /dev/null +++ b/src/IGESCAFControl/IGESCAFControl_Writer.hxx @@ -0,0 +1,118 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESCAFControl_Writer_HeaderFile +#define _IGESCAFControl_Writer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class TDocStd_Document; +class TCollection_AsciiString; +class TDF_LabelSequence; +class TopoDS_Shape; +class XCAFPrs_DataMapOfShapeStyle; +class XCAFPrs_DataMapOfStyleTransient; +class TopTools_MapOfShape; +class XCAFPrs_Style; + + +//! Provides a tool to write DECAF document to the
+//! IGES file. Besides transfer of shapes (including
+//! assemblies) provided by IGESControl, supports also
+//! colors and part names
+//! IGESCAFControl_Writer writer();
+//! Methods for writing IGES file:
+//! writer.Transfer (Document);
+//! writer.Write("filename") or writer.Write(OStream) or
+//! writer.Perform(Document,"filename");
+//! Methods for managing the writing of attributes.
+//! Colors
+//! writer.SetColorMode(colormode);
+//! Standard_Boolean colormode = writer.GetColorMode();
+//! Layers
+//! writer.SetLayerMode(layermode);
+//! Standard_Boolean layermode = writer.GetLayerMode();
+//! Names
+//! writer.SetNameMode(namemode);
+//! Standard_Boolean namemode = writer.GetNameMode();
+class IGESCAFControl_Writer : public IGESControl_Writer { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a writer with an empty
+ //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
+ Standard_EXPORT IGESCAFControl_Writer(); + //! Creates a reader tool and attaches it to an already existing Session
+ //! Clears the session if it was not yet set for IGES
+ Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Transfers a document to a IGES model
+ //! Returns True if translation is OK
+ Standard_EXPORT Standard_Boolean Transfer(const Handle(TDocStd_Document)& doc) ; + + Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const TCollection_AsciiString& filename) ; + //! Transfers a document and writes it to a IGES file
+ //! Returns True if translation is OK
+ Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const Standard_CString filename) ; + //! Set ColorMode for indicate write Colors or not.
+ Standard_EXPORT void SetColorMode(const Standard_Boolean colormode) ; + + Standard_EXPORT Standard_Boolean GetColorMode() const; + //! Set NameMode for indicate write Name or not.
+ Standard_EXPORT void SetNameMode(const Standard_Boolean namemode) ; + + Standard_EXPORT Standard_Boolean GetNameMode() const; + //! Set LayerMode for indicate write Layers or not.
+ Standard_EXPORT void SetLayerMode(const Standard_Boolean layermode) ; + + Standard_EXPORT Standard_Boolean GetLayerMode() const; + +protected: + + //! Transfers labels to a IGES model
+ //! Returns True if translation is OK
+ Standard_EXPORT Standard_Boolean Transfer(const TDF_LabelSequence& labels) ; + //! Reads colors from DECAF document and assigns them
+ //! to corresponding IGES entities
+ Standard_EXPORT Standard_Boolean WriteAttributes(const TDF_LabelSequence& labels) ; + //! Reads layers from DECAF document and assigns them
+ //! to corresponding IGES entities
+ Standard_EXPORT Standard_Boolean WriteLayers(const TDF_LabelSequence& labels) ; + //! Recursivile iterates on subshapes and assign names
+ //! to IGES entity
+ Standard_EXPORT Standard_Boolean WriteNames(const TDF_LabelSequence& labels) ; + +private: + + //! Recursively iterates on subshapes and assigns colors
+ //! to faces and edges (if set)
+ Standard_EXPORT void MakeColors(const TopoDS_Shape& S,const XCAFPrs_DataMapOfShapeStyle& settings,XCAFPrs_DataMapOfStyleTransient& colors,TopTools_MapOfShape& Map,const XCAFPrs_Style& inherit) ; + + Standard_Boolean myColorMode; + Standard_Boolean myNameMode; + Standard_Boolean myLayerMode; + +}; +#endif diff --git a/src/IGESControl/FILES b/src/IGESControl/FILES new file mode 100644 index 0000000000..a520ed646c --- /dev/null +++ b/src/IGESControl/FILES @@ -0,0 +1,9 @@ +IGESControl_ActorWrite.hxx +IGESControl_ActorWrite.cxx +IGESControl_Controller.hxx +IGESControl_Controller.cxx +IGESControl_Reader.hxx +IGESControl_Reader.lxx +IGESControl_Reader.cxx +IGESControl_Writer.hxx +IGESControl_Writer.cxx \ No newline at end of file diff --git a/src/IGESControl/IGESControl.cdl b/src/IGESControl/IGESControl.cdl index b16b267c39..9d13a505c0 100644 --- a/src/IGESControl/IGESControl.cdl +++ b/src/IGESControl/IGESControl.cdl @@ -34,12 +34,13 @@ uses is - class Controller; - class Writer; - class Reader; - class ActorWrite; + imported Controller; + imported Writer; + imported Reader; class IGESBoundary; class AlgoContainer; class ToolContainer; + + imported ActorWrite; end; diff --git a/src/IGESControl/IGESControl_ActorWrite.cdl b/src/IGESControl/IGESControl_ActorWrite.cdl deleted file mode 100644 index 61d4ce3a5a..0000000000 --- a/src/IGESControl/IGESControl_ActorWrite.cdl +++ /dev/null @@ -1,43 +0,0 @@ --- Created on: 1998-09-07 --- 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 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. - -class ActorWrite from IGESControl - inherits ActorOfFinderProcess from Transfer - - ---Purpose : Actor to write Shape to IGES - -uses - - Finder from Transfer, - FinderProcess from Transfer, - Binder from Transfer - -is - - Create returns ActorWrite; - - Recognize (me : mutable; start : Finder from Transfer) returns Boolean - is redefined; - ---Purpose : Recognizes a ShapeMapper - - Transfer (me : mutable; start : Finder from Transfer; - FP : mutable FinderProcess) returns Binder is redefined; - ---Purpose : Transfers Shape to IGES Entities - -- - -- ModeTrans may be : 0 -> groups of Faces - -- or 1 -> BRep - -end ActorWrite; diff --git a/src/IGESControl/IGESControl_ActorWrite.cxx b/src/IGESControl/IGESControl_ActorWrite.cxx index ebe1db82f5..cbcf4a817f 100644 --- a/src/IGESControl/IGESControl_ActorWrite.cxx +++ b/src/IGESControl/IGESControl_ActorWrite.cxx @@ -11,11 +11,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include + #include #include #include - +#include #include #include @@ -28,6 +28,19 @@ #include #include +IMPLEMENT_STANDARD_TYPE(IGESControl_ActorWrite) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_ActorOfFinderProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESControl_ActorWrite) + + +IMPLEMENT_DOWNCAST(IGESControl_ActorWrite,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESControl_ActorWrite) + IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; } Standard_Boolean IGESControl_ActorWrite::Recognize @@ -53,7 +66,7 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer DeclareAndCast(IGESData_IGESModel,modl,FP->Model()); if (modl.IsNull()) return NullResult(); - if (themodetrans < 0 || themodetrans > 1) return NullResult(); + if (myModeTrans < 0 || myModeTrans > 1) return NullResult(); Handle(Standard_Transient) ent; DeclareAndCast(TransferBRep_ShapeMapper,shmap,start); @@ -73,8 +86,8 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP); BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP); - if (themodetrans == 0) ent = BR0.TransferShape(shape); - if (themodetrans == 1) ent = BR1.TransferShape(shape); + if (myModeTrans == 0) ent = BR0.TransferShape(shape); + if (myModeTrans == 1) ent = BR1.TransferShape(shape); // modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___ XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info); // modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___ diff --git a/src/IGESControl/IGESControl_ActorWrite.hxx b/src/IGESControl/IGESControl_ActorWrite.hxx new file mode 100644 index 0000000000..76a6e6541b --- /dev/null +++ b/src/IGESControl/IGESControl_ActorWrite.hxx @@ -0,0 +1,60 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESControl_ActorWrite_HeaderFile +#define _IGESControl_ActorWrite_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +class Transfer_Finder; +class Transfer_Binder; +class Transfer_FinderProcess; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_ActorOfFinderProcess); +class IGESControl_ActorWrite; + +DEFINE_STANDARD_HANDLE(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess) + +//! Actor to write Shape to IGES
+class IGESControl_ActorWrite : public Transfer_ActorOfFinderProcess { + +public: + + Standard_EXPORT IGESControl_ActorWrite(); + + //! Recognizes a ShapeMapper
+ Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Transfer_Finder)& start); + + //! Transfers Shape to IGES Entities
+ //!
+ //! ModeTrans may be : 0 -> groups of Faces
+ //! or 1 -> BRep
+ Standard_EXPORT virtual Handle_Transfer_Binder Transfer(const Handle(Transfer_Finder)& start, + const Handle(Transfer_FinderProcess)& FP); + + + DEFINE_STANDARD_RTTI(IGESControl_ActorWrite) + +}; +#endif diff --git a/src/IGESControl/IGESControl_Controller.cdl b/src/IGESControl/IGESControl_Controller.cdl deleted file mode 100644 index a2d838f67e..0000000000 --- a/src/IGESControl/IGESControl_Controller.cdl +++ /dev/null @@ -1,75 +0,0 @@ --- Created on: 1995-03-15 --- Created by: Christian CAILLET --- 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 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. - -class Controller from IGESControl inherits Controller from XSControl - - ---Purpose : Controller for IGES-5.1 - -uses - - CString, - Protocol from Interface, - InterfaceModel from Interface, - WorkLibrary from IFSelect, - ReturnStatus from IFSelect, - ActorOfTransientProcess from Transfer, - FinderProcess from Transfer, - ActorOfFinderProcess from Transfer, - WorkSession from XSControl, - Shape from TopoDS - -is - - Create (modefnes : Boolean = Standard_False) - returns mutable Controller from IGESControl; - ---Purpose : Initializes the use of IGES Norm (the first time) and returns - -- a Controller for IGES-5.1 - -- If is True, sets it to internal FNES format - - NewModel (me) returns mutable InterfaceModel from Interface; - ---Purpose : Creates a new empty Model ready to receive data of the Norm. - -- It is taken from IGES Template Model - - ActorRead (me; model : InterfaceModel) - returns mutable ActorOfTransientProcess from Transfer; - ---Purpose : Returns the Actor for Read attached to the pair (norm,appli) - -- It is an Actor from IGESToBRep, adapted from an IGESModel : - -- Unit, tolerances - - TransferWriteShape (me; shape : Shape from TopoDS; - FP : mutable FinderProcess from Transfer; - model : mutable InterfaceModel from Interface; - modetrans : Integer = 0) - returns ReturnStatus is redefined; - ---Purpose : Takes one Shape and transfers it to the InterfaceModel - -- (already created by NewModel for instance) - -- is to be interpreted by each kind of XstepAdaptor - -- Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape - -- -2 bad model (requires an IGESModel) - -- modeshape : 0 groupe of face (version < 5.1) - -- 1 BREP-version 5.1 of IGES - - Init (myclass) returns Boolean; - ---Purpose : Standard Initialisation. It creates a Controller for IGES and - -- records it to various names, available to select it later - -- Returns True when done, False if could not be done - -- Also, it creates and records an Adaptor for FNES - Customise (me: mutable; WS : in out WorkSession from XSControl) is redefined; -fields - - themode : Boolean; - -end Controller; diff --git a/src/IGESControl/IGESControl_Controller.cxx b/src/IGESControl/IGESControl_Controller.cxx index 081d0caf1c..74b470bf27 100644 --- a/src/IGESControl/IGESControl_Controller.cxx +++ b/src/IGESControl/IGESControl_Controller.cxx @@ -14,7 +14,7 @@ //#58 rln 28.12.98 changing default values for Global Section //sln 14.01.2002 OCC51 : verifying whether entry model of method ActorRead is IGESDatat_IGESModel -#include +#include #include #include #include @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #include #include @@ -59,10 +61,28 @@ #include #include #include -#include -#include -#include + #include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(IGESControl_Controller) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(XSControl_Controller), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESControl_Controller) + + +IMPLEMENT_DOWNCAST(IGESControl_Controller,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESControl_Controller) //szv#4:S4163:12Mar99 never referenced //static const Standard_CString thelong = "IGES"; @@ -77,7 +97,7 @@ IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod) //JR/Hp : XSControl_Controller ((Standard_CString ) (mod ? "FNES" : "IGES") , (Standard_CString ) (mod ? "fnes" : "iges") ) , // : XSControl_Controller ( (mod ? "FNES" : "iges") , (mod ? "fnes" : "iges") ) , - themode (mod) + myMode (mod) { static Standard_Boolean init = Standard_False; if (!init) { @@ -144,7 +164,7 @@ IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod) TraceStatic ("write.iges.unit",6); TraceStatic ("write.iges.brep.mode",6); - theAdaptorLibrary = new IGESSelect_WorkLibrary(themode); + theAdaptorLibrary = new IGESSelect_WorkLibrary(myMode); theAdaptorProtocol = IGESSelect_WorkLibrary::DefineProtocol(); Handle(IGESToBRep_Actor) anactiges = new IGESToBRep_Actor; diff --git a/src/IGESControl/IGESControl_Controller.hxx b/src/IGESControl/IGESControl_Controller.hxx new file mode 100644 index 0000000000..a55d5183e7 --- /dev/null +++ b/src/IGESControl/IGESControl_Controller.hxx @@ -0,0 +1,84 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESControl_Controller_HeaderFile +#define _IGESControl_Controller_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceModel; +class Transfer_ActorOfTransientProcess; +class TopoDS_Shape; +class Transfer_FinderProcess; +class XSControl_WorkSession; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(XSControl_Controller); +class IGESControl_Controller; + +DEFINE_STANDARD_HANDLE(IGESControl_Controller,XSControl_Controller) + +//! Controller for IGES-5.1
+class IGESControl_Controller : public XSControl_Controller +{ + +public: + + //! Initializes the use of IGES Norm (the first time) and returns
+ //! a Controller for IGES-5.1
+ //! If is True, sets it to internal FNES format
+ Standard_EXPORT IGESControl_Controller(const Standard_Boolean modefnes = Standard_False); + //! Creates a new empty Model ready to receive data of the Norm.
+ //! It is taken from IGES Template Model
+ Standard_EXPORT Handle_Interface_InterfaceModel NewModel() const; + //! Returns the Actor for Read attached to the pair (norm,appli)
+ //! It is an Actor from IGESToBRep, adapted from an IGESModel :
+ //! Unit, tolerances
+ Standard_EXPORT Handle_Transfer_ActorOfTransientProcess ActorRead(const Handle(Interface_InterfaceModel)& model) const; + //! Takes one Shape and transfers it to the InterfaceModel
+ //! (already created by NewModel for instance)
+ //! is to be interpreted by each kind of XstepAdaptor
+ //! Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape
+ //! -2 bad model (requires an IGESModel)
+ //! modeshape : 0 groupe of face (version < 5.1)
+ //! 1 BREP-version 5.1 of IGES
+ Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& shape,const Handle(Transfer_FinderProcess)& FP,const Handle(Interface_InterfaceModel)& model,const Standard_Integer modetrans = 0) const; + //! Standard Initialisation. It creates a Controller for IGES and
+ //! records it to various names, available to select it later
+ //! Returns True when done, False if could not be done
+ //! Also, it creates and records an Adaptor for FNES
+ Standard_EXPORT static Standard_Boolean Init() ; + + Standard_EXPORT virtual void Customise(Handle(XSControl_WorkSession)& WS) ; + + DEFINE_STANDARD_RTTI(IGESControl_Controller) + +private: + + Standard_Boolean myMode; + +}; +#endif diff --git a/src/IGESControl/IGESControl_Reader.cdl b/src/IGESControl/IGESControl_Reader.cdl deleted file mode 100644 index 6fa6f1b8f4..0000000000 --- a/src/IGESControl/IGESControl_Reader.cdl +++ /dev/null @@ -1,101 +0,0 @@ --- Created on: 1996-09-06 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class Reader from IGESControl inherits Reader from XSControl - - ---Purpose : - -- Reads IGES files, checks them and translates their contents into Open CASCADE models. - -- The IGES data can be that of a whole model or that of a specific list of entities in the model. - -- As in XSControl_Reader, you specify the list using a selection. - -- For translation of iges files it is possible to use the following sequence: - -- To change parameters of translation - -- class Interface_Static should be used before the beginning of translation - -- (see IGES Parameters and General Parameters) - -- Creation of reader - -- IGESControl_Reader reader; - -- To load a file in a model use method: - -- reader.ReadFile("filename.igs") - -- To check a loading file use method Check: - -- reader.Check(failsonly); where failsonly is equal to Standard_True or - -- Standard_False; - -- To print the results of load: - -- reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of - -- enumeration IFSelect_PrintCount - -- To transfer entities from a model the following methods can be used: - -- for the whole model - -- reader.TransferRoots(onlyvisible); where onlyvisible is equal to - -- Standard_True or Standard_False; - -- To transfer a list of entities: - -- reader.TransferList(list); - -- To transfer one entity - -- reader.TransferEntity(ent) or reader.Transfer(num); - -- To obtain a result the following method can be used: - -- reader.IsDone() - -- reader.NbShapes() and reader.Shape(num); or reader.OneShape(); - -- To print the results of transfer use method: - -- reader.PrintTransferInfo(failwarn,mode); where printfail is equal to the - -- value of enumeration IFSelect_PrintFail, mode see above. - -- Gets correspondence between an IGES entity and a result shape obtained therefrom. - -- reader.TransientProcess(); - -- TopoDS_Shape shape = - -- TransferBRep::ShapeResult(reader.TransientProcess(),ent); - - -uses CString, HSequenceOfTransient from TColStd, - IGESModel from IGESData, - PrintFail from IFSelect, - PrintCount from IFSelect, - ReturnStatus from IFSelect, - WorkSession from XSControl - -is - - Create returns Reader from IGESControl; - ---Purpose : Creates a Reader from scratch - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) - returns Reader from IGESControl; - ---Purpose : Creates a Reader from an already existing Session - - SetReadVisible(me: in out; ReadRoot: Boolean from Standard); - ---Purpose : Set the transion of ALL Roots (if theReadOnlyVisible is False) - -- or of Visible Roots (if theReadOnlyVisible is True) - ---C++: inline - - GetReadVisible(me) returns Boolean; - ---C++: inline - - IGESModel (me) returns IGESModel; - ---Purpose : Returns the model as a IGESModel. - -- It can then be consulted (header, product) - - - NbRootsForTransfer (me : in out) returns Integer is redefined; - ---Purpose : Determines the list of root entities from Model which are candidate for - -- a transfer to a Shape (type of entities is PRODUCT) - -- is taken into account to define roots - - PrintTransferInfo(me; failwarn: PrintFail from IFSelect; mode: PrintCount from IFSelect); - ---Purpose : Prints Statistics and check list for Transfer - - -- other methods are inherited from Reader in IGESToBRep - -fields - - theReadOnlyVisible : Boolean from Standard; - -end Reader; diff --git a/src/IGESControl/IGESControl_Reader.cxx b/src/IGESControl/IGESControl_Reader.cxx index 65e518b618..e959f7d0ee 100644 --- a/src/IGESControl/IGESControl_Reader.cxx +++ b/src/IGESControl/IGESControl_Reader.cxx @@ -13,7 +13,7 @@ //gka 06.01.99 S3767 //abv 10.04.99 S4136: eliminate using BRepAPI::Precision() -#include +#include #include #include #include @@ -52,6 +52,8 @@ #include #include #include +#include +#include // add of stdio.h for NT compilation #include @@ -66,7 +68,7 @@ IGESControl_Reader::IGESControl_Reader () IGESControl_Controller::Init(); SetWS (new XSControl_WorkSession); SetNorm("IGES"); - theReadOnlyVisible = Standard_False; + myReadOnlyVisible = Standard_False; } @@ -81,7 +83,7 @@ IGESControl_Reader::IGESControl_Reader IGESControl_Controller::Init(); SetWS (WS,scratch); SetNorm ("IGES"); - theReadOnlyVisible = Standard_False; + myReadOnlyVisible = Standard_False; } @@ -118,14 +120,14 @@ Standard_Integer IGESControl_Reader::NbRootsForTransfer() Interface_ShareFlags SH (model,protocol); // sln 11.06.2002 OCC448 - Interface_Static::SetIVal("read.iges.onlyvisible",theReadOnlyVisible); + Interface_Static::SetIVal("read.iges.onlyvisible",myReadOnlyVisible); Standard_Integer nb = model->NbEntities(); for (Standard_Integer i = 1; i <= nb; i ++) { Handle(IGESData_IGESEntity) ent = model->Entity(i); if ( SH.IsShared(ent) || ! actor->Recognize (ent) ) continue; // on ajoute un traitement pour ne prendre que les entites visibles - if ( ! theReadOnlyVisible || ent->BlankStatus() == 0 ) { + if ( ! myReadOnlyVisible || ent->BlankStatus() == 0 ) { theroots.Append(ent); } } diff --git a/src/IGESControl/IGESControl_Reader.hxx b/src/IGESControl/IGESControl_Reader.hxx new file mode 100644 index 0000000000..906321675b --- /dev/null +++ b/src/IGESControl/IGESControl_Reader.hxx @@ -0,0 +1,111 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESControl_Reader_HeaderFile +#define _IGESControl_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class IGESData_IGESModel; + + + +//! Reads IGES files, checks them and translates their contents into Open CASCADE models.
+//! The IGES data can be that of a whole model or that of a specific list of entities in the model.
+//! As in XSControl_Reader, you specify the list using a selection.
+//! For translation of iges files it is possible to use the following sequence:
+//! To change parameters of translation
+//! class Interface_Static should be used before the beginning of translation
+//! (see IGES Parameters and General Parameters)
+//! Creation of reader
+//! IGESControl_Reader reader;
+//! To load a file in a model use method:
+//! reader.ReadFile("filename.igs")
+//! To check a loading file use method Check:
+//! reader.Check(failsonly); where failsonly is equal to Standard_True or
+//! Standard_False;
+//! To print the results of load:
+//! reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of
+//! enumeration IFSelect_PrintCount
+//! To transfer entities from a model the following methods can be used:
+//! for the whole model
+//! reader.TransferRoots(onlyvisible); where onlyvisible is equal to
+//! Standard_True or Standard_False;
+//! To transfer a list of entities:
+//! reader.TransferList(list);
+//! To transfer one entity
+//! reader.TransferEntity(ent) or reader.Transfer(num);
+//! To obtain a result the following method can be used:
+//! reader.IsDone()
+//! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
+//! To print the results of transfer use method:
+//! reader.PrintTransferInfo(failwarn,mode); where printfail is equal to the
+//! value of enumeration IFSelect_PrintFail, mode see above.
+//! Gets correspondence between an IGES entity and a result shape obtained therefrom.
+//! reader.TransientProcess();
+//! TopoDS_Shape shape =
+//! TransferBRep::ShapeResult(reader.TransientProcess(),ent);
+class IGESControl_Reader : public XSControl_Reader +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a Reader from scratch
+ Standard_EXPORT IGESControl_Reader(); + + //! Creates a Reader from an already existing Session
+ Standard_EXPORT IGESControl_Reader(const Handle(XSControl_WorkSession)& WS, + const Standard_Boolean scratch = Standard_True); + + //! Set the transion of ALL Roots (if myReadOnlyVisible is False)
+ //! or of Visible Roots (if myReadOnlyVisible is True)
+ void SetReadVisible(const Standard_Boolean ReadRoot) ; + + Standard_Boolean GetReadVisible() const; + + //! Returns the model as a IGESModel.
+ //! It can then be consulted (header, product)
+ Standard_EXPORT Handle_IGESData_IGESModel IGESModel() const; + + //! Determines the list of root entities from Model which are candidate for
+ //! a transfer to a Shape (type of entities is PRODUCT)
+ //! is taken into account to define roots
+ Standard_EXPORT virtual Standard_Integer NbRootsForTransfer(); + + //! Prints Statistics and check list for Transfer
+ Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, + const IFSelect_PrintCount mode) const; + + +private: + Standard_Boolean myReadOnlyVisible; +}; + +#include + +#endif diff --git a/src/IGESControl/IGESControl_Reader.lxx b/src/IGESControl/IGESControl_Reader.lxx index bd94facce1..8702716e41 100644 --- a/src/IGESControl/IGESControl_Reader.lxx +++ b/src/IGESControl/IGESControl_Reader.lxx @@ -18,7 +18,7 @@ inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot) { - theReadOnlyVisible = ReadRoot; + myReadOnlyVisible = ReadRoot; } @@ -29,5 +29,5 @@ inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot) inline Standard_Boolean IGESControl_Reader::GetReadVisible ()const { - return theReadOnlyVisible; + return myReadOnlyVisible; } diff --git a/src/IGESControl/IGESControl_Writer.cdl b/src/IGESControl/IGESControl_Writer.cdl deleted file mode 100644 index 88b5c16783..0000000000 --- a/src/IGESControl/IGESControl_Writer.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Created on: 1996-01-30 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class Writer from IGESControl - - ---Purpose : This class creates and writes - -- IGES files from CAS.CADE models. An IGES file can be written to - -- an existing IGES file or to a new one. - -- The translation can be performed in one or several - -- operations. Each translation operation - -- outputs a distinct root entity in the IGES file. - -- To write an IGES file it is possible to use the following sequence: - -- To modify the IGES file header or to change translation - -- parameters it is necessary to use class Interface_Static (see - -- IGESParameters and GeneralParameters). - -uses CString, OStream, Transient, Shape from TopoDS, - FinderProcess, BasicEditor from IGESData, IGESModel, IGESEntity - -is - - Create returns Writer; - ---Purpose : Creates a writer object with the - -- default unit (millimeters) and write mode (Face). - -- IGESControl_Writer (const Standard_CString unit, - -- const Standard_Integer modecr = 0); - - Create (unit : CString; modecr : Integer = 0) returns Writer; - ---Purpose : Creates a writer with given - -- values for units and for write mode. - -- unit may be any unit that is accepted by the IGES standard. - -- By default, it is the millimeter. - -- modecr defines the write mode and may be: - -- - 0: Faces (default) - -- - 1: BRep. - - Create (model : mutable IGESModel; modecr : Integer = 0) returns Writer; - ---Purpose : Creates a writer object with the - -- prepared IGES model model in write mode. - -- modecr defines the write mode and may be: - -- - 0: Faces (default) - -- - 1: BRep. - - Model (me) returns IGESModel; - ---Purpose : Returns the IGES model to be written in output. - - TransferProcess (me) returns mutable FinderProcess; - SetTransferProcess (me : in out; TP : mutable FinderProcess); - ---Purpose : Returns/Sets the TransferProcess : it contains final results - -- and if some, check messages - - AddShape (me : in out; sh : Shape) returns Boolean; - ---Purpose : Translates a Shape to IGES Entities and adds them to the model - -- Returns True if done, False if Shape not suitable for IGES or null - - AddGeom (me : in out; geom : Transient) returns Boolean; - ---Purpose : Translates a Geometry (Surface or Curve) to IGES Entities and - -- adds them to the model - -- Returns True if done, False if geom is neither a Surface or - -- a Curve suitable for IGES or is null - - AddEntity (me : in out; ent : IGESEntity) returns Boolean; - ---Purpose : Adds an IGES entity (and the ones it references) to the model - - ComputeModel (me : in out); - ---Purpose : Computes the entities found in - -- the model, which is ready to be written. - -- This contrasts with the default computation of headers only. - - Write (me : in out; S : in out OStream; fnes : Boolean = Standard_False) - returns Boolean; - ---Purpose : Computes then writes the model to an OStream - -- Returns True when done, false in case of error - - Write (me : in out; file : CString; fnes : Boolean = Standard_False) - returns Boolean; - ---Purpose : Prepares and writes an IGES model - -- either to an OStream, S or to a file name,CString. - -- Returns True if the operation was performed correctly and - -- False if an error occurred (for instance, - -- if the processor could not create the file). - - PrintStatsTransfer (me; what : Integer; mode : Integer = 0); - ---Purpose : Prints Statistics about Transfer - -fields - - theTP : FinderProcess; - themod : IGESModel; - thedit : BasicEditor from IGESData; - thecr : Integer; -- mode ecr - thest : Boolean; -- computed ? - -end Writer; diff --git a/src/IGESControl/IGESControl_Writer.cxx b/src/IGESControl/IGESControl_Writer.cxx index 300d43527c..057cd00cd4 100644 --- a/src/IGESControl/IGESControl_Writer.cxx +++ b/src/IGESControl/IGESControl_Writer.cxx @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -43,6 +43,11 @@ #include #include #include +#include +#include +#include +#include +#include #include IGESControl_Writer::IGESControl_Writer () diff --git a/src/IGESControl/IGESControl_Writer.hxx b/src/IGESControl/IGESControl_Writer.hxx new file mode 100644 index 0000000000..6315dd280f --- /dev/null +++ b/src/IGESControl/IGESControl_Writer.hxx @@ -0,0 +1,116 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESControl_Writer_HeaderFile +#define _IGESControl_Writer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Transfer_FinderProcess; +class IGESData_IGESModel; +class TopoDS_Shape; +class Standard_Transient; +class IGESData_IGESEntity; + + +//! This class creates and writes
+//! IGES files from CAS.CADE models. An IGES file can be written to
+//! an existing IGES file or to a new one.
+//! The translation can be performed in one or several
+//! operations. Each translation operation
+//! outputs a distinct root entity in the IGES file.
+//! To write an IGES file it is possible to use the following sequence:
+//! To modify the IGES file header or to change translation
+//! parameters it is necessary to use class Interface_Static (see
+//! IGESParameters and GeneralParameters).
+class IGESControl_Writer { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a writer object with the
+ //! default unit (millimeters) and write mode (Face).
+ //! IGESControl_Writer (const Standard_CString unit,
+ //! const Standard_Integer modecr = 0);
+ Standard_EXPORT IGESControl_Writer(); + //! Creates a writer with given
+ //! values for units and for write mode.
+ //! unit may be any unit that is accepted by the IGES standard.
+ //! By default, it is the millimeter.
+ //! modecr defines the write mode and may be:
+ //! - 0: Faces (default)
+ //! - 1: BRep.
+ Standard_EXPORT IGESControl_Writer(const Standard_CString unit,const Standard_Integer modecr = 0); + //! Creates a writer object with the
+ //! prepared IGES model model in write mode.
+ //! modecr defines the write mode and may be:
+ //! - 0: Faces (default)
+ //! - 1: BRep.
+ Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model,const Standard_Integer modecr = 0); + //! Returns the IGES model to be written in output.
+ Standard_EXPORT Handle_IGESData_IGESModel Model() const; + + Standard_EXPORT Handle_Transfer_FinderProcess TransferProcess() const; + //! Returns/Sets the TransferProcess : it contains final results
+ //! and if some, check messages
+ Standard_EXPORT void SetTransferProcess(const Handle(Transfer_FinderProcess)& TP) ; + //! Translates a Shape to IGES Entities and adds them to the model
+ //! Returns True if done, False if Shape not suitable for IGES or null
+ Standard_EXPORT Standard_Boolean AddShape(const TopoDS_Shape& sh) ; + //! Translates a Geometry (Surface or Curve) to IGES Entities and
+ //! adds them to the model
+ //! Returns True if done, False if geom is neither a Surface or
+ //! a Curve suitable for IGES or is null
+ Standard_EXPORT Standard_Boolean AddGeom(const Handle(Standard_Transient)& geom) ; + //! Adds an IGES entity (and the ones it references) to the model
+ Standard_EXPORT Standard_Boolean AddEntity(const Handle(IGESData_IGESEntity)& ent) ; + //! Computes the entities found in
+ //! the model, which is ready to be written.
+ //! This contrasts with the default computation of headers only.
+ Standard_EXPORT void ComputeModel() ; + //! Computes then writes the model to an OStream
+ //! Returns True when done, false in case of error
+ Standard_EXPORT Standard_Boolean Write(Standard_OStream& S,const Standard_Boolean fnes = Standard_False) ; + //! Prepares and writes an IGES model
+ //! either to an OStream, S or to a file name,CString.
+ //! Returns True if the operation was performed correctly and
+ //! False if an error occurred (for instance,
+ //! if the processor could not create the file).
+ Standard_EXPORT Standard_Boolean Write(const Standard_CString file,const Standard_Boolean fnes = Standard_False) ; + //! Prints Statistics about Transfer
+ Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,const Standard_Integer mode = 0) const; + +private: + + Handle_Transfer_FinderProcess theTP; + Handle_IGESData_IGESModel themod; + IGESData_BasicEditor thedit; + Standard_Integer thecr; + Standard_Boolean thest; +}; +#endif diff --git a/src/IGESData/FILES b/src/IGESData/FILES index acf94ad713..33c7b0e81e 100755 --- a/src/IGESData/FILES +++ b/src/IGESData/FILES @@ -1 +1,9 @@ IGESData_Dump.hxx +IGESData_FileRecognizer.hxx +IGESData_FileRecognizer.cxx +IGESData_IGESReaderTool.hxx +IGESData_IGESReaderTool.cxx +IGESData_SpecificLib.hxx +IGESData_SpecificLib.cxx +IGESData_WriterLib.hxx +IGESData_WriterLib.cxx \ No newline at end of file diff --git a/src/IGESData/IGESData.cdl b/src/IGESData/IGESData.cdl index f9768a794b..56a0391d9f 100644 --- a/src/IGESData/IGESData.cdl +++ b/src/IGESData/IGESData.cdl @@ -50,14 +50,13 @@ is class DirChecker; class IGESReaderData; - class IGESReaderTool; + imported IGESReaderTool; class ParamReader; class ParamCursor; class DirPart; -- litteral description class IGESType; - deferred class FileRecognizer instantiates - Recognizer from Interface (IGESType, IGESEntity); + imported FileRecognizer; class IGESWriter; class IGESDumper; @@ -72,10 +71,8 @@ is class DefaultSpecific; class FileProtocol; - class WriterLib instantiates Library from LibCtl - (IGESEntity, ReadWriteModule, Protocol from IGESData); - class SpecificLib instantiates Library from LibCtl - (IGESEntity, SpecificModule, Protocol from IGESData); + imported WriterLib; + imported SpecificLib; -- -- Enumerations -- -- enumeration Status is diff --git a/src/LibCtl/LibCtl_ProtocolTemplate.gxx b/src/IGESData/IGESData_FileRecognizer.cxx similarity index 74% rename from src/LibCtl/LibCtl_ProtocolTemplate.gxx rename to src/IGESData/IGESData_FileRecognizer.cxx index 475780709e..9c34ceb0be 100644 --- a/src/LibCtl/LibCtl_ProtocolTemplate.gxx +++ b/src/IGESData/IGESData_FileRecognizer.cxx @@ -9,5 +9,10 @@ // 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 + + IMPLEMENT_STANDARD_HANDLE(IGESData_FileRecognizer, Standard_Transient) + IMPLEMENT_STANDARD_RTTIEXT(IGESData_FileRecognizer, Standard_Transient) + + \ No newline at end of file diff --git a/src/IGESData/IGESData_FileRecognizer.hxx b/src/IGESData/IGESData_FileRecognizer.hxx new file mode 100644 index 0000000000..152a49af64 --- /dev/null +++ b/src/IGESData/IGESData_FileRecognizer.hxx @@ -0,0 +1,46 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESData_FileRecognizer_HeaderFile +#define _IGESData_FileRecognizer_HeaderFile + +#include +#include +#include +#include + +class IGESData_IGESEntity; +class Standard_NoSuchObject; +class IGESData_IGESType; +class Standard_Transient; + +DEFINE_STANDARD_HANDLE(IGESData_FileRecognizer, Standard_Transient) + +class IGESData_FileRecognizer : public Interface_Recognizer +{ +public: + Standard_EXPORT IGESData_FileRecognizer(): + Interface_Recognizer () + {} + + + DEFINE_STANDARD_RTTI(IGESData_FileRecognizer); +}; + + + +#endif diff --git a/src/IGESData/IGESData_IGESReaderTool.cdl b/src/IGESData/IGESData_IGESReaderTool.cdl deleted file mode 100644 index 8bd0f343cf..0000000000 --- a/src/IGESData/IGESData_IGESReaderTool.cdl +++ /dev/null @@ -1,109 +0,0 @@ --- Created on: 1992-04-06 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -class IGESReaderTool from IGESData inherits FileReaderTool - - ---Purpose : specific FileReaderTool for IGES - -- Parameters are accessed through specific objects, ParamReaders - -uses Integer, Boolean, Transient, - Check, InterfaceModel, GeneralLib, ReaderLib, ParamList, - IGESReaderData, Protocol from IGESData, FileRecognizer, - IGESType, IGESEntity, DirPart, ReadStage, ParamReader - -is - - Create (reader : mutable IGESReaderData; protocol : Protocol from IGESData) - returns IGESReaderTool; - ---Purpose : creates IGESReaderTool to work with an IGESReaderData and an - -- IGES Protocol. - -- Actually, no Lib is used - - -- -- General -- -- - - Prepare (me : in out; reco : mutable FileRecognizer); - ---Purpose : binds empty entities to records, works with the Protocol - -- (from IGESData) stored and later used - -- RQ : Actually, sets DNum into IGES Entities - -- Also loads the list of parameters for ParamReader - - Recognize (me : in out; num : Integer; - ach : in out Check; ent : out mutable Transient) - returns Boolean; - ---Purpose : recognizes records by asking Protocol (on data of DirType) - - -- Loading the IGESModel -- - - BeginRead (me : in out; amodel : mutable InterfaceModel); - ---Purpose : fills model's header, that is, its GlobalSection - - AnalyseRecord (me : in out; - num : Integer; anent : mutable Transient; acheck : in out Check) - returns Boolean; - ---Purpose : fills an entity, given record no; works by calling ReadDirPart - -- then ReadParams (with help of a ParamReader), then if required - -- ReadProps and ReadAssocs, from IGESEntity - -- Returns True if no fail has been recorded - - EndRead (me : in out; amodel : mutable InterfaceModel) is redefined; - ---Purpose : after reading entities, true line weights can be computed - - -- For each IGESEntity -- - - ReadDir (me; ent : mutable IGESEntity; IR : IGESReaderData; - DP : DirPart; ach : in out Check); - ---Purpose : Reads directory part componants from file; DP is the litteral - -- directory part, IR detains entities referenced by DP - - ReadOwnParams (me; ent : mutable IGESEntity; - IR : IGESReaderData; PR : in out ParamReader); - ---Purpose : Performs Reading of own Parameters for each IGESEntity - -- Works with the ReaderLib loaded with ReadWriteModules for IGES - -- In case of failure, tries UndefinedEntity from IGES - - ReadProps (me; ent : mutable IGESEntity; IR : IGESReaderData; - PR : in out ParamReader); - ---Purpose : Reads Property List, if there is (if not, does nothing) - -- criterium is : current parameter of PR remains inside params - -- list, and Stage is "Own" - -- Current parameter must be a positive integer, which value - -- gives the length of the list; else, a Fail is produced (into - -- Check of PR) and reading process is stopped - - ReadAssocs (me; ent : mutable IGESEntity; IR : IGESReaderData; - PR : in out ParamReader); - ---Purpose : Reads Associativity List, if there is (if not, does nothing) - -- criterium is : current parameter of PR remains inside params - -- list, and Stage is "Own" - -- Same conditions as above; in addition, no parameter must be - -- let after the list once read - -- Note that "Associated" entities are not declared "Shared" - -fields - - thelist : ParamList; -- (loaded once, allows optimization) - thereco : FileRecognizer; - theglib : GeneralLib; - therlib : ReaderLib; - thecnum : Integer; -- current entity number for recognize - thectyp : IGESType; -- its IGESType (for purpose of optimization) - thestep : ReadStage; -- to continue an interrupted party - thechk : Check; -- check on header (kept by IGESModel) - thegradweight : Integer; - themaxweight : Real; - thedefweight : Real; - -end IGESReaderTool; diff --git a/src/IGESData/IGESData_IGESReaderTool.cxx b/src/IGESData/IGESData_IGESReaderTool.cxx index a8e07fb054..2dc035bcdb 100644 --- a/src/IGESData/IGESData_IGESReaderTool.cxx +++ b/src/IGESData/IGESData_IGESReaderTool.cxx @@ -11,7 +11,16 @@ // 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 #include #include #include diff --git a/src/IGESData/IGESData_IGESReaderTool.hxx b/src/IGESData/IGESData_IGESReaderTool.hxx new file mode 100644 index 0000000000..2d428ee111 --- /dev/null +++ b/src/IGESData/IGESData_IGESReaderTool.hxx @@ -0,0 +1,139 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESData_IGESReaderTool_HeaderFile +#define _IGESData_IGESReaderTool_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_ParamList; +class IGESData_FileRecognizer; +class Interface_Check; +class IGESData_IGESReaderData; +class IGESData_Protocol; +class Standard_Transient; +class Interface_InterfaceModel; +class IGESData_IGESEntity; +class IGESData_DirPart; +class IGESData_ParamReader; + + +//! specific FileReaderTool for IGES
+//! Parameters are accessed through specific objects, ParamReaders
+class IGESData_IGESReaderTool : public Interface_FileReaderTool +{ +public: + + DEFINE_STANDARD_ALLOC + + //! creates IGESReaderTool to work with an IGESReaderData and an
+//! IGES Protocol.
+//! Actually, no Lib is used
+ Standard_EXPORT IGESData_IGESReaderTool(const Handle(IGESData_IGESReaderData)& reader,const Handle(IGESData_Protocol)& protocol); + //! binds empty entities to records, works with the Protocol
+//! (from IGESData) stored and later used
+//! RQ : Actually, sets DNum into IGES Entities
+//! Also loads the list of parameters for ParamReader
+ Standard_EXPORT void Prepare(const Handle(IGESData_FileRecognizer)& reco) ; + //! recognizes records by asking Protocol (on data of DirType)
+ Standard_EXPORT Standard_Boolean Recognize(const Standard_Integer num,Handle(Interface_Check)& ach,Handle(Standard_Transient)& ent) ; + //! fills model's header, that is, its GlobalSection
+ Standard_EXPORT void BeginRead(const Handle(Interface_InterfaceModel)& amodel) ; + //! fills an entity, given record no; works by calling ReadDirPart
+//! then ReadParams (with help of a ParamReader), then if required
+//! ReadProps and ReadAssocs, from IGESEntity
+//! Returns True if no fail has been recorded
+ Standard_EXPORT Standard_Boolean AnalyseRecord(const Standard_Integer num,const Handle(Standard_Transient)& anent,Handle(Interface_Check)& acheck) ; + //! after reading entities, true line weights can be computed
+ Standard_EXPORT virtual void EndRead(const Handle(Interface_InterfaceModel)& amodel) ; + //! Reads directory part componants from file; DP is the litteral
+//! directory part, IR detains entities referenced by DP
+ Standard_EXPORT void ReadDir(const Handle(IGESData_IGESEntity)& ent,const Handle(IGESData_IGESReaderData)& IR,const IGESData_DirPart& DP,Handle(Interface_Check)& ach) const; + //! Performs Reading of own Parameters for each IGESEntity
+//! Works with the ReaderLib loaded with ReadWriteModules for IGES
+//! In case of failure, tries UndefinedEntity from IGES
+ Standard_EXPORT void ReadOwnParams(const Handle(IGESData_IGESEntity)& ent,const Handle(IGESData_IGESReaderData)& IR,IGESData_ParamReader& PR) const; + //! Reads Property List, if there is (if not, does nothing)
+//! criterium is : current parameter of PR remains inside params
+//! list, and Stage is "Own"
+//! Current parameter must be a positive integer, which value
+//! gives the length of the list; else, a Fail is produced (into
+//! Check of PR) and reading process is stopped
+ Standard_EXPORT void ReadProps(const Handle(IGESData_IGESEntity)& ent,const Handle(IGESData_IGESReaderData)& IR,IGESData_ParamReader& PR) const; + //! Reads Associativity List, if there is (if not, does nothing)
+//! criterium is : current parameter of PR remains inside params
+//! list, and Stage is "Own"
+//! Same conditions as above; in addition, no parameter must be
+//! let after the list once read
+//! Note that "Associated" entities are not declared "Shared"
+ Standard_EXPORT void ReadAssocs(const Handle(IGESData_IGESEntity)& ent,const Handle(IGESData_IGESReaderData)& IR,IGESData_ParamReader& PR) const; + + + + + +protected: + + + + + +private: + + + +Handle_Interface_ParamList thelist; +Handle_IGESData_FileRecognizer thereco; +Interface_GeneralLib theglib; +Interface_ReaderLib therlib; +Standard_Integer thecnum; +IGESData_IGESType thectyp; +IGESData_ReadStage thestep; +Handle_Interface_Check thechk; +Standard_Integer thegradweight; +Standard_Real themaxweight; +Standard_Real thedefweight; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/IGESData/IGESData_SpecificLib.cxx b/src/IGESData/IGESData_SpecificLib.cxx new file mode 100644 index 0000000000..966df90d48 --- /dev/null +++ b/src/IGESData/IGESData_SpecificLib.cxx @@ -0,0 +1,30 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +typedef LibCtl_GlobalNode + IGESData_GlobalNodeOfSpecificLib; + +template<> +Standard_EXPORT NCollection_Handle< IGESData_GlobalNodeOfSpecificLib >& +IGESData_SpecificLib::GetGlobal() +{ + static NCollection_Handle< IGESData_GlobalNodeOfSpecificLib > aGlobal; + return aGlobal; +} diff --git a/src/IGESData/IGESData_SpecificLib.hxx b/src/IGESData/IGESData_SpecificLib.hxx new file mode 100644 index 0000000000..38738f8642 --- /dev/null +++ b/src/IGESData/IGESData_SpecificLib.hxx @@ -0,0 +1,45 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESData_SpecificLib_HeaderFile +#define _IGESData_SpecificLib_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_NoSuchObject; +class Standard_Transient; +class IGESData_IGESEntity; +class IGESData_IGESEntity; +class IGESData_SpecificModule; +class IGESData_Protocol; + +typedef LibCtl_Library + IGESData_SpecificLib; + +#endif \ No newline at end of file diff --git a/src/IGESData/IGESData_WriterLib.cxx b/src/IGESData/IGESData_WriterLib.cxx new file mode 100644 index 0000000000..f98b3ac15d --- /dev/null +++ b/src/IGESData/IGESData_WriterLib.cxx @@ -0,0 +1,30 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +typedef LibCtl_GlobalNode + IGESData_GlobalNodeOfWriterLib; + +template<> +Standard_EXPORT NCollection_Handle< IGESData_GlobalNodeOfWriterLib >& +IGESData_WriterLib::GetGlobal() +{ + static NCollection_Handle< IGESData_GlobalNodeOfWriterLib > aGlobal; + return aGlobal; +} diff --git a/src/IGESData/IGESData_WriterLib.hxx b/src/IGESData/IGESData_WriterLib.hxx new file mode 100644 index 0000000000..00d8b735cf --- /dev/null +++ b/src/IGESData/IGESData_WriterLib.hxx @@ -0,0 +1,47 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESData_WriterLib_HeaderFile +#define _IGESData_WriterLib_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_NoSuchObject; +class IGESData_IGESEntity; +class IGESData_ReadWriteModule; +class IGESData_Protocol; +class Standard_Transient; + + +typedef LibCtl_Library + IGESData_WriterLib; + +#endif diff --git a/src/IGESDefs/FILES b/src/IGESDefs/FILES new file mode 100644 index 0000000000..bcb441a507 --- /dev/null +++ b/src/IGESDefs/FILES @@ -0,0 +1,4 @@ +IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.hxx +IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.cxx +IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle.hxx + diff --git a/src/IGESDefs/IGESDefs.cdl b/src/IGESDefs/IGESDefs.cdl index 914597c260..a4325f3029 100644 --- a/src/IGESDefs/IGESDefs.cdl +++ b/src/IGESDefs/IGESDefs.cdl @@ -98,9 +98,9 @@ is class HArray1OfTabularData instantiates HArray1 from TCollection (TabularData,Array1OfTabularData); - class HArray1OfHArray1OfTextDisplayTemplate instantiates - -- HArray1 (HArray1OfTextDisplayTemplate,Array1OfHArray1OfTextDisplayTemplate); - JaggedArray from Interface (HArray1OfTextDisplayTemplate from IGESGraph); + + imported HArray1OfHArray1OfTextDisplayTemplate; + imported HArray1OfHArray1OfTextDisplayTemplate_Handle; -- Package Methods diff --git a/src/IGESDefs/IGESDefs_AssociativityDef.cdl b/src/IGESDefs/IGESDefs_AssociativityDef.cdl index 5a6d04b8a3..fb20fb6fbe 100644 --- a/src/IGESDefs/IGESDefs_AssociativityDef.cdl +++ b/src/IGESDefs/IGESDefs_AssociativityDef.cdl @@ -24,8 +24,8 @@ class AssociativityDef from IGESDefs inherits IGESEntity uses - HArray1OfInteger from TColStd, - HArray1OfHArray1OfInteger from IGESBasic + HArray1OfInteger from TColStd, + HArray1OfHArray1OfInteger_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -39,7 +39,7 @@ is requirements : HArray1OfInteger; orders : HArray1OfInteger; numItems : HArray1OfInteger; - items : HArray1OfHArray1OfInteger) + items : HArray1OfHArray1OfInteger_Handle) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class -- AssociativityDef @@ -106,6 +106,6 @@ fields theBackPointerReqs : HArray1OfInteger; theClassOrders : HArray1OfInteger; theNbItemsPerClass : HArray1OfInteger; - theItems : HArray1OfHArray1OfInteger; + theItems : HArray1OfHArray1OfInteger_Handle; end AssociativityDef; diff --git a/src/IGESDefs/IGESDefs_AttributeDef.cdl b/src/IGESDefs/IGESDefs_AttributeDef.cdl index 6abaaa283c..7fac2dfa62 100644 --- a/src/IGESDefs/IGESDefs_AttributeDef.cdl +++ b/src/IGESDefs/IGESDefs_AttributeDef.cdl @@ -32,7 +32,7 @@ uses HArray1OfIGESEntity from IGESData, TextDisplayTemplate from IGESGraph, HArray1OfTextDisplayTemplate from IGESGraph, - HArray1OfHArray1OfTextDisplayTemplate from IGESDefs + HArray1OfHArray1OfTextDisplayTemplate_Handle from IGESDefs raises DimensionMismatch, OutOfRange, NullObject @@ -49,7 +49,7 @@ is attrValueDataTypes : HArray1OfInteger; attrValueCounts : HArray1OfInteger; attrValues : HArray1OfTransient from TColStd; - attrValuePointers : HArray1OfHArray1OfTextDisplayTemplate) + attrValuePointers : HArray1OfHArray1OfTextDisplayTemplate_Handle) raises DimensionMismatch; -- This method is used to set the fields of the -- class AttributeDef @@ -163,6 +163,6 @@ fields theAttrValueDataTypes : HArray1OfInteger; theAttrValueCounts : HArray1OfInteger; theAttrValues : HArray1OfTransient from TColStd; - theAttrValuePointers : HArray1OfHArray1OfTextDisplayTemplate; + theAttrValuePointers : HArray1OfHArray1OfTextDisplayTemplate_Handle; end AttributeDef; diff --git a/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.cxx b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.cxx new file mode 100644 index 0000000000..ca30b9edf2 --- /dev/null +++ b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.cxx @@ -0,0 +1,21 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +IMPLEMENT_STANDARD_HANDLE(IGESDefs_HArray1OfHArray1OfTextDisplayTemplate, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_HArray1OfHArray1OfTextDisplayTemplate, MMgt_TShared) diff --git a/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.hxx b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.hxx new file mode 100644 index 0000000000..2f71192798 --- /dev/null +++ b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate.hxx @@ -0,0 +1,40 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_H__ +#define _IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_H__ + +#include +#include +#include + +class IGESGraph_HArray1OfTextDisplayTemplate; + +class IGESDefs_HArray1OfHArray1OfTextDisplayTemplate : public Interface_JaggedArray +{ +public: + Standard_EXPORT IGESDefs_HArray1OfHArray1OfTextDisplayTemplate + (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + :Interface_JaggedArray (theLowerIndex, theUpperIndex) + {} + DEFINE_STANDARD_RTTI(IGESDefs_HArray1OfHArray1OfTextDisplayTemplate); +}; + +DEFINE_STANDARD_HANDLE(IGESDefs_HArray1OfHArray1OfTextDisplayTemplate, MMgt_TShared) + +#endif diff --git a/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle.hxx b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle.hxx new file mode 100644 index 0000000000..afaff5a9ba --- /dev/null +++ b/src/IGESDefs/IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle.hxx @@ -0,0 +1,26 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle_H__ +#define _IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle_H__ + +#include + +typedef Handle(IGESDefs_HArray1OfHArray1OfTextDisplayTemplate) + IGESDefs_HArray1OfHArray1OfTextDisplayTemplate_Handle; + +#endif \ No newline at end of file diff --git a/src/IGESDefs/IGESDefs_TabularData.cdl b/src/IGESDefs/IGESDefs_TabularData.cdl index 8434bc3c86..28f6546af7 100644 --- a/src/IGESDefs/IGESDefs_TabularData.cdl +++ b/src/IGESDefs/IGESDefs_TabularData.cdl @@ -23,9 +23,9 @@ class TabularData from IGESDefs inherits IGESEntity uses - HArray1OfInteger from TColStd, - HArray1OfReal from TColStd, - HArray1OfHArray1OfReal from IGESBasic + HArray1OfInteger from TColStd, + HArray1OfReal from TColStd, + HArray1OfHArray1OfReal_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -40,8 +40,8 @@ is propType : Integer; typesInd : HArray1OfInteger; nbValuesInd : HArray1OfInteger; - valuesInd : HArray1OfHArray1OfReal; - valuesDep : HArray1OfHArray1OfReal) + valuesInd : HArray1OfHArray1OfReal_Handle; + valuesDep : HArray1OfHArray1OfReal_Handle) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class -- TabularData @@ -127,7 +127,7 @@ fields thePropertyType : Integer; theTypeOfIndependentVariables : HArray1OfInteger; theNbValues : HArray1OfInteger; - theIndependentValues : HArray1OfHArray1OfReal; - theDependentValues : HArray1OfHArray1OfReal; + theIndependentValues : HArray1OfHArray1OfReal_Handle; + theDependentValues : HArray1OfHArray1OfReal_Handle; end TabularData; diff --git a/src/IGESGeom/IGESGeom_Boundary.cdl b/src/IGESGeom/IGESGeom_Boundary.cdl index ec73c9a531..1aef20dfed 100644 --- a/src/IGESGeom/IGESGeom_Boundary.cdl +++ b/src/IGESGeom/IGESGeom_Boundary.cdl @@ -23,9 +23,9 @@ class Boundary from IGESGeom inherits IGESEntity uses - HArray1OfInteger from TColStd, - HArray1OfIGESEntity from IGESData, - HArray1OfHArray1OfIGESEntity from IGESBasic + HArray1OfInteger from TColStd, + HArray1OfIGESEntity from IGESData, + HArray1OfHArray1OfIGESEntity_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -41,7 +41,7 @@ is aSurface : IGESEntity; allModelCurves : HArray1OfIGESEntity; allSenses : HArray1OfInteger; - allParameterCurves : HArray1OfHArray1OfIGESEntity) + allParameterCurves : HArray1OfHArray1OfIGESEntity_Handle) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class -- Boundary @@ -123,6 +123,6 @@ fields theSurface : IGESEntity; theModelCurves : HArray1OfIGESEntity; theSenses : HArray1OfInteger; - theParameterCurves : HArray1OfHArray1OfIGESEntity; + theParameterCurves : HArray1OfHArray1OfIGESEntity_Handle; end Boundary; diff --git a/src/IGESGraph/IGESGraph_TextFontDef.cdl b/src/IGESGraph/IGESGraph_TextFontDef.cdl index 2c35eaa3c1..42eb205dfa 100644 --- a/src/IGESGraph/IGESGraph_TextFontDef.cdl +++ b/src/IGESGraph/IGESGraph_TextFontDef.cdl @@ -25,9 +25,9 @@ class TextFontDef from IGESGraph inherits IGESEntity uses - HAsciiString from TCollection, - HArray1OfInteger from TColStd, - HArray1OfHArray1OfInteger from IGESBasic + HAsciiString from TCollection, + HArray1OfInteger from TColStd, + HArray1OfHArray1OfInteger_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -47,9 +47,9 @@ is allNextCharX : HArray1OfInteger; allNextCharY : HArray1OfInteger; allPenMotions : HArray1OfInteger; - allPenFlags : HArray1OfHArray1OfInteger; - allMovePenToX : HArray1OfHArray1OfInteger; - allMovePenToY : HArray1OfHArray1OfInteger) + allPenFlags : HArray1OfHArray1OfInteger_Handle; + allMovePenToX : HArray1OfHArray1OfInteger_Handle; + allMovePenToY : HArray1OfHArray1OfInteger_Handle) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class -- TextFontDef @@ -164,14 +164,14 @@ fields -- Number of pen motions for each character(Length = NbCharacters) -- is (NM1 ,NM2 ....... NMn) - thePenMotions : HArray1OfHArray1OfInteger; + thePenMotions : HArray1OfHArray1OfInteger_Handle; -- Status of Pen up/down flag for each character -- flag : 0 = Down(Default) -- 1 = Up -- Note : Inner HArray1 are of lengths NM1, NM2... NMn respectively - thePenMovesToX : HArray1OfHArray1OfInteger; - thePenMovesToY : HArray1OfHArray1OfInteger; + thePenMovesToX : HArray1OfHArray1OfInteger_Handle; + thePenMovesToY : HArray1OfHArray1OfInteger_Handle; -- For each character, Grid location to which the pen is to move -- Note : Inner HArray1 are of lengths NM1, NM2... NMn respectively diff --git a/src/IGESGraph/IGESGraph_ToolTextFontDef.cxx b/src/IGESGraph/IGESGraph_ToolTextFontDef.cxx index c1e308a475..d78c8edd8c 100644 --- a/src/IGESGraph/IGESGraph_ToolTextFontDef.cxx +++ b/src/IGESGraph/IGESGraph_ToolTextFontDef.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/src/IGESSelect/FILES b/src/IGESSelect/FILES new file mode 100644 index 0000000000..94ccc9fd7d --- /dev/null +++ b/src/IGESSelect/FILES @@ -0,0 +1,6 @@ +IGESSelect_FileModifier.hxx +IGESSelect_FileModifier.cxx +IGESSelect_AddFileComment.hxx +IGESSelect_AddFileComment.cxx +IGESSelect_FloatFormat.hxx +IGESSelect_FloatFormat.cxx \ No newline at end of file diff --git a/src/IGESSelect/IGESSelect.cdl b/src/IGESSelect/IGESSelect.cdl index cfee12a574..f07745f126 100644 --- a/src/IGESSelect/IGESSelect.cdl +++ b/src/IGESSelect/IGESSelect.cdl @@ -56,14 +56,12 @@ is class SelectFaces; -- Select some geometries : Faces class SelectPCurves; -- Select PCurves of Faces + imported FileModifier; + + deferred class ModelModifier; - deferred class ModelModifier instantiates - ModelModifier from IFSelect (IGESModel from IGESData, Protocol from IGESData); - deferred class FileModifier instantiates - FileModifier from IFSelect (IGESWriter from IGESData); - - class FloatFormat; -- File Modifier to control Float Format - class AddFileComment; -- " " to add comment start lines + imported FloatFormat; -- File Modifier to control Float Format + imported AddFileComment; -- " " to add comment start lines class UpdateFileName; -- Set new file name class UpdateCreationDate; -- Set new creation date diff --git a/src/IGESSelect/IGESSelect_AddFileComment.cdl b/src/IGESSelect/IGESSelect_AddFileComment.cdl deleted file mode 100644 index 22788a5cc6..0000000000 --- a/src/IGESSelect/IGESSelect_AddFileComment.cdl +++ /dev/null @@ -1,65 +0,0 @@ --- Created on: 1994-08-26 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -class AddFileComment from IGESSelect inherits FileModifier from IGESSelect - - ---Purpose : This class allows to add comment lines on writing an IGES File - -- These lines are added to Start Section, instead of the only - -- one blank line written by default. - -uses CString, AsciiString from TCollection, - HSequenceOfHAsciiString from TColStd, - IGESWriter , ContextWrite - -is - - Create returns mutable AddFileComment; - ---Purpose : Creates a new emoty AddFileComment. Use AddLine to complete it - - Clear (me : mutable); - ---Purpose : Clears the list of file comment lines already stored - - AddLine (me : mutable; line : CString); - ---Purpose : Adds a line for file comment - -- Remark : Lines are limited to 72 useful char.s . A line of more than - -- 72 char.s will be splited into several ones of 72 max each. - - AddLines (me : mutable; lines : HSequenceOfHAsciiString from TColStd); - ---Purpose : Adds a list of lines for file comment - -- Each of them must comply with demand of AddLine - - NbLines (me) returns Integer; - ---Purpose : Returns the count of stored lines - - Line (me; num : Integer) returns CString; - ---Purpose : Returns a stored line given its rank - - Lines (me) returns HSequenceOfHAsciiString from TColStd; - ---Purpose : Returns the complete list of lines in once - - Perform (me; ctx : in out ContextWrite; - writer : in out IGESWriter); - ---Purpose : Sends the comment lines to the file (Start Section) - - Label (me) returns AsciiString from TCollection; - ---Purpose : Returns specific Label, which is - -- "Add Comment Lines (Start Section)" - -fields - - thelist : HSequenceOfHAsciiString from TColStd; - -end AddFileComment; diff --git a/src/IGESSelect/IGESSelect_AddFileComment.cxx b/src/IGESSelect/IGESSelect_AddFileComment.cxx index 8293268899..e4670f9d64 100644 --- a/src/IGESSelect/IGESSelect_AddFileComment.cxx +++ b/src/IGESSelect/IGESSelect_AddFileComment.cxx @@ -14,11 +14,30 @@ // 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 +IMPLEMENT_STANDARD_TYPE(IGESSelect_AddFileComment) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IGESSelect_FileModifier), + STANDARD_TYPE(IFSelect_GeneralModifier), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESSelect_AddFileComment) + + +IMPLEMENT_DOWNCAST(IGESSelect_AddFileComment,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESSelect_AddFileComment) + IGESSelect_AddFileComment::IGESSelect_AddFileComment () { thelist = new TColStd_HSequenceOfHAsciiString(); } diff --git a/src/IGESSelect/IGESSelect_AddFileComment.hxx b/src/IGESSelect/IGESSelect_AddFileComment.hxx new file mode 100644 index 0000000000..4bd38d8179 --- /dev/null +++ b/src/IGESSelect/IGESSelect_AddFileComment.hxx @@ -0,0 +1,76 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESSelect_AddFileComment_HeaderFile +#define _IGESSelect_AddFileComment_HeaderFile + +#include +#include +#include +#include +#include +#include + +class TColStd_HSequenceOfHAsciiString; +class IFSelect_ContextWrite; +class IGESData_IGESWriter; +class TCollection_AsciiString; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(IGESSelect_FileModifier); +class IGESSelect_AddFileComment; + +DEFINE_STANDARD_HANDLE(IGESSelect_AddFileComment,IGESSelect_FileModifier) + +//! This class allows to add comment lines on writing an IGES File
+//! These lines are added to Start Section, instead of the only
+//! one blank line written by default.
+class IGESSelect_AddFileComment : public IGESSelect_FileModifier +{ + +public: + + //! Creates a new emoty AddFileComment. Use AddLine to complete it
+ Standard_EXPORT IGESSelect_AddFileComment(); + //! Clears the list of file comment lines already stored
+ Standard_EXPORT void Clear() ; + //! Adds a line for file comment
+ //! Remark : Lines are limited to 72 useful char.s . A line of more than
+ //! 72 char.s will be splited into several ones of 72 max each.
+ Standard_EXPORT void AddLine(const Standard_CString line) ; + //! Adds a list of lines for file comment
+ //! Each of them must comply with demand of AddLine
+ Standard_EXPORT void AddLines(const Handle(TColStd_HSequenceOfHAsciiString)& lines) ; + //! Returns the count of stored lines
+ Standard_EXPORT Standard_Integer NbLines() const; + //! Returns a stored line given its rank
+ Standard_EXPORT Standard_CString Line(const Standard_Integer num) const; + //! Returns the complete list of lines in once
+ Standard_EXPORT Handle_TColStd_HSequenceOfHAsciiString Lines() const; + //! Sends the comment lines to the file (Start Section)
+ Standard_EXPORT void Perform(IFSelect_ContextWrite& ctx,IGESData_IGESWriter& writer) const; + //! Returns specific Label, which is
+ //! "Add Comment Lines (Start Section)"
+ Standard_EXPORT TCollection_AsciiString Label() const; + + + DEFINE_STANDARD_RTTI(IGESSelect_AddFileComment) + +private: + Handle_TColStd_HSequenceOfHAsciiString thelist; +}; +#endif diff --git a/src/IGESSelect/IGESSelect_FileModifier.cxx b/src/IGESSelect/IGESSelect_FileModifier.cxx new file mode 100644 index 0000000000..5e8c196a4b --- /dev/null +++ b/src/IGESSelect/IGESSelect_FileModifier.cxx @@ -0,0 +1,34 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(IGESSelect_FileModifier) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_GeneralModifier), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESSelect_FileModifier) + + +IMPLEMENT_DOWNCAST(IGESSelect_FileModifier,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESSelect_FileModifier) \ No newline at end of file diff --git a/src/IGESSelect/IGESSelect_FileModifier.hxx b/src/IGESSelect/IGESSelect_FileModifier.hxx new file mode 100644 index 0000000000..a828f83f0f --- /dev/null +++ b/src/IGESSelect/IGESSelect_FileModifier.hxx @@ -0,0 +1,48 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESSelect_FileModifier_HeaderFile +#define _IGESSelect_FileModifier_HeaderFile + +#include +#include +#include + +class IGESData_IGESWriter; +class IFSelect_ContextWrite; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(IFSelect_GeneralModifier); +class IGESSelect_FileModifier; + +DEFINE_STANDARD_HANDLE(IGESSelect_FileModifier,IFSelect_GeneralModifier) + +class IGESSelect_FileModifier : public IFSelect_GeneralModifier +{ + +public: + Standard_EXPORT virtual void Perform(IFSelect_ContextWrite& ctx,IGESData_IGESWriter& writer) const = 0; + + DEFINE_STANDARD_RTTI(IGESSelect_FileModifier) +protected: + + Standard_EXPORT IGESSelect_FileModifier () + : IFSelect_GeneralModifier (Standard_False) + { } + +}; +#endif diff --git a/src/IGESSelect/IGESSelect_FloatFormat.cdl b/src/IGESSelect/IGESSelect_FloatFormat.cdl deleted file mode 100644 index d2c333e204..0000000000 --- a/src/IGESSelect/IGESSelect_FloatFormat.cdl +++ /dev/null @@ -1,92 +0,0 @@ --- Created on: 1994-06-01 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -class FloatFormat from IGESSelect inherits FileModifier from IGESSelect - - ---Purpose : This class gives control out format for floatting values : - -- ZeroSuppress or no, Main Format, Format in Range (for values - -- around 1.), as IGESWriter allows to manage it. - -- Formats are given under C-printf form - -uses CString, AsciiString from TCollection, - IGESWriter , ContextWrite - -is - - Create returns mutable FloatFormat; - ---Purpose : Creates a new FloatFormat, with standard options : - -- ZeroSuppress, Main Format = %E, - -- Format between 0.001 and 1000. = %f - - SetDefault (me : mutable; digits : Integer = 0); - ---Purpose : Sets FloatFormat to default value (see Create) but if - -- is given positive, it commands Formats (main and range) to - -- ensure significant digits to be displayed - - SetZeroSuppress (me : mutable; mode : Boolean); - ---Purpose : Sets ZeroSuppress mode to a new value - - SetFormat (me : mutable; format : CString = "%E"); - ---Purpose : Sets Main Format to a new value - -- Remark : SetFormat, SetZeroSuppress and SetFormatForRange are - -- independant - - SetFormatForRange (me : mutable; format : CString = "%f"; - Rmin : Real = 0.1; Rmax : Real = 1000.0); - ---Purpose : Sets Format for Range to a new value with its range of - -- application. - -- To cancel it, give format as "" (empty string) - -- Remark that if the condition (0. < Rmin < Rmax) is not - -- verified, this secondary format will be ignored. - -- Moreover, this secondary format is intended to be used in a - -- range around 1. - - - Format (me; zerosup : out Boolean; - mainform : out AsciiString from TCollection; - hasrange : out Boolean; - forminrange : out AsciiString from TCollection; - rangemin, rangemax : out Real); - ---Purpose : Returns all recorded parameters : - -- zerosup : ZeroSuppress status - -- mainform : Main Format (which applies out of the range, or - -- for every real if no range is set) - -- hasrange : True if a FormatInRange is set, False else - -- (following parameters do not apply if it is False) - -- forminrange : Secondary Format (it applies inside the range) - -- rangemin, rangemax : the range in which the secondary format - -- applies - - - Perform (me; ctx : in out ContextWrite; - writer : in out IGESWriter); - ---Purpose : Sets the Floatting Formats of IGESWriter to the recorded - -- parameters - - Label (me) returns AsciiString from TCollection; - ---Purpose : Returns specific Label : for instance, - -- "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]" - -fields - - thezerosup : Boolean; - themainform : AsciiString from TCollection; - theformrange : AsciiString from TCollection; - therangemin : Real; - therangemax : Real; - -end FloatFormat; - diff --git a/src/IGESSelect/IGESSelect_FloatFormat.cxx b/src/IGESSelect/IGESSelect_FloatFormat.cxx index e964546e39..975768b66e 100644 --- a/src/IGESSelect/IGESSelect_FloatFormat.cxx +++ b/src/IGESSelect/IGESSelect_FloatFormat.cxx @@ -11,11 +11,27 @@ // 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 +IMPLEMENT_STANDARD_TYPE(IGESSelect_FloatFormat) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IGESSelect_FileModifier), + STANDARD_TYPE(IFSelect_GeneralModifier), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESSelect_FloatFormat) + + +IMPLEMENT_DOWNCAST(IGESSelect_FloatFormat,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESSelect_FloatFormat) IGESSelect_FloatFormat::IGESSelect_FloatFormat () : thezerosup (Standard_True) , themainform ("%E") , diff --git a/src/IGESSelect/IGESSelect_FloatFormat.hxx b/src/IGESSelect/IGESSelect_FloatFormat.hxx new file mode 100644 index 0000000000..330ad99afd --- /dev/null +++ b/src/IGESSelect/IGESSelect_FloatFormat.hxx @@ -0,0 +1,98 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESSelect_FloatFormat_HeaderFile +#define _IGESSelect_FloatFormat_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +class TCollection_AsciiString; +class IFSelect_ContextWrite; +class IGESData_IGESWriter; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(IGESSelect_FileModifier); +class IGESSelect_FloatFormat; + +DEFINE_STANDARD_HANDLE(IGESSelect_FloatFormat,IGESSelect_FileModifier) + +//! This class gives control out format for floatting values :
+//! ZeroSuppress or no, Main Format, Format in Range (for values
+//! around 1.), as IGESWriter allows to manage it.
+//! Formats are given under C-printf form
+class IGESSelect_FloatFormat : public IGESSelect_FileModifier +{ + +public: + + //! Creates a new FloatFormat, with standard options :
+ //! ZeroSuppress, Main Format = %E,
+ //! Format between 0.001 and 1000. = %f
+ Standard_EXPORT IGESSelect_FloatFormat(); + //! Sets FloatFormat to default value (see Create) but if
+ //! is given positive, it commands Formats (main and range) to
+ //! ensure significant digits to be displayed
+ Standard_EXPORT void SetDefault(const Standard_Integer digits = 0) ; + //! Sets ZeroSuppress mode to a new value
+ Standard_EXPORT void SetZeroSuppress(const Standard_Boolean mode) ; + //! Sets Main Format to a new value
+ //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
+ //! independant
+ Standard_EXPORT void SetFormat(const Standard_CString format = "%E") ; + //! Sets Format for Range to a new value with its range of
+ //! application.
+ //! To cancel it, give format as "" (empty string)
+ //! Remark that if the condition (0. < Rmin < Rmax) is not
+ //! verified, this secondary format will be ignored.
+ //! Moreover, this secondary format is intended to be used in a
+ //! range around 1.
+ Standard_EXPORT void SetFormatForRange(const Standard_CString format = "%f",const Standard_Real Rmin = 0.1,const Standard_Real Rmax = 1000.0) ; + //! Returns all recorded parameters :
+ //! zerosup : ZeroSuppress status
+ //! mainform : Main Format (which applies out of the range, or
+ //! for every real if no range is set)
+ //! hasrange : True if a FormatInRange is set, False else
+ //! (following parameters do not apply if it is False)
+ //! forminrange : Secondary Format (it applies inside the range)
+ //! rangemin, rangemax : the range in which the secondary format
+ //! applies
+ Standard_EXPORT void Format(Standard_Boolean& zerosup,TCollection_AsciiString& mainform,Standard_Boolean& hasrange,TCollection_AsciiString& forminrange,Standard_Real& rangemin,Standard_Real& rangemax) const; + //! Sets the Floatting Formats of IGESWriter to the recorded
+ //! parameters
+ Standard_EXPORT void Perform(IFSelect_ContextWrite& ctx,IGESData_IGESWriter& writer) const; + //! Returns specific Label : for instance,
+ //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ Standard_EXPORT TCollection_AsciiString Label() const; + + DEFINE_STANDARD_RTTI(IGESSelect_FloatFormat) + +private: + + Standard_Boolean thezerosup; + TCollection_AsciiString themainform; + TCollection_AsciiString theformrange; + Standard_Real therangemin; + Standard_Real therangemax; +}; +#endif diff --git a/src/IGESSelect/IGESSelect_ModelModifier.cdl b/src/IGESSelect/IGESSelect_ModelModifier.cdl new file mode 100644 index 0000000000..fbd967c36d --- /dev/null +++ b/src/IGESSelect/IGESSelect_ModelModifier.cdl @@ -0,0 +1,57 @@ +-- Copyright (c) 1999-2012 OPEN CASCADE SAS +-- +-- The content of this file is subject to the Open CASCADE Technology Public +-- License Version 6.5 (the "License"). You may not use the content of this file +-- except in compliance with the License. Please obtain a copy of the License +-- at http://www.opencascade.org and read it completely before using this file. +-- +-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +-- +-- The Original Code and all software distributed under the License is +-- distributed on an "AS IS" basis, without warranty of any kind, and the +-- Initial Developer hereby disclaims all such warranties, including without +-- limitation, any warranties of merchantability, fitness for a particular +-- purpose or non-infringement. Please see the License for the specific terms +-- and conditions governing the rights and limitations under the License. + +deferred class ModelModifier from IGESSelect inherits Modifier from IFSelect +uses CString, + InterfaceModel, + Protocol from Interface, + Protocol from IGESData, + IGESModel from IGESData, + CopyTool from Interface, + ContextModif + +is + Initialize(mayChangeGraph : Boolean); + ---Purpose : Calls inherited Initialize, transmits to it the information + -- + + Perform (me; theContext : in out ContextModif from IFSelect; + theTarget : mutable InterfaceModel from Interface; + theProtocol : Protocol from Interface; + theCopyTool : in out CopyTool from Interface); + ---Purpose : The inherited Perform does the required cast (and refuses to + -- go further if cast has failed) then calls the instantiated + -- Performing + + PerformProtocol (me; theContext : in out ContextModif from IFSelect; + theTarget : mutable IGESModel from IGESData; + theProtocol : Protocol from IGESData; + theCopyTool : in out CopyTool from Interface) is virtual; + ---Purpose : Specific Perform with Protocol. It is defined to let the + -- Protocol unused and to call Performing without Protocol + -- (most current case). It can be redefined if specific action + -- requires Protocol. + + Performing (me; theContext : in out ContextModif from IFSelect; + theTarget : mutable IGESModel from IGESData; + theCopyTool : in out CopyTool from Interface) is deferred; + ---Purpose : Specific Perform, without Protocol. If Performing with + -- Protocol is redefined, Performing without Protocol must + -- though be defined to do nothing (not called, but demanded + -- by the linker) + +end ModelModifier; \ No newline at end of file diff --git a/src/IGESSelect/IGESSelect_ModelModifier.cxx b/src/IGESSelect/IGESSelect_ModelModifier.cxx new file mode 100644 index 0000000000..68fef3a599 --- /dev/null +++ b/src/IGESSelect/IGESSelect_ModelModifier.cxx @@ -0,0 +1,56 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include +#include +#include + + IMPLEMENT_STANDARD_HANDLE(IGESSelect_ModelModifier, IFSelect_Modifier) + IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_ModelModifier, IFSelect_Modifier) + +IGESSelect_ModelModifier::IGESSelect_ModelModifier (const Standard_Boolean mayChangeGraph) + : IFSelect_Modifier (mayChangeGraph) +{} + +void IGESSelect_ModelModifier::Perform + (IFSelect_ContextModif& theContext, + const Handle(Interface_InterfaceModel)& theTarget, + const Handle(Interface_Protocol)& theProtocol, + Interface_CopyTool& theCopyTool) const +{ + theContext.TraceModifier(this); + Handle(IGESData_IGESModel) aTarget = Handle(IGESData_IGESModel)::DownCast(theTarget); + Handle(IGESData_Protocol) aProtocol + = Handle(IGESData_Protocol)::DownCast(theProtocol); + if (aTarget.IsNull()) + { + theContext.CCheck()->AddFail("Model to Modify : unproper type"); + return; + } + PerformProtocol (theContext,aTarget,aProtocol,theCopyTool); +} + +void IGESSelect_ModelModifier::PerformProtocol + (IFSelect_ContextModif& theContext, + const Handle(IGESData_IGESModel)& theTarget, + const Handle(IGESData_Protocol)& theProtocol, + Interface_CopyTool& theCopyTool) const +{ + theContext.SetProtocol(theProtocol); + Performing (theContext,theTarget,theCopyTool); +} diff --git a/src/IGESSolid/IGESSolid.cdl b/src/IGESSolid/IGESSolid.cdl index 02b2bbd3af..afefc30723 100644 --- a/src/IGESSolid/IGESSolid.cdl +++ b/src/IGESSolid/IGESSolid.cdl @@ -23,10 +23,10 @@ uses Standard, TCollection, - TColStd, - TColgp, + TColStd, + TColgp, gp, - Message, + Message, Interface, IGESData, IGESBasic, diff --git a/src/IGESSolid/IGESSolid_Loop.cdl b/src/IGESSolid/IGESSolid_Loop.cdl index 86afff83f8..691fd2695d 100644 --- a/src/IGESSolid/IGESSolid_Loop.cdl +++ b/src/IGESSolid/IGESSolid_Loop.cdl @@ -27,10 +27,11 @@ class Loop from IGESSolid inherits IGESEntity uses - HArray1OfIGESEntity from IGESData, - HArray1OfInteger from TColStd, - HArray1OfHArray1OfInteger from IGESBasic, - HArray1OfHArray1OfIGESEntity from IGESBasic + HArray1OfIGESEntity from IGESData, + HArray1OfInteger from TColStd, + HArray1OfHArray1OfInteger from IGESBasic, + HArray1OfHArray1OfInteger_Handle from IGESBasic, + HArray1OfHArray1OfIGESEntity_Handle from IGESBasic raises DimensionMismatch, OutOfRange @@ -46,8 +47,8 @@ is index : HArray1OfInteger; orient : HArray1OfInteger; nbParameterCurves : HArray1OfInteger; - isoparametricFlags : HArray1OfHArray1OfInteger; - curves : HArray1OfHArray1OfIGESEntity from + isoparametricFlags : HArray1OfHArray1OfInteger_Handle; + curves : HArray1OfHArray1OfIGESEntity_Handle from IGESBasic) raises DimensionMismatch; ---Purpose : This method is used to set the fields of the class Loop @@ -143,10 +144,10 @@ fields theNbParameterCurves : HArray1OfInteger; -- no. of underlying parameter space curves - theIsoparametricFlags : HArray1OfHArray1OfInteger; + theIsoparametricFlags : HArray1OfHArray1OfInteger_Handle; -- Isoparametric flags of the space curves - theCurves : HArray1OfHArray1OfIGESEntity + theCurves : HArray1OfHArray1OfIGESEntity_Handle from IGESBasic; -- parameter space curves corresponding to the edges diff --git a/src/IGESToBRep/FILES b/src/IGESToBRep/FILES index 80ce3b6011..b075cc5da4 100755 --- a/src/IGESToBRep/FILES +++ b/src/IGESToBRep/FILES @@ -1 +1,5 @@ +IGESToBRep_Actor.hxx +IGESToBRep_Actor.cxx +IGESToBRep_Reader.hxx +IGESToBRep_Reader.cxx project.pxx diff --git a/src/IGESToBRep/IGESToBRep.cdl b/src/IGESToBRep/IGESToBRep.cdl index e1e9919c50..1878f06d14 100644 --- a/src/IGESToBRep/IGESToBRep.cdl +++ b/src/IGESToBRep/IGESToBRep.cdl @@ -50,8 +50,8 @@ is class BRepEntity; class IGESBoundary; - class Reader; - class Actor; + imported Reader; + imported Actor; class AlgoContainer; class ToolContainer; diff --git a/src/IGESToBRep/IGESToBRep_Actor.cdl b/src/IGESToBRep/IGESToBRep_Actor.cdl deleted file mode 100644 index bb78ea0e45..0000000000 --- a/src/IGESToBRep/IGESToBRep_Actor.cdl +++ /dev/null @@ -1,57 +0,0 @@ --- Created on: 1994-11-03 --- Created by: Marie Jose MARTZ --- Copyright (c) 1994-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 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. - -class Actor from IGESToBRep - inherits ActorOfTransientProcess from Transfer - - ---Purpose : This class performs the transfer of an Entity from - -- IGESToBRep - -- - -- I.E. for each type of Entity, it invokes the appropriate Tool - -- then returns the Binder which contains the Result - -uses TransientProcess, Binder, InterfaceModel from Interface - -is - - Create returns mutable Actor from IGESToBRep; - - SetModel (me : mutable; model : InterfaceModel from Interface); - - SetContinuity (me : mutable; continuity : Integer from Standard = 0); - ---Purpose By default continuity = 0 - -- if continuity = 1 : try C1 - -- if continuity = 2 : try C2 - - GetContinuity (me) returns Integer from Standard; - ---Purpose : Return "thecontinuity" - - Recognize (me : mutable; start : Transient) returns Boolean is redefined; - - Transfer (me : mutable; start : Transient; TP : mutable TransientProcess) - returns mutable Binder is redefined; - - UsedTolerance (me) returns Real; - ---Purpose : Returns the tolerance which was actually used, either from - -- the file or from statics - -fields - - themodel : InterfaceModel from Interface; - thecontinuity : Integer; - theeps : Real; - -end Actor; diff --git a/src/IGESToBRep/IGESToBRep_Actor.cxx b/src/IGESToBRep/IGESToBRep_Actor.cxx index f4b56a5248..c913b11a8b 100644 --- a/src/IGESToBRep/IGESToBRep_Actor.cxx +++ b/src/IGESToBRep/IGESToBRep_Actor.cxx @@ -11,7 +11,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include #include #include #include @@ -24,12 +25,11 @@ #include #include #include - +#include #include #include - #include - +#include #include #include #include @@ -37,6 +37,19 @@ #include #include +IMPLEMENT_STANDARD_TYPE(IGESToBRep_Actor) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_ActorOfTransientProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(IGESToBRep_Actor) + + +IMPLEMENT_DOWNCAST(IGESToBRep_Actor,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(IGESToBRep_Actor) + //======================================================================= //function : IGESToBRep_Actor //purpose : diff --git a/src/IGESToBRep/IGESToBRep_Actor.hxx b/src/IGESToBRep/IGESToBRep_Actor.hxx new file mode 100644 index 0000000000..878783dd1b --- /dev/null +++ b/src/IGESToBRep/IGESToBRep_Actor.hxx @@ -0,0 +1,83 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESToBRep_Actor_HeaderFile +#define _IGESToBRep_Actor_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceModel; +class Standard_Transient; +class Transfer_Binder; +class Transfer_TransientProcess; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_ActorOfTransientProcess); +class IGESToBRep_Actor; + +DEFINE_STANDARD_HANDLE(IGESToBRep_Actor,Transfer_ActorOfTransientProcess) + +//! This class performs the transfer of an Entity from
+//! IGESToBRep
+//!
+//! I.E. for each type of Entity, it invokes the appropriate Tool
+//! then returns the Binder which contains the Result
+class IGESToBRep_Actor : public Transfer_ActorOfTransientProcess { + +public: + + Standard_EXPORT IGESToBRep_Actor(); + + Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model) ; + //!---Purpose By default continuity = 0
+ //! if continuity = 1 : try C1
+ //! if continuity = 2 : try C2
+ Standard_EXPORT void SetContinuity(const Standard_Integer continuity = 0); + + //! Return "thecontinuity"
+ Standard_EXPORT Standard_Integer GetContinuity() const; + + Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Standard_Transient)& start); + + Standard_EXPORT virtual Handle_Transfer_Binder Transfer(const Handle(Standard_Transient)& start, + const Handle(Transfer_TransientProcess)& TP); + + //! Returns the tolerance which was actually used, either from
+ //! the file or from statics
+ Standard_EXPORT Standard_Real UsedTolerance() const; + + DEFINE_STANDARD_RTTI(IGESToBRep_Actor) + +private: + + +Handle_Interface_InterfaceModel themodel; +Standard_Integer thecontinuity; +Standard_Real theeps; + + +}; +#endif diff --git a/src/IGESToBRep/IGESToBRep_CurveAndSurface.cdl b/src/IGESToBRep/IGESToBRep_CurveAndSurface.cdl index d0b18f7f8d..ec794ab35b 100644 --- a/src/IGESToBRep/IGESToBRep_CurveAndSurface.cdl +++ b/src/IGESToBRep/IGESToBRep_CurveAndSurface.cdl @@ -27,7 +27,7 @@ uses IGESEntity from IGESData, IGESModel from IGESData, CString from Standard, - TransientProcess from Transfer, + TransientProcess_Handle from Transfer, Surface from Geom, Msg from Message is @@ -155,11 +155,11 @@ is ---C++: inline ---Purpose: Returns the value of "myContinuity" - SetTransferProcess(me: in out; TP: TransientProcess from Transfer); + SetTransferProcess(me: in out; TP: TransientProcess_Handle from Transfer); ---C++: inline ---Purpose: Set the value of "myMsgReg" - GetTransferProcess(me) returns TransientProcess from Transfer; + GetTransferProcess(me) returns TransientProcess_Handle from Transfer; ---C++: inline ---Purpose: Returns the value of "myMsgReg" @@ -240,6 +240,6 @@ fields myModel : IGESModel from IGESData ; - myTP : TransientProcess from Transfer; + myTP : TransientProcess_Handle from Transfer; end CurveAndSurface; diff --git a/src/IGESToBRep/IGESToBRep_Reader.cdl b/src/IGESToBRep/IGESToBRep_Reader.cdl deleted file mode 100644 index eaf8e4fccf..0000000000 --- a/src/IGESToBRep/IGESToBRep_Reader.cdl +++ /dev/null @@ -1,108 +0,0 @@ --- Created on: 1994-09-01 --- Created by: Marie Jose MARTZ --- Copyright (c) 1994-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 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. - -class Reader from IGESToBRep - - ---Purpose : A simple way to read geometric IGES data. - -- Encapsulates reading file and calling transfer tools - -uses - IGESModel from IGESData, - ShareFlags from Interface, - TransientProcess from Transfer, - Shape from TopoDS, - SequenceOfShape from TopTools, - Actor from IGESToBRep - -is - - Create returns Reader; - ---Purpose : Creates a Reader - - LoadFile (me : in out; filename : CString) returns Integer; - ---Purpose : Loads a Model from a file.Returns 0 if success. - -- returns 1 if the file could not be opened, - -- returns -1 if an error occurred while the file was being loaded. - - SetModel (me : in out; model : IGESModel); - ---Purpose : Specifies a Model to work on - -- Also clears the result and Done status, sets TransientProcess - - Model (me) returns IGESModel; - ---Purpose : Returns the Model to be worked on. - - SetTransientProcess (me : in out; TP : mutable TransientProcess); - ---Purpose : Allows to set an already defined TransientProcess - -- (to be called after LoadFile or SetModel) - - TransientProcess (me) returns TransientProcess; - ---Purpose : Returns the TransientProcess - - Actor (me) returns Actor from IGESToBRep; - ---Purpose : Returns "theActor" - - Clear (me : in out); - ---Purpose : Clears the results between two translation operations. - - Check (me; withprint : Boolean) returns Boolean; - ---Purpose : Checks the IGES file that was --- loaded into memory. Displays error messages in the default --- message file if withprint is true. Returns True if no fail --- message was found and False if there was at least one fail message. - - TransferRoots (me : in out; onlyvisible : Boolean = Standard_True); - ---Purpose : Translates root entities in an --- IGES file. Standard_True is the default value and means that only --- visible root entities are translated. Standard_False --- translates all of the roots (visible and invisible). - - Transfer (me : in out; num : Integer) returns Boolean; - ---Purpose : Transfers an Entity given its rank in the Model (Root or not) - -- Returns True if it is recognized as Geom-Topol. - -- (But it can have failed : see IsDone) - - IsDone (me) returns Boolean; - ---Purpose : Returns True if the LAST Transfer/TransferRoots was a success - - UsedTolerance (me) returns Real; - ---Purpose : Returns the Tolerance which has been actually used, converted - -- in millimeters - -- (either that from File or that from Session, according the mode) - - NbShapes (me) returns Integer; - ---Purpose : Returns the number of shapes produced by the translation. - - Shape (me; num : Integer = 1) returns Shape from TopoDS; - ---Purpose : Returns the num the resulting shape in a translation operation. - - OneShape (me) returns Shape from TopoDS; - ---Purpose : Returns all of the results in a --- single shape which is: --- - a null shape if there are no results, --- - a shape if there is one result, --- - a compound containing the resulting shapes if there are several. - - - -fields - - theModel : IGESModel from IGESData; - theDone : Boolean; - theShapes : SequenceOfShape from TopTools; - theActor : Actor from IGESToBRep; - theProc : TransientProcess from Transfer; - -end Reader; diff --git a/src/IGESToBRep/IGESToBRep_Reader.cxx b/src/IGESToBRep/IGESToBRep_Reader.cxx index 9ce1a53fb8..7c7796ffe0 100644 --- a/src/IGESToBRep/IGESToBRep_Reader.cxx +++ b/src/IGESToBRep/IGESToBRep_Reader.cxx @@ -15,23 +15,19 @@ //#70 rln 03.03.99 syntax correction // sln 11.06.2002 OCC448 : Initialize "read.onlyvisiable" parameter to control transfering invisiable sub entities which logicaly depend on the grouping entities #include -#include +#include #include #include #include - #include - #include #include #include #include #include #include - #include #include - #include #include #include @@ -40,22 +36,17 @@ #include #include #include - #include #include #include #include #include #include - #include #include #include - -//#include #include #include - #include #include #include @@ -63,10 +54,10 @@ #include #include #include - #include #include #include +#include #ifdef WNT #include diff --git a/src/IGESToBRep/IGESToBRep_Reader.hxx b/src/IGESToBRep/IGESToBRep_Reader.hxx new file mode 100644 index 0000000000..eb4dcb5551 --- /dev/null +++ b/src/IGESToBRep/IGESToBRep_Reader.hxx @@ -0,0 +1,120 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _IGESToBRep_Reader_HeaderFile +#define _IGESToBRep_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class IGESData_IGESModel; +class TopoDS_Shape; + + +//! A simple way to read geometric IGES data.
+//! Encapsulates reading file and calling transfer tools
+class IGESToBRep_Reader +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a Reader
+ Standard_EXPORT IGESToBRep_Reader(); + + //! Loads a Model from a file.Returns 0 if success.
+ //! returns 1 if the file could not be opened,
+ //! returns -1 if an error occurred while the file was being loaded.
+ Standard_EXPORT Standard_Integer LoadFile(const Standard_CString filename); + + //! Specifies a Model to work on
+ //! Also clears the result and Done status, sets TransientProcess
+ Standard_EXPORT void SetModel(const Handle(IGESData_IGESModel)& model); + + //! Returns the Model to be worked on.
+ Standard_EXPORT Handle(IGESData_IGESModel) Model() const; + + //! Allows to set an already defined TransientProcess
+//! (to be called after LoadFile or SetModel)
+ Standard_EXPORT void SetTransientProcess(const Handle(Transfer_TransientProcess)& TP); + + //! Returns the TransientProcess
+ Standard_EXPORT Transfer_TransientProcess_Handle TransientProcess() const; + + //! Returns "theActor"
+ Standard_EXPORT Handle(IGESToBRep_Actor) Actor() const; + + //! Clears the results between two translation operations.
+ Standard_EXPORT void Clear(); + + //! Checks the IGES file that was
+ //! loaded into memory. Displays error messages in the default
+ //! message file if withprint is true. Returns True if no fail
+ //! message was found and False if there was at least one fail message.
+ Standard_EXPORT Standard_Boolean Check(const Standard_Boolean withprint) const; + + //! Translates root entities in an
+ //! IGES file. Standard_True is the default value and means that only
+ //! visible root entities are translated. Standard_False
+ //! translates all of the roots (visible and invisible).
+ Standard_EXPORT void TransferRoots(const Standard_Boolean onlyvisible = Standard_True); + + //! Transfers an Entity given its rank in the Model (Root or not)
+ //! Returns True if it is recognized as Geom-Topol.
+ //! (But it can have failed : see IsDone)
+ Standard_EXPORT Standard_Boolean Transfer(const Standard_Integer num); + + //! Returns True if the LAST Transfer/TransferRoots was a success
+ Standard_EXPORT Standard_Boolean IsDone() const; + + //! Returns the Tolerance which has been actually used, converted
+ //! in millimeters
+ //! (either that from File or that from Session, according the mode)
+ Standard_EXPORT Standard_Real UsedTolerance() const; + + //! Returns the number of shapes produced by the translation.
+ Standard_EXPORT Standard_Integer NbShapes() const; + + //! Returns the num the resulting shape in a translation operation.
+ Standard_EXPORT TopoDS_Shape Shape(const Standard_Integer num = 1) const; + + //! Returns all of the results in a
+ //! single shape which is:
+ //! - a null shape if there are no results,
+ //! - a shape if there is one result,
+ //! - a compound containing the resulting shapes if there are several.
+ Standard_EXPORT TopoDS_Shape OneShape() const; + +private: + + Handle(IGESData_IGESModel) theModel; + Standard_Boolean theDone; + TopTools_SequenceOfShape theShapes; + Handle(IGESToBRep_Actor) theActor; + Handle(Transfer_TransientProcess) theProc; + +}; +#endif diff --git a/src/Interface/FILES b/src/Interface/FILES index eace684367..99c506080f 100755 --- a/src/Interface/FILES +++ b/src/Interface/FILES @@ -7,3 +7,9 @@ Interface_Translates.hxx Interface_StaticStandards.cxx Interface_Version.hxx Interface_VectorOfFileParameter.hxx +Interface_JaggedArray.hxx +Interface_Recognizer.hxx +Interface_ReaderLib.hxx +Interface_ReaderLib.cxx +Interface_GeneralLib.hxx +Interface_GeneralLib.cxx diff --git a/src/Interface/Interface.cdl b/src/Interface/Interface.cdl index f4c67c5cea..ce06bbe9a9 100644 --- a/src/Interface/Interface.cdl +++ b/src/Interface/Interface.cdl @@ -34,7 +34,7 @@ is class EntityList; -- for an (ordered) little list of Entities private class EntityCluster; -- ancillary class for the former - generic class JaggedArray; -- to turn arround limitation on Array(Array) + imported JaggedArray; -- to turn arround limitation on Array(Array) -- -- Auxiliary Classes (results, working data) -- -- @@ -54,8 +54,7 @@ is deferred class Protocol; -- manages also Active Protocol deferred class GeneralModule; -- (Shareds,Check,Copy,Trace) - class GeneralLib instantiates Library from LibCtl - (Transient, GeneralModule, Protocol from Interface); + imported GeneralLib; class GTool; @@ -81,13 +80,12 @@ is imported StaticSatisfies; -- Function to be added to a Static for specific Satisfies - deferred generic class Recognizer; -- aimed to create Interface Entities + imported Recognizer; -- aimed to create Interface Entities -- -- File Access (Read & Write) -- -- deferred class ReaderModule; - class ReaderLib instantiates Library from LibCtl - (Transient, ReaderModule, Protocol from Interface); + imported ReaderLib; imported VectorOfFileParameter; class FileParameter; diff --git a/src/Interface/Interface_GeneralLib.cxx b/src/Interface/Interface_GeneralLib.cxx new file mode 100644 index 0000000000..bb00340736 --- /dev/null +++ b/src/Interface/Interface_GeneralLib.cxx @@ -0,0 +1,30 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +typedef LibCtl_GlobalNode + Interface_GlobalNodeOfGeneralLib; + +template<> +Standard_EXPORT NCollection_Handle< Interface_GlobalNodeOfGeneralLib >& +Interface_GeneralLib::GetGlobal() +{ + static NCollection_Handle< Interface_GlobalNodeOfGeneralLib > aGlobal; + return aGlobal; +} diff --git a/src/Interface/Interface_GeneralLib.hxx b/src/Interface/Interface_GeneralLib.hxx new file mode 100644 index 0000000000..18fafd99d6 --- /dev/null +++ b/src/Interface/Interface_GeneralLib.hxx @@ -0,0 +1,45 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Interface_GeneralLib_HeaderFile +#define _Interface_GeneralLib_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class Standard_NoSuchObject; +class Standard_Transient; +class Interface_GeneralModule; +class Interface_Protocol; + +typedef LibCtl_Library + Interface_GeneralLib; + +#endif diff --git a/src/Interface/Interface_JaggedArray.cdl b/src/Interface/Interface_JaggedArray.cdl deleted file mode 100644 index f5c6d38392..0000000000 --- a/src/Interface/Interface_JaggedArray.cdl +++ /dev/null @@ -1,47 +0,0 @@ --- Created on: 1995-05-30 --- Created by: Christian CAILLET --- 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 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. - -generic class JaggedArray from Interface - (TheKey as TShared) - inherits TShared - - ---Purpose : This class allows to define an HArray1 Of HArray1 ... - -- which is not possible with the actual system of - -- genericity supported by CasCade - -uses Array1OfTransient - -is - - Create (low, up : Integer) returns mutable JaggedArray; - - Lower (me) returns Integer; - Upper (me) returns Integer; - Length (me) returns Integer; - - SetValue (me : mutable; num : Integer; val : any TheKey); - - Value (me; num : Integer) returns any TheKey; - -- C++ : return const & (NO , DownCast required) - --- ChangeValue (me : mutable; num : Integer) returns any TheKey; - -- C++ : return & (NO , DownCast required !) - -fields - - thelist : Array1OfTransient; - -end JaggedArray; diff --git a/src/Interface/Interface_JaggedArray.gxx b/src/Interface/Interface_JaggedArray.gxx deleted file mode 100644 index 08ee3d123d..0000000000 --- a/src/Interface/Interface_JaggedArray.gxx +++ /dev/null @@ -1,39 +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 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 - -Interface_JaggedArray::Interface_JaggedArray - (const Standard_Integer low, const Standard_Integer up) -: thelist (low,up) { Handle(Standard_Transient) nulo; thelist.Init(nulo); } - - Standard_Integer Interface_JaggedArray::Lower () const - { return thelist.Lower(); } - - Standard_Integer Interface_JaggedArray::Upper () const - { return thelist.Upper(); } - - Standard_Integer Interface_JaggedArray::Length () const - { return thelist.Length(); } - - void Interface_JaggedArray::SetValue - (const Standard_Integer num, const Handle(TheKey)& val) - { thelist.SetValue(num,val); } - - Handle(TheKey) Interface_JaggedArray::Value - (const Standard_Integer num) const - { return Handle(TheKey)::DownCast(thelist.Value(num)); } - -// Handle(TheKey)& Interface_JaggedArray::ChangeValue -// (const Standard_Integer num) -// { return thelist.ChangeValue(num); } diff --git a/src/Interface/Interface_JaggedArray.hxx b/src/Interface/Interface_JaggedArray.hxx new file mode 100644 index 0000000000..60b5a7c442 --- /dev/null +++ b/src/Interface/Interface_JaggedArray.hxx @@ -0,0 +1,64 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Interface_JaggedArray_H__ +#define _Interface_JaggedArray_H__ + +#include +#include + +template +class Interface_JaggedArray: public MMgt_TShared +{ +private: + NCollection_Array1 myList; +public: + Standard_EXPORT Interface_JaggedArray (const Standard_Integer theLowerIndex, + const Standard_Integer theUpperIndex) + : myList (theLowerIndex, theUpperIndex) + { + Handle(Standard_Transient) aNullObj; + myList.Init(aNullObj); + } + + Standard_EXPORT Standard_Integer Lower() const + { + return myList.Lower(); + } + + Standard_EXPORT Standard_Integer Upper() const + { + return myList.Upper(); + } + + Standard_EXPORT Standard_Integer Length() const + { + return myList.Length(); + } + + Standard_EXPORT void SetValue (const Standard_Integer theNum, + const KeyType& theVal) + { + myList.SetValue(theNum, theVal); + } + + Standard_EXPORT KeyType Value (const Standard_Integer theNum) const + { + return KeyType::DownCast(myList.Value(theNum)); + } +}; +#endif \ No newline at end of file diff --git a/src/Interface/Interface_ReaderLib.cxx b/src/Interface/Interface_ReaderLib.cxx new file mode 100644 index 0000000000..f047924c29 --- /dev/null +++ b/src/Interface/Interface_ReaderLib.cxx @@ -0,0 +1,30 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +typedef LibCtl_GlobalNode + Interface_GlobalNodeOfReaderLib; + +template<> +Standard_EXPORT NCollection_Handle< Interface_GlobalNodeOfReaderLib >& +Interface_ReaderLib::GetGlobal() +{ + static NCollection_Handle< Interface_GlobalNodeOfReaderLib > aGlobal; + return aGlobal; +} diff --git a/src/Interface/Interface_ReaderLib.hxx b/src/Interface/Interface_ReaderLib.hxx new file mode 100644 index 0000000000..61bd0f5826 --- /dev/null +++ b/src/Interface/Interface_ReaderLib.hxx @@ -0,0 +1,41 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Interface_ReaderLib_HeaderFile +#define _Interface_ReaderLib_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_ReaderModule; +class Interface_Protocol; +class Standard_NoSuchObject; + +typedef LibCtl_Library + Interface_ReaderLib; + +#endif \ No newline at end of file diff --git a/src/Interface/Interface_Recognizer.cdl b/src/Interface/Interface_Recognizer.cdl deleted file mode 100644 index 80dfc0b5e1..0000000000 --- a/src/Interface/Interface_Recognizer.cdl +++ /dev/null @@ -1,79 +0,0 @@ --- Created on: 1992-02-03 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -deferred generic class Recognizer from Interface - (TheKey as any; - TheResul as Transient) - inherits Transient - - ---Purpose : Defines a correspondance between an object to be recognized, - -- of type (Kind) TheKey, and a result of the recognition. There - -- can be no correspondance. When an object is recognized, the - -- returned result is empty : a Recognizer is not aimed to make - -- a transfer but to initiate it by giving a correspondant - -- - -- A Recognizer can be compound, that is, in addition to its own - -- Eval method if this one has failed, it can ask another - -- Recognizer to work, and so on : See method Add - -raises NoSuchObject - - -is - - Initialize; - ---Purpose : Assumes that no result has yet been recognized - - Evaluate (me : mutable; akey : TheKey; res : out mutable TheResul) - returns Boolean; - ---Purpose : Evaluates if recognition has a result, returns it if yes - -- In case of success, Returns True and puts result in "res" - -- In case of Failure, simply Returns False - -- Works by calling deferred method Eval, and in case of failure, - -- looks for Added Recognizers to work - - Result (me) returns mutable TheResul raises NoSuchObject; - ---Purpose : Returns result of last recognition (call of Evaluate) - - Add (me : mutable; reco : mutable Recognizer); - ---Purpose : Adds a new Recognizer to the Compound, at the end - -- Several calls to Add work by adding in the order of calls : - -- Hence, when Eval has failed to recognize, Evaluate will call - -- Evaluate from the first added Recognizer if there is one, - -- and to the second if there is still no result, and so on - - SetOK (me : mutable; aresult : mutable TheResul) is protected; - ---Purpose : Records the result of the recognition. Called by specific - -- method Eval to record a result : after calling it, Eval has - -- finished and can return - - SetKO (me : mutable) is protected; - ---Purpose : Records that recognition gives no result - - Eval (me : mutable; akey : TheKey) is deferred protected; - ---Purpose : THIS METHOD DEFINES THE RECOGNITION PROTOCOL, it is proper to - -- each precise type of Recognizer - -- For a suitable type of akey, it calls SetOK(result) where - -- result is an empty result of appropriate type, then returns - -fields - - theres : TheResul; -- storing result of last evaluation - - hasnext : Boolean; - thenext : Recognizer; -- managing compound definition - -end Recognizer; diff --git a/src/Interface/Interface_Recognizer.gxx b/src/Interface/Interface_Recognizer.gxx deleted file mode 100644 index 17d341c931..0000000000 --- a/src/Interface/Interface_Recognizer.gxx +++ /dev/null @@ -1,61 +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 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 - -// ATTENTION : TransRecognizer a exactement le meme code ... -// Mais produit un Transient au lieu d un Persistent - -// Principe : a un objet de depart (cle), un Recognizer tente d'associer un -// resultat. La classe Recognizer offre le mecanisme general gerant cela -// Chaque classe particuliere (une fois definie l'instanciation) doit fournir -// une methode specifique Eval, qui opere la correspondance -// Eval considere l'objet par tous moyens appropries, et en cas de succes, -// appelle SetOK(result) puis sort (return) -// en cas d'echec, suite au retour d'Eval, Recognizer sait que SetOK n'a pas -// ete appele - -Interface_Recognizer::Interface_Recognizer () - { hasnext = Standard_False; } - //thekey.Nullify(); inutile, fait par le constructeur ... - - Standard_Boolean Interface_Recognizer::Evaluate - (const TheKey& akey, Handle(TheResul)& res) -{ - theres.Nullify(); - Eval(akey); - if (!theres.IsNull()) { - res = theres; - return Standard_True; - } - else if (hasnext) return thenext->Evaluate(akey,res); - return Standard_False; -} - - Handle(TheResul) Interface_Recognizer::Result () const -{ - if (!theres.IsNull()) return theres; - if (hasnext) return thenext->Result(); - Standard_NoSuchObject::Raise ("Recognizer evaluation has failed"); - return theres; // pour calmer le compilateur -} - - void Interface_Recognizer::Add (const Handle(Interface_Recognizer)& reco) - { thenext = reco; hasnext = Standard_True; } - - void Interface_Recognizer::SetOK (const Handle(TheResul)& aresult) - { theres = aresult; } - - void Interface_Recognizer::SetKO () - { theres.Nullify(); } diff --git a/src/Interface/Interface_Recognizer.hxx b/src/Interface/Interface_Recognizer.hxx new file mode 100644 index 0000000000..370b37ccbf --- /dev/null +++ b/src/Interface/Interface_Recognizer.hxx @@ -0,0 +1,85 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Interface_Recognizer_HeaderFile +#define _Interface_Recognizer_HeaderFile + +#include +#include + + +template +class Interface_Recognizer : public Standard_Transient +{ +private: + // Storing result of last evaluation + ResultType myRes; + +protected: + Standard_Boolean myHasNext; + + // Managing compound definition + HandleType myNext; + +public: + + Standard_EXPORT Standard_Boolean Evaluate (const KeyType& theKey, + ResultType& theRes) + { + myRes.Nullify(); + Eval(theKey); + if (!myRes.IsNull()) + { + theRes = myRes; + return Standard_True; + } + else if (myHasNext) return myNext->Evaluate(theKey, theRes); + return Standard_False; + } + + Standard_EXPORT ResultType Result () const + { + if (!myRes.IsNull()) return myRes; + if (myHasNext) return myNext->Result(); + Standard_NoSuchObject::Raise ("Recognizer evaluation has failed"); + return myRes; + } + + Standard_EXPORT void Add (const HandleType& theRecognizer) + { + myNext = theRecognizer; + myHasNext = Standard_True; + } +protected: + + Standard_EXPORT Interface_Recognizer () + { + myHasNext = Standard_False; + } + + Standard_EXPORT void SetOK (const ResultType& theResult) + { + myRes = theResult; + } + Standard_EXPORT void SetKO () + { + myRes.Nullify(); + } + Standard_EXPORT virtual void Eval(const KeyType& akey) = 0; +}; + +#endif \ No newline at end of file diff --git a/src/LibCtl/FILES b/src/LibCtl/FILES index ec94df1763..45edba67bc 100755 --- a/src/LibCtl/FILES +++ b/src/LibCtl/FILES @@ -1,6 +1,4 @@ LibCtl.cdl -LibCtl_GlobalNode.gxx -LibCtl_Library.cdl -LibCtl_Library.gxx -LibCtl_Node.gxx -LibCtl_ProtocolTemplate.cdl +LibCtl_Library.hxx + + diff --git a/src/LibCtl/LibCtl.cdl b/src/LibCtl/LibCtl.cdl index 7c8e4fcfff..69a323f080 100644 --- a/src/LibCtl/LibCtl.cdl +++ b/src/LibCtl/LibCtl.cdl @@ -79,7 +79,6 @@ uses MMgt, Standard is - generic class Library,GlobalNode,Node; - deferred generic class ProtocolTemplate; -- take it as a Template + imported Library; end LibCtl; diff --git a/src/LibCtl/LibCtl_GlobalNode.gxx b/src/LibCtl/LibCtl_GlobalNode.gxx deleted file mode 100644 index e62befecae..0000000000 --- a/src/LibCtl/LibCtl_GlobalNode.gxx +++ /dev/null @@ -1,48 +0,0 @@ -// 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 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 - -// Classe generique imbriquee dans Library : utilisee pour construire les -// listes globales de Modules attaches a une classe instanciee de Library -// (cf Library pour plus de details) - - -LibCtl_GlobalNode::LibCtl_GlobalNode () { } - -// ATTENTION, Add agit en substitution : pour un Protocol donne, c est le -// dernier appel qui l emporte - void LibCtl_GlobalNode::Add - (const Handle(TheModule)& amodule, const Handle(TheProtocol)& aprotocol) -{ - if (themod == amodule) return; - if (theprot == aprotocol) themod = amodule; - else if (thenext.IsNull()) { - if (themod.IsNull()) { themod = amodule; theprot = aprotocol; } - else { - thenext = new LibCtl_GlobalNode; - thenext->Add (amodule,aprotocol); - } - } - else thenext->Add (amodule,aprotocol); -} - - const Handle(TheModule)& LibCtl_GlobalNode::Module () const - { return themod; } - - const Handle(TheProtocol)& LibCtl_GlobalNode::Protocol () const - { return theprot; } - - const Handle(LibCtl_GlobalNode)& LibCtl_GlobalNode::Next () const - { return thenext; } diff --git a/src/LibCtl/LibCtl_Library.cdl b/src/LibCtl/LibCtl_Library.cdl deleted file mode 100644 index 60747c9682..0000000000 --- a/src/LibCtl/LibCtl_Library.cdl +++ /dev/null @@ -1,188 +0,0 @@ --- Created on: 1993-01-29 --- Created by: Christian CAILLET --- Copyright (c) 1993-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 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. - -generic class Library from LibCtl - (TheObject as any; - TheModule as Transient; - TheProtocol as Transient) -- must comply with Protocol template - - ---Purpose : Manages a list of Execution Modules attached to Protocols - -- to perform a specific set of functionnalities. - -- - -- Each instantiated class of Library has a global set a Modules. - -- These Modules are put in this set before working, for instance - -- by static construction (using method SetGlobal). One Module - -- is bound which each Protocol (considered as a class). - -- - -- To work, a Library is created by taking the Modules which - -- comply with a Protocol (bound with its class and the classes - -- of its Resources), given as parameter of its creation. - -- - -- Thus, any tool can use it to get the suitable Modules - ---Warning : The order of the Modules in the Library has assumed to be - -- useless, and is not managed. - -raises NoSuchObject - - -- -- Nested class : Node of Module -- -- - - private class GlobalNode inherits Transient - ---Purpose : Manages a (possibly static) Global List of Modules bound to - -- Protocols. - -- Remark that it requires independance from Memory Management - -- (because a Global List of Modules can be build through static - -- declarations, i.e. before any sequential execution) - -- Remark there will not be many many GlobalNodes created - - is - - Create returns mutable GlobalNode; - ---Purpose : Creates an empty GlobalNode, with no Next - - Add (me : mutable; amodule : TheModule; aprotocol : TheProtocol) - is static; - ---Purpose : Adds a Module bound with a Protocol to the list : does - -- nothing if already in the list, THAT IS, Same Type (exact - -- match) and Same State (that is, IsEqual is not required) - -- Once added, stores its attached Protocol in correspondance - - Module (me) returns any TheModule is static; - ---Purpose : Returns the Module stored in a given GlobalNode - ---C++ : return const & - - Protocol (me) returns any TheProtocol is static; - ---Purpose : Returns the attached Protocol stored in a given GlobalNode - ---C++ : return const & - - Next (me) returns any GlobalNode is static; - ---Purpose : Returns the Next GlobalNode. If none is defined, returned - -- value is a Null Handle - ---C++ : return const & - - fields - - themod : TheModule; - theprot : TheProtocol; - thenext : GlobalNode; - - end GlobalNode; - - - private class Node inherits TShared - - ---Purpose : Manages a list of Modules for a Library (as an instance) : - -- Designates a GlobalNode (couple Module-Protocol) - - is - - Create returns mutable Node; - ---Purpose : Creates an empty Node, with no Next - - AddNode (me : mutable; anode : any GlobalNode) is static; - ---Purpose : Adds a couple (Module,Protocol), that is, stores it into - -- itself if not yet done, else creates a Next Node to do it - - Module (me) returns any TheModule is static; - ---Purpose : Returns the Module designated by a precise Node - ---C++ : return const & - - Protocol (me) returns any TheProtocol is static; - ---Purpose : Returns the Protocol designated by a precise Node - ---C++ : return const & - - Next (me) returns mutable Node is static; - ---Purpose : Returns the Next Node. If none was defined, returned value - -- is a Null Handle - ---C++ : return const & - - fields - - thenode : GlobalNode; - thenext : Node; - - end Node; - - -is - - SetGlobal (myclass; amodule : TheModule; aprotocol : TheProtocol); - ---Purpose : Adds a couple (Module-Protocol) into the global definition set - -- for this class of Library. - - Create (aprotocol : TheProtocol) returns Library; - ---Purpose : Creates a Library which complies with a Protocol, that is : - -- Same class (criterium IsInstance) - -- This creation gets the Modules from the global set, those - -- which are bound to the given Protocol and its Resources - - Create returns Library; - ---Purpose : Creates an empty Library : it will later by filled by method - -- AddProtocol - - AddProtocol (me : in out; aprotocol : Transient) is static; - ---Purpose : Adds a couple (Module-Protocol) to the Library, given the - -- class of a Protocol. Takes Resources into account. - -- (if is not of type TheProtocol, it is not added) - - Clear (me : in out) is static; - ---Purpose : Clears the list of Modules of a library (can be used to - -- redefine the order of Modules before action : Clear then - -- refill the Library by calls to AddProtocol) - - SetComplete (me : in out); - ---Purpose : Sets a library to be defined with the complete Global list - -- (all the couples Protocol/Modules recorded in it) - - - Select (me; obj : any TheObject; module : out any TheModule; CN : out Integer) - returns Boolean; - ---Purpose : Selects a Module from the Library, given an Object. - -- Returns True if Select has succeeded, False else. - -- Also Returns (as arguments) the selected Module and the Case - -- Number determined by the associated Protocol. - -- If Select has failed, is Null Handle and CN is zero. - -- (Select can work on any criterium, such as Object DynamicType) - - - Start (me : in out) is static; - ---Purpose : Starts Iteration on the Modules (sets it on the first one) - - More (me) returns Boolean is static; - ---Purpose : Returns True if there are more Modules to iterate on - - Next (me : in out) is static; - ---Purpose : Iterates by getting the next Module in the list - -- If there is none, the exception will be raised by Value - - Module (me) returns any TheModule - ---Purpose : Returns the current Module in the Iteration - raises NoSuchObject is static; - -- Error if there is no current Module to iterate on - ---C++ : return const & - - Protocol (me) returns any TheProtocol - ---Purpose : Returns the current Protocol in the Iteration - raises NoSuchObject is static; - -- Error if there is no current Protocol to iterate on - ---C++ : return const & - -fields - - thelist : Node; - thecurr : Node; -- for iteration - -- there are also "class variables" which describe global set - -end Library; diff --git a/src/LibCtl/LibCtl_Library.gxx b/src/LibCtl/LibCtl_Library.gxx deleted file mode 100644 index a24e7663a4..0000000000 --- a/src/LibCtl/LibCtl_Library.gxx +++ /dev/null @@ -1,157 +0,0 @@ -// 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 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 - - -// Liste Globale des Modules, dans laquelle on va se servir - -static Handle(LibCtl_GlobalNode) theglobal; - -// Donnees pour optimisation (dernier Protocole demande) - -static Handle(TheProtocol) theprotocol; -static Handle(LibCtl_Node) thelast; - - -// Alimentation de la liste globale -// ATTENTION : SetGlobal fait de la substitution, c-a-d que c est le dernier -// qui a raison pour un Protocol donne - void LibCtl_Library::SetGlobal - (const Handle(TheModule)& amodule, const Handle(TheProtocol)& aprotocol) -{ - if (theglobal.IsNull()) theglobal = new LibCtl_GlobalNode; - theglobal->Add(amodule,aprotocol); -} - -// Constructeur d apres Protocole - LibCtl_Library::LibCtl_Library (const Handle(TheProtocol)& aprotocol) -{ - Standard_Boolean last = Standard_False; - if (aprotocol.IsNull()) return; // PAS de protocole = Lib VIDE - if (!theprotocol.IsNull()) last = - (theprotocol == aprotocol); - - if (last) thelist = thelast; -// Si Pas d optimisation disponible : construire la liste - else { - AddProtocol(aprotocol); -// Ceci definit l optimisation (pour la fois suivante) - thelast = thelist; - theprotocol = aprotocol; - } -} - -// Constructeur vide - LibCtl_Library::LibCtl_Library () { } - - -// Ajout d un Protocol : attention, desoptimise (sinon risque de confusion !) - void LibCtl_Library::AddProtocol - (const Handle(Standard_Transient)& aprotocol) -{ -// DownCast car Protocol->Resources, meme redefini et utilise dans d autres -// librairies, doit toujours renvoyer le type le plus haut - Handle(TheProtocol) aproto = Handle(TheProtocol)::DownCast(aprotocol); - if (aproto.IsNull()) return; - -// D abord, ajouter celui-ci a la liste : chercher le Node - Handle(LibCtl_GlobalNode) curr; - for (curr = theglobal; !curr.IsNull(); ) { // curr->Next : plus loin - const Handle(TheProtocol)& protocol = curr->Protocol(); - if (!protocol.IsNull()) { -// Match Protocol ? - if (protocol->DynamicType() == aprotocol->DynamicType()) { - if (thelist.IsNull()) thelist = new LibCtl_Node; - thelist->AddNode(curr); - break; // UN SEUL MODULE PAR PROTOCOLE - } - } - curr = curr->Next(); // cette formule est refusee dans "for" - } -// Ensuite, Traiter les ressources - Standard_Integer nb = aproto->NbResources(); - for (Standard_Integer i = 1; i <= nb; i ++) { - AddProtocol (aproto->Resource(i)); - } -// Ne pas oublier de desoptimiser - theprotocol.Nullify(); - thelast.Nullify(); -} - - void LibCtl_Library::Clear () - { thelist = new LibCtl_Node; } - - void LibCtl_Library::SetComplete () -{ - thelist = new LibCtl_Node; -// On prend chacun des Protocoles de la Liste Globale et on l ajoute - Handle(LibCtl_GlobalNode) curr; - for (curr = theglobal; !curr.IsNull(); ) { // curr->Next : plus loin - const Handle(TheProtocol)& protocol = curr->Protocol(); -// Comme on prend tout tout tout, on ne se preoccupe pas des Ressources ! - if (!protocol.IsNull()) thelist->AddNode(curr); - curr = curr->Next(); // cette formule est refusee dans "for" - } -} - - -// Selection : Tres fort, on retourne le Module correspondant a un Type -// (ainsi que le CaseNumber retourne par le protocole correspondant) - - Standard_Boolean LibCtl_Library::Select - (const TheObject& obj, - Handle(TheModule)& module, Standard_Integer& CN) const -{ - module.Nullify(); CN = 0; // Reponse "pas trouve" - if (thelist.IsNull()) return Standard_False; - Handle(LibCtl_Node) curr = thelist; - for (curr = thelist; !curr.IsNull(); ) { // curr->Next : plus loin - const Handle(TheProtocol)& protocol = curr->Protocol(); - if (!protocol.IsNull()) { - CN = protocol->CaseNumber(obj); - if (CN > 0) { - module = curr->Module(); - return Standard_True; - } - } - curr = curr->Next(); // cette formule est refusee dans "for" - } - return Standard_False; // ici, pas trouce -} - - -// .... Iteration .... - - void LibCtl_Library::Start () - { thecurr = thelist; } - - Standard_Boolean LibCtl_Library::More () const - { return (!thecurr.IsNull()); } - - void LibCtl_Library::Next () - { if (!thecurr.IsNull()) thecurr = thecurr->Next(); } - - const Handle(TheModule)& LibCtl_Library::Module () const -{ - if (thecurr.IsNull()) Standard_NoSuchObject::Raise("Library from LibCtl"); - return thecurr->Module(); -} - - const Handle(TheProtocol)& LibCtl_Library::Protocol () const -{ - if (thecurr.IsNull()) Standard_NoSuchObject::Raise("Library from LibCtl"); - return thecurr->Protocol(); -} diff --git a/src/LibCtl/LibCtl_Library.hxx b/src/LibCtl/LibCtl_Library.hxx new file mode 100644 index 0000000000..85af591554 --- /dev/null +++ b/src/LibCtl/LibCtl_Library.hxx @@ -0,0 +1,352 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _LibCtl_Library_HeaderFile +#define _LibCtl_Library_HeaderFile + +#include +#include +#include +#include + +template class LibCtl_GlobalNode; + +//! Manages a list of Modules for a Library (as an instance) : +//! Designates a GlobalNode (couple Module-Protocol) +template +class LibCtl_Node +{ +private: + + NCollection_Handle < LibCtl_GlobalNode > myNode; + NCollection_Handle < LibCtl_Node > myNext; + +public: + + Standard_EXPORT LibCtl_Node (); + Standard_EXPORT void AddNode (const NCollection_Handle< LibCtl_GlobalNode >& theNode); + Standard_EXPORT const ModuleType& Module () const; + Standard_EXPORT const ProtocolType& Protocol () const; + Standard_EXPORT const NCollection_Handle< LibCtl_Node >& Next () const; +}; + +//! Creates an empty Node, with no Next +template +LibCtl_Node +::LibCtl_Node () { } + +//! Adds a couple (Module,Protocol), that is, stores it into +//! itself if not yet done, else creates a Next Node to do it. +template +void LibCtl_Node::AddNode (const NCollection_Handle< LibCtl_GlobalNode >& theNode) +{ + if (myNode == theNode) return; + if (myNext.IsNull()) { + if (myNode.IsNull()) myNode = theNode; + else { + myNext = new LibCtl_Node; + myNext->AddNode (theNode); + } + } + else myNext->AddNode (theNode); +} + +//! Returns the Module designated by a precise Node. +template +const ModuleType& LibCtl_Node::Module () const +{ + return myNode->Module(); +} + +//! Returns the Protocol designated by a precise Node. +template +const ProtocolType& LibCtl_Node::Protocol () const +{ + return myNode->Protocol(); +} + +//! Returns the next Node. +//! If none was defined, returned value is a null handle. +template +const NCollection_Handle< LibCtl_Node >& LibCtl_Node::Next () const +{ + return myNext; +} + +//! Manages a (possibly static) Global List of Modules bound to protocols. +//! Remark that it requires independance from Memory Management +//! (because a Global List of Modules can be build through static +//! declarations, i.e. before any sequential execution) +//! Remark there will not be many many GlobalNodes created +template +class LibCtl_GlobalNode +{ +private: + ModuleType myMod; + ProtocolType myProt; + NCollection_Handle myNext; +public: + Standard_EXPORT LibCtl_GlobalNode (); + Standard_EXPORT void Add (const ModuleType& theModule, const ProtocolType& theProtocol); + Standard_EXPORT const ModuleType& Module () const; + Standard_EXPORT const ProtocolType& Protocol () const; + Standard_EXPORT const NCollection_Handle & Next () const; +}; + +//! Creates an empty GlobalNode, with no Next +template +LibCtl_GlobalNode +::LibCtl_GlobalNode () { } + +//! Adds a Module bound with a Protocol to the list : does +//! nothing if already in the list, THAT IS, Same Type (exact +//! match) and Same State (that is, IsEqual is not required). +//! Once added, stores its attached Protocol in correspondance. +template +void LibCtl_GlobalNode ::Add +(const ModuleType& theModule, const ProtocolType& theProtocol) +{ + if (myMod == theModule) return; + if (myProt == theProtocol) myMod = theModule; + else if (myNext.IsNull()) + { + if (myMod.IsNull()) + { + myMod = theModule; + myProt = theProtocol; + } + else + { + myNext = new LibCtl_GlobalNode; + myNext->Add (theModule,theProtocol); + } + } + else myNext->Add (theModule,theProtocol); +} + +//! Returns the Module stored in a given GlobalNode. +template +const ModuleType& LibCtl_GlobalNode ::Module () const +{ + return myMod; +} + +//! Returns the attached Protocol stored in a given GlobalNode. +template +const ProtocolType& LibCtl_GlobalNode ::Protocol () const +{ + return myProt; +} + +//! Returns the next GlobalNode. +//! If none is defined, returned value is a null handle. +template +const NCollection_Handle >& +LibCtl_GlobalNode ::Next () const +{ + return myNext; +} + +// Library +//! Manages a list of Execution Modules attached to Protocols +//! to perform a specific set of functionnalities. +//! +//! Each instantiated class of Library has a global set a Modules. +//! These Modules are put in this set before working, for instance +//! by static construction (using method SetGlobal). One Module +//! is bound which each Protocol (considered as a class). +//! +//! To work, a Library is created by taking the Modules which +//! comply with a Protocol (bound with its class and the classes +//! of its Resources), given as parameter of its creation. +//! +//! Thus, any tool can use it to get the suitable Modules +//! Warning : The order of the Modules in the Library has assumed to be +//! useless, and is not managed. +template +class LibCtl_Library +{ +public: + // Basic data for optimization (Protocol last request) + static ProtocolType myProtocol; + static NCollection_Handle< LibCtl_Node > myLast; + + DEFINE_STANDARD_ALLOC + +private: + NCollection_Handle< LibCtl_Node > myList; + NCollection_Handle< LibCtl_Node > myCurr; +public: + + //! Gets global list of modules + static NCollection_Handle< LibCtl_GlobalNode >& GetGlobal(); + + //! Supply the global list + Standard_EXPORT static void SetGlobal (const ModuleType& theModule, const ProtocolType& theProtocol) + { + if (GetGlobal().IsNull()) GetGlobal() = new LibCtl_GlobalNode; + GetGlobal()->Add(theModule,theProtocol); + } + + Standard_EXPORT LibCtl_Library (const ProtocolType& theProtocol) + { + Standard_Boolean last = Standard_False; + // No protocol = empty library + if (theProtocol.IsNull()) return; + if (!myProtocol.IsNull()) last = + (myProtocol == theProtocol); + + if (last) + myList = myLast; + // If no optimization available: list building + else + { + AddProtocol(theProtocol); + // This defines the optimization (for the next time) + myLast = myList; + myProtocol = theProtocol; + } + } + + Standard_EXPORT LibCtl_Library () + { } + + //! Add a Protocol: attention: it is desoptimise (if not confusion!) + Standard_EXPORT void AddProtocol (const Handle(Standard_Transient)& theProtocol) + { + // Downcast as Protocol-> Resources, and even redefined to use in other + // Library must always return the type highest + ProtocolType aProtocol = ProtocolType::DownCast(theProtocol); + if (aProtocol.IsNull()) return; + + NCollection_Handle< LibCtl_GlobalNode > curr; + for (curr = GetGlobal(); !curr.IsNull(); ) + { + const ProtocolType& aProtocol = curr->Protocol(); + if (!aProtocol.IsNull()) + { + // Match Protocol ? + if (aProtocol->DynamicType() == theProtocol->DynamicType()) + { + if (myList.IsNull()) + myList = new LibCtl_Node; + + myList->AddNode(curr); + break; // UN SEUL MODULE PAR PROTOCOLE + } + } + curr = curr->Next(); + } + // Treat resources + Standard_Integer nb = aProtocol->NbResources(); + for (Standard_Integer i = 1; i <= nb; i++) + { + AddProtocol (aProtocol->Resource(i)); + } + + myProtocol.Nullify(); + myLast.Nullify(); + } + + Standard_EXPORT void Clear () + { + myList = new LibCtl_Node ; + } + + Standard_EXPORT void SetComplete () + { + myList = new LibCtl_Node ; + // Take each of the protocols of the Global list + NCollection_Handle< LibCtl_GlobalNode > curr; + for (curr = GetGlobal(); !curr.IsNull(); ) + { + const ProtocolType& aProtocol = curr->Protocol(); + // As we take all , it is not preoccupied resources + if (!aProtocol.IsNull()) myList->AddNode(curr); + curr = curr->Next(); + } + } + + //! Selection: the corresponding theModule is returned to a Type + //! (as well as CaseNumber returns the corresponding protocol) + Standard_EXPORT Standard_Boolean Select (const ObjectType& theObj, + ModuleType& theModule, + Standard_Integer& theCN) const + { + // Reponse: "not found" + theModule.Nullify(); theCN = 0; + if (myList.IsNull()) + return Standard_False; + NCollection_Handle< LibCtl_Node > curr = myList; + for (curr = myList; !curr.IsNull(); ) + { + const ProtocolType& aProtocol = curr->Protocol(); + if (!aProtocol.IsNull()) + { + theCN = aProtocol->CaseNumber(theObj); + if (theCN > 0) + { + theModule = curr->Module(); + return Standard_True; + } + } + curr = curr->Next(); + } + return Standard_False; + } + + //! Initialization for iteration through the library + Standard_EXPORT void Start () + { + myCurr = myList; + } + + Standard_EXPORT Standard_Boolean More () const + { + return (!myCurr.IsNull()); + } + + Standard_EXPORT void Next () + { + if (!myCurr.IsNull()) + myCurr = myCurr->Next(); + } + + Standard_EXPORT const ModuleType& Module () const + { + if (myCurr.IsNull()) + Standard_NoSuchObject::Raise("Library from LibCtl"); + return myCurr->Module(); + } + + Standard_EXPORT const ProtocolType& Protocol () const + { + if (myCurr.IsNull()) + Standard_NoSuchObject::Raise("Library from LibCtl"); + return myCurr->Protocol(); + } +}; + +//! Basic data for optimization (Protocol last request) +template +ProtocolType LibCtl_Library::myProtocol; + +template +NCollection_Handle > +LibCtl_Library::myLast; + +#endif diff --git a/src/LibCtl/LibCtl_Node.gxx b/src/LibCtl/LibCtl_Node.gxx deleted file mode 100644 index ce7e98f100..0000000000 --- a/src/LibCtl/LibCtl_Node.gxx +++ /dev/null @@ -1,45 +0,0 @@ -// 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 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 - - -// Classe generique imbriquee dans Library : utilisee pour construire la -// listes de Modules d une librairie (cf Library pour plus de details) -// (En fait : Liste de Global Nodes -> Module + Protocol) - -LibCtl_Node::LibCtl_Node () { } - - void LibCtl_Node::AddNode (const Handle(LibCtl_GlobalNode)& anode) -{ - if (thenode == anode) return; - if (thenext.IsNull()) { - if (thenode.IsNull()) thenode = anode; - else { - thenext = new LibCtl_Node; - thenext->AddNode (anode); - } - } - else thenext->AddNode (anode); -} - - - const Handle(TheModule)& LibCtl_Node::Module () const - { return thenode->Module(); } - - const Handle(TheProtocol)& LibCtl_Node::Protocol () const - { return thenode->Protocol(); } - - const Handle(LibCtl_Node)& LibCtl_Node::Next () const - { return thenext; } diff --git a/src/LibCtl/LibCtl_ProtocolTemplate.cdl b/src/LibCtl/LibCtl_ProtocolTemplate.cdl deleted file mode 100644 index 1e39cf57a1..0000000000 --- a/src/LibCtl/LibCtl_ProtocolTemplate.cdl +++ /dev/null @@ -1,59 +0,0 @@ --- Created on: 1993-03-17 --- Created by: Christian CAILLET --- Copyright (c) 1993-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 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. - -deferred generic class ProtocolTemplate from LibCtl - (TheObject as any) - inherits Transient - - ---Purpose : This class is a Template class for Library : there is no - -- obligation to inherit it for instantiate a Library class. - -- - -- A Protocol class defines a data scheme by gathering a set of - -- Object Classes. This set is made of : - -- - As necessary, other sets already defined by other Protocols. - -- These Protocols are the Resources of - -- This definition can be recurrent : each Protocol class - -- defines its Resources at immediate level - -- - The list of Object Classes it identifies DIRECTLY (itself), - -- i.e. not through its Resources. - -- - -- A classic Selection criterium is DynamicType (for a Transient - -- or Persistent Object), this gives a Case Number per Class. If - -- another criterium is taken, it must assume unique and non- - -- ambiguous binding between an object state and a Cse Number. - -- - -- For each Object Class (or recognized state) it identifies - -- directly, it provides a unique positive Number, which can be - -- used as Case Number. - -- - -- A Module bound with a Protocol class is assumed to accept any - -- Object of a Class it defines DIRECTLY (not its Resources). - -uses Type - -is - - NbResources (me) returns Integer is deferred; - ---Purpose : Gives the count of Protocols used as Resource (can be zero) - - Resource (me; num : Integer) returns ProtocolTemplate is deferred; - ---Purpose : Returns a Resource, given a rank. - - CaseNumber (me; obj : any TheObject) returns Integer is deferred; - ---Purpose : Returns a Case Number, specific of each recognized Object - -- This is a positive number. Zero means " not recognized" - -end ProtocolTemplate; diff --git a/src/MoniTool/MoniTool.cdl b/src/MoniTool/MoniTool.cdl index 3fd900e4c2..a4a1ed16aa 100644 --- a/src/MoniTool/MoniTool.cdl +++ b/src/MoniTool/MoniTool.cdl @@ -28,16 +28,9 @@ uses Standard, MMgt, TCollection, TColStd, Dico, Message, Dico, OSD is - - -- Element, generic Elem, and instance for Transient - class DataInfo; -- used in Elem : this one is for Transient deferred class Element; - generic class Elem; - class TransientElem instantiates Elem - (Transient, MapTransientHasher from TColStd, DataInfo); class ElemHasher; - - + class IntVal; class RealVal; class AttrList; diff --git a/src/MoniTool/MoniTool_DataInfo.cdl b/src/MoniTool/MoniTool_DataInfo.cdl deleted file mode 100644 index af23ce7c97..0000000000 --- a/src/MoniTool/MoniTool_DataInfo.cdl +++ /dev/null @@ -1,35 +0,0 @@ --- Created on: 1996-09-04 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class DataInfo from MoniTool - - ---Purpose : Gives informations on an object - -- Used as template to instantiate Elem, etc - -- This class is for Transient - -uses CString, Transient, Type - -is - - Type (myclass; ent : Transient) returns Type; - ---Purpose : Returns the Type attached to an object - -- Here, the Dynamic Type of a Transient. Null Type if unknown - - TypeName (myclass; ent : Transient) returns CString; - ---Purpose : Returns Type Name (string) - -- Allows to name type of non-handled objects - -end DataInfo; diff --git a/src/MoniTool/MoniTool_Elem.cdl b/src/MoniTool/MoniTool_Elem.cdl deleted file mode 100644 index a9c77dcb65..0000000000 --- a/src/MoniTool/MoniTool_Elem.cdl +++ /dev/null @@ -1,62 +0,0 @@ --- Created on: 1994-11-04 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -generic class Elem from MoniTool - (TheKey as any; - TheHasher as any; - TheInfo as any) - inherits Element - - ---Purpose : an Elem defines an Element for a specific input class - -- its definition includes the value of the Key to be mapped, - -- and the HashCoder associated to the class of the Key - -- - -- TheKey defines the class to be keyed - -- TheHasher is the associated Hasher - -- TheInfo is an additionnal class which helps to provide - -- informations on the value (template : see DataInfo) - -uses CString - -is - - Create (akey : any TheKey) returns mutable Elem; - ---Purpose : Creates a Elem with a Value. This Value can then not be - -- changed. It is used by the Hasher to compute the HashCode, - -- which will then be stored for an immediate reading. - - Value (me) returns any TheKey is static; - ---Purpose : Returns the contained value - ---C++ : return const & - - Equates (me; other : Element) returns Boolean; - ---Purpose : Specific testof equallity : defined as False if has - -- not the same true Type, else contents are compared (by - -- C++ operator ==) - - ValueType (me) returns Type is redefined; - ---Purpose : Returns the Type of the Value. By default, returns the - -- DynamicType of , but can be redefined - - ValueTypeName (me) returns CString is redefined; - ---Purpose : Returns the name of the Type of the Value. Default is name - -- of ValueType, unless it is for a non-handled object - -fields - - theval : TheKey; - -end Elem; diff --git a/src/MoniTool/MoniTool_Elem.gxx b/src/MoniTool/MoniTool_Elem.gxx deleted file mode 100644 index 31552f3fa1..0000000000 --- a/src/MoniTool/MoniTool_Elem.gxx +++ /dev/null @@ -1,41 +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 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 - - -MoniTool_Elem::MoniTool_Elem (const TheKey& akey) - : theval (akey) -{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); } - - - const TheKey& MoniTool_Elem::Value () const - { return theval; } - - Standard_Boolean MoniTool_Elem::Equates - (const Handle(MoniTool_Element)& other) const -{ - if (other.IsNull()) return Standard_False; - if (GetHashCode() != other->GetHashCode()) return Standard_False; - if (other->DynamicType() != DynamicType()) return Standard_False; - Handle(MoniTool_Elem) another = Handle(MoniTool_Elem)::DownCast(other); -// return (theval == another->Value()); - return TheHasher::IsEqual (theval,another->Value()); -} - - Handle(Standard_Type) MoniTool_Elem::ValueType () const - { return TheInfo::Type(theval); } - - Standard_CString MoniTool_Elem::ValueTypeName () const - { return TheInfo::TypeName(theval); } diff --git a/src/STEPCAFControl/FILES b/src/STEPCAFControl/FILES new file mode 100644 index 0000000000..7be9abfc0f --- /dev/null +++ b/src/STEPCAFControl/FILES @@ -0,0 +1,8 @@ +STEPCAFControl_ActorWrite.hxx +STEPCAFControl_ActorWrite.cxx +STEPCAFControl_Writer.hxx +STEPCAFControl_Writer.cxx +STEPCAFControl_Reader.hxx +STEPCAFControl_Reader.cxx +STEPCAFControl_Controller.hxx +STEPCAFControl_Controller.cxx diff --git a/src/STEPCAFControl/STEPCAFControl.cdl b/src/STEPCAFControl/STEPCAFControl.cdl index 2c7a61644f..9db40635d8 100644 --- a/src/STEPCAFControl/STEPCAFControl.cdl +++ b/src/STEPCAFControl/STEPCAFControl.cdl @@ -41,17 +41,17 @@ uses is - class Reader; + imported Reader; ---Purpose: Reader for DECAF documents - class Writer; + imported Writer; ---Purpose: Writer for DECAF documents class ExternFile; ---Purpose: Auxiliary class to store results of translation of external file - class ActorWrite; - class Controller; + imported ActorWrite; + imported Controller; ---Purpose: Extensions of standard STEP tools for DECAF specifics class DictionaryOfExternFile instantiates diff --git a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cdl b/src/STEPCAFControl/STEPCAFControl_ActorWrite.cdl deleted file mode 100644 index d39d76896e..0000000000 --- a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cdl +++ /dev/null @@ -1,50 +0,0 @@ --- Created on: 2000-10-05 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class ActorWrite from STEPCAFControl inherits ActorWrite from STEPControl - - ---Purpose: Extends ActorWrite from STEPControl by analysis of - -- whether shape is assembly (based on information from DECAF) - -uses - Shape from TopoDS, - MapOfShape from TopTools - -is - - Create returns mutable ActorWrite; - - IsAssembly (me; S: in out Shape from TopoDS) returns Boolean is redefined; - ---Purpose: Check whether shape S is assembly - -- Returns True if shape is registered in assemblies map - - SetStdMode (me: mutable; stdmode: Boolean = Standard_True); - ---Purpose: Set standard mode of work - -- In standard mode Actor (default) behaves exactly as its - -- ancestor, also map is cleared - - ClearMap (me: mutable); - ---Purpose: Clears map of shapes registered as assemblies - - RegisterAssembly (me: mutable; S: Shape from TopoDS); - ---Purpose: Registers shape to be written as assembly - -- The shape should be TopoDS_Compound (else does nothing) - -fields - - myStdMode: Boolean; - myMap: MapOfShape from TopTools; - -end ActorWrite; diff --git a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx b/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx index 961194ab71..2b806b5077 100644 --- a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx +++ b/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx @@ -13,7 +13,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(STEPCAFControl_ActorWrite) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(STEPControl_ActorWrite), + STANDARD_TYPE(Transfer_ActorOfFinderProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPCAFControl_ActorWrite) + + +IMPLEMENT_DOWNCAST(STEPCAFControl_ActorWrite,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPCAFControl_ActorWrite) //======================================================================= //function : STEPCAFControl_ActorWrite diff --git a/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx b/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx new file mode 100644 index 0000000000..2ca7ea0afb --- /dev/null +++ b/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx @@ -0,0 +1,68 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPCAFControl_ActorWrite_HeaderFile +#define _STEPCAFControl_ActorWrite_HeaderFile + +#include +#include +#include +#include +#include + +class TopoDS_Shape; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(STEPControl_ActorWrite); +class STEPCAFControl_ActorWrite; + +DEFINE_STANDARD_HANDLE(STEPCAFControl_ActorWrite,STEPControl_ActorWrite) + + +//! Extends ActorWrite from STEPControl by analysis of
+//! whether shape is assembly (based on information from DECAF)
+class STEPCAFControl_ActorWrite : public STEPControl_ActorWrite +{ + +public: + + Standard_EXPORT STEPCAFControl_ActorWrite(); + + //! Check whether shape S is assembly
+ //! Returns True if shape is registered in assemblies map
+ Standard_EXPORT virtual Standard_Boolean IsAssembly(TopoDS_Shape& S) const; + + //! Set standard mode of work
+ //! In standard mode Actor (default) behaves exactly as its
+ //! ancestor, also map is cleared
+ Standard_EXPORT void SetStdMode(const Standard_Boolean stdmode = Standard_True); + + //! Clears map of shapes registered as assemblies
+ Standard_EXPORT void ClearMap(); + + //! Registers shape to be written as assembly
+ //! The shape should be TopoDS_Compound (else does nothing)
+ Standard_EXPORT void RegisterAssembly(const TopoDS_Shape& S); + + DEFINE_STANDARD_RTTI(STEPCAFControl_ActorWrite) + +private: + + Standard_Boolean myStdMode; + TopTools_MapOfShape myMap; +}; +#endif diff --git a/src/STEPCAFControl/STEPCAFControl_Controller.cdl b/src/STEPCAFControl/STEPCAFControl_Controller.cdl deleted file mode 100644 index ba75326060..0000000000 --- a/src/STEPCAFControl/STEPCAFControl_Controller.cdl +++ /dev/null @@ -1,36 +0,0 @@ --- Created on: 2000-10-05 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class Controller from STEPCAFControl inherits Controller from STEPControl - - ---Purpose: Extends Controller from STEPControl in order to provide - -- ActorWrite adapted for writing assemblies from DECAF - -- Note that ActorRead from STEPControl is used for reading - -- (inherited automatically) - -uses - ActorWrite from STEPCAFControl - -is - - Create returns mutable Controller; - ---Purpose : Initializes the use of STEP Norm (the first time) - - Init (myclass) returns Boolean; - ---Purpose : Standard Initialisation. It creates a Controller for STEP-XCAF - -- and records it to various names, available to select it later - -- Returns True when done, False if could not be done - -end Controller; diff --git a/src/STEPCAFControl/STEPCAFControl_Controller.cxx b/src/STEPCAFControl/STEPCAFControl_Controller.cxx index 45aa3ad368..a309d4cccf 100644 --- a/src/STEPCAFControl/STEPCAFControl_Controller.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Controller.cxx @@ -13,10 +13,26 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include +#include + +IMPLEMENT_STANDARD_TYPE(STEPCAFControl_Controller) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(STEPControl_Controller), + STANDARD_TYPE(XSControl_Controller), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPCAFControl_Controller) + + +IMPLEMENT_DOWNCAST(STEPCAFControl_Controller,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPCAFControl_Controller) + //======================================================================= //function : STEPCAFControl_Controller diff --git a/src/STEPCAFControl/STEPCAFControl_Controller.hxx b/src/STEPCAFControl/STEPCAFControl_Controller.hxx new file mode 100644 index 0000000000..5b71ec96c7 --- /dev/null +++ b/src/STEPCAFControl/STEPCAFControl_Controller.hxx @@ -0,0 +1,54 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPCAFControl_Controller_HeaderFile +#define _STEPCAFControl_Controller_HeaderFile + +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class Handle(Standard_Type); +class Handle(STEPControl_Controller); +class STEPCAFControl_Controller; + +DEFINE_STANDARD_HANDLE(STEPCAFControl_Controller,STEPControl_Controller) + +//! Extends Controller from STEPControl in order to provide
+//! ActorWrite adapted for writing assemblies from DECAF
+//! Note that ActorRead from STEPControl is used for reading
+//! (inherited automatically)
+class STEPCAFControl_Controller : public STEPControl_Controller +{ + +public: + + //! Initializes the use of STEP Norm (the first time)
+ Standard_EXPORT STEPCAFControl_Controller(); + + //! Standard Initialisation. It creates a Controller for STEP-XCAF
+ //! and records it to various names, available to select it later
+ //! Returns True when done, False if could not be done
+ Standard_EXPORT static Standard_Boolean Init() ; + + DEFINE_STANDARD_RTTI(STEPCAFControl_Controller) +}; +#endif diff --git a/src/STEPCAFControl/STEPCAFControl_ExternFile.cdl b/src/STEPCAFControl/STEPCAFControl_ExternFile.cdl index f66565e778..dc1bfda0e5 100644 --- a/src/STEPCAFControl/STEPCAFControl_ExternFile.cdl +++ b/src/STEPCAFControl/STEPCAFControl_ExternFile.cdl @@ -21,7 +21,7 @@ class ExternFile from STEPCAFControl inherits TShared from MMgt uses HAsciiString from TCollection, ReturnStatus from IFSelect, - WorkSession from XSControl, + WorkSession_Handle from XSControl, Shape from TopoDS, Label from TDF @@ -30,9 +30,9 @@ is Create returns ExternFile; ---Purpose: Creates an empty structure - SetWS (me: mutable; WS: WorkSession from XSControl); + SetWS (me: mutable; WS: WorkSession_Handle from XSControl); ---C++: inline - GetWS (me) returns WorkSession from XSControl; + GetWS (me) returns WorkSession_Handle from XSControl; ---C++: inline SetLoadStatus (me: mutable; stat: ReturnStatus from IFSelect); @@ -67,7 +67,7 @@ is fields - myWS : WorkSession from XSControl; + myWS : WorkSession_Handle from XSControl; myLoadStatus: ReturnStatus from IFSelect; myTransferStatus: Boolean; diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cdl b/src/STEPCAFControl/STEPCAFControl_Reader.cdl deleted file mode 100644 index 8ff84b5db3..0000000000 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cdl +++ /dev/null @@ -1,308 +0,0 @@ --- Created on: 2000-08-15 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class Reader from STEPCAFControl --- inherits Reader from STEPControl - - ---Purpose: Provides a tool to read STEP file and put it into - -- DECAF document. Besides transfer of shapes (including - -- assemblies) provided by STEPControl, supports also - -- colors and part names - -- - -- This reader supports reading files with external references - -- i.e. multifile reading - -- It behaves as usual Reader (from STEPControl) for the main - -- file (e.g. if it is single file) - -- Results of reading other files can be accessed by name of the - -- file or by iterating on a readers - -uses - AsciiString from TCollection, - WorkSession from XSControl, - ReturnStatus from IFSelect, - Shape from TopoDS, - Document from TDocStd, - Reader from STEPControl, - NextAssemblyUsageOccurrence from StepRepr, - DictionaryOfExternFile from STEPCAFControl, - ExternFile from STEPCAFControl, - ExternRefs from STEPConstruct, - Tool from STEPConstruct, - DataMapOfShapePD from STEPCAFControl, - DataMapOfPDExternFile from STEPCAFControl, - DataMapOfShapeLabel from XCAFDoc, - MapOfShape from TopTools, - ShapeTool from XCAFDoc, - Label from TDF, - LabelSequence from TDF, - HSequenceOfTransient from TColStd, - RepresentationItem from StepRepr, - TransientProcess from Transfer, - ConnectedFaceSet from StepShape - -is - - Create returns Reader; - ---Purpose: Creates a reader with an empty --- STEP model and sets ColorMode, LayerMode, NameMode and --- PropsMode to Standard_True. - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Reader; - ---Purpose: Creates a reader tool and attaches it to an already existing Session - -- Clears the session if it was not yet set for STEP - - Init (me: in out; WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True); - ---Purpose: Clears the internal data structures and attaches to a new session - -- Clears the session if it was not yet set for STEP - - ReadFile (me : in out; filename : CString) - returns ReturnStatus from IFSelect; - ---Purpose: Loads a file and returns the read status - -- Provided for use like single-file reader - - NbRootsForTransfer (me: in out) returns Integer; - ---Purpose: Returns number of roots recognized for transfer - -- Shortcut for Reader().NbRootsForTransfer() - - TransferOneRoot (me: in out; num: Integer; doc: in out Document from TDocStd) - returns Boolean; - ---Purpose: Translates currently loaded STEP file into the document - -- Returns True if succeeded, and False in case of fail - -- Provided for use like single-file reader - - Transfer (me: in out; doc: in out Document from TDocStd) - returns Boolean; - ---Purpose: Translates currently loaded STEP file into the document - -- Returns True if succeeded, and False in case of fail - -- Provided for use like single-file reader - - Perform (me: in out; filename: AsciiString from TCollection; - doc: in out Document from TDocStd) returns Boolean; - - Perform (me: in out; filename: CString; doc: in out Document from TDocStd) - returns Boolean; - ---Purpose: Translate STEP file given by filename into the document - -- Return True if succeeded, and False in case of fail - - ---Scope: Access to fields - - ExternFiles (me) returns DictionaryOfExternFile from STEPCAFControl; - ---Purpose: Returns data on external files - -- Returns Null handle if no external files are read - ---C++: return const & - - ExternFile (me; name: CString; ef: out ExternFile from STEPCAFControl) - returns Boolean; - ---Purpose: Returns data on external file by its name - -- Returns False if no external file with given name is read - - ChangeReader (me: in out) returns Reader from STEPControl; - ---Purpose: Returns basic reader - ---C++: return & - - Reader (me) returns Reader from STEPControl; - ---Purpose: Returns basic reader as const - ---C++: return const & - - ---Scope: Internal methods - - Transfer (me: in out; rd: in out Reader from STEPControl; - num: Integer; - doc: in out Document from TDocStd; - Lseq: out LabelSequence from TDF; - asOne: Boolean = Standard_False) - returns Boolean is protected; - ---Purpose: Translates STEP file already loaded into the reader - -- into the document - -- If num==0, translates all roots, else only root number num - -- Returns True if succeeded, and False in case of fail - -- If asOne is True, in case of multiple results composes - -- them into assembly. Fills sequence of produced labels - - AddShape (me; S: Shape from TopoDS; STool: ShapeTool from XCAFDoc; - NewShapesMap : MapOfShape from TopTools; - ShapePDMap: DataMapOfShapePD from STEPCAFControl; - PDFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: in out DataMapOfShapeLabel from XCAFDoc) - returns Label from TDF is protected; - ---Purpose: Add a shape to a document - -- Depending on a case, this shape can be added as one, or - -- as assembly, or (in case if it is associated with external - -- reference) taken as that referred shape - - ReadExternFile (me: in out; file, fullpath: CString; doc: in out Document from TDocStd) - returns ExternFile from STEPCAFControl is protected; - ---Purpose: Reads (or if returns already read) extern file with - -- given name - - ReadColors (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd; - PDFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: DataMapOfShapeLabel from XCAFDoc) - returns Boolean is protected; - ---Purpose: Reads style assignments from STEP model and sets - -- corresponding color assignments in the DECAF document - - ReadNames (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd; - PDFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: DataMapOfShapeLabel from XCAFDoc) - returns Boolean is protected; - ---Purpose: Reads names of parts defined in the STEP model and - -- assigns them to corresponding labels in the DECAF document - - ReadValProps (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd; - PDFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: DataMapOfShapeLabel from XCAFDoc) - returns Boolean is protected; - ---Purpose: Reads validation properties assigned to shapes in the STEP - -- model and assigns them to corresponding labels in the DECAF - -- document - - ReadLayers (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd) - returns Boolean is protected; - ---Purpose: Reads layers of parts defined in the STEP model and - -- set reference between shape and layers in the DECAF document - - ReadSHUOs (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd; - PDFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: DataMapOfShapeLabel from XCAFDoc) - returns Boolean is protected; - ---Purpose: Reads SHUO for instances defined in the STEP model and - -- set reference between shape instances from different assemblyes - - ReadGDTs (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd) - returns Boolean is protected; - ---Purpose: Reads D> for instances defined in the STEP model and - -- set reference between shape instances from different assemblyes - - ReadMaterials (me; WS: WorkSession from XSControl; - doc: in out Document from TDocStd; - SeqPDS : HSequenceOfTransient from TColStd) - returns Boolean is protected; - ---Purpose: Reads materials for instances defined in the STEP model and - -- set reference between shape instances from different assemblyes - - SettleShapeData(me; theItem: RepresentationItem from StepRepr; - theLab: out Label from TDF; - theShapeTool: ShapeTool from XCAFDoc; - theTP: TransientProcess from Transfer) - returns Label from TDF is protected; - --- Purpose: Populates the sub-Label of the passed TDF Label with shape - -- data associated with the given STEP Representation Item, - -- including naming and topological information. - - ExpandSubShapes(me; theShapeTool: ShapeTool from XCAFDoc; - theShapeLabelMap: DataMapOfShapeLabel from XCAFDoc; - theShapePDMap: DataMapOfShapePD from STEPCAFControl) - is protected; - --- Purpose: Given the maps of already translated shapes, this method - -- expands their correspondent Labels in XDE Document so that - -- to have a dedicated sub-Label for each sub-shape coming - -- with associated name in its STEP Representation Item. - - ExpandManifoldSolidBrep(me; theLab: out Label from TDF; - theItem: RepresentationItem from StepRepr; - theTP: TransientProcess from Transfer; - theShapeTool: ShapeTool from XCAFDoc) - is protected; - --- Purpose: Expands the topological structure of Manifold Solid BRep - -- STEP entity to OCAF sub-tree. Entities having no names - -- associated via their Representation Items are skipped. - - ExpandSBSM(me; theLab: out Label from TDF; - theItem: RepresentationItem from StepRepr; - theTP: TransientProcess from Transfer; - theShapeTool: ShapeTool from XCAFDoc) - is protected; - --- Purpose: Expands the topological structure of Shell-Based Surface - -- Model STEP entity to OCAF sub-tree. Entities having no names - -- associated via their Representation Items are skipped. - - ExpandShell(me; theShell: ConnectedFaceSet from StepShape; - theLab: out Label from TDF; - theTP: TransientProcess from Transfer; - theShapeTool: ShapeTool from XCAFDoc) - is protected; - --- Purpose: Expands STEP Shell structure to OCAF sub-tree. Entities - -- having no names associated via their Representation Items - -- are skipped. - - FindInstance (myclass; NAUO: NextAssemblyUsageOccurrence from StepRepr; - STool: ShapeTool from XCAFDoc; - Tool: Tool from STEPConstruct; - PDRFileMap : DataMapOfPDExternFile from STEPCAFControl; - ShapeLabelMap: DataMapOfShapeLabel from XCAFDoc) - returns Label from TDF; - ---Purpose: Returns label of instance of an assembly component - -- corresponding to a given NAUO - - --- Work with fileds for different mode of reading STEP file. - - SetColorMode(me: in out; colormode: Boolean from Standard); - ---Purpose: Set ColorMode for indicate read Colors or not. - - GetColorMode(me) returns Boolean; - - SetNameMode(me: in out; namemode: Boolean from Standard); - ---Purpose: Set NameMode for indicate read Name or not. - - GetNameMode(me) returns Boolean; - - SetLayerMode(me: in out; layermode: Boolean from Standard); - ---Purpose: Set LayerMode for indicate read Layers or not. - - GetLayerMode(me) returns Boolean; - - - SetPropsMode(me: in out; propsmode: Boolean from Standard); - ---Purpose: PropsMode for indicate read Validation properties or not. - - GetPropsMode(me) returns Boolean; - - SetSHUOMode(me: in out; shuomode: Boolean from Standard); - ---Purpose: Set SHUO mode for indicate write SHUO or not. - - GetSHUOMode(me) returns Boolean; - - SetGDTMode(me: in out; gdtmode: Boolean from Standard); - ---Purpose: Set GDT mode for indicate write GDT or not. - - GetGDTMode(me) returns Boolean; - - SetMatMode(me: in out; matmode: Boolean from Standard); - ---Purpose: Set Material mode - - GetMatMode(me) returns Boolean; - -fields - - myReader : Reader from STEPControl; - myFiles : DictionaryOfExternFile from STEPCAFControl; - myColorMode : Boolean; - myNameMode : Boolean; - myLayerMode : Boolean; - myPropsMode : Boolean; - mySHUOMode : Boolean; - myGDTMode : Boolean; - myMatMode : Boolean; - -end Reader; diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 962fce782d..69805c07ca 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -13,7 +13,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include @@ -172,6 +172,27 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef DEB //! Converts address of the passed shape (TShape) to string. diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.hxx b/src/STEPCAFControl/STEPCAFControl_Reader.hxx new file mode 100644 index 0000000000..80a642e391 --- /dev/null +++ b/src/STEPCAFControl/STEPCAFControl_Reader.hxx @@ -0,0 +1,241 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPCAFControl_Reader_HeaderFile +#define _STEPCAFControl_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class STEPCAFControl_DictionaryOfExternFile; +class XSControl_WorkSession; +class TDocStd_Document; +class TCollection_AsciiString; +class STEPCAFControl_ExternFile; +class STEPControl_Reader; +class TDF_LabelSequence; +class TDF_Label; +class TopoDS_Shape; +class XCAFDoc_ShapeTool; +class TopTools_MapOfShape; +class STEPCAFControl_DataMapOfShapePD; +class STEPCAFControl_DataMapOfPDExternFile; +class XCAFDoc_DataMapOfShapeLabel; +class TColStd_HSequenceOfTransient; +class StepRepr_RepresentationItem; +class Transfer_TransientProcess; +class StepShape_ConnectedFaceSet; +class StepRepr_NextAssemblyUsageOccurrence; +class STEPConstruct_Tool; + + +//! Provides a tool to read STEP file and put it into
+//! DECAF document. Besides transfer of shapes (including
+//! assemblies) provided by STEPControl, supports also
+//! colors and part names
+//!
+//! This reader supports reading files with external references
+//! i.e. multifile reading
+//! It behaves as usual Reader (from STEPControl) for the main
+//! file (e.g. if it is single file)
+//! Results of reading other files can be accessed by name of the
+//! file or by iterating on a readers
+class STEPCAFControl_Reader { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a reader with an empty
+//! STEP model and sets ColorMode, LayerMode, NameMode and
+//! PropsMode to Standard_True.
+ Standard_EXPORT STEPCAFControl_Reader(); + //! Creates a reader tool and attaches it to an already existing Session
+//! Clears the session if it was not yet set for STEP
+ Standard_EXPORT STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Clears the internal data structures and attaches to a new session
+//! Clears the session if it was not yet set for STEP
+ Standard_EXPORT void Init(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ; + //! Loads a file and returns the read status
+//! Provided for use like single-file reader
+ Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString filename) ; + //! Returns number of roots recognized for transfer
+//! Shortcut for Reader().NbRootsForTransfer()
+ Standard_EXPORT Standard_Integer NbRootsForTransfer() ; + //! Translates currently loaded STEP file into the document
+//! Returns True if succeeded, and False in case of fail
+//! Provided for use like single-file reader
+ Standard_EXPORT Standard_Boolean TransferOneRoot(const Standard_Integer num,Handle(TDocStd_Document)& doc) ; + //! Translates currently loaded STEP file into the document
+//! Returns True if succeeded, and False in case of fail
+//! Provided for use like single-file reader
+ Standard_EXPORT Standard_Boolean Transfer(Handle(TDocStd_Document)& doc) ; + + Standard_EXPORT Standard_Boolean Perform(const TCollection_AsciiString& filename,Handle(TDocStd_Document)& doc) ; + //! Translate STEP file given by filename into the document
+//! Return True if succeeded, and False in case of fail
+ Standard_EXPORT Standard_Boolean Perform(const Standard_CString filename,Handle(TDocStd_Document)& doc) ; + //! Returns data on external files
+//! Returns Null handle if no external files are read
+ Standard_EXPORT const Handle_STEPCAFControl_DictionaryOfExternFile& ExternFiles() const; + //! Returns data on external file by its name
+//! Returns False if no external file with given name is read
+ Standard_EXPORT Standard_Boolean ExternFile(const Standard_CString name,Handle(STEPCAFControl_ExternFile)& ef) const; + //! Returns basic reader
+ Standard_EXPORT STEPControl_Reader& ChangeReader() ; + //! Returns basic reader as const
+ Standard_EXPORT const STEPControl_Reader& Reader() const; + //! Returns label of instance of an assembly component
+//! corresponding to a given NAUO
+ Standard_EXPORT static TDF_Label FindInstance(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,const Handle(XCAFDoc_ShapeTool)& STool,const STEPConstruct_Tool& Tool,const STEPCAFControl_DataMapOfPDExternFile& PDRFileMap,const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) ; + //! Set ColorMode for indicate read Colors or not.
+ Standard_EXPORT void SetColorMode(const Standard_Boolean colormode) ; + + Standard_EXPORT Standard_Boolean GetColorMode() const; + //! Set NameMode for indicate read Name or not.
+ Standard_EXPORT void SetNameMode(const Standard_Boolean namemode) ; + + Standard_EXPORT Standard_Boolean GetNameMode() const; + //! Set LayerMode for indicate read Layers or not.
+ Standard_EXPORT void SetLayerMode(const Standard_Boolean layermode) ; + + Standard_EXPORT Standard_Boolean GetLayerMode() const; + //! PropsMode for indicate read Validation properties or not.
+ Standard_EXPORT void SetPropsMode(const Standard_Boolean propsmode) ; + + Standard_EXPORT Standard_Boolean GetPropsMode() const; + //! Set SHUO mode for indicate write SHUO or not.
+ Standard_EXPORT void SetSHUOMode(const Standard_Boolean shuomode) ; + + Standard_EXPORT Standard_Boolean GetSHUOMode() const; + //! Set GDT mode for indicate write GDT or not.
+ Standard_EXPORT void SetGDTMode(const Standard_Boolean gdtmode) ; + + Standard_EXPORT Standard_Boolean GetGDTMode() const; + //! Set Material mode
+ Standard_EXPORT void SetMatMode(const Standard_Boolean matmode) ; + + Standard_EXPORT Standard_Boolean GetMatMode() const; + + + + + +protected: + + //! Translates STEP file already loaded into the reader
+//! into the document
+//! If num==0, translates all roots, else only root number num
+//! Returns True if succeeded, and False in case of fail
+//! If asOne is True, in case of multiple results composes
+//! them into assembly. Fills sequence of produced labels
+ Standard_EXPORT Standard_Boolean Transfer(STEPControl_Reader& rd,const Standard_Integer num,Handle(TDocStd_Document)& doc,TDF_LabelSequence& Lseq,const Standard_Boolean asOne = Standard_False) ; + //! Add a shape to a document
+//! Depending on a case, this shape can be added as one, or
+//! as assembly, or (in case if it is associated with external
+//! reference) taken as that referred shape
+ Standard_EXPORT TDF_Label AddShape(const TopoDS_Shape& S,const Handle(XCAFDoc_ShapeTool)& STool,const TopTools_MapOfShape& NewShapesMap,const STEPCAFControl_DataMapOfShapePD& ShapePDMap,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const; + //! Reads (or if returns already read) extern file with
+//! given name
+ Standard_EXPORT Handle_STEPCAFControl_ExternFile ReadExternFile(const Standard_CString file,const Standard_CString fullpath,Handle(TDocStd_Document)& doc) ; + //! Reads style assignments from STEP model and sets
+//! corresponding color assignments in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadColors(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const; + //! Reads names of parts defined in the STEP model and
+//! assigns them to corresponding labels in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadNames(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const; + //! Reads validation properties assigned to shapes in the STEP
+//! model and assigns them to corresponding labels in the DECAF
+//! document
+ Standard_EXPORT Standard_Boolean ReadValProps(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const; + //! Reads layers of parts defined in the STEP model and
+//! set reference between shape and layers in the DECAF document
+ Standard_EXPORT Standard_Boolean ReadLayers(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc) const; + //! Reads SHUO for instances defined in the STEP model and
+//! set reference between shape instances from different assemblyes
+ Standard_EXPORT Standard_Boolean ReadSHUOs(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const; + //! Reads D> for instances defined in the STEP model and
+//! set reference between shape instances from different assemblyes
+ Standard_EXPORT Standard_Boolean ReadGDTs(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc) const; + //! Reads materials for instances defined in the STEP model and
+//! set reference between shape instances from different assemblyes
+ Standard_EXPORT Standard_Boolean ReadMaterials(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const; + //! Populates the sub-Label of the passed TDF Label with shape
+//! data associated with the given STEP Representation Item,
+//! including naming and topological information.
+ Standard_EXPORT TDF_Label SettleShapeData(const Handle(StepRepr_RepresentationItem)& theItem,TDF_Label& theLab,const Handle(XCAFDoc_ShapeTool)& theShapeTool,const Handle(Transfer_TransientProcess)& theTP) const; + //! Given the maps of already translated shapes, this method
+//! expands their correspondent Labels in XDE Document so that
+//! to have a dedicated sub-Label for each sub-shape coming
+//! with associated name in its STEP Representation Item.
+ Standard_EXPORT void ExpandSubShapes(const Handle(XCAFDoc_ShapeTool)& theShapeTool,const XCAFDoc_DataMapOfShapeLabel& theShapeLabelMap,const STEPCAFControl_DataMapOfShapePD& theShapePDMap) const; + //! Expands the topological structure of Manifold Solid BRep
+//! STEP entity to OCAF sub-tree. Entities having no names
+//! associated via their Representation Items are skipped.
+ Standard_EXPORT void ExpandManifoldSolidBrep(TDF_Label& theLab,const Handle(StepRepr_RepresentationItem)& theItem,const Handle(Transfer_TransientProcess)& theTP,const Handle(XCAFDoc_ShapeTool)& theShapeTool) const; + //! Expands the topological structure of Shell-Based Surface
+//! Model STEP entity to OCAF sub-tree. Entities having no names
+//! associated via their Representation Items are skipped.
+ Standard_EXPORT void ExpandSBSM(TDF_Label& theLab,const Handle(StepRepr_RepresentationItem)& theItem,const Handle(Transfer_TransientProcess)& theTP,const Handle(XCAFDoc_ShapeTool)& theShapeTool) const; + //! Expands STEP Shell structure to OCAF sub-tree. Entities
+//! having no names associated via their Representation Items
+//! are skipped.
+ Standard_EXPORT void ExpandShell(const Handle(StepShape_ConnectedFaceSet)& theShell,TDF_Label& theLab,const Handle(Transfer_TransientProcess)& theTP,const Handle(XCAFDoc_ShapeTool)& theShapeTool) const; + + + + +private: + + + +STEPControl_Reader myReader; +Handle_STEPCAFControl_DictionaryOfExternFile myFiles; +Standard_Boolean myColorMode; +Standard_Boolean myNameMode; +Standard_Boolean myLayerMode; +Standard_Boolean myPropsMode; +Standard_Boolean mySHUOMode; +Standard_Boolean myGDTMode; +Standard_Boolean myMatMode; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cdl b/src/STEPCAFControl/STEPCAFControl_Writer.cdl deleted file mode 100644 index d595d8c329..0000000000 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cdl +++ /dev/null @@ -1,227 +0,0 @@ --- Created on: 2000-08-15 --- Created by: Andrey BETENEV --- Copyright (c) 2000-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 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. - -class Writer from STEPCAFControl --- inherits Writer from STEPControl - - ---Purpose: Provides a tool to write DECAF document to the - -- STEP file. Besides transfer of shapes (including - -- assemblies) provided by STEPControl, supports also - -- colors and part names - -- - -- Also supports multifile writing - -uses - AsciiString from TCollection, - ReturnStatus from IFSelect, - WorkSession from XSControl, - Shape from TopoDS, - Writer from STEPControl, - StepModelType from STEPControl, - DictionaryOfExternFile from STEPCAFControl, - ExternFile from STEPCAFControl, - Label from TDF, - LabelSequence from TDF, - DataMapOfLabelShape from STEPCAFControl, - DataMapOfLabelExternFile from STEPCAFControl, - Document from TDocStd, - DataMapOfShapeTransient from MoniTool - -is - - Create returns Writer; - ---Purpose: Creates a writer with an empty --- STEP model and sets ColorMode, LayerMode, NameMode and --- PropsMode to Standard_True. - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Writer; - ---Purpose: Creates a reader tool and attaches it to an already existing Session - -- Clears the session if it was not yet set for STEP - -- Clears the internal data structures - - Init (me: in out; WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True); - ---Purpose: Clears the internal data structures and attaches to a new session - -- Clears the session if it was not yet set for STEP - - Write (me : in out; filename : CString) - returns ReturnStatus from IFSelect; - ---Purpose: Writes all the produced models into file - -- In case of multimodel with extern references, - -- filename will be a name of root file, all other files - -- have names of corresponding parts - -- Provided for use like single-file writer - - Transfer (me : in out; doc : Document from TDocStd; - mode: StepModelType from STEPControl = STEPControl_AsIs; - multi: CString = 0) - returns Boolean; - Transfer (me : in out; L: Label from TDF; - mode: StepModelType from STEPControl = STEPControl_AsIs; - multi: CString = 0) - returns Boolean; - ---Purpose: Transfers a document (or single label) to a STEP model - -- The mode of translation of shape is AsIs - -- If multi is not null pointer, it switches to multifile - -- mode (with external refs), and string pointed by - -- gives prefix for names of extern files (can be empty string) - -- Returns True if translation is OK - - Perform (me : in out; doc : Document from TDocStd; - filename: AsciiString from TCollection) - returns Boolean; - - Perform (me : in out; doc : Document from TDocStd; filename: CString) - returns Boolean; - ---Purpose : Transfers a document and writes it to a STEP file - -- Returns True if translation is OK - - ---Scope: Access to fields - - ExternFiles (me) returns DictionaryOfExternFile from STEPCAFControl; - ---Purpose: Returns data on external files - -- Returns Null handle if no external files are read - ---C++: return const & - - ExternFile (me; L: Label from TDF; ef: out ExternFile from STEPCAFControl) - returns Boolean; - ---Purpose: Returns data on external file by its original label - -- Returns False if no external file with given name is read - - ExternFile (me; name: CString; ef: out ExternFile from STEPCAFControl) - returns Boolean; - ---Purpose: Returns data on external file by its name - -- Returns False if no external file with given name is read - - ChangeWriter (me: in out) returns Writer from STEPControl; - ---Purpose: Returns basic reader for root file - ---C++: return & - - Writer (me) returns Writer from STEPControl; - ---Purpose: Returns basic reader as const - ---C++: return const & - - ---Scope: Internal methods - - Transfer (me : in out; wr: in out Writer from STEPControl; - labels: LabelSequence from TDF; - mode: StepModelType from STEPControl = STEPControl_AsIs; - multi: CString = 0; - isExternFile: Boolean = Standard_False) - returns Boolean is protected; - ---Purpose: Transfers labels to a STEP model - -- Returns True if translation is OK - -- isExternFile setting from TransferExternFiles method - - TransferExternFiles (me : in out; L: Label from TDF; - mode: StepModelType from STEPControl; - Lseq: out LabelSequence from TDF; - prefix: CString = "") - returns Shape from TopoDS is protected; - ---Purpose: Parses assembly structure of label L, writes all the simple - -- shapes each to its own file named by name of its label plus - -- prefix - -- Returns shape representing that assembly structure - -- in the form of nested empty compounds (and a sequence of - -- labels which are newly written nodes of this assembly) - - WriteExternRefs (me; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write external references to STEP - - WriteColors (me: in out; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write colors assigned to specified labels, to STEP model - - WriteNames (me; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write names assigned to specified labels, to STEP model - - WriteDGTs (me; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write D>s assigned to specified labels, to STEP model - - WriteMaterials (me; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write materials assigned to specified labels, to STEP model - - WriteValProps (me; WS: WorkSession from XSControl; - labels: LabelSequence from TDF; multi: CString) - returns Boolean is protected; - ---Purpose: Write validation properties assigned to specified labels, - -- to STEP model - - WriteLayers (me; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write layers assigned to specified labels, to STEP model - - WriteSHUOs (me: in out; WS: WorkSession from XSControl; labels: LabelSequence from TDF) - returns Boolean is protected; - ---Purpose: Write SHUO assigned to specified component, to STEP model - - --- Work with fileds for different mode of writing STEP file. - - SetColorMode(me: in out; colormode: Boolean from Standard); - ---Purpose: Set ColorMode for indicate write Colors or not. - - GetColorMode(me) returns Boolean; - - SetNameMode(me: in out; namemode: Boolean from Standard); - ---Purpose: Set NameMode for indicate write Name or not. - - GetNameMode(me) returns Boolean; - - SetLayerMode(me: in out; layermode: Boolean from Standard); - ---Purpose: Set LayerMode for indicate write Layers or not. - - GetLayerMode(me) returns Boolean; - - SetPropsMode(me: in out; propsmode: Boolean from Standard); - ---Purpose: PropsMode for indicate write Validation properties or not. - - GetPropsMode(me) returns Boolean; - - SetSHUOMode(me: in out; shuomode: Boolean from Standard); - ---Purpose: Set SHUO mode for indicate write SHUO or not. - - GetSHUOMode(me) returns Boolean; - - SetDimTolMode(me: in out; dimtolmode: Boolean from Standard); - ---Purpose: Set dimtolmode for indicate write D>s or not. - - GetDimTolMode(me) returns Boolean; - - SetMaterialMode(me: in out; matmode: Boolean from Standard); - ---Purpose: Set dimtolmode for indicate write D>s or not. - - GetMaterialMode(me) returns Boolean; - -fields - - myWriter : Writer from STEPControl; - myFiles : DictionaryOfExternFile from STEPCAFControl; - myLabels : DataMapOfLabelShape from STEPCAFControl; - myLabEF : DataMapOfLabelExternFile from STEPCAFControl; - myColorMode: Boolean; - myNameMode : Boolean; - myLayerMode: Boolean; - myPropsMode: Boolean; - mySHUOMode : Boolean; - myMapCompMDGPR : DataMapOfShapeTransient from MoniTool; - myDGTMode : Boolean; - myMatMode : Boolean; - -end Writer; diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index cbcc447214..3507b0ccf5 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -20,7 +20,7 @@ // (analysis of SDRs which the CDSR links should be done) // Names and validation props are supported for top-level shapes only -#include +#include #include #include #include @@ -168,6 +168,17 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + //======================================================================= //function : GetLabelName //purpose : auxilary function: take name of label and append it to str diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.hxx b/src/STEPCAFControl/STEPCAFControl_Writer.hxx new file mode 100644 index 0000000000..510b050fb1 --- /dev/null +++ b/src/STEPCAFControl/STEPCAFControl_Writer.hxx @@ -0,0 +1,197 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPCAFControl_Writer_HeaderFile +#define _STEPCAFControl_Writer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class STEPCAFControl_DictionaryOfExternFile; +class XSControl_WorkSession; +class TDocStd_Document; +class TDF_Label; +class TCollection_AsciiString; +class STEPCAFControl_ExternFile; +class STEPControl_Writer; +class TDF_LabelSequence; +class TopoDS_Shape; + + +//! Provides a tool to write DECAF document to the
+//! STEP file. Besides transfer of shapes (including
+//! assemblies) provided by STEPControl, supports also
+//! colors and part names
+//!
+//! Also supports multifile writing
+class STEPCAFControl_Writer { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a writer with an empty
+//! STEP model and sets ColorMode, LayerMode, NameMode and
+//! PropsMode to Standard_True.
+ Standard_EXPORT STEPCAFControl_Writer(); + //! Creates a reader tool and attaches it to an already existing Session
+//! Clears the session if it was not yet set for STEP
+//! Clears the internal data structures
+ Standard_EXPORT STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Clears the internal data structures and attaches to a new session
+//! Clears the session if it was not yet set for STEP
+ Standard_EXPORT void Init(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ; + //! Writes all the produced models into file
+//! In case of multimodel with extern references,
+//! filename will be a name of root file, all other files
+//! have names of corresponding parts
+//! Provided for use like single-file writer
+ Standard_EXPORT IFSelect_ReturnStatus Write(const Standard_CString filename) ; + + Standard_EXPORT Standard_Boolean Transfer(const Handle(TDocStd_Document)& doc,const STEPControl_StepModelType mode = STEPControl_AsIs,const Standard_CString multi = 0) ; + //! Transfers a document (or single label) to a STEP model
+//! The mode of translation of shape is AsIs
+//! If multi is not null pointer, it switches to multifile
+//! mode (with external refs), and string pointed by
+//! gives prefix for names of extern files (can be empty string)
+//! Returns True if translation is OK
+ Standard_EXPORT Standard_Boolean Transfer(const TDF_Label& L,const STEPControl_StepModelType mode = STEPControl_AsIs,const Standard_CString multi = 0) ; + + Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const TCollection_AsciiString& filename) ; + //! Transfers a document and writes it to a STEP file
+//! Returns True if translation is OK
+ Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const Standard_CString filename) ; + //! Returns data on external files
+//! Returns Null handle if no external files are read
+ Standard_EXPORT const Handle_STEPCAFControl_DictionaryOfExternFile& ExternFiles() const; + //! Returns data on external file by its original label
+//! Returns False if no external file with given name is read
+ Standard_EXPORT Standard_Boolean ExternFile(const TDF_Label& L,Handle(STEPCAFControl_ExternFile)& ef) const; + //! Returns data on external file by its name
+//! Returns False if no external file with given name is read
+ Standard_EXPORT Standard_Boolean ExternFile(const Standard_CString name,Handle(STEPCAFControl_ExternFile)& ef) const; + //! Returns basic reader for root file
+ Standard_EXPORT STEPControl_Writer& ChangeWriter() ; + //! Returns basic reader as const
+ Standard_EXPORT const STEPControl_Writer& Writer() const; + //! Set ColorMode for indicate write Colors or not.
+ Standard_EXPORT void SetColorMode(const Standard_Boolean colormode) ; + + Standard_EXPORT Standard_Boolean GetColorMode() const; + //! Set NameMode for indicate write Name or not.
+ Standard_EXPORT void SetNameMode(const Standard_Boolean namemode) ; + + Standard_EXPORT Standard_Boolean GetNameMode() const; + //! Set LayerMode for indicate write Layers or not.
+ Standard_EXPORT void SetLayerMode(const Standard_Boolean layermode) ; + + Standard_EXPORT Standard_Boolean GetLayerMode() const; + //! PropsMode for indicate write Validation properties or not.
+ Standard_EXPORT void SetPropsMode(const Standard_Boolean propsmode) ; + + Standard_EXPORT Standard_Boolean GetPropsMode() const; + //! Set SHUO mode for indicate write SHUO or not.
+ Standard_EXPORT void SetSHUOMode(const Standard_Boolean shuomode) ; + + Standard_EXPORT Standard_Boolean GetSHUOMode() const; + //! Set dimtolmode for indicate write D>s or not.
+ Standard_EXPORT void SetDimTolMode(const Standard_Boolean dimtolmode) ; + + Standard_EXPORT Standard_Boolean GetDimTolMode() const; + //! Set dimtolmode for indicate write D>s or not.
+ Standard_EXPORT void SetMaterialMode(const Standard_Boolean matmode) ; + + Standard_EXPORT Standard_Boolean GetMaterialMode() const; + + + + + +protected: + + //! Transfers labels to a STEP model
+//! Returns True if translation is OK
+//! isExternFile setting from TransferExternFiles method
+ Standard_EXPORT Standard_Boolean Transfer(STEPControl_Writer& wr,const TDF_LabelSequence& labels,const STEPControl_StepModelType mode = STEPControl_AsIs,const Standard_CString multi = 0,const Standard_Boolean isExternFile = Standard_False) ; + //! Parses assembly structure of label L, writes all the simple
+//! shapes each to its own file named by name of its label plus
+//! prefix
+//! Returns shape representing that assembly structure
+//! in the form of nested empty compounds (and a sequence of
+//! labels which are newly written nodes of this assembly)
+ Standard_EXPORT TopoDS_Shape TransferExternFiles(const TDF_Label& L,const STEPControl_StepModelType mode,TDF_LabelSequence& Lseq,const Standard_CString prefix = "") ; + //! Write external references to STEP
+ Standard_EXPORT Standard_Boolean WriteExternRefs(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) const; + //! Write colors assigned to specified labels, to STEP model
+ Standard_EXPORT Standard_Boolean WriteColors(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) ; + //! Write names assigned to specified labels, to STEP model
+ Standard_EXPORT Standard_Boolean WriteNames(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) const; + //! Write D>s assigned to specified labels, to STEP model
+ Standard_EXPORT Standard_Boolean WriteDGTs(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) const; + //! Write materials assigned to specified labels, to STEP model
+ Standard_EXPORT Standard_Boolean WriteMaterials(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) const; + //! Write validation properties assigned to specified labels,
+//! to STEP model
+ Standard_EXPORT Standard_Boolean WriteValProps(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels,const Standard_CString multi) const; + //! Write layers assigned to specified labels, to STEP model
+ Standard_EXPORT Standard_Boolean WriteLayers(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) const; + //! Write SHUO assigned to specified component, to STEP model
+ Standard_EXPORT Standard_Boolean WriteSHUOs(const Handle(XSControl_WorkSession)& WS,const TDF_LabelSequence& labels) ; + + + + +private: + + + +STEPControl_Writer myWriter; +Handle_STEPCAFControl_DictionaryOfExternFile myFiles; +STEPCAFControl_DataMapOfLabelShape myLabels; +STEPCAFControl_DataMapOfLabelExternFile myLabEF; +Standard_Boolean myColorMode; +Standard_Boolean myNameMode; +Standard_Boolean myLayerMode; +Standard_Boolean myPropsMode; +Standard_Boolean mySHUOMode; +MoniTool_DataMapOfShapeTransient myMapCompMDGPR; +Standard_Boolean myDGTMode; +Standard_Boolean myMatMode; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPConstruct/STEPConstruct.cdl b/src/STEPConstruct/STEPConstruct.cdl index 9ca6406ffd..0f6c885120 100644 --- a/src/STEPConstruct/STEPConstruct.cdl +++ b/src/STEPConstruct/STEPConstruct.cdl @@ -85,13 +85,13 @@ is PointHasher from STEPConstruct); - FindEntity (FinderProcess: FinderProcess from Transfer; Shape: Shape from TopoDS) + FindEntity (FinderProcess: FinderProcess_Handle from Transfer; Shape: Shape from TopoDS) returns RepresentationItem from StepRepr; ---Purpose: Returns STEP entity of the (sub)type of RepresentationItem -- which is a result of the tranalation of the Shape, or Null if -- no result is recorded - FindEntity (FinderProcess: FinderProcess from Transfer; Shape: Shape from TopoDS; + FindEntity (FinderProcess: FinderProcess_Handle from Transfer; Shape: Shape from TopoDS; Loc: out Location from TopLoc) returns RepresentationItem from StepRepr; ---Purpose: The same as above, but in the case if item not found, repeats @@ -99,7 +99,7 @@ is -- location with which result is found (either location of the Shape, -- or Null) - FindShape (TransientProcess: TransientProcess from Transfer; item: RepresentationItem from StepRepr) + FindShape (TransientProcess: TransientProcess_Handle from Transfer; item: RepresentationItem from StepRepr) returns Shape from TopoDS; ---Purpose: Returns Shape resulting from given STEP entity (Null if not mapped) diff --git a/src/STEPConstruct/STEPConstruct.cxx b/src/STEPConstruct/STEPConstruct.cxx index 5ae1a70f17..eb0ac66439 100644 --- a/src/STEPConstruct/STEPConstruct.cxx +++ b/src/STEPConstruct/STEPConstruct.cxx @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/STEPConstruct/STEPConstruct_ExternRefs.cdl b/src/STEPConstruct/STEPConstruct_ExternRefs.cdl index 9a4ca7f9d0..b9a08b171d 100644 --- a/src/STEPConstruct/STEPConstruct_ExternRefs.cdl +++ b/src/STEPConstruct/STEPConstruct_ExternRefs.cdl @@ -26,7 +26,7 @@ class ExternRefs from STEPConstruct inherits Tool from STEPConstruct uses HAsciiString from TCollection, SequenceOfTransient from TColStd, - WorkSession from XSControl, + WorkSession_Handle from XSControl, ProductDefinition from StepBasic, SequenceOfInteger from TColStd, CString from Standard, @@ -42,10 +42,10 @@ is Create returns ExternRefs; ---Purpose: Creates an empty tool - Create (WS: WorkSession from XSControl) returns ExternRefs; + Create (WS: WorkSession_Handle from XSControl) returns ExternRefs; ---Purpose: Creates a tool and initializes it - Init (me: in out; WS: WorkSession from XSControl) returns Boolean; + Init (me: in out; WS: WorkSession_Handle from XSControl) returns Boolean; ---Purpose: Initializes tool; returns True if succeeded Clear (me: in out); diff --git a/src/STEPConstruct/STEPConstruct_Styles.cdl b/src/STEPConstruct/STEPConstruct_Styles.cdl index 6af2e88be2..5e7e3da64d 100644 --- a/src/STEPConstruct/STEPConstruct_Styles.cdl +++ b/src/STEPConstruct/STEPConstruct_Styles.cdl @@ -26,11 +26,11 @@ class Styles from STEPConstruct inherits Tool from STEPConstruct -- with particular implementation of colors (as described in RP) uses - WorkSession from XSControl, + WorkSession_Handle from XSControl, InterfaceModel from Interface, HGraph from Interface, - FinderProcess from Transfer, - TransientProcess from Transfer, + FinderProcess_Handle from Transfer, + TransientProcess_Handle from Transfer, Shape from TopoDS, SequenceOfTransient from TColStd, HSequenceOfTransient from TColStd, @@ -52,10 +52,10 @@ is Create returns Styles; ---Purpose: Creates an empty tool - Create (WS: WorkSession from XSControl) returns Styles; + Create (WS: WorkSession_Handle from XSControl) returns Styles; ---Purpose: Creates a tool and initializes it - Init (me: in out; WS: WorkSession from XSControl) returns Boolean; + Init (me: in out; WS: WorkSession_Handle from XSControl) returns Boolean; ---Purpose: Initializes tool; returns True if succeeded --Basic methods: general work with styles diff --git a/src/STEPConstruct/STEPConstruct_Tool.cdl b/src/STEPConstruct/STEPConstruct_Tool.cdl index ef9df23198..10c9a0cc07 100644 --- a/src/STEPConstruct/STEPConstruct_Tool.cdl +++ b/src/STEPConstruct/STEPConstruct_Tool.cdl @@ -27,28 +27,28 @@ class Tool from STEPConstruct -- this (and derived) tool multiple times uses - WorkSession from XSControl, + WorkSession_Handle from XSControl, InterfaceModel from Interface, Graph from Interface, HGraph from Interface, - FinderProcess from Transfer, - TransientProcess from Transfer + FinderProcess_Handle from Transfer, + TransientProcess_Handle from Transfer is Create returns Tool; ---Purpose: Creates an empty tool - Create (WS: WorkSession from XSControl) returns Tool; + Create (WS: WorkSession_Handle from XSControl) returns Tool; ---Purpose: Creates a tool and loads it with worksession - SetWS (me: in out; WS: WorkSession from XSControl) + SetWS (me: in out; WS: WorkSession_Handle from XSControl) returns Boolean is protected; ---Purpose: Load worksession; returns True if succeeded -- Returns False if either FinderProcess of TransientProcess -- cannot be obtained or are Null - WS (me) returns WorkSession from XSControl; + WS (me) returns WorkSession_Handle from XSControl; ---Purpose: Returns currently loaded WorkSession ---C++: return const & ---C++: inline @@ -62,21 +62,21 @@ is ---C++: return const & ---C++: inline - TransientProcess (me) returns TransientProcess from Transfer; + TransientProcess (me) returns TransientProcess_Handle from Transfer; ---Purpose: Returns TransientProcess (reading; Null if not loaded) ---C++: return const & ---C++: inline - FinderProcess (me) returns FinderProcess from Transfer; + FinderProcess (me) returns FinderProcess_Handle from Transfer; ---Purpose: Returns FinderProcess (writing; Null if not loaded) ---C++: return const & ---C++: inline fields - myWS : WorkSession from XSControl; - myFinderProcess: FinderProcess from Transfer; - myTransientProcess: TransientProcess from Transfer; + myWS : WorkSession_Handle from XSControl; + myFinderProcess: FinderProcess_Handle from Transfer; + myTransientProcess: TransientProcess_Handle from Transfer; myHGraph : HGraph from Interface; -- for optimization (no recomutings) end Tool; diff --git a/src/STEPConstruct/STEPConstruct_ValidationProps.cdl b/src/STEPConstruct/STEPConstruct_ValidationProps.cdl index f43e120f7c..147e8ee6a5 100644 --- a/src/STEPConstruct/STEPConstruct_ValidationProps.cdl +++ b/src/STEPConstruct/STEPConstruct_ValidationProps.cdl @@ -21,11 +21,11 @@ class ValidationProps from STEPConstruct inherits Tool from STEPConstruct -- These are surface area, solid volume and centroid. uses - WorkSession from XSControl, + WorkSession_Handle from XSControl, InterfaceModel from Interface, HGraph from Interface, - FinderProcess from Transfer, - TransientProcess from Transfer, + FinderProcess_Handle from Transfer, + TransientProcess_Handle from Transfer, RepresentationItem from StepRepr, Pnt from gp, Shape from TopoDS, @@ -46,10 +46,10 @@ is Create returns ValidationProps; ---Purpose: Creates an empty tool - Create (WS: WorkSession from XSControl) returns ValidationProps; + Create (WS: WorkSession_Handle from XSControl) returns ValidationProps; ---Purpose: Creates a tool and loads it with worksession - Init (me: in out; WS: WorkSession from XSControl) returns Boolean; + Init (me: in out; WS: WorkSession_Handle from XSControl) returns Boolean; ---Purpose: Load worksession; returns True if succeeded AddProp (me: in out; Shape: Shape from TopoDS; diff --git a/src/STEPControl/FILES b/src/STEPControl/FILES new file mode 100644 index 0000000000..9f009fb332 --- /dev/null +++ b/src/STEPControl/FILES @@ -0,0 +1,10 @@ +STEPControl_ActorWrite.hxx +STEPControl_ActorWrite.cxx +STEPControl_ActorRead.hxx +STEPControl_ActorRead.cxx +STEPControl_Controller.hxx +STEPControl_Controller.cxx +STEPControl_Reader.hxx +STEPControl_Reader.cxx +STEPControl_Writer.hxx +STEPControl_Writer.cxx \ No newline at end of file diff --git a/src/STEPControl/STEPControl.cdl b/src/STEPControl/STEPControl.cdl index 289bbaa304..dd53b277e8 100644 --- a/src/STEPControl/STEPControl.cdl +++ b/src/STEPControl/STEPControl.cdl @@ -64,12 +64,10 @@ is -- - STEPControl_GeometricCurveSet -- translates an Open CASCADE shape into a STEP geometric_curve_set entity. - class Controller; - - class Reader; - class Writer; - - class ActorRead; - class ActorWrite; + imported Controller; + imported Reader; + imported Writer; + imported ActorRead; + imported ActorWrite; end STEPControl; diff --git a/src/STEPControl/STEPControl_ActorRead.cdl b/src/STEPControl/STEPControl_ActorRead.cdl deleted file mode 100644 index 557c23372f..0000000000 --- a/src/STEPControl/STEPControl_ActorRead.cdl +++ /dev/null @@ -1,158 +0,0 @@ --- Created on: 1994-12-21 --- Created by: Dieter THIEMANN --- Copyright (c) 1994-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 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. - -class ActorRead from STEPControl - inherits ActorOfTransientProcess from Transfer - - ---Purpose : This class performs the transfer of an Entity from - -- AP214 and AP203, either Geometric or Topologic. - -- - -- I.E. for each type of Entity, it invokes the appropriate Tool - -- then returns the Binder which contains the Result - -uses - - TransientProcess from Transfer, - Binder from Transfer, - Trsf from gp, - Axis2Placement3d from StepGeom, - Representation from StepRepr, - RepresentationRelationship from StepRepr, - ProductDefinition from StepBasic, - NextAssemblyUsageOccurrence from StepRepr, - ShapeRepresentation from StepShape, - ContextDependentShapeRepresentation from StepShape, - ShapeRepresentationRelationship from StepRepr, - GeometricRepresentationItem from StepGeom, - MappedItem from StepRepr, - FaceSurface from StepShape, - ShapeBinder from TransferBRep, - NMTool from StepToTopoDS, -- To proceed with non-manifold cases (ssv; 13.11.2010) - Shell from TopoDS, - ListOfShape from TopTools, - Compound from TopoDS, - IndexedDataMapOfShapeListOfShape from TopTools - -is - - Create returns mutable ActorRead from STEPControl; - - Recognize (me : mutable; start : Transient) returns Boolean is redefined; - - Transfer (me : mutable; start : Transient; - TP : mutable TransientProcess from Transfer) - returns mutable Binder from Transfer is redefined; - -- calls TransferShape - - TransferShape (me : mutable; - start : Transient; - TP : mutable TransientProcess from Transfer; - isManifold : Boolean = Standard_True) - returns mutable Binder from Transfer; - - ---Private: unit and uncertainty context management - - PrepareUnits (me : mutable; rep: Representation from StepRepr; - TP: mutable TransientProcess from Transfer); - ---Purpose: set units and tolerances context by given ShapeRepresentation - - ResetUnits (me: mutable); - ---Purpose: reset units and tolerances context to default - --- (mm, radians, read.precision.val, etc.) - - ComputeTransformation (me: mutable; Origin, Target: Axis2Placement3d from StepGeom; - OrigContext, TargContext: Representation from StepRepr; - TP: mutable TransientProcess from Transfer; - Trsf: out Trsf from gp) - returns Boolean; - ---Purpose: Computes transformation defined by two axis placements (in MAPPED_ITEM - -- or ITEM_DEFINED_TRANSFORMATION) taking into account their - -- representation contexts (i.e. units, which may be different) - -- Returns True if transformation is computed and is not an identity. - - ComputeSRRWT (me: mutable; SRR: RepresentationRelationship from StepRepr; - TP: mutable TransientProcess from Transfer; - Trsf: out Trsf from gp) - returns Boolean; - ---Purpose: Computes transformation defined by given - -- REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION - - TransferEntity(me: mutable; PD : ProductDefinition from StepBasic; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers product definition entity - - - TransferEntity(me: mutable; NAUO : NextAssemblyUsageOccurrence from StepRepr; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers next assembly usage occurence entity - - TransferEntity(me: mutable; sr : ShapeRepresentation from StepShape; - TP : mutable TransientProcess from Transfer; - isBound : out Boolean ) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers shape representation entity - - - TransferEntity(me: mutable; CDSR : ContextDependentShapeRepresentation from StepShape; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers context dependent shape representation entity - - TransferEntity(me: mutable; und : ShapeRepresentationRelationship from StepRepr; - TP : mutable TransientProcess from Transfer; - nbrep : Integer =0) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers shape representation relationship entity - - - TransferEntity(me : mutable; - git : GeometricRepresentationItem from StepGeom; - TP : mutable TransientProcess from Transfer; - isManifold : Boolean) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers geometric representation item entity such as ManifoldSolidBRep ,...etc - - TransferEntity(me: mutable; mapit : MappedItem from StepRepr; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers mapped item - - TransferEntity(me: mutable; fs : FaceSurface from StepShape; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Transfers FaceSurface entity - - OldWay(me: mutable; start : Transient; - TP : mutable TransientProcess from Transfer) returns mutable ShapeBinder from TransferBRep is protected; - ---Purpose:Tranlates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off. - - closeIDEASShell(me : mutable; - shell : in Shell from TopoDS; - closingShells : in ListOfShape from TopTools) - returns Shell from TopoDS - is private; - - computeIDEASClosings(me : mutable; - comp : in Compound from TopoDS; - shellClosingMap : in out IndexedDataMapOfShapeListOfShape from TopTools) - is private; - -fields - --- theUnitFactor : Real; -- Conversion unit factor. --- theVTol : Real; -- Tolerance for Vertices --- theETol : Real; -- Tolerance for Edges --- theFTol : Real; -- Tolerance for Faces - myNMTool : NMTool from StepToTopoDS; -- To proceed with non-manifold cases (ssv; 13.11.2010) - myPrecision : Real; - myMaxTol : Real; - mySRContext: Representation from StepRepr; -- context for unuts - -end ActorRead; diff --git a/src/STEPControl/STEPControl_ActorRead.cxx b/src/STEPControl/STEPControl_ActorRead.cxx index a2d4a953c7..df08fc3db8 100644 --- a/src/STEPControl/STEPControl_ActorRead.cxx +++ b/src/STEPControl/STEPControl_ActorRead.cxx @@ -15,9 +15,9 @@ //:n4 abv 11.02.99 S4132: recognition of GeometricSet (instead of GeometricCurveSet) // gka 05.04.99 S4136: eliminate parameter lastpreci //gka,abv 14.04.99 S4136: maintain unit context, precision and maxtolerance values -#include +#include #include - +#include // #include // pour mise au point #include @@ -126,6 +126,21 @@ #define TRANSLOG + +IMPLEMENT_STANDARD_TYPE(STEPControl_ActorRead) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_ActorOfTransientProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPControl_ActorRead) + + +IMPLEMENT_DOWNCAST(STEPControl_ActorRead,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPControl_ActorRead) + + // ============================================================================ // Function: DumpWhatIs // Purpose: Use it in DEB mode to dump your shapes diff --git a/src/STEPControl/STEPControl_ActorRead.hxx b/src/STEPControl/STEPControl_ActorRead.hxx new file mode 100644 index 0000000000..fcdbb4d89e --- /dev/null +++ b/src/STEPControl/STEPControl_ActorRead.hxx @@ -0,0 +1,153 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPControl_ActorRead_HeaderFile +#define _STEPControl_ActorRead_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StepRepr_Representation; +class Standard_Transient; +class Transfer_Binder; +class Transfer_TransientProcess; +class StepGeom_Axis2Placement3d; +class gp_Trsf; +class StepRepr_RepresentationRelationship; +class TransferBRep_ShapeBinder; +class StepBasic_ProductDefinition; +class StepRepr_NextAssemblyUsageOccurrence; +class StepShape_ShapeRepresentation; +class StepShape_ContextDependentShapeRepresentation; +class StepRepr_ShapeRepresentationRelationship; +class StepGeom_GeometricRepresentationItem; +class StepRepr_MappedItem; +class StepShape_FaceSurface; +class TopoDS_Shell; +class TopTools_ListOfShape; +class TopoDS_Compound; +class TopTools_IndexedDataMapOfShapeListOfShape; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_ActorOfTransientProcess); +class STEPControl_ActorRead; + +DEFINE_STANDARD_HANDLE(STEPControl_ActorRead,Transfer_ActorOfTransientProcess) + + +//! This class performs the transfer of an Entity from
+//! AP214 and AP203, either Geometric or Topologic.
+//!
+//! I.E. for each type of Entity, it invokes the appropriate Tool
+//! then returns the Binder which contains the Result
+class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess { + +public: + + + Standard_EXPORT STEPControl_ActorRead(); + + Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Standard_Transient)& start) ; + + Standard_EXPORT virtual Handle_Transfer_Binder Transfer(const Handle(Standard_Transient)& start,const Handle(Transfer_TransientProcess)& TP) ; + + Standard_EXPORT Handle_Transfer_Binder TransferShape(const Handle(Standard_Transient)& start,const Handle(Transfer_TransientProcess)& TP,const Standard_Boolean isManifold = Standard_True) ; + //! set units and tolerances context by given ShapeRepresentation
+ Standard_EXPORT void PrepareUnits(const Handle(StepRepr_Representation)& rep,const Handle(Transfer_TransientProcess)& TP) ; + //! reset units and tolerances context to default
+//! (mm, radians, read.precision.val, etc.)
+ Standard_EXPORT void ResetUnits() ; + //! Computes transformation defined by two axis placements (in MAPPED_ITEM
+//! or ITEM_DEFINED_TRANSFORMATION) taking into account their
+//! representation contexts (i.e. units, which may be different)
+//! Returns True if transformation is computed and is not an identity.
+ Standard_EXPORT Standard_Boolean ComputeTransformation(const Handle(StepGeom_Axis2Placement3d)& Origin,const Handle(StepGeom_Axis2Placement3d)& Target,const Handle(StepRepr_Representation)& OrigContext,const Handle(StepRepr_Representation)& TargContext,const Handle(Transfer_TransientProcess)& TP,gp_Trsf& Trsf) ; + //! Computes transformation defined by given
+//! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
+ Standard_EXPORT Standard_Boolean ComputeSRRWT(const Handle(StepRepr_RepresentationRelationship)& SRR,const Handle(Transfer_TransientProcess)& TP,gp_Trsf& Trsf) ; + + + + + DEFINE_STANDARD_RTTI(STEPControl_ActorRead) + +protected: + + //!Transfers product definition entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepBasic_ProductDefinition)& PD,const Handle(Transfer_TransientProcess)& TP) ; + //!Transfers next assembly usage occurence entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,const Handle(Transfer_TransientProcess)& TP) ; + //!Transfers shape representation entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepShape_ShapeRepresentation)& sr,const Handle(Transfer_TransientProcess)& TP,Standard_Boolean& isBound) ; + //!Transfers context dependent shape representation entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,const Handle(Transfer_TransientProcess)& TP) ; + //!Transfers shape representation relationship entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepRepr_ShapeRepresentationRelationship)& und,const Handle(Transfer_TransientProcess)& TP,const Standard_Integer nbrep = 0) ; + //!Transfers geometric representation item entity such as ManifoldSolidBRep ,...etc
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepGeom_GeometricRepresentationItem)& git,const Handle(Transfer_TransientProcess)& TP,const Standard_Boolean isManifold) ; + //!Transfers mapped item
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepRepr_MappedItem)& mapit,const Handle(Transfer_TransientProcess)& TP) ; + //!Transfers FaceSurface entity
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder TransferEntity(const Handle(StepShape_FaceSurface)& fs,const Handle(Transfer_TransientProcess)& TP) ; + //!Tranlates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off.
+ Standard_EXPORT Handle_TransferBRep_ShapeBinder OldWay(const Handle(Standard_Transient)& start,const Handle(Transfer_TransientProcess)& TP) ; + + + +private: + + + Standard_EXPORT TopoDS_Shell closeIDEASShell(const TopoDS_Shell& shell,const TopTools_ListOfShape& closingShells) ; + + Standard_EXPORT void computeIDEASClosings(const TopoDS_Compound& comp,TopTools_IndexedDataMapOfShapeListOfShape& shellClosingMap) ; + +StepToTopoDS_NMTool myNMTool; +Standard_Real myPrecision; +Standard_Real myMaxTol; +Handle_StepRepr_Representation mySRContext; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPControl/STEPControl_ActorWrite.cdl b/src/STEPControl/STEPControl_ActorWrite.cdl deleted file mode 100644 index 916f6f3580..0000000000 --- a/src/STEPControl/STEPControl_ActorWrite.cdl +++ /dev/null @@ -1,116 +0,0 @@ --- Created on: 1995-01-31 --- Created by: Dieter THIEMANN --- 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 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. - -class ActorWrite from STEPControl - inherits ActorOfFinderProcess from Transfer - - ---Purpose : This class performs the transfer of a Shape from TopoDS - -- to AP203 or AP214 (CD2 or DIS) - - -uses FinderProcess, TransientProcess, Binder, Finder, StepModel from StepData, - Shape from TopoDS, - StepModelType from STEPControl, - Axis2Placement3d from StepGeom, - ShapeRepresentation from StepShape, - ShapeDefinitionRepresentation from StepShape, - HAsciiString from TCollection, - ContextTool from STEPConstruct, - Part from STEPConstruct, - HSequenceOfShape from TopTools, -- For non-manifold topology processing (ssv; 13.11.2010) - NonManifoldSurfaceShapeRepresentation from StepShape -- For non-manifold topology processing (ssv; 13.11.2010) - -is - - Create returns mutable ActorWrite from STEPControl; - - Recognize (me : mutable; start : Finder) returns Boolean is redefined; - - Transfer (me : mutable; start : Finder; FP : mutable FinderProcess) - returns mutable Binder is redefined; - -- enchains : TransferShape , MakeProductData , and manages mode - -- "simple" or in Assembly - - TransferSubShape (me : mutable; start : Finder; - SDR : ShapeDefinitionRepresentation from StepShape; - AX1 : out Axis2Placement3d from StepGeom; - FP : mutable FinderProcess; - shapeGroup : HSequenceOfShape from TopTools = NULL; - isManifold : Boolean = Standard_True) - returns mutable Binder; - - TransferShape (me : mutable; start : Finder; - SDR : ShapeDefinitionRepresentation from StepShape; - FP : mutable FinderProcess; - shapeGroup : HSequenceOfShape from TopTools = NULL; - isManifold : Boolean = Standard_True) - returns mutable Binder; - - TransferCompound (me : mutable; start : Finder; - SDR : ShapeDefinitionRepresentation from StepShape; - FP : mutable FinderProcess) - returns mutable Binder; - --- InitProductData (me: mutable) returns Part from STEPConstruct; - --- MakeProductData (me : mutable; --- SR : ShapeRepresentation from StepShape; --- SDRTool : Part from STEPConstruct; --- model : StepModel from StepData; --- addPRPC : Boolean) --- returns mutable Binder; - - - SetMode (me : mutable; M : StepModelType from STEPControl); - - Mode (me) returns StepModelType from STEPControl; - - SetGroupMode (me : mutable; mode : Integer); - -- Default is 0 (no group item) - -- 1 for REPRESENTATION_RELATIONSHIP with ITEM_DEFINED_TRANSFORMATION - -- other positive values if needed (not implemented) - - GroupMode (me) returns Integer; - - SetTolerance (me : mutable; Tol : Real); - -- Tol <= 0 means Unset - - IsAssembly (me; S: in out Shape from TopoDS) returns Boolean is virtual; - ---Purpose: Customizable method to check whether shape S should - -- be written as assembly or not - -- Default implementation uses flag GroupMode and analyses - -- the shape itself - -- NOTE: this method can modify shape - - getNMSSRForGroup (me; - shapeGroup : HSequenceOfShape from TopTools; - FP : mutable FinderProcess; - isNMSSRCreated : in out Boolean) - returns NonManifoldSurfaceShapeRepresentation from StepShape - is private; - ---Purpose: Non-manifold shapes are stored in NMSSR group - -- (NON_MANIFOLD_SURFACE_SHAPE_REPRESENTATION). - -- Use this method to get the corresponding NMSSR (or - -- to create a new one if doesn't exist yet) - -- (ssv; 13.11.2010) - -fields - - mygroup : Integer; - mytoler : Real; - myContext: ContextTool from STEPConstruct; - -end ActorWrite; diff --git a/src/STEPControl/STEPControl_ActorWrite.cxx b/src/STEPControl/STEPControl_ActorWrite.cxx index e7c1c1434f..16fbbebec6 100644 --- a/src/STEPControl/STEPControl_ActorWrite.cxx +++ b/src/STEPControl/STEPControl_ActorWrite.cxx @@ -16,7 +16,7 @@ //abv,gka 05.04.99: S4136: change parameters and update units // PTV 22.08.2002 OCC609 transfer solo vertices into step file. // PTV 16.09.2002 OCC725 transfer compound of vertices into one geometrical curve set. -#include +#include #include // Transfer @@ -115,6 +115,19 @@ #include #include +IMPLEMENT_STANDARD_TYPE(STEPControl_ActorWrite) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_ActorOfFinderProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPControl_ActorWrite) + + +IMPLEMENT_DOWNCAST(STEPControl_ActorWrite,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPControl_ActorWrite) + // ============================================================================ // Function: DumpWhatIs // Purpose: Use it in DEB mode to dump your shapes @@ -322,7 +335,7 @@ void STEPControl_ActorWrite::SetMode (const STEPControl_StepModelType M) STEPControl_StepModelType STEPControl_ActorWrite::Mode () const { - switch (themodetrans) { + switch (myModeTrans) { case 0 : return STEPControl_AsIs; case 1 : return STEPControl_FacetedBrep; case 2 : return STEPControl_ShellBasedSurfaceModel; diff --git a/src/STEPControl/STEPControl_ActorWrite.hxx b/src/STEPControl/STEPControl_ActorWrite.hxx new file mode 100644 index 0000000000..6f10326565 --- /dev/null +++ b/src/STEPControl/STEPControl_ActorWrite.hxx @@ -0,0 +1,118 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPControl_ActorWrite_HeaderFile +#define _STEPControl_ActorWrite_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Transfer_Finder; +class Transfer_Binder; +class Transfer_FinderProcess; +class StepShape_ShapeDefinitionRepresentation; +class StepGeom_Axis2Placement3d; +class TopTools_HSequenceOfShape; +class TopoDS_Shape; +class StepShape_NonManifoldSurfaceShapeRepresentation; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_ActorOfFinderProcess); +class STEPControl_ActorWrite; + +DEFINE_STANDARD_HANDLE(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess) + +//! This class performs the transfer of a Shape from TopoDS
+//! to AP203 or AP214 (CD2 or DIS)
+class STEPControl_ActorWrite : public Transfer_ActorOfFinderProcess +{ + +public: + + + Standard_EXPORT STEPControl_ActorWrite(); + + Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Transfer_Finder)& start) ; + + Standard_EXPORT virtual Handle_Transfer_Binder Transfer(const Handle(Transfer_Finder)& start, + const Handle(Transfer_FinderProcess)& FP) ; + + Standard_EXPORT Handle_Transfer_Binder TransferSubShape(const Handle(Transfer_Finder)& start, + const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, + Handle(StepGeom_Axis2Placement3d)& AX1, + const Handle(Transfer_FinderProcess)& FP, + const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, + const Standard_Boolean isManifold = Standard_True) ; + + Standard_EXPORT Handle_Transfer_Binder TransferShape(const Handle(Transfer_Finder)& start, + const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, + const Handle(Transfer_FinderProcess)& FP, + const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, + const Standard_Boolean isManifold = Standard_True) ; + + Standard_EXPORT Handle_Transfer_Binder TransferCompound(const Handle(Transfer_Finder)& start, + const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, + const Handle(Transfer_FinderProcess)& FP) ; + + Standard_EXPORT void SetMode(const STEPControl_StepModelType M) ; + + Standard_EXPORT STEPControl_StepModelType Mode() const; + + Standard_EXPORT void SetGroupMode(const Standard_Integer mode) ; + + Standard_EXPORT Standard_Integer GroupMode() const; + + Standard_EXPORT void SetTolerance(const Standard_Real Tol) ; + + //! Customizable method to check whether shape S should
+ //! be written as assembly or not
+ //! Default implementation uses flag GroupMode and analyses
+ //! the shape itself
+ //! NOTE: this method can modify shape
+ Standard_EXPORT virtual Standard_Boolean IsAssembly(TopoDS_Shape& S) const; + + DEFINE_STANDARD_RTTI(STEPControl_ActorWrite) + +private: + + //! Non-manifold shapes are stored in NMSSR group
+ //! (NON_MANIFOLD_SURFACE_SHAPE_REPRESENTATION).
+ //! Use this method to get the corresponding NMSSR (or
+ //! to create a new one if doesn't exist yet)
+ //! (ssv; 13.11.2010)
+ Standard_EXPORT Handle(StepShape_NonManifoldSurfaceShapeRepresentation) getNMSSRForGroup(const Handle(TopTools_HSequenceOfShape)& shapeGroup, + const Handle(Transfer_FinderProcess)& FP, + Standard_Boolean& isNMSSRCreated) const; + + Standard_Integer mygroup; + Standard_Real mytoler; + STEPConstruct_ContextTool myContext; +}; +#endif diff --git a/src/STEPControl/STEPControl_Controller.cdl b/src/STEPControl/STEPControl_Controller.cdl deleted file mode 100644 index 19a349725b..0000000000 --- a/src/STEPControl/STEPControl_Controller.cdl +++ /dev/null @@ -1,71 +0,0 @@ --- Created on: 1995-02-20 --- Created by: Christian CAILLET --- 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 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. - -class Controller from STEPControl inherits Controller from XSControl - - ---Purpose : defines basic controller for STEP processor - -uses - - CString, - Protocol from Interface, - InterfaceModel from Interface, - WorkLibrary from IFSelect, - ReturnStatus from IFSelect, - ActorOfTransientProcess from Transfer, - FinderProcess from Transfer, - ActorOfFinderProcess from Transfer, - Shape from TopoDS, - WorkSession from XSControl - -is - - Create returns mutable Controller from STEPControl; - ---Purpose : Initializes the use of STEP Norm (the first time) and - -- returns a Controller - - NewModel (me) returns mutable InterfaceModel from Interface; - ---Purpose : Creates a new empty Model ready to receive data of the Norm. - -- It is taken from STEP Template Model - - ActorRead (me; model : InterfaceModel) - returns mutable ActorOfTransientProcess from Transfer; - ---Purpose : Returns a new Actor for Read attached to the pair (norm,appli) - -- It is a PmsToTopoDSAct_Actor - - -- Redefined Transfer for Write (using Actor) -- - Customise (me: mutable; WS : in out WorkSession from XSControl) is redefined; - - TransferWriteShape (me; shape : Shape from TopoDS; - FP : mutable FinderProcess from Transfer; - model : mutable InterfaceModel from Interface; - modetrans : Integer = 0) returns ReturnStatus - is redefined; - ---Purpose : Takes one Shape and transfers it to the InterfaceModel - -- (already created by NewModel for instance) - -- is to be interpreted by each kind of XstepAdaptor - -- Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape - -- -2 bad model (requires a StepModel) - -- modeshape : 1 Facetted BRep, 2 Shell, 3 Manifold Solid - - -- for global initialisation - - Init (myclass) returns Boolean; - ---Purpose : Standard Initialisation. It creates a Controller for STEP - -- and records it to various names, available to select it later - -- Returns True when done, False if could not be done - -end Controller; diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index ded953084a..82dcd952fe 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -13,14 +13,14 @@ //:j4 gka 16.03.99 S4134 // gka 05.04.99 S4136: parameters definitions changed -#include +#include #include #include #include //#include #include - +#include #include #include #include @@ -55,7 +55,24 @@ #include #include #include +#include +#include +#include +#include +#include +IMPLEMENT_STANDARD_TYPE(STEPControl_Controller) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(XSControl_Controller), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPControl_Controller) + + +IMPLEMENT_DOWNCAST(STEPControl_Controller,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPControl_Controller) STEPControl_Controller::STEPControl_Controller () : XSControl_Controller ("STEP", "step") diff --git a/src/STEPControl/STEPControl_Controller.hxx b/src/STEPControl/STEPControl_Controller.hxx new file mode 100644 index 0000000000..63947fc44b --- /dev/null +++ b/src/STEPControl/STEPControl_Controller.hxx @@ -0,0 +1,96 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPControl_Controller_HeaderFile +#define _STEPControl_Controller_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceModel; +class Transfer_ActorOfTransientProcess; +class XSControl_WorkSession; +class TopoDS_Shape; +class Transfer_FinderProcess; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(XSControl_Controller); +class STEPControl_Controller; + +DEFINE_STANDARD_HANDLE(STEPControl_Controller,XSControl_Controller) + +//! defines basic controller for STEP processor
+class STEPControl_Controller : public XSControl_Controller { + +public: + + //! Initializes the use of STEP Norm (the first time) and
+//! returns a Controller
+ Standard_EXPORT STEPControl_Controller(); + //! Creates a new empty Model ready to receive data of the Norm.
+//! It is taken from STEP Template Model
+ Standard_EXPORT Handle_Interface_InterfaceModel NewModel() const; + //! Returns a new Actor for Read attached to the pair (norm,appli)
+//! It is a PmsToTopoDSAct_Actor
+ Standard_EXPORT Handle_Transfer_ActorOfTransientProcess ActorRead(const Handle(Interface_InterfaceModel)& model) const; + + Standard_EXPORT virtual void Customise(Handle(XSControl_WorkSession)& WS) ; + //! Takes one Shape and transfers it to the InterfaceModel
+//! (already created by NewModel for instance)
+//! is to be interpreted by each kind of XstepAdaptor
+//! Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape
+//! -2 bad model (requires a StepModel)
+//! modeshape : 1 Facetted BRep, 2 Shell, 3 Manifold Solid
+ Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& shape,const Handle(Transfer_FinderProcess)& FP,const Handle(Interface_InterfaceModel)& model,const Standard_Integer modetrans = 0) const; + //! Standard Initialisation. It creates a Controller for STEP
+//! and records it to various names, available to select it later
+//! Returns True when done, False if could not be done
+ Standard_EXPORT static Standard_Boolean Init() ; + + + + + DEFINE_STANDARD_RTTI(STEPControl_Controller) + +protected: + + + + +private: + + + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPControl/STEPControl_Reader.cdl b/src/STEPControl/STEPControl_Reader.cdl deleted file mode 100644 index 6314ac59eb..0000000000 --- a/src/STEPControl/STEPControl_Reader.cdl +++ /dev/null @@ -1,102 +0,0 @@ --- Created on: 1996-07-08 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class Reader from STEPControl inherits Reader from XSControl - - ---Purpose : Reads STEP files, checks them and translates their contents - -- into Open CASCADE models. The STEP data can be that of - -- a whole model or that of a specific list of entities in the model. - -- As in XSControl_Reader, you specify the list using a selection. - -- For the translation of iges files it is possible to use next sequence: - -- To change translation parameters - -- class Interface_Static should be used before beginning of - -- translation (see STEP Parameters and General Parameters) - -- Creation of reader - STEPControl_Reader reader; - -- To load s file in a model use method reader.ReadFile("filename.stp") - -- To print load results reader.PrintCheckLoad(failsonly,mode) - -- where mode is equal to the value of enumeration IFSelect_PrintCount - -- For definition number of candidates : - -- Standard_Integer nbroots = reader. NbRootsForTransfer(); - -- To transfer entities from a model the following methods can be used: - -- for the whole model - reader.TransferRoots(); - -- to transfer a list of entities: reader.TransferList(list); - -- to transfer one entity Handle(Standard_Transient) - -- ent = reader.RootForTransfer(num); - -- reader.TransferEntity(ent), or - -- reader.TransferOneRoot(num), or - -- reader.TransferOne(num), or - -- reader.TransferRoot(num) - -- To obtain the result the following method can be used: - -- reader.NbShapes() and reader.Shape(num); or reader.OneShape(); - -- To print the results of transfer use method: - -- reader.PrintCheckTransfer(failwarn,mode); - -- where printfail is equal to the value of enumeration - -- IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer(); - -- Gets correspondence between a STEP entity and a result - -- shape obtained from it. - -- Handle(XSControl_WorkSession) - -- WS = reader.WS(); - -- if ( WS->TransferReader()->HasResult(ent) ) - -- TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent); - -uses - - CString, OStream, Transient, SequenceOfTransient from TColStd, - StepModel from StepData, WorkSession from XSControl, - ReturnStatus from IFSelect, PrintCount from IFSelect, - Shape from TopoDS, SequenceOfShape from TopTools, - SequenceOfAsciiString from TColStd, - Array1OfAsciiString from TColStd, - Array1OfReal from TColStd, - SequenceOfAsciiString from TColStd, - RepresentationContext from StepRepr -is - - Create returns Reader; - ---Purpose : Creates a reader object with an empty STEP model. - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Reader; - ---Purpose : Creates a Reader for STEP from an already existing Session - -- Clears the session if it was not yet set for STEP - - StepModel (me) returns StepModel; - ---Purpose : Returns the model as a StepModel. - -- It can then be consulted (header, product) - - TransferRoot (me : in out; num : Integer = 1) returns Boolean; - ---Purpose : Transfers a root given its rank in the list of candidate roots - -- Default is the first one - -- Returns True if a shape has resulted, false else - -- Same as inherited TransferOneRoot, kept for compatibility - - NbRootsForTransfer (me : in out) returns Integer is redefined; - ---Purpose : Determines the list of root entities from Model which are candidate for - -- a transfer to a Shape (type of entities is PRODUCT) - - FileUnits(me : in out; theUnitLengthNames : in out SequenceOfAsciiString from TColStd; - theUnitAngleNames : in out SequenceOfAsciiString from TColStd; - theUnitSolidAngleNames : in out SequenceOfAsciiString from TColStd ); - ---Purpose : Returns sequence of all unit names for shape representations - -- found in file - - findUnits(me : in out ; theReprContext : RepresentationContext from StepRepr; - theNameUnits : in out Array1OfAsciiString from TColStd; - theFactorUnits : in out Array1OfReal from TColStd) returns Boolean is private; - ---Purpose : Returns units for length , angle and solidangle for shape representations - - -end Reader; diff --git a/src/STEPControl/STEPControl_Reader.cxx b/src/STEPControl/STEPControl_Reader.cxx index a55122923a..3d010b0b9c 100644 --- a/src/STEPControl/STEPControl_Reader.cxx +++ b/src/STEPControl/STEPControl_Reader.cxx @@ -11,14 +11,13 @@ // 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 @@ -68,6 +67,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include //======================================================================= //function : STEPControl_Reader @@ -552,4 +557,3 @@ Standard_Boolean STEPControl_Reader::findUnits( return (nbFind); } - diff --git a/src/STEPControl/STEPControl_Reader.hxx b/src/STEPControl/STEPControl_Reader.hxx new file mode 100644 index 0000000000..fbed3be5f8 --- /dev/null +++ b/src/STEPControl/STEPControl_Reader.hxx @@ -0,0 +1,126 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPControl_Reader_HeaderFile +#define _STEPControl_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class StepData_StepModel; +class TColStd_SequenceOfAsciiString; +class StepRepr_RepresentationContext; +class TColStd_Array1OfAsciiString; +class TColStd_Array1OfReal; + + +//! Reads STEP files, checks them and translates their contents
+//! into Open CASCADE models. The STEP data can be that of
+//! a whole model or that of a specific list of entities in the model.
+//! As in XSControl_Reader, you specify the list using a selection.
+//! For the translation of iges files it is possible to use next sequence:
+//! To change translation parameters
+//! class Interface_Static should be used before beginning of
+//! translation (see STEP Parameters and General Parameters)
+//! Creation of reader - STEPControl_Reader reader;
+//! To load s file in a model use method reader.ReadFile("filename.stp")
+//! To print load results reader.PrintCheckLoad(failsonly,mode)
+//! where mode is equal to the value of enumeration IFSelect_PrintCount
+//! For definition number of candidates :
+//! Standard_Integer nbroots = reader. NbRootsForTransfer();
+//! To transfer entities from a model the following methods can be used:
+//! for the whole model - reader.TransferRoots();
+//! to transfer a list of entities: reader.TransferList(list);
+//! to transfer one entity Handle(Standard_Transient)
+//! ent = reader.RootForTransfer(num);
+//! reader.TransferEntity(ent), or
+//! reader.TransferOneRoot(num), or
+//! reader.TransferOne(num), or
+//! reader.TransferRoot(num)
+//! To obtain the result the following method can be used:
+//! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
+//! To print the results of transfer use method:
+//! reader.PrintCheckTransfer(failwarn,mode);
+//! where printfail is equal to the value of enumeration
+//! IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer();
+//! Gets correspondence between a STEP entity and a result
+//! shape obtained from it.
+//! Handle(XSControl_WorkSession)
+//! WS = reader.WS();
+//! if ( WS->TransferReader()->HasResult(ent) )
+//! TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);
+class STEPControl_Reader : public XSControl_Reader { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a reader object with an empty STEP model.
+ Standard_EXPORT STEPControl_Reader(); + //! Creates a Reader for STEP from an already existing Session
+//! Clears the session if it was not yet set for STEP
+ Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Returns the model as a StepModel.
+//! It can then be consulted (header, product)
+ Standard_EXPORT Handle_StepData_StepModel StepModel() const; + //! Transfers a root given its rank in the list of candidate roots
+//! Default is the first one
+//! Returns True if a shape has resulted, false else
+//! Same as inherited TransferOneRoot, kept for compatibility
+ Standard_EXPORT Standard_Boolean TransferRoot(const Standard_Integer num = 1) ; + //! Determines the list of root entities from Model which are candidate for
+//! a transfer to a Shape (type of entities is PRODUCT)
+ Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() ; + //! Returns sequence of all unit names for shape representations
+//! found in file
+ Standard_EXPORT void FileUnits(TColStd_SequenceOfAsciiString& theUnitLengthNames,TColStd_SequenceOfAsciiString& theUnitAngleNames,TColStd_SequenceOfAsciiString& theUnitSolidAngleNames) ; + + + + + +protected: + + + + + +private: + + //! Returns units for length , angle and solidangle for shape representations
+ Standard_EXPORT Standard_Boolean findUnits(const Handle(StepRepr_RepresentationContext)& theReprContext,TColStd_Array1OfAsciiString& theNameUnits,TColStd_Array1OfReal& theFactorUnits) ; + + + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPControl/STEPControl_Writer.cdl b/src/STEPControl/STEPControl_Writer.cdl deleted file mode 100644 index e42b60a9c8..0000000000 --- a/src/STEPControl/STEPControl_Writer.cdl +++ /dev/null @@ -1,111 +0,0 @@ --- Created on: 1996-07-08 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class Writer from STEPControl - - ---Purpose : This class creates and writes - -- STEP files from Open CASCADE models. A STEP file can be - -- written to an existing STEP file or to a new one. - -- Translation can be performed in one or several operations. Each - -- translation operation outputs a distinct root entity in the STEP file. - -uses - - CString, - StepModel from StepData, WorkSession from XSControl, - ReturnStatus from IFSelect, - Shape from TopoDS, - StepModelType from STEPControl - -is - - Create returns Writer; - ---Purpose : Creates a Writer from scratch - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Writer; - ---Purpose : Creates a Writer from an already existing Session - -- If is True (D), clears already recorded data - - SetTolerance (me : in out; Tol : Real); - ---Purpose : Sets a length-measure value that - -- will be written to uncertainty-measure-with-unit - -- when the next shape is translated. - - UnsetTolerance (me : in out); - ---Purpose : Unsets the tolerance formerly forced by SetTolerance - - SetWS (me : in out; WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True); - ---Purpose : Sets a specific session to - - WS (me) returns WorkSession from XSControl; - ---Purpose : Returns the session used in - - Model (me : in out; newone : Boolean = Standard_False) returns StepModel; - ---Purpose : Returns the produced model. Produces a new one if not yet done - -- or if is True - -- This method allows for instance to edit product or header - -- data before writing. - - Transfer (me : in out; sh : Shape from TopoDS; - mode : StepModelType from STEPControl; - compgraph : Boolean = Standard_True) - returns ReturnStatus; - ---Purpose : Translates shape sh to a STEP - -- entity. mode defines the STEP entity type to be output: - -- - STEPControlStd_AsIs translates a shape to its highest possible - -- STEP representation. - -- - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP - -- manifold_solid_brep or brep_with_voids entity. - -- - STEPControlStd_FacetedBrep translates a shape into a STEP - -- faceted_brep entity. - -- - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP - -- shell_based_surface_model entity. - -- - STEPControlStd_GeometricCurveSet translates a shape into a STEP - -- geometric_curve_set entity. - - - Write (me : in out; filename : CString) returns ReturnStatus; - ---Purpose : Writes a STEP model in the file identified by filename. - - PrintStatsTransfer (me; what : Integer; mode : Integer = 0); - ---Purpose : Displays the statistics for the - -- last translation. what defines the kind of statistics that are displayed: - -- - 0 gives general statistics (number of translated roots, - -- number of warnings, number of fail messages), - -- - 1 gives root results, - -- - 2 gives statistics for all checked entities, - -- - 3 gives the list of translated entities, - -- - 4 gives warning and fail messages, - -- - 5 gives fail messages only. - -- mode is used according to the use of what. If what is 0, mode is - -- ignored. If what is 1, 2 or 3, mode defines the following: - -- - 0 lists the numbers of STEP entities in a STEP model, - -- - 1 gives the number, identifier, type and result type for each - -- STEP entity and/or its status (fail, warning, etc.), - -- - 2 gives maximum information for each STEP entity (i.e. checks), - -- - 3 gives the number of entities by the type of a STEP entity, - -- - 4 gives the number of of STEP entities per result type and/or status, - -- - 5 gives the number of pairs (STEP or result type and status), - -- - 6 gives the number of pairs (STEP or result type and status) - -- AND the list of entity numbers in the STEP model. - -fields - - thesession : WorkSession from XSControl; - -end Writer; diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index e8f8911077..eaee2af004 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -11,7 +11,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include @@ -20,6 +20,10 @@ #include #include #include +#include +#include +#include +#include //======================================================================= diff --git a/src/STEPControl/STEPControl_Writer.hxx b/src/STEPControl/STEPControl_Writer.hxx new file mode 100644 index 0000000000..ddf07f303e --- /dev/null +++ b/src/STEPControl/STEPControl_Writer.hxx @@ -0,0 +1,130 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPControl_Writer_HeaderFile +#define _STEPControl_Writer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class StepData_StepModel; +class TopoDS_Shape; + + +//! This class creates and writes
+//! STEP files from Open CASCADE models. A STEP file can be
+//! written to an existing STEP file or to a new one.
+//! Translation can be performed in one or several operations. Each
+//! translation operation outputs a distinct root entity in the STEP file.
+class STEPControl_Writer { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a Writer from scratch
+ Standard_EXPORT STEPControl_Writer(); + //! Creates a Writer from an already existing Session
+//! If is True (D), clears already recorded data
+ Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Sets a length-measure value that
+//! will be written to uncertainty-measure-with-unit
+//! when the next shape is translated.
+ Standard_EXPORT void SetTolerance(const Standard_Real Tol) ; + //! Unsets the tolerance formerly forced by SetTolerance
+ Standard_EXPORT void UnsetTolerance() ; + //! Sets a specific session to
+ Standard_EXPORT void SetWS(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ; + //! Returns the session used in
+ Standard_EXPORT Handle_XSControl_WorkSession WS() const; + //! Returns the produced model. Produces a new one if not yet done
+//! or if is True
+//! This method allows for instance to edit product or header
+//! data before writing.
+ Standard_EXPORT Handle_StepData_StepModel Model(const Standard_Boolean newone = Standard_False) ; + //! Translates shape sh to a STEP
+//! entity. mode defines the STEP entity type to be output:
+//! - STEPControlStd_AsIs translates a shape to its highest possible
+//! STEP representation.
+//! - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP
+//! manifold_solid_brep or brep_with_voids entity.
+//! - STEPControlStd_FacetedBrep translates a shape into a STEP
+//! faceted_brep entity.
+//! - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP
+//! shell_based_surface_model entity.
+//! - STEPControlStd_GeometricCurveSet translates a shape into a STEP
+//! geometric_curve_set entity.
+ Standard_EXPORT IFSelect_ReturnStatus Transfer(const TopoDS_Shape& sh,const STEPControl_StepModelType mode,const Standard_Boolean compgraph = Standard_True) ; + //! Writes a STEP model in the file identified by filename.
+ Standard_EXPORT IFSelect_ReturnStatus Write(const Standard_CString filename) ; + //! Displays the statistics for the
+//! last translation. what defines the kind of statistics that are displayed:
+//! - 0 gives general statistics (number of translated roots,
+//! number of warnings, number of fail messages),
+//! - 1 gives root results,
+//! - 2 gives statistics for all checked entities,
+//! - 3 gives the list of translated entities,
+//! - 4 gives warning and fail messages,
+//! - 5 gives fail messages only.
+//! mode is used according to the use of what. If what is 0, mode is
+//! ignored. If what is 1, 2 or 3, mode defines the following:
+//! - 0 lists the numbers of STEP entities in a STEP model,
+//! - 1 gives the number, identifier, type and result type for each
+//! STEP entity and/or its status (fail, warning, etc.),
+//! - 2 gives maximum information for each STEP entity (i.e. checks),
+//! - 3 gives the number of entities by the type of a STEP entity,
+//! - 4 gives the number of of STEP entities per result type and/or status,
+//! - 5 gives the number of pairs (STEP or result type and status),
+//! - 6 gives the number of pairs (STEP or result type and status)
+//! AND the list of entity numbers in the STEP model.
+ Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,const Standard_Integer mode = 0) const; + + + + + +protected: + + + + + +private: + + + +Handle_XSControl_WorkSession thesession; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/STEPSelections/FILES b/src/STEPSelections/FILES new file mode 100644 index 0000000000..2e7224546d --- /dev/null +++ b/src/STEPSelections/FILES @@ -0,0 +1,2 @@ +STEPSelections_SelectForTransfer.hxx +STEPSelections_SelectForTransfer.cxx diff --git a/src/STEPSelections/STEPSelections.cdl b/src/STEPSelections/STEPSelections.cdl index e70e5e5734..de791e71ad 100644 --- a/src/STEPSelections/STEPSelections.cdl +++ b/src/STEPSelections/STEPSelections.cdl @@ -46,7 +46,7 @@ is class SelectInstances; - class SelectForTransfer; + imported SelectForTransfer; -- Classes that are intended for assembly exploration class SequenceOfAssemblyLink instantiates diff --git a/src/STEPSelections/STEPSelections_SelectForTransfer.cdl b/src/STEPSelections/STEPSelections_SelectForTransfer.cdl deleted file mode 100644 index fc88a27d69..0000000000 --- a/src/STEPSelections/STEPSelections_SelectForTransfer.cdl +++ /dev/null @@ -1,31 +0,0 @@ --- Created on: 2003-06-02 --- Created by: Galina KULIKOVA --- Copyright (c) 2003-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 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. - -class SelectForTransfer from STEPSelections inherits SelectForTransfer from XSControl - - ---Purpose: - -uses - EntityIterator, - Graph, - TransferReader from XSControl - -is - Create returns mutable SelectForTransfer; - Create (TR : TransferReader from XSControl) returns mutable SelectForTransfer; - RootResult(me; G : Graph) returns EntityIterator is redefined; - - -end SelectForTransfer; diff --git a/src/STEPSelections/STEPSelections_SelectForTransfer.cxx b/src/STEPSelections/STEPSelections_SelectForTransfer.cxx index 457697588a..d4aebef6ce 100644 --- a/src/STEPSelections/STEPSelections_SelectForTransfer.cxx +++ b/src/STEPSelections/STEPSelections_SelectForTransfer.cxx @@ -11,10 +11,31 @@ // 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 + +IMPLEMENT_STANDARD_TYPE(STEPSelections_SelectForTransfer) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(XSControl_SelectForTransfer), + STANDARD_TYPE(IFSelect_SelectExtract), + STANDARD_TYPE(IFSelect_SelectDeduct), + STANDARD_TYPE(IFSelect_Selection), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(STEPSelections_SelectForTransfer) + + +IMPLEMENT_DOWNCAST(STEPSelections_SelectForTransfer,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(STEPSelections_SelectForTransfer) + + //======================================================================= //function : STEPSelections_SelectForTransfer //purpose : diff --git a/src/STEPSelections/STEPSelections_SelectForTransfer.hxx b/src/STEPSelections/STEPSelections_SelectForTransfer.hxx new file mode 100644 index 0000000000..914ee9ef84 --- /dev/null +++ b/src/STEPSelections/STEPSelections_SelectForTransfer.hxx @@ -0,0 +1,51 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _STEPSelections_SelectForTransfer_HeaderFile +#define _STEPSelections_SelectForTransfer_HeaderFile + +#include +#include +#include +#include +class XSControl_TransferReader; +class Interface_EntityIterator; +class Interface_Graph; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(XSControl_SelectForTransfer); +class STEPSelections_SelectForTransfer; + +DEFINE_STANDARD_HANDLE(STEPSelections_SelectForTransfer,XSControl_SelectForTransfer) + +class STEPSelections_SelectForTransfer : public XSControl_SelectForTransfer { + +public: + + + Standard_EXPORT STEPSelections_SelectForTransfer(); + + Standard_EXPORT STEPSelections_SelectForTransfer(const Handle(XSControl_TransferReader)& TR); + + Standard_EXPORT virtual Interface_EntityIterator RootResult(const Interface_Graph& G) const; + + + + + DEFINE_STANDARD_RTTI(STEPSelections_SelectForTransfer) +}; +#endif diff --git a/src/StepAP209/StepAP209_Construct.cdl b/src/StepAP209/StepAP209_Construct.cdl index c14b4a42d8..3e1198544c 100644 --- a/src/StepAP209/StepAP209_Construct.cdl +++ b/src/StepAP209/StepAP209_Construct.cdl @@ -18,7 +18,7 @@ class Construct from StepAP209 inherits Tool from STEPConstruct ---Purpose: Basic tool for working with AP209 model uses - WorkSession from XSControl, + WorkSession_Handle from XSControl, Product from StepBasic, ProductDefinition from StepBasic, ProductDefinitionFormation from StepBasic, @@ -40,10 +40,10 @@ is Create returns Construct; ---Purpose: Creates an empty tool - Create (WS: WorkSession from XSControl) returns Construct; + Create (WS: WorkSession_Handle from XSControl) returns Construct; ---Purpose: Creates a tool and initializes it - Init (me: in out; WS: WorkSession from XSControl) returns Boolean; + Init (me: in out; WS: WorkSession_Handle from XSControl) returns Boolean; ---Purpose: Initializes tool; returns True if succeeded IsDesing(me; PD: ProductDefinitionFormation from StepBasic) returns Boolean; diff --git a/src/StepData/FILES b/src/StepData/FILES new file mode 100644 index 0000000000..976e7a377d --- /dev/null +++ b/src/StepData/FILES @@ -0,0 +1,6 @@ +StepData_FileRecognizer.hxx +StepData_FileRecognizer.cxx +StepData_StepReaderTool.hxx +StepData_StepReaderTool.cxx +StepData_WriterLib.hxx +StepData_WriterLib.cxx diff --git a/src/StepData/StepData.cdl b/src/StepData/StepData.cdl index bb663ec5b2..d4e2782a60 100644 --- a/src/StepData/StepData.cdl +++ b/src/StepData/StepData.cdl @@ -54,8 +54,7 @@ is class Protocol; -- basic protocol for Step deferred class GeneralModule; -- general services - deferred class FileRecognizer instantiates - Recognizer from Interface (AsciiString from TCollection, Transient); + imported FileRecognizer; class FileProtocol; class HeaderTool; @@ -66,13 +65,12 @@ is class DescrReadWrite; class StepReaderData; -- litteral description of Step File - class StepReaderTool; + imported StepReaderTool; deferred class ReadWriteModule; class StepWriter; -- idem but in the other sense class StepDumper; - class WriterLib instantiates Library from LibCtl - (Transient, ReadWriteModule, Protocol from StepData); + imported WriterLib; class DefaultGeneral; -- Default Module which processes UnknownEntity diff --git a/src/MoniTool/MoniTool_DataInfo.cxx b/src/StepData/StepData_FileRecognizer.cxx similarity index 68% rename from src/MoniTool/MoniTool_DataInfo.cxx rename to src/StepData/StepData_FileRecognizer.cxx index b46c1379c4..d2f91c68b8 100644 --- a/src/MoniTool/MoniTool_DataInfo.cxx +++ b/src/StepData/StepData_FileRecognizer.cxx @@ -1,3 +1,4 @@ +// Copyright (c) 1994-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. @@ -11,12 +12,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include -Handle(Standard_Type) MoniTool_DataInfo::Type - (const Handle(Standard_Transient)& ent) - { return ent->DynamicType(); } +#include - Standard_CString MoniTool_DataInfo::TypeName - (const Handle(Standard_Transient)& ent) - { return ent->DynamicType()->Name(); } + IMPLEMENT_STANDARD_HANDLE(StepData_FileRecognizer, Standard_Transient) + IMPLEMENT_STANDARD_RTTIEXT(StepData_FileRecognizer, Standard_Transient) diff --git a/src/StepData/StepData_FileRecognizer.hxx b/src/StepData/StepData_FileRecognizer.hxx new file mode 100644 index 0000000000..9646da4a89 --- /dev/null +++ b/src/StepData/StepData_FileRecognizer.hxx @@ -0,0 +1,46 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _StepData_FileRecognizer_H__ +#define _StepData_FileRecognizer_H__ + +#include +#include +#include + +class TCollection_AsciiString; +class Standard_Transient; +class Standard_NoSuchObject; + +DEFINE_STANDARD_HANDLE(StepData_FileRecognizer, Standard_Transient) + +class StepData_FileRecognizer : public Interface_Recognizer +{ +public: + Standard_EXPORT StepData_FileRecognizer() + :Interface_Recognizer () + {} + + Standard_EXPORT void Add (const Handle(StepData_FileRecognizer)& theRecognizer); + + DEFINE_STANDARD_RTTI(StepData_FileRecognizer); +}; + + + +#endif + diff --git a/src/StepData/StepData_StepReaderTool.cdl b/src/StepData/StepData_StepReaderTool.cdl deleted file mode 100644 index 1f87de0e17..0000000000 --- a/src/StepData/StepData_StepReaderTool.cdl +++ /dev/null @@ -1,95 +0,0 @@ --- Created on: 1992-02-11 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -class StepReaderTool from StepData inherits FileReaderTool - - ---Purpose : Specific FileReaderTool for Step; works with FileReaderData - -- provides references evaluation, plus access to litteral data - -- and specific methods defined by FileReaderTool - -- Remarks : works with a ReaderLib to load Entities - -uses Integer, Boolean, Transient, - InterfaceModel, Check, GeneralLib, ReaderLib, - StepReaderData, FileRecognizer, Protocol from StepData - -is - - -- -- File data storing and access (specific) -- -- - - Create (reader : mutable StepReaderData; protocol : Protocol from StepData) - returns StepReaderTool; - ---Purpose : creates StepReaderTool to work with a StepReaderData according - -- to a Step Protocol. Defines the ReaderLib at this time - - -- -- setting empty entities before loading model -- -- - - Prepare (me : in out; optimize : Boolean = Standard_True); - ---Purpose : Bounds empty entities to records, uses default Recognition - -- provided by ReaderLib and ReaderModule. Also calls computation - -- of references (SetEntityNumbers from StepReaderData) - -- Works only on data entities (skips header) - -- given False allows to test some internal algorithms - -- which are normally avoided (see also StepReaderData) - - Prepare (me : in out; reco : mutable FileRecognizer; - optimize : Boolean = Standard_True); - ---Purpose : Bounds empty entities to records, works with a specific - -- FileRecognizer, stored and later used in Recognize - -- Works only on data entities (skips header) - -- is to call - -- RecognizeByLib - - -- -- managing Header -- -- - -- Header is defined as a list of StepEntities (without ident) - - PrepareHeader (me : in out; reco : mutable FileRecognizer); - ---Purpose : bounds empty entities and sub-lists to header records - -- works like Prepare + SetEntityNumbers, but for header - -- (N.B.: in Header, no Ident and no reference) - -- FileRecognizer is to specify Entities which are allowed to be - -- defined in the Header (not every type can be) - - -- -- loading entities into the model -- -- - - BeginRead (me : in out; amodel : mutable InterfaceModel); - ---Purpose : fills model's header; that is, gives to it Header entities - -- and commands their loading. Also fills StepModel's Global - -- Check from StepReaderData's GlobalCheck - - AnalyseRecord (me : in out; - num : Integer; anent : mutable Transient; acheck : in out Check) - returns Boolean; - ---Purpose : fills an entity, given record no; works by using a ReaderLib - -- to load each entity, which must be a Transient - -- Actually, returned value is True if no fail, False else - - EndRead (me : in out; amodel : mutable InterfaceModel) is redefined; - ---Purpose : Ends file reading after reading all the entities - -- Here, it binds in the model, Idents to Entities (for checks) - -fields - - thereco : FileRecognizer; - theglib : GeneralLib; - therlib : ReaderLib; - -end StepReaderTool; diff --git a/src/StepData/StepData_StepReaderTool.cxx b/src/StepData/StepData_StepReaderTool.cxx index b66d13a223..e23ade2293 100644 --- a/src/StepData/StepData_StepReaderTool.cxx +++ b/src/StepData/StepData_StepReaderTool.cxx @@ -11,7 +11,13 @@ // 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 diff --git a/src/StepData/StepData_StepReaderTool.hxx b/src/StepData/StepData_StepReaderTool.hxx new file mode 100644 index 0000000000..1567549e66 --- /dev/null +++ b/src/StepData/StepData_StepReaderTool.hxx @@ -0,0 +1,100 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _StepData_StepReaderTool_HeaderFile +#define _StepData_StepReaderTool_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StepData_FileRecognizer; +class StepData_StepReaderData; +class StepData_Protocol; +class Interface_Check; +class Standard_Transient; +class Interface_InterfaceModel; + + +//! Specific FileReaderTool for Step; works with FileReaderData
+//! provides references evaluation, plus access to litteral data
+//! and specific methods defined by FileReaderTool
+//! Remarks : works with a ReaderLib to load Entities
+class StepData_StepReaderTool : public Interface_FileReaderTool +{ +public: + + DEFINE_STANDARD_ALLOC + + //! creates StepReaderTool to work with a StepReaderData according
+//! to a Step Protocol. Defines the ReaderLib at this time
+ Standard_EXPORT StepData_StepReaderTool(const Handle(StepData_StepReaderData)& reader,const Handle(StepData_Protocol)& protocol); + //! Bounds empty entities to records, uses default Recognition
+//! provided by ReaderLib and ReaderModule. Also calls computation
+//! of references (SetEntityNumbers from StepReaderData)
+//! Works only on data entities (skips header)
+//! given False allows to test some internal algorithms
+//! which are normally avoided (see also StepReaderData)
+ Standard_EXPORT void Prepare(const Standard_Boolean optimize = Standard_True) ; + //! Bounds empty entities to records, works with a specific
+//! FileRecognizer, stored and later used in Recognize
+//! Works only on data entities (skips header)
+//! + Standard_EXPORT void Prepare(const Handle(StepData_FileRecognizer)& reco,const Standard_Boolean optimize = Standard_True) ; + //! recognizes records, by asking either ReaderLib (default) or
+//! FileRecognizer (if defined) to do so. is to call
+//! RecognizeByLib
+ Standard_EXPORT Standard_Boolean Recognize(const Standard_Integer num,Handle(Interface_Check)& ach,Handle(Standard_Transient)& ent) ; + //! bounds empty entities and sub-lists to header records
+//! works like Prepare + SetEntityNumbers, but for header
+//! (N.B.: in Header, no Ident and no reference)
+//! FileRecognizer is to specify Entities which are allowed to be
+//! defined in the Header (not every type can be)
+ Standard_EXPORT void PrepareHeader(const Handle(StepData_FileRecognizer)& reco) ; + //! fills model's header; that is, gives to it Header entities
+//! and commands their loading. Also fills StepModel's Global
+//! Check from StepReaderData's GlobalCheck
+ Standard_EXPORT void BeginRead(const Handle(Interface_InterfaceModel)& amodel) ; + //! fills an entity, given record no; works by using a ReaderLib
+//! to load each entity, which must be a Transient
+//! Actually, returned value is True if no fail, False else
+ Standard_EXPORT Standard_Boolean AnalyseRecord(const Standard_Integer num,const Handle(Standard_Transient)& anent,Handle(Interface_Check)& acheck) ; + //! Ends file reading after reading all the entities
+//! Here, it binds in the model, Idents to Entities (for checks)
+ Standard_EXPORT virtual void EndRead(const Handle(Interface_InterfaceModel)& amodel) ; + +private: + +Handle_StepData_FileRecognizer thereco; +Interface_GeneralLib theglib; +Interface_ReaderLib therlib; + + +}; + +#endif diff --git a/src/StepData/StepData_WriterLib.cxx b/src/StepData/StepData_WriterLib.cxx new file mode 100644 index 0000000000..29db3702ef --- /dev/null +++ b/src/StepData/StepData_WriterLib.cxx @@ -0,0 +1,31 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include + +typedef LibCtl_GlobalNode + StepData_GlobalNode; + +template <> +Standard_EXPORT NCollection_Handle< StepData_GlobalNode > & +StepData_WriterLib::GetGlobal() +{ + static NCollection_Handle < StepData_GlobalNode > aGlobal; + return aGlobal; +} diff --git a/src/StepData/StepData_WriterLib.hxx b/src/StepData/StepData_WriterLib.hxx new file mode 100644 index 0000000000..8c98da1159 --- /dev/null +++ b/src/StepData/StepData_WriterLib.hxx @@ -0,0 +1,47 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _StepData_WriterLib_HeaderFile +#define _StepData_WriterLib_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class StepData_NodeOfWriterLib; +class Standard_NoSuchObject; +class Standard_Transient; +class StepData_ReadWriteModule; +class StepData_Protocol; + +typedef LibCtl_Library + StepData_WriterLib; + +#endif \ No newline at end of file diff --git a/src/StepSelect/FILES b/src/StepSelect/FILES new file mode 100644 index 0000000000..a5120e23e9 --- /dev/null +++ b/src/StepSelect/FILES @@ -0,0 +1,4 @@ +StepSelect_FileModifier.hxx +StepSelect_FileModifier.cxx +StepSelect_FloatFormat.hxx +StepSelect_FloatFormat.cxx diff --git a/src/StepSelect/StepSelect.cdl b/src/StepSelect/StepSelect.cdl index 9d555c1161..3f87951152 100644 --- a/src/StepSelect/StepSelect.cdl +++ b/src/StepSelect/StepSelect.cdl @@ -26,12 +26,9 @@ is class StepType; - deferred class ModelModifier instantiates ModelModifier from IFSelect - (StepModel from StepData, Protocol from StepData); - deferred class FileModifier instantiates FileModifier from IFSelect - (StepWriter from StepData); + imported FileModifier; - class FloatFormat; + imported FloatFormat; class WorkLibrary; diff --git a/src/StepSelect/StepSelect_FileModifier.cxx b/src/StepSelect/StepSelect_FileModifier.cxx new file mode 100644 index 0000000000..c3e303ec20 --- /dev/null +++ b/src/StepSelect/StepSelect_FileModifier.cxx @@ -0,0 +1,33 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(StepSelect_FileModifier) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_GeneralModifier), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(StepSelect_FileModifier) + + +IMPLEMENT_DOWNCAST(StepSelect_FileModifier,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(StepSelect_FileModifier) \ No newline at end of file diff --git a/src/StepSelect/StepSelect_FileModifier.hxx b/src/StepSelect/StepSelect_FileModifier.hxx new file mode 100644 index 0000000000..27a3dc3b1b --- /dev/null +++ b/src/StepSelect/StepSelect_FileModifier.hxx @@ -0,0 +1,52 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _StepSelect_FileModifier_HeaderFile +#define _StepSelect_FileModifier_HeaderFile + +#include +#include +#include +#include + +class StepData_StepWriter; +class IFSelect_ContextWrite; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(IFSelect_GeneralModifier); +class StepSelect_FileModifier; + +DEFINE_STANDARD_HANDLE(StepSelect_FileModifier,IFSelect_GeneralModifier) + +class StepSelect_FileModifier : public IFSelect_GeneralModifier +{ + +public: + + + Standard_EXPORT virtual void Perform (IFSelect_ContextWrite& ctx, + StepData_StepWriter& writer) const = 0; + + DEFINE_STANDARD_RTTI(StepSelect_FileModifier) + +protected: + Standard_EXPORT StepSelect_FileModifier () + : IFSelect_GeneralModifier (Standard_False) + { } +}; + +#endif \ No newline at end of file diff --git a/src/StepSelect/StepSelect_FloatFormat.cdl b/src/StepSelect/StepSelect_FloatFormat.cdl deleted file mode 100644 index a69a74332a..0000000000 --- a/src/StepSelect/StepSelect_FloatFormat.cdl +++ /dev/null @@ -1,92 +0,0 @@ --- Created on: 1994-06-01 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -class FloatFormat from StepSelect inherits FileModifier from StepSelect - - ---Purpose : This class gives control out format for floatting values : - -- ZeroSuppress or no, Main Format, Format in Range (for values - -- around 1.), as StepWriter allows to manage it. - -- Formats are given under C-printf form - -uses CString, AsciiString from TCollection, HSequenceOfInteger from TColStd, - CheckIterator, StepWriter , ContextWrite - -is - - Create returns mutable FloatFormat; - ---Purpose : Creates a new FloatFormat, with standard options : - -- ZeroSuppress, Main Format = %E, - -- Format between 0.001 and 1000. = %f - - SetDefault (me : mutable; digits : Integer = 0); - ---Purpose : Sets FloatFormat to default value (see Create) but if - -- is given positive, it commands Formats (main and range) to - -- ensure significant digits to be displayed - - SetZeroSuppress (me : mutable; mode : Boolean); - ---Purpose : Sets ZeroSuppress mode to a new value - - SetFormat (me : mutable; format : CString = "%E"); - ---Purpose : Sets Main Format to a new value - -- Remark : SetFormat, SetZeroSuppress and SetFormatForRange are - -- independant - - SetFormatForRange (me : mutable; format : CString = "%f"; - Rmin : Real = 0.1; Rmax : Real = 1000.0); - ---Purpose : Sets Format for Range to a new value with its range of - -- application. - -- To cancel it, give format as "" (empty string) - -- Remark that if the condition (0. < Rmin < Rmax) is not - -- verified, this secondary format will be ignored. - -- Moreover, this secondary format is intended to be used in a - -- range around 1. - - - Format (me; zerosup : out Boolean; - mainform : out AsciiString from TCollection; - hasrange : out Boolean; - forminrange : out AsciiString from TCollection; - rangemin, rangemax : out Real); - ---Purpose : Returns all recorded parameters : - -- zerosup : ZeroSuppress status - -- mainform : Main Format (which applies out of the range, or - -- for every real if no range is set) - -- hasrange : True if a FormatInRange is set, False else - -- (following parameters do not apply if it is False) - -- forminrange : Secondary Format (it applies inside the range) - -- rangemin, rangemax : the range in which the secondary format - -- applies - - - Perform (me; ctx : in out ContextWrite; - writer : in out StepWriter); - ---Purpose : Sets the Floatting Formats of StepWriter to the recorded - -- parameters - - Label (me) returns AsciiString from TCollection; - ---Purpose : Returns specific Label : for instance, - -- "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]" - -fields - - thezerosup : Boolean; - themainform : AsciiString from TCollection; - theformrange : AsciiString from TCollection; - therangemin : Real; - therangemax : Real; - -end FloatFormat; - diff --git a/src/StepSelect/StepSelect_FloatFormat.cxx b/src/StepSelect/StepSelect_FloatFormat.cxx index d43b5edb09..989696f465 100644 --- a/src/StepSelect/StepSelect_FloatFormat.cxx +++ b/src/StepSelect/StepSelect_FloatFormat.cxx @@ -11,11 +11,27 @@ // 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 +IMPLEMENT_STANDARD_TYPE(StepSelect_FloatFormat) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(StepSelect_FileModifier), + STANDARD_TYPE(IFSelect_GeneralModifier), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(StepSelect_FloatFormat) + + +IMPLEMENT_DOWNCAST(StepSelect_FloatFormat,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(StepSelect_FloatFormat) StepSelect_FloatFormat::StepSelect_FloatFormat () : thezerosup (Standard_True) , themainform ("%E") , diff --git a/src/StepSelect/StepSelect_FloatFormat.hxx b/src/StepSelect/StepSelect_FloatFormat.hxx new file mode 100644 index 0000000000..630fb66020 --- /dev/null +++ b/src/StepSelect/StepSelect_FloatFormat.hxx @@ -0,0 +1,116 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _StepSelect_FloatFormat_HeaderFile +#define _StepSelect_FloatFormat_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +class TCollection_AsciiString; +class IFSelect_ContextWrite; +class StepData_StepWriter; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(StepSelect_FileModifier); +class StepSelect_FloatFormat; + +DEFINE_STANDARD_HANDLE(StepSelect_FloatFormat,StepSelect_FileModifier) + +//! This class gives control out format for floatting values :
+//! ZeroSuppress or no, Main Format, Format in Range (for values
+//! around 1.), as StepWriter allows to manage it.
+//! Formats are given under C-printf form
+class StepSelect_FloatFormat : public StepSelect_FileModifier { + +public: + + //! Creates a new FloatFormat, with standard options :
+//! ZeroSuppress, Main Format = %E,
+//! Format between 0.001 and 1000. = %f
+ Standard_EXPORT StepSelect_FloatFormat(); + //! Sets FloatFormat to default value (see Create) but if
+//! is given positive, it commands Formats (main and range) to
+//! ensure significant digits to be displayed
+ Standard_EXPORT void SetDefault(const Standard_Integer digits = 0) ; + //! Sets ZeroSuppress mode to a new value
+ Standard_EXPORT void SetZeroSuppress(const Standard_Boolean mode) ; + //! Sets Main Format to a new value
+//! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
+//! independant
+ Standard_EXPORT void SetFormat(const Standard_CString format = "%E") ; + //! Sets Format for Range to a new value with its range of
+//! application.
+//! To cancel it, give format as "" (empty string)
+//! Remark that if the condition (0. < Rmin < Rmax) is not
+//! verified, this secondary format will be ignored.
+//! Moreover, this secondary format is intended to be used in a
+//! range around 1.
+ Standard_EXPORT void SetFormatForRange(const Standard_CString format = "%f",const Standard_Real Rmin = 0.1,const Standard_Real Rmax = 1000.0) ; + //! Returns all recorded parameters :
+//! zerosup : ZeroSuppress status
+//! mainform : Main Format (which applies out of the range, or
+//! for every real if no range is set)
+//! hasrange : True if a FormatInRange is set, False else
+//! (following parameters do not apply if it is False)
+//! forminrange : Secondary Format (it applies inside the range)
+//! rangemin, rangemax : the range in which the secondary format
+//! applies
+ Standard_EXPORT void Format(Standard_Boolean& zerosup,TCollection_AsciiString& mainform,Standard_Boolean& hasrange,TCollection_AsciiString& forminrange,Standard_Real& rangemin,Standard_Real& rangemax) const; + //! Sets the Floatting Formats of StepWriter to the recorded
+//! parameters
+ Standard_EXPORT void Perform(IFSelect_ContextWrite& ctx,StepData_StepWriter& writer) const; + //! Returns specific Label : for instance,
+//! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ Standard_EXPORT TCollection_AsciiString Label() const; + + + + + DEFINE_STANDARD_RTTI(StepSelect_FloatFormat) + +protected: + + + + +private: + + +Standard_Boolean thezerosup; +TCollection_AsciiString themainform; +TCollection_AsciiString theformrange; +Standard_Real therangemin; +Standard_Real therangemax; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/StepToTopoDS/StepToTopoDS_Builder.cdl b/src/StepToTopoDS/StepToTopoDS_Builder.cdl index e5d3788d01..49afadb759 100644 --- a/src/StepToTopoDS/StepToTopoDS_Builder.cdl +++ b/src/StepToTopoDS/StepToTopoDS_Builder.cdl @@ -33,7 +33,7 @@ uses GeometricSet from StepShape, Shape from TopoDS, BuilderError from StepToTopoDS, - TransientProcess from Transfer, + TransientProcess_Handle from Transfer, NMTool from StepToTopoDS raises NotDone from StdFail @@ -43,62 +43,62 @@ is Create returns Builder from StepToTopoDS; Create (S : ManifoldSolidBrep from StepShape; - TP : TransientProcess from Transfer ) + TP : TransientProcess_Handle from Transfer ) returns Builder from StepToTopoDS; Create (S : BrepWithVoids from StepShape; - TP : TransientProcess from Transfer ) + TP : TransientProcess_Handle from Transfer ) returns Builder from StepToTopoDS; Create ( S : FacetedBrep from StepShape; - TP : TransientProcess from Transfer ) + TP : TransientProcess_Handle from Transfer ) returns Builder from StepToTopoDS; Create (S : FacetedBrepAndBrepWithVoids from StepShape; - TP : TransientProcess from Transfer ) + TP : TransientProcess_Handle from Transfer ) returns Builder from StepToTopoDS; Create (S : ShellBasedSurfaceModel from StepShape; - TP : TransientProcess from Transfer; + TP : TransientProcess_Handle from Transfer; NMTool : in out NMTool from StepToTopoDS ) returns Builder from StepToTopoDS; Create ( S : GeometricSet from StepShape; - TP : TransientProcess from Transfer ) + TP : TransientProcess_Handle from Transfer ) returns Builder from StepToTopoDS; Init (me : in out; S : ManifoldSolidBrep from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : BrepWithVoids from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : FacetedBrep from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : FacetedBrepAndBrepWithVoids from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : ShellBasedSurfaceModel from StepShape; - TP : TransientProcess from Transfer; + TP : TransientProcess_Handle from Transfer; NMTool : in out NMTool from StepToTopoDS ); Init (me : in out; S : EdgeBasedWireframeModel from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : FaceBasedSurfaceModel from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Init (me : in out; S : GeometricSet from StepShape; - TP : TransientProcess from Transfer ); + TP : TransientProcess_Handle from Transfer ); Value (me) returns Shape from TopoDS raises NotDone diff --git a/src/StepToTopoDS/StepToTopoDS_Builder.cxx b/src/StepToTopoDS/StepToTopoDS_Builder.cxx index cd7897574b..377e9db0ce 100644 --- a/src/StepToTopoDS/StepToTopoDS_Builder.cxx +++ b/src/StepToTopoDS/StepToTopoDS_Builder.cxx @@ -66,6 +66,7 @@ #include #include +#include #include #include diff --git a/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cdl b/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cdl index 59a44eb806..7fe754f949 100644 --- a/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cdl +++ b/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cdl @@ -19,7 +19,7 @@ class MakeTransformed from StepToTopoDS inherits Root ---Purpose : Produces instances by Transformation of a basic item uses Trsf from gp, Shape from TopoDS, - TransientProcess from Transfer, + TransientProcess_Handle from Transfer, Axis2Placement3d from StepGeom, CartesianTransformationOperator3d from StepGeom, MappedItem from StepRepr @@ -48,7 +48,7 @@ is TranslateMappedItem (me : in out; mapit : MappedItem from StepRepr; - TP : mutable TransientProcess from Transfer) + TP : TransientProcess_Handle from Transfer) returns Shape; ---Purpose : Translates a MappedItem. More precisely -- A MappedItem has a MappingSource and a MappingTarget diff --git a/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cxx b/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cxx index 6410f38fbe..0e057e8e14 100644 --- a/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cxx +++ b/src/StepToTopoDS/StepToTopoDS_MakeTransformed.cxx @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/src/StepToTopoDS/StepToTopoDS_Tool.cdl b/src/StepToTopoDS/StepToTopoDS_Tool.cdl index 43e4b4778e..270c299733 100644 --- a/src/StepToTopoDS/StepToTopoDS_Tool.cdl +++ b/src/StepToTopoDS/StepToTopoDS_Tool.cdl @@ -33,18 +33,18 @@ uses Curve from Geom2d, Curve from Geom, Surface from Geom, - TransientProcess from Transfer + TransientProcess_Handle from Transfer is Create returns Tool from StepToTopoDS; Create(Map : DataMapOfTRI from StepToTopoDS; - TP : TransientProcess from Transfer) + TP : TransientProcess_Handle from Transfer) returns Tool from StepToTopoDS; Init(me : in out; Map : DataMapOfTRI from StepToTopoDS; - TP : TransientProcess from Transfer); + TP : TransientProcess_Handle from Transfer); IsBound(me : in out; TRI : TopologicalRepresentationItem from StepShape) @@ -95,7 +95,7 @@ is ComputePCurve(me) returns Boolean from Standard; - TransientProcess(me) returns TransientProcess from Transfer; + TransientProcess(me) returns TransientProcess_Handle from Transfer; -- Statistics @@ -126,7 +126,7 @@ fields myComputePC : Boolean from Standard; - myTransProc : TransientProcess from Transfer; + myTransProc : TransientProcess_Handle from Transfer; -- Statistics : -- Surface continuity diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl index 5e9f0df11c..a003c98e7b 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl @@ -25,7 +25,7 @@ class TranslateCompositeCurve from StepToTopoDS -- cyclic references is implemented. uses - TransientProcess from Transfer, + TransientProcess_Handle from Transfer, CompositeCurve from StepGeom, Surface from StepGeom, Surface from Geom, @@ -37,12 +37,12 @@ is ---Purpose: Empty constructor Create (CC: CompositeCurve from StepGeom; - TP: TransientProcess from Transfer) + TP: TransientProcess_Handle from Transfer) returns TranslateCompositeCurve; ---Purpose: Translates standalone composite_curve Create (CC: CompositeCurve from StepGeom; - TP: TransientProcess from Transfer; + TP: TransientProcess_Handle from Transfer; S : Surface from StepGeom; Surf: Surface from Geom) returns TranslateCompositeCurve; @@ -50,13 +50,13 @@ is Init (me: in out; CC: CompositeCurve from StepGeom; - TP: TransientProcess from Transfer) + TP: TransientProcess_Handle from Transfer) returns Boolean; ---Purpose: Translates standalone composite_curve Init (me: in out; CC: CompositeCurve from StepGeom; - TP: TransientProcess from Transfer; + TP: TransientProcess_Handle from Transfer; S : Surface from StepGeom; Surf: Surface from Geom) returns Boolean; diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx index 92319cd492..a1ee32535c 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx @@ -38,7 +38,7 @@ #include #include #include - +#include #include #include diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cdl b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cdl index 946aa85169..a23d84f6f5 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cdl +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cdl @@ -19,7 +19,7 @@ class TranslateCurveBoundedSurface from StepToTopoDS ---Purpose: Translate curve_bounded_surface into TopoDS_Face uses - TransientProcess from Transfer, + TransientProcess_Handle from Transfer, CurveBoundedSurface from StepGeom, Face from TopoDS @@ -28,13 +28,13 @@ is ---Purpose: Create empty tool Create (CBS: CurveBoundedSurface from StepGeom; - TP: TransientProcess from Transfer) + TP: TransientProcess_Handle from Transfer) returns TranslateCurveBoundedSurface; ---Purpose: Translate surface Init (me: in out; CBS: CurveBoundedSurface from StepGeom; - TP: TransientProcess from Transfer) + TP: TransientProcess_Handle from Transfer) returns Boolean; ---Purpose: Translate surface diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx index 7a994b35fc..ba31489801 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/TopoDSToStep/TopoDSToStep.cdl b/src/TopoDSToStep/TopoDSToStep.cdl index b9cbc6cd2e..a6182748ea 100644 --- a/src/TopoDSToStep/TopoDSToStep.cdl +++ b/src/TopoDSToStep/TopoDSToStep.cdl @@ -148,13 +148,13 @@ is -- returns Shape from TopoDS; ---Purpose: Returns a new shape without undirect surfaces. - AddResult (FP: FinderProcess from Transfer; + AddResult (FP: FinderProcess_Handle from Transfer; Shape: Shape from TopoDS; entity: Transient from Standard); ---Purpose: Adds an entity into the list of results (binders) for -- shape stored in FinderProcess - AddResult (FP: FinderProcess from Transfer; + AddResult (FP: FinderProcess_Handle from Transfer; Tool: Tool from TopoDSToStep); ---Purpose: Adds all entities recorded in Tool into the map of results -- (binders) stored in FinderProcess diff --git a/src/TopoDSToStep/TopoDSToStep.cxx b/src/TopoDSToStep/TopoDSToStep.cxx index c57885da1a..9bbf758e4a 100644 --- a/src/TopoDSToStep/TopoDSToStep.cxx +++ b/src/TopoDSToStep/TopoDSToStep.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/TopoDSToStep/TopoDSToStep_Builder.cdl b/src/TopoDSToStep/TopoDSToStep_Builder.cdl index 417c71fb5d..68b49f65ad 100644 --- a/src/TopoDSToStep/TopoDSToStep_Builder.cdl +++ b/src/TopoDSToStep/TopoDSToStep_Builder.cdl @@ -22,7 +22,7 @@ class Builder from TopoDSToStep uses - FinderProcess from Transfer, + FinderProcess_Handle from Transfer, Shape from TopoDS, Tool from TopoDSToStep, BuilderError from TopoDSToStep, @@ -40,13 +40,13 @@ is Create(S : Shape from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns Builder from TopoDSToStep; Init(me : in out; S : Shape from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); -- ----------------------------------------------------------- -- Get the Result diff --git a/src/TopoDSToStep/TopoDSToStep_Builder.cxx b/src/TopoDSToStep/TopoDSToStep_Builder.cxx index e074d5e234..d69cd7340a 100644 --- a/src/TopoDSToStep/TopoDSToStep_Builder.cxx +++ b/src/TopoDSToStep/TopoDSToStep_Builder.cxx @@ -15,11 +15,10 @@ // commercial license or contractual agreement. #include - #include - #include +#include #include #include #include @@ -29,14 +28,11 @@ #include #include #include - #include - +#include #include #include -#include - -#include +#include // ============================================================================ // Method : TopoDSToStep_Builder::TopoDSToStep_Builder diff --git a/src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cdl b/src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cdl index 8d2e4f8acd..c15c7d2446 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cdl @@ -25,14 +25,14 @@ class MakeBrepWithVoids from TopoDSToStep inherits uses Solid from TopoDS, BrepWithVoids from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( S : Solid from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeBrepWithVoids; Value (me) returns BrepWithVoids from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cdl b/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cdl index ea69eb6b1d..10be0e7eba 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cdl @@ -26,18 +26,18 @@ class MakeFacetedBrep from TopoDSToStep inherits uses Shell from TopoDS, Solid from TopoDS, FacetedBrep from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( S : Shell from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeFacetedBrep; Create ( S : Solid from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeFacetedBrep; Value (me) returns FacetedBrep from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cdl b/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cdl index ca49d964db..275e04e624 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cdl @@ -25,14 +25,14 @@ class MakeFacetedBrepAndBrepWithVoids from TopoDSToStep inherits uses Solid from TopoDS, FacetedBrepAndBrepWithVoids from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( S : Solid from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeFacetedBrepAndBrepWithVoids; Value (me) returns FacetedBrepAndBrepWithVoids from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cdl b/src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cdl index c7471a3352..8aac473ecf 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cdl @@ -23,14 +23,14 @@ class MakeGeometricCurveSet from TopoDSToStep inherits uses Shape from TopoDS, GeometricCurveSet from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( SH : Shape from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeGeometricCurveSet; Value (me) returns GeometricCurveSet from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cdl b/src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cdl index 8d4a054cc6..f40144ada8 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cdl @@ -26,18 +26,18 @@ class MakeManifoldSolidBrep from TopoDSToStep inherits uses Shell from TopoDS, Solid from TopoDS, ManifoldSolidBrep from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( S : Shell from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeManifoldSolidBrep; Create ( S : Solid from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeManifoldSolidBrep; Value (me) returns ManifoldSolidBrep from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cdl b/src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cdl index ac293905c4..39da4a5a9e 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cdl @@ -26,22 +26,22 @@ uses Face from TopoDS, Shell from TopoDS, Solid from TopoDS, ShellBasedSurfaceModel from StepShape, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail is Create ( F : Face from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeShellBasedSurfaceModel; Create ( S : Shell from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeShellBasedSurfaceModel; Create ( S : Solid from TopoDS; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeShellBasedSurfaceModel; Value (me) returns ShellBasedSurfaceModel from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cdl b/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cdl index 3807ce4f7b..2c48a4bff7 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cdl @@ -25,7 +25,7 @@ uses Edge from TopoDS, TopologicalRepresentationItem from StepShape, Tool from TopoDSToStep, MakeEdgeError from TopoDSToStep, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail @@ -35,13 +35,13 @@ is Create(E : Edge from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeStepEdge; Init(me : in out; E : Edge from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); Value (me) returns TopologicalRepresentationItem from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx b/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx index cf8dc74268..14745d304d 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include // Processing of non-manifold topology (ssv; 11.11.2010) diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cdl b/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cdl index d1f36370be..284e241046 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cdl @@ -25,7 +25,7 @@ uses Face from TopoDS, TopologicalRepresentationItem from StepShape, Tool from TopoDSToStep, MakeFaceError from TopoDSToStep, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail @@ -35,13 +35,13 @@ is Create (F : Face from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeStepFace; Init(me : in out; F : Face from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); Value (me) returns TopologicalRepresentationItem from StepShape raises NotDone diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx b/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx index dcd77675bc..3c80bce17c 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx @@ -84,6 +84,7 @@ #include #include +#include #include #include diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cdl b/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cdl index ba58ed019c..ee57609fc7 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cdl @@ -25,7 +25,7 @@ uses Vertex from TopoDS, TopologicalRepresentationItem from StepShape, Tool from TopoDSToStep, MakeVertexError from TopoDSToStep, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail @@ -35,13 +35,13 @@ is Create (V : Vertex from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeStepVertex; Init(me : in out; V : Vertex from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); Value (me) returns TopologicalRepresentationItem from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx b/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx index 3e1188bcdc..43e70a7e5c 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx @@ -25,7 +25,7 @@ #include #include - +#include #include // Processing of non-manifold topology (ssv; 11.11.2010) diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cdl b/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cdl index dc848f0b2e..91a5fadb25 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cdl +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cdl @@ -25,7 +25,7 @@ uses Wire from TopoDS, TopologicalRepresentationItem from StepShape, Tool from TopoDSToStep, MakeWireError from TopoDSToStep, - FinderProcess from Transfer + FinderProcess_Handle from Transfer raises NotDone from StdFail @@ -35,13 +35,13 @@ is Create (W : Wire from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns MakeStepWire; Init(me : in out; W : Wire from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); Value (me) returns TopologicalRepresentationItem from StepShape diff --git a/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cxx b/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cxx index 3677bbe545..f72673cce3 100644 --- a/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cxx +++ b/src/TopoDSToStep/TopoDSToStep_MakeStepWire.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/src/TopoDSToStep/TopoDSToStep_WireframeBuilder.cdl b/src/TopoDSToStep/TopoDSToStep_WireframeBuilder.cdl index 8bc7a861c9..1a6809547a 100644 --- a/src/TopoDSToStep/TopoDSToStep_WireframeBuilder.cdl +++ b/src/TopoDSToStep/TopoDSToStep_WireframeBuilder.cdl @@ -22,7 +22,7 @@ class WireframeBuilder from TopoDSToStep uses - FinderProcess from Transfer, + FinderProcess_Handle from Transfer, Edge from TopoDS, Face from TopoDS, Shape from TopoDS, @@ -43,13 +43,13 @@ is Create(S : Shape from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer) + FP : FinderProcess_Handle from Transfer) returns WireframeBuilder from TopoDSToStep; Init(me : in out; S : Shape from TopoDS; T : in out Tool from TopoDSToStep; - FP : mutable FinderProcess from Transfer); + FP : FinderProcess_Handle from Transfer); -- ----------------------------------------------------------- -- Get the Result diff --git a/src/Transfer/FILES b/src/Transfer/FILES new file mode 100644 index 0000000000..b49efc3dd5 --- /dev/null +++ b/src/Transfer/FILES @@ -0,0 +1,28 @@ +Transfer_Actor.hxx +Transfer_ActorOfFinderProcess.hxx +Transfer_ActorOfFinderProcess.cxx +Transfer_ActorOfTransientProcess.hxx +Transfer_ActorOfTransientProcess.cxx +Transfer_TransferOutput.hxx +Transfer_TransferOutput.cxx +Transfer_FinderProcess.hxx +Transfer_FinderProcess.cxx +Transfer_TransientProcess.hxx +Transfer_TransientProcess.cxx +Transfer_Iterator.hxx +Transfer_IteratorOfProcessForFinder.hxx +Transfer_IteratorOfProcessForTransient.hxx +Transfer_DispatchControl.hxx +Transfer_DispatchControl.cxx +Transfer_TransferDispatch.hxx +Transfer_TransferDispatch.cxx +Transfer_ResultFromTransient.hxx +Transfer_ResultFromTransient.cxx +Transfer_ResultFromModel.hxx +Transfer_ResultFromModel.cxx +Transfer_TransferProcess.hxx +Transfer_TransientProcess_Handle.hxx +Transfer_FinderProcess_Handle.hxx +Transfer_Mapper.hxx +Transfer_TransientMapper.hxx +Transfer_TransientMapper.cxx \ No newline at end of file diff --git a/src/Transfer/Transfer.cdl b/src/Transfer/Transfer.cdl index e5c4e387e4..095ea7d2d1 100644 --- a/src/Transfer/Transfer.cdl +++ b/src/Transfer/Transfer.cdl @@ -26,59 +26,46 @@ uses TCollection, TColStd, MMgt, Standard, Dico, MoniTool, Interface, Message is class DataInfo; -- used in Mapper - deferred class Finder; - generic class Mapper; - class TransientMapper instantiates Mapper - (Transient, MapTransientHasher from TColStd, DataInfo); + imported Mapper; + imported TransientMapper; class FindHasher; deferred class Binder; - class VoidBinder; - generic class SimpleBinder; - class SimpleBinderOfTransient; - class BinderOfTransientInteger; - class TransientListBinder; - class MultipleBinder; + class VoidBinder; + class SimpleBinderOfTransient; + class BinderOfTransientInteger; + class TransientListBinder; + class MultipleBinder; - class ResultFromTransient; - class ResultFromModel; + imported ResultFromTransient; + imported ResultFromModel; class TransferIterator; - generic class TransferProcess; - generic class TransferMap; - generic class Iterator; - generic class Actor; - - class ProcessForTransient instantiates TransferProcess - (Transient, MapTransientHasher from TColStd, - HSequenceOfTransient from TColStd); - ---Purpose : Manages Transfer of Transient Objects. Produces also - -- ActorOfTransientProcess (deferred class), - -- IteratorOfTransientProcess (for Results), - -- TransferMapOfTransientProcess (internally used) - -- Normally uses as TransientProcess, which adds some specifics - - class TransientProcess; -- inherits TransferForTransient - class ActorOfTransientProcess; + imported TransferProcess; + imported Iterator; + imported Actor; + imported TransientProcess_Handle; -- Workaround for WOK creating handles of non-cdl classes + imported TransientProcess; + ---Purpose : Manages Transfer of Transient Objects. + imported ActorOfTransientProcess; class SequenceOfFinder instantiates Sequence from TCollection (Finder); class HSequenceOfFinder instantiates HSequence from TCollection (Finder,SequenceOfFinder); - class ProcessForFinder instantiates TransferProcess - (Finder, FindHasher, HSequenceOfFinder); - - class FinderProcess; - class ActorOfFinderProcess; - - class TransferOutput; + imported IteratorOfProcessForFinder; + imported IteratorOfProcessForTransient; + imported FinderProcess; + imported FinderProcess_Handle;-- Workaround for WOK creating handles of non-cdl classes + imported ActorOfFinderProcess; + imported TransferOutput; class TransferInput; - class DispatchControl; - class TransferDispatch; - class ActorDispatch; + imported DispatchControl; + imported TransferDispatch; + imported ActorDispatch; class MapContainer; diff --git a/src/Transfer/Transfer_Actor.gxx b/src/Transfer/Transfer_Actor.gxx deleted file mode 100644 index 63d6d96467..0000000000 --- a/src/Transfer/Transfer_Actor.gxx +++ /dev/null @@ -1,68 +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 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 - -// TheStart : Handle(Standard_Transient) ou (Transfer_Finder) - - - -Transfer_Actor::Transfer_Actor () { } - - - Standard_Boolean Transfer_Actor::Recognize (const TheStart& /*start*/) - { return Standard_True; } - - Handle(Transfer_Binder) Transfer_Actor::Transferring - (const TheStart& /*start*/, - const Handle(Transfer_TransferProcess)& /*TP*/) - { return NullResult(); } - - - Handle(Transfer_SimpleBinderOfTransient) - Transfer_Actor::TransientResult - (const Handle(Standard_Transient)& res) const -{ - Handle(Transfer_SimpleBinderOfTransient) binder; - if (res.IsNull()) return binder; - binder = new Transfer_SimpleBinderOfTransient; - binder->SetResult (res); - return binder; -} - - - Handle(Transfer_Binder) Transfer_Actor::NullResult () const -{ - Handle(Transfer_Binder) binder; - return binder; -} - - - void Transfer_Actor::SetNext - (const Handle(Transfer_Actor)& next) -{ - if (thenext == next) return; - if (thenext.IsNull()) thenext = next; - else if (thenext->IsLast()) { next->SetNext(thenext); thenext = next; } - else thenext->SetNext(next); -} - - Handle(Transfer_Actor) Transfer_Actor::Next () const - { return thenext; } - - void Transfer_Actor::SetLast (const Standard_Boolean mode) - { thelast = mode; } - - - Standard_Boolean Transfer_Actor::IsLast () const - { return thelast; } diff --git a/src/Transfer/Transfer_Actor.hxx b/src/Transfer/Transfer_Actor.hxx new file mode 100644 index 0000000000..54269e1444 --- /dev/null +++ b/src/Transfer/Transfer_Actor.hxx @@ -0,0 +1,147 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_Actor_HeaderFile +#define _Transfer_Actor_HeaderFile + +#include +#include +#include +#include +#include +#include + +//! An Actor performs the effective Transfer of a Starting +//! Object, piloted by a TransferProcess. That is : +//! - It recognizes, for a Starting Object, the case to be run +//! - Then, it performs the Transfer : the recommanded way to +//! work is to define for each Type of Object to Transfer, a +//! specific Transfer Tool, then to call it by the Actor +//! - It assumes that the Result of Transfer is stored in a +//! Binder, it creates it if the Tool does not do +//! It can use the TransferProcess for intermediate Results +//! - It returns the Binder which stores the Result +//! It no Result can be produced, it returns a Null Handle +//! It may bind this Binder to but is not obliged : +//! TransferProcess controls this point. +//! +//! Remark about the kind of returned Binder : +//! - for a Transient Result, use the method TransientResult +//! - else, cast and query the Binder itself +//! +//! An Actor can be built by combination : this allows to +//! gather several Actors, each one processing a set of cases. + +template < class ActorHandle, class TheStart, class TransferProcessHandle > +class Transfer_Actor : public MMgt_TShared +{ +private: + ActorHandle myNext; + Standard_Boolean myLast; +public: + Standard_EXPORT Transfer_Actor () { } + + //! Prerequesite for Transfer : the method Transfer is + //! called on a starting object only if Recognize has + //! returned True on it. This allows to define a list + //! of Actors, each one processing a definite kind of data. + //! TransferProcess calls Recognize on each one before + //! calling Transfer. But even if Recognize has returned + //! true, Transfer can reject by returning a Null Binder + //! (afterwards rejection), the theNext actor is then invoked. + //! The provided default returns True, can be redefined. + Standard_EXPORT Standard_Boolean Recognize (const TheStart& /*start*/) + { + return Standard_True; + } + + //! Specific action of Transfer. The Result is stored in + //! the returned Binder, or a Null Handle for "No result" + //! (Default defined as doing nothing; should be deffered) + //! "mutable" allows the Actor to record intermediate + //! information, in addition to those of TransferProcess. + //! In case of Error during a Transfer, any kind of + //! exception can be raised. + Standard_EXPORT Handle(Transfer_Binder) Transferring (const TheStart& /*start*/, + const TransferProcessHandle& /*TP*/) + { + return NullResult(); + } + + //! Prepares and returns a binder for a Transient result. + //! Returns a Null Handle if is itself null. + Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult + (const Handle(Standard_Transient)& theRes) const + { + Handle(Transfer_SimpleBinderOfTransient) binder; + if (theRes.IsNull()) + return binder; + binder = new Transfer_SimpleBinderOfTransient; + binder->SetResult (theRes); + return binder; + } + + //! Returns a binder for no result, i.e. a null handle. + Standard_EXPORT Handle(Transfer_Binder) NullResult () const + { + Handle(Transfer_Binder) binder; + return binder; + } + + //! If is true, commands an Actor to be set at the + //! end of the list of Actors (see SetNext). + //! If it is False (creation default), each add Actor is + //! set at the beginning of the list. + //! This allows to define default Actors (which are Last). + Standard_EXPORT void SetLast (const Standard_Boolean theMode = Standard_True) + { + myLast = theMode; + } + + //! Defines a Next Actor : it can then be asked to work if + //! produces no result for a given type of Object. + //! If Next is already set and is not "Last", calls + //! SetNext on it. If Next defined and "Last", the new + //! actor is added before it in the list. + Standard_EXPORT void SetNext (const ActorHandle& theNext) + { + if (myNext == theNext) + return; + if (myNext.IsNull()) + myNext = theNext; + else if (myNext->IsLast()) + { + theNext->SetNext(myNext); + myNext = theNext; + } + else + myNext->SetNext(theNext); + } + + //! Returns the actor defined as Next, or a null handle. + Standard_EXPORT ActorHandle Next () const + { + return myNext; + } + + //! Returns the Last status (see SetLast). + Standard_EXPORT Standard_Boolean IsLast () const + { + return myLast; + } +}; +#endif diff --git a/src/Transfer/Transfer_ActorDispatch.cdl b/src/Transfer/Transfer_ActorDispatch.cdl deleted file mode 100644 index 851b897192..0000000000 --- a/src/Transfer/Transfer_ActorDispatch.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Created on: 1994-05-24 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -class ActorDispatch from Transfer inherits ActorOfTransientProcess - - ---Purpose : This class allows to work with a TransferDispatch, i.e. to - -- transfer entities from a data set to another one defined by - -- the same interface norm, with the following features : - -- - ActorDispatch itself acts as a default actor, i.e. it copies - -- entities with the general service Copy, as CopyTool does - -- - it allows to add other actors for specific ways of transfer, - -- which may include data modifications, conversions ... - -- - and other features from TransferDispatch (such as mapping - -- other than one-one) - -uses Transient, InterfaceModel, GeneralLib, Protocol from Interface, - TransferDispatch, TransientProcess, Binder - -raises InterfaceError - -is - - Create (amodel : InterfaceModel; lib : GeneralLib) - returns mutable ActorDispatch; - ---Purpose : Creates an ActorDispatch from a Model. Works with a General - -- Service Library, given as an Argument - -- This causes TransferDispatch and its TransientProcess to be - -- created, with default actor - - Create (amodel : InterfaceModel; protocol : Protocol from Interface) - returns mutable ActorDispatch; - ---Purpose : Same as above, but Library is defined through a Protocol - - Create (amodel : InterfaceModel) returns mutable ActorDispatch - ---Purpose : Same as above, but works with the Active Protocol - raises InterfaceError; - -- Error if no Active Protocol is defined - - AddActor (me : mutable; actor : mutable ActorOfTransientProcess from Transfer); - ---Purpose : Utility which adds an actor to the default (it calls - -- SetActor from the TransientProcess) - - TransferDispatch (me : mutable) returns TransferDispatch; - ---Purpose : Returns the TransferDispatch, which does the work, records - -- the intermediate data, etc... - -- See TransferDispatch & CopyTool, to see the available methods - ---C++ : return & - - - Transfer (me : mutable; start : Transient; TP : mutable TransientProcess) - returns mutable Binder is redefined; - ---Purpose : Specific action : it calls the method Transfer from CopyTool - -- i.e. the general service Copy, then returns the Binder - -- produced by the TransientProcess - -fields - - thetool : TransferDispatch; - -end ActorDispatch; diff --git a/src/Transfer/Transfer_ActorDispatch.cxx b/src/Transfer/Transfer_ActorDispatch.cxx index 6f9d14e7d3..53d5bcf6af 100644 --- a/src/Transfer/Transfer_ActorDispatch.cxx +++ b/src/Transfer/Transfer_ActorDispatch.cxx @@ -11,8 +11,29 @@ // 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 +#include + +IMPLEMENT_STANDARD_TYPE(Transfer_ActorDispatch) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_ActorOfTransientProcess), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_ActorDispatch) + +IMPLEMENT_DOWNCAST(Transfer_ActorDispatch,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_ActorDispatch) Transfer_ActorDispatch::Transfer_ActorDispatch diff --git a/src/Transfer/Transfer_ActorDispatch.hxx b/src/Transfer/Transfer_ActorDispatch.hxx new file mode 100644 index 0000000000..6bd3ceaa94 --- /dev/null +++ b/src/Transfer/Transfer_ActorDispatch.hxx @@ -0,0 +1,94 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_ActorDispatch_HeaderFile +#define _Transfer_ActorDispatch_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceError; +class Interface_InterfaceModel; +class Interface_Protocol; +class Transfer_ActorOfTransientProcess; +class Transfer_TransferDispatch; +class Transfer_Binder; +class Standard_Transient; +class Transfer_TransientProcess; +class Handle(Standard_Type); +class Handle(Transfer_ActorOfTransientProcess); + +DEFINE_STANDARD_HANDLE(Transfer_ActorDispatch,Transfer_ActorOfTransientProcess) + +//! This class allows to work with a TransferDispatch, i.e. to
+//! transfer entities from a data set to another one defined by
+//! the same interface norm, with the following features :
+//! - ActorDispatch itself acts as a default actor, i.e. it copies
+//! entities with the general service Copy, as CopyTool does
+//! - it allows to add other actors for specific ways of transfer,
+//! which may include data modifications, conversions ...
+//! - and other features from TransferDispatch (such as mapping
+//! other than one-one)
+class Transfer_ActorDispatch : public Transfer_ActorOfTransientProcess { + +public: + + //! Creates an ActorDispatch from a Model. Works with a General
+ //! Service Library, given as an Argument
+ //! This causes TransferDispatch and its TransientProcess to be
+ //! created, with default actor
+ Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel,const Interface_GeneralLib& lib); + + //! Same as above, but Library is defined through a Protocol
+ Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel, + const Handle(Interface_Protocol)& protocol); + + //! Same as above, but works with the Active Protocol
+ Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel); + + //! Utility which adds an actor to the default (it calls
+ //! SetActor from the TransientProcess)
+ Standard_EXPORT void AddActor(const Handle(Transfer_ActorOfTransientProcess)& actor); + + //! Returns the TransferDispatch, which does the work, records
+ //! the intermediate data, etc...
+ //! See TransferDispatch & CopyTool, to see the available methods
+ Standard_EXPORT Transfer_TransferDispatch& TransferDispatch(); + + //! Specific action : it calls the method Transfer from CopyTool
+ //! i.e. the general service Copy, then returns the Binder
+ //! produced by the TransientProcess
+ Standard_EXPORT virtual Handle_Transfer_Binder Transfer(const Handle(Standard_Transient)& start, + const Handle(Transfer_TransientProcess)& TP) ; + + + DEFINE_STANDARD_RTTI(Transfer_ActorDispatch) + +private: + Transfer_TransferDispatch thetool; +}; +#endif diff --git a/src/Transfer/Transfer_ActorOfFinderProcess.cdl b/src/Transfer/Transfer_ActorOfFinderProcess.cdl deleted file mode 100644 index 1a20d76723..0000000000 --- a/src/Transfer/Transfer_ActorOfFinderProcess.cdl +++ /dev/null @@ -1,54 +0,0 @@ --- Created on: 1996-09-04 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class ActorOfFinderProcess from Transfer inherits ActorOfProcessForFinder - - ---Purpose : The original class was renamed. Compatibility only - -- - -- ModeTrans : a simple way of transmitting a transfer mode from - -- a user. To be interpreted for each norm - -uses Finder, FinderProcess, ProcessForFinder, Binder - -is - - Create returns mutable ActorOfFinderProcess; - - ModeTrans (me : mutable) returns Integer; - ---Purpose : Returns the Transfer Mode, modifiable - ---C++ : return & - - Transferring (me : mutable; start : Finder; TP : mutable ProcessForFinder) - returns mutable Binder is redefined; - -- calls the one below - - Transfer (me : mutable; start : Finder; TP : mutable FinderProcess) - returns mutable Binder is virtual; - -- default calls TransferTransient if is a TransientMapper, - -- i.e. does nothing, to be redefined - - TransferTransient (me : mutable; start : Transient; - TP : mutable FinderProcess) - returns mutable Transient is virtual; - -- default does nothing, can be redefined - -- usefull when a result is Transient, simpler to define than Transfer with - -- a Finder - -fields - - themodetrans : Integer is protected; - -end ActorOfFinderProcess; diff --git a/src/Transfer/Transfer_ActorOfFinderProcess.cxx b/src/Transfer/Transfer_ActorOfFinderProcess.cxx index 91d4ca1ada..6b551f0860 100644 --- a/src/Transfer/Transfer_ActorOfFinderProcess.cxx +++ b/src/Transfer/Transfer_ActorOfFinderProcess.cxx @@ -11,36 +11,41 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include #include -Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess () { themodetrans = 0; } +IMPLEMENT_STANDARD_HANDLE(Transfer_ActorOfFinderProcess, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess, MMgt_TShared) + +Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess () { myModeTrans = 0; } Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans () -{ return themodetrans; } +{ return myModeTrans; } Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer - (const Handle(Transfer_Finder)& fnd, - const Handle(Transfer_FinderProcess)& FP) + (const Handle(Transfer_Finder)& theFinder, + const Handle(Transfer_FinderProcess)& theFP) { - Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (fnd); + Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (theFinder); if (tm.IsNull()) return NullResult(); - Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP); + Handle(Standard_Transient) res = TransferTransient (tm->Value(),theFP); if (res.IsNull()) return NullResult(); return TransientResult (res); } Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring - (const Handle(Transfer_Finder)& ent, - const Handle(Transfer_ProcessForFinder)& TP) + (const Handle(Transfer_Finder)& theFinder, + const Handle(Transfer_FinderProcess)& theTP) { - return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP)); + return Transfer(theFinder,Handle(Transfer_FinderProcess)::DownCast(theTP)); } Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient - (const Handle(Standard_Transient)& /*ent*/, + (const Handle(Standard_Transient)& /*theEnt*/, const Handle(Transfer_FinderProcess)& ) { - Handle(Standard_Transient) nulres; - return nulres; + Handle(Standard_Transient) aNullRes; + return aNullRes; } diff --git a/src/Transfer/Transfer_ActorOfFinderProcess.hxx b/src/Transfer/Transfer_ActorOfFinderProcess.hxx new file mode 100644 index 0000000000..53d7f6d346 --- /dev/null +++ b/src/Transfer/Transfer_ActorOfFinderProcess.hxx @@ -0,0 +1,56 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_ActorOfFinderProcess_HeaderFile +#define _Transfer_ActorOfFinderProcess_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DEFINE_STANDARD_HANDLE(Transfer_ActorOfFinderProcess, MMgt_TShared) + +class Transfer_ActorOfFinderProcess : public Transfer_Actor < Handle(Transfer_ActorOfFinderProcess), + Handle(Transfer_Finder), + Handle(Transfer_FinderProcess) > +{ +public: + Standard_EXPORT Transfer_ActorOfFinderProcess(); + //! Returns the Transfer Mode, modifiable
+ Standard_EXPORT Standard_Integer& ModeTrans() ; + + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring(const Handle(Transfer_Finder)& theFinder, + const Handle(Transfer_FinderProcess)& theFP); + + Standard_EXPORT virtual Handle(Transfer_Binder) Transfer(const Handle(Transfer_Finder)& theFinder, + const Handle(Transfer_FinderProcess)& theFP); + + Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient(const Handle(Standard_Transient)& theEnt, + const Handle(Transfer_FinderProcess)& theFP); + + DEFINE_STANDARD_RTTI(Transfer_ActorOfFinderProcess) + +protected: + Standard_Integer myModeTrans; +}; +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_ActorOfTransientProcess.cdl b/src/Transfer/Transfer_ActorOfTransientProcess.cdl deleted file mode 100644 index 701971930b..0000000000 --- a/src/Transfer/Transfer_ActorOfTransientProcess.cdl +++ /dev/null @@ -1,42 +0,0 @@ --- Created on: 1996-09-04 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class ActorOfTransientProcess from Transfer inherits ActorOfProcessForTransient from Transfer - - ---Purpose : The original class was renamed. Compatibility only - -uses Transient, TransientProcess, ProcessForTransient, Binder - -is - - Create returns mutable ActorOfTransientProcess; - - Transferring (me : mutable; start : Transient; TP : mutable ProcessForTransient) - returns mutable Binder is redefined; - -- calls the one below - - Transfer (me : mutable; start : Transient; TP : mutable TransientProcess) - returns mutable Binder is virtual; - -- default calls TransferTransient i.e. does nothing, to be redefined - - TransferTransient (me : mutable; start : Transient; - TP : mutable TransientProcess) - returns mutable Transient is virtual; - -- default does nothing, can be redefined - -- usefull when a result is Transient, simpler to define than Transfer with - -- a Binder - -end ActorOfTransientProcess; diff --git a/src/Transfer/Transfer_ActorOfTransientProcess.cxx b/src/Transfer/Transfer_ActorOfTransientProcess.cxx index 3dfd2e5e3d..460358247f 100644 --- a/src/Transfer/Transfer_ActorOfTransientProcess.cxx +++ b/src/Transfer/Transfer_ActorOfTransientProcess.cxx @@ -1,3 +1,4 @@ +// Copyright (c) 1994-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. @@ -11,30 +12,36 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include +#include -Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { } + IMPLEMENT_STANDARD_HANDLE(Transfer_ActorOfTransientProcess, MMgt_TShared) + IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess, MMgt_TShared) + +Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { } Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer - (const Handle(Standard_Transient)& start, - const Handle(Transfer_TransientProcess)& TP) + (const Handle(Standard_Transient)& theEnt, + const Handle(Transfer_TransientProcess)& theTP) { - Handle(Standard_Transient) res = TransferTransient (start,TP); + Handle(Standard_Transient) res = TransferTransient (theEnt,theTP); if (res.IsNull()) return NullResult(); return TransientResult (res); } Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring - (const Handle(Standard_Transient)& ent, - const Handle(Transfer_ProcessForTransient)& TP) + (const Handle(Standard_Transient)& theEnt, + const Handle(Transfer_TransientProcess)& theTP) { - return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP)); + return Transfer (theEnt, Handle(Transfer_TransientProcess)::DownCast(theTP)); } Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient - (const Handle(Standard_Transient)& /*ent*/, - const Handle(Transfer_TransientProcess)& /*TP*/) + (const Handle(Standard_Transient)& /*theEnt*/, + const Handle(Transfer_TransientProcess)& /*theTP*/) { - Handle(Standard_Transient) nulres; - return nulres; + Handle(Standard_Transient) aNullRes; + return aNullRes; } diff --git a/src/Transfer/Transfer_ActorOfTransientProcess.hxx b/src/Transfer/Transfer_ActorOfTransientProcess.hxx new file mode 100644 index 0000000000..f60967e481 --- /dev/null +++ b/src/Transfer/Transfer_ActorOfTransientProcess.hxx @@ -0,0 +1,52 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_ActorOfTransientProcess_HeaderFile +#define _Transfer_ActorOfTransientProcess_HeaderFile + +#include +#include +#include +#include +#include +#include + +DEFINE_STANDARD_HANDLE(Transfer_ActorOfTransientProcess, MMgt_TShared) + +class Transfer_ActorOfTransientProcess : public Transfer_Actor < Handle(Transfer_ActorOfTransientProcess), + Handle(Standard_Transient), + Handle(Transfer_TransientProcess) > +{ +public: + + Standard_EXPORT Transfer_ActorOfTransientProcess(); + + Standard_EXPORT virtual Handle_Transfer_Binder Transferring (const Handle(Standard_Transient)& theEnt, + const Handle(Transfer_TransientProcess)& theTP) ; + + Standard_EXPORT virtual Handle_Transfer_Binder Transfer (const Handle(Standard_Transient)& theEnt, + const Handle(Transfer_TransientProcess)& theTP) ; + + Standard_EXPORT virtual Handle_Standard_Transient TransferTransient (const Handle(Standard_Transient)& theStart, + const Handle(Transfer_TransientProcess)& theTP) ; + + + DEFINE_STANDARD_RTTI(Transfer_ActorOfTransientProcess) + +}; + +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_DispatchControl.cdl b/src/Transfer/Transfer_DispatchControl.cdl deleted file mode 100644 index b091758415..0000000000 --- a/src/Transfer/Transfer_DispatchControl.cdl +++ /dev/null @@ -1,64 +0,0 @@ --- Created on: 1993-06-17 --- Created by: Christian CAILLET --- Copyright (c) 1993-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 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. - -class DispatchControl from Transfer inherits CopyControl from Interface - - ---Purpose : This is an auxiliary class for TransferDispatch, which allows - -- to record simple copies, as CopyControl from Interface, but - -- based on a TransientProcess. Hence, it allows in addition - -- more actions (such as recording results of adaptations) - -uses Transient, TransientProcess, InterfaceModel - -raises InterfaceError - -is - - Create (model : InterfaceModel; TP : mutable TransientProcess) - returns mutable DispatchControl; - ---Purpose : Creates the DispatchControl, ready for use - - TransientProcess (me) returns mutable TransientProcess; - ---Purpose : Returns the content of the DispatchControl : it can be used - -- for a direct call, if the basic methods do not suffice - ---C++ : return const & - - StartingModel (me) returns any InterfaceModel; - ---Purpose : Returns the Model from which the transfer is to be done - ---C++ : return const & - - -- Now, inherited methods used for Copy (the minimum set) - - Clear (me : mutable); - ---Purpose : Clears the List of Copied Results - - Bind (me : mutable; ent : Transient; res : mutable Transient) - ---Purpose : Binds a (Transient) Result to a (Transient) Starting Entity - raises InterfaceError; - -- Error if is already bound - - Search (me; ent : Transient; res : out mutable Transient) - returns Boolean; - ---Purpose : Searches for the Result bound to a Starting Entity - -- If Found, returns True and fills - -- Else, returns False and nullifies - -fields - - theTP : TransientProcess; - themodel : InterfaceModel; - -end DispatchControl; diff --git a/src/Transfer/Transfer_DispatchControl.cxx b/src/Transfer/Transfer_DispatchControl.cxx index 1c23406927..f0d7377d32 100644 --- a/src/Transfer/Transfer_DispatchControl.cxx +++ b/src/Transfer/Transfer_DispatchControl.cxx @@ -11,8 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(Transfer_DispatchControl) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Interface_CopyControl), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_DispatchControl) + + +IMPLEMENT_DOWNCAST(Transfer_DispatchControl,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_DispatchControl) Transfer_DispatchControl::Transfer_DispatchControl diff --git a/src/Transfer/Transfer_DispatchControl.hxx b/src/Transfer/Transfer_DispatchControl.hxx new file mode 100644 index 0000000000..a2b8a547a9 --- /dev/null +++ b/src/Transfer/Transfer_DispatchControl.hxx @@ -0,0 +1,71 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_DispatchControl_HeaderFile +#define _Transfer_DispatchControl_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +class Transfer_TransientProcess; +class Interface_InterfaceModel; +class Interface_InterfaceError; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Interface_CopyControl); +class Transfer_DispatchControl; + +DEFINE_STANDARD_HANDLE(Transfer_DispatchControl,Interface_CopyControl) + + +//! This is an auxiliary class for TransferDispatch, which allows
+//! to record simple copies, as CopyControl from Interface, but
+//! based on a TransientProcess. Hence, it allows in addition
+//! more actions (such as recording results of adaptations)
+class Transfer_DispatchControl : public Interface_CopyControl +{ + +public: + + //! Creates the DispatchControl, ready for use
+ Standard_EXPORT Transfer_DispatchControl(const Handle(Interface_InterfaceModel)& model,const Handle(Transfer_TransientProcess)& TP); + //! Returns the content of the DispatchControl : it can be used
+ //! for a direct call, if the basic methods do not suffice
+ Standard_EXPORT const Handle_Transfer_TransientProcess& TransientProcess() const; + //! Returns the Model from which the transfer is to be done
+ Standard_EXPORT const Handle_Interface_InterfaceModel& StartingModel() const; + //! Clears the List of Copied Results
+ Standard_EXPORT void Clear() ; + //! Binds a (Transient) Result to a (Transient) Starting Entity
+ Standard_EXPORT void Bind(const Handle(Standard_Transient)& ent,const Handle(Standard_Transient)& res) ; + //! Searches for the Result bound to a Starting Entity
+ //! If Found, returns True and fills
+ //! Else, returns False and nullifies
+ Standard_EXPORT Standard_Boolean Search(const Handle(Standard_Transient)& ent,Handle(Standard_Transient)& res) const; + + DEFINE_STANDARD_RTTI(Transfer_DispatchControl) + +private: + +Handle_Transfer_TransientProcess theTP; +Handle_Interface_InterfaceModel themodel; +}; +#endif diff --git a/src/Transfer/Transfer_FinderProcess.cdl b/src/Transfer/Transfer_FinderProcess.cdl deleted file mode 100644 index 7e9322ef92..0000000000 --- a/src/Transfer/Transfer_FinderProcess.cdl +++ /dev/null @@ -1,71 +0,0 @@ --- Created on: 1996-09-04 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class FinderProcess from Transfer inherits ProcessForFinder - - ---Purpose : Adds specific features to the generic definition : - -- PrintTrace is adapted - -uses InterfaceModel from Interface, - Messenger from Message, - Finder, TransientMapper - -is - - Create (nb : Integer = 10000) returns mutable FinderProcess; - ---Purpose : Sets FinderProcess at initial state, with an initial size - - SetModel (me : mutable; model : InterfaceModel); - ---Purpose : Sets an InterfaceModel, which can be used during transfer - -- for instance if a context must be managed, it is in the Model - - Model (me) returns InterfaceModel; - ---Purpose : Returns the Model which can be used for context - - NextMappedWithAttribute (me; name : CString; num0 : Integer) returns Integer; - ---Purpose : In the list of mapped items (between 1 and NbMapped), - -- searches for the first mapped item which follows - -- (not included) and which has an attribute named - -- The considered Attributes are those brought by Finders,i.e. - -- by Input data. - -- While NextItemWithAttribute works on Result data (Binders) - -- - -- Hence, allows such an iteration - -- - -- for (num = FP->NextMappedWithAttribute(name,0); - -- num > 0; - -- num = FP->NextMappedWithAttribute(name,num) { - -- .. process mapped item - -- } - - TransientMapper (me; obj : Transient) returns TransientMapper; - ---Purpose : Returns a TransientMapper for a given Transient Object - -- Either is already mapped, then its Mapper is returned - -- Or it is not, then a new one is created then returned, BUT - -- it is not mapped here (use Bind or FindElseBind to do this) - - - PrintTrace (me; start : Finder; S : Messenger from Message) is redefined; - ---Purpose : Specific printing to trace a Finder (by its method ValueType) - - PrintStats (me; mode : Integer; S : Messenger from Message); - ---Purpose : Prints statistics on a given output, according mode - -fields - - themodel : InterfaceModel; - -end FinderProcess; diff --git a/src/Transfer/Transfer_FinderProcess.cxx b/src/Transfer/Transfer_FinderProcess.cxx index 5b6f0d0b65..c6666010c2 100644 --- a/src/Transfer/Transfer_FinderProcess.cxx +++ b/src/Transfer/Transfer_FinderProcess.cxx @@ -11,79 +11,279 @@ // 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 + +IMPLEMENT_STANDARD_TYPE(Transfer_FinderProcess) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_FinderProcess) -Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb) - : Transfer_ProcessForFinder (nb) { } - - void Transfer_FinderProcess::SetModel - (const Handle(Interface_InterfaceModel)& model) - { themodel = model; } - - Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const - { return themodel; } - +IMPLEMENT_DOWNCAST(Transfer_FinderProcess,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_FinderProcess) - Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute - (const Standard_CString name, const Standard_Integer num0) const -{ - Standard_Integer num, nb = NbMapped(); - for (num = num0+1; num <= nb; num ++) { - Handle(Transfer_Finder) fnd = Mapped (num); - if (fnd.IsNull()) continue; - if (!fnd->Attribute(name).IsNull()) return num; + Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer theNb) + : Transfer_TransferProcess < Handle(Transfer_ActorOfFinderProcess), + Transfer_TransferMapOfProcessForFinder, + Handle(Transfer_Finder), + Transfer_FindHasher, + Handle(Transfer_HSequenceOfFinder), + Transfer_IteratorOfProcessForFinder > (theNb) { } + + void Transfer_FinderProcess::SetModel (const Handle(Interface_InterfaceModel)& theModel) + { + myModel = theModel; + } + + Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const + { + return myModel; + } + + Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute + (const Standard_CString theName, + const Standard_Integer theNum0) const + { + Standard_Integer aNum, aNb = NbMapped(); + for (aNum = theNum0 + 1; aNum <= aNb; aNum ++) + { + Handle(Transfer_Finder) aFnd = Mapped (aNum); + if (aFnd.IsNull()) continue; + if (!aFnd->Attribute(theName).IsNull()) + return aNum; + } + return 0; } - return 0; -} - Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper - (const Handle(Standard_Transient)& obj) const -{ - Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj); - Standard_Integer index = MapIndex (mapper); - if (index == 0) return mapper; - return Handle(Transfer_TransientMapper)::DownCast(Mapped(index)); -} + Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper + (const Handle(Standard_Transient)& theObj) const + { + Handle(Transfer_TransientMapper) aMapper = new Transfer_TransientMapper(theObj); + Standard_Integer anIndex = MapIndex (aMapper); + if (anIndex == 0) + return aMapper; + return Handle(Transfer_TransientMapper)::DownCast(Mapped(anIndex)); + } - void Transfer_FinderProcess::PrintTrace - (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const - { if (!start.IsNull()) S<<" Type:"<ValueTypeName(); } + void Transfer_FinderProcess::PrintTrace (const Handle(Transfer_Finder)& theStart, + const Handle(Message_Messenger)& theMessenger) const + { + if (!theStart.IsNull()) + theMessenger<<" Type:"<ValueTypeName(); + } - void Transfer_FinderProcess::PrintStats - (const Standard_Integer mode, const Handle(Message_Messenger)& S) const -{ - S<<"\n*******************************************************************\n"; - if (mode == 1) { // Statistiques de base - S << "******** Basic Statistics ********"<Check(); - Transfer_StatusExec stat = binder->StatusExec(); - if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) - nbe ++; - else { - if (ach->NbWarnings() > 0) nbw ++; - if (binder->HasResult()) nbr ++; + for (anI = 1; anI <= aMax; anI ++) { + const Handle(Transfer_Binder)& aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + const Handle(Interface_Check) aCheck = aBinder->Check(); + Transfer_StatusExec aStatus = aBinder->StatusExec(); + if (aStatus != Transfer_StatusInitial && aStatus != Transfer_StatusDone) + aNbe ++; + else { + if (aCheck->NbWarnings() > 0) aNbw ++; + if (aBinder->HasResult()) aNbr ++; + } + } + if (aNbr > aNbRoots) + theMessenger<<"**** ( Itermediate Results : "< 0) + theMessenger<<"**** Errors on :"< 0) + theMessenger<<"**** Warnings on : "<Recognize (theStart)) aBinder = anActor->Transferring(theStart,this); + else aBinder.Nullify(); + if (!aBinder.IsNull()) break; + anActor = anActor->Next(); + } + if (aBinder.IsNull()) { + if (myLevel > 0) myLevel --; + return aBinder; + } + // Managing the root level (.. a close look ..) + if (myRootLevel == 0 && aBinder->StatusExec() == Transfer_StatusDone) + myRootLevel = myLevel - 1; + + if (myLevel > 0) myLevel --; + return aBinder; + } + + //======================================================================= + //function : Transferring + //purpose : + //======================================================================= + + Handle(Transfer_Binder) Transfer_FinderProcess::Transferring (const Handle(Transfer_Finder)& theStart) + { + Handle(Transfer_Binder) aFormer = FindAndMask(theStart); + + // Use more: note "AlreadyUsed" so result can not be changed + if (!aFormer.IsNull()) { + if (aFormer->HasResult()) { + aFormer->SetAlreadyUsed(); + return aFormer; + } + + // Initial state: perhaps already done ... or infeasible + Transfer_StatusExec statex = aFormer->StatusExec(); + switch (statex) { + case Transfer_StatusInitial : // Transfer is prepared to do + break; + case Transfer_StatusDone : // Transfer was already done + myMessenger << " .. and Transfer done" << endl; + return aFormer; + case Transfer_StatusRun : + aFormer->SetStatusExec(Transfer_StatusLoop); + return aFormer; + case Transfer_StatusError : + if (myTrace) { + myMessenger << " *** Transfer in Error Status :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferFailure::Raise + ("TransferProcess : Transfer in Error Status"); + case Transfer_StatusLoop : // The loop is closed ... + if (myTrace) { + myMessenger << " *** Transfer Head of Dead Loop :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferDeadLoop::Raise + ("TransferProcess : Transfer at Head of a Dead Loop"); + } +#ifdef TRANSLOG + cout << "Transfer,level "<SetStatusExec(Transfer_StatusRun); + } +#ifdef TRANSLOG + cout << " GO .." << endl; +#endif + + Handle(Transfer_Binder) aBinder; + Standard_Boolean newbind = Standard_False; + if (myToHandleErr) { + // Transfer under protection exceptions (for notification actually) + Standard_Integer anOldLevel = myLevel; + try { + OCC_CATCH_SIGNALS + aBinder = TransferProduct(theStart); + } + catch (Transfer_TransferDeadLoop) { + if (aBinder.IsNull()) { + myMessenger << " *** Dead Loop with no Result" << endl; + if (myTrace) StartTrace (aBinder, theStart, myLevel-1,0); + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); newbind = Standard_True; + } else if (aBinder->StatusExec() == Transfer_StatusLoop) { + if (myTrace) { + myMessenger << " *** Dead Loop : Finding head of Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + else StartTrace (aBinder, theStart,myLevel-1,4); + Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); + } else { + if (myTrace) { + myMessenger << " *** Dead Loop : Actor in Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + } + aBinder->AddFail("Transfer in dead Loop"); + myLevel = anOldLevel; + } + catch (Standard_Failure) { + if (aBinder.IsNull()) { + myMessenger << " *** Exception Raised with no Result" << endl; + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); newbind = Standard_True; + } + aBinder->AddFail("Transfer stopped by exception raising"); + if (myTrace) { + myMessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; + StartTrace (aBinder, theStart, myLevel-1,4); + } + myLevel = anOldLevel; } } - if (nbr > nbroots) - S<<"**** ( Itermediate Results : "< 0) - S<<"**** Errors on :"< 0) - S<<"**** Warnings on : "<SetStatusExec ( Transfer_StatusDone ); + Handle(Transfer_Binder) nulbinder; + return nulbinder; + } + + // Manage Roots (if planned) + if (myRootLevel >= myLevel) { + myRootLevel = 0; + if (myToManageRoot && aBinder->Status() != Transfer_StatusVoid) { + SetRoot (theStart); + } + } + return myLastBinder; + } + + Standard_Boolean Transfer_FinderProcess::Transfer(const Handle(Transfer_Finder)& theStart) + { + Handle(Transfer_Binder) aBinder = Transferring(theStart); + return (!aBinder.IsNull()); } - S< +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceModel; +class Transfer_TransientMapper; +class Standard_Transient; +class Transfer_Finder; +class Message_Messenger; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class Transfer_FinderProcess; + +class Transfer_FinderProcess +: public Transfer_TransferProcess < Handle(Transfer_ActorOfFinderProcess), + Transfer_TransferMapOfProcessForFinder, + Handle(Transfer_Finder), + Transfer_FindHasher, + Handle(Transfer_HSequenceOfFinder), + Transfer_IteratorOfProcessForFinder > +{ + +public: + + //! Sets FinderProcess at initial state, with an initial size
+ Standard_EXPORT Transfer_FinderProcess(const Standard_Integer theNb = 10000); + //! Sets an InterfaceModel, which can be used during transfer
+ //! for instance if a context must be managed, it is in the Model
+ Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& theModel) ; + //! Returns the Model which can be used for context
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + //! In the list of mapped items (between 1 and NbMapped),
+ //! searches for the first mapped item which follows
+ //! (not included) and which has an attribute named
+ //! The considered Attributes are those brought by Finders,i.e.
+ //! by Input data.
+ //! While NextItemWithAttribute works on Result data (Binders)
+ //!
+ //! Hence, allows such an iteration
+ //!
+ //! for (num = FP->NextMappedWithAttribute(name,0);
+ //! num > 0;
+ //! num = FP->NextMappedWithAttribute(name,num) {
+ //! .. process mapped item
+ //! }
+ Standard_EXPORT Standard_Integer NextMappedWithAttribute (const Standard_CString theName, + const Standard_Integer theNum0) const; + //! Returns a TransientMapper for a given Transient Object
+ //! Either is already mapped, then its Mapper is returned
+ //! Or it is not, then a new one is created then returned, BUT
+ //! it is not mapped here (use Bind or FindElseBind to do this)
+ Standard_EXPORT Handle_Transfer_TransientMapper TransientMapper (const Handle(Standard_Transient)& theObj) const; + //! Specific printing to trace a Finder (by its method ValueType)
+ Standard_EXPORT virtual void PrintTrace (const Handle(Transfer_Finder)& theStart, + const Handle(Message_Messenger)& theMessenger) const; + //! Prints statistics on a given output, according mode
+ Standard_EXPORT void PrintStats(const Standard_Integer mode,const Handle(Message_Messenger)& theMessenger) const; + + Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Transfer_Finder)& theStart); + + Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& theStart); + + Standard_EXPORT Standard_Boolean Transfer(const Handle(Transfer_Finder)& theStart); + + DEFINE_STANDARD_RTTI(Transfer_FinderProcess) + +private: + + Handle_Interface_InterfaceModel myModel; + +}; +#endif diff --git a/src/Transfer/Transfer_FinderProcess_Handle.hxx b/src/Transfer/Transfer_FinderProcess_Handle.hxx new file mode 100644 index 0000000000..a833685aee --- /dev/null +++ b/src/Transfer/Transfer_FinderProcess_Handle.hxx @@ -0,0 +1,38 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl. + +#ifndef _Transfer_FinderProcess_Handle_HeaderFile +#define _Transfer_FinderProcess_Handle_HeaderFile + +#include +#include +#include + +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class Transfer_FinderProcess; + +DEFINE_STANDARD_HANDLE(Transfer_FinderProcess,MMgt_TShared) + +typedef Handle(Transfer_FinderProcess) Transfer_FinderProcess_Handle; + +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_Iterator.gxx b/src/Transfer/Transfer_Iterator.gxx deleted file mode 100644 index bc613ac70b..0000000000 --- a/src/Transfer/Transfer_Iterator.gxx +++ /dev/null @@ -1,75 +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 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. - -// Transfer_Iterator.gxx -#include - - -// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder) -// Il a servi a instancier TheList qui est une HSequence - - -Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts) - : Transfer_TransferIterator () -{ if (withstarts) thestarts = new TheList(); } - - - void Transfer_Iterator::Add - (const Handle(Transfer_Binder)& binder) -{ - if (!thestarts.IsNull()) Standard_NoSuchObject::Raise - ("Transfer_Iterator : Add, Starting Object required not provided"); - AddItem(binder); -} - - void Transfer_Iterator::Add - (const Handle(Transfer_Binder)& binder, const TheStart& start) -{ - AddItem(binder); - if (!thestarts.IsNull()) thestarts->Append(start); -} - - void Transfer_Iterator::Filter - (const Handle(TheList)& list, const Standard_Boolean keep) -{ - if (list.IsNull() || thestarts.IsNull()) return; - Standard_Integer i, j, nb = thestarts->Length(); - if (nb == 0) return; - Handle(Transfer_Binder) factice; - Transfer_TransferMap amap (nb); - for (i = 1; i <= nb; i ++) { - j = amap.Add (thestarts->Value(i),factice); - SelectItem (j,!keep); - } - -// Comparaison - nb = list->Length(); - for (i = 1; i <= nb; i ++) { - j = amap.FindIndex (list->Value(i)); - if (j > 0) SelectItem (j,keep); - } -} - - Standard_Boolean Transfer_Iterator::HasStarting () const - { return (!thestarts.IsNull()); } - - const TheStart& Transfer_Iterator::Starting () const -{ -// if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise -// ("TransferIterator : Starting"); -// if (theselect->Value(thecurr) == 0) Standard_NoSuchObject::Raise -// ("TransferIterator : Starting"); - if (thestarts.IsNull()) Standard_NoSuchObject::Raise - ("TransferIterator : No Starting defined at all"); - return thestarts->Value(thecurr); -} diff --git a/src/Transfer/Transfer_Iterator.hxx b/src/Transfer/Transfer_Iterator.hxx new file mode 100644 index 0000000000..b6998837b9 --- /dev/null +++ b/src/Transfer/Transfer_Iterator.hxx @@ -0,0 +1,95 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_Iterator_HeaderFile +#define _Transfer_Iterator_HeaderFile + +#include +#include +#include +#include + +//! This is a TransferIterator PLUS the capability to access +//! the Starting Objects. It is given as a Result from +//! TransferProcess. It can be used when a TransferIterator +//! is required. +//! See also : TransferIterator, for more information +template +class Transfer_Iterator : public Transfer_TransferIterator +{ +private: + ListHandle myStarts; + +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Transfer_Iterator (const Standard_Boolean theWithStarts) + : Transfer_TransferIterator () + { if (theWithStarts) + myStarts = new List(); } + + + Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder) + { + if (!myStarts.IsNull()) Standard_NoSuchObject::Raise + ("Transfer_Iterator : Add, Starting Object required not provided"); + AddItem(theBinder); + } + + Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder, + const TheStart& theStart) + { + AddItem (theBinder); + if (!myStarts.IsNull()) + myStarts->Append(theStart); + } + + Standard_EXPORT void Filter (const ListHandle& theList, + const Standard_Boolean toKeep = Standard_True) + { + if (theList.IsNull() || myStarts.IsNull()) + return; + Standard_Integer anI, aJ, aNb = myStarts->Length(); + if (aNb == 0) return; + Handle(Transfer_Binder) factice; + TransferMap amap (aNb); + for (anI = 1; anI <= aNb; anI ++) { + aJ = amap.Add (myStarts->Value(anI),factice); + SelectItem (aJ,!toKeep); + } + + // Comparaison + aNb = theList->Length(); + for (anI = 1; anI <= aNb; anI ++) { + aJ = amap.FindIndex (theList->Value(anI)); + if (aJ > 0) SelectItem (aJ,toKeep); + } + } + + Standard_EXPORT Standard_Boolean HasStarting () const + { + return (!myStarts.IsNull()); + } + + Standard_EXPORT const TheStart& Starting () const + { + if (myStarts.IsNull()) Standard_NoSuchObject::Raise + ("TransferIterator : No Starting defined at all"); + return myStarts->Value(thecurr); + } +}; +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx b/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx new file mode 100644 index 0000000000..7f5fa188b0 --- /dev/null +++ b/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx @@ -0,0 +1,65 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_IteratorOfProcessForFinder_HeaderFile +#define _Transfer_IteratorOfProcessForFinder_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Transfer_HSequenceOfFinder; +class Standard_NoSuchObject; +class Transfer_Finder; +class Transfer_FindHasher; +class Transfer_FinderProcess; +class Transfer_ActorOfFinderProcess; +class Transfer_Binder; + +typedef NCollection_IndexedDataMap < Handle(Transfer_Finder), + Handle(Transfer_Binder), + Transfer_FindHasher > + Transfer_TransferMapOfProcessForFinder; + +class Transfer_IteratorOfProcessForFinder : public Transfer_Iterator +{ +public: + Standard_EXPORT Transfer_IteratorOfProcessForFinder(const Standard_Boolean theWithStarts) + : Transfer_Iterator (theWithStarts) + { } + +}; +#endif diff --git a/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx b/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx new file mode 100644 index 0000000000..a8edfbe285 --- /dev/null +++ b/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx @@ -0,0 +1,66 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_IteratorOfProcessForTransient_HeaderFile +#define _Transfer_IteratorOfProcessForTransient_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TColStd_HSequenceOfTransient; +class Standard_NoSuchObject; +class Standard_Transient; +class TColStd_MapTransientHasher; +class Transfer_TransientProcess; +class Transfer_ActorOfTransientProcess; +class Transfer_Binder; + +typedef NCollection_IndexedDataMap + Transfer_TransferMapOfProcessForTransient; + + +class Transfer_IteratorOfProcessForTransient : public Transfer_Iterator +{ +public: + Standard_EXPORT Transfer_IteratorOfProcessForTransient(const Standard_Boolean theWithStarts) + : Transfer_Iterator (theWithStarts) + { } + +}; +#endif diff --git a/src/Transfer/Transfer_Mapper.cdl b/src/Transfer/Transfer_Mapper.cdl deleted file mode 100644 index c6f6719266..0000000000 --- a/src/Transfer/Transfer_Mapper.cdl +++ /dev/null @@ -1,62 +0,0 @@ --- Created on: 1994-11-04 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -generic class Mapper from Transfer - (TheKey as any; - TheHasher as any; - TheInfo as any) - inherits Finder - - ---Purpose : a Mapper defines a Finder for a specific input class - -- its definition includes the value of the Key to be mapped, - -- and the HashCoder associated to the class of the Key - -- - -- TheKey defines the class to be keyed - -- TheHasher is the associated Hasher - -- TheInfo is an additionnal class which helps to provide - -- informations on the value (template : see DataInfo) - -uses CString - -is - - Create (akey : any TheKey) returns mutable Mapper; - ---Purpose : Creates a Mapper with a Value. This Value can then not be - -- changed. It is used by the Hasher to compute the HashCode, - -- which will then be stored for an immediate reading. - - Value (me) returns any TheKey is static; - ---Purpose : Returns the contained value - ---C++ : return const & - - Equates (me; other : Finder) returns Boolean; - ---Purpose : Specific testof equallity : defined as False if has - -- not the same true Type, else contents are compared (by - -- C++ operator ==) - - ValueType (me) returns Type is redefined; - ---Purpose : Returns the Type of the Value. By default, returns the - -- DynamicType of , but can be redefined - - ValueTypeName (me) returns CString is redefined; - ---Purpose : Returns the name of the Type of the Value. Default is name - -- of ValueType, unless it is for a non-handled object - -fields - - theval : TheKey; - -end Mapper; diff --git a/src/Transfer/Transfer_Mapper.gxx b/src/Transfer/Transfer_Mapper.gxx deleted file mode 100644 index aa0363f299..0000000000 --- a/src/Transfer/Transfer_Mapper.gxx +++ /dev/null @@ -1,41 +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 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 - - -Transfer_Mapper::Transfer_Mapper (const TheKey& akey) - : theval (akey) -{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); } - - - const TheKey& Transfer_Mapper::Value () const - { return theval; } - - Standard_Boolean Transfer_Mapper::Equates - (const Handle(Transfer_Finder)& other) const -{ - if (other.IsNull()) return Standard_False; - if (GetHashCode() != other->GetHashCode()) return Standard_False; - if (other->DynamicType() != DynamicType()) return Standard_False; - Handle(Transfer_Mapper) another = Handle(Transfer_Mapper)::DownCast(other); -// return (theval == another->Value()); - return TheHasher::IsEqual (theval,another->Value()); -} - - Handle(Standard_Type) Transfer_Mapper::ValueType () const - { return TheInfo::Type(theval); } - - Standard_CString Transfer_Mapper::ValueTypeName () const - { return TheInfo::TypeName(theval); } diff --git a/src/Transfer/Transfer_Mapper.hxx b/src/Transfer/Transfer_Mapper.hxx new file mode 100644 index 0000000000..b1fc373897 --- /dev/null +++ b/src/Transfer/Transfer_Mapper.hxx @@ -0,0 +1,67 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_Mapper_HeaderFile +#define _Transfer_Mapper_HeaderFile + +#include +#include + + //! Mapper defines a Finder for a specific input class + //! its definition includes the value of the Key to be mapped, + //! and the HashCoder associated to the class of the Key + //! TheKey defines the class to be keyed + //! TheHasher is the associated Hasher + //! TheInfo is an additionnal class which helps to provide + //! informations on the value (template : see DataInfo) +template +class Transfer_Mapper : public Transfer_Finder +{ +private: + TheKey myVal; +public: + Standard_EXPORT Transfer_Mapper (const TheKey& theKey) + : myVal (theKey) + { + SetHashCode (TheHasher::HashCode (theKey, IntegerLast())); + } + + Standard_EXPORT const TheKey& Value () const + { + return myVal; + } + + Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& theOther) const + { + if (theOther.IsNull()) return Standard_False; + if (GetHashCode() != theOther->GetHashCode()) return Standard_False; + if (theOther->DynamicType() != DynamicType()) return Standard_False; + MapperHandle another = MapperHandle::DownCast(theOther); + return TheHasher::IsEqual (myVal,another->Value()); + } + + Standard_EXPORT Handle(Standard_Type) ValueType () const + { + return TheInfo::Type(myVal); + } + + Standard_EXPORT Standard_CString ValueTypeName () const + { + return TheInfo::TypeName(myVal); + } +}; +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_ResultFromModel.cdl b/src/Transfer/Transfer_ResultFromModel.cdl deleted file mode 100644 index 44b0f60106..0000000000 --- a/src/Transfer/Transfer_ResultFromModel.cdl +++ /dev/null @@ -1,152 +0,0 @@ --- Created on: 1995-11-16 --- Created by: Christian CAILLET --- 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 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. - -class ResultFromModel from Transfer inherits TShared - - ---Purpose : ResultFromModel is used to store a final result stored in a - -- TransientProcess, respectfully to its structuration in scopes - -- by using a set of ResultFromTransient - -- Hence, it can be regarded as a passive equivalent of the - -- stored data in the TransientProcess, while an Iterator gives - -- a flat view of it. - -- - -- A ResultFromModel is intended to be attached to the transfer - -- of one entity (typically root entity but it is not mandatory) - -- - -- It is then possible to : - -- - Create and fill a ResultFromModel from a TransientProcess, - -- by designating a starting entity - -- - Fill back the TransientProcess from a ResultFromModel, as it - -- were filled by the operation which filled it the first time - -uses CString, AsciiString, HSequenceOfTransient from TColStd, - InterfaceModel, CheckIterator, CheckStatus, - ResultFromTransient, TransientProcess - -is - - Create returns mutable ResultFromModel; - ---Purpose : Creates a ResultFromModel, empty - - SetModel (me : mutable; model : InterfaceModel); - ---Purpose : Sets starting Model - - SetFileName (me : mutable; filename : CString); - ---Purpose : Sets starting File Name - - Model (me) returns InterfaceModel; - ---Purpose : Returns starting Model (null if not set) - - FileName (me) returns CString; - ---Purpose : Returns starting File Name (empty if not set) - - Fill (me : mutable; TP : TransientProcess; ent : Transient) returns Boolean; - ---Purpose : Fills from a TransientProcess, with the result attached to - -- a starting entity. Considers its Model if it is set. - -- This action produces a structured set of ResultFromTransient, - -- considering scopes, starting by that of . - -- If has no recorded result, it remains empty - -- Returns True if a result is recorded, False else - - Strip (me : mutable; mode : Integer); - ---Purpose : Clears some data attached to binders used by TransientProcess, - -- which become useless once the transfer has been done, - -- by calling Strip on its ResultFromTransient - -- - -- mode = 0 : minimum, clears data remaining from TransferProcess - -- mode = 10 : just keeps file name, label, check status ..., - -- and MainResult but only the result (Binder) - -- mode = 11 : also clears MainResult (status and names remain) - - FillBack (me; TP : mutable TransientProcess); - ---Purpose : Fills back a TransientProcess from the structured set of - -- binders. Also sets the Model. - - - HasResult (me) returns Boolean; - ---Purpose : Returns True if a Result is recorded - - MainResult (me) returns ResultFromTransient; - ---Purpose : Returns the main recorded ResultFromTransient, or a null - - SetMainResult (me : mutable; amain : ResultFromTransient); - ---Purpose : Sets a new value for the main recorded ResultFromTransient - - MainLabel (me) returns CString; - ---Purpose : Returns the label in starting model attached to main entity - -- (updated by Fill or SetMainResult, if Model is known) - - MainNumber (me) returns Integer; - ---Purpose : Returns the label in starting model attached to main entity - - -- Global Queries -- - - ResultFromKey (me; start : Transient) returns ResultFromTransient; - ---Purpose : Searches for a key (starting entity) and returns its result - -- Returns a null handle if not found - - Results (me; level : Integer) returns HSequenceOfTransient; - ---Purpose : Internal method which returns the list of ResultFromTransient, - -- according level (2:complete; 1:sub-level 1; 0:main only) - - TransferredList (me; level : Integer = 2) returns HSequenceOfTransient; - ---Purpose : Returns the list of recorded starting entities, ending by the - -- root. Entities with check but no transfer result are ignored - -- = 2 (D), considers the complete list - -- = 1 considers the main result plus immediate subs - -- = 0 just the main result - - CheckedList (me; check : CheckStatus; result : Boolean) - returns HSequenceOfTransient; - ---Purpose : Returns the list of starting entities to which a check status - -- is attached. - -- = -2 , all entities whatever the check (see result) - -- = -1 , entities with no fail (warning allowed) - -- = 0 , entities with no check at all - -- = 1 , entities with warning but no fail - -- = 2 , entities with fail - -- : if True, only entities with an attached result - -- Remark : result True and check=0 will give an empty list - - CheckList (me; erronly : Boolean; level : Integer = 2) - returns CheckIterator; - ---Purpose : Returns the check-list of this set of results - -- true : only fails are considered - -- = 0 : considers only main binder - -- = 1 : considers main binder plus immediate subs - -- = 2 (D) : considers all checks - - CheckStatus (me) returns CheckStatus; - ---Purpose : Returns the check status with corresponds to the content - -- of this ResultFromModel; considers all levels of transfer - -- (worst status). Returns CheckAny if not yet computed - -- Reads it from recorded status if already computed, else - -- recomputes one - - ComputeCheckStatus (me : mutable; enforce : Boolean) returns CheckStatus; - ---Purpose : Computes and records check status (see CheckStatus) - -- Does not computes it if already done and False - -fields - - themodel : InterfaceModel; - thename : AsciiString; - themain : ResultFromTransient; - themlab : AsciiString; - themnum : Integer; - themchk : CheckStatus; - -end ResultFromModel; diff --git a/src/Transfer/Transfer_ResultFromModel.cxx b/src/Transfer/Transfer_ResultFromModel.cxx index f323b601bc..06bb220780 100644 --- a/src/Transfer/Transfer_ResultFromModel.cxx +++ b/src/Transfer/Transfer_ResultFromModel.cxx @@ -11,13 +11,31 @@ // 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 +#include +#include +#include +IMPLEMENT_STANDARD_TYPE(Transfer_ResultFromModel) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_ResultFromModel) + + +IMPLEMENT_DOWNCAST(Transfer_ResultFromModel,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_ResultFromModel) Transfer_ResultFromModel::Transfer_ResultFromModel () { themnum = 0; themchk = Interface_CheckAny; } diff --git a/src/Transfer/Transfer_ResultFromModel.hxx b/src/Transfer/Transfer_ResultFromModel.hxx new file mode 100644 index 0000000000..d5a62a03e4 --- /dev/null +++ b/src/Transfer/Transfer_ResultFromModel.hxx @@ -0,0 +1,158 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_ResultFromModel_HeaderFile +#define _Transfer_ResultFromModel_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class Interface_InterfaceModel; +class Transfer_ResultFromTransient; +class Transfer_TransientProcess; +class Standard_Transient; +class TColStd_HSequenceOfTransient; +class Interface_CheckIterator; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class Transfer_ResultFromModel; + +DEFINE_STANDARD_HANDLE(Transfer_ResultFromModel,MMgt_TShared) + +//! ResultFromModel is used to store a final result stored in a
+//! TransientProcess, respectfully to its structuration in scopes
+//! by using a set of ResultFromTransient
+//! Hence, it can be regarded as a passive equivalent of the
+//! stored data in the TransientProcess, while an Iterator gives
+//! a flat view of it.
+//!
+//! A ResultFromModel is intended to be attached to the transfer
+//! of one entity (typically root entity but it is not mandatory)
+//!
+//! It is then possible to :
+//! - Create and fill a ResultFromModel from a TransientProcess,
+//! by designating a starting entity
+//! - Fill back the TransientProcess from a ResultFromModel, as it
+//! were filled by the operation which filled it the first time
+class Transfer_ResultFromModel : public MMgt_TShared { + +public: + + //! Creates a ResultFromModel, empty
+ Standard_EXPORT Transfer_ResultFromModel(); + //! Sets starting Model
+ Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model) ; + //! Sets starting File Name
+ Standard_EXPORT void SetFileName(const Standard_CString filename) ; + //! Returns starting Model (null if not set)
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + //! Returns starting File Name (empty if not set)
+ Standard_EXPORT Standard_CString FileName() const; + //! Fills from a TransientProcess, with the result attached to
+//! a starting entity. Considers its Model if it is set.
+//! This action produces a structured set of ResultFromTransient,
+//! considering scopes, starting by that of .
+//! If has no recorded result, it remains empty
+//! Returns True if a result is recorded, False else
+ Standard_EXPORT Standard_Boolean Fill(const Handle(Transfer_TransientProcess)& TP,const Handle(Standard_Transient)& ent) ; + //! Clears some data attached to binders used by TransientProcess,
+//! which become useless once the transfer has been done,
+//! by calling Strip on its ResultFromTransient
+//!
+//! mode = 0 : minimum, clears data remaining from TransferProcess
+//! mode = 10 : just keeps file name, label, check status ...,
+//! and MainResult but only the result (Binder)
+//! mode = 11 : also clears MainResult (status and names remain)
+ Standard_EXPORT void Strip(const Standard_Integer mode) ; + //! Fills back a TransientProcess from the structured set of
+//! binders. Also sets the Model.
+ Standard_EXPORT void FillBack(const Handle(Transfer_TransientProcess)& TP) const; + //! Returns True if a Result is recorded
+ Standard_EXPORT Standard_Boolean HasResult() const; + //! Returns the main recorded ResultFromTransient, or a null
+ Standard_EXPORT Handle_Transfer_ResultFromTransient MainResult() const; + //! Sets a new value for the main recorded ResultFromTransient
+ Standard_EXPORT void SetMainResult(const Handle(Transfer_ResultFromTransient)& amain) ; + //! Returns the label in starting model attached to main entity
+//! (updated by Fill or SetMainResult, if Model is known)
+ Standard_EXPORT Standard_CString MainLabel() const; + //! Returns the label in starting model attached to main entity
+ Standard_EXPORT Standard_Integer MainNumber() const; + //! Searches for a key (starting entity) and returns its result
+//! Returns a null handle if not found
+ Standard_EXPORT Handle_Transfer_ResultFromTransient ResultFromKey(const Handle(Standard_Transient)& start) const; + //! Internal method which returns the list of ResultFromTransient,
+//! according level (2:complete; 1:sub-level 1; 0:main only)
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient Results(const Standard_Integer level) const; + //! Returns the list of recorded starting entities, ending by the
+//! root. Entities with check but no transfer result are ignored
+//! = 2 (D), considers the complete list
+//! = 1 considers the main result plus immediate subs
+//! = 0 just the main result
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient TransferredList(const Standard_Integer level = 2) const; + //! Returns the list of starting entities to which a check status
+//! is attached.
+//! = -2 , all entities whatever the check (see result)
+//! = -1 , entities with no fail (warning allowed)
+//! = 0 , entities with no check at all
+//! = 1 , entities with warning but no fail
+//! = 2 , entities with fail
+//! : if True, only entities with an attached result
+//! Remark : result True and check=0 will give an empty list
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient CheckedList(const Interface_CheckStatus check,const Standard_Boolean result) const; + //! Returns the check-list of this set of results
+//! true : only fails are considered
+//! = 0 : considers only main binder
+//! = 1 : considers main binder plus immediate subs
+//! = 2 (D) : considers all checks
+ Standard_EXPORT Interface_CheckIterator CheckList(const Standard_Boolean erronly,const Standard_Integer level = 2) const; + //! Returns the check status with corresponds to the content
+//! of this ResultFromModel; considers all levels of transfer
+//! (worst status). Returns CheckAny if not yet computed
+//! Reads it from recorded status if already computed, else
+//! recomputes one
+ Standard_EXPORT Interface_CheckStatus CheckStatus() const; + //! Computes and records check status (see CheckStatus)
+//! Does not computes it if already done and False
+ Standard_EXPORT Interface_CheckStatus ComputeCheckStatus(const Standard_Boolean enforce) ; + + DEFINE_STANDARD_RTTI(Transfer_ResultFromModel) + +private: + + +Handle_Interface_InterfaceModel themodel; +TCollection_AsciiString thename; +Handle_Transfer_ResultFromTransient themain; +TCollection_AsciiString themlab; +Standard_Integer themnum; +Interface_CheckStatus themchk; + + +}; +#endif diff --git a/src/Transfer/Transfer_ResultFromTransient.cdl b/src/Transfer/Transfer_ResultFromTransient.cdl deleted file mode 100644 index 54c617a90d..0000000000 --- a/src/Transfer/Transfer_ResultFromTransient.cdl +++ /dev/null @@ -1,103 +0,0 @@ --- Created on: 1995-11-16 --- Created by: Christian CAILLET --- 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 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. - -class ResultFromTransient from Transfer inherits TShared - - ---Purpose : This class, in conjunction with ResultFromModel, allows to - -- record the result of a transfer initially stored in a - -- TransientProcess. - -- - -- A ResultFromTransient records a couple (Transient,Binder for - -- the result and checks) plus a list of "sub-results", which - -- have been recorded in the TrabsientProcess, under scope - -- attached to the starting transient. - -uses Transient, HSequenceOfTransient, IndexedMapOfTransient, - Check, CheckStatus, Binder, TransientProcess - -is - - Create returns mutable ResultFromTransient; - ---Purpose : Creates a ResultFromTransient, empty - - SetStart (me : mutable; start : any Transient); - ---Purpose : Sets starting entity - - SetBinder (me : mutable; binder : any Binder); - ---Purpose : Sets Binder (for result plus individual check) - - Start (me) returns any Transient; - ---Purpose : Returns the starting entity - - Binder (me) returns any Binder; - ---Purpose : Returns the binder - - HasResult (me) returns Boolean; - ---Purpose : Returns True if a result is recorded - - Check (me) returns Check; - ---Purpose : Returns the check (or an empty one if no binder) - ---C++ : return const - - CheckStatus (me) returns CheckStatus; - ---Purpose : Returns the check status - - - ClearSubs (me : mutable); - ---Purpose : Clears the list of (immediate) sub-results - - AddSubResult (me : mutable; sub : mutable ResultFromTransient); - ---Purpose : Adds a sub-result - - NbSubResults (me) returns Integer; - ---Purpose : Returns the count of recorded sub-results - - SubResult (me; num : Integer) returns mutable ResultFromTransient; - ---Purpose : Returns a sub-result, given its rank - - ResultFromKey (me; key : Transient) returns ResultFromTransient; - ---Purpose : Returns the ResultFromTransient attached to a given starting - -- entity (the key). Returns a null handle if not found - - FillMap (me; map : in out IndexedMapOfTransient); - ---Purpose : This method is used by ResultFromModel to collate the list of - -- ResultFromTransient, avoiding duplications with a map - -- Remark : is already in the map and has not to be bound - - - Fill (me : mutable; TP : TransientProcess); - ---Purpose : Fills from a TransientProcess, with the starting entity which - -- must have been set before. It works with scopes, calls Fill - -- on each of its sub-results - - Strip (me : mutable); - ---Purpose : Clears some data attached to binders used by TransientProcess, - -- which become useless once the transfer has been done : - -- the list of sub-scoped binders, which is now recorded as - -- sub-results - - FillBack (me; TP : mutable TransientProcess); - ---Purpose : Fills back a TransientProcess with definition of a - -- ResultFromTransient, respectfully to its structuration in - -- scopes - -fields - - thestart : Transient; - thebinder : Binder; - thesubs : HSequenceOfTransient; - -end ResultFromTransient; diff --git a/src/Transfer/Transfer_ResultFromTransient.cxx b/src/Transfer/Transfer_ResultFromTransient.cxx index 17f93fd731..d90f885d76 100644 --- a/src/Transfer/Transfer_ResultFromTransient.cxx +++ b/src/Transfer/Transfer_ResultFromTransient.cxx @@ -11,8 +11,28 @@ // 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 + +IMPLEMENT_STANDARD_TYPE(Transfer_ResultFromTransient) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_ResultFromTransient) + + +IMPLEMENT_DOWNCAST(Transfer_ResultFromTransient,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_ResultFromTransient) static Handle(Interface_Check) voidcheck = new Interface_Check; diff --git a/src/Transfer/Transfer_ResultFromTransient.hxx b/src/Transfer/Transfer_ResultFromTransient.hxx new file mode 100644 index 0000000000..17adc51d41 --- /dev/null +++ b/src/Transfer/Transfer_ResultFromTransient.hxx @@ -0,0 +1,114 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_ResultFromTransient_HeaderFile +#define _Transfer_ResultFromTransient_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class Transfer_Binder; +class TColStd_HSequenceOfTransient; +class Interface_Check; +class TColStd_IndexedMapOfTransient; +class Transfer_TransientProcess; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class Transfer_ResultFromTransient; + +DEFINE_STANDARD_HANDLE(Transfer_ResultFromTransient,MMgt_TShared) + +//! This class, in conjunction with ResultFromModel, allows to
+//! record the result of a transfer initially stored in a
+//! TransientProcess.
+//!
+//! A ResultFromTransient records a couple (Transient,Binder for
+//! the result and checks) plus a list of "sub-results", which
+//! have been recorded in the TrabsientProcess, under scope
+//! attached to the starting transient.
+ +class Transfer_ResultFromTransient : public MMgt_TShared +{ + +public: + + //! Creates a ResultFromTransient, empty
+ Standard_EXPORT Transfer_ResultFromTransient(); + //! Sets starting entity
+ Standard_EXPORT void SetStart(const Handle(Standard_Transient)& start) ; + //! Sets Binder (for result plus individual check)
+ Standard_EXPORT void SetBinder(const Handle(Transfer_Binder)& binder) ; + //! Returns the starting entity
+ Standard_EXPORT Handle_Standard_Transient Start() const; + //! Returns the binder
+ Standard_EXPORT Handle_Transfer_Binder Binder() const; + //! Returns True if a result is recorded
+ Standard_EXPORT Standard_Boolean HasResult() const; + //! Returns the check (or an empty one if no binder)
+ Standard_EXPORT const Handle_Interface_Check Check() const; + //! Returns the check status
+ Standard_EXPORT Interface_CheckStatus CheckStatus() const; + //! Clears the list of (immediate) sub-results
+ Standard_EXPORT void ClearSubs() ; + //! Adds a sub-result
+ Standard_EXPORT void AddSubResult(const Handle(Transfer_ResultFromTransient)& sub) ; + //! Returns the count of recorded sub-results
+ Standard_EXPORT Standard_Integer NbSubResults() const; + //! Returns a sub-result, given its rank
+ Standard_EXPORT Handle_Transfer_ResultFromTransient SubResult(const Standard_Integer num) const; + //! Returns the ResultFromTransient attached to a given starting
+ //! entity (the key). Returns a null handle if not found
+ Standard_EXPORT Handle_Transfer_ResultFromTransient ResultFromKey(const Handle(Standard_Transient)& key) const; + //! This method is used by ResultFromModel to collate the list of
+ //! ResultFromTransient, avoiding duplications with a map
+ //! Remark : is already in the map and has not to be bound
+ Standard_EXPORT void FillMap(TColStd_IndexedMapOfTransient& map) const; + //! Fills from a TransientProcess, with the starting entity which
+ //! must have been set before. It works with scopes, calls Fill
+ //! on each of its sub-results
+ Standard_EXPORT void Fill(const Handle(Transfer_TransientProcess)& TP) ; + //! Clears some data attached to binders used by TransientProcess,
+ //! which become useless once the transfer has been done :
+ //! the list of sub-scoped binders, which is now recorded as
+ //! sub-results
+ Standard_EXPORT void Strip() ; + //! Fills back a TransientProcess with definition of a
+ //! ResultFromTransient, respectfully to its structuration in
+ //! scopes
+ Standard_EXPORT void FillBack(const Handle(Transfer_TransientProcess)& TP) const; + + DEFINE_STANDARD_RTTI(Transfer_ResultFromTransient) + +private: + + Handle_Standard_Transient thestart; + Handle_Transfer_Binder thebinder; + Handle_TColStd_HSequenceOfTransient thesubs; + +}; +#endif diff --git a/src/Transfer/Transfer_SimpleBinder.cdl b/src/Transfer/Transfer_SimpleBinder.cdl deleted file mode 100644 index a7670a22fa..0000000000 --- a/src/Transfer/Transfer_SimpleBinder.cdl +++ /dev/null @@ -1,81 +0,0 @@ --- Created on: 1992-02-17 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -generic class SimpleBinder from Transfer - - (TheResult as any; -- any : avoid Transient classes - TheInfo as any) -- template : DataInfo - - inherits Binder - - ---Purpose : Allows direct binding between a starting Object and the Result - -- of its transfer when it is Unique. - -- The Result itself is defined as a formal parameter - -- Warning : While it is possible to instantiate SimpleBinder with any Type - -- for the Result, it is not advisable to instantiate it with - -- Transient Classes, because such Results are directly known and - -- managed by TransferProcess & Co, through - -- SimpleBinderOfTransient : this class looks like instantiation - -- of SimpleBinder, but its method ResultType - -- is adapted (reads DynamicType of the Result) - -uses CString, Type - -raises TransferFailure - -is - - Create returns mutable SimpleBinder; - ---Purpose : normal standard constructor, creates an empty SimpleBinder - - Create (res : any TheResult) returns mutable SimpleBinder; - ---Purpose : constructor which in the same time defines the result - --- IsMultiple (me) returns Boolean; - ---Purpose : Returns True if a starting object is bound with SEVERAL - -- results : Here, returns allways False - -- But it can have next results - - ResultType (me) returns Type; - ---Purpose : Returns the Type permitted for the Result, i.e. the Type - -- of the Parameter Class (statically defined) - - ResultTypeName (me) returns CString; - ---Purpose : Returns the Type Name computed for the Result (dynamic) - - SetResult (me : mutable; res : any TheResult) - ---Purpose : Defines the Result - raises TransferFailure; - -- Error if the Result is already used (see class Binder) - - Result (me) returns any TheResult - ---Purpose : Returns the defined Result, if there is one - raises TransferFailure; - -- Error if the Result is not defined (see class Binder) - ---C++ : return const & - - CResult (me : mutable) returns any TheResult; - ---Purpose : Returns the defined Result, if there is one, and allows to - -- change it (avoids Result + SetResult). - -- Admits that Result can be not yet defined - -- Warning : a call to CResult causes Result to be known as defined - ---C++ : return & - -fields - - theres : TheResult; - -end SimpleBinder; diff --git a/src/Transfer/Transfer_SimpleBinder.gxx b/src/Transfer/Transfer_SimpleBinder.gxx deleted file mode 100644 index 69f415f87d..0000000000 --- a/src/Transfer/Transfer_SimpleBinder.gxx +++ /dev/null @@ -1,48 +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 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 classe generique - - -// "TheResult" identifie la classe donnee en parametre du Resultat - - -Transfer_SimpleBinder::Transfer_SimpleBinder () { } - - Transfer_SimpleBinder::Transfer_SimpleBinder (const TheResult& res) - : theres (res) - { SetResultPresent(); } - - -// Standard_Boolean Transfer_SimpleBinder::IsMultiple() const -// { return Standard_False; } - - - Handle(Standard_Type) Transfer_SimpleBinder::ResultType () const - { return TheInfo::Type (theres); } // correspond a "STANDARD_TYPE(TheResult)" - - Standard_CString Transfer_SimpleBinder::ResultTypeName () const - { return TheInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TheResult)" - - - void Transfer_SimpleBinder::SetResult (const TheResult& res) -{ - SetResultPresent(); - theres = res; -} - - const TheResult& Transfer_SimpleBinder::Result () const - { return theres; } - - TheResult& Transfer_SimpleBinder::CResult () - { SetResultPresent(); return theres; } diff --git a/src/Transfer/Transfer_TransferDispatch.cdl b/src/Transfer/Transfer_TransferDispatch.cdl deleted file mode 100644 index ec3cb96791..0000000000 --- a/src/Transfer/Transfer_TransferDispatch.cdl +++ /dev/null @@ -1,66 +0,0 @@ --- Created on: 1992-02-07 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -class TransferDispatch from Transfer inherits CopyTool - - ---Purpose : A TransferDispatch is aimed to dispatch Entities between two - -- Interface Models, by default by copying them, as CopyTool, but - -- with more capabilities of adapting : Copy is redefined to - -- firstly pass the hand to a TransferProcess. If this gives no - -- result, standard Copy is called. - -- - -- This allow, for instance, to modify the copied Entity (such as - -- changing a Name for a VDA Entity), or to do a deeper work - -- (such as Substituting a kind of Entity to another one). - -- - -- For these reasons, TransferDispatch is basically a CopyTool, - -- but uses a more sophiscated control, which is TransferProcess, - -- and its method Copy is redefined - -uses Transient, InterfaceModel, GeneralLib, Protocol from Interface, - TransientProcess - -raises InterfaceError - -is - - Create (amodel : InterfaceModel; lib : GeneralLib) returns TransferDispatch; - ---Purpose : Creates a TransferDispatch from a Model. Works with a General - -- Service Library, given as an Argument - -- A TransferDispatch is created as a CopyTool in which the - -- Control is set to TransientProcess - - Create (amodel : InterfaceModel; protocol : Protocol from Interface) - returns TransferDispatch; - ---Purpose : Same as above, but Library is defined through a Protocol - - Create (amodel : InterfaceModel) returns TransferDispatch - ---Purpose : Same as above, but works with the Active Protocol - raises InterfaceError; - -- Error if no Active Protocol is defined - - TransientProcess (me) returns mutable TransientProcess; - ---Purpose : Returns the content of Control Object, as a TransientProcess - - - Copy (me : in out; entfrom : Transient; entto : out mutable Transient; - mapped : Boolean; errstat : Boolean) - returns Boolean is redefined; - ---Purpose : Copies an Entity by calling the method Transferring from the - -- TransferProcess. If this called produces a Null Binder, then - -- the standard, inherited Copy is called - -end TransferDispatch; diff --git a/src/Transfer/Transfer_TransferDispatch.cxx b/src/Transfer/Transfer_TransferDispatch.cxx index d368ad597b..81b927c1cb 100644 --- a/src/Transfer/Transfer_TransferDispatch.cxx +++ b/src/Transfer/Transfer_TransferDispatch.cxx @@ -11,45 +11,51 @@ // 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 Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Interface_GeneralLib& lib) - : Interface_CopyTool (amodel,lib) -{ SetControl (new Transfer_DispatchControl - (amodel, new Transfer_TransientProcess(amodel->NbEntities()))); } + (const Handle(Interface_InterfaceModel)& amodel, + const Interface_GeneralLib& lib) + : Interface_CopyTool (amodel,lib) +{ + SetControl (new Transfer_DispatchControl + (amodel, new Transfer_TransientProcess(amodel->NbEntities()))); +} +Transfer_TransferDispatch::Transfer_TransferDispatch + (const Handle(Interface_InterfaceModel)& amodel, + const Handle(Interface_Protocol)& protocol) + : Interface_CopyTool (amodel,protocol) +{ + SetControl (new Transfer_DispatchControl + (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); +} - Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Handle(Interface_Protocol)& protocol) - : Interface_CopyTool (amodel,protocol) -{ SetControl (new Transfer_DispatchControl - (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); } +Transfer_TransferDispatch::Transfer_TransferDispatch + (const Handle(Interface_InterfaceModel)& amodel) + : Interface_CopyTool (amodel) +{ + SetControl (new Transfer_DispatchControl + (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); +} - - Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel) - : Interface_CopyTool (amodel) -{ SetControl (new Transfer_DispatchControl - (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); } - - - - Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess +Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess () const { return Handle(Transfer_DispatchControl)::DownCast(Control())->TransientProcess(); } - Standard_Boolean Transfer_TransferDispatch::Copy - (const Handle(Standard_Transient)& entfrom, - Handle(Standard_Transient)& entto, - const Standard_Boolean mapped, const Standard_Boolean errstat) +Standard_Boolean Transfer_TransferDispatch::Copy + (const Handle(Standard_Transient)& entfrom, + Handle(Standard_Transient)& entto, + const Standard_Boolean mapped, + const Standard_Boolean errstat) { Handle(Transfer_Binder) result = TransientProcess()->Transferring(entfrom); if (result.IsNull()) diff --git a/src/Transfer/Transfer_TransferDispatch.hxx b/src/Transfer/Transfer_TransferDispatch.hxx new file mode 100644 index 0000000000..3907cdbcb5 --- /dev/null +++ b/src/Transfer/Transfer_TransferDispatch.hxx @@ -0,0 +1,77 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_TransferDispatch_HeaderFile +#define _Transfer_TransferDispatch_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceError; +class Interface_InterfaceModel; +class Interface_Protocol; +class Transfer_TransientProcess; +class Standard_Transient; + + +//! A TransferDispatch is aimed to dispatch Entities between two
+//! Interface Models, by default by copying them, as CopyTool, but
+//! with more capabilities of adapting : Copy is redefined to
+//! firstly pass the hand to a TransferProcess. If this gives no
+//! result, standard Copy is called.
+//!
+//! This allow, for instance, to modify the copied Entity (such as
+//! changing a Name for a VDA Entity), or to do a deeper work
+//! (such as Substituting a kind of Entity to another one).
+//!
+//! For these reasons, TransferDispatch is basically a CopyTool,
+//! but uses a more sophiscated control, which is TransferProcess,
+//! and its method Copy is redefined
+class Transfer_TransferDispatch : public Interface_CopyTool +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a TransferDispatch from a Model. Works with a General
+ //! Service Library, given as an Argument
+ //! A TransferDispatch is created as a CopyTool in which the
+ //! Control is set to TransientProcess
+ Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,const Interface_GeneralLib& lib); + //! Same as above, but Library is defined through a Protocol
+ Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,const Handle(Interface_Protocol)& protocol); + //! Same as above, but works with the Active Protocol
+ Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel); + //! Returns the content of Control Object, as a TransientProcess
+ Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; + //! Copies an Entity by calling the method Transferring from the
+ //! TransferProcess. If this called produces a Null Binder, then
+ //! the standard, inherited Copy is called
+ Standard_EXPORT virtual Standard_Boolean Copy (const Handle(Standard_Transient)& entfrom, + Handle(Standard_Transient)& entto, + const Standard_Boolean mapped, + const Standard_Boolean errstat) ; +}; +#endif diff --git a/src/Transfer/Transfer_TransferInput.cdl b/src/Transfer/Transfer_TransferInput.cdl index 04310c01e6..8a007ff0df 100644 --- a/src/Transfer/Transfer_TransferInput.cdl +++ b/src/Transfer/Transfer_TransferInput.cdl @@ -23,7 +23,7 @@ class TransferInput from Transfer -- only Transient Objects) uses InterfaceModel, EntityIterator, Protocol from Interface, - TransferIterator, TransientProcess, FinderProcess + TransferIterator, TransientProcess_Handle, FinderProcess_Handle raises TransferFailure @@ -38,7 +38,7 @@ is -- Error if one of the Resulting Objects is defined not Transient - FillModel (me; proc : TransientProcess; + FillModel (me; proc : TransientProcess_Handle; amodel : mutable InterfaceModel) ---Purpose : Fills an InterfaceModel with the Complete Result of a Transfer -- stored in a TransientProcess (Starting Objects are Transient) @@ -46,7 +46,7 @@ is raises TransferFailure; -- Error if one of the Resulting Objects is defined not Transient - FillModel (me; proc : TransientProcess; + FillModel (me; proc : TransientProcess_Handle; amodel : mutable InterfaceModel; proto : Protocol from Interface; roots : Boolean = Standard_True) @@ -59,7 +59,7 @@ is -- Error if one of the Resulting Objects is defined not Transient - FillModel (me; proc : FinderProcess; + FillModel (me; proc : FinderProcess_Handle; amodel : mutable InterfaceModel) ---Purpose : Fills an InterfaceModel with the Complete Result of a Transfer -- stored in a TransientProcess (Starting Objects are Transient) @@ -67,7 +67,7 @@ is raises TransferFailure; -- Error if one of the Resulting Objects is defined not Transient - FillModel (me; proc : FinderProcess; + FillModel (me; proc : FinderProcess_Handle; amodel : mutable InterfaceModel; proto : Protocol from Interface; roots : Boolean = Standard_True) diff --git a/src/Transfer/Transfer_TransferInput.cxx b/src/Transfer/Transfer_TransferInput.cxx index 59d46037b3..25bacc98c9 100644 --- a/src/Transfer/Transfer_TransferInput.cxx +++ b/src/Transfer/Transfer_TransferInput.cxx @@ -13,6 +13,8 @@ #include #include +#include +#include #include #include #include diff --git a/src/Transfer/Transfer_TransferOutput.cdl b/src/Transfer/Transfer_TransferOutput.cdl deleted file mode 100644 index 3b50071f59..0000000000 --- a/src/Transfer/Transfer_TransferOutput.cdl +++ /dev/null @@ -1,113 +0,0 @@ --- Created on: 1992-02-04 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -class TransferOutput from Transfer - - ---Purpose : A TransferOutput is a Tool which manages the transfer of - -- entities created by an Interface, stored in an InterfaceModel, - -- into a set of Objects suitable for an Application - -- Objects to be transferred are given, by method Transfer - -- (which calls Transfer from TransientProcess) - -- A default action is available to get all roots of the Model - -- Result is given as a TransferIterator (see TransferProcess) - -- Also, it is possible to pilot directly the TransientProcess - -uses Transient, HSequenceOfTransient, - InterfaceModel, Protocol from Interface, Graph, EntityIterator, - TransientProcess, ActorOfTransientProcess - -raises NoSuchObject, TransferFailure - -is - - Create (actor : mutable ActorOfTransientProcess; amodel : InterfaceModel) - returns TransferOutput; - ---Purpose : Creates a TransferOutput ready to use, with a TransientProcess - - Create (proc : mutable TransientProcess; amodel : InterfaceModel) - returns TransferOutput; - ---Purpose : Creates a TransferOutput from an already existing - -- TransientProcess, and a Model - --- ScopeMode (me : in out) returns Boolean; - ---Purpose : Returns (by Reference, hence can be changed) the Mode for - -- Scope Management. False (D) means Scope is ignored. - -- True means that each individual Transfer (direct or through - -- TransferRoots) is regarded as one Scope - ---C++ : return & - - Model (me) returns InterfaceModel; - ---Purpose : Returns the Starting Model - - TransientProcess (me) returns mutable TransientProcess; - ---Purpose : Returns the TransientProcess used to work - - Transfer (me : in out; obj : Transient) - ---Purpose : Transfer checks that all taken Entities come from the same - -- Model, then calls Transfer from TransientProcess - raises TransferFailure; - -- Error if does not come from starting Model - - - TransferRoots (me : in out; protocol : Protocol from Interface); - ---Purpose : Runs transfer on the roots of the Interface Model - -- The Roots are computed with a ShareFlags created from a - -- Protocol given as Argument - - TransferRoots (me : in out; G : Graph from Interface); - ---Purpose : Runs transfer on the roots defined by a Graph of dependences - -- (which detains also a Model and its Entities) - -- Roots are computed with a ShareFlags created from the Graph - - TransferRoots (me : in out); - ---Purpose : Runs transfer on the roots of the Interface Model - -- Remark : the Roots are computed with a ShareFlags created - -- from the Active Protocol - - -- Helping Extractions -- - - ListForStatus (me; normal : Boolean; roots : Boolean = Standard_True) - returns EntityIterator; - ---Purpose : Returns the list of Starting Entities with these criteria : - -- - False, gives the entities bound with ABNORMAL STATUS - -- (e.g. : Fail recorded, Exception raised during Transfer) - -- - True, gives Entities with or without a Result, but - -- with no Fail, no Exception (Warnings are not counted) - -- - False, considers all entities recorded (either for - -- Result, or for at least one Fail or Warning message) - -- - True (Default), considers only roots of Transfer - -- (the Entities recorded at highest level) - -- This method is based on AbnormalResult from TransferProcess - - ModelForStatus (me; protocol : Protocol; - normal : Boolean; roots : Boolean = Standard_True) - returns mutable InterfaceModel; - ---Purpose : Fills a Model with the list determined by ListForStatus - -- This model starts from scratch (made by NewEmptyModel from the - -- current Model), then is filled by AddWithRefs - -- - -- Useful to get separately from a transfer, the entities which - -- have caused problem, in order to furtherly analyse them (with - -- normal = False), or the "good" entities, to obtain a data set - -- "which works well" (with normal = True) - -fields - - theproc : TransientProcess; - themodel : InterfaceModel; --- thescope : Boolean; - -end TransferOutput; diff --git a/src/Transfer/Transfer_TransferOutput.cxx b/src/Transfer/Transfer_TransferOutput.cxx index ff112d69e6..31b3cd3e10 100644 --- a/src/Transfer/Transfer_TransferOutput.cxx +++ b/src/Transfer/Transfer_TransferOutput.cxx @@ -12,7 +12,17 @@ // commercial license or contractual agreement. //szv#4 S4163 -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/src/Transfer/Transfer_TransferOutput.hxx b/src/Transfer/Transfer_TransferOutput.hxx new file mode 100644 index 0000000000..564571c55f --- /dev/null +++ b/src/Transfer/Transfer_TransferOutput.hxx @@ -0,0 +1,123 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_TransferOutput_HeaderFile +#define _Transfer_TransferOutput_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Transfer_TransientProcess; +class Interface_InterfaceModel; +class Standard_NoSuchObject; +class Transfer_TransferFailure; +class Transfer_ActorOfTransientProcess; +class Standard_Transient; +class Interface_Protocol; +class Interface_Graph; +class Interface_EntityIterator; + +//! A TransferOutput is a Tool which manages the transfer of
+//! entities created by an Interface, stored in an InterfaceModel,
+//! into a set of Objects suitable for an Application
+//! Objects to be transferred are given, by method Transfer
+//! (which calls Transfer from TransientProcess)
+//! A default action is available to get all roots of the Model
+//! Result is given as a TransferIterator (see TransferProcess)
+//! Also, it is possible to pilot directly the TransientProcess
+class Transfer_TransferOutput +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a TransferOutput ready to use, with a TransientProcess
+ Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_ActorOfTransientProcess)& actor, + const Handle(Interface_InterfaceModel)& amodel); + + //! Creates a TransferOutput from an already existing
+ //! TransientProcess, and a Model
//! Returns (by Reference, hence can be changed) the Mode for
+ //! Scope Management. False (D) means Scope is ignored.
+ //! True means that each individual Transfer (direct or through
+ //! TransferRoots) is regarded as one Scope
+ Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc, + const Handle(Interface_InterfaceModel)& amodel); + + //! Returns the Starting Model
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + + //! Returns the TransientProcess used to work
+ Standard_EXPORT Handle_Transfer_TransientProcess TransientProcess() const; + + //! Transfer checks that all taken Entities come from the same
+ //! Model, then calls Transfer from TransientProcess
+ Standard_EXPORT void Transfer(const Handle(Standard_Transient)& obj); + + //! Runs transfer on the roots of the Interface Model
+ //! The Roots are computed with a ShareFlags created from a
+ //! Protocol given as Argument
+ Standard_EXPORT void TransferRoots(const Handle(Interface_Protocol)& protocol); + + //! Runs transfer on the roots defined by a Graph of dependences
+ //! (which detains also a Model and its Entities)
+ //! Roots are computed with a ShareFlags created from the Graph
+ Standard_EXPORT void TransferRoots(const Interface_Graph& G); + + //! Runs transfer on the roots of the Interface Model
+ //! Remark : the Roots are computed with a ShareFlags created
+ //! from the Active Protocol
+ Standard_EXPORT void TransferRoots(); + + //! Returns the list of Starting Entities with these criteria :
+ //! - False, gives the entities bound with ABNORMAL STATUS
+ //! (e.g. : Fail recorded, Exception raised during Transfer)
+ //! - True, gives Entities with or without a Result, but
+ //! with no Fail, no Exception (Warnings are not counted)
+ //! - False, considers all entities recorded (either for
+ //! Result, or for at least one Fail or Warning message)
+ //! - True (Default), considers only roots of Transfer
+ //! (the Entities recorded at highest level)
+ //! This method is based on AbnormalResult from TransferProcess
+ Standard_EXPORT Interface_EntityIterator ListForStatus (const Standard_Boolean normal, + const Standard_Boolean roots = Standard_True) const; + //! Fills a Model with the list determined by ListForStatus
+ //! This model starts from scratch (made by NewEmptyModel from the
+ //! current Model), then is filled by AddWithRefs
+ //!
+ //! Useful to get separately from a transfer, the entities which
+ //! have caused problem, in order to furtherly analyse them (with
+ //! normal = False), or the "good" entities, to obtain a data set
+ //! "which works well" (with normal = True)
+ Standard_EXPORT Handle_Interface_InterfaceModel ModelForStatus (const Handle(Interface_Protocol)& protocol, + const Standard_Boolean normal, + const Standard_Boolean roots = Standard_True) const; + +private: + +Handle_Transfer_TransientProcess theproc; +Handle_Interface_InterfaceModel themodel; + + +}; +#endif diff --git a/src/Transfer/Transfer_TransferProcess.cdl b/src/Transfer/Transfer_TransferProcess.cdl deleted file mode 100644 index b558437894..0000000000 --- a/src/Transfer/Transfer_TransferProcess.cdl +++ /dev/null @@ -1,733 +0,0 @@ --- Created on: 1992-02-03 --- Created by: Christian CAILLET --- Copyright (c) 1992-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 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. - -generic class TransferProcess from Transfer - (TheStart as any; -- either Transient or Finder - TheMapHasher as any; - TheList as Transient) -- HSequence from TCollection(TheStart) - -- TheStart as Handle (i.e. Finder-Transient only) - -- TheMapMasher : only for the Map - -- TheList : for Starting Objects in Iterator (a HSequence from TColStd) - inherits TShared - - ---Purpose : This class gives the frame for doing a direct transfer : it - -- provides required basic tools, such as a Map, and automatisms - -- which simplify work, while their use is not mandatory. - -- - -- Starting Objects managed by Mapping can be Transient or any - -- (by two instantiations provided by the package, - -- TransientProcess and FinderProcess, see class Finder). - -- - -- A direct Transfer must maintain data sharing whenever possible - -- (that is, when described by both sides) : this is managed by a - -- Map. It works with intermediate Objects, the Binders. Hence it - -- allows a binding, one/several-one/several, and it controls - -- that a Resulting Data can be used by another one only - -- if its creation has been ended. Also it keeps error status. - -- - -- Several results can be bound to a starting object, identified - -- by a category number. The default one (the only one considered - -- for final analysis) is zero. But mapping accesses allow to - -- precise a category number different from zero - -- - -- In order to work more easily in most cases, automatisms are - -- offered. Classically, to transfer an object, its result is - -- computed then bound. This applies recursively for referenced - -- objects. Each Transfer of a kind of object can be performed - -- by a specific Tool, which can use TransferProcess to work. - -- - -- - -- Many often, a specific Transfer can work as : "Search the good - -- Tool to Perform the Transfer (if not provided), run the Tool, - -- then Bind the Result", where "Perform" is seen as a black box. - -- - -- This way of working is assumed through automatisms which use - -- two types of auxiliary objects : - -- - An Actor acts as a Library of Transfer Actions : - -- it recognizes the operation to perform on a starting object, - -- then runs it (see class Actor) - -- - it produces a Binder, which is then recorded in the Map - -- - of course, if the Transfer has been already done, it is not - -- run once more : the first Result is available - -- - it is possible to re-evaluate the Result if required (i.e. - -- if the definitive Result is known only once other Transfers - -- have been engaged) - -- - in the case of a second (or more) ask for Transfer, the - -- Result is considered as "AlreadyUsed", hence it may not be - -- changed (in the Binder itself or by Rebinding another one) - -- - -- This gives a top-down process, in which first object to be - -- transferred asks for another one it references to be, etc... - -- This allows automatic management of Roots : only first - -- transfers (asked by the user) can be Root Transfers. - -- - -- - -- Other features are : Management of Root Entities (the Entities - -- by which the Transfer has started, and their Results, can be - -- identified as Roots, by the user or by automatisms); Error - -- Handling (if automatisms are used); - -- Returning Results, which can be specialized for - -- Roots, or Erroneous Data, or complete/partial (for one entity) - -- - -- Finally, TransferProcess inherits TShared : this allows to - -- run successive steps on the same set of data attached to a - -- given Transfer, by easily transmitting this set. - -uses Integer, Boolean, Transient, Type, - IndexedMapOfInteger,SequenceOfInteger,HArray1OfInteger, SequenceOfTransient, - HSequenceOfTransient, DictionaryOfInteger from Dico, - Msg from Message, Messenger from Message, - ParamType from Interface, - Check from Interface, CheckIterator from Interface, Binder from Transfer, - ProgressIndicator from Message - -- also : parameter TheStart; nested Actor, Iterator, TransferMap - -raises InterfaceError, TransferFailure - - - -- -- Nested Classes -- -- - - class TransferMap instantiates IndexedDataMap from TCollection - (TheStart,Binder,TheMapHasher); - ---Purpose : This is the Map used by TransferProcess - - - class Iterator inherits TransferIterator - ---Purpose : This is a TransferIterator PLUS the capability to access - -- the Starting Objects. It is given as a Result from - -- TransferProcess. It can be used when a TransferIterator - -- is required - ---See also : TransferIterator, for more information - - uses Boolean, Binder -- , TheStart, TheList - - raises NoSuchObject - - is - - Create (withstarts : Boolean) returns Iterator; - ---Purpose : Creates an empty Iterator - -- if withstarts is True, each Binder to be iterated will - -- be associated to its corresponding Starting Object - - Add (me : in out; binder : Binder) - ---Purpose : Adds a Binder to the iteration list (construction) - -- with no corresponding Starting Object - -- (note that Result is brought by Binder) - raises NoSuchObject is static; - -- Error if Starting Objects were required at Creation - -- time - - Add (me : in out; binder : Binder; start : TheStart) is static; - ---Purpose : Adds a Binder to the iteration list, associated with - -- its corresponding Starting Object "start" - -- Starting Object is ignored if not required at - -- Creation time - - Filter (me : in out; list : TheList; keep : Boolean = Standard_True); - ---Purpose : After having added all items, keeps or rejects items - -- which are attached to starting data given by - -- = True (D) : keeps. = False : rejects - -- Does nothing if was False - - HasStarting (me) returns Boolean is static; - ---Purpose : Returns True if Starting Object is available - -- (defined at Creation Time) - - Starting (me) returns TheStart - ---Purpose : Returns corresponding Starting Object - raises NoSuchObject is static; - -- Error if the Iterator was not created with Starting - -- Objects (Create called with = True) - ---C++ : return const & - - fields - - thestarts : TheList; - - end Iterator; - - - -- (should be deferred, not allowed for a nested class) - class Actor inherits TShared - ---Purpose : An Actor performs the effective Transfer of a Starting - -- Object, piloted by a TransferProcess. That is : - -- - It recognizes, for a Starting Object, the case to be run - -- - Then, it performs the Transfer : the recommanded way to - -- work is to define for each Type of Object to Transfer, a - -- specific Transfer Tool, then to call it by the Actor - -- - It assumes that the Result of Transfer is stored in a - -- Binder, it creates it if the Tool does not do - -- It can use the TransferProcess for intermediate Results - -- - It returns the Binder which stores the Result - -- It no Result can be produced, it returns a Null Handle - -- It may bind this Binder to but is not obliged : - -- TransferProcess controls this point. - -- - -- Remark about the kind of returned Binder : - -- - for a Transient Result, use the method TransientResult - -- - else, cast and query the Binder itself - -- - -- An Actor can be built by combination : this allows to - -- gather several Actors, each one processing a set of cases. - - uses Transient, Binder, - SimpleBinderOfTransient - -- TransferProcess, TheStart - - raises DomainError - - is - - Create returns mutable Actor; - - Recognize (me : mutable; start : TheStart) - returns Boolean is virtual; - ---Purpose : Prerequesite for Transfer : the method Transfer is - -- called on a starting object only if Recognize has - -- returned True on it - -- This allows to define a list of Actors, each one - -- processing a definite kind of data - -- TransferProcess calls Recognize on each one before - -- calling Transfer. But even if Recognize has returned - -- True, Transfer can reject by returning a Null Binder - -- (afterwards rejection), the next actor is then invoked - -- - -- The provided default returns True, can be redefined - - Transferring (me : mutable; - start : TheStart; TP : mutable TransferProcess) - returns mutable Binder - ---Purpose : Specific action of Transfer. The Result is stored in - -- the returned Binder, or a Null Handle for "No result" - -- (Default defined as doing nothing; should be deffered) - -- "mutable" allows the Actor to record intermediate - -- information, in addition to those of TransferProcess - raises DomainError is virtual; -- should be deferred; - -- In case of Error during a Transfer, any kind of - -- exception can be raised - - TransientResult (me; res : any Transient) - returns mutable SimpleBinderOfTransient; - ---Purpose : Prepares and Returns a Binder for a Transient Result - -- Returns a Null Handle if is itself Null - - NullResult (me) returns mutable Binder; - ---Purpose : Returns a Binder for No Result, i.e. a Null Handle - - - SetLast (me : mutable; mode : Boolean = Standard_True); - ---Purpose : If is True, commands an Actor to be set at the - -- end of the list of Actors (see SetNext) - -- If it is False (creation default), each add Actor is - -- set at the beginning of the list - -- This allows to define default Actors (which are Last) - - IsLast (me) returns Boolean; - ---Purpose : Returns the Last status (see SetLast). - - SetNext (me : mutable; next : mutable Actor); - ---Purpose : Defines a Next Actor : it can then be asked to work if - -- produces no result for a given type of Object. - -- If Next is already set and is not "Last", calls - -- SetNext on it. If Next defined and "Last", the new - -- actor is added before it in the list - - Next (me) returns mutable Actor; - ---Purpose : Returns the Actor defined as Next, or a Null Handle - - fields - - thenext : Actor; - thelast : Boolean; - - end Actor; - - -- -- The class TransferProcess itself -- -- - -is - - Create (nb : Integer = 10000) returns mutable TransferProcess from Transfer; - ---Purpose : Sets TransferProcess at initial state. Gives an Initial size - -- (indicative) for the Map when known (default is 10000). - -- Sets default trace file as a printer and default trace level - -- (see Message_TraceFile). - - Create (printer: Messenger from Message; nb: Integer = 10000) - returns mutable TransferProcess from Transfer; - ---Purpose : Sets TransferProcess at initial state. Gives an Initial size - -- (indicative) for the Map when known (default is 10000). - -- Sets a specified printer. - - Clear (me : mutable); - ---Purpose : Resets a TransferProcess as ready for a completely new work. - -- Clears general data (roots) and the Map - - Clean (me : mutable); - ---Purpose : Rebuilds the Map and the roots to really remove Unbound items - -- Because Unbind keeps the entity in place, even if not bound - -- Hence, working by checking new items is meaningless if a - -- formerly unbound item is rebound - - Resize (me : mutable; nb : Integer); - ---Purpose : Resizes the Map as required (if a new reliable value has been - -- determined). Acts only if is greater than actual NbMapped - - SetActor (me : mutable; actor : mutable Actor); - ---Purpose : Defines an Actor, which is used for automatic Transfer - -- If already defined, the new Actor is cumulated - -- (see SetNext from Actor) - - Actor (me) returns mutable Actor; - ---Purpose : Returns the defined Actor. Returns a Null Handle if - -- not set. - - -- -- Fine Access to Map -- -- - -- This access works on : Binder (default), or Handle Result - -- (Transient,Finder) as privileged kinds of Result - - Find (me; start : TheStart) returns mutable Binder; - ---Purpose : Returns the Binder which is linked with a starting Object - -- It can either bring a Result (Transfer done) or none (for a - -- pre-binding). - -- If no Binder is linked with , returns a Null Handle - -- Considers a category number, by default 0 - ---Warning : it is not equivalent to IsBound, which demands a Result - -- C++ : return const & - - IsBound (me; start : TheStart) returns Boolean; - ---Purpose : Returns True if a Result (whatever its form) is Bound with - -- a starting Object. I.e., if a Binder with a Result set, - -- is linked with it - -- Considers a category number, by default 0 - - IsAlreadyUsed (me; start : TheStart) returns Boolean; - ---Purpose : Returns True if the result of the transfer of an object is - -- already used in other ones. If it is, Rebind cannot change it. - -- Considers a category number, by default 0 - - FindAndMask (me : mutable; start : TheStart) - returns mutable Binder is private; - ---Purpose : Same as Find but stores the last access to the map, for a - -- faster access on next calls (as Bind does too) - -- Considers a category number, by default 0 - -- C++ : return const & - - Bind (me : mutable; start : TheStart; binder : mutable Binder) - ---Purpose : Creates a Link a starting Object with a Binder. This Binder - -- can either bring a Result (effective Binding) or none (it can - -- be set later : pre-binding). - -- Considers a category number, by default 0 - raises TransferFailure; - -- Error if a Binder with a Result set is already linked with - -- this Object (Binder with StatusResult not Initial) - - Rebind (me : mutable; start : TheStart; binder : mutable Binder) - ---Purpose : Changes the Binder linked with a starting Object for its - -- unitary transfer. This it can be useful when the exact form - -- of the result is known once the transfer is widely engaged. - -- This can be done only on first transfer. - -- Considers a category number, by default 0 - raises TransferFailure; - -- Error if : - the Result is known as Already Used - -- or if - No Result is bound to - -- or if - brings No result - - Unbind (me : mutable; start : TheStart) returns Boolean - ---Purpose : Removes the Binder linked with a starting object - -- If this Binder brings a non-empty Check, it is replaced by - -- a VoidBinder. Also removes from the list of Roots as required. - -- Returns True if done, False if was not bound - -- Considers a category number, by default 0 - raises TransferFailure; - -- Error if : - the Result is known as Already Used - - FindElseBind (me : mutable; start : TheStart) - returns mutable Binder; - ---Purpose : Returns a Binder for a starting entity, as follows : - -- Tries to Find the already bound one - -- If none found, creates a VoidBinder and Binds it - - -- Check management (uses Binder's Check) - - SetMessenger (me: mutable; messenger: Messenger from Message); - ---Purpose : Sets Messenger used for outputting messages. - - Messenger (me) returns Messenger from Message; - ---Purpose : Returns Messenger used for outputting messages. - -- The returned object is guaranteed to be non-null; - -- default is Message::Messenger(). - - SetTraceLevel (me: mutable; tracelev: Integer); - ---Purpose : Sets trace level used for outputting messages: - -- = 0 : no trace at all - -- = 1 : handled exceptions and calls to AddError - -- = 2 : also calls to AddWarning - -- = 3 : also traces new Roots - -- (uses method ErrorTrace). - -- Default is 1 : Errors traced - - TraceLevel (me) returns Integer; - ---Purpose : Returns trace level used for outputting messages. - - SendFail (me : mutable; start : TheStart; amsg : Msg from Message); - ---Purpose : New name for AddFail (Msg) - - SendWarning (me : mutable; start : TheStart; amsg : Msg from Message); - ---Purpose : New name for AddWarning (Msg) - - SendMsg (me : mutable; start : TheStart; amsg : Msg from Message); - ---Purpose : Adds an information message - -- Trace is filled if trace level is at least 3 - - AddFail (me : mutable; start : TheStart; mess : CString; orig : CString = ""); - ---Purpose : Adds an Error message to a starting entity (to the check of - -- its Binder of category 0, as a Fail) - - AddError (me : mutable; start : TheStart; mess : CString; orig : CString = ""); - ---Purpose : (other name of AddFail, maintained for compatibility) - - AddFail (me : mutable; start : TheStart; amsg : Msg from Message); - ---Purpose : Adds an Error Message to a starting entity from the definition - -- of a Msg (Original+Value) - - AddWarning (me : mutable; start : TheStart; mess : CString; orig : CString = ""); - ---Purpose : Adds a Warning message to a starting entity (to the check of - -- its Binder of category 0) - - AddWarning (me : mutable; start : TheStart; amsg : Msg from Message); - ---Purpose : Adds a Warning Message to a starting entity from the definition - -- of a Msg (Original+Value) - - - Mend (me : mutable; start : TheStart; pref : CString = ""); - ---Pirpose : Mends messages bound to a starting entity, if there are some - -- as for Check from Interface : - -- Default converts all fails to warnings and that's all - - Check (me; start : TheStart) returns Check; - ---Purpose : Returns the Check attached to a starting entity. If - -- is unknown, returns an empty Check - --- AddCaseName (me : mutable; start : TheStart; casename : CString); - ---Purpose : Adds a case name to a starting entity - --- AddCaseValue (me : mutable; start : TheStart; caseval : Transient); - ---Purpose : Adds a case value to a starting entity - --- CaseList (me; start : TheStart) returns HSequenceOfTransient; - ---Purpose : Returns the complete case list for an entity. Null Handle if empty - --- NextItemWithAttribute (me; name : CString; num0 : Integer) returns Integer; - ---Purpose : In the list of mapped items (between 1 and NbMapped), - -- searches for the first item which follows (not included) - -- and which has an attribute named - -- Attributes are brought by Binders - -- Hence, allows such an iteration - -- - -- for (num = TP->NextItemWithAttribute(name,0); - -- num > 0; - -- num = TP->NextItemWithAttribute(name,num) { - -- .. process mapped item - -- } - --- AttributeType (me; name : CString) returns ParamType; - ---Purpose : Returns the type of an Attribute attached to binders - -- If this name gives no Attribute, returns ParamVoid - -- If this name gives several different types, returns ParamMisc - -- Else, returns the effective type (ParamInteger, ParamReal, - -- ParamIdent, or ParamText) - --- Attributes (me; rootname : CString = "") returns DictionaryOfInteger; - ---Purpose : Returns the list of recorded Attribute Names, as a Dictionary - -- of Integer : each value gives the count of items which bring - -- this attribute name - -- By default, considers all the attribute names - -- If is given, considers only the attribute names - -- which begin by - - -- Most Useful Specific Bindings -- - - BindTransient (me : mutable; start : TheStart; res : any Transient) - ---Purpose : Binds a starting object with a Transient Result. - -- Uses a SimpleBinderOfTransient to work. If there is already - -- one but with no Result set, sets its Result. - -- Considers a category number, by default 0 - raises TransferFailure; - -- Error if a result is already bound (Binder not Initial) - - FindTransient (me; start : TheStart) - returns any Transient; - ---Purpose : Returns the Result of the Transfer of an object as a - -- Transient Result. - -- Returns a Null Handle if there is no Transient Result - -- Considers a category number, by default 0 - -- Warning : Supposes that Binding is done with a SimpleBinderOfTransient - ---C++ : return const & - - - BindMultiple (me : mutable; start : TheStart) - ---Purpose : Prepares an object to be bound with several results. - -- If no Binder is yet attached to , a MultipleBinder - -- is created, empty. If a Binder is already set, it must - -- accept Multiple Binding. - -- Considers a category number, by default 0 - raises TransferFailure; - -- Error if a UNIQUE result is already bound (if a Multiple - -- Result is, nothing is done) - - AddMultiple (me : mutable; start : TheStart; res : mutable Transient) - ---Purpose : Adds an item to a list of results bound to a starting object. - -- Considers a category number, by default 0, for all results - raises TransferFailure; - -- Error if no Binder accepting Multiple Binding is attached - -- to (none at all, or for a unique result) - - FindTypedTransient (me; start : TheStart; atype : Type from Standard; - val : out mutable Transient) returns Boolean; - ---Purpose : Searches for a transient result attached to a starting object, - -- according to its type, by criterium IsKind(atype) - -- - -- In case of multiple result, explores the list and gives in - -- the first transient result IsKind(atype) - -- Returns True and fills if found - -- Else, returns False ( is not touched, not even nullified) - -- - -- This syntactic form avoids to do DownCast : if a result is - -- found with the good type, it is loaded in and can be - -- immediately used, well initialised - - GetTypedTransient (me; binder : Binder; atype : Type from Standard; - val : out mutable Transient) returns Boolean; - ---Purpose : Searches for a transient result recorded in a Binder, whatever - -- this Binder is recorded or not in - -- - -- This is strictly equivalent to the class method GetTypedResult - -- from class SimpleBinderOfTransient, but is just lighter to call - -- - -- Apart from this, works as FindTypedTransient - - - -- -- Atomic access to Map -- -- - - NbMapped (me) returns Integer; - ---Purpose : Returns the maximum possible value for Map Index - -- (no result can be bound with a value greater than it) - - Mapped (me; num : Integer) returns any TheStart; - ---Purpose : Returns the Starting Object bound to an Index, - ---C++ : return const & - - MapIndex (me; start : TheStart) returns Integer; - ---Purpose : Returns the Index value bound to a Starting Object, 0 if none - - MapItem (me; num : Integer) returns mutable Binder; - ---Purpose : Returns the Binder bound to an Index - -- Considers a category number, by default 0 - - -- -- Root Management -- -- - - SetRoot (me : mutable; start : TheStart) - ---Purpose : Declares (and its Result) as Root. This status will be - -- later exploited by RootResult, see below (Result can be - -- produced at any time) - raises TransferFailure; - -- Error if is not bound before calling to SetRoot - - SetRootManagement (me : mutable; stat : Boolean); - ---Purpose : Enable (if True) or Disables (if False) Root - -- Management. If it is set, Transfers are considered as stacked - -- (a first Transfer commands other Transfers, and so on) and - -- the Transfers commanded by an external caller are "Root". - -- Remark : SetRoot can be called whatever this status, on every - -- object. - -- Default is set to True. - - NbRoots (me) returns Integer; - ---Purpose : Returns the count of recorded Roots - - Root (me; num : Integer) returns any TheStart; - ---Purpose : Returns a Root Entity given its number in the list (1-NbRoots) - ---C++ : return const & - - RootItem (me; num : Integer) returns mutable Binder; - ---Purpose : Returns the Binder bound with a Root Entity given its number - -- Considers a category number, by default 0 - - RootIndex (me; start : TheStart) returns Integer; - ---Purpose : Returns the index in the list of roots for a starting item, - -- or 0 if it is not recorded as a root - - NestingLevel (me) returns Integer; - ---Purpose : Returns Nesting Level of Transfers (managed by methods - -- TranscriptWith & Co). Starts to zero. If no automatic Transfer - -- is used, it remains to zero. Zero means Root Level. - - ResetNestingLevel (me : mutable); - ---Purpose : Resets Nesting Level of Transfers to Zero (Root Level), - -- whatever its current value. - - -- -- The Transfer Operations themselves -- -- - - Recognize (me; start : TheStart) returns Boolean; - ---Purpose : Tells if has been recognized as good candidate for - -- Transfer. i.e. queries the Actor and its Nexts - - Transferring (me : mutable; start : TheStart) returns mutable Binder - ---Purpose : Performs the Transfer of a Starting Object, by calling - -- the method TransferProduct (see below). - -- Mapping and Roots are managed : nothing is done if a Result is - -- already Bound, an exception is raised in case of error. - raises TransferFailure; - -- Error : if the Transfer falls in a loop, or asks to Rebind an - -- Object already Bound AND Used or reads a non computed Result - -- - -- Remark : if ErrorHandle is set, no exception is raised : see - -- the method SetErrorHandle for more details - -- C++ : return const & - - TransferProduct (me : mutable; start : TheStart) returns mutable Binder - ---Purpose : Internal action of Transfer, called by Transferring, with or - -- without ErrorHandle. It invokes the Actor to work (set by - -- SetActor), and tries its Nexts if no result is produced, - -- until a Non Null Binder is produced. - -- But keep in mind that a Null Binder can allways be returned - -- if a Starting Entity has not been recognized at all. - raises TransferFailure - is private; - -- Error if the Transfer Action does any bad use of the Bindings - - Transfer (me : mutable; start : TheStart) returns Boolean - --- Purpose : Same as Transferring but does not return the Binder. - -- Simply returns True in case of success (for user call) - raises TransferFailure; - -- Error : from Transferring. - - -- -- Error Control on run-time -- -- - - SetErrorHandle (me : mutable; err : Boolean); - ---Purpose : Allows controls if exceptions will be handled - -- Transfer Operations - -- False : they are not handled with try {} catch {} - -- True : they are - -- Default is False: no handling performed - - ErrorHandle (me) returns Boolean; - ---Purpose : Returns error handling flag - - StartTrace (me; binder : Binder; start : TheStart; level,mode : Integer); - ---Purpose : Method called when trace is asked - -- Calls PrintTrace to display information relevant for starting - -- objects (which can be redefined) - -- is Nesting Level of Transfer (0 = root) - -- controls the way the trace is done : - -- 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root - - PrintTrace (me; start : TheStart; S : Messenger from Message) is virtual; - ---Purpose : Prints a short information on a starting object. By default - -- prints its Dynamic Type. Can be redefined - - IsLooping (me; alevel : Integer) returns Boolean; - ---Purpose : Returns True if we are surely in a DeadLoop. Evaluation is not - -- exact, it is a "majorant" which must be computed fast. - -- This "majorant" is : greater than NbMapped. - - -- -- Results and Error Log -- -- - -- The Map can be consulted term by term (as being indexed), - -- or through an Iterator - - - RootResult (me; withstart : Boolean = Standard_False) returns Iterator; - ---Purpose : Returns, as an iterator, the log of root transfer, i.e. the - -- created objects and Binders bound to starting roots - -- If withstart is given True, Starting Objets are also returned - - CompleteResult (me; withstart : Boolean = Standard_False) returns Iterator; - ---Purpose : Returns, as an Iterator, the entire log of transfer (list of - -- created objects and Binders which can bring errors) - -- If withstart is given True, Starting Objets are also returned - - AbnormalResult (me) returns Iterator; - ---Purpose : Returns Binders which are neither "Done" nor "Initial", - -- that is Error,Loop or Run (abnormal states at end of Transfer) - -- Starting Objects are given in correspondance in the iterator - - CheckList (me; erronly : Boolean) returns CheckIterator; - ---Purpose : Returns a CheckList as a list of Check : each one is for a - -- starting entity which have either check (warning or fail) - -- messages are attached, or are in abnormal state : that case - -- gives a specific message - -- If is True, checks with Warnings only are ignored - - ResultOne (me; start : TheStart; level : Integer; - withstart : Boolean = Standard_False) returns Iterator; - ---Purpose : Returns, as an Iterator, the log of transfer for one object - -- = 0 : this object only - -- and if is a scope owner (else, is ignored) : - -- = 1 : object plus its immediate scoped ones - -- = 2 : object plus all its scoped ones - - CheckListOne (me; start : TheStart; level : Integer; - erronly : Boolean) returns CheckIterator; - ---Purpose : Returns a CheckList for one starting object - -- interpreted as by ResultOne - -- If is True, checks with Warnings only are ignored - - IsCheckListEmpty (me; start : TheStart; level : Integer; - erronly : Boolean) returns Boolean; - ---Purpose : Returns True if no check message is attached to a starting - -- object. interpreted as by ResultOne - -- If is True, checks with Warnings only are ignored - - RemoveResult (me : mutable; start : TheStart; level : Integer; - compute : Boolean = Standard_True); - ---Purpose : Removes Results attached to (== Unbinds) a given object and, - -- according : - -- = 0 : only it - -- = 1 : it plus its immediately owned sub-results(scope) - -- = 2 : it plus all its owned sub-results(scope) - - CheckNum (me; start : TheStart) returns Integer is virtual; - ---Purpose : Computes a number to be associated to a starting object in - -- a check or a check-list - -- By default, returns 0; can be redefined - - SetProgress(me : mutable; theProgress : ProgressIndicator from Message); - ---Purpose: Sets Progress indicator - - GetProgress(me) returns ProgressIndicator from Message; - ---Purpose: Gets Progress indicator - -fields - - theerrh : Boolean; -- to handle or not exception raisings - thetrace : Integer; -- trace level (exceptions,errors, etc...) - themessenger : Messenger from Message; -- messenger for sending messages - - thelevel : Integer; - therootl : Integer; -- level of root at each time (not allways 1) - therootm : Boolean; -- Flag for Root Management set or not - theroots : IndexedMapOfInteger; -- indices of roots in the map - - thelastobj : TheStart; -- Last Starting Object Bound - thelastbnd : Binder; -- Its attached Binder (noted to optimize) - theindex : Integer; -- And Index - theactor : Actor; - themap : TransferMap; - - myProgress : ProgressIndicator from Message; -- Progress indicator - -end TransferProcess; diff --git a/src/Transfer/Transfer_TransferProcess.gxx b/src/Transfer/Transfer_TransferProcess.gxx deleted file mode 100644 index ef564b416c..0000000000 --- a/src/Transfer/Transfer_TransferProcess.gxx +++ /dev/null @@ -1,1567 +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 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. - -// DCE 21.01.99 S3767 Display original messages only -// if the level is greater than 2 - -//#include -// Class generique - -// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder) -// Il doit offrir : "==" , .IsNull() , ->DynamicType() - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -//#define TRANSLOG // debug - -static Handle(Standard_Transient) nultrans; // pour retour const&(Null) ... -static Handle(Transfer_Binder) nulbinder; - - -//======================================================================= -//function : Transfer_TransferProcess -//purpose : -//======================================================================= - -Transfer_TransferProcess::Transfer_TransferProcess (const Standard_Integer nb) - : themap (nb) -{ - theerrh = Standard_True; - therootm = Standard_False; - thelevel = 0; therootl = 0; - themessenger = Message::DefaultMessenger(); - thetrace = 0; -// theroots = new TColStd_HSequenceOfInteger (); - theindex = 0; -} - - -//======================================================================= -//function : Transfer_TransferProcess -//purpose : -//======================================================================= - -Transfer_TransferProcess::Transfer_TransferProcess(const Handle(Message_Messenger)& messenger, - const Standard_Integer nb) - : themap (nb) -{ - theerrh = Standard_True; - therootm = Standard_False; - thelevel = 0; therootl = 0; - SetMessenger (messenger); - thetrace = 1; -// theroots = new TColStd_HSequenceOfInteger (); - theindex = 0; -} - - void Transfer_TransferProcess::Clear () -{ - thelevel = 0; therootl = 0; - theroots.Clear(); - themap.Clear(); - theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify(); -} - - void Transfer_TransferProcess::Clean () -{ - Standard_Integer i, nb = NbMapped(); - Standard_Integer j,unb = 0; - for (i = 1; i <= nb; i ++) { - if (themap(i).IsNull()) unb ++; - } - if (unb == 0) return; - -// Refaire la map -> decalages - TColStd_Array1OfInteger unbs (1,nb); unbs.Init(0); - Transfer_TransferMap newmap (nb*2); - for (i = 1; i <= nb; i ++) { - TheStart ent = Mapped(i); - Handle(Transfer_Binder) bnd = MapItem(i); - if (bnd.IsNull()) continue; - j = newmap.Add (ent,bnd); - unbs.SetValue (i,j); - } - themap.Assign (newmap); - - // Update La liste des racines - TColStd_IndexedMapOfInteger aNewRoots; - for( i=1; i<= theroots.Extent(); i++ ) { - j = theroots.FindKey(i); - Standard_Integer k = unbs.Value(j); - if ( k ) aNewRoots.Add ( k ); - } - theroots.Clear(); - theroots = aNewRoots; - -// Le reste : nettoyage - thelastobj.Nullify(); - thelastbnd.Nullify(); - theindex = 0; -} - - -//======================================================================= -//function : Resize -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Resize (const Standard_Integer nb) -{ - if (nb > themap.NbBuckets()) themap.ReSize(nb); -} - - -//======================================================================= -//function : SetActor -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetActor(const Handle(Transfer_Actor)& actor) -{ - if (theactor == actor) return; - if (theactor.IsNull()) theactor = actor; - else if (actor.IsNull()) theactor = actor; // declenche RAZ - else if (theactor->IsLast()) { actor->SetNext(theactor); theactor = actor; } - else theactor->SetNext(actor); -} - - -//======================================================================= -//function : Actor -//purpose : -//======================================================================= - -Handle(Transfer_Actor) Transfer_TransferProcess::Actor () const -{ - return theactor; -} - - -// ######################################################################## -// .... MAPPING .... - -// ## ## ## Actions Generales sur Binders ## ## ## -// ## ## ## Consultations ## ## ## - - -// ## ## Find ## ## - -//======================================================================= -//function : Find -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::Find (const TheStart& start) const -// const Standard_Integer categ) const -{ - if (thelastobj == start) { - //if (theindex > 0) return thelastbnd->Search(categ); //skl - if (theindex > 0) return thelastbnd; //skl - } - Standard_Integer index = themap.FindIndex (start); - if (index > 0) { - const Handle(Transfer_Binder)& binder = themap.FindFromIndex(index); - //if (binder.IsNull()) //skl - return binder; - //return binder->Search(categ); //skl - } - return nulbinder; -} - -// ## ## IsBound ## ## - -//======================================================================= -//function : IsBound -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsBound(const TheStart& start) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = Find(start); //,categ); skl - if (binder.IsNull()) return Standard_False; - return binder->HasResult(); -} - -// ## ## IsAlreadyUsed ## ## - -//======================================================================= -//function : IsAlreadyUsed -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsAlreadyUsed(const TheStart& start) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = Find(start); //,categ); skl - if (binder.IsNull()) { - StartTrace (binder,start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : IsAlreadyUsed, transfer not done cannot be used..."); - } - return (binder->Status() == Transfer_StatusUsed); -} - - -// ## ## FindAndMask (private) ## ## - -//======================================================================= -//function : FindAndMask -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::FindAndMask(const TheStart& start) -// const Standard_Integer categ) -{ - if (thelastobj == start) { - if (theindex > 0) return thelastbnd; //skl ->Search(categ); - } - thelastobj = start; - theindex = themap.FindIndex (start); - if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex); - else thelastbnd.Nullify(); - //if (thelastbnd.IsNull()) skl - return thelastbnd; - //return thelastbnd->Search(categ); //skl -} - - -// ## ## ## Modifications ## ## ## - - -//======================================================================= -//function : Bind -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Bind (const TheStart& start, - const Handle(Transfer_Binder)& binder) -// const Standard_Integer categ) -{ - if (binder.IsNull()) return; - Handle(Transfer_Binder) former = FindAndMask(start);//,categ);skl - if (!former.IsNull()) { -// On admet VoidBinder : alors on reprend son Check - if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) { - binder->Merge(former); - //binder->SetCategory(categ); //skl - themap(theindex) = binder; // Substitution - } - else if (former->Status() == Transfer_StatusUsed) { - StartTrace (former,start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : Bind, already Bound"); - } - else { - if (thetrace > 2) StartTrace (former,start,thelevel,5); - binder->CCheck()->GetMessages (former->Check()); - } - } - //binder->SetCategory(categ); //skl - if (theindex == 0 || thelastbnd.IsNull()) { - if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau - else themap(theindex) = binder; // idem en fait - thelastbnd = binder; - } - else { //skl - //binder->AddResult(thelastbnd); - thelastbnd = binder; - themap(theindex) = binder; - } -/*skl else if (thelastbnd->Category() == categ) { // Substitue cette categorie - binder->Next(Standard_False)->SetNext(thelastbnd->Next(Standard_True),Standard_True); - thelastbnd = binder; - themap(theindex) = binder; - } else { - thelastbnd->AddNext (binder,categ,Standard_True); - } */ -} - - -//======================================================================= -//function : Rebind -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Rebind (const TheStart& start, - const Handle(Transfer_Binder)& binder) -// const Standard_Integer categ) -{ - Bind(start,binder); //,categ);skl - // entre les deux, les differences allaient s amenuisant - // au debut, on criait si pas encore Bound (idiot) - // ne restait plus comme difference que le test StatusUsed sur Rebind, - // tandis que Bind refusait des lors qu il y avait un resultat - // -> a present, Bind s aligne sur Rebind -} - - -//======================================================================= -//function : Unbind -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Unbind(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) former = FindAndMask(start);//,categ);skl - if (theindex == 0) return Standard_False; - if (former.IsNull()) return Standard_False; - if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True; - //const Interface_Check& ach = thelastbnd->Check(); - //Handle(Transfer_Binder) newbinder = thelastbnd->RemoveNext(categ);skl - //if (newbinder != thelastbnd)skl - themap(theindex) = thelastbnd;// = newbinder;skl - if(theroots.Contains(theindex)) { - TColStd_IndexedMapOfInteger aNewRoots; - for(Standard_Integer i = 1; i <= theroots.Extent(); i++) - if(theindex!= theroots.FindKey(i)) - aNewRoots.Add(theroots.FindKey(i)); - - theroots.Clear(); - theroots = aNewRoots; - } - - thelastobj.Nullify(); - thelastbnd.Nullify(); - theindex = 0; - return Standard_True; -} - - -//======================================================================= -//function : FindElseBind -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::FindElseBind(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask (start);//,categ);skl - if (!binder.IsNull()) return binder; - binder = new Transfer_VoidBinder; - Bind(start,binder);//,categ);skl - return binder; -} - - -// ## ## ## Messages associes ## ## ## - -//======================================================================= -//function : SetMessenger -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetMessenger (const Handle(Message_Messenger)& messenger) -{ - if ( messenger.IsNull() ) - themessenger = Message::DefaultMessenger(); - else - themessenger = messenger; -} - -//======================================================================= -//function : Messenger -//purpose : -//======================================================================= - -Handle(Message_Messenger) Transfer_TransferProcess::Messenger () const -{ - return themessenger; -} - -//======================================================================= -//function : SetTraceLevel -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetTraceLevel (const Standard_Integer tracelev) -{ - thetrace = tracelev; -} - -//======================================================================= -//function : TraceLevel -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::TraceLevel () const -{ - return thetrace; -} - -//======================================================================= -//function : SendFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendFail(const TheStart& start, - const Message_Msg& amsg) -{ - AddFail(start,amsg); -} - - -//======================================================================= -//function : SendWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendWarning(const TheStart& start, - const Message_Msg& amsg) -{ - AddWarning(start,amsg); -} - - -//======================================================================= -//function : SendMsg -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendMsg(const TheStart& start, - const Message_Msg& amsg) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - // Alimente la trace : Regle causant (user messages) - if (thetrace > 0) { - StartTrace (binder,start,thelevel,6); - themessenger << amsg.Value(); - if (amsg.IsEdited()&&thetrace>2) - themessenger << " [from: " << amsg.Original() << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddFail(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddFail (mess,orig); - if (thetrace > 0) { - StartTrace (binder,start,thelevel,1); - themessenger << " --> Fail : " << mess; - if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddError -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddError(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - AddFail (start,mess,orig); -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddFail(const TheStart& start, - const Message_Msg& amsg) -{ - if (amsg.IsEdited()) AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString(), - TCollection_AsciiString(amsg.Original()).ToCString()); - else AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString()); -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddWarning(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddWarning(mess,orig); - if (thetrace > 1) { - StartTrace (binder,start,thelevel,2); - themessenger << " --> Warning : " << mess; - if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddWarning(const TheStart& start, - const Message_Msg& amsg) -{ - if (amsg.IsEdited()) AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString(), - TCollection_AsciiString(amsg.Original()).ToCString()); - else AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString()); -} - - -//======================================================================= -//function : Mend -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Mend(const TheStart& start, - const Standard_CString pref) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) return; // rien a faire ... - Handle(Interface_Check) ach = binder->CCheck(); - ach->Mend (pref); -} - - -//======================================================================= -//function : Check -//purpose : -//======================================================================= - -Handle(Interface_Check) Transfer_TransferProcess::Check(const TheStart& start) const -{ - const Handle(Transfer_Binder)& binder = Find(start); - if (binder.IsNull()) { - Handle(Interface_Check) check; - return check; - } - return binder->Check(); -} - -/*skl -void Transfer_TransferProcess::AddCaseName(const TheStart& start, - const Standard_CString casename) -{ - AddCaseValue (start, new TCollection_HAsciiString (casename)); -} - - -void Transfer_TransferProcess::AddCaseValue(const TheStart& start, - const Handle(Standard_Transient)& caseval) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddCaseValue (caseval); -} - - -Handle(TColStd_HSequenceOfTransient) Transfer_TransferProcess::CaseList - (const TheStart& start) const -{ - Handle(TColStd_HSequenceOfTransient) list; - const Handle(Transfer_Binder)& binder = Find(start); - if (binder.IsNull()) return list; - return binder->CaseList(); -} - -Standard_Integer Transfer_TransferProcess::NextItemWithAttribute - (const Standard_CString name, const Standard_Integer num0) const -{ - Standard_Integer num, nb = NbMapped(); - for (num = num0+1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - if (!bnd->Attribute(name).IsNull()) return num; - } - return 0; -} - - -Interface_ParamType Transfer_TransferProcess::AttributeType - (const Standard_CString name) const -{ - Interface_ParamType aty, res = Interface_ParamVoid; - Standard_Integer num, nb = NbMapped(); - for (num = 1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - aty = bnd->AttributeType(name); - if (aty == Interface_ParamVoid) continue; - if (res == Interface_ParamVoid) res = aty; - else if (res != aty) return Interface_ParamMisc; - } - return res; -} - -Handle(Dico_DictionaryOfInteger) Transfer_TransferProcess::Attributes - (const Standard_CString rootname) const -{ - Handle(Dico_DictionaryOfInteger) list = new Dico_DictionaryOfInteger; - Standard_Integer num, nb = NbMapped(); - for (num = 1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - Handle(Dico_DictionaryOfTransient) atr = bnd->AttrList(); - if (atr.IsNull()) continue; - Dico_IteratorOfDictionaryOfTransient iatr(atr,rootname); - for (; iatr.More(); iatr.Next()) { - TCollection_AsciiString name = iatr.Name(); - Standard_Boolean deja; - Standard_Integer& nbval = list->NewItem (name.ToCString(),deja); - if (!deja) nbval = 0; - nbval ++; - } - - } - return list; -} -skl*/ - - -// ## ## ## Actions sur Types Privilegies ## ## ## -// ## ## ## (Transient) ## ## ## - -// Bind associe un objet a un objet resultat; or la Map associe un Objet a un -// Binder (qui designe son resultat) -// *Transient travaillent avec un SimpleBinderOfTransient -// si deja la, on considere son resultat -// sinon, on cree un Binder du bon type - - -//======================================================================= -//function : BindTransient -//purpose : -//======================================================================= - -void Transfer_TransferProcess::BindTransient(const TheStart& start, - const Handle(Standard_Transient)& res) -// const Standard_Integer categ) -{ - if (res.IsNull()) return; - Handle(Transfer_Binder) former = Find(start);//,categ);skl - Handle(Transfer_SimpleBinderOfTransient) binder = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(former); -// Binding sur place ? - if (!binder.IsNull()) { - if (binder->Status() == Transfer_StatusVoid) { binder->SetResult(res); return; } - } -// Sinon, refaire - binder = new Transfer_SimpleBinderOfTransient; - binder->SetResult (res); - if (former.IsNull()) Bind(start,binder);//,categ);skl - else Rebind(start,binder);//,categ);skl -} - - -//======================================================================= -//function : FindTransient -//purpose : -//======================================================================= - -const Handle(Standard_Transient)& Transfer_TransferProcess::FindTransient - (const TheStart& start) const -{ - Handle(Transfer_SimpleBinderOfTransient) binder = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start)); - if (binder.IsNull()) return nultrans; - if (!binder->HasResult()) return nultrans; - return binder->Result(); -} - - -// Binding Multiple : D abord le declarer par BindMultiple (si pas deja fait) -// Puis ajouter les termes par AddMultiple - -//======================================================================= -//function : BindMultiple -//purpose : -//======================================================================= - -void Transfer_TransferProcess::BindMultiple(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask (start);//,categ);skl - if (!binder.IsNull()) { - if (!binder->IsKind(STANDARD_TYPE(Transfer_MultipleBinder))) { - StartTrace (thelastbnd,start,thelevel,4); - Transfer_TransferFailure::Raise ("TransferProcess : BindMultiple"); - } - } - else Bind(start,new Transfer_MultipleBinder);//,categ);skl -} - - -//======================================================================= -//function : AddMultiple -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddMultiple(const TheStart& start, - const Handle(Standard_Transient)& res) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask(start);//,categ);skl - Handle(Transfer_MultipleBinder) multr = - Handle(Transfer_MultipleBinder)::DownCast(binder); - if (multr.IsNull()) { - StartTrace (binder,start,thelevel,4); - if (binder.IsNull()) Transfer_TransferFailure::Raise - ("TransferProcess : AddMultiple, nothing bound"); - else Transfer_TransferFailure::Raise - ("TransferProcess : AddMultiple, Binder not a MultipleBinder"); - } - multr->AddResult(res); -} - - -//======================================================================= -//function : FindTypedTransient -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::FindTypedTransient - (const TheStart& start, const Handle(Standard_Type)& atype, - Handle(Standard_Transient)& val) const -{ - return GetTypedTransient (Find(start),atype,val); -} - - -//======================================================================= -//function : GetTypedTransient -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::GetTypedTransient - (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, - Handle(Standard_Transient)& val) const -{ - return Transfer_SimpleBinderOfTransient::GetTypedResult(binder,atype,val); -} - - -// ## ## ## ## ## Acces Atomique ## ## ## ## ## -// (ne gere pas le scope mais donne acces aux categories) - -//======================================================================= -//function : NbMapped -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NbMapped () const -{ - return themap.Extent(); -} - - -//======================================================================= -//function : Mapped -//purpose : -//======================================================================= - -const TheStart& Transfer_TransferProcess::Mapped(const Standard_Integer num) const -{ - return themap.FindKey(num); -} - - -//======================================================================= -//function : MapIndex -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::MapIndex(const TheStart& start) const -{ - return themap.FindIndex(start); -} - - -//======================================================================= -//function : MapItem -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::MapItem(const Standard_Integer num) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = themap.FindFromIndex(num); - //sklif (binder.IsNull()) - return binder; - //sklreturn binder->Search (categ); -} - - -// ######################################################################## -// .... ROOT MANAGEMENT .... - -//======================================================================= -//function : SetRoot -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetRoot (const TheStart& start) -{ - Standard_Integer index = MapIndex(start); - if (index == 0) { - //StartTrace (thelastbnd,start,thelevel,4); - //Transfer_TransferFailure::Raise("TransferProcess : SetRoot"); - return; - } - - theroots.Add(index); - if (thetrace > 2) StartTrace (MapItem(index),start,thelevel,3); -} - - -//======================================================================= -//function : SetRootManagement -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetRootManagement(const Standard_Boolean stat) -{ - therootm = stat; -} - - -//======================================================================= -//function : NbRoots -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NbRoots () const -{ - return theroots.Extent(); -} - - -//======================================================================= -//function : Root -//purpose : -//======================================================================= - -const TheStart& Transfer_TransferProcess::Root(const Standard_Integer num) const -{ - Standard_Integer ind = 0; - if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); - return themap.FindKey (ind); -} - - -//======================================================================= -//function : RootItem -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::RootItem(const Standard_Integer num) const -// const Standard_Integer categ) const -{ - Standard_Integer ind = 0; - if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); - return themap.FindFromIndex(ind);//->Search(categ);skl -} - - -//======================================================================= -//function : RootIndex -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::RootIndex(const TheStart& start) const -{ - Standard_Integer index = MapIndex(start); - if (index == 0) return 0; - return theroots.FindIndex(index); -} - - -//======================================================================= -//function : NestingLevel -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NestingLevel () const -{ - return thelevel; -} - - -//======================================================================= -//function : ResetNestingLevel -//purpose : -//======================================================================= - -void Transfer_TransferProcess::ResetNestingLevel () -{ - thelevel = 0; -} - - -// ######################################################################## -// .... SCOPE MANAGEMENT .... - - -//====================================================================== -//Purpose : gka TRJ9 for writing SDR for solid -// Check if binder has already been bound to the result binder. -//====================================================================== - -// static Standard_Boolean Contains(const Handle(Transfer_Binder)& resbinder, -// const Handle(Transfer_Binder)& addbinder) -// { -// Handle(Transfer_Binder) tmpbind = resbinder; -// for ( ; ! tmpbind.IsNull(); tmpbind = tmpbind->NextResult() ) -// if ( tmpbind == addbinder ) return Standard_True; -// return Standard_False; -// } - -// ######################################################################## -// .... AUTOMATISMES DE TRANSFERT .... - -// ## ## ## ## ## Fonctions de Base ## ## ## ## ## - - -//======================================================================= -//function : Recognize -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Recognize(const TheStart& start) const -{ - Handle(Transfer_Actor) actor = theactor; - // On balaie les Next jusqu a avoir un Resultat - while (!actor.IsNull()) { - if (actor->Recognize (start)) return Standard_True; - actor = actor->Next(); - } - return Standard_False; -} - - -//======================================================================= -//function : Transferring -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& start) -{ - // Map deja alimentee ? - Handle(Transfer_Binder) former = FindAndMask(start); - - // .... Transfert deja effectue avec Resultat ? .... - - // On considere que cette nouvelle demande de Transfert correspond donc a une - // utilisation en plus : noter "AlreadyUsed", donc resultat non modifiable - if (!former.IsNull()) { - if (former->HasResult()) { - former->SetAlreadyUsed(); - return former; - } - //} - - // .... Etat Initial : peut-etre deja fait ... ou infaisable ! - - //if (!former.IsNull()) { - Transfer_StatusExec statex = former->StatusExec(); - switch (statex) { - case Transfer_StatusInitial : // Transfert prepare a faire - break; - case Transfer_StatusDone : // Transfert deja fait -//#ifdef TRANSLOG - themessenger << " .. and Transfer done" << endl; -//#endif -// if (former->HasResult()) former->SetAlreadyUsed(); - return former; - case Transfer_StatusRun : // ca y est, on boucle - former->SetStatusExec(Transfer_StatusLoop); - return former; - case Transfer_StatusError : // pas propre, ca ... - if (thetrace) { - themessenger << " *** Transfer in Error Status :" << endl; - StartTrace (former, start, thelevel,0); -// (*themessenger->Out()) << flush; - } - else StartTrace (former, start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : Transfer in Error Status"); - case Transfer_StatusLoop : // la boucle est bouclee ... - if (thetrace) { - themessenger << " *** Transfer Head of Dead Loop :" << endl; - StartTrace (former, start, thelevel,0); -// (*themessenger->Out()) << flush; - } - else StartTrace (former, start,thelevel,4); - Transfer_TransferDeadLoop::Raise - ("TransferProcess : Transfer at Head of a Dead Loop"); - } -#ifdef TRANSLOG - cout << "Transfer,level "<SetStatusExec(Transfer_StatusRun); - } -#ifdef TRANSLOG - cout << " GO .." << endl; -#endif - - Handle(Transfer_Binder) binder; - Standard_Boolean newbind = Standard_False; - if (theerrh) { - // Transfert sous protection pour les exceptions (pour notification en fait) - Standard_Integer oldlev = thelevel; - try { - OCC_CATCH_SIGNALS - binder = TransferProduct(start); - } - - // ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... ! - catch (Transfer_TransferDeadLoop) { - if (binder.IsNull()) { - themessenger << " *** Dead Loop with no Result" << endl; - if (thetrace) StartTrace (binder, start, thelevel-1,0); - binder = new Transfer_VoidBinder; - Bind (start,binder); newbind = Standard_True; - } else if (binder->StatusExec() == Transfer_StatusLoop) { - if (thetrace) { - themessenger << " *** Dead Loop : Finding head of Loop :" << endl; - StartTrace (binder, start, thelevel-1,0); - } - else StartTrace (binder, start,thelevel-1,4); - Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); -// Autrement dit, on change d exception (on est sorti de la boucle) - } else { - if (thetrace) { - themessenger << " *** Dead Loop : Actor in Loop :" << endl; - StartTrace (binder, start, thelevel-1,0); - } - } - binder->AddFail("Transfer in dead Loop"); - thelevel = oldlev; - } - catch (Standard_Failure) { - if (binder.IsNull()) { - themessenger << " *** Exception Raised with no Result" << endl; - binder = new Transfer_VoidBinder; - Bind (start,binder); newbind = Standard_True; - } - binder->AddFail("Transfer stopped by exception raising"); - if (thetrace) { - themessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; - StartTrace (binder, start, thelevel-1,4); - } - thelevel = oldlev; - } - } - -// Transfert non protege (ainsi, dbx a la main en cas de plantage par Raise) - else binder = TransferProduct(start); - -// .... Conclusion : Noter dans la Map .... - - if (!newbind && !binder.IsNull()) { - if (former.IsNull()) { -// Peut-etre a fait lui meme Bind ... verifier sinon le faire - if (!IsBound(start)) Bind(start,binder); // resultat = categorie 0 - else { // gka TRJ9 for writing SDR for solid -// Handle(Transfer_Binder) tmpbind = Find(start); -// if(!Contains(binder,tmpbind)) -// binder->AddResult(tmpbind); - Rebind(start,binder); // test_pattern.sat - } - } - else Rebind(start,binder); -// (du coup, vaut ) -#ifdef TRANSLOG - cout << " ... OK" << endl; -#endif - } - else { - //= by ABV: 5 Oct 97: nothing generated, but former can be in run state - drop it - //= ASK: may be set it to StatusInitial ? - if ( ! former.IsNull() ) former->SetStatusExec ( Transfer_StatusDone ); //+ - return nulbinder; // Binder Null ... que faire d autre ? - } - -// .... Gerer les Racines (si prevu) .... - - if (therootl >= thelevel) { - therootl = 0; - if (therootm && binder->Status() != Transfer_StatusVoid) { - SetRoot (start); - } - } - return thelastbnd; -} - -// ## ## TransferProduct : Action proprement dite ## ## - - Handle(Transfer_Binder) Transfer_TransferProcess::TransferProduct - (const TheStart& start) -{ - thelevel ++; // si decremente et == 0, transfert racine - Handle(Transfer_Binder) binder; - Handle(Transfer_Actor) actor = theactor; - -// On balaie les Next jusqu a avoir un Resultat - while (!actor.IsNull()) { - if (actor->Recognize (start)) binder = actor->Transferring(start,this); - else binder.Nullify(); - if (!binder.IsNull()) break; - actor = actor->Next(); - } - if (binder.IsNull()) { -// if (thetrace) { -// themessenger << "Transfer has produced no Result" < 0) thelevel --; - return binder; - } -// Gestion du niveau racine (.. a regarder de pres ..) - if (therootl == 0 && binder->StatusExec() == Transfer_StatusDone) - therootl = thelevel - 1; - - if (thelevel > 0) thelevel --; - return binder; -} - - -//======================================================================= -//function : Transfer -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Transfer(const TheStart& start) -{ - Handle(Transfer_Binder) binder = Transferring(start); - return (!binder.IsNull()); -} - - -// ######################################################################### -// .... Error Handling + Trace .... - -// trace : 1 pour Fail et Exception , 2 pour Root et Warning - - -//======================================================================= -//function : SetErrorHandle -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetErrorHandle(const Standard_Boolean err) -{ - theerrh = err; -} // traite par Transferring - - -//======================================================================= -//function : ErrorHandle -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::ErrorHandle() const -{ - return theerrh; -} - -//======================================================================= -//function : StartTrace -//purpose : -//======================================================================= - -void Transfer_TransferProcess::StartTrace(const Handle(Transfer_Binder)& binder, - const TheStart& start, - const Standard_Integer level, - const Standard_Integer mode) const -{ - // ### Fail (Roots:50) -- Start start->DynamicType() - // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType() - if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4) - if (mode == 1) themessenger << " ### Fail"; - if (mode == 2) themessenger << " ### Warning"; - if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent(); - if (mode == 4) themessenger << " ### Exception"; - if (mode == 5) themessenger << " ### Substitution"; - if (mode == 6) themessenger << " ### Information"; - if (level > 1) - themessenger << " (nested)"; // " at nesting Level:"<= 0 && mode != 3) - themessenger << " at " << theroots.Extent() << " Roots"; - } - if (!start.IsNull()) PrintTrace (start,themessenger); -//// sout << endl; - - if (!binder.IsNull()) { // old: if IsNull sout <Status() != Transfer_StatusVoid) { -// --- Result Type: binder->ResultType() --- Binder : binder->DynamicType(); - if (!hasres) - themessenger << "\n --- Result Type : "; - else - themessenger << " , "; - themessenger << bnd->ResultTypeName(); -// CKY 9-JAN-1999: waiting for XSTEP Kernel message (not IGES_2075) -/* Message_Msg Msg2075("IGES_2075"); - Msg2075.AddString(bnd->ResultTypeName()); - Msg2075.TraceEver(); */ - hasres = Standard_True; - } - bnd = bnd->NextResult(); - } - if (!hasres && mode > 2) { - themessenger << "\n --- No Result recorded"; -// CKY 9-JAN-1999 : waiting for XSTEP Kernel message -// (not IGES_2075, no reference to specifically TopoDS_Shape) -/* Message_Msg Msg2075("IGES_2075"); - Msg2075.AddString("No TopoDS_Shape"); - Msg2075.TraceEver(); */ - } -//old if (isused) sout << " -- (Already Used in another Transfer)"; - } - themessenger << endl; -} - - -//======================================================================= -//function : PrintTrace -//purpose : -//======================================================================= - -void Transfer_TransferProcess::PrintTrace(const TheStart& start, - const Handle(Message_Messenger)& S) const -{ - if (!start.IsNull()) S <<" Type:" << start->DynamicType()->Name(); -} - - -//======================================================================= -//function : IsLooping -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsLooping - (const Standard_Integer alevel) const - { return alevel > NbMapped(); } - - - -// ######################################################################### -// .... RESULTATS .... - - -// ## ## RootResult : Les Racines ## ## - - -//======================================================================= -//function : RootResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::RootResult(const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = theroots.Extent(); - for (Standard_Integer j = 1; j <= max; j ++) { - Standard_Integer i = theroots.FindKey(j); - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(i)); - else iter.Add (binder); - } - return iter; -} - - -// ## ## CompleteResult : Tous les Resultats ## ## - -//======================================================================= -//function : CompleteResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::CompleteResult - (const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(i)); - else iter.Add (binder); - } - return iter; -} - - -// ## ## AbnormalResult : Transferts a probleme ## ## -//======================================================================= -//function : AbnormalResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::AbnormalResult() const -{ - Transfer_Iterator iter(Standard_True); - Standard_Integer max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone) - iter.Add (binder,Mapped(i)); // on note les cas "pas normaux" - } - return iter; -} - - -// ## ## ## CheckList : les messages ## ## ## -//======================================================================= -//function : CheckList -//purpose : -//======================================================================= - -Interface_CheckIterator Transfer_TransferProcess::CheckList - (const Standard_Boolean erronly) const -{ - Interface_CheckIterator list; - Standard_Integer num, max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && - !check->HasFailed()) - check->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); - if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue; - const TheStart& ent = Mapped(i); - num = CheckNum(ent); - if (num == 0) num = i; - check->SetEntity(ent); - list.Add(check,num); - } - return list; -} - - -// ######################################################################### -// .... RESULTATS PAR ENTITE .... - -//======================================================================= -//function : ResultOne -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::ResultOne(const TheStart& start, - const Standard_Integer level, - const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return iter; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); - //MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(ind)); - else iter.Add (binder); - } - return iter; -} - - -//======================================================================= -//function : CheckListOne -//purpose : -//======================================================================= - -Interface_CheckIterator Transfer_TransferProcess::CheckListOne - (const TheStart& start,const Standard_Integer level, - const Standard_Boolean erronly) const -{ - Interface_CheckIterator list; - Standard_Integer max = NbMapped(); - Standard_Integer num, ind = MapIndex (start); - if (ind == 0) return list; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); - //MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && - !check->HasFailed()) - check->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); - if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue; - const TheStart& ent = Mapped(ind); - num = CheckNum(ent); if (num == 0) num = ind; - check->SetEntity(ent); - list.Add(check,num); - } - return list; -} - - -//======================================================================= -//function : IsCheckListEmpty -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsCheckListEmpty - (const TheStart& start, const Standard_Integer level, - const Standard_Boolean erronly) const -{ - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return Standard_False; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); -// MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; - - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone) - return Standard_False; - if (check->HasFailed() || (!erronly && check->NbWarnings() > 0)) return Standard_False; - } - return Standard_True; -} - - -//======================================================================= -//function : RemoveResult -//purpose : -//======================================================================= - -void Transfer_TransferProcess::RemoveResult(const TheStart& start, - const Standard_Integer level, - const Standard_Boolean /*compute*/) -{ - //if (compute) ComputeScopes(); - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); -// MarkScoped (ind,level,map); - - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; -// Standard_Boolean cayest = binder->SetNbUserScopes (-1); -// if (cayest) themap(ind) = nulbinder; // RAZ ! - } - -//pdn commented for (i = NbRoots(); i > 0; i --) -// if (theroots.Value(i) == ind) theroots.Remove(i); -} - - -Standard_Integer Transfer_TransferProcess::CheckNum(const TheStart& ) const -{ - return 0; -} - - -//======================================================================= -//function : SetProgress -//purpose : Sets Progress indicator -//======================================================================= - -void Transfer_TransferProcess::SetProgress(const Handle(Message_ProgressIndicator)& theProgress) -{ - myProgress = theProgress; -} - -//======================================================================= -//function : GetProgress -//purpose : Returns Progress indicator -//======================================================================= - -Handle(Message_ProgressIndicator) Transfer_TransferProcess::GetProgress() const -{ - return myProgress; -} diff --git a/src/Transfer/Transfer_TransferProcess.hxx b/src/Transfer/Transfer_TransferProcess.hxx new file mode 100644 index 0000000000..92506a7969 --- /dev/null +++ b/src/Transfer/Transfer_TransferProcess.hxx @@ -0,0 +1,2219 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_TransferProcess_HeaderFile +#define _Transfer_TransferProcess_HeaderFile + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + //! This class gives the frame for doing a direct transfer : it + //! provides required basic tools, such as a Map, and automatisms + //! which simplify work, while their use is not mandatory. + //! + //! Starting Objects managed by Mapping can be Transient or any + //! (by two instantiations provided by the package, + //! TransientProcess and FinderProcess, see class Finder). + //! + //! A direct Transfer must maintain data sharing whenever possible + //! (that is, when described by both sides) : this is managed by a + //! Map. It works with intermediate Objects, the Binders. Hence it + //! allows a binding, one/several-one/several, and it controls + //! that a Resulting Data can be used by another one only + //! if its creation has been ended. Also it keeps error status. + //! + //! Several results can be bound to a starting object, identified + //! by a category number. The default one (the only one considered + //! for final analysis) is zero. But mapping accesses allow to + //! precise a category number different from zero + //! + //! In order to work more easily in most cases, automatisms are + //! offered. Classically, to transfer an object, its result is + //! computed then bound. This applies recursively for referenced + //! objects. Each Transfer of a kind of object can be performed + //! by a specific Tool, which can use TransferProcess to work. + //! + //! + //! Many often, a specific Transfer can work as : "Search the good + //! Tool to Perform the Transfer (if not provided), run the Tool, + //! then Bind the Result", where "Perform" is seen as a black box. + //! + //! This way of working is assumed through automatisms which use + //! two types of auxiliary objects : + //! - An Actor acts as a Library of Transfer Actions : + //! it recognizes the operation to perform on a starting object, + //! then runs it (see class Actor) + //! - it produces a Binder, which is then recorded in the Map + //! - of course, if the Transfer has been already done, it is not + //! run once more : the first Result is available + //! - it is possible to re-evaluate the Result if required (anI.e. + //! if the definitive Result is known only once other Transfers + //! have been engaged) + //! - in the case of a second (or more) ask for Transfer, the + //! Result is considered as "AlreadyUsed", hence it may not be + //! changed (in the Binder itself or by Rebinding another one) + //! + //! This gives a top-down process, in which first object to be + //! transferred asks for another one it references to be, etc... + //! This allows automatic management of Roots : only first + //! transfers (asked by the user) can be Root Transfers. + //! + //! + //! Other features are : Management of Root Entities (the Entities + //! by which the Transfer has started, and their Results, can be + //! identified as Roots, by the user or by automatisms); Error + //! Handling (if automatisms are used); + //! Returning Results, which can be specialized for + //! Roots, or Erroneous Data, or complete/partial (for one entity) + //! + //! Finally, TransferProcess inherits TShared : this allows to + //! run successive steps on the same set of data attached to a + //! given Transfer, by easily transmitting this set. + +template +class Transfer_TransferProcess : public MMgt_TShared +{ +private: + Handle(Standard_Transient) myNullTrans; +protected: + //! To handle or not exception raisings + Standard_Boolean myToHandleErr; + //! Trace theLevel (exceptions,errors, etc...) + Standard_Integer myTrace; + //! Messenger for sending messages + Handle(Message_Messenger) myMessenger; + + Standard_Integer myLevel; + //! Level of root at each time (not allways 1) + Standard_Integer myRootLevel; + //! Flag for Root Management set or not + Standard_Boolean myToManageRoot; + //! Indices of roots in the map + TColStd_IndexedMapOfInteger myRoots; + + //! Last Starting Object Bound + StartObject myLastObj; + //! Its attached Binder (noted to optimize) + Handle(Transfer_Binder) myLastBinder; + Standard_Integer myIndex; + ActorHandle myActor; + TransferMap myMap; + //! Progress indicator + Handle(Message_ProgressIndicator) myProgress; + +private: + + + Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const StartObject& start) ; +public: + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets default trace file as a printer and default trace level + //! (see Message_TraceFile). + Standard_EXPORT Transfer_TransferProcess (const Standard_Integer theNb = 10000); + + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets a specified printer. + Standard_EXPORT Transfer_TransferProcess (const Handle(Message_Messenger)& myMessenger, + const Standard_Integer theNb = 10000); + + //! Same as Find but stores the last access to the map, for a + //! faster access on next calls (as Bind does too). + //! Considers a category number, by default 0. + Standard_EXPORT Handle(Transfer_Binder) FindAndMask (const StartObject& theStart); + + //! Resets a TransferProcess as ready for a completely new work. + //! Clears general data (roots) and the Map. + Standard_EXPORT void Clear (); + + //! Rebuilds the Map and the roots to really remove Unbound items + //! Because Unbind keeps the entity in place, even if not bound + //! Hence, working by checking new items is meaningless if a + //! formerly unbound item is rebound. + Standard_EXPORT void Clean (); + + //! Resizes the Map as required (if a new reliable value has been + //! determined). Acts only if is greater than actual NbMapped. + Standard_EXPORT void Resize (const Standard_Integer theNb); + + //! Defines an Actor, which is used for automatic Transfer + //! If already defined, the new Actor is cumulated + //! (see SetNext from Actor). + Standard_EXPORT void SetActor(const ActorHandle& theActor); + + //! Returns the defined Actor. Returns a Null Handle if not set. + Standard_EXPORT ActorHandle Actor () const; + + //! Fine Access to Map + //! This access works on : Binder (default), or Handle Result + //! (Transient,Finder) as privileged kinds of Result + + //! Returns the Binder which is linked with a starting Object + //! It can either bring a Result (Transfer done) or none (for a + //! pre-binding). + //! If no Binder is linked with , returns a Null Handle + //! Considers a category number, by default 0. + //! Warning : it is not equivalent to IsBound, which demands a Result + Standard_EXPORT Handle(Transfer_Binder) Find (const StartObject& theStart) const; + + //! Returns True if a Result (whatever its form) is Bound with + //! a starting Object. I.e., if a Binder with a Result set, is linked with it. + //! Considers a category number, by default 0. + Standard_EXPORT Standard_Boolean IsBound (const StartObject& theStart) const; + + //! Returns True if the result of the transfer of an object is + //! already used in other ones. If it is, Rebind cannot change it. + //! Considers a category number, by default 0. + Standard_EXPORT Standard_Boolean IsAlreadyUsed (const StartObject& theStart) const; + + //! Creates a Link a starting Object with a Binder. This Binder + //! can either bring a Result (effective Binding) or none (it can + //! be set later : pre-binding). + //! Considers a category number, by default 0. + //! Error if a Binder with a Result set is already linked with + //! this Object (Binder with StatusResult not Initial). + Standard_EXPORT void Bind (const StartObject& theStart, + const Handle(Transfer_Binder)& theBinder); + + //! Changes the Binder linked with a starting Object for its + //! unitary transfer. This it can be useful when the exact form + //! of the result is known once the transfer is widely engaged. + //! This can be done only on first transfer. + //! Considers a category number, by default 0. + //! Error if : - the Result is known as Already Used + //! or if - No Result is bound to + //! or if - brings No result. + Standard_EXPORT void Rebind (const StartObject& theStart, + const Handle(Transfer_Binder)& theBinder); + + //! Removes the Binder linked with a starting object + //! If this Binder brings a non-empty Check, it is replaced by + //! a VoidBinder. Also removes from the list of Roots as required. + //! Returns True if done, False if was not bound. + //! Considers a category number, by default 0. + //! Error if : - the Result is known as Already Used. + Standard_EXPORT Standard_Boolean Unbind (const StartObject& theStart); + + //! Returns a Binder for a starting entity, as follows: + //! Tries to Find the already bound one. + //! If none found, creates a VoidBinder and Binds it. + Standard_EXPORT Handle(Transfer_Binder) FindElseBind (const StartObject& theStart); + + //! Sets Messenger used for outputting messages. + Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& myMessenger); + + //! Returns Messenger used for outputting messages. + //! The returned object is guaranteed to be non-null; + //! default is Message::Messenger(). + Standard_EXPORT Handle(Message_Messenger) Messenger () const; + + //! Sets trace level used for outputting messages: + //! = 0 : no trace at all + //! = 1 : handled exceptions and calls to AddError + //! = 2 : also calls to AddWarning + //! = 3 : also traces new Roots + //! (uses method ErrorTrace). + //! Default is 1 : Errors traced. + Standard_EXPORT void SetTraceLevel (const Standard_Integer myTraceLevel); + + //! Returns trace level used for outputting messages. + Standard_EXPORT Standard_Integer TraceLevel () const; + + //! New name for AddFail(theMsg). + Standard_EXPORT void SendFail (const StartObject& theStart, + const Message_Msg& theMsg); + + //! New name for AddWarning (Msg). + Standard_EXPORT void SendWarning (const StartObject& theStart, + const Message_Msg& theMsg); + //! Adds an information message. + //! Trace is filled if trace level is at least 3. + Standard_EXPORT void SendMsg (const StartObject& theStart, + const Message_Msg& theMsg); + + //! Adds an Error message to a starting entity (to the check of + //! its Binder of category 0, as a Fail). + Standard_EXPORT void AddFail (const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig = ""); + + //! The other name of AddFail, maintained for compatibility. + Standard_EXPORT void AddError (const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig = ""); + + //! Adds an Error Message to a starting entity from the definition + //! of a Msg (Original+Value). + Standard_EXPORT void AddFail (const StartObject& theStart, + const Message_Msg& theMsg); + + //! Adds a Warning message to a starting entity (to the check of + //! its Binder of category 0). + Standard_EXPORT void AddWarning (const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig = ""); + + //! Adds a Warning Message to a starting entity from the definition + //! of a Msg (Original+Value). + Standard_EXPORT void AddWarning (const StartObject& theStart, + const Message_Msg& theMsg); + + //! Mends messages bound to a starting entity, if there are some + //! as for Check from Interface : + //! Default converts all fails to warnings and that's all. + Standard_EXPORT void Mend (const StartObject& theStart, + const Standard_CString thePref = ""); + + //! Returns the Check attached to a starting entity. + //! If is unknown, returns an empty Check. + Standard_EXPORT Handle(Interface_Check) Check (const StartObject& theStart) const; + + //! Binds a starting object with a Transient Result. + //! Uses a SimpleBinderOfTransient to work. If there is already + //! one but with no Result set, sets its Result. + //! Considers a category number, by default 0. + //! Error if a result is already bound (Binder not Initial). + Standard_EXPORT void BindTransient (const StartObject& theStart, + const Handle(Standard_Transient)& theResult); + + //! Returns the Result of the Transfer of an object as a + //! Transient Result. + //! Returns a Null Handle if there is no Transient Result + //! Considers a category number, by default 0. + //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient. + Standard_EXPORT const Handle(Standard_Transient)& FindTransient + (const StartObject& theStart) const; + + //! Prepares an object to be bound with several results. + //! If no Binder is yet attached to , a MultipleBinder + //! is created, empty. If a Binder is already set, it must + //! accept Multiple Binding. + //! Considers a category number, by default 0. + //! Error if a UNIQUE result is already bound (if a Multiple + //! Result is, nothing is done). + Standard_EXPORT void BindMultiple (const StartObject& theStart); + + //! Searches for a transient result attached to a starting object, + //! according to its type, by criterium IsKind(theType) + //! In case of multiple result, explores the list and gives in + //! the first transient result IsKind(atype) + //! Returns True and fills if found + //! Else, returns False ( is not touched, not even nullified) + //! This syntactic form avoids to do DownCast : if a result is + //! found with the good type, it is loaded in and can be + //! immediately used, well initialised. + Standard_EXPORT Standard_Boolean + FindTypedTransient (const StartObject& theStart, + const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theVal) const; + + //! Searches for a transient result recorded in a Binder, whatever + //! this Binder is recorded or not in . + //! This is strictly equivalent to the class method GetTypedResult + //! from class SimpleBinderOfTransient, but is just lighter to call + //! Apart from this, works as FindTypedTransient. + Standard_EXPORT Standard_Boolean + GetTypedTransient (const Handle(Transfer_Binder)& theBinder, + const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theVal) const; + + //! Returns the maximum possible value for Map Index + //! (no result can be bound with a value greater than it). + Standard_EXPORT Standard_Integer NbMapped () const; + + //! Returns the Starting Object bound to an Index. + Standard_EXPORT const StartObject& Mapped (const Standard_Integer theNum) const; + + //! Returns the Index value bound to a Starting Object, 0 if none. + Standard_EXPORT Standard_Integer MapIndex (const StartObject& theStart) const; + + //! Returns the Binder bound to an Index + //! Considers a category number, by default 0. + Standard_EXPORT Handle(Transfer_Binder) MapItem(const Standard_Integer theNum) const; + + //! Declares (and its Result) as Root. This status will be + //! later exploited by RootResult, see below (Result can be + //! produced at any time). + //! Error if is not bound before calling to SetRoot. + Standard_EXPORT void SetRoot (const StartObject& theStart); + + //! Enable (if True) or Disables (if False) Root + //! Management. If it is set, Transfers are considered as stacked + //! (a first Transfer commands other Transfers, and so on) and + //! the Transfers commanded by an external caller are "Root". + //! Remark : SetRoot can be called whatever this status, on every + //! object. + //! Default is set to True. + Standard_EXPORT void SetRootManagement (const Standard_Boolean theStatus); + + //! Returns the count of recorded roots. + Standard_EXPORT Standard_Integer NbRoots () const; + + //! Returns a Root Entity given its number in the list (1-NbRoots). + Standard_EXPORT const StartObject& Root (const Standard_Integer theNum) const; + + //! Returns the Binder bound with a Root Entity given its number. + //! Considers a category number, by default 0. + Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer theNum) const; + + //! Returns the index in the list of roots for a starting item, + //! or 0 if it is not recorded as a root. + Standard_EXPORT Standard_Integer RootIndex (const StartObject& theStart) const; + + //! Returns Nesting Level of Transfers (managed by methods + //! TranscriptWith & Co). Starts to zero. If no automatic Transfer + //! is used, it remains to zero. Zero means Root Level. + Standard_EXPORT Standard_Integer NestingLevel () const; + + //! Resets Nesting Level of Transfers to Zero (Root Level), + //! whatever its current value. + Standard_EXPORT void ResetNestingLevel (); + + //! Tells if has been recognized as good candidate for + //! Transfer. i.e. queries the Actor and its Nexts. + Standard_EXPORT Standard_Boolean Recognize (const StartObject& theStart) const; + + //! Performs the Transfer of a Starting Object, by calling + //! the method TransferProduct (see below). + //! Mapping and Roots are managed : nothing is done if a Result is + //! already Bound, an exception is raised in case of error. + //! Error : if the Transfer falls in a loop, or asks to Rebind an + //! Object already Bound AND Used or reads a non computed Result + //! + //! Remark : if ErrorHandle is set, no exception is raised : see + //! the method SetErrorHandle for more details + Standard_EXPORT Handle(Transfer_Binder) Transferring (const StartObject& theStart); + + //! Same as Transferring but does not return the Binder. + //! Simply returns True in case of success (for user call). + Standard_EXPORT Standard_Boolean Transfer (const StartObject& theStart) ; + + //! Allows controls if exceptions will be handled + //! Transfer Operations + //! False : they are not handled with try {} catch {} + //! True : they are + //! Default is False: no handling performed. + Standard_EXPORT void SetErrorHandle (const Standard_Boolean isError); + + //! Returns error handling flag. + Standard_EXPORT Standard_Boolean ErrorHandle() const; + + //! Method called when trace is asked + //! Calls PrintTrace to display information relevant for starting + //! objects (which can be redefined) + //! is Nesting Level of Transfer (0 = root) + //! controls the way the trace is done : + //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root. + Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& theBinder, + const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Integer theMode) const; + + //! Prints a short information on a starting object. + //! By default prints its Dynamic Type. Can be redefined. + Standard_EXPORT void PrintTrace (const StartObject& theStart, + const Handle(Message_Messenger)& myMessenger) const; + + //! Returns True if we are surely in a DeadLoop. Evaluation is not + //! exact, it is a "majorant" which must be computed fast. + //! This "majorant" is : greater than NbMapped. + Standard_EXPORT Standard_Boolean IsLooping (const Standard_Integer theLevel) const; + + //! Returns, as an iterator, the log of root transfer, i.e. the + //! created objects and Binders bound to starting roots. + //! If withstart is given True, Starting Objets are also returned. + Standard_EXPORT Iterator RootResult (const Standard_Boolean isWithStart = Standard_False) const; + + //! Returns, as an Iterator, the entire log of transfer (list of + //! created objects and Binders which can bring errors). + //! If withstart is given True, Starting Objets are also returned. + Standard_EXPORT Iterator CompleteResult (const Standard_Boolean isWithStart = Standard_False) const; + + //! Returns Binders which are neither "Done" nor "Initial", + //! that is Error,Loop or Run (abnormal states at end of Transfer) + //! Starting Objects are given in correspondance in the iterator. + Standard_EXPORT Iterator AbnormalResult() const; + + //! Returns a CheckList as a list of Check : each one is for a + //! starting entity which have either check (warning or fail) + //! messages are attached, or are in abnormal state : that case + //! gives a specific message. + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean isErrOnly) const; + + //! Returns, as an Iterator, the log of transfer for one object + //! = 0 : this object only + //! and if is a scope owner (else, is ignored) : + //! = 1 : object plus its immediate scoped ones + //! = 2 : object plus all its scoped ones. + Standard_EXPORT Iterator ResultOne (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean isWithStart = Standard_False) const; + + //! Returns a CheckList for one starting object + //! interpreted as by ResultOne + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Interface_CheckIterator + CheckListOne (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean isErrOnly) const; + + //! Returns True if no check message is attached to a starting + //! object. interpreted as by ResultOne + //! If is True, checks with Warnings only are ignored . + Standard_EXPORT Standard_Boolean + IsCheckListEmpty (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean isErrOnly) const; + + //! Removes Results attached to (== Unbinds) a given object and, + //! according : + //! = 0 : only it + //! = 1 : it plus its immediately owned sub-results(scope) + //! = 2 : it plus all its owned sub-results(scope). + Standard_EXPORT void RemoveResult (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean toCompute = Standard_True); + + //! Computes a number to be associated to a starting object in + //! a check or a check-list. + //! By default, returns 0; can be redefined. + Standard_EXPORT virtual Standard_Integer CheckNum(const StartObject& ) const; + + //! Sets Progress indicator. + Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress); + + //! Gets Progress indicator. + Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress () const; + + //! Adds an item to a list of results bound to a starting object. + //! Considers a category number, by default 0, for all results + //! Error if no Binder accepting Multiple Binding is attached + //! to (none at all, or for a unique result) + Standard_EXPORT void AddMultiple (const StartObject& theStart, + const Handle(Standard_Transient)& theResult); + +}; + + //======================================================================= + //function : Transfer_TransferProcess + //purpose : + //======================================================================= + template + Transfer_TransferProcess + ::Transfer_TransferProcess (const Standard_Integer theNb) + : myMap (theNb) + { + myToHandleErr = Standard_True; + myToManageRoot = Standard_False; + myLevel = 0; myRootLevel = 0; + myMessenger = Message::DefaultMessenger(); + myTrace = 0; + // myRoots = new TColStd_HSequenceOfInteger (); + myIndex = 0; + } + + + //======================================================================= + //function : Transfer_TransferProcess + //purpose : + //======================================================================= + + template + Transfer_TransferProcess + ::Transfer_TransferProcess (const Handle(Message_Messenger)& myMessenger, + const Standard_Integer theNb) + : myMap (theNb) + { + myToHandleErr = Standard_True; + myToManageRoot = Standard_False; + myLevel = 0; myRootLevel = 0; + SetMessenger (myMessenger); + myTrace = 1; + myIndex = 0; + } + + //======================================================================= + //function : Clear + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Clear () + { + myLevel = 0; myRootLevel = 0; + myRoots.Clear(); + myMap.Clear(); + myIndex = 0; myLastObj.Nullify(); myLastBinder.Nullify(); + } + + //======================================================================= + //function : Clean + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Clean () + { + Standard_Integer anI, aNb = NbMapped(); + Standard_Integer aJ,unb = 0; + for (anI = 1; anI <= aNb; anI ++) + { + if (myMap(anI).IsNull()) unb ++; + } + if (unb == 0) return; + + TColStd_Array1OfInteger unbs (1,aNb); unbs.Init(0); + TransferMap newmap (aNb*2); + for (anI = 1; anI <= aNb; anI ++) + { + StartObject ent = Mapped(anI); + Handle(Transfer_Binder) bnd = MapItem(anI); + if (bnd.IsNull()) continue; + aJ = newmap.Add (ent,bnd); + unbs.SetValue (anI,aJ); + } + myMap.Assign (newmap); + + // Update the list of root + TColStd_IndexedMapOfInteger aNewRoots; + for (anI=1; anI<= myRoots.Extent(); anI++) + { + aJ = myRoots.FindKey(anI); + Standard_Integer k = unbs.Value(aJ); + if (k) aNewRoots.Add (k); + } + myRoots.Clear(); + myRoots = aNewRoots; + + myLastObj.Nullify(); + myLastBinder.Nullify(); + myIndex = 0; + } + + //======================================================================= + //function : Resize + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Resize (const Standard_Integer theNb) + { + if (theNb > myMap.NbBuckets()) + myMap.ReSize(theNb); + } + + //======================================================================= + //function : SetActor + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetActor(const ActorHandle& theActor) + { + if (myActor == theActor) return; + if (myActor.IsNull()) myActor = theActor; + else if (theActor.IsNull()) myActor = theActor; // declenche RAZ + else if (myActor->IsLast()) { theActor->SetNext(myActor); myActor = theActor; } + else myActor->SetNext(theActor); + } + + + //======================================================================= + //function : Actor + //purpose : + //======================================================================= + + template + ActorHandle + Transfer_TransferProcess + ::Actor () const + { + return myActor; + } + + + // ######################################################################## + // .... MAPPING .... + + // ## ## ## Actions Generales sur Binders ## ## ## + // ## ## ## Consultations ## ## ## + + //======================================================================= + //function : Find + //purpose : + //======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::Find (const StartObject& theStart) const + { + if (myLastObj == theStart) + { + //if (myIndex > 0) return myLastBinder->Search(categ); //skl + if (myIndex > 0) return myLastBinder; //skl + } + Standard_Integer index = myMap.FindIndex (theStart); + if (index > 0) + { + const Handle(Transfer_Binder)& theBinder = myMap.FindFromIndex(index); + //if (theBinder.IsNull()) //skl + return theBinder; + //return theBinder->Search(categ); //skl + } + Handle(Transfer_Binder) aNullBinder; + return aNullBinder; + } + + //======================================================================= + //function : IsBound + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::IsBound (const StartObject& theStart) const + { + Handle(Transfer_Binder) theBinder = Find(theStart); //,categ); skl + if (theBinder.IsNull()) return Standard_False; + return theBinder->HasResult(); + } + + //======================================================================= + //function : IsAlreadyUsed + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::IsAlreadyUsed (const StartObject& theStart) const + { + Handle(Transfer_Binder) theBinder = Find(theStart); + if (theBinder.IsNull()) { + StartTrace (theBinder,theStart,myLevel,4); + Transfer_TransferFailure::Raise + ("TransferProcess : IsAlreadyUsed, transfer not done cannot be used..."); + } + return (theBinder->Status() == Transfer_StatusUsed); + } + + //======================================================================= + //function : FindAndMask + //purpose : + //======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::FindAndMask (const StartObject& theStart) + { + if (myLastObj == theStart) + { + if (myIndex > 0) return myLastBinder; + } + myLastObj = theStart; + myIndex = myMap.FindIndex (theStart); + if (myIndex > 0) myLastBinder = myMap.FindFromIndex(myIndex); + else myLastBinder.Nullify(); + return myLastBinder; + } + + //======================================================================= + //function : Bind + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Bind (const StartObject& theStart, + const Handle(Transfer_Binder)& theBinder) + { + if (theBinder.IsNull()) return; + Handle(Transfer_Binder) aFormer = FindAndMask(theStart); + if (!aFormer.IsNull()) + { + if (aFormer->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) + { + theBinder->Merge(aFormer); + myMap(myIndex) = theBinder; // Substitution + } + else if (aFormer->Status() == Transfer_StatusUsed) + { + StartTrace (aFormer,theStart,myLevel,4); + Transfer_TransferFailure::Raise + ("TransferProcess : Bind, already Bound"); + } + else + { + if (myTrace > 2) StartTrace (aFormer,theStart,myLevel,5); + theBinder->CCheck()->GetMessages (aFormer->Check()); + } + } + if (myIndex == 0 || myLastBinder.IsNull()) + { + if (myIndex == 0) myIndex = myMap.Add(theStart,theBinder); + else myMap(myIndex) = theBinder; + myLastBinder = theBinder; + } + else + { + myLastBinder = theBinder; + myMap(myIndex) = theBinder; + } + } + + //======================================================================= + //function : Rebind + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Rebind (const StartObject& theStart, + const Handle(Transfer_Binder)& theBinder) + { + Bind(theStart,theBinder); + } + + //======================================================================= + //function : Unbind + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::Unbind (const StartObject& theStart) + { + Handle(Transfer_Binder) aFormer = FindAndMask(theStart); + if (myIndex == 0) return Standard_False; + if (aFormer.IsNull()) return Standard_False; + if (aFormer->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) + return Standard_True; + myMap(myIndex) = myLastBinder; + if (myRoots.Contains(myIndex)) + { + TColStd_IndexedMapOfInteger aNewRoots; + for (Standard_Integer anI = 1; anI <= myRoots.Extent(); anI++) + if (myIndex!= myRoots.FindKey(anI)) + aNewRoots.Add(myRoots.FindKey(anI)); + + myRoots.Clear(); + myRoots = aNewRoots; + } + + myLastObj.Nullify(); + myLastBinder.Nullify(); + myIndex = 0; + return Standard_True; + } + + //======================================================================= + //function : FindElseBind + //purpose : + //======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::FindElseBind (const StartObject& theStart) + { + Handle(Transfer_Binder) aBinder = FindAndMask (theStart); + if (!aBinder.IsNull()) return aBinder; + aBinder = new Transfer_VoidBinder; + Bind(theStart,aBinder); + return aBinder; + } + + //======================================================================= + //function : SetMessenger + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetMessenger (const Handle(Message_Messenger)& myMessenger) + { + if ( myMessenger.IsNull() ) + myMessenger = Message::DefaultMessenger(); + else + myMessenger = myMessenger; + } + + //======================================================================= + //function : Messenger + //purpose : + //======================================================================= + + template + Handle(Message_Messenger) + Transfer_TransferProcess + ::Messenger () const + { + return myMessenger; + } + + //======================================================================= + //function : SetTraceLevel + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetTraceLevel (const Standard_Integer myTraceLevel) + { + myTrace = myTraceLevel; + } + + //======================================================================= + //function : TraceLevel + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::TraceLevel () const + { + return myTrace; + } + + //======================================================================= + //function : SendFail + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SendFail (const StartObject& theStart, + const Message_Msg& theMsg) + { + AddFail(theStart,theMsg); + } + + //======================================================================= + //function : SendWarning + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SendWarning (const StartObject& theStart, + const Message_Msg& theMsg) + { + AddWarning(theStart,theMsg); + } + + //======================================================================= + //function : SendMsg + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SendMsg (const StartObject& theStart, + const Message_Msg& theMsg) + { + Handle(Transfer_Binder) theBinder = FindAndMask(theStart); + if (theBinder.IsNull()) { + theBinder = new Transfer_VoidBinder; + Bind (theStart,theBinder); + } + // Feeds the trace: Rule causing (user messages) + if (myTrace > 0) { + StartTrace (theBinder,theStart,myLevel,6); + myMessenger << theMsg.Value(); + if (theMsg.IsEdited()&&myTrace>2) + myMessenger << " [from: " << theMsg.Original() << "]"; + myMessenger << endl; + } + } + + //======================================================================= + //function : AddFail + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddFail (const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig) + { + Handle(Transfer_Binder) theBinder = FindAndMask (theStart); + if (theBinder.IsNull()) + { + theBinder = new Transfer_VoidBinder; + Bind (theStart,theBinder); + } + theBinder->AddFail (theMessage,theOrig); + if (myTrace > 0) + { + StartTrace (theBinder,theStart,myLevel,1); + myMessenger << " --> Fail : " << theMessage; + if (theOrig[0] != '\0'&&myTrace>2) myMessenger << " [from: " << theOrig << "]"; + myMessenger << endl; + } + } + + + //======================================================================= + //function : AddError + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddError(const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig) + { + AddFail (theStart,theMessage,theOrig); + } + + //======================================================================= + //function : AddFail + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddFail (const StartObject& theStart, + const Message_Msg& theMsg) + { + if (theMsg.IsEdited()) AddFail (theStart,TCollection_AsciiString(theMsg.Value()).ToCString(), + TCollection_AsciiString(theMsg.Original()).ToCString()); + else AddFail (theStart,TCollection_AsciiString(theMsg.Value()).ToCString()); + } + + //======================================================================= + //function : AddWarning + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddWarning (const StartObject& theStart, + const Standard_CString theMessage, + const Standard_CString theOrig) + { + Handle(Transfer_Binder) aBinder = FindAndMask(theStart); + if (aBinder.IsNull()) { + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); + } + aBinder->AddWarning(theMessage,theOrig); + if (myTrace > 1) { + StartTrace (aBinder,theStart,myLevel,2); + myMessenger << " --> Warning : " << theMessage; + if (theOrig[0] != '\0'&&myTrace>2) myMessenger << " [from: " << theOrig << "]"; + myMessenger << endl; + } + } + + //======================================================================= + //function : AddWarning + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddWarning (const StartObject& theStart, + const Message_Msg& theMsg) + { + if (theMsg.IsEdited()) + AddWarning (theStart,TCollection_AsciiString(theMsg.Value()).ToCString(), + TCollection_AsciiString(theMsg.Original()).ToCString()); + else + AddWarning (theStart,TCollection_AsciiString(theMsg.Value()).ToCString()); + } + + //======================================================================= + //function : Mend + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::Mend (const StartObject& theStart, + const Standard_CString thePref) + { + Handle(Transfer_Binder) aBinder = FindAndMask (theStart); + if (aBinder.IsNull()) + return; + Handle(Interface_Check) ach = aBinder->CCheck(); + ach->Mend (thePref); + } + + //======================================================================= + //function : Check + //purpose : + //======================================================================= + + template + Handle(Interface_Check) + Transfer_TransferProcess + ::Check(const StartObject& theStart) const + { + const Handle(Transfer_Binder)& aBinder = Find(theStart); + if (aBinder.IsNull()) { + Handle(Interface_Check) aCheck; + return aCheck; + } + return aBinder->Check(); + } + + // ## ## ## Actions sur Types Privilegies ## ## ## + // ## ## ## (Transient) ## ## ## + + // Bind associe un objet a un objet resultat; or la Map associe un Objet a un + // Binder (qui designe son resultat) + // *Transient travaillent avec un SimpleBinderOfTransient + // si deja la, on considere son resultat + // sinon, on cree un Binder du bon type + + + //======================================================================= + //function : BindTransient + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::BindTransient (const StartObject& theStart, + const Handle(Standard_Transient)& theResult) + { + if (theResult.IsNull()) return; + Handle(Transfer_Binder) aFormer = Find(theStart); + Handle(Transfer_SimpleBinderOfTransient) aBinder = + Handle(Transfer_SimpleBinderOfTransient)::DownCast(aFormer); + if (!aBinder.IsNull()) + { + if (aBinder->Status() == Transfer_StatusVoid) + { + aBinder->SetResult(theResult); return; + } + } + aBinder = new Transfer_SimpleBinderOfTransient; + aBinder->SetResult (theResult); + if (aFormer.IsNull()) + Bind(theStart,aBinder); + else + Rebind(theStart,aBinder); + } + + //======================================================================= + //function : FindTransient + //purpose : + //======================================================================= + + template + const Handle(Standard_Transient)& + Transfer_TransferProcess + ::FindTransient (const StartObject& theStart) const + { + Handle(Transfer_SimpleBinderOfTransient) aBinder = + Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(theStart)); + if (aBinder.IsNull()) return myNullTrans; + if (!aBinder->HasResult()) return myNullTrans; + return aBinder->Result(); + } + + // Binding Multiple: D by BindMultiple declare the first (if not already done) + // Then add the words by AddMultiple + + //======================================================================= + //function : BindMultiple + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::BindMultiple (const StartObject& theStart) + { + Handle(Transfer_Binder) aBinder = FindAndMask (theStart); + if (!aBinder.IsNull()) + { + if (!aBinder->IsKind(STANDARD_TYPE(Transfer_MultipleBinder))) + { + StartTrace (myLastBinder,theStart,myLevel,4); + Transfer_TransferFailure::Raise ("TransferProcess : BindMultiple"); + } + } + else Bind(theStart,new Transfer_MultipleBinder); + } + + //======================================================================= + //function : AddMultiple + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::AddMultiple (const StartObject& theStart, + const Handle(Standard_Transient)& theResult) + { + Handle(Transfer_Binder) aBinder = FindAndMask(theStart); + Handle(Transfer_MultipleBinder) aMultBinder = + Handle(Transfer_MultipleBinder)::DownCast(aBinder); + if (aMultBinder.IsNull()) + { + StartTrace (aBinder,theStart,myLevel,4); + if (aBinder.IsNull()) Transfer_TransferFailure::Raise + ("TransferProcess : AddMultiple, nothing bound"); + else Transfer_TransferFailure::Raise + ("TransferProcess : AddMultiple, Binder not a MultipleBinder"); + } + aMultBinder->AddResult(theResult); + } + + //======================================================================= + //function : FindTypedTransient + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::FindTypedTransient (const StartObject& theStart, + const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theVal) const + { + return GetTypedTransient (Find(theStart), theType, theVal); + } + + //======================================================================= + //function : GetTypedTransient + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::GetTypedTransient (const Handle(Transfer_Binder)& theBinder, + const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theVal) const + { + return Transfer_SimpleBinderOfTransient::GetTypedResult(theBinder, theType, theVal); + } + + + // ## ## ## ## ## Atomic access ## ## ## ## ## + // (doesn't manage the scope but gives access to categories) + + //======================================================================= + //function : NbMapped + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::NbMapped () const + { + return myMap.Extent(); + } + + //======================================================================= + //function : Mapped + //purpose : + //======================================================================= + + template + const StartObject& + Transfer_TransferProcess + ::Mapped(const Standard_Integer theNum) const + { + return myMap.FindKey(theNum); + } + + //======================================================================= + //function : MapIndex + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::MapIndex(const StartObject& theStart) const + { + return myMap.FindIndex(theStart); + } + + //======================================================================= + //function : MapItem + //purpose : + //======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::MapItem(const Standard_Integer theNum) const + { + Handle(Transfer_Binder) aBinder = myMap.FindFromIndex(theNum); + return aBinder; + } + + + // ######################################################################## + // .... ROOT MANAGEMENT .... + + //======================================================================= + //function : SetRoot + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetRoot (const StartObject& theStart) + { + Standard_Integer anIndex = MapIndex(theStart); + if (anIndex == 0) + { + return; + } + + myRoots.Add(anIndex); + if (myTrace > 2) + StartTrace (MapItem(anIndex),theStart,myLevel,3); + } + + //======================================================================= + //function : SetRootManagement + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetRootManagement (const Standard_Boolean theStatus) + { + myToManageRoot = theStatus; + } + + //======================================================================= + //function : NbRoots + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::NbRoots () const + { + return myRoots.Extent(); + } + + //======================================================================= + //function : Root + //purpose : + //======================================================================= + + template + const StartObject& + Transfer_TransferProcess + ::Root (const Standard_Integer theNum) const + { + Standard_Integer anInd = 0; + if (theNum > 0 && theNum <= myRoots.Extent()) anInd = myRoots.FindKey(theNum); + return myMap.FindKey (anInd); + } + + //======================================================================= + //function : RootItem + //purpose : + //======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::RootItem (const Standard_Integer theNum) const + { + Standard_Integer anInd = 0; + if (theNum > 0 && theNum <= myRoots.Extent()) anInd = myRoots.FindKey(theNum); + return myMap.FindFromIndex(anInd);//->Search(categ);skl + } + + //======================================================================= + //function : RootIndex + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::RootIndex (const StartObject& theStart) const + { + Standard_Integer anIndex = MapIndex (theStart); + if (anIndex == 0) return 0; + return myRoots.FindIndex (anIndex); + } + + //======================================================================= + //function : NestingLevel + //purpose : + //======================================================================= + + template + Standard_Integer + Transfer_TransferProcess + ::NestingLevel () const + { + return myLevel; + } + + //======================================================================= + //function : ResetNestingLevel + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::ResetNestingLevel () + { + myLevel = 0; + } + + // ######################################################################## + // .... SCOPE MANAGEMENT .... + + + //====================================================================== + //Purpose : gka TRJ9 for writing SDR for solid + // Check if aBinder has already been bound to the result aBinder. + //====================================================================== + + // static Standard_Boolean Contains(const Handle(Transfer_Binder)& resbinder, + // const Handle(Transfer_Binder)& addbinder) + // { + // Handle(Transfer_Binder) tmpbind = resbinder; + // for ( ; ! tmpbind.IsNull(); tmpbind = tmpbind->NextResult() ) + // if ( tmpbind == addbinder ) return Standard_True; + // return Standard_False; + // } + + // ######################################################################## + // .... AUTOMATION OF TRANSFER .... + + // ## ## ## ## ## Basic Functions ## ## ## ## ## + + + //======================================================================= + //function : Recognize + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::Recognize(const StartObject& theStart) const + { + ActorHandle anActor = myActor; + // It scans up to have a next result + while (!anActor.IsNull()) + { + if (anActor->Recognize (theStart)) + return Standard_True; + anActor = anActor->Next(); + } + return Standard_False; + } + +//======================================================================= +//function : Transferring +//purpose : +//======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::Transferring (const StartObject& theStart) + { + Handle(Transfer_Binder) aFormer = FindAndMask(theStart); + + // Was the Transfer already done with Result? + if (!aFormer.IsNull()) + { + if (aFormer->HasResult()) + { + aFormer->SetAlreadyUsed(); + return aFormer; + } + + // Initial state: perhaps already done ... or infeasible! + Transfer_StatusExec statex = aFormer->StatusExec(); + switch (statex) + { + case Transfer_StatusInitial : + break; + case Transfer_StatusDone : + + myMessenger << " .. and Transfer done" << endl; + + return aFormer; + case Transfer_StatusRun : + aFormer->SetStatusExec(Transfer_StatusLoop); + return aFormer; + case Transfer_StatusError : + if (myTrace) + { + myMessenger << " *** Transfer in Error Status :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferFailure::Raise + ("TransferProcess : Transfer in Error Status"); + case Transfer_StatusLoop : + if (myTrace) + { + myMessenger << " *** Transfer Head of Dead Loop :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferDeadLoop::Raise + ("TransferProcess : Transfer at Head of a Dead Loop"); + } +#ifdef TRANSLOG + cout << "Transfer,level "<SetStatusExec(Transfer_StatusRun); + } +#ifdef TRANSLOG + cout << " GO .." << endl; +#endif + + Handle(Transfer_Binder) aBinder; + Standard_Boolean isNewBind = Standard_False; + if (myToHandleErr) + { + // Transfer under protection exceptions (for notification actually) + Standard_Integer anOldLevel = myLevel; + try + { + OCC_CATCH_SIGNALS + aBinder = TransferProduct(theStart); + } + catch (Transfer_TransferDeadLoop) + { + if (aBinder.IsNull()) + { + myMessenger << " *** Dead Loop with no Result" << endl; + if (myTrace) StartTrace (aBinder, theStart, myLevel-1,0); + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); isNewBind = Standard_True; + } else if (aBinder->StatusExec() == Transfer_StatusLoop) { + if (myTrace) { + myMessenger << " *** Dead Loop : Finding head of Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + else StartTrace (aBinder, theStart,myLevel-1,4); + Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); + // In other words, exchange of exception (it is out of the loop) + } else { + if (myTrace) { + myMessenger << " *** Dead Loop : Actor in Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + } + aBinder->AddFail("Transfer in dead Loop"); + myLevel = anOldLevel; + } + catch (Standard_Failure) { + if (aBinder.IsNull()) { + myMessenger << " *** Exception Raised with no Result" << endl; + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); isNewBind = Standard_True; + } + aBinder->AddFail("Transfer stopped by exception raising"); + if (myTrace) { + myMessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; + StartTrace (aBinder, theStart, myLevel-1,4); + } + myLevel = anOldLevel; + } + } + + // Transfer is non protected (for example, dbx hand in case of a crash by Raise) + else aBinder = TransferProduct(theStart); + + // Conclusion : Save the Map + + if (!isNewBind && !aBinder.IsNull()) + { + if (aFormer.IsNull()) + { + // Maybe made ​​him even Bind + if (!IsBound(theStart)) + Bind(theStart,aBinder); //result = 0 category + else + { + // gka TRJ9 for writing SDR for solid + Rebind(theStart,aBinder); // test_pattern.sat + } + } + else Rebind(theStart,aBinder); + // (Therefore, is ) +#ifdef TRANSLOG + cout << " ... OK" << endl; +#endif + } + else + { + //= by ABV: 5 Oct 97: nothing generated, but aFormer can be in run state - drop it + //= ASK: may be set it to StatusInitial ? + if ( ! aFormer.IsNull() ) aFormer->SetStatusExec ( Transfer_StatusDone ); //+ + Handle(Transfer_Binder) aNullBinder; + return aNullBinder; // Binder Null ... que faire d autre ? + } + + // Manage Roots (if planned) + if (myRootLevel >= myLevel) { + myRootLevel = 0; + if (myToManageRoot && aBinder->Status() != Transfer_StatusVoid) + { + SetRoot (theStart); + } + } + return myLastBinder; + } + +//======================================================================= +//function : TransferProduct +//purpose : +//======================================================================= + + template + Handle(Transfer_Binder) + Transfer_TransferProcess + ::TransferProduct (const StartObject& theStart) +{ + myLevel ++; + Handle(Transfer_Binder) aBinder; + ActorHandle anActor = myActor; + + while (!anActor.IsNull()) { + if (anActor->Recognize (theStart)) aBinder = anActor->Transferring(theStart,this); + else aBinder.Nullify(); + if (!aBinder.IsNull()) break; + anActor = anActor->Next(); + } + if (aBinder.IsNull()) + { + + if (myLevel > 0) myLevel --; + return aBinder; + } + + if (myRootLevel == 0 && aBinder->StatusExec() == Transfer_StatusDone) + myRootLevel = myLevel - 1; + + if (myLevel > 0) myLevel --; + return aBinder; +} + + +//======================================================================= +//function : Transfer +//purpose : +//======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::Transfer(const StartObject& theStart) +{ + Handle(Transfer_Binder) aBinder = Transferring (theStart); + return (!aBinder.IsNull()); +} + + // ######################################################################### + // .... Error Handling + Trace .... + + //======================================================================= + //function : SetErrorHandle + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetErrorHandle (const Standard_Boolean isError) + { + myToHandleErr = isError; + } + + //======================================================================= + //function : ErrorHandle + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::ErrorHandle() const + { + return myToHandleErr; + } + + //======================================================================= + //function : StartTrace + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::StartTrace (const Handle(Transfer_Binder)& theBinder, + const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Integer theMode) const + { + // ### Fail (Roots:50) //! Start theStart->DynamicType() + // ### Fail (Roots:50) //! Start id:#label.. Type:theStart->DynamicType() + if (myTrace > 3) { // Internal to be switch when searching bug (trace >= 4) + if (theMode == 1) myMessenger << " ### Fail"; + if (theMode == 2) myMessenger << " ### Warning"; + if (theMode == 3) myMessenger << " ### New Root n0 " << myRoots.Extent(); + if (theMode == 4) myMessenger << " ### Exception"; + if (theMode == 5) myMessenger << " ### Substitution"; + if (theMode == 6) myMessenger << " ### Information"; + if (theLevel > 1) + myMessenger << " (nested)"; // " at nesting Level:"<= 0 && theMode != 3) + myMessenger << " at " << myRoots.Extent() << " Roots"; + } + if (!theStart.IsNull()) PrintTrace (theStart,myMessenger); + + if (!theBinder.IsNull()) { // old: if IsNull sout <Status() != Transfer_StatusVoid) { + // --- Result Type: theBinder->ResultType() --- Binder : theBinder->DynamicType(); + if (!hasres) + myMessenger << "\n --- Result Type : "; + else + myMessenger << " , "; + myMessenger << bnd->ResultTypeName(); + // CKY 9-JAN-1999: waiting for XSTEP Kernel message (not IGES_2075) + /* Message_Msg Msg2075("IGES_2075"); + Msg2075.AddString(bnd->ResultTypeName()); + Msg2075.TraceEver(); */ + hasres = Standard_True; + if (bnd->Status() == Transfer_StatusUsed) isused = Standard_True; + } + bnd = bnd->NextResult(); + } + if (!hasres && theMode > 2) { + myMessenger << "\n --- No Result recorded"; + // CKY 9-JAN-1999 : waiting for XSTEP Kernel message + // (not IGES_2075, no reference to specifically TopoDS_Shape) + /* Message_Msg Msg2075("IGES_2075"); + Msg2075.AddString("No TopoDS_Shape"); + Msg2075.TraceEver(); */ + } + //old if (isused) sout << " //! (Already Used in another Transfer)"; + } + myMessenger << endl; + } + + + //======================================================================= + //function : PrintTrace + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::PrintTrace (const StartObject& theStart, + const Handle(Message_Messenger)& myMessenger) const + { + if (!theStart.IsNull()) + myMessenger <<" Type:" << theStart->DynamicType()->Name(); + } + + //======================================================================= + //function : IsLooping + //purpose : + //======================================================================= + + template + Standard_Boolean + Transfer_TransferProcess + ::IsLooping (const Standard_Integer theLevel) const + { + return theLevel > NbMapped(); + } + + // ######################################################################### + // .... RESULTS .... + + //======================================================================= + //function : RootResult + //purpose : + //======================================================================= + + template + Iterator + Transfer_TransferProcess + ::RootResult (const Standard_Boolean isWithStart) const + { + Iterator iter(isWithStart); + Standard_Integer aMax = myRoots.Extent(); + for (Standard_Integer aJ = 1; aJ <= aMax; aJ ++) + { + Standard_Integer anI = myRoots.FindKey(aJ); + Handle(Transfer_Binder) aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + if (isWithStart) iter.Add (aBinder,Mapped(anI)); + else iter.Add (aBinder); + } + return iter; + } + + //======================================================================= + //function : CompleteResult + //purpose : All Results + //======================================================================= + + template + Iterator + Transfer_TransferProcess + ::CompleteResult (const Standard_Boolean isWithStart) const + { + Iterator iter(isWithStart); + Standard_Integer aMax = NbMapped(); + for (Standard_Integer anI = 1; anI <= aMax; anI ++) { + Handle(Transfer_Binder) aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + if (isWithStart) iter.Add (aBinder,Mapped(anI)); + else iter.Add (aBinder); + } + return iter; + } + + //======================================================================= + //function : AbnormalResult + //purpose : Transfers a problem + //======================================================================= + + template + Iterator + Transfer_TransferProcess + ::AbnormalResult() const + { + Iterator anIter(Standard_True); + Standard_Integer aMax = NbMapped(); + for (Standard_Integer anI = 1; anI <= aMax; anI ++) { + Handle(Transfer_Binder) aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + Transfer_StatusExec aStatExec = aBinder->StatusExec(); + if (aStatExec != Transfer_StatusInitial && aStatExec != Transfer_StatusDone) + anIter.Add (aBinder,Mapped(anI)); // on note les cas "pas normaux" + } + return anIter; + } + + //======================================================================= + //function : CheckList + //purpose : + //======================================================================= + + template + Interface_CheckIterator + Transfer_TransferProcess + ::CheckList (const Standard_Boolean isErrOnly) const + { + Interface_CheckIterator list; + Standard_Integer theNum, aMax = NbMapped(); + for (Standard_Integer anI = 1; anI <= aMax; anI ++) { + Handle(Transfer_Binder) aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + Transfer_StatusExec aStatExec = aBinder->StatusExec(); + Handle(Interface_Check) aCheck = aBinder->Check(); + if (aStatExec != Transfer_StatusInitial && aStatExec != Transfer_StatusDone && + !aCheck->HasFailed()) + aCheck->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); + if (!aCheck->HasFailed() && (isErrOnly || aCheck->NbWarnings() == 0)) continue; + const StartObject& ent = Mapped(anI); + theNum = CheckNum(ent); + if (theNum == 0) theNum = anI; + aCheck->SetEntity(ent); + list.Add(aCheck,theNum); + } + return list; + } + + // ######################################################################### + // .... RESULTS BY ENTITY .... + + //======================================================================= + //function : ResultOne + //purpose : + //======================================================================= + + template + Iterator + Transfer_TransferProcess + ::ResultOne (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean isWithStart) const + { + Iterator anIter(isWithStart); + Standard_Integer aMax = NbMapped(); + Standard_Integer anInd = MapIndex (theStart); + if (anInd == 0) return anIter; + Standard_Integer i1 = (theLevel == 0 ? anInd : 1); + Standard_Integer i2 = (theLevel == 0 ? anInd : aMax); + Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); + for (Standard_Integer anI = i1; anI <= i2; anI ++) { + anInd = map->Value(anI); + if (anInd == 0) continue; + Handle(Transfer_Binder) aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + if (isWithStart) anIter.Add (aBinder,Mapped(anInd)); + else anIter.Add (aBinder); + } + return anIter; + } + + //======================================================================= + //function : CheckListOne + //purpose : + //======================================================================= + + template + Interface_CheckIterator + Transfer_TransferProcess + ::CheckListOne (const StartObject& theStart,const Standard_Integer theLevel, + const Standard_Boolean isErrOnly) const + { + Interface_CheckIterator aList; + Standard_Integer aMax = NbMapped(); + Standard_Integer aNum, anInd = MapIndex (theStart); + if (anInd == 0) return aList; + Standard_Integer i1 = (theLevel == 0 ? anInd : 1); + Standard_Integer i2 = (theLevel == 0 ? anInd : aMax); + Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); + + for (Standard_Integer anI = i1; anI <= i2; anI ++) { + anInd = map->Value(anI); + if (anInd == 0) continue; + Handle(Transfer_Binder) aBinder = MapItem(anInd); + if (aBinder.IsNull()) continue; + Transfer_StatusExec aStatExec = aBinder->StatusExec(); + Handle(Interface_Check) aCheck = aBinder->Check(); + if (aStatExec != Transfer_StatusInitial && aStatExec != Transfer_StatusDone && + !aCheck->HasFailed()) + aCheck->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); + if (!aCheck->HasFailed() && (isErrOnly || aCheck->NbWarnings() == 0)) continue; + const StartObject& anEnt = Mapped(anInd); + aNum = CheckNum(anEnt); if (aNum == 0) aNum = anInd; + aCheck->SetEntity(anEnt); + aList.Add(aCheck,aNum); + } + return aList; + } + + //======================================================================= + //function : IsCheckListEmpty + //purpose : + //======================================================================= + template + Standard_Boolean + Transfer_TransferProcess + ::IsCheckListEmpty (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean isErrOnly) const + { + Standard_Integer aMax = NbMapped(); + Standard_Integer anInd = MapIndex (theStart); + if (anInd == 0) return Standard_False; + Standard_Integer i1 = (theLevel == 0 ? anInd : 1); + Standard_Integer i2 = (theLevel == 0 ? anInd : aMax); + Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); + + for (Standard_Integer anI = i1; anI <= i2; anI ++) { + anInd = map->Value(anI); + if (anInd == 0) continue; + Handle(Transfer_Binder) aBinder = MapItem(anInd); + if (aBinder.IsNull()) continue; + + Transfer_StatusExec aStatExec = aBinder->StatusExec(); + Handle(Interface_Check) aCheck = aBinder->Check(); + if (aStatExec != Transfer_StatusInitial && aStatExec != Transfer_StatusDone) + return Standard_False; + if (aCheck->HasFailed() || (!isErrOnly && aCheck->NbWarnings() > 0)) return Standard_False; + } + return Standard_True; + } + + //======================================================================= + //function : RemoveResult + //purpose : + //======================================================================= + + template + void + Transfer_TransferProcess + ::RemoveResult (const StartObject& theStart, + const Standard_Integer theLevel, + const Standard_Boolean toCompute) + { + Standard_Integer aMax = NbMapped(); + Standard_Integer anInd = MapIndex (theStart); + if (anInd == 0) return; + Standard_Integer i1 = (theLevel == 0 ? anInd : 1); + Standard_Integer i2 = (theLevel == 0 ? anInd : aMax); + Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); + + Standard_Integer anI; // svv Jan11 2000 : porting on DEC + for (anI = i1; anI <= i2; anI ++) { + anInd = map->Value(anI); + if (anInd == 0) continue; + Handle(Transfer_Binder) aBinder = MapItem(anInd); + if (aBinder.IsNull()) continue; + } + } + + template + Standard_Integer + Transfer_TransferProcess + ::CheckNum (const StartObject& ) const + { + return 0; + } + + //======================================================================= + //function : SetProgress + //purpose : Sets Progress indicator + //======================================================================= + + template + void + Transfer_TransferProcess + ::SetProgress (const Handle(Message_ProgressIndicator)& theProgress) + { + myProgress = theProgress; + } + + //======================================================================= + //function : GetProgress + //purpose : Returns Progress indicator + //======================================================================= + + template + Handle(Message_ProgressIndicator) + Transfer_TransferProcess + ::GetProgress() const + { + return myProgress; + } + +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_TransientMapper.cxx b/src/Transfer/Transfer_TransientMapper.cxx new file mode 100644 index 0000000000..1ed39ef8a7 --- /dev/null +++ b/src/Transfer/Transfer_TransientMapper.cxx @@ -0,0 +1,37 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(Transfer_TransientMapper) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_Finder), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_TransientMapper) + + +IMPLEMENT_DOWNCAST(Transfer_TransientMapper,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_TransientMapper) \ No newline at end of file diff --git a/src/Transfer/Transfer_TransientMapper.hxx b/src/Transfer/Transfer_TransientMapper.hxx new file mode 100644 index 0000000000..3be0d16877 --- /dev/null +++ b/src/Transfer/Transfer_TransientMapper.hxx @@ -0,0 +1,60 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_TransientMapper_HeaderFile +#define _Transfer_TransientMapper_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class TColStd_MapTransientHasher; +class Transfer_DataInfo; +class Transfer_Finder; +class Standard_Type; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_Finder); +class Transfer_TransientMapper; + +DEFINE_STANDARD_HANDLE(Transfer_TransientMapper,Transfer_Finder) + +class Transfer_TransientMapper : public Transfer_Mapper + { + public: + Standard_EXPORT Transfer_TransientMapper(const Handle(Standard_Transient) theKey) + : Transfer_Mapper(theKey) + { } + DEFINE_STANDARD_RTTI(Transfer_TransientMapper) + + }; + +#endif \ No newline at end of file diff --git a/src/Transfer/Transfer_TransientProcess.cdl b/src/Transfer/Transfer_TransientProcess.cdl deleted file mode 100644 index e176f01822..0000000000 --- a/src/Transfer/Transfer_TransientProcess.cdl +++ /dev/null @@ -1,102 +0,0 @@ --- Created on: 1996-09-04 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class TransientProcess from Transfer inherits ProcessForTransient - - ---Purpose : Adds specific features to the generic definition : - -- TransientProcess is intended to work from an InterfaceModel - -- to a set of application objects. - -- - -- Hence, some informations about starting entities can be gotten - -- from the model : for Trace, CheckList, Integrity Status - -uses Transient, Type, - DictionaryOfTransient, - InterfaceModel, HGraph, Graph, EntityIterator, - HSequenceOfTransient from TColStd, - Messenger from Message - -is - - Create (nb : Integer = 10000) returns mutable TransientProcess; - ---Purpose : Sets TransientProcess at initial state, with an initial size - - SetModel (me : mutable; model : InterfaceModel); - ---Purpose : Sets an InterfaceModel, used by StartTrace, CheckList, queries - -- on Integrity, to give informations significant for each norm. - - Model (me) returns InterfaceModel; - ---Purpose : Returns the Model used for StartTrace - - SetGraph (me : mutable; HG : HGraph); - ---Purpose : Sets a Graph : superseedes SetModel if already done - - HasGraph (me) returns Boolean; - HGraph (me) returns HGraph; - Graph (me) returns Graph; - ---C++ : return const & - - SetContext (me : mutable; name : CString; ctx : Transient); - ---Purpose : Sets a Context : according to receiving appli, to be - -- interpreted by the Actor - - GetContext (me; name : CString; type : Type; ctx : out Transient) - returns Boolean; - ---Purpose : Returns the Context attached to a name, if set and if it is - -- Kind of the type, else a Null Handle - -- Returns True if OK, False if no Context - - Context (me : mutable) returns DictionaryOfTransient; - ---Purpose : Returns (modifiable) the whole definition of Context - -- Rather for internal use (ex.: preparing and setting in once) - ---C++ : return & - - PrintTrace (me; start : Transient; S : Messenger from Message) is redefined; - ---Purpose : Specific printing to trace an entity : prints label and type - -- (if model is set) - - CheckNum (me; ent : Transient) returns Integer is redefined; - ---Purpose : Specific number of a starting object for check-list : Number - -- in model - - TypedSharings (me; start : Transient; type : Type) returns EntityIterator; - ---Purpose : Returns the list of sharings entities, AT ANY LEVEL, which are - -- kind of a given type. Calls TypedSharings from Graph - -- Returns an empty list if the Graph has not been aknowledged - - IsDataLoaded (me; ent : Transient) returns Boolean; - ---Purpose : Tells if an entity is well loaded from file (even if its data - -- fail on checking, they are present). Mostly often, answers - -- True. Else, there was a syntactic error in the file. - -- A non-loaded entity MAY NOT BE transferred, unless its Report - -- (in the model) is interpreted - - IsDataFail (me; ent : Transient) returns Boolean; - ---Purpose : Tells if an entity fails on data checking (load time, - -- syntactic, or semantic check). Normally, should answer False. - -- It is not prudent to try transferring an entity which fails on - -- data checking - - PrintStats (me; mode : Integer; S : Messenger from Message); - ---Purpose : Prints statistics on a given output, according mode - RootsForTransfer(me : mutable) returns HSequenceOfTransient from TColStd; -fields - - themodel : InterfaceModel; - thegraph : HGraph; - thectx : DictionaryOfTransient; - thetrroots : HSequenceOfTransient from TColStd; -end TransientProcess; diff --git a/src/Transfer/Transfer_TransientProcess.cxx b/src/Transfer/Transfer_TransientProcess.cxx index 8dfb89249e..480507a0b6 100644 --- a/src/Transfer/Transfer_TransientProcess.cxx +++ b/src/Transfer/Transfer_TransientProcess.cxx @@ -11,11 +11,32 @@ // 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 +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(Transfer_TransientProcess) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(Transfer_TransientProcess) + + +IMPLEMENT_DOWNCAST(Transfer_TransientProcess,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(Transfer_TransientProcess) //======================================================================= @@ -24,21 +45,26 @@ //======================================================================= Transfer_TransientProcess::Transfer_TransientProcess - (const Standard_Integer nb) : Transfer_ProcessForTransient (nb) + (const Standard_Integer theNb) + : Transfer_TransferProcess < Handle(Transfer_ActorOfTransientProcess), + Transfer_TransferMapOfProcessForTransient, + Handle(Standard_Transient), + TColStd_MapTransientHasher, + Handle(TColStd_HSequenceOfTransient), + Transfer_IteratorOfProcessForTransient > (theNb) { - thetrroots = new TColStd_HSequenceOfTransient; + theTrRoots = new TColStd_HSequenceOfTransient; } - //======================================================================= //function : SetModel //purpose : //======================================================================= void Transfer_TransientProcess::SetModel - (const Handle(Interface_InterfaceModel)& model) + (const Handle(Interface_InterfaceModel)& theModel) { - themodel = model; + myModel = theModel; } @@ -49,17 +75,17 @@ void Transfer_TransientProcess::SetModel Handle(Interface_InterfaceModel) Transfer_TransientProcess::Model () const { - return themodel; + return myModel; } -void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG) +void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& theHGraph) { - thegraph = HG; - if (!thegraph.IsNull()) - SetModel(thegraph->Graph().Model()); + myGraph = theHGraph; + if (!myGraph.IsNull()) + SetModel(myGraph->Graph().Model()); else - themodel.Nullify(); + myModel.Nullify(); } @@ -70,7 +96,7 @@ void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG) Standard_Boolean Transfer_TransientProcess::HasGraph () const { - return !thegraph.IsNull(); + return !myGraph.IsNull(); } @@ -81,7 +107,7 @@ Standard_Boolean Transfer_TransientProcess::HasGraph () const Handle(Interface_HGraph) Transfer_TransientProcess::HGraph () const { - return thegraph; + return myGraph; } @@ -92,7 +118,7 @@ Handle(Interface_HGraph) Transfer_TransientProcess::HGraph () const const Interface_Graph& Transfer_TransientProcess::Graph () const { - return thegraph->Graph(); + return myGraph->Graph(); } @@ -101,11 +127,11 @@ const Interface_Graph& Transfer_TransientProcess::Graph () const //purpose : //======================================================================= -void Transfer_TransientProcess::SetContext(const Standard_CString name, - const Handle(Standard_Transient)& ctx) +void Transfer_TransientProcess::SetContext(const Standard_CString theName, + const Handle(Standard_Transient)& theCtx) { - if (thectx.IsNull()) thectx = new Dico_DictionaryOfTransient; - thectx->SetItem (name,ctx); + if (myCtx.IsNull()) myCtx = new Dico_DictionaryOfTransient; + myCtx->SetItem (theName,theCtx); } @@ -115,15 +141,15 @@ void Transfer_TransientProcess::SetContext(const Standard_CString name, //======================================================================= Standard_Boolean Transfer_TransientProcess::GetContext - (const Standard_CString name, const Handle(Standard_Type)& type, - Handle(Standard_Transient)& ctx) const + (const Standard_CString theName, const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theCtx) const { - if (thectx.IsNull()) return Standard_False; - if (!thectx->GetItem (name,ctx)) ctx.Nullify(); - if (ctx.IsNull()) return Standard_False; - if (type.IsNull()) return Standard_True; - if (!ctx->IsKind(type)) ctx.Nullify(); - return !ctx.IsNull(); + if (myCtx.IsNull()) return Standard_False; + if (!myCtx->GetItem (theName,theCtx)) theCtx.Nullify(); + if (theCtx.IsNull()) return Standard_False; + if (theType.IsNull()) return Standard_True; + if (!theCtx->IsKind(theType)) theCtx.Nullify(); + return !theCtx.IsNull(); } @@ -134,7 +160,7 @@ Standard_Boolean Transfer_TransientProcess::GetContext Handle(Dico_DictionaryOfTransient)& Transfer_TransientProcess::Context () { - return thectx; + return myCtx; } @@ -144,17 +170,17 @@ Handle(Dico_DictionaryOfTransient)& Transfer_TransientProcess::Context () //======================================================================= void Transfer_TransientProcess::PrintTrace - (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const + (const Handle(Standard_Transient)& theStart, const Handle(Message_Messenger)& theMessenger) const { - if (!start.IsNull()) { - S << "Entity "; - if (!themodel.IsNull()) { - themodel->Print (start,S,1); -// S<<"id "; themodel->Print (start,S); -// S<<" Type:"<TypeName (start); + if (!theStart.IsNull()) { + theMessenger << "Entity "; + if (!myModel.IsNull()) { + myModel->Print (theStart,theMessenger,1); +// theMessenger<<"id "; myModel->Print (theStart,theMessenger); +// theMessenger<<" Type:"<TypeName (theStart); } - else S<<" Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name()); - // << start (handle) ?? + else theMessenger<<" Type:"<< Interface_InterfaceModel::ClassName(theStart->DynamicType()->Name()); + // << theStart (handle) ?? } } @@ -165,9 +191,9 @@ void Transfer_TransientProcess::PrintTrace //======================================================================= Standard_Integer Transfer_TransientProcess::CheckNum - (const Handle(Standard_Transient)& start) const + (const Handle(Standard_Transient)& theStart) const { - return (themodel.IsNull() ? 0 : themodel->Number(start)); + return (myModel.IsNull() ? 0 : myModel->Number(theStart)); } @@ -177,12 +203,12 @@ Standard_Integer Transfer_TransientProcess::CheckNum //======================================================================= Interface_EntityIterator Transfer_TransientProcess::TypedSharings - (const Handle(Standard_Transient)& start, - const Handle(Standard_Type)& type) const + (const Handle(Standard_Transient)& theStart, + const Handle(Standard_Type)& theType) const { Interface_EntityIterator iter; - if (thegraph.IsNull()) return iter; - return thegraph->Graph().TypedSharings (start,type); + if (myGraph.IsNull()) return iter; + return myGraph->Graph().TypedSharings (theStart,theType); } @@ -192,13 +218,13 @@ Interface_EntityIterator Transfer_TransientProcess::TypedSharings //======================================================================= Standard_Boolean Transfer_TransientProcess::IsDataLoaded - (const Handle(Standard_Transient)& start) const + (const Handle(Standard_Transient)& theStart) const { - if (themodel.IsNull()) return Standard_True; - Standard_Integer num = themodel->Number(start); - if (num == 0) return Standard_True; - if (themodel->IsUnknownEntity(num)) return Standard_False; - return !themodel->IsRedefinedContent(num); + if (myModel.IsNull()) return Standard_True; + Standard_Integer aNum = myModel->Number(theStart); + if (aNum == 0) return Standard_True; + if (myModel->IsUnknownEntity(aNum)) return Standard_False; + return !myModel->IsRedefinedContent(aNum); } @@ -208,14 +234,14 @@ Standard_Boolean Transfer_TransientProcess::IsDataLoaded //======================================================================= Standard_Boolean Transfer_TransientProcess::IsDataFail - (const Handle(Standard_Transient)& start) const + (const Handle(Standard_Transient)& theStart) const { - if (themodel.IsNull()) return Standard_False; - Standard_Integer num = themodel->Number(start); - if (num == 0) return Standard_False; - if (themodel->IsErrorEntity(num)) return Standard_True; - const Handle(Interface_Check) ach = themodel->Check(num,Standard_False); // semantic - return ach->HasFailed(); + if (myModel.IsNull()) return Standard_False; + Standard_Integer aNum = myModel->Number(theStart); + if (aNum == 0) return Standard_False; + if (myModel->IsErrorEntity(aNum)) return Standard_True; + const Handle(Interface_Check) aCheck = myModel->Check(aNum,Standard_False); // semantic + return aCheck->HasFailed(); } @@ -225,42 +251,42 @@ Standard_Boolean Transfer_TransientProcess::IsDataFail //======================================================================= void Transfer_TransientProcess::PrintStats(const Standard_Integer /*mode*/, - const Handle(Message_Messenger)& S) const + const Handle(Message_Messenger)& theMessenger) const { - S<<"\n*******************************************************************\n"; + theMessenger<<"\n*******************************************************************\n"; // if (mode == 1) { // Statistiques de base - S << "******** Basic Statistics ********"<NbEntities()<NbEntities()<Check(); - Transfer_StatusExec stat = binder->StatusExec(); - if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) - nbe ++; + for (anI = 1; anI <= aMax; anI ++) { + const Handle(Transfer_Binder)& aBinder = MapItem(anI); + if (aBinder.IsNull()) continue; + const Handle(Interface_Check) aCheck = aBinder->Check(); + Transfer_StatusExec aStatus = aBinder->StatusExec(); + if (aStatus != Transfer_StatusInitial && aStatus != Transfer_StatusDone) + aNbe ++; else { - if (ach->NbWarnings() > 0) nbw ++; - if (binder->HasResult()) nbr ++; + if (aCheck->NbWarnings() > 0) aNbw ++; + if (aBinder->HasResult()) aNbr ++; } } - if (nbr > nbroots) - S<<"**** ( Itermediate Results : "< 0) - S<<"**** Errors on : "< 0) - S<<"**** Warnings on : "< aNbRoots) + theMessenger<<"**** ( Itermediate Results : "< 0) + theMessenger<<"**** Errors on : "< 0) + theMessenger<<"**** Warnings on : "<Recognize (theStart)) aBinder = anActor->Transferring(theStart,this); + else aBinder.Nullify(); + if (!aBinder.IsNull()) break; + anActor = anActor->Next(); + } + if (aBinder.IsNull()) { + if (myLevel > 0) myLevel --; + return aBinder; + } + // Managing the root level (.. a close look ..) + if (myRootLevel == 0 && aBinder->StatusExec() == Transfer_StatusDone) + myRootLevel = myLevel - 1; + + if (myLevel > 0) myLevel --; + return aBinder; + } + + //======================================================================= + //function : Transferring + //purpose : + //======================================================================= + + Handle(Transfer_Binder) Transfer_TransientProcess::Transferring (const Handle(Standard_Transient)& theStart) + { + Handle(Transfer_Binder) aFormer = FindAndMask(theStart); + + // Use more: note "AlreadyUsed" so result can not be changed + if (!aFormer.IsNull()) { + if (aFormer->HasResult()) { + aFormer->SetAlreadyUsed(); + return aFormer; + } + + // Initial state: perhaps already done ... or infeasible + Transfer_StatusExec statex = aFormer->StatusExec(); + switch (statex) { + case Transfer_StatusInitial : // Transfer is prepared to do + break; + case Transfer_StatusDone : // Transfer was already done + myMessenger << " .. and Transfer done" << endl; + return aFormer; + case Transfer_StatusRun : + aFormer->SetStatusExec(Transfer_StatusLoop); + return aFormer; + case Transfer_StatusError : + if (myTrace) { + myMessenger << " *** Transfer in Error Status :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferFailure::Raise + ("TransferProcess : Transfer in Error Status"); + case Transfer_StatusLoop : // The loop is closed ... + if (myTrace) { + myMessenger << " *** Transfer Head of Dead Loop :" << endl; + StartTrace (aFormer, theStart, myLevel,0); + } + else StartTrace (aFormer, theStart,myLevel,4); + Transfer_TransferDeadLoop::Raise + ("TransferProcess : Transfer at Head of a Dead Loop"); + } +#ifdef TRANSLOG + cout << "Transfer,level "<SetStatusExec(Transfer_StatusRun); + } +#ifdef TRANSLOG + cout << " GO .." << endl; +#endif + + Handle(Transfer_Binder) aBinder; + Standard_Boolean isNewBind = Standard_False; + if (myToHandleErr) { + // Transfer under protection exceptions (for notification actually) + Standard_Integer anOldLevel = myLevel; + try { + OCC_CATCH_SIGNALS + aBinder = TransferProduct(theStart); + } + catch (Transfer_TransferDeadLoop) { + if (aBinder.IsNull()) { + myMessenger << " *** Dead Loop with no Result" << endl; + if (myTrace) StartTrace (aBinder, theStart, myLevel-1,0); + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); isNewBind = Standard_True; + } else if (aBinder->StatusExec() == Transfer_StatusLoop) { + if (myTrace) { + myMessenger << " *** Dead Loop : Finding head of Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + else StartTrace (aBinder, theStart,myLevel-1,4); + Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); + } else { + if (myTrace) { + myMessenger << " *** Dead Loop : Actor in Loop :" << endl; + StartTrace (aBinder, theStart, myLevel-1,0); + } + } + aBinder->AddFail("Transfer in dead Loop"); + myLevel = anOldLevel; + } + catch (Standard_Failure) { + if (aBinder.IsNull()) { + myMessenger << " *** Exception Raised with no Result" << endl; + aBinder = new Transfer_VoidBinder; + Bind (theStart,aBinder); isNewBind = Standard_True; + } + aBinder->AddFail("Transfer stopped by exception raising"); + if (myTrace) { + myMessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; + StartTrace (aBinder, theStart, myLevel-1,4); + } + myLevel = anOldLevel; + } + } + + else aBinder = TransferProduct(theStart); + + // Conclusion : Noter dans la Map + + if (!isNewBind && !aBinder.IsNull()) { + if (aFormer.IsNull()) { + if (!IsBound(theStart)) Bind(theStart,aBinder); // result = 0 category + else { // gka TRJ9 for writing SDR for solid + Rebind(theStart,aBinder); // test_pattern.sat + } + } + else Rebind(theStart,aBinder); +#ifdef TRANSLOG + cout << " ... OK" << endl; +#endif + } + else + { + //= by ABV: 5 Oct 97: nothing generated, but aFormer can be in run state - drop it + //= ASK: may be set it to StatusInitial ? + if ( ! aFormer.IsNull() ) aFormer->SetStatusExec ( Transfer_StatusDone ); + Handle(Transfer_Binder) aNullBinder; + return aNullBinder; + } + + // Manage Roots (if planned) + if (myRootLevel >= myLevel) { + myRootLevel = 0; + if (myToManageRoot && aBinder->Status() != Transfer_StatusVoid) { + SetRoot (theStart); + } + } + return myLastBinder; + } + + Standard_Boolean Transfer_TransientProcess::Transfer(const Handle(Standard_Transient)& theStart) + { + Handle(Transfer_Binder) aBinder = Transferring(theStart); + return (!aBinder.IsNull()); + } + diff --git a/src/Transfer/Transfer_TransientProcess.hxx b/src/Transfer/Transfer_TransientProcess.hxx new file mode 100644 index 0000000000..9fe1974404 --- /dev/null +++ b/src/Transfer/Transfer_TransientProcess.hxx @@ -0,0 +1,146 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Transfer_TransientProcess_HeaderFile +#define _Transfer_TransientProcess_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_InterfaceModel; +class Interface_HGraph; +class Dico_DictionaryOfTransient; +class TColStd_HSequenceOfTransient; +class Interface_Graph; +class Standard_Transient; +class Standard_Type; +class Message_Messenger; +class Interface_EntityIterator; +class Handle(Standard_Type); +class Handle(MMgt_TShared); + + +//! Adds specific features to the generic definition :
+//! TransientProcess is intended to work from an InterfaceModel
+//! to a set of application objects.
+//!
+//! Hence, some informations about starting entities can be gotten
+//! from the model : for Trace, CheckList, Integrity Status
+class Transfer_TransientProcess +: public Transfer_TransferProcess < Handle(Transfer_ActorOfTransientProcess), + Transfer_TransferMapOfProcessForTransient, + Handle(Standard_Transient), + TColStd_MapTransientHasher, + Handle(TColStd_HSequenceOfTransient), + Transfer_IteratorOfProcessForTransient > +{ + +public: + + //! Sets TransientProcess at initial state, with an initial size
+ Standard_EXPORT Transfer_TransientProcess (const Standard_Integer theNb = 10000); + //! Sets an InterfaceModel, used by StartTrace, CheckList, queries
+ //! on Integrity, to give informations significant for each norm.
+ Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& theModel) ; + //! Returns the Model used for StartTrace
+ Standard_EXPORT Handle_Interface_InterfaceModel Model () const; + //! Sets a Graph : superseedes SetModel if already done
+ Standard_EXPORT void SetGraph(const Handle(Interface_HGraph)& theHG) ; + + Standard_EXPORT Standard_Boolean HasGraph () const; + + Standard_EXPORT Handle_Interface_HGraph HGraph () const; + + Standard_EXPORT const Interface_Graph& Graph () const; + //! Sets a Context : according to receiving appli, to be
+ //! interpreted by the Actor
+ Standard_EXPORT void SetContext (const Standard_CString theName, + const Handle(Standard_Transient)& theCtx) ; + //! Returns the Context attached to a name, if set and if it is
+ //! Kind of the type, else a Null Handle
+ //! Returns True if OK, False if no Context
+ Standard_EXPORT Standard_Boolean GetContext (const Standard_CString theName, + const Handle(Standard_Type)& theType, + Handle(Standard_Transient)& theCtx) const; + //! Returns (modifiable) the whole definition of Context
+ //! Rather for internal use (ex.: preparing and setting in once)
+ Standard_EXPORT Handle_Dico_DictionaryOfTransient& Context () ; + //! Specific printing to trace an entity : prints label and type
+ //! (if model is set)
+ Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& theStart, + const Handle(Message_Messenger)& theMessenger) const; + //! Specific number of a starting object for check-list : Number
+ //! in model
+ Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& theEnt) const; + //! Returns the list of sharings entities, AT ANY LEVEL, which are
+ //! kind of a given type. Calls TypedSharings from Graph
+ //! Returns an empty list if the Graph has not been aknowledged
+ Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& theStart, + const Handle(Standard_Type)& theType) const; + //! Tells if an entity is well loaded from file (even if its data
+ //! fail on checking, they are present). Mostly often, answers
+ //! True. Else, there was a syntactic error in the file.
+ //! A non-loaded entity MAY NOT BE transferred, unless its Report
+ //! (in the model) is interpreted
+ Standard_EXPORT Standard_Boolean IsDataLoaded (const Handle(Standard_Transient)& theEnt) const; + //! Tells if an entity fails on data checking (load time,
+ //! syntactic, or semantic check). Normally, should answer False.
+ //! It is not prudent to try transferring an entity which fails on
+ //! data checking
+ Standard_EXPORT Standard_Boolean IsDataFail (const Handle(Standard_Transient)& theEnt) const; + //! Prints statistics on a given output, according mode
+ Standard_EXPORT void PrintStats (const Standard_Integer theMode, + const Handle(Message_Messenger)& theMessenger) const; + + Standard_EXPORT Handle_TColStd_HSequenceOfTransient RootsForTransfer() ; + + Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Standard_Transient)& theStart); + + Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& theStart); + + Standard_EXPORT Standard_Boolean Transfer(const Handle(Standard_Transient)& theStart); + + DEFINE_STANDARD_RTTI(Transfer_TransientProcess) + +private: + Handle_Interface_InterfaceModel myModel; + Handle_Interface_HGraph myGraph; + Handle_Dico_DictionaryOfTransient myCtx; + Handle_TColStd_HSequenceOfTransient theTrRoots; +}; + +#endif diff --git a/src/Transfer/Transfer_TransientProcess_Handle.hxx b/src/Transfer/Transfer_TransientProcess_Handle.hxx new file mode 100644 index 0000000000..bb03f97dab --- /dev/null +++ b/src/Transfer/Transfer_TransientProcess_Handle.hxx @@ -0,0 +1,33 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +// Workaround: Handles for none-cdl classes. +// Delete this file after transformation all classes to none-cdl ones. + +#ifndef _Transfer_TransientProcess_Handle_HeaderFile +#define _Transfer_TransientProcess_Handle_HeaderFile + +#include +#include +#include + +DEFINE_STANDARD_HANDLE(Transfer_TransientProcess,MMgt_TShared) + +typedef Handle(Transfer_TransientProcess) Transfer_TransientProcess_Handle; + +#endif diff --git a/src/TransferBRep/FILES b/src/TransferBRep/FILES new file mode 100644 index 0000000000..52bd5eab8b --- /dev/null +++ b/src/TransferBRep/FILES @@ -0,0 +1,9 @@ +TransferBRep_Reader.hxx +TransferBRep_Reader.cxx +TransferBRep_ShapeMapper.hxx +TransferBRep_ShapeMapper.cxx +TransferBRep_ShapeMapper_Handle.hxx +TransferBRep_BinderOfShape.hxx +TransferBRep_BinderOfShape.cxx +TransferBRep_ShapeBinder.hxx +TransferBRep_ShapeBinder.cxx \ No newline at end of file diff --git a/src/TransferBRep/TransferBRep.cdl b/src/TransferBRep/TransferBRep.cdl index 472ed2f96d..6ae08624f8 100644 --- a/src/TransferBRep/TransferBRep.cdl +++ b/src/TransferBRep/TransferBRep.cdl @@ -24,21 +24,17 @@ uses Standard, TCollection, TColStd, TopoDS, TopAbs, TopTools, Interface, Transf is - class Reader; + imported Reader; -- class Analyzer; class ShapeInfo; - class BinderOfShape instantiates SimpleBinder from Transfer - (Shape from TopoDS, ShapeInfo); - - class ShapeBinder; + imported BinderOfShape; + imported ShapeBinder; class ShapeListBinder; - class ShapeMapper instantiates Mapper from Transfer - (Shape from TopoDS, ShapeMapHasher from TopTools, ShapeInfo); - class OrientedShapeMapper instantiates Mapper from Transfer - (Shape from TopoDS, OrientedShapeMapHasher from TopTools, ShapeInfo); + imported ShapeMapper; + imported ShapeMapper_Handle; class TransferResultInfo; class SequenceOfTransferResultInfo instantiates Sequence from TCollection @@ -53,25 +49,25 @@ is ---Purpose : Get the Shape recorded in a Binder -- If the Binder brings a multiple result, search for the Shape - ShapeResult (TP : TransientProcess from Transfer; ent : Transient) + ShapeResult (TP : TransientProcess_Handle from Transfer; ent : Transient) returns Shape from TopoDS; ---Purpose : Get the Shape recorded in a TransientProcess as result of the -- Transfer of an entity. I.E. in the binder bound to that Entity -- If no result or result not a single Shape, returns a Null Shape - SetShapeResult (TP : mutable TransientProcess from Transfer; ent : Transient; + SetShapeResult (TP : TransientProcess_Handle from Transfer; ent : Transient; result : Shape from TopoDS); ---Purpose : Sets a Shape as a result for a starting entity -- (reverse of ShapeResult) -- It simply creates a ShapeBinder then binds it to the entity - Shapes (TP : TransientProcess from Transfer; rootsonly : Boolean = Standard_True) + Shapes (TP : TransientProcess_Handle from Transfer; rootsonly : Boolean = Standard_True) returns HSequenceOfShape from TopTools; ---Purpose : Gets the Shapes recorded in a TransientProcess as result of a -- Transfer, considers roots only or all results according -- , returns them as a HSequence - Shapes (TP : TransientProcess from Transfer; + Shapes (TP : TransientProcess_Handle from Transfer; list : HSequenceOfTransient from TColStd) returns HSequenceOfShape from TopTools; ---Purpose : Gets the Shapes recorded in a TransientProcess as result of a @@ -79,7 +75,7 @@ is -- the shapes as a HSequence - ShapeState (FP : FinderProcess from Transfer; shape : Shape from TopoDS) + ShapeState (FP : FinderProcess_Handle from Transfer; shape : Shape from TopoDS) returns Orientation from TopAbs; ---Purpose : Returns a Status regarding a Shape in a FinderProcess -- - FORWARD means bound with SAME Orientation @@ -87,23 +83,23 @@ is -- - EXTERNAL means NOT BOUND -- - INTERNAL is not used - ResultFromShape (FP : FinderProcess from Transfer; shape : Shape from TopoDS) + ResultFromShape (FP : FinderProcess_Handle from Transfer; shape : Shape from TopoDS) returns Binder from Transfer; ---Purpose : Returns the result (as a Binder) attached to a given Shape -- Null if none - TransientFromShape (FP : FinderProcess from Transfer; shape : Shape from TopoDS) + TransientFromShape (FP : FinderProcess_Handle from Transfer; shape : Shape from TopoDS) returns Transient; ---Purpose : Returns the result as pure Transient attached to a Shape -- first one if multiple result - SetTransientFromShape (FP : FinderProcess from Transfer; + SetTransientFromShape (FP : FinderProcess_Handle from Transfer; shape : Shape from TopoDS; result : Transient); ---Purpose : Binds a Transient Result to a Shape in a FinderProcess -- (as first result if multiple : does not add it to existing one) - ShapeMapper (FP : FinderProcess from Transfer; shape : Shape from TopoDS) - returns ShapeMapper; + ShapeMapper (FP : FinderProcess_Handle from Transfer; shape : Shape from TopoDS) + returns ShapeMapper_Handle; ---Purpose : Returns a ShapeMapper for a given Shape (location included) -- Either is already mapped, then its Mapper is returned -- Or it is not, then a new one is created then returned, BUT @@ -111,7 +107,7 @@ is -- Functions to collect transfer result information -- - TransferResultInfo (TP : TransientProcess from Transfer; + TransferResultInfo (TP : TransientProcess_Handle from Transfer; EntityTypes: HSequenceOfTransient from TColStd; InfoSeq : out HSequenceOfTransferResultInfo from TransferBRep); ---Purpose: Fills sequence of TransferResultInfo for each type of entity @@ -120,7 +116,7 @@ is -- compare with entities in EntityTypes. -- TopAbs_ShapeEnum). - TransferResultInfo (FP : FinderProcess from Transfer; + TransferResultInfo (FP : FinderProcess_Handle from Transfer; ShapeTypes: HSequenceOfInteger from TColStd; InfoSeq : out HSequenceOfTransferResultInfo from TransferBRep); ---Purpose: Fills sequence of TransferResultInfo for each type of shape @@ -151,7 +147,7 @@ is -- embedded in ShapeMapper ResultCheckList (chl : CheckIterator from Interface; - FP : FinderProcess from Transfer; + FP : FinderProcess_Handle from Transfer; model : InterfaceModel from Interface) returns CheckIterator from Interface; ---Purpose : Takes a starting CheckIterator which brings checks bound with diff --git a/src/TransferBRep/TransferBRep.cxx b/src/TransferBRep/TransferBRep.cxx index cf20e69c9e..39fe47fb3b 100644 --- a/src/TransferBRep/TransferBRep.cxx +++ b/src/TransferBRep/TransferBRep.cxx @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/TransferBRep/TransferBRep_BinderOfShape.cxx b/src/TransferBRep/TransferBRep_BinderOfShape.cxx new file mode 100644 index 0000000000..768859f736 --- /dev/null +++ b/src/TransferBRep/TransferBRep_BinderOfShape.cxx @@ -0,0 +1,72 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(TransferBRep_BinderOfShape) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_Binder), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(TransferBRep_BinderOfShape) + +IMPLEMENT_DOWNCAST(TransferBRep_BinderOfShape,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(TransferBRep_BinderOfShape) + +TransferBRep_BinderOfShape::TransferBRep_BinderOfShape () +{ } + +TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (const TopoDS_Shape& res) + : theres (res) +{ + SetResultPresent(); +} + +Handle(Standard_Type) TransferBRep_BinderOfShape::ResultType () const +{ + return TransferBRep_ShapeInfo::Type (theres); +} // corresponds a "STANDARD_TYPE(TopoDS_Shape)" + +Standard_CString TransferBRep_BinderOfShape::ResultTypeName () const +{ + return TransferBRep_ShapeInfo::TypeName (theres); +} // corresponds a "STANDARD_TYPE(TopoDS_Shape)" + + +void TransferBRep_BinderOfShape::SetResult (const TopoDS_Shape& res) +{ + SetResultPresent(); + theres = res; +} + +const TopoDS_Shape& TransferBRep_BinderOfShape::Result () const +{ + return theres; +} + +TopoDS_Shape& TransferBRep_BinderOfShape::CResult () +{ + SetResultPresent(); return theres; +} \ No newline at end of file diff --git a/src/TransferBRep/TransferBRep_BinderOfShape.hxx b/src/TransferBRep/TransferBRep_BinderOfShape.hxx new file mode 100644 index 0000000000..86f37845fc --- /dev/null +++ b/src/TransferBRep/TransferBRep_BinderOfShape.hxx @@ -0,0 +1,61 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _TransferBRep_BinderOfShape_HeaderFile +#define _TransferBRep_BinderOfShape_HeaderFile + +#include +#include +#include +#include +#include +#include + +class Transfer_TransferFailure; +class TopoDS_Shape; +class TransferBRep_ShapeInfo; +class Standard_Type; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_Binder); +class TransferBRep_BinderOfShape; + +DEFINE_STANDARD_HANDLE(TransferBRep_BinderOfShape,Transfer_Binder) + +class TransferBRep_BinderOfShape : public Transfer_Binder +{ +public: + Standard_EXPORT TransferBRep_BinderOfShape(); + + Standard_EXPORT TransferBRep_BinderOfShape(const TopoDS_Shape& res); + + Standard_EXPORT Handle_Standard_Type ResultType() const; + + Standard_EXPORT Standard_CString ResultTypeName() const; + + Standard_EXPORT void SetResult(const TopoDS_Shape& res) ; + + Standard_EXPORT const TopoDS_Shape& Result() const; + + Standard_EXPORT TopoDS_Shape& CResult() ; + + DEFINE_STANDARD_RTTI(TransferBRep_BinderOfShape) + +private: + TopoDS_Shape theres; +}; +#endif \ No newline at end of file diff --git a/src/TransferBRep/TransferBRep_Reader.cdl b/src/TransferBRep/TransferBRep_Reader.cdl deleted file mode 100644 index 4ee84748fb..0000000000 --- a/src/TransferBRep/TransferBRep_Reader.cdl +++ /dev/null @@ -1,193 +0,0 @@ --- Created on: 1994-10-03 --- Created by: Christian CAILLET --- Copyright (c) 1994-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 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. - -class Reader from TransferBRep - - ---Purpose : This class offers a simple, easy to call, way of transferring - -- data from interface files to Shapes from CasCade - -- It must be specialized according to each norm/protocol, by : - -- - defining how to read a file (specific method with protocol) - -- - definig transfer, by providing an Actor - -uses CString, Transient, HSequenceOfTransient from TColStd, - Shape from TopoDS, HSequenceOfShape from TopTools, - InterfaceModel, Protocol from Interface, CheckIterator, - TransientProcess from Transfer, ActorOfTransientProcess from Transfer - -raises OutOfRange - -is - - Create returns Reader; - ---Purpose : Initializes a non-specialised Reader. Typically, for each norm - -- or protocol, is will be required to define a specific Create - -- to load a file and transfer it - - SetProtocol (me : in out; protocol : Protocol from Interface); - ---Purpose : Records the protocol to be used for read and transfer roots - - Protocol (me) returns Protocol from Interface is virtual; - ---Purpose : Returns the recorded Protocol - - SetActor (me : in out; actor : ActorOfTransientProcess from Transfer); - ---Purpose : Records the actor to be used for transfers - - Actor (me) returns ActorOfTransientProcess is virtual; - ---Purpose : Returns the recorded Actor - - - SetFileStatus (me : in out; status : Integer); - ---Purpose : Sets File Status to be interpreted as follows : - -- = 0 OK - -- < 0 file not found - -- > 0 read error, no Model could be created - - FileStatus (me) returns Integer; - ---Purpose : Returns the File Status - - FileNotFound (me) returns Boolean; - ---Purpose : Returns True if FileStatus is for FileNotFound - - SyntaxError (me) returns Boolean; - ---Purpose : Returns True if FileStatus is for Error during read - -- (major error; for local error, see CheckModel) - - SetModel (me : in out; model : InterfaceModel); - ---Purpose : Specifies a Model to work on - -- Also clears the result and Done status - - Model (me) returns InterfaceModel; - ---Purpose : Returns the Model to be worked on - - Clear (me : in out); - ---Purpose : clears the result and Done status. But not the Model. - - CheckStatusModel (me; withprint : Boolean) returns Boolean; - ---Purpose : Checks the Model. Returns True if there is NO FAIL at all - -- (regardless Warnings) - -- If is True, also sends Checks on standard output - - CheckListModel (me) returns CheckIterator; - ---Purpose : Checks the Model (complete : syntax + semantic) and returns - -- the produced Check List - - ModeNewTransfer (me : in out) returns Boolean; - ---Purpose : Returns (by Reference, hence can be changed) the Mode for new - -- Transfer : True (D) means that each new Transfer produces a - -- new TransferProcess. Else keeps the original one but each - -- Transfer clears its (former results are not kept) - ---C++ : return & - - BeginTransfer (me : in out) returns Boolean; - ---Purpose : Initializes the Reader for a Transfer (one,roots, or list) - -- Also calls PrepareTransfer - -- Returns True when done, False if could not be done - - EndTransfer (me : in out); - ---Purpose : Ebds a Transfer (one, roots or list) by recording its result - - PrepareTransfer (me : in out) is virtual; - ---Purpose : Prepares the Transfer. Also can act on the Actor or change the - -- TransientProcess if required. - -- Should not set the Actor into the TransientProcess, it is done - -- by caller. The provided default does nothing. - - TransferRoots (me : in out) is virtual; - ---Purpose : Transfers all Root Entities which are recognized as Geom-Topol - -- The result will be a list of Shapes. - -- This method calls user redefinable PrepareTransfer - -- Remark : former result is cleared - - Transfer (me : in out; num : Integer) returns Boolean is virtual; - ---Purpose : Transfers an Entity given its rank in the Model (Root or not) - -- Returns True if it is recognized as Geom-Topol. - -- (But it can have failed : see IsDone) - - TransferList (me : in out; list : HSequenceOfTransient) is virtual; - ---Purpose : Transfers a list of Entities (only the ones also in the Model) - -- Remark : former result is cleared - - IsDone (me) returns Boolean; - ---Purpose : Returns True if the LAST Transfer/TransferRoots was a success - - NbShapes (me) returns Integer; - ---Purpose : Returns the count of produced Shapes (roots) - - Shapes (me) returns HSequenceOfShape; - ---Purpose : Returns the complete list of produced Shapes - - Shape (me; num : Integer = 1) returns Shape from TopoDS - ---Purpose : Returns a Shape given its rank, by default the first one - raises OutOfRange; - -- Error if num < 1 or num > NbShapes - ---C++ : return const & - - ShapeResult (me; ent : Transient) returns Shape from TopoDS; - ---Purpose : Returns a Shape produced from a given entity (if it was - -- individually transferred or if an intermediate result is - -- known). If no Shape is bound with , returns a Null Shape - -- Warning : Runs on the last call to Transfer,TransferRoots,TransferList - - OneShape (me) returns Shape from TopoDS; - ---Purpose : Returns a unique Shape for the result : - -- - a void Shape (type = SHAPE) if result is empty - -- - a simple Shape if result has only one : returns this one - -- - a Compound if result has more than one Shape - - NbTransients (me) returns Integer; - ---Purpose : Returns the count of produced Transient Results (roots) - - Transients (me) returns HSequenceOfTransient; - ---Purpose : Returns the complete list of produced Transient Results - - Transient (me; num : Integer = 1) returns any Transient - ---Purpose : Returns a Transient Root Result, given its rank (by default - -- the first one) - raises OutOfRange; - -- Error if num < 1 or num > NbShapes - - - CheckStatusResult (me; withprints : Boolean) returns Boolean; - ---Purpose : Checks the Result of last Transfer (individual or roots, no - -- cumulation on several transfers). Returns True if NO fail - -- occured during Transfer (queries the TransientProcess) - - CheckListResult (me) returns CheckIterator; - ---Purpose : Checks the Result of last Transfer (individual or roots, no - -- cumulation on several transfers) and returns the produced list - - TransientProcess (me) returns TransientProcess; - ---Purpose : Returns the TransientProcess. It records informations about - -- the very last transfer done. Null if no transfer yet done. - -- Can be used for queries more accurate than the default ones. - - Destroy (me: in out) is virtual; - ---C++ : alias "Standard_EXPORT virtual ~TransferBRep_Reader() { Destroy(); }" - - -fields - - theProto : Protocol from Interface; - theActor : ActorOfTransientProcess from Transfer; - theModel : InterfaceModel; - theFilest : Integer; - theDone : Boolean is protected; - theNewpr : Boolean; - theProc : TransientProcess is protected; - theShapes : HSequenceOfShape; - theTransi : HSequenceOfTransient; - -end Reader; diff --git a/src/TransferBRep/TransferBRep_Reader.cxx b/src/TransferBRep/TransferBRep_Reader.cxx index 3ab01b9ad0..ebe63b5555 100644 --- a/src/TransferBRep/TransferBRep_Reader.cxx +++ b/src/TransferBRep/TransferBRep_Reader.cxx @@ -11,8 +11,16 @@ // 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 #include #include #include diff --git a/src/TransferBRep/TransferBRep_Reader.hxx b/src/TransferBRep/TransferBRep_Reader.hxx new file mode 100644 index 0000000000..30ce16c4ff --- /dev/null +++ b/src/TransferBRep/TransferBRep_Reader.hxx @@ -0,0 +1,189 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _TransferBRep_Reader_HeaderFile +#define _TransferBRep_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Interface_Protocol; +class Transfer_ActorOfTransientProcess; +class Interface_InterfaceModel; +class Transfer_TransientProcess; +class TopTools_HSequenceOfShape; +class TColStd_HSequenceOfTransient; +class Standard_OutOfRange; +class Interface_CheckIterator; +class TopoDS_Shape; +class Standard_Transient; + + +//! This class offers a simple, easy to call, way of transferring
+//! data from interface files to Shapes from CasCade
+//! It must be specialized according to each norm/protocol, by :
+//! - defining how to read a file (specific method with protocol)
+//! - definig transfer, by providing an Actor
+class TransferBRep_Reader +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Initializes a non-specialised Reader. Typically, for each norm
+//! or protocol, is will be required to define a specific Create
+//! to load a file and transfer it
+ Standard_EXPORT TransferBRep_Reader(); + //! Records the protocol to be used for read and transfer roots
+ Standard_EXPORT void SetProtocol(const Handle(Interface_Protocol)& protocol) ; + //! Returns the recorded Protocol
+ Standard_EXPORT virtual Handle_Interface_Protocol Protocol() const; + //! Records the actor to be used for transfers
+ Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfTransientProcess)& actor) ; + //! Returns the recorded Actor
+ Standard_EXPORT virtual Handle_Transfer_ActorOfTransientProcess Actor() const; + //! Sets File Status to be interpreted as follows :
+//! = 0 OK
+//! < 0 file not found
+//! > 0 read error, no Model could be created
+ Standard_EXPORT void SetFileStatus(const Standard_Integer status) ; + //! Returns the File Status
+ Standard_EXPORT Standard_Integer FileStatus() const; + //! Returns True if FileStatus is for FileNotFound
+ Standard_EXPORT Standard_Boolean FileNotFound() const; + //! Returns True if FileStatus is for Error during read
+//! (major error; for local error, see CheckModel)
+ Standard_EXPORT Standard_Boolean SyntaxError() const; + //! Specifies a Model to work on
+//! Also clears the result and Done status
+ Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model) ; + //! Returns the Model to be worked on
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + //! clears the result and Done status. But not the Model.
+ Standard_EXPORT void Clear() ; + //! Checks the Model. Returns True if there is NO FAIL at all
+//! (regardless Warnings)
+//! If is True, also sends Checks on standard output
+ Standard_EXPORT Standard_Boolean CheckStatusModel(const Standard_Boolean withprint) const; + //! Checks the Model (complete : syntax + semantic) and returns
+//! the produced Check List
+ Standard_EXPORT Interface_CheckIterator CheckListModel() const; + //! Returns (by Reference, hence can be changed) the Mode for new
+//! Transfer : True (D) means that each new Transfer produces a
+//! new TransferProcess. Else keeps the original one but each
+//! Transfer clears its (former results are not kept)
+ Standard_EXPORT Standard_Boolean& ModeNewTransfer() ; + //! Initializes the Reader for a Transfer (one,roots, or list)
+//! Also calls PrepareTransfer
+//! Returns True when done, False if could not be done
+ Standard_EXPORT Standard_Boolean BeginTransfer() ; + //! Ebds a Transfer (one, roots or list) by recording its result
+ Standard_EXPORT void EndTransfer() ; + //! Prepares the Transfer. Also can act on the Actor or change the
+//! TransientProcess if required.
+//! Should not set the Actor into the TransientProcess, it is done
+//! by caller. The provided default does nothing.
+ Standard_EXPORT virtual void PrepareTransfer() ; + //! Transfers all Root Entities which are recognized as Geom-Topol
+//! The result will be a list of Shapes.
+//! This method calls user redefinable PrepareTransfer
+//! Remark : former result is cleared
+ Standard_EXPORT virtual void TransferRoots() ; + //! Transfers an Entity given its rank in the Model (Root or not)
+//! Returns True if it is recognized as Geom-Topol.
+//! (But it can have failed : see IsDone)
+ Standard_EXPORT virtual Standard_Boolean Transfer(const Standard_Integer num) ; + //! Transfers a list of Entities (only the ones also in the Model)
+//! Remark : former result is cleared
+ Standard_EXPORT virtual void TransferList(const Handle(TColStd_HSequenceOfTransient)& list) ; + //! Returns True if the LAST Transfer/TransferRoots was a success
+ Standard_EXPORT Standard_Boolean IsDone() const; + //! Returns the count of produced Shapes (roots)
+ Standard_EXPORT Standard_Integer NbShapes() const; + //! Returns the complete list of produced Shapes
+ Standard_EXPORT Handle_TopTools_HSequenceOfShape Shapes() const; + //! Returns a Shape given its rank, by default the first one
+ Standard_EXPORT const TopoDS_Shape& Shape(const Standard_Integer num = 1) const; + //! Returns a Shape produced from a given entity (if it was
+//! individually transferred or if an intermediate result is
+//! known). If no Shape is bound with , returns a Null Shape
+//! Warning : Runs on the last call to Transfer,TransferRoots,TransferList
+ Standard_EXPORT TopoDS_Shape ShapeResult(const Handle(Standard_Transient)& ent) const; + //! Returns a unique Shape for the result :
+//! - a void Shape (type = SHAPE) if result is empty
+//! - a simple Shape if result has only one : returns this one
+//! - a Compound if result has more than one Shape
+ Standard_EXPORT TopoDS_Shape OneShape() const; + //! Returns the count of produced Transient Results (roots)
+ Standard_EXPORT Standard_Integer NbTransients() const; + //! Returns the complete list of produced Transient Results
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient Transients() const; + //! Returns a Transient Root Result, given its rank (by default
+//! the first one)
+ Standard_EXPORT Handle_Standard_Transient Transient(const Standard_Integer num = 1) const; + //! Checks the Result of last Transfer (individual or roots, no
+//! cumulation on several transfers). Returns True if NO fail
+//! occured during Transfer (queries the TransientProcess)
+ Standard_EXPORT Standard_Boolean CheckStatusResult(const Standard_Boolean withprints) const; + //! Checks the Result of last Transfer (individual or roots, no
+//! cumulation on several transfers) and returns the produced list
+ Standard_EXPORT Interface_CheckIterator CheckListResult() const; + //! Returns the TransientProcess. It records informations about
+//! the very last transfer done. Null if no transfer yet done.
+//! Can be used for queries more accurate than the default ones.
+ Standard_EXPORT Handle_Transfer_TransientProcess TransientProcess() const; + + Standard_EXPORT virtual void Destroy() ; +Standard_EXPORT virtual ~TransferBRep_Reader() { Destroy(); } + + + + + +protected: + + + +Standard_Boolean theDone; +Handle_Transfer_TransientProcess theProc; + + +private: + + + +Handle_Interface_Protocol theProto; +Handle_Transfer_ActorOfTransientProcess theActor; +Handle_Interface_InterfaceModel theModel; +Standard_Integer theFilest; +Standard_Boolean theNewpr; +Handle_TopTools_HSequenceOfShape theShapes; +Handle_TColStd_HSequenceOfTransient theTransi; + + +}; +#endif diff --git a/src/TransferBRep/TransferBRep_ShapeBinder.cdl b/src/TransferBRep/TransferBRep_ShapeBinder.cdl deleted file mode 100644 index bce165ba48..0000000000 --- a/src/TransferBRep/TransferBRep_ShapeBinder.cdl +++ /dev/null @@ -1,51 +0,0 @@ --- Created on: 1994-10-03 --- Created by: Assim --- Copyright (c) 1994-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 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. - -class ShapeBinder from TransferBRep inherits BinderOfShape - - ---Purpose : A ShapeBinder is a BinderOfShape with some additional services - -- to cast the Result under various kinds of Shapes - -uses ShapeEnum from TopAbs, Shape from TopoDS , - Vertex from TopoDS, Edge from TopoDS, Wire from TopoDS, - Face from TopoDS, Shell from TopoDS, Solid from TopoDS, - CompSolid from TopoDS, Compound from TopoDS - -raises TypeMismatch from Standard - -is - - Create returns mutable ShapeBinder; - ---Purpose : Creates an empty ShapeBinder - - Create (res : Shape) returns mutable ShapeBinder; - ---Purpose : Creates a ShapeBinder with a result - - ShapeType (me) returns ShapeEnum; - ---Purpose : Returns the Type of the Shape Result (under TopAbs form) - - -- different sub-types for the Result. Result returns a Shape - - Vertex (me) returns Vertex raises TypeMismatch from Standard; - Edge (me) returns Edge raises TypeMismatch from Standard; - Wire (me) returns Wire raises TypeMismatch from Standard; - Face (me) returns Face raises TypeMismatch from Standard; - Shell (me) returns Shell raises TypeMismatch from Standard; - Solid (me) returns Solid raises TypeMismatch from Standard; - CompSolid (me) returns CompSolid raises TypeMismatch from Standard; - Compound (me) returns Compound raises TypeMismatch from Standard; - -end ShapeBinder; diff --git a/src/TransferBRep/TransferBRep_ShapeBinder.cxx b/src/TransferBRep/TransferBRep_ShapeBinder.cxx index df56cceab9..67ea993f42 100644 --- a/src/TransferBRep/TransferBRep_ShapeBinder.cxx +++ b/src/TransferBRep/TransferBRep_ShapeBinder.cxx @@ -11,9 +11,36 @@ // 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 +#include +#include +#include +#include #include +#include +IMPLEMENT_STANDARD_TYPE(TransferBRep_ShapeBinder) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(TransferBRep_BinderOfShape), + STANDARD_TYPE(Transfer_Binder), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(TransferBRep_ShapeBinder) + + +IMPLEMENT_DOWNCAST(TransferBRep_ShapeBinder,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(TransferBRep_ShapeBinder) TransferBRep_ShapeBinder::TransferBRep_ShapeBinder () { } diff --git a/src/TransferBRep/TransferBRep_ShapeBinder.hxx b/src/TransferBRep/TransferBRep_ShapeBinder.hxx new file mode 100644 index 0000000000..ce95d9eaa0 --- /dev/null +++ b/src/TransferBRep/TransferBRep_ShapeBinder.hxx @@ -0,0 +1,77 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License.. + +#ifndef _TransferBRep_ShapeBinder_HeaderFile +#define _TransferBRep_ShapeBinder_HeaderFile + +#include +#include +#include +#include + +class Standard_TypeMismatch; +class TopoDS_Shape; +class TopoDS_Vertex; +class TopoDS_Edge; +class TopoDS_Wire; +class TopoDS_Face; +class TopoDS_Shell; +class TopoDS_Solid; +class TopoDS_CompSolid; +class TopoDS_Compound; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(TransferBRep_BinderOfShape); +class TransferBRep_ShapeBinder; + +DEFINE_STANDARD_HANDLE(TransferBRep_ShapeBinder,TransferBRep_BinderOfShape) + +//! A ShapeBinder is a BinderOfShape with some additional services
+//! to cast the Result under various kinds of Shapes
+class TransferBRep_ShapeBinder : public TransferBRep_BinderOfShape +{ + +public: + + //! Creates an empty ShapeBinder
+ Standard_EXPORT TransferBRep_ShapeBinder(); + //! Creates a ShapeBinder with a result
+ Standard_EXPORT TransferBRep_ShapeBinder(const TopoDS_Shape& res); + //! Returns the Type of the Shape Result (under TopAbs form)
+ Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; + + Standard_EXPORT TopoDS_Vertex Vertex() const; + + Standard_EXPORT TopoDS_Edge Edge() const; + + Standard_EXPORT TopoDS_Wire Wire() const; + + Standard_EXPORT TopoDS_Face Face() const; + + Standard_EXPORT TopoDS_Shell Shell() const; + + Standard_EXPORT TopoDS_Solid Solid() const; + + Standard_EXPORT TopoDS_CompSolid CompSolid() const; + + Standard_EXPORT TopoDS_Compound Compound() const; + + + DEFINE_STANDARD_RTTI(TransferBRep_ShapeBinder) + +}; +#endif diff --git a/src/TransferBRep/TransferBRep_ShapeMapper.cxx b/src/TransferBRep/TransferBRep_ShapeMapper.cxx new file mode 100644 index 0000000000..580cfb227a --- /dev/null +++ b/src/TransferBRep/TransferBRep_ShapeMapper.cxx @@ -0,0 +1,37 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(TransferBRep_ShapeMapper) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(Transfer_Finder), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(TransferBRep_ShapeMapper) + + +IMPLEMENT_DOWNCAST(TransferBRep_ShapeMapper,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(TransferBRep_ShapeMapper) \ No newline at end of file diff --git a/src/TransferBRep/TransferBRep_ShapeMapper.hxx b/src/TransferBRep/TransferBRep_ShapeMapper.hxx new file mode 100644 index 0000000000..7127592d1c --- /dev/null +++ b/src/TransferBRep/TransferBRep_ShapeMapper.hxx @@ -0,0 +1,60 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _TransferBRep_ShapeMapper_HeaderFile +#define _TransferBRep_ShapeMapper_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TopoDS_Shape; +class TopTools_ShapeMapHasher; +class TransferBRep_ShapeInfo; +class Transfer_Finder; +class Standard_Type; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(Transfer_Finder); + +DEFINE_STANDARD_HANDLE(TransferBRep_ShapeMapper,Transfer_Finder) + + +class TransferBRep_ShapeMapper : public Transfer_Mapper + { +public: + Standard_EXPORT TransferBRep_ShapeMapper(const TopoDS_Shape& theShape) + : Transfer_Mapper (theShape) + { } + + DEFINE_STANDARD_RTTI(TransferBRep_ShapeMapper) + }; +#endif diff --git a/src/TransferBRep/TransferBRep_ShapeMapper_Handle.hxx b/src/TransferBRep/TransferBRep_ShapeMapper_Handle.hxx new file mode 100644 index 0000000000..57bfffca2c --- /dev/null +++ b/src/TransferBRep/TransferBRep_ShapeMapper_Handle.hxx @@ -0,0 +1,25 @@ +// Copyright (c) 1999-2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _TransferBRep_ShapeMapper_Handle_HeaderFile +#define _TransferBRep_ShapeMapper_Handle_HeaderFile + +#include + +typedef Handle(TransferBRep_ShapeMapper) TransferBRep_ShapeMapper_Handle; + +#endif \ No newline at end of file diff --git a/src/XSAlgo/XSAlgo_AlgoContainer.cdl b/src/XSAlgo/XSAlgo_AlgoContainer.cdl index 82f48e14a6..a23b04fa59 100644 --- a/src/XSAlgo/XSAlgo_AlgoContainer.cdl +++ b/src/XSAlgo/XSAlgo_AlgoContainer.cdl @@ -29,8 +29,8 @@ uses WireData from ShapeExtend, Wire from ShapeAnalysis, Wire from ShapeFix, - TransientProcess from Transfer, - FinderProcess from Transfer, + TransientProcess_Handle from Transfer, + FinderProcess_Handle from Transfer, ProgressIndicator from Message is @@ -92,10 +92,10 @@ is -- and corrects it if necessary. ---Remark : In Open CASCADE does nothing. - MergeTransferInfo (me; TP : TransientProcess from Transfer; + MergeTransferInfo (me; TP : TransientProcess_Handle from Transfer; info: Transient; startTPitem: Integer = 1) is virtual; - MergeTransferInfo (me; FP : FinderProcess from Transfer; + MergeTransferInfo (me; FP : FinderProcess_Handle from Transfer; info: Transient) is virtual; ---Purpose: Updates translation map (TP or FP) with information -- resulting from ShapeProcessing diff --git a/src/XSAlgo/XSAlgo_AlgoContainer.cxx b/src/XSAlgo/XSAlgo_AlgoContainer.cxx index 436709b059..97f95cd31c 100644 --- a/src/XSAlgo/XSAlgo_AlgoContainer.cxx +++ b/src/XSAlgo/XSAlgo_AlgoContainer.cxx @@ -51,6 +51,8 @@ #include #include +#include +#include #include #include #include diff --git a/src/XSControl/FILES b/src/XSControl/FILES new file mode 100644 index 0000000000..43ce89fca2 --- /dev/null +++ b/src/XSControl/FILES @@ -0,0 +1,19 @@ +XSControl_Controller.hxx +XSControl_Controller.cxx +XSControl_TransferReader.hxx +XSControl_TransferReader.cxx +XSControl_TransferWriter.hxx +XSControl_TransferWriter.cxx +XSControl_SelectForTransfer.hxx +XSControl_SelectForTransfer.cxx +XSControl_WorkSession.hxx +XSControl_WorkSession.cxx +XSControl_WorkSession_Handle.hxx +XSControl_Reader.hxx +XSControl_Reader.cxx +XSControl_Writer.hxx +XSControl_Writer.cxx +XSControl_SignTransferStatus.hxx +XSControl_SignTransferStatus.cxx +XSControl_ConnectedShapes.hxx +XSControl_ConnectedShapes.cxx diff --git a/src/XSControl/XSControl.cdl b/src/XSControl/XSControl.cdl index 2e5dac0f44..55590dd59f 100644 --- a/src/XSControl/XSControl.cdl +++ b/src/XSControl/XSControl.cdl @@ -25,24 +25,25 @@ uses Standard , MMgt, TCollection , TColStd, Dico, is - deferred class Controller; - class TransferReader; - class TransferWriter; + imported Controller; + imported TransferReader; + imported TransferWriter; - class WorkSession; - class SelectForTransfer; - class SignTransferStatus; - class ConnectedShapes; - - class Reader; - class Writer; + imported WorkSession; + imported WorkSession_Handle; --workaround to allow WOK detect handle of non-cdl class + imported SelectForTransfer; + imported SignTransferStatus; + imported ConnectedShapes; + + imported Reader; + imported Writer; class Functions; class FuncShape; class Utils; class Vars; - Session (pilot : SessionPilot from IFSelect) returns WorkSession from XSControl; + Session (pilot : SessionPilot from IFSelect) returns WorkSession_Handle from XSControl; ---Purpose : Returns the WorkSession of a SessionPilot, but casts it as -- from XSControl : it then gives access to Control & Transfers diff --git a/src/XSControl/XSControl_ConnectedShapes.cdl b/src/XSControl/XSControl_ConnectedShapes.cdl deleted file mode 100644 index b8eaa085dd..0000000000 --- a/src/XSControl/XSControl_ConnectedShapes.cdl +++ /dev/null @@ -1,66 +0,0 @@ --- Created on: 1999-02-24 --- Created by: Christian CAILLET --- Copyright (c) 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 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. - -class ConnectedShapes from XSControl inherits SelectExplore from IFSelect - - ---Purpose : From a TopoDS_Shape, or from the entity which has produced it, - -- searches for the shapes, and the entities which have produced - -- them in last transfer, which are adjacent to it by VERTICES - -uses AsciiString, Transient, Graph, EntityIterator, - HSequenceOfTransient from TColStd, - Shape from TopoDS, ShapeEnum from TopAbs, - TransientProcess from Transfer, TransferReader from XSControl - -is - - Create returns ConnectedShapes; - ---Purpose : Creates a Selection ConnectedShapes. It remains to be set a - -- TransferReader - - Create (TR : TransferReader) returns ConnectedShapes; - ---Purpose : Creates a Selection ConnectedShapes, which will work with the - -- current TransferProcess brought by the TransferReader - - SetReader (me : mutable; TR : TransferReader); - ---Purpose : Sets a TransferReader to sort entities : it brings the - -- TransferProcess which may change, while the TransferReader does not - - Explore (me; level : Integer; ent : Transient; G : Graph; - explored : in out EntityIterator) - returns Boolean; - ---Purpose : Explores an entity : entities from which are connected to that - -- produced by this entity, including itself - - - ExploreLabel (me) returns AsciiString from TCollection; - ---Purpose : Returns a text defining the criterium. - -- "Connected Entities through produced Shapes" - - - AdjacentEntities (myclass; - ashape : Shape from TopoDS; - TP : TransientProcess from Transfer; - type : ShapeEnum from TopAbs) - returns HSequenceOfTransient; - ---Purpose : This functions considers a shape from a transfer and performs - -- the search function explained above - -fields - - theTR : TransferReader; - -end ConnectedShapes; diff --git a/src/XSControl/XSControl_ConnectedShapes.cxx b/src/XSControl/XSControl_ConnectedShapes.cxx index 732677e32c..1a22f3c95d 100644 --- a/src/XSControl/XSControl_ConnectedShapes.cxx +++ b/src/XSControl/XSControl_ConnectedShapes.cxx @@ -11,11 +11,32 @@ // 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 +#include +IMPLEMENT_STANDARD_TYPE(XSControl_ConnectedShapes) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_SelectExplore), + STANDARD_TYPE(IFSelect_SelectDeduct), + STANDARD_TYPE(IFSelect_Selection), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_ConnectedShapes) + + +IMPLEMENT_DOWNCAST(XSControl_ConnectedShapes,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_ConnectedShapes) XSControl_ConnectedShapes::XSControl_ConnectedShapes () : IFSelect_SelectExplore (1) { } diff --git a/src/XSControl/XSControl_ConnectedShapes.hxx b/src/XSControl/XSControl_ConnectedShapes.hxx new file mode 100644 index 0000000000..aa85b75930 --- /dev/null +++ b/src/XSControl/XSControl_ConnectedShapes.hxx @@ -0,0 +1,85 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_ConnectedShapes_HeaderFile +#define _XSControl_ConnectedShapes_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class Interface_Graph; +class Interface_EntityIterator; +class TCollection_AsciiString; +class TColStd_HSequenceOfTransient; +class Handle(Standard_Type); +class Handle(IFSelect_SelectExplore); +class TopoDS_Shape; + +DEFINE_STANDARD_HANDLE(XSControl_ConnectedShapes,IFSelect_SelectExplore) + +//! From a TopoDS_Shape, or from the entity which has produced it,
+//! searches for the shapes, and the entities which have produced
+//! them in last transfer, which are adjacent to it by VERTICES
+class XSControl_ConnectedShapes : public IFSelect_SelectExplore +{ +public: + + //! Creates a Selection ConnectedShapes. It remains to be set a
+ //! TransferReader
+ Standard_EXPORT XSControl_ConnectedShapes(); + + //! Creates a Selection ConnectedShapes, which will work with the
+ //! current TransferProcess brought by the TransferReader
+ Standard_EXPORT XSControl_ConnectedShapes(const Handle(XSControl_TransferReader)& TR); + + //! Sets a TransferReader to sort entities : it brings the
+ //! TransferProcess which may change, while the TransferReader does not
+ Standard_EXPORT void SetReader(const Handle(XSControl_TransferReader)& TR); + + //! Explores an entity : entities from which are connected to that
+ //! produced by this entity, including itself
+ Standard_EXPORT Standard_Boolean Explore(const Standard_Integer level, + const Handle(Standard_Transient)& ent, + const Interface_Graph& G, + Interface_EntityIterator& explored) const; + + //! Returns a text defining the criterium.
+ //! "Connected Entities through produced Shapes"
+ Standard_EXPORT TCollection_AsciiString ExploreLabel() const; + + //! This functions considers a shape from a transfer and performs
+ //! the search function explained above
+ Standard_EXPORT static Handle_TColStd_HSequenceOfTransient AdjacentEntities(const TopoDS_Shape& ashape, + const Handle(Transfer_TransientProcess)& TP, + const TopAbs_ShapeEnum type) ; + + DEFINE_STANDARD_RTTI(XSControl_ConnectedShapes) + +private: + Handle(XSControl_TransferReader) theTR; + +}; +#endif diff --git a/src/XSControl/XSControl_Controller.cdl b/src/XSControl/XSControl_Controller.cdl deleted file mode 100644 index ec97c320bb..0000000000 --- a/src/XSControl/XSControl_Controller.cdl +++ /dev/null @@ -1,336 +0,0 @@ --- Created on: 1995-03-13 --- Created by: Christian CAILLET --- 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 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. - -deferred class Controller from XSControl inherits TShared - - ---Purpose : This class allows a general X-STEP engine to run generic - -- functions on any interface norm, in the same way. It includes - -- the transfer operations. I.e. it gathers the already available - -- general modules, the engine has just to know it - -- - -- The important point is that a given X-STEP Controller is - -- attached to a given couple made of an Interface Norm (such as - -- IGES-5.1) and an application data model (CasCade Shapes for - -- instance). - -- - -- A Controller brings a Profile, this allows to have several - -- variants on the same basic definition, for instance keep the - -- norm definition but give several transfer actors, etc - -- - -- Finally, Controller can be gathered in a general dictionary then - -- retreived later by a general call (method Recorded) - -- - -- It does not manage the produced data, but the Actors make the - -- link between the norm and the application - -uses CString, AsciiString, SequenceOfTransient, SequenceOfInteger, - DictionaryOfTransient, DictionaryOfInteger, - HArray1OfHAsciiString from Interface, - HSequenceOfHAsciiString from TColStd, - Protocol from Interface, - Signature from IFSelect, - InterfaceModel from Interface, - CheckIterator from Interface, - ActorOfTransientProcess from Transfer, - ActorOfFinderProcess from Transfer, - FinderProcess from Transfer, - Shape from TopoDS, - WorkLibrary from IFSelect, - Profile from IFSelect, - WorkSession from XSControl, - ReturnStatus from IFSelect - -raises DomainError - -is - - Initialize (longname, shortname : CString); - ---Purpose : Initializing with names - -- is for the complete, official, long name - -- is for the short name used for resources - - SetNames (me : mutable; longname, shortname : CString); - ---Purpose : Changes names - -- if a name is empty, the formerly set one remains - -- Remark : Does not call Record or AutoRecord - - AutoRecord (me) raises DomainError; - ---Purpose : Records is a general dictionary under Short and Long - -- Names (see method Name) - - Record (me; name : CString) raises DomainError; - ---Purpose : Records in a general dictionary under a name - -- Error if already used for another one - - Recorded (myclass; name : CString) returns mutable Controller; - ---Purpose : Returns the Controller attached to a given name - -- Returns a Null Handle if is unknown - - ListRecorded (myclass; mode : Integer = 0) returns HSequenceOfHAsciiString; - ---Purpose : Returns the list of names of recorded norms, according to mode - -- = 0 (D) : all the recorded names - -- < 0 : for each distinct norm, its resource (short) name - -- > 0 : for each distinct norm, its complete (long) name - - Name (me; rsc : Boolean = Standard_False) returns CString; - ---Purpose : Returns a name, as given when initializing : - -- rsc = False (D) : True Name attached to the Norm (long name) - -- rsc = True : Name of the ressource set (i.e. short name) - - Profile (me) returns Profile from IFSelect; - ---Purpose : Returns the Profile - -- It starts with a first configuration Base (empty) and the - -- following options : - -- protocol for the Protocol - -- sign-type for the SignType (Default Signature for Type) - -- access for the WorkLibrary - -- tr-read for ActorRead (import processor) - -- tr-write for ActorWrite (export processor) - - DefineProfile (me : mutable; confname : CString); - ---Purpose : Considers the current state of the Controller as defining a - -- configuration, newly created or already existing - - SetProfile (me : mutable; confname : CString) returns Boolean; - ---Purpose : Sets the Controller in a given Configuration of its Profile - -- Calls SettingProfile (which can be redefined) - -- - -- Returns True if done, False if unknown - - SettingProfile (me : mutable; confname : CString) - returns Boolean is virtual; - ---Purpose : This method is called by SetProfile, it can be redefined - -- for specific sub-class of Controller - -- The default does nothing - - ApplyProfile (me : mutable; WS : WorkSession from XSControl; confname : CString) - returns Boolean; - ---Purpose : Applies a Configuration of the Profile to the WorkSession - -- I.E. calls SetProfile then fills WorkSession with definitions - - ApplyingProfile (me : mutable; WS : WorkSession from XSControl; confname : CString) - returns Boolean is virtual; - ---Purpose : Called by ApplyProfile, can be redefined for specific - -- sub-class of Controller - -- The default does nothing - - - Protocol (me) returns Protocol from Interface; - ---Purpose : Returns the Protocol attached to the Norm (from field) - - SignType (me) returns Signature from IFSelect; - ---Purpose : Returns the SignType attached to the norm (from field) - - WorkLibrary (me) returns WorkLibrary from IFSelect; - ---Purpose : Returns the WorkLibrary attached to the Norm. Remark that it - -- has to be in phase with the Protocol (read from field) - - NewModel (me) returns mutable InterfaceModel from Interface is deferred; - ---Purpose : Creates a new empty Model ready to receive data of the Norm - -- Used to write data from Imagine to an interface file - - ActorRead (me; model : InterfaceModel) - returns mutable ActorOfTransientProcess from Transfer is deferred; - ---Purpose : Returns the Actor for Read attached to the pair (norm,appli) - -- It can be adapted for data of the input Model, as required - -- Can be read from field then adapted with Model as required - - ActorWrite (me) returns mutable ActorOfFinderProcess from Transfer - is virtual; - ---Purpose : Returns the Actor for Write attached to the pair (norm,appli) - -- Read from field. Can be redefined - - UpdateStatics (me; mode : Integer; criter : CString = "") is virtual; - ---Purpose : Updates static values - -- precises the kind of updating : (see Items from Static) - -- -1 : a precise static item : criter = its name - -- 0 : all items of a family : criter = the family name - -- 1 : all items which match regexp name : criter = regexp name - -- By default (criter empty) should consider all relevant statics - -- If is defined, can consider only this static item - -- The provided default method does nothing, to be redefined - - - -- Writing Actions (can be redefined from ActorWrite using) - -- These actions are ran under control of a TransferWriter - - SetModeWrite (me : mutable; modemin, modemax : Integer; shape : Boolean = Standard_True); - ---Purpose : Sets mininum and maximum values for modetrans (write) - -- Erases formerly recorded bounds and values - -- Actually only for shape - -- Then, for each value a little help can be attached - - SetModeWriteHelp (me : mutable; modetrans : Integer; help : CString; - shape : Boolean = Standard_True); - ---Purpose : Attaches a short line of help to a value of modetrans (write) - - ModeWriteBounds (me; modemin, modemax : out Integer; - shape : Boolean = Standard_True) returns Boolean; - ---Purpose : Returns recorded min and max values for modetrans (write) - -- Actually only for shapes - -- Returns True if bounds are set, False else (then, free value) - - IsModeWrite (me; modetrans : Integer; shape : Boolean = Standard_True) - returns Boolean; - ---Purpose : Tells if a value of is a good value(within bounds) - -- Actually only for shapes - - ModeWriteHelp (me; modetrans : Integer; shape : Boolean = Standard_True) - returns CString; - ---Purpose : Returns the help line recorded for a value of modetrans - -- empty if help not defined or not within bounds or if values are free - - - RecognizeWriteTransient (me; obj : Transient; modetrans : Integer = 0) - returns Boolean is virtual; - ---Purpose : Tells if (an application object) is a valid candidate - -- for a transfer to a Model. - -- By default, asks the ActorWrite if known (through a - -- TransientMapper). Can be redefined - - TransferWriteTransient (me; obj : Transient; - FP : mutable FinderProcess from Transfer; - model : mutable InterfaceModel from Interface; - modetrans : Integer = 0) - returns ReturnStatus is virtual; - ---Purpose : Takes one Transient Object and transfers it to an - -- InterfaceModel (already created, e.g. by NewModel) - -- (result is recorded in the model by AddWithRefs) - -- FP records produced results and checks - -- - -- Default uses ActorWrite; can be redefined as necessary - -- Returned value is a status, as follows : - -- 0 OK , 1 No Result , 2 Fail (e.g. exception raised) - -- -1 bad conditions , -2 bad model or null model - -- For type of object not recognized : should return 1 - - RecognizeWriteShape (me; shape : Shape from TopoDS; modetrans: Integer = 0) - returns Boolean is virtual; - ---Purpose : Tells if a shape is valid for a transfer to a model - -- Asks the ActorWrite (through a ShapeMapper) - - TransferWriteShape (me; shape : Shape from TopoDS; - FP : mutable FinderProcess from Transfer; - model : mutable InterfaceModel from Interface; - modetrans : Integer = 0) - returns ReturnStatus is virtual; - ---Purpose : Takes one Shape and transfers it to an - -- InterfaceModel (already created, e.g. by NewModel) - -- Default uses ActorWrite; can be redefined as necessary - -- Returned value is a status, as follows : - -- Done OK , Void : No Result , Fail : Fail (e.g. exception) - -- Error : bad conditions , bad model or null model - -- Resolution of file clusters - -- According to each norm, there can (or not) be files of which - -- definition is not complete but refers to other files : this defines - -- a file cluster. - -- It can then be resolved by two calls : - -- - ClusterContext prepares the resolution, specific of each case - -- - ResolveCluster performs the resolution, its result consists in - -- having all data gathered in one final model - - ClusterContext (me; WS : WorkSession) returns mutable Transient is virtual; - ---Purpose : Prepares and returns a context to resolve a cluster - -- All data to be used are detained by the WorkSession - -- The definition of this context is free and proper to each case - -- remark that it is aimed to be used in ResolveCluster - -- - -- The context must be prepared, but resolution must not have - -- began - -- - -- If no cluster has to be resolved, should return a null handle - -- This is the default case, which can be redefined - - ResolveCluster (me; WS : mutable WorkSession; context : mutable Transient) - returns CheckIterator is virtual; - ---Purpose : Performs the resolution itself, from the starting data and - -- the cluster context - -- - -- Can fill a CheckList as necessary (especially when one or - -- more references remain unresolved) - -- - -- Default does nothing and returns an empty CheckList - - -- Additional Items as required (free list), each item is named - - AddControlItem (me : mutable; item : any Transient; name : CString); - ---Purpose : Adds an item in the control list - -- A control item of a controller is accessed by its name which - -- is specific of a kind of item (i.e. a kind of functionnality) - -- Adds or replaces if is already recorded - - ControlItem (me; name : CString) returns any Transient; - ---Purpose : Returns a control item from its name, Null if unknown - -- To be used then, it just remains to be down-casted - - -- To Help Session Customising -- - - TraceStatic (me : mutable; name : CString; use : Integer); - ---Purpose : Records the name of a Static to be traced for a given use - - AddSessionItem (me : mutable; item : Transient; name : CString; - setapplied : CString = ""); - ---Purpose : Records a Session Item, to be added for customisation of the - -- Work Session. It must have a specific name. - -- is used if is a GeneralModifier, to decide - -- to which hook list it will be applied, if not empty (else, - -- not applied to any hook list) - -- ACTUAL : only one hook list is managed : "send" - -- Remark : this method is to be called at Create time, the - -- recorded items will be used by Customise - -- Warning : if conflicts, the last recorded item is kept - - SessionItem (me; name : CString) returns Transient; - ---Purpose : Returns an item given its name to record in a Session - -- If is unknown, returns a Null Handle - - IsApplied (me; item : Transient) returns Boolean; - ---Purpose : Returns True if is recorded as - - Customise (me: mutable; WS : in out WorkSession) is virtual; - ---Purpose : Customises a WorkSession, by adding to it the recorded items - -- (by AddSessionItem), then by calling a specific method - -- Customising, set by default to do nothing - - Customising (me : mutable; WS : in out WorkSession); -- is virtual - ---Purpose : Specific customisation method, which can be redefined - -- Default does nothing - AdaptorSession(me) returns DictionaryOfTransient; - -fields - - theProfile : Profile; - - theShortName : AsciiString is protected; - theLongName : AsciiString is protected; - - theAdaptorLibrary : WorkLibrary is protected; - theAdaptorProtocol : Protocol is protected; - theSignType : Signature is protected; - theAdaptorRead : ActorOfTransientProcess is protected; - theAdaptorWrite : ActorOfFinderProcess is protected; - - theItems : DictionaryOfTransient; - - theAdaptorSession : DictionaryOfTransient is protected; - theAdaptorApplied : SequenceOfTransient; - theAdaptorHooks : HSequenceOfHAsciiString from TColStd; - theParams : SequenceOfTransient from TColStd; - theParamUses : SequenceOfInteger from TColStd; - - theModeWriteShapeN : HArray1OfHAsciiString from Interface; - -end Controller; diff --git a/src/XSControl/XSControl_Controller.cxx b/src/XSControl/XSControl_Controller.cxx index 51767c58c1..d207e87bb7 100644 --- a/src/XSControl/XSControl_Controller.cxx +++ b/src/XSControl/XSControl_Controller.cxx @@ -11,7 +11,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include @@ -60,6 +60,35 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(XSControl_Controller) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_Controller) + + +IMPLEMENT_DOWNCAST(XSControl_Controller,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_Controller) static Handle(Dico_DictionaryOfTransient)& listadapt() { diff --git a/src/XSControl/XSControl_Controller.hxx b/src/XSControl/XSControl_Controller.hxx new file mode 100644 index 0000000000..4ffea83ee4 --- /dev/null +++ b/src/XSControl/XSControl_Controller.hxx @@ -0,0 +1,313 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_Controller_HeaderFile +#define _XSControl_Controller_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class IFSelect_WorkLibrary; +class Interface_Protocol; +class IFSelect_Signature; +class Transfer_ActorOfTransientProcess; +class Transfer_ActorOfFinderProcess; +class Dico_DictionaryOfTransient; +class TColStd_HSequenceOfHAsciiString; +class Interface_HArray1OfHAsciiString; +class Standard_DomainError; +class Handle(XSControl_WorkSession); +class Interface_InterfaceModel; +class Standard_Transient; +class Transfer_FinderProcess; +class TopoDS_Shape; +class Interface_CheckIterator; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class XSControl_Controller; + +DEFINE_STANDARD_HANDLE(XSControl_Controller,MMgt_TShared) + +//! This class allows a general X-STEP engine to run generic
+//! functions on any interface norm, in the same way. It includes
+//! the transfer operations. I.e. it gathers the already available
+//! general modules, the engine has just to know it
+//!
+//! The important point is that a given X-STEP Controller is
+//! attached to a given couple made of an Interface Norm (such as
+//! IGES-5.1) and an application data model (CasCade Shapes for
+//! instance).
+//!
+//! A Controller brings a Profile, this allows to have several
+//! variants on the same basic definition, for instance keep the
+//! norm definition but give several transfer actors, etc
+//!
+//! Finally, Controller can be gathered in a general dictionary then
+//! retreived later by a general call (method Recorded)
+//!
+//! It does not manage the produced data, but the Actors make the
+//! link between the norm and the application
+class XSControl_Controller : public MMgt_TShared { + +public: + + //! Changes names
+//! if a name is empty, the formerly set one remains
+//! Remark : Does not call Record or AutoRecord
+ Standard_EXPORT void SetNames(const Standard_CString longname,const Standard_CString shortname) ; + //! Records is a general dictionary under Short and Long
+//! Names (see method Name)
+ Standard_EXPORT void AutoRecord() const; + //! Records in a general dictionary under a name
+//! Error if already used for another one
+ Standard_EXPORT void Record(const Standard_CString name) const; + //! Returns the Controller attached to a given name
+//! Returns a Null Handle if is unknown
+ Standard_EXPORT static Handle_XSControl_Controller Recorded(const Standard_CString name) ; + //! Returns the list of names of recorded norms, according to mode
+//! = 0 (D) : all the recorded names
+//! < 0 : for each distinct norm, its resource (short) name
+//! > 0 : for each distinct norm, its complete (long) name
+ Standard_EXPORT static Handle_TColStd_HSequenceOfHAsciiString ListRecorded(const Standard_Integer mode = 0) ; + //! Returns a name, as given when initializing :
+//! rsc = False (D) : True Name attached to the Norm (long name)
+//! rsc = True : Name of the ressource set (i.e. short name)
+ Standard_EXPORT Standard_CString Name(const Standard_Boolean rsc = Standard_False) const; + //! Returns the Profile
+//! It starts with a first configuration Base (empty) and the
+//! following options :
+//! protocol for the Protocol
+//! sign-type for the SignType (Default Signature for Type)
+//! access for the WorkLibrary
+//! tr-read for ActorRead (import processor)
+//! tr-write for ActorWrite (export processor)
+ Standard_EXPORT Handle_IFSelect_Profile Profile() const; + //! Considers the current state of the Controller as defining a
+//! configuration, newly created or already existing
+ Standard_EXPORT void DefineProfile(const Standard_CString confname) ; + //! Sets the Controller in a given Configuration of its Profile
+//! Calls SettingProfile (which can be redefined)
+//!
+//! Returns True if done, False if unknown
+ Standard_EXPORT Standard_Boolean SetProfile(const Standard_CString confname) ; + //! This method is called by SetProfile, it can be redefined
+//! for specific sub-class of Controller
+//! The default does nothing
+ Standard_EXPORT virtual Standard_Boolean SettingProfile(const Standard_CString confname) ; + //! Applies a Configuration of the Profile to the WorkSession
+//! I.E. calls SetProfile then fills WorkSession with definitions
+ Standard_EXPORT Standard_Boolean ApplyProfile(const Handle(XSControl_WorkSession)& WS,const Standard_CString confname) ; + //! Called by ApplyProfile, can be redefined for specific
+//! sub-class of Controller
+//! The default does nothing
+ Standard_EXPORT virtual Standard_Boolean ApplyingProfile(const Handle(XSControl_WorkSession)& WS,const Standard_CString confname) ; + //! Returns the Protocol attached to the Norm (from field)
+ Standard_EXPORT Handle_Interface_Protocol Protocol() const; + //! Returns the SignType attached to the norm (from field)
+ Standard_EXPORT Handle_IFSelect_Signature SignType() const; + //! Returns the WorkLibrary attached to the Norm. Remark that it
+//! has to be in phase with the Protocol (read from field)
+ Standard_EXPORT Handle_IFSelect_WorkLibrary WorkLibrary() const; + //! Creates a new empty Model ready to receive data of the Norm
+//! Used to write data from Imagine to an interface file
+ Standard_EXPORT virtual Handle_Interface_InterfaceModel NewModel() const = 0; + //! Returns the Actor for Read attached to the pair (norm,appli)
+//! It can be adapted for data of the input Model, as required
+//! Can be read from field then adapted with Model as required
+ Standard_EXPORT virtual Handle_Transfer_ActorOfTransientProcess ActorRead(const Handle(Interface_InterfaceModel)& model) const = 0; + //! Returns the Actor for Write attached to the pair (norm,appli)
+//! Read from field. Can be redefined
+ Standard_EXPORT virtual Handle_Transfer_ActorOfFinderProcess ActorWrite() const; + //! Updates static values
+//! precises the kind of updating : (see Items from Static)
+//! -1 : a precise static item : criter = its name
+//! 0 : all items of a family : criter = the family name
+//! 1 : all items which match regexp name : criter = regexp name
+//! By default (criter empty) should consider all relevant statics
+//! If is defined, can consider only this static item
+//! The provided default method does nothing, to be redefined
+ Standard_EXPORT virtual void UpdateStatics(const Standard_Integer mode,const Standard_CString criter = "") const; + //! Sets mininum and maximum values for modetrans (write)
+//! Erases formerly recorded bounds and values
+//! Actually only for shape
+//! Then, for each value a little help can be attached
+ Standard_EXPORT void SetModeWrite(const Standard_Integer modemin,const Standard_Integer modemax,const Standard_Boolean shape = Standard_True) ; + //! Attaches a short line of help to a value of modetrans (write)
+ Standard_EXPORT void SetModeWriteHelp(const Standard_Integer modetrans,const Standard_CString help,const Standard_Boolean shape = Standard_True) ; + //! Returns recorded min and max values for modetrans (write)
+//! Actually only for shapes
+//! Returns True if bounds are set, False else (then, free value)
+ Standard_EXPORT Standard_Boolean ModeWriteBounds(Standard_Integer& modemin,Standard_Integer& modemax,const Standard_Boolean shape = Standard_True) const; + //! Tells if a value of is a good value(within bounds)
+//! Actually only for shapes
+ Standard_EXPORT Standard_Boolean IsModeWrite(const Standard_Integer modetrans,const Standard_Boolean shape = Standard_True) const; + //! Returns the help line recorded for a value of modetrans
+//! empty if help not defined or not within bounds or if values are free
+ Standard_EXPORT Standard_CString ModeWriteHelp(const Standard_Integer modetrans,const Standard_Boolean shape = Standard_True) const; + //! Tells if (an application object) is a valid candidate
+//! for a transfer to a Model.
+//! By default, asks the ActorWrite if known (through a
+//! TransientMapper). Can be redefined
+ Standard_EXPORT virtual Standard_Boolean RecognizeWriteTransient(const Handle(Standard_Transient)& obj,const Standard_Integer modetrans = 0) const; + //! Takes one Transient Object and transfers it to an
+//! InterfaceModel (already created, e.g. by NewModel)
+//! (result is recorded in the model by AddWithRefs)
+//! FP records produced results and checks
+//!
+//! Default uses ActorWrite; can be redefined as necessary
+//! Returned value is a status, as follows :
+//! 0 OK , 1 No Result , 2 Fail (e.g. exception raised)
+//! -1 bad conditions , -2 bad model or null model
+//! For type of object not recognized : should return 1
+ Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteTransient(const Handle(Standard_Transient)& obj,const Handle(Transfer_FinderProcess)& FP,const Handle(Interface_InterfaceModel)& model,const Standard_Integer modetrans = 0) const; + //! Tells if a shape is valid for a transfer to a model
+//! Asks the ActorWrite (through a ShapeMapper)
+ Standard_EXPORT virtual Standard_Boolean RecognizeWriteShape(const TopoDS_Shape& shape,const Standard_Integer modetrans = 0) const; + //! Takes one Shape and transfers it to an
+//! InterfaceModel (already created, e.g. by NewModel)
+//! Default uses ActorWrite; can be redefined as necessary
+//! Returned value is a status, as follows :
+//! Done OK , Void : No Result , Fail : Fail (e.g. exception)
+//! Error : bad conditions , bad model or null model
+//! Resolution of file clusters
+//! According to each norm, there can (or not) be files of which
+//! definition is not complete but refers to other files : this defines
+//! a file cluster.
+//! It can then be resolved by two calls :
+//! - ClusterContext prepares the resolution, specific of each case
+//! - ResolveCluster performs the resolution, its result consists in
+//! having all data gathered in one final model
+ Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& shape,const Handle(Transfer_FinderProcess)& FP,const Handle(Interface_InterfaceModel)& model,const Standard_Integer modetrans = 0) const; + //! Prepares and returns a context to resolve a cluster
+//! All data to be used are detained by the WorkSession
+//! The definition of this context is free and proper to each case
+//! remark that it is aimed to be used in ResolveCluster
+//!
+//! The context must be prepared, but resolution must not have
+//! began
+//!
+//! If no cluster has to be resolved, should return a null handle
+//! This is the default case, which can be redefined
+ Standard_EXPORT virtual Handle_Standard_Transient ClusterContext(const Handle(XSControl_WorkSession)& WS) const; + //! Performs the resolution itself, from the starting data and
+//! the cluster context
+//!
+//! Can fill a CheckList as necessary (especially when one or
+//! more references remain unresolved)
+//!
+//! Default does nothing and returns an empty CheckList
+ Standard_EXPORT virtual Interface_CheckIterator ResolveCluster(const Handle(XSControl_WorkSession)& WS,const Handle(Standard_Transient)& context) const; + //! Adds an item in the control list
+//! A control item of a controller is accessed by its name which
+//! is specific of a kind of item (i.e. a kind of functionnality)
+//! Adds or replaces if is already recorded
+ Standard_EXPORT void AddControlItem(const Handle(Standard_Transient)& item,const Standard_CString name) ; + //! Returns a control item from its name, Null if unknown
+//! To be used then, it just remains to be down-casted
+ Standard_EXPORT Handle_Standard_Transient ControlItem(const Standard_CString name) const; + //! Records the name of a Static to be traced for a given use
+ Standard_EXPORT void TraceStatic(const Standard_CString name,const Standard_Integer use) ; + //! Records a Session Item, to be added for customisation of the
+//! Work Session. It must have a specific name.
+//! is used if is a GeneralModifier, to decide
+//! to which hook list it will be applied, if not empty (else,
+//! not applied to any hook list)
+//! ACTUAL : only one hook list is managed : "send"
+//! Remark : this method is to be called at Create time, the
+//! recorded items will be used by Customise
+//! Warning : if conflicts, the last recorded item is kept
+ Standard_EXPORT void AddSessionItem(const Handle(Standard_Transient)& item,const Standard_CString name,const Standard_CString setapplied = "") ; + //! Returns an item given its name to record in a Session
+//! If is unknown, returns a Null Handle
+ Standard_EXPORT Handle_Standard_Transient SessionItem(const Standard_CString name) const; + //! Returns True if is recorded as
+ Standard_EXPORT Standard_Boolean IsApplied(const Handle(Standard_Transient)& item) const; + //! Customises a WorkSession, by adding to it the recorded items
+//! (by AddSessionItem), then by calling a specific method
+//! Customising, set by default to do nothing
+ Standard_EXPORT virtual void Customise(Handle(XSControl_WorkSession)& WS) ; + //! Specific customisation method, which can be redefined
+//! Default does nothing
+ Standard_EXPORT void Customising(Handle(XSControl_WorkSession)& WS) ; + + Standard_EXPORT Handle_Dico_DictionaryOfTransient AdaptorSession() const; + + + + + DEFINE_STANDARD_RTTI(XSControl_Controller) + +protected: + + //! Initializing with names
+//! is for the complete, official, long name
+//! is for the short name used for resources
+ Standard_EXPORT XSControl_Controller(const Standard_CString longname,const Standard_CString shortname); + +TCollection_AsciiString theShortName; +TCollection_AsciiString theLongName; +Handle_IFSelect_WorkLibrary theAdaptorLibrary; +Handle_Interface_Protocol theAdaptorProtocol; +Handle_IFSelect_Signature theSignType; +Handle_Transfer_ActorOfTransientProcess theAdaptorRead; +Handle_Transfer_ActorOfFinderProcess theAdaptorWrite; +Handle_Dico_DictionaryOfTransient theAdaptorSession; + + +private: + + +Handle_IFSelect_Profile theProfile; +Handle_Dico_DictionaryOfTransient theItems; +TColStd_SequenceOfTransient theAdaptorApplied; +Handle_TColStd_HSequenceOfHAsciiString theAdaptorHooks; +TColStd_SequenceOfTransient theParams; +TColStd_SequenceOfInteger theParamUses; +Handle_Interface_HArray1OfHAsciiString theModeWriteShapeN; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/XSControl/XSControl_FuncShape.cdl b/src/XSControl/XSControl_FuncShape.cdl index 84bf9671c7..b1f6a68459 100644 --- a/src/XSControl/XSControl_FuncShape.cdl +++ b/src/XSControl/XSControl_FuncShape.cdl @@ -28,14 +28,14 @@ class FuncShape from XSControl -- basic features from user callable forms uses CString, AsciiString from TCollection, - WorkSession from XSControl, HSequenceOfShape from TopTools + WorkSession_Handle from XSControl, HSequenceOfShape from TopTools is Init (myclass); ---Purpose : Defines and loads all functions which work on shapes for XSControl (as ActFunc) - MoreShapes (myclass; session : WorkSession from XSControl; + MoreShapes (myclass; session : WorkSession_Handle from XSControl; list : in out mutable HSequenceOfShape from TopTools; name : CString) returns Integer; ---Purpose : Analyses a name as designating Shapes from a Vars or from @@ -49,7 +49,7 @@ is -- completed (Append without Clear) by the Shapes found -- Returns 0 if no Shape could be found - FileAndVar (myclass; session : WorkSession from XSControl; + FileAndVar (myclass; session : WorkSession_Handle from XSControl; file, var, def : CString; resfile, resvar : out AsciiString from TCollection) returns Boolean; diff --git a/src/XSControl/XSControl_Functions.cxx b/src/XSControl/XSControl_Functions.cxx index d485094ca4..30f774b40e 100644 --- a/src/XSControl/XSControl_Functions.cxx +++ b/src/XSControl/XSControl_Functions.cxx @@ -42,7 +42,6 @@ //#include //#include //#include -//#include #include #include diff --git a/src/XSControl/XSControl_Reader.cdl b/src/XSControl/XSControl_Reader.cdl deleted file mode 100644 index 93ff800c90..0000000000 --- a/src/XSControl/XSControl_Reader.cdl +++ /dev/null @@ -1,251 +0,0 @@ --- Created on: 1997-05-14 --- Created by: Christian CAILLET --- Copyright (c) 1997-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 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. - -class Reader from XSControl - - ---Purpose : - -- A groundwork to convert a shape to data which complies - -- with a particular norm. This data can be that of a whole - -- model or that of a specific list of entities in the model. - -- You specify the list using a single selection or a - -- combination of selections. A selection is an operator which - -- computes a list of entities from a list given in input. To - -- specify the input, you can use: - -- - A predefined selection such as "xst-transferrable-roots" - -- - A filter based on a signature. - -- A signature is an operator which returns a string from an - -- entity according to its type. - -- For example: - -- - "xst-type" (CDL) - -- - "iges-level" - -- - "step-type". - -- A filter can be based on a signature by giving a value to - -- be matched by the string returned. For example, - -- "xst-type(Curve)". - -- If no list is specified, the selection computes its list of - -- entities from the whole model. To use this class, you have to - -- initialize the transfer norm first, as shown in the example below. - -- Example: - -- Control_Reader reader; - -- IFSelect_ReturnStatus status = reader.ReadFile (filename.); - -- When using IGESControl_Reader or STEPControl_Reader - as the - -- above example shows - the reader initializes the norm directly. - -- Note that loading the file only stores the data. It does - -- not translate this data. Shapes are accumulated by - -- successive transfers. The last shape is cleared by: - -- - ClearShapes which allows you to handle a new batch - -- - TransferRoots which restarts the list of shapes from scratch. - -uses CString, OStream, Transient, - SequenceOfTransient from TColStd, HSequenceOfTransient from TColStd, - InterfaceModel from Interface, WorkSession from XSControl, - ReturnStatus from IFSelect, PrintCount from IFSelect, - Shape from TopoDS, SequenceOfShape from TopTools - -is - - Create returns Reader; - ---Purpose : Creates a Reader from scratch (creates an empty WorkSession) - -- A WorkSession or a Controller must be provided before running - - Create (norm : CString) returns Reader; - ---Purpose : Creates a Reader from scratch, with a norm name which - -- identifies a Controller - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Reader; - ---Purpose : Creates a Reader from an already existing Session, with a - -- Controller already set - - ---Purpose: Virtual destructor - ---C++ : alias "Standard_EXPORT virtual ~XSControl_Reader() {}" - - SetNorm (me : in out; norm : CString) returns Boolean; - ---Purpose : Sets a specific norm to - -- Returns True if done, False if is not available - - SetWS (me : in out; WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True); - ---Purpose : Sets a specific session to - - WS (me) returns WorkSession from XSControl; - ---Purpose : Returns the session used in - - - ReadFile (me : in out; filename : CString) returns ReturnStatus; - ---Purpose : Loads a file and returns the read status - -- Zero for a Model which compies with the Controller - - Model (me) returns InterfaceModel; - ---Purpose : Returns the model. It can then be consulted (header, product) - - GiveList (me : in out; first, second : CString = "") - returns HSequenceOfTransient from TColStd; - ---Purpose : Returns a list of entities from the IGES or STEP file - -- according to the following rules: - -- - if first and second are empty strings, the whole file is selected. - -- - if first is an entity number or label, the entity referred to is selected. - -- - if first is a list of entity numbers/labels separated by commas, the entities referred to are selected, - -- - if first is the name of a selection in the worksession and second is not defined, - -- the list contains the standard output for that selection. - -- - if first is the name of a selection and second is defined, the criterion defined - -- by second is applied to the result of the first selection. - -- A selection is an operator which computes a list of entities from a list given in - -- input according to its type. If no list is specified, the selection computes its - -- list of entities from the whole model. - -- A selection can be: - -- - A predefined selection (xst-transferrable-mode) - -- - A filter based on a signature - -- A Signature is an operator which returns a string from an entity according to its type. For example: - -- - "xst-type" (CDL) - -- - "iges-level" - -- - "step-type". - -- For example, if you wanted to select only the advanced_faces in a STEP file you - -- would use the following code: - -- Example - -- Reader.GiveList("xst-transferrable-roots","step-type(ADVANCED_FACE)"); - -- Warning - -- If the value given to second is incorrect, it will simply be ignored. - - GiveList (me : in out; first : CString; ent : Transient) - returns HSequenceOfTransient from TColStd; - ---Purpose : Computes a List of entities from the model as follows - -- beeing a Selection, beeing an entity or a list - -- of entities (as a HSequenceOfTransient) : - -- the standard result of this selection applied to this list - -- if is erroneous, a null handle is returned - - - NbRootsForTransfer (me : in out) returns Integer is virtual ; - ---Purpose : Determines the list of root entities which are candidate for - -- a transfer to a Shape, and returns the number - -- of entities in the list - - RootForTransfer (me : in out; num : Integer = 1) returns Transient; - ---Purpose : Returns an IGES or STEP root - -- entity for translation. The entity is identified by its - -- rank in a list. - - TransferOneRoot (me : in out; num : Integer = 1) returns Boolean ; - ---Purpose : Translates a root identified by the rank num in the model. - -- false is returned if no shape is produced. - - TransferOne (me : in out; num : Integer) returns Boolean; - ---Purpose : Translates an IGES or STEP - -- entity identified by the rank num in the model. - -- false is returned if no shape is produced. - - TransferEntity (me : in out; start : Transient) returns Boolean; - ---Purpose : Translates an IGES or STEP - -- entity in the model. true is returned if a shape is - -- produced; otherwise, false is returned. - - TransferList (me : in out; list : HSequenceOfTransient from TColStd) - returns Integer; - ---Purpose : Translates a list of entities. - -- Returns the number of IGES or STEP entities that were - -- successfully translated. The list can be produced with GiveList. - -- Warning - This function does not clear the existing output shapes. - - TransferRoots (me : in out) returns Integer; - ---Purpose : Translates all translatable - -- roots and returns the number of successful translations. - -- Warning - This function clears existing output shapes first. - - - ClearShapes (me : in out); - ---Purpose : Clears the list of shapes that - -- may have accumulated in calls to TransferOne or TransferRoot.C - - NbShapes (me) returns Integer; - ---Purpose : Returns the number of shapes produced by translation. - - Shapes (me: in out) returns SequenceOfShape from TopTools is protected; - ---Purpose : Returns a sequence of produced shapes - ---C++: return & - - Shape (me; num : Integer = 1) returns Shape from TopoDS; - ---Purpose : Returns the shape resulting - -- from a translation and identified by the rank num. - -- num equals 1 by default. In other words, the first shape - -- resulting from the translation is returned. - - OneShape (me) returns Shape from TopoDS; - ---Purpose : Returns all of the results in - -- a single shape which is: - -- - a null shape if there are no results, - -- - a shape if there is one result, - -- - a compound containing the resulting shapes if there are more than one. - - PrintCheckLoad (me; failsonly : Boolean; mode : PrintCount); - ---Purpose : Prints the check list attached to loaded data, on the Standard - -- Trace File (starts at cout) - -- All messages or fails only, according to - -- mode = 0 : per entity, prints messages - -- mode = 1 : per message, just gives count of entities per check - -- mode = 2 : also gives entity numbers - - PrintCheckTransfer (me; failsonly : Boolean; mode : PrintCount); - ---Purpose : Displays check results for the - -- last translation of IGES or STEP entities to Open CASCADE - -- entities. Only fail messages are displayed if failsonly is - -- true. All messages are displayed if failsonly is - -- false. mode determines the contents and the order of the - -- messages according to the terms of the IFSelect_PrintCount enumeration. - - PrintStatsTransfer (me; what : Integer; mode : Integer = 0); - ---Purpose : Displays the statistics for - -- the last translation. what defines the kind of - -- statistics that are displayed as follows: - -- - 0 gives general statistics (number of translated roots, - -- number of warnings, number of fail messages), - -- - 1 gives root results, - -- - 2 gives statistics for all checked entities, - -- - 3 gives the list of translated entities, - -- - 4 gives warning and fail messages, - -- - 5 gives fail messages only. - -- The use of mode depends on the value of what. If what is 0, - -- mode is ignored. If what is 1, 2 or 3, mode defines the following: - -- - 0 lists the numbers of IGES or STEP entities in the respective model - -- - 1 gives the number, identifier, type and result - -- type for each IGES or STEP entity and/or its status - -- (fail, warning, etc.) - -- - 2 gives maximum information for each IGES or STEP entity (i.e. checks) - -- - 3 gives the number of entities per type of IGES or STEP entity - -- - 4 gives the number of IGES or STEP entities per result type and/or status - -- - 5 gives the number of pairs (IGES or STEP or result type and status) - -- - 6 gives the number of pairs (IGES or STEP or result type - -- and status) AND the list of entity numbers in the IGES or STEP model. - -- If what is 4 or 5, mode defines the warning and fail - -- messages as follows: - -- - if mode is 0 all warnings and checks per entity are returned - -- - if mode is 2 the list of entities per warning is returned. - -- If mode is not set, only the list of all entities per warning is given. - - GetStatsTransfer (me; list: HSequenceOfTransient from TColStd; - nbMapped : out Integer; - nbWithResult: out Integer; - nbWithFail : out Integer); - ---Purpose: Gives statistics about Transfer - -fields - - thesession : WorkSession from XSControl; - therootsta : Boolean is protected; -- are roots determined - theroots : SequenceOfTransient is protected; -- only roots available for Transfer - theshapes : SequenceOfShape; - -end Reader; diff --git a/src/XSControl/XSControl_Reader.cxx b/src/XSControl/XSControl_Reader.cxx index b5c4db990d..6d5a68121b 100644 --- a/src/XSControl/XSControl_Reader.cxx +++ b/src/XSControl/XSControl_Reader.cxx @@ -13,7 +13,7 @@ // pdn 26.02.99 added initializing of compound in function OneShape //: gka 14.04.99: S4136: apply scaling -#include +#include #include #include #include @@ -25,14 +25,16 @@ #include #include #include -//#include #include #include #include - - -//#include -//#include +#include +#include +#include +#include +#include +#include +#include //======================================================================= diff --git a/src/XSControl/XSControl_Reader.hxx b/src/XSControl/XSControl_Reader.hxx new file mode 100644 index 0000000000..14c1626272 --- /dev/null +++ b/src/XSControl/XSControl_Reader.hxx @@ -0,0 +1,238 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_Reader_HeaderFile +#define _XSControl_Reader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class Interface_InterfaceModel; +class TColStd_HSequenceOfTransient; +class Standard_Transient; +class TopTools_SequenceOfShape; +class TopoDS_Shape; + + + +//! A groundwork to convert a shape to data which complies
+//! with a particular norm. This data can be that of a whole
+//! model or that of a specific list of entities in the model.
+//! You specify the list using a single selection or a
+//! combination of selections. A selection is an operator which
+//! computes a list of entities from a list given in input. To
+//! specify the input, you can use:
+//! - A predefined selection such as "xst-transferrable-roots"
+//! - A filter based on a signature.
+//! A signature is an operator which returns a string from an
+//! entity according to its type.
+//! For example:
+//! - "xst-type" (CDL)
+//! - "iges-level"
+//! - "step-type".
+//! A filter can be based on a signature by giving a value to
+//! be matched by the string returned. For example,
+//! "xst-type(Curve)".
+//! If no list is specified, the selection computes its list of
+//! entities from the whole model. To use this class, you have to
+//! initialize the transfer norm first, as shown in the example below.
+//! Example:
+//! Control_Reader reader;
+//! IFSelect_ReturnStatus status = reader.ReadFile (filename.);
+//! When using IGESControl_Reader or STEPControl_Reader - as the
+//! above example shows - the reader initializes the norm directly.
+//! Note that loading the file only stores the data. It does
+//! not translate this data. Shapes are accumulated by
+//! successive transfers. The last shape is cleared by:
+//! - ClearShapes which allows you to handle a new batch
+//! - TransferRoots which restarts the list of shapes from scratch.
+class XSControl_Reader { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a Reader from scratch (creates an empty WorkSession)
+//! A WorkSession or a Controller must be provided before running
+ Standard_EXPORT XSControl_Reader(); + //! Creates a Reader from scratch, with a norm name which
+//! identifies a Controller
+ Standard_EXPORT XSControl_Reader(const Standard_CString norm); + //! Creates a Reader from an already existing Session, with a
+//! Controller already set
//! Virtual destructor
+ Standard_EXPORT XSControl_Reader(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); +Standard_EXPORT virtual ~XSControl_Reader() {} + //! Sets a specific norm to
+//! Returns True if done, False if is not available
+ Standard_EXPORT Standard_Boolean SetNorm(const Standard_CString norm) ; + //! Sets a specific session to
+ Standard_EXPORT void SetWS(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ; + //! Returns the session used in
+ Standard_EXPORT Handle_XSControl_WorkSession WS() const; + //! Loads a file and returns the read status
+//! Zero for a Model which compies with the Controller
+ Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString filename) ; + //! Returns the model. It can then be consulted (header, product)
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + //! Returns a list of entities from the IGES or STEP file
+//! according to the following rules:
+//! - if first and second are empty strings, the whole file is selected.
+//! - if first is an entity number or label, the entity referred to is selected.
+//! - if first is a list of entity numbers/labels separated by commas, the entities referred to are selected,
+//! - if first is the name of a selection in the worksession and second is not defined,
+//! the list contains the standard output for that selection.
+//! - if first is the name of a selection and second is defined, the criterion defined
+//! by second is applied to the result of the first selection.
+//! A selection is an operator which computes a list of entities from a list given in
+//! input according to its type. If no list is specified, the selection computes its
+//! list of entities from the whole model.
+//! A selection can be:
+//! - A predefined selection (xst-transferrable-mode)
+//! - A filter based on a signature
+//! A Signature is an operator which returns a string from an entity according to its type. For example:
+//! - "xst-type" (CDL)
+//! - "iges-level"
+//! - "step-type".
+//! For example, if you wanted to select only the advanced_faces in a STEP file you
+//! would use the following code:
+//! Example
+//! Reader.GiveList("xst-transferrable-roots","step-type(ADVANCED_FACE)");
+//! Warning
+//! If the value given to second is incorrect, it will simply be ignored.
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient GiveList(const Standard_CString first = "",const Standard_CString second = "") ; + //! Computes a List of entities from the model as follows
+//! beeing a Selection, beeing an entity or a list
+//! of entities (as a HSequenceOfTransient) :
+//! the standard result of this selection applied to this list
+//! if is erroneous, a null handle is returned
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient GiveList(const Standard_CString first,const Handle(Standard_Transient)& ent) ; + //! Determines the list of root entities which are candidate for
+//! a transfer to a Shape, and returns the number
+//! of entities in the list
+ Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() ; + //! Returns an IGES or STEP root
+//! entity for translation. The entity is identified by its
+//! rank in a list.
+ Standard_EXPORT Handle_Standard_Transient RootForTransfer(const Standard_Integer num = 1) ; + //! Translates a root identified by the rank num in the model.
+//! false is returned if no shape is produced.
+ Standard_EXPORT Standard_Boolean TransferOneRoot(const Standard_Integer num = 1) ; + //! Translates an IGES or STEP
+//! entity identified by the rank num in the model.
+//! false is returned if no shape is produced.
+ Standard_EXPORT Standard_Boolean TransferOne(const Standard_Integer num) ; + //! Translates an IGES or STEP
+//! entity in the model. true is returned if a shape is
+//! produced; otherwise, false is returned.
+ Standard_EXPORT Standard_Boolean TransferEntity(const Handle(Standard_Transient)& start) ; + //! Translates a list of entities.
+//! Returns the number of IGES or STEP entities that were
+//! successfully translated. The list can be produced with GiveList.
+//! Warning - This function does not clear the existing output shapes.
+ Standard_EXPORT Standard_Integer TransferList(const Handle(TColStd_HSequenceOfTransient)& list) ; + //! Translates all translatable
+//! roots and returns the number of successful translations.
+//! Warning - This function clears existing output shapes first.
+ Standard_EXPORT Standard_Integer TransferRoots() ; + //! Clears the list of shapes that
+//! may have accumulated in calls to TransferOne or TransferRoot.C
+ Standard_EXPORT void ClearShapes() ; + //! Returns the number of shapes produced by translation.
+ Standard_EXPORT Standard_Integer NbShapes() const; + //! Returns the shape resulting
+//! from a translation and identified by the rank num.
+//! num equals 1 by default. In other words, the first shape
+//! resulting from the translation is returned.
+ Standard_EXPORT TopoDS_Shape Shape(const Standard_Integer num = 1) const; + //! Returns all of the results in
+//! a single shape which is:
+//! - a null shape if there are no results,
+//! - a shape if there is one result,
+//! - a compound containing the resulting shapes if there are more than one.
+ Standard_EXPORT TopoDS_Shape OneShape() const; + //! Prints the check list attached to loaded data, on the Standard
+//! Trace File (starts at cout)
+//! All messages or fails only, according to
+//! mode = 0 : per entity, prints messages
+//! mode = 1 : per message, just gives count of entities per check
+//! mode = 2 : also gives entity numbers
+ Standard_EXPORT void PrintCheckLoad(const Standard_Boolean failsonly,const IFSelect_PrintCount mode) const; + //! Displays check results for the
+//! last translation of IGES or STEP entities to Open CASCADE
+//! entities. Only fail messages are displayed if failsonly is
+//! true. All messages are displayed if failsonly is
+//! false. mode determines the contents and the order of the
+//! messages according to the terms of the IFSelect_PrintCount enumeration.
+ Standard_EXPORT void PrintCheckTransfer(const Standard_Boolean failsonly,const IFSelect_PrintCount mode) const; + //! Displays the statistics for
+//! the last translation. what defines the kind of
+//! statistics that are displayed as follows:
+//! - 0 gives general statistics (number of translated roots,
+//! number of warnings, number of fail messages),
+//! - 1 gives root results,
+//! - 2 gives statistics for all checked entities,
+//! - 3 gives the list of translated entities,
+//! - 4 gives warning and fail messages,
+//! - 5 gives fail messages only.
+//! The use of mode depends on the value of what. If what is 0,
+//! mode is ignored. If what is 1, 2 or 3, mode defines the following:
+//! - 0 lists the numbers of IGES or STEP entities in the respective model
+//! - 1 gives the number, identifier, type and result
+//! type for each IGES or STEP entity and/or its status
+//! (fail, warning, etc.)
+//! - 2 gives maximum information for each IGES or STEP entity (i.e. checks)
+//! - 3 gives the number of entities per type of IGES or STEP entity
+//! - 4 gives the number of IGES or STEP entities per result type and/or status
+//! - 5 gives the number of pairs (IGES or STEP or result type and status)
+//! - 6 gives the number of pairs (IGES or STEP or result type
+//! and status) AND the list of entity numbers in the IGES or STEP model.
+//! If what is 4 or 5, mode defines the warning and fail
+//! messages as follows:
+//! - if mode is 0 all warnings and checks per entity are returned
+//! - if mode is 2 the list of entities per warning is returned.
+//! If mode is not set, only the list of all entities per warning is given.
+ Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,const Standard_Integer mode = 0) const; + //! Gives statistics about Transfer
+ Standard_EXPORT void GetStatsTransfer(const Handle(TColStd_HSequenceOfTransient)& list,Standard_Integer& nbMapped,Standard_Integer& nbWithResult,Standard_Integer& nbWithFail) const; + +protected: + //! Returns a sequence of produced shapes
+ Standard_EXPORT TopTools_SequenceOfShape& Shapes(); + + Standard_Boolean therootsta; + TColStd_SequenceOfTransient theroots; + +private: + + Handle_XSControl_WorkSession thesession; + TopTools_SequenceOfShape theshapes; + + +}; +#endif diff --git a/src/XSControl/XSControl_SelectForTransfer.cdl b/src/XSControl/XSControl_SelectForTransfer.cdl deleted file mode 100644 index f567a0d004..0000000000 --- a/src/XSControl/XSControl_SelectForTransfer.cdl +++ /dev/null @@ -1,79 +0,0 @@ --- Created on: 1996-03-26 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class SelectForTransfer from XSControl inherits SelectExtract from IFSelect - - ---Purpose : This selection selects the entities which are recognised for - -- transfer by an Actor for Read : current one or another one. - -- - -- An Actor is an operator which runs transfers from interface - -- entities to objects for Imagine. It has a method to recognize - -- the entities it can process (by default, it recognises all, - -- this method can be redefined). - -- - -- A TransferReader brings an Actor, according to the currently - -- selected norm and transfer conditions. - -- - -- This selection considers, either the current Actor (brought by - -- the TransferReader, updated as required), or a precise one. - -uses AsciiString from TCollection, InterfaceModel, - ActorOfTransientProcess, TransferReader - -is - - Create returns mutable SelectForTransfer; - ---Purpose : Creates a SelectForTransfer, non initialised - -- it sorts nothing, unless an Actor has been defined - - Create (TR : TransferReader) returns mutable SelectForTransfer; - ---Purpose : Creates a SelectForTransfer, which will work with the - -- currently defined Actor brought by the TransferReader - - SetReader (me : mutable; TR : TransferReader); - ---Purpose : Sets a TransferReader to sort entities : it brings the Actor, - -- which may change, while the TransferReader does not - - SetActor (me : mutable; act : mutable ActorOfTransientProcess); - ---Purpose : Sets a precise actor to sort entities - -- This definition oversedes the creation with a TransferReader - - Actor (me) returns ActorOfTransientProcess; - ---Purpose : Returns the Actor used as precised one. - -- Returns a Null Handle for a creation from a TransferReader - -- without any further setting - - Reader (me) returns TransferReader; - ---Purpose : Returns the Reader (if created with a Reader) - -- Returns a Null Handle if not created with a Reader - - - Sort (me; rank : Integer; ent : Transient; model : InterfaceModel) - returns Boolean; - ---Purpose : Returns True for an Entity which is recognized by the Actor, - -- either the precised one, or the one defined by TransferReader - - --Sort (me; ent : in out Transient) returns Boolean; - - ExtractLabel (me) returns AsciiString from TCollection; - ---Purpose : Returns a text defining the criterium : "Recognized for Transfer [(current actor)]" - -fields - - theTR : TransferReader; - theAC : ActorOfTransientProcess; - -end SelectForTransfer; diff --git a/src/XSControl/XSControl_SelectForTransfer.cxx b/src/XSControl/XSControl_SelectForTransfer.cxx index 7a0fefec6b..53f72c140e 100644 --- a/src/XSControl/XSControl_SelectForTransfer.cxx +++ b/src/XSControl/XSControl_SelectForTransfer.cxx @@ -11,7 +11,29 @@ // 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 + +IMPLEMENT_STANDARD_TYPE(XSControl_SelectForTransfer) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_SelectExtract), + STANDARD_TYPE(IFSelect_SelectDeduct), + STANDARD_TYPE(IFSelect_Selection), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_SelectForTransfer) + + +IMPLEMENT_DOWNCAST(XSControl_SelectForTransfer,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_SelectForTransfer) XSControl_SelectForTransfer::XSControl_SelectForTransfer () { } diff --git a/src/XSControl/XSControl_SelectForTransfer.hxx b/src/XSControl/XSControl_SelectForTransfer.hxx new file mode 100644 index 0000000000..e7bd4ef2a7 --- /dev/null +++ b/src/XSControl/XSControl_SelectForTransfer.hxx @@ -0,0 +1,112 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_SelectForTransfer_HeaderFile +#define _XSControl_SelectForTransfer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_TransferReader; +class Transfer_ActorOfTransientProcess; +class Standard_Transient; +class Interface_InterfaceModel; +class TCollection_AsciiString; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class Handle(IFSelect_SelectExtract); + +DEFINE_STANDARD_HANDLE(XSControl_SelectForTransfer,IFSelect_SelectExtract) + +//! This selection selects the entities which are recognised for
+//! transfer by an Actor for Read : current one or another one.
+//!
+//! An Actor is an operator which runs transfers from interface
+//! entities to objects for Imagine. It has a method to recognize
+//! the entities it can process (by default, it recognises all,
+//! this method can be redefined).
+//!
+//! A TransferReader brings an Actor, according to the currently
+//! selected norm and transfer conditions.
+//!
+//! This selection considers, either the current Actor (brought by
+//! the TransferReader, updated as required), or a precise one.
+class XSControl_SelectForTransfer : public IFSelect_SelectExtract { + +public: + + //! Creates a SelectForTransfer, non initialised
+//! it sorts nothing, unless an Actor has been defined
+ Standard_EXPORT XSControl_SelectForTransfer(); + //! Creates a SelectForTransfer, which will work with the
+//! currently defined Actor brought by the TransferReader
+ Standard_EXPORT XSControl_SelectForTransfer(const Handle(XSControl_TransferReader)& TR); + //! Sets a TransferReader to sort entities : it brings the Actor,
+//! which may change, while the TransferReader does not
+ Standard_EXPORT void SetReader(const Handle(XSControl_TransferReader)& TR) ; + //! Sets a precise actor to sort entities
+//! This definition oversedes the creation with a TransferReader
+ Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfTransientProcess)& act) ; + //! Returns the Actor used as precised one.
+//! Returns a Null Handle for a creation from a TransferReader
+//! without any further setting
+ Standard_EXPORT Handle_Transfer_ActorOfTransientProcess Actor() const; + //! Returns the Reader (if created with a Reader)
+//! Returns a Null Handle if not created with a Reader
+ Standard_EXPORT Handle_XSControl_TransferReader Reader() const; + //! Returns True for an Entity which is recognized by the Actor,
+//! either the precised one, or the one defined by TransferReader
+ Standard_EXPORT Standard_Boolean Sort(const Standard_Integer rank,const Handle(Standard_Transient)& ent,const Handle(Interface_InterfaceModel)& model) const; + //! Returns a text defining the criterium : "Recognized for Transfer [(current actor)]"
+ Standard_EXPORT TCollection_AsciiString ExtractLabel() const; + + + + + DEFINE_STANDARD_RTTI(XSControl_SelectForTransfer) + +protected: + + + + +private: + + +Handle_XSControl_TransferReader theTR; +Handle_Transfer_ActorOfTransientProcess theAC; + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/XSControl/XSControl_SignTransferStatus.cdl b/src/XSControl/XSControl_SignTransferStatus.cdl deleted file mode 100644 index 6c1256c824..0000000000 --- a/src/XSControl/XSControl_SignTransferStatus.cdl +++ /dev/null @@ -1,72 +0,0 @@ --- Created on: 1998-07-31 --- 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 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. - -class SignTransferStatus from XSControl inherits Signature from IFSelect - - ---Purpose : This Signatures gives the Transfer Status of an entity, as - -- recorded in a TransferProcess. It can be : - -- - Void : not recorded, or recorded as void with no message - -- (attributes are not taken into account) - -- - Warning : no result, warning message(s), no fail - -- - Fail : no result, fail messages (with or without warning) - -- - Result.. : result, no message (neither warning nor fail) - -- Result.. i.e. Result:TypeName of the result - -- - Result../Warning : result, with warning but no fail - -- - Result../Fail : result, with fail (.e. bad result) - -- - Fail on run : no result yet recorded, no message, but - -- an exception occurred while recording the result - -- (this should not appear and indicates a programming error) - -uses CString, Transient, InterfaceModel, - TransientProcess, TransferReader - -is - - Create returns mutable SignTransferStatus; - ---Purpose : Creates a SignTransferStatus, not initialised - -- it gives nothing (empty string) - - Create (TR : TransferReader) returns mutable SignTransferStatus; - ---Purpose : Creates a SignTransferStatus, which will work on the current - -- TransientProcess brought by the TransferReader (its MapReader) - - SetReader (me : mutable; TR : TransferReader); - ---Purpose : Sets a TransferReader to work - - SetMap (me : mutable; TP : TransientProcess); - ---Purpose : Sets a precise map to sign entities - -- This definition oversedes the creation with a TransferReader - - Map (me) returns TransientProcess; - ---Purpose : Returns the TransientProcess used as precised one - -- Returns a Null Handle for a creation from a TransferReader - -- without any further setting - - Reader (me) returns TransferReader; - ---Purpose : Returns the Reader (if created with a Reader) - -- Returns a Null Handle if not created with a Reader - - - Value (me; ent : any Transient; model : InterfaceModel) returns CString; - ---Purpose : Returns the Signature for a Transient object, as its transfer - -- status - -fields - - theTR : TransferReader; - theTP : TransientProcess; - -end SignTransferStatus; diff --git a/src/XSControl/XSControl_SignTransferStatus.cxx b/src/XSControl/XSControl_SignTransferStatus.cxx index 7c7626e43e..eead9e2b0e 100644 --- a/src/XSControl/XSControl_SignTransferStatus.cxx +++ b/src/XSControl/XSControl_SignTransferStatus.cxx @@ -11,11 +11,28 @@ // 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 + +IMPLEMENT_STANDARD_TYPE(XSControl_SignTransferStatus) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_Signature), + STANDARD_TYPE(Interface_SignType), + STANDARD_TYPE(MoniTool_SignText), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_SignTransferStatus) + + +IMPLEMENT_DOWNCAST(XSControl_SignTransferStatus,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_SignTransferStatus) static TCollection_AsciiString& themes() { diff --git a/src/XSControl/XSControl_SignTransferStatus.hxx b/src/XSControl/XSControl_SignTransferStatus.hxx new file mode 100644 index 0000000000..91735875d8 --- /dev/null +++ b/src/XSControl/XSControl_SignTransferStatus.hxx @@ -0,0 +1,85 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_SignTransferStatus_HeaderFile +#define _XSControl_SignTransferStatus_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class Interface_InterfaceModel; +class Handle(Standard_Type); +class Handle(IFSelect_Signature); +class XSControl_SignTransferStatus; + +DEFINE_STANDARD_HANDLE(XSControl_SignTransferStatus,IFSelect_Signature) + +//! This Signatures gives the Transfer Status of an entity, as
+//! recorded in a TransferProcess. It can be :
+//! - Void : not recorded, or recorded as void with no message
+//! (attributes are not taken into account)
+//! - Warning : no result, warning message(s), no fail
+//! - Fail : no result, fail messages (with or without warning)
+//! - Result.. : result, no message (neither warning nor fail)
+//! Result.. i.e. Result:TypeName of the result
+//! - Result../Warning : result, with warning but no fail
+//! - Result../Fail : result, with fail (.e. bad result)
+//! - Fail on run : no result yet recorded, no message, but
+//! an exception occurred while recording the result
+//! (this should not appear and indicates a programming error)
+class XSControl_SignTransferStatus : public IFSelect_Signature +{ +public: + + //! Creates a SignTransferStatus, not initialised
+ //! it gives nothing (empty string)
+ Standard_EXPORT XSControl_SignTransferStatus(); + //! Creates a SignTransferStatus, which will work on the current
+ //! TransientProcess brought by the TransferReader (its MapReader)
+ Standard_EXPORT XSControl_SignTransferStatus(const Handle(XSControl_TransferReader)& TR); + //! Sets a TransferReader to work
+ Standard_EXPORT void SetReader(const Handle(XSControl_TransferReader)& TR) ; + //! Sets a precise map to sign entities
+ //! This definition oversedes the creation with a TransferReader
+ Standard_EXPORT void SetMap(const Handle(Transfer_TransientProcess)& TP) ; + //! Returns the TransientProcess used as precised one
+ //! Returns a Null Handle for a creation from a TransferReader
+ //! without any further setting
+ Standard_EXPORT Handle(Transfer_TransientProcess) Map() const; + //! Returns the Reader (if created with a Reader)
+ //! Returns a Null Handle if not created with a Reader
+ Standard_EXPORT Handle(XSControl_TransferReader) Reader() const; + //! Returns the Signature for a Transient object, as its transfer
+ //! status
+ Standard_EXPORT Standard_CString Value(const Handle(Standard_Transient)& ent, + const Handle(Interface_InterfaceModel)& model) const; + + DEFINE_STANDARD_RTTI(XSControl_SignTransferStatus) + +private: + + Handle(XSControl_TransferReader) theTR; + Handle(Transfer_TransientProcess) theTP; +}; +#endif diff --git a/src/XSControl/XSControl_TransferReader.cdl b/src/XSControl/XSControl_TransferReader.cdl deleted file mode 100644 index c08f6de899..0000000000 --- a/src/XSControl/XSControl_TransferReader.cdl +++ /dev/null @@ -1,358 +0,0 @@ --- Created on: 1995-12-05 --- Created by: Christian CAILLET --- 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 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. - -class TransferReader from XSControl inherits TShared - - ---Purpose : A TransferReader performs, manages, handles results of, - -- transfers done when reading a file (i.e. from entities of an - -- InterfaceModel, to objects for Imagine) - -- - -- Running is organised around basic tools : TransientProcess and - -- its Actor, results are Binders and CheckIterators. It implies - -- control by a Controller (which prepares the Actor as required) - -- - -- Getting results can be done directly on TransientProcess, but - -- these are immediate "last produced" results. Each transfer of - -- an entity gives a final result, but also possible intermediate - -- data, and checks, which can be attached to sub-entities. - -- - -- Hence, final results (which intermediates and checks) are - -- recorded as ResultFromModel and can be queried individually. - -- - -- Some more direct access are given for results which are - -- Transient or Shapes - -uses CString, AsciiString, Transient, - DataMapOfIntegerTransient, HSequenceOfTransient, DictionaryOfTransient, - InterfaceModel, CheckIterator, Graph, HGraph, - TransientProcess, ActorOfTransientProcess, Binder, ResultFromModel, - CheckStatus from Interface, Controller from XSControl, - Shape from TopoDS, HSequenceOfShape from TopTools - -is - - Create returns mutable TransferReader; - ---Purpose : Creates a TransferReader, empty - - -- General Management -- - - SetController (me : mutable; control : mutable Controller from XSControl); - ---Purpose : Sets a Controller. It is required to generate the Actor. - -- Elsewhere, the Actor must be provided directly - - SetActor (me : mutable; actor : mutable ActorOfTransientProcess); - ---Purpose : Sets the Actor directly : this value will be used if the - -- Controller is not set - - Actor (me : mutable) returns mutable ActorOfTransientProcess; - ---Purpose : Returns the Actor, determined by the Controller, or if this - -- one is unknown, directly set. - -- Once it has been defined, it can then be edited. - - SetModel (me : mutable; model : InterfaceModel); - ---Purpose : Sets an InterfaceModel. This causes former results, computed - -- from another one, to be lost (see also Clear) - - SetGraph (me : mutable; graph : HGraph); - ---Purpose : Sets a Graph and its InterfaceModel (calls SetModel) - - Model (me) returns InterfaceModel; - ---Purpose : Returns the currently set InterfaceModel - - SetContext (me : mutable; name : CString; ctx : Transient); - ---Purpose : Sets a Context : according to receiving appli, to be - -- interpreted by the Actor - - GetContext (me; name : CString; type : Type; ctx : out Transient) - returns Boolean; - ---Purpose : Returns the Context attached to a name, if set and if it is - -- Kind of the type, else a Null Handle - -- Returns True if OK, False if no Context - - Context (me : mutable) returns DictionaryOfTransient; - ---Purpose : Returns (modifiable) the whole definition of Context - -- Rather for internal use (ex.: preparing and setting in once) - ---C++ : return & - - SetFileName (me : mutable; name : CString); - ---Purpose : Sets a new value for (loaded) file name - - FileName (me) returns CString; - ---Purpose : Returns actual value of file name - - Clear (me : mutable; mode : Integer); - ---Purpose : Clears data, according mode : - -- -1 all - -- 0 nothing done - -- +1 final results - -- +2 working data (model, context, transfer process) - - TransientProcess (me) returns mutable TransientProcess; - ---Purpose : Returns the currently used TransientProcess - -- It is computed from the model by TransferReadRoots, or by - -- BeginTransferRead - - SetTransientProcess (me : mutable; TP : mutable TransientProcess); - ---Purpose : Forces the TransientProcess - -- Remark : it also changes the Model and the Actor, from those - -- recorded in the new TransientProcess - - - -- Recording and Querying Results -- - -- these methods work mainly on recorded data - -- i.e. they don't need Controller and Actor - - RecordResult (me : mutable; ent : Transient) returns Boolean; - ---Purpose : Records a final result of transferring an entity - -- This result is recorded as a ResultFromModel, taken from - -- the TransientProcess - -- Returns True if a result is available, False else - - IsRecorded (me; ent : Transient) returns Boolean; - ---Purpose : Returns True if a final result is recorded for an entity - -- Remark that it can bring no effective result if transfer has - -- completely failed (FinalResult brings only fail messages ...) - - HasResult (me; ent : Transient) returns Boolean; - ---Purpose : Returns True if a final result is recorded AND BRINGS AN - -- EFFECTIVE RESULT (else, it brings only fail messages) - - RecordedList (me) returns HSequenceOfTransient; - ---Purpose : Returns the list of entities to which a final result is - -- attached (i.e. processed by RecordResult) - - Skip (me : mutable; ent : Transient) returns Boolean; - ---Purpose : Note that an entity has been required for transfer but no - -- result at all is available (typically : case not implemented) - -- It is not an error, but it gives a specific status : Skipped - -- Returns True if done, False if is not in starting model - - IsSkipped (me; ent : Transient) returns Boolean; - ---Purpose : Returns True if an entity is noted as skipped - - IsMarked (me; ent : Transient) returns Boolean; - ---Purpose : Returns True if an entity has been asked for transfert, hence - -- it is marked, as : Recorded (a computation has ran, with or - -- without an effective result), or Skipped (case ignored) - - - FinalResult (me; ent : Transient) returns ResultFromModel; - ---Purpose : Returns the final result recorded for an entity, as such - - FinalEntityLabel (me; ent : Transient) returns CString; - ---Purpose : Returns the label attached to an entity recorded for final, - -- or an empty string if not recorded - - FinalEntityNumber (me; ent : Transient) returns Integer; - ---Purpose : Returns the number attached to the entity recorded for final, - -- or zero if not recorded (looks in the ResultFromModel) - - ResultFromNumber (me; num : Integer) returns ResultFromModel; - ---Purpose : Returns the final result recorded for a NUMBER of entity - -- (internal use). Null if out of range - - TransientResult (me; ent : Transient) returns mutable Transient; - ---Purpose : Returns the resulting object as a Transient - -- Null Handle if no result or result not transient - - ShapeResult (me; ent : Transient) returns Shape from TopoDS; - ---Purpose : Returns the resulting object as a Shape - -- Null Shape if no result or result not a shape - - ClearResult (me : mutable; ent : Transient; mode : Integer) returns Boolean; - ---Purpose : Clears recorded result for an entity, according mode - -- = -1 : true, complete, clearing (erasing result) - -- >= 0 : simple "stripping", see ResultFromModel, - -- in particular, 0 for simple internal strip, - -- 10 for all but final result, - -- 11 for all : just label, status and filename are kept - -- Returns True when done, False if nothing was to clear - - - EntityFromResult (me; res : Transient; mode : Integer=0) returns Transient; - ---Purpose : Returns an entity from which a given result was produced. - -- If = 0 (D), searches in last root transfers - -- If = 1, searches in last (root & sub) transfers - -- If = 2, searches in root recorded results - -- If = 3, searches in all (root & sub) recordeds - -- can be, either a transient object (result itself) or - -- a binder. For a binder of shape, calls EntityFromShapeResult - -- Returns a Null Handle if not recorded - - EntityFromShapeResult (me; res : Shape from TopoDS; mode : Integer=0) - returns Transient; - ---Purpose : Returns an entity from which a given shape result was produced - -- Returns a Null Handle if not recorded or not a Shape - - EntitiesFromShapeList (me; res : HSequenceOfShape from TopTools; mode : Integer = 0) - returns HSequenceOfTransient from TColStd; - ---Purpose : Returns the list of entities from which some shapes were - -- produced : it corresponds to a loop on EntityFromShapeResult, - -- but is optimised - - - CheckList (me; ent : Transient; level : Integer = 0) returns CheckIterator; - ---Purpose : Returns the CheckList resulting from transferring , i.e. - -- stored in its recorded form ResultFromModel - -- (empty if transfer successful or not recorded ...) - -- - -- If is the Model, returns the complete cumulated - -- check-list, is ignored - -- - -- If is an entity of the Model, applies as follows - -- : -1 for only, LAST transfer (TransientProcess) - -- : 0 for only (D) - -- 1 for and its immediate subtransfers, if any - -- 2 for and subtransferts at all levels - - HasChecks (me; ent : Transient; failsonly : Boolean) returns Boolean; - ---Purpose : Returns True if an entity (with a final result) has checks : - -- - failsonly = False : any kind of check message - -- - failsonly = True : fails only - -- Returns False if is not recorded - - CheckedList (me; ent : Transient; - withcheck : CheckStatus = Interface_CheckAny; result : Boolean = Standard_True) - returns HSequenceOfTransient; - ---Purpose : Returns the list of starting entities to which a given check - -- status is attached, IN FINAL RESULTS - -- can be an entity, or the model to query all entities - -- Below, "entities" are, either plus its sub-transferred, - -- or all the entities of the model - -- - -- = -2 , all entities whatever the check (see result) - -- = -1 , entities with no fail (warning allowed) - -- = 0 , entities with no check at all - -- = 1 , entities with warning but no fail - -- = 2 , entities with fail - -- : if True, only entities with an attached result - -- Remark : result True and check=0 will give an empty list - - -- Actions for Transfer (Read) -- - - BeginTransfer (me : mutable) returns Boolean; - ---Purpose : Defines a new TransferProcess for reading transfer - -- Returns True if done, False if data are not properly defined - -- (the Model, the Actor for Read) - - Recognize (me : mutable; ent : Transient) returns Boolean; - ---Purpose : Tells if an entity is recognized as a valid candidate for - -- Transfer. Calls method Recognize from the Actor (if known) - - TransferOne (me : mutable; ent : Transient; - rec : Boolean = Standard_True) returns Integer; - ---Purpose : Commands the transfer on reading for an entity to data for - -- Imagine, using the selected Actor for Read - -- Returns count of transferred entities, ok or with fails (0/1) - -- If is True (D), the result is recorded by RecordResult - - TransferList (me : mutable; list : HSequenceOfTransient; - rec : Boolean = Standard_True) returns Integer; - ---Purpose : Commands the transfer on reading for a list of entities to - -- data for Imagine, using the selected Actor for Read - -- Returns count of transferred entities, ok or with fails (0/1) - -- If is True (D), the results are recorded by RecordResult - - TransferRoots (me : mutable; G : Graph) returns Integer; - ---Purpose : Transfers the content of the current Interface Model to - -- data handled by Imagine, starting from its Roots (determined - -- by the Graph ), using the selected Actor for Read - -- Returns the count of performed root transfers (i.e. 0 if none) - -- or -1 if no actor is defined - - TransferClear (me : mutable; ent : Transient; level : Integer = 0); - ---Purpose : Clears the results attached to an entity - -- if equates the starting model, clears all results - - PrintStats (me; what : Integer; mode : Integer = 0); - ---Purpose : Prints statistics on current Trace File, according and - -- . See PrintStatsProcess for details - - -- Querying last transfer (i.e. TransientProcess) -- - - LastCheckList (me) returns CheckIterator; - ---Purpose : Returns the CheckList resulting from last TransferRead - -- i.e. from TransientProcess itself, recorded from last Clear - - LastTransferList (me; roots : Boolean) returns HSequenceOfTransient; - ---Purpose : Returns the list of entities recorded as lastly transferred - -- i.e. from TransientProcess itself, recorded from last Clear - -- If is True , considers only roots of transfer - -- If is False, considers all entities bound with result - - ShapeResultList (me : mutable; rec : Boolean) - returns HSequenceOfShape from TopTools; - ---Purpose : Returns a list of result Shapes - -- If is True , sees RecordedList - -- If is False, sees LastTransferList (last ROOT transfers) - -- For each one, if it is a Shape, it is cumulated to the list - -- If no Shape is found, returns an empty Sequence - - PrintStatsProcess (myclass; TP : TransientProcess; - what : Integer; mode : Integer = 0); - ---Purpose : This routines prints statistics about a TransientProcess - -- It can be called, by a TransferReader, or isolately - -- Prints are done on the default trace file - -- defines what kind of statistics are to be printed : - -- 0 : basic figures - -- 1 : root results - -- 2 : all recorded (roots, intermediate, checked entities) - -- 3 : abnormal records - -- 4 : check messages (warnings and fails) - -- 5 : fail messages - -- - -- is used according : - -- = 0 : is ignored - -- = 1,2,3 : as follows : - -- 0 (D) : just lists numbers of concerned entities in the model - -- 1 : for each entity, gives number,label, type and result - -- type and/or status (fail/warning...) - -- 2 : for each entity, gives maximal information (i.e. checks) - -- 3 : counts per type of starting entity (class type) - -- 4 : counts per result type and/or status - -- 5 : counts per couple (starting type / result type/status) - -- 6 : idem plus gives for each item, the list of numbers of - -- entities in the starting model - -- - -- = 4,5 : modes relays on an enum PrintCount : - -- 0 (D) : ItemsByEntity (sequential list by entity) - -- 1 : CountByItem - -- 2 : ShortByItem (count + 5 first numbers) - -- 3 : ListByItem (count + entity numbers) - -- 4 : EntitiesByItem (count + entity numbers and labels) - - PrintStatsOnList (myclass; TP : TransientProcess; - list : HSequenceOfTransient; - what : Integer; mode : Integer = 0); - ---Purpose : Works as PrintStatsProcess, but displays data only on the - -- entities which are in (filter) - -fields - - theController : Controller; - - theFilename : AsciiString; - theModel : InterfaceModel; - theGraph : HGraph; - theContext : DictionaryOfTransient; - - theActor : ActorOfTransientProcess; - theTransfer : TransientProcess; - - theResults : DataMapOfIntegerTransient; - theShapeResult : HSequenceOfShape from TopTools; - -end TransferReader; diff --git a/src/XSControl/XSControl_TransferReader.cxx b/src/XSControl/XSControl_TransferReader.cxx index 53bff1bebe..14163a5ecf 100644 --- a/src/XSControl/XSControl_TransferReader.cxx +++ b/src/XSControl/XSControl_TransferReader.cxx @@ -13,7 +13,7 @@ //: abv 09.04.99: S4136: remove parameter lastpreci // szv#11:CASCADE30:01Feb00 BRepBuilderAPI::Precision(p) removed -#include +#include #include #include #include @@ -47,12 +47,38 @@ #include #include #include - #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +IMPLEMENT_STANDARD_TYPE(XSControl_TransferReader) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_TransferReader) + + +IMPLEMENT_DOWNCAST(XSControl_TransferReader,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_TransferReader) + //======================================================================= //function : XSControl_TransferReader diff --git a/src/XSControl/XSControl_TransferReader.hxx b/src/XSControl/XSControl_TransferReader.hxx new file mode 100644 index 0000000000..de8e05acb6 --- /dev/null +++ b/src/XSControl/XSControl_TransferReader.hxx @@ -0,0 +1,343 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_TransferReader_HeaderFile +#define _XSControl_TransferReader_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_Controller; +class Handle(XSControl_Controller); +class Interface_InterfaceModel; +class Interface_HGraph; +class Dico_DictionaryOfTransient; +class Transfer_ActorOfTransientProcess; +class Transfer_TransientProcess; +class TopTools_HSequenceOfShape; +class Standard_Transient; +class Standard_Type; +class TColStd_HSequenceOfTransient; +class Transfer_ResultFromModel; +class TopoDS_Shape; +class Interface_CheckIterator; +class Interface_Graph; +class Standard_Transient; +class Handle(Standard_Type); + +DEFINE_STANDARD_HANDLE(XSControl_TransferReader,MMgt_TShared) + +//! A TransferReader performs, manages, handles results of,
+//! transfers done when reading a file (i.e. from entities of an
+//! InterfaceModel, to objects for Imagine)
+//!
+//! Running is organised around basic tools : TransientProcess and
+//! its Actor, results are Binders and CheckIterators. It implies
+//! control by a Controller (which prepares the Actor as required)
+//!
+//! Getting results can be done directly on TransientProcess, but
+//! these are immediate "last produced" results. Each transfer of
+//! an entity gives a final result, but also possible intermediate
+//! data, and checks, which can be attached to sub-entities.
+//!
+//! Hence, final results (which intermediates and checks) are
+//! recorded as ResultFromModel and can be queried individually.
+//!
+//! Some more direct access are given for results which are
+//! Transient or Shapes
+class XSControl_TransferReader : public MMgt_TShared +{ +public: + + //! Creates a TransferReader, empty
+ Standard_EXPORT XSControl_TransferReader(); + //! Sets a Controller. It is required to generate the Actor.
+ //! Elsewhere, the Actor must be provided directly
+ Standard_EXPORT void SetController(const Handle(XSControl_Controller)& control) ; + //! Sets the Actor directly : this value will be used if the
+ //! Controller is not set
+ Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfTransientProcess)& actor) ; + //! Returns the Actor, determined by the Controller, or if this
+ //! one is unknown, directly set.
+ //! Once it has been defined, it can then be edited.
+ Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) Actor() ; + //! Sets an InterfaceModel. This causes former results, computed
+ //! from another one, to be lost (see also Clear)
+ Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model) ; + //! Sets a Graph and its InterfaceModel (calls SetModel)
+ Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& graph) ; + //! Returns the currently set InterfaceModel
+ Standard_EXPORT Handle_Interface_InterfaceModel Model() const; + //! Sets a Context : according to receiving appli, to be
+ //! interpreted by the Actor
+ Standard_EXPORT void SetContext (const Standard_CString name, + const Handle(Standard_Transient)& ctx) ; + //! Returns the Context attached to a name, if set and if it is
+ //! Kind of the type, else a Null Handle
+ //! Returns True if OK, False if no Context
+ Standard_EXPORT Standard_Boolean GetContext (const Standard_CString name, + const Handle(Standard_Type)& type, + Handle(Standard_Transient)& ctx) const; + //! Returns (modifiable) the whole definition of Context
+ //! Rather for internal use (ex.: preparing and setting in once)
+ Standard_EXPORT Handle(Dico_DictionaryOfTransient)& Context() ; + //! Sets a new value for (loaded) file name
+ Standard_EXPORT void SetFileName(const Standard_CString name) ; + //! Returns actual value of file name
+ Standard_EXPORT Standard_CString FileName() const; + //! Clears data, according mode :
+ //! -1 all
+ //! 0 nothing done
+ //! +1 final results
+ //! +2 working data (model, context, transfer process)
+ Standard_EXPORT void Clear(const Standard_Integer mode) ; + //! Returns the currently used TransientProcess
+ //! It is computed from the model by TransferReadRoots, or by
+ //! BeginTransferRead
+ Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; + //! Forces the TransientProcess
+ //! Remark : it also changes the Model and the Actor, from those
+ //! recorded in the new TransientProcess
+ Standard_EXPORT void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP) ; + //! Records a final result of transferring an entity
+ //! This result is recorded as a ResultFromModel, taken from
+ //! the TransientProcess
+ //! Returns True if a result is available, False else
+ Standard_EXPORT Standard_Boolean RecordResult (const Handle(Standard_Transient)& ent) ; + //! Returns True if a final result is recorded for an entity
+ //! Remark that it can bring no effective result if transfer has
+ //! completely failed (FinalResult brings only fail messages ...)
+ Standard_EXPORT Standard_Boolean IsRecorded (const Handle(Standard_Transient)& ent) const; + //! Returns True if a final result is recorded AND BRINGS AN
+ //! EFFECTIVE RESULT (else, it brings only fail messages)
+ Standard_EXPORT Standard_Boolean HasResult (const Handle(Standard_Transient)& ent) const; + //! Returns the list of entities to which a final result is
+ //! attached (i.e. processed by RecordResult)
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient RecordedList() const; + //! Note that an entity has been required for transfer but no
+ //! result at all is available (typically : case not implemented)
+ //! It is not an error, but it gives a specific status : Skipped
+ //! Returns True if done, False if is not in starting model
+ Standard_EXPORT Standard_Boolean Skip (const Handle(Standard_Transient)& ent) ; + //! Returns True if an entity is noted as skipped
+ Standard_EXPORT Standard_Boolean IsSkipped (const Handle(Standard_Transient)& ent) const; + //! Returns True if an entity has been asked for transfert, hence
+ //! it is marked, as : Recorded (a computation has ran, with or
+ //! without an effective result), or Skipped (case ignored)
+ Standard_EXPORT Standard_Boolean IsMarked (const Handle(Standard_Transient)& ent) const; + //! Returns the final result recorded for an entity, as such
+ Standard_EXPORT Handle_Transfer_ResultFromModel FinalResult (const Handle(Standard_Transient)& ent) const; + //! Returns the label attached to an entity recorded for final,
+ //! or an empty string if not recorded
+ Standard_EXPORT Standard_CString FinalEntityLabel (const Handle(Standard_Transient)& ent) const; + //! Returns the number attached to the entity recorded for final,
+ //! or zero if not recorded (looks in the ResultFromModel)
+ Standard_EXPORT Standard_Integer FinalEntityNumber (const Handle(Standard_Transient)& ent) const; + //! Returns the final result recorded for a NUMBER of entity
+ //! (internal use). Null if out of range
+ Standard_EXPORT Handle_Transfer_ResultFromModel ResultFromNumber (const Standard_Integer num) const; + //! Returns the resulting object as a Transient
+ //! Null Handle if no result or result not transient
+ Standard_EXPORT Handle_Standard_Transient TransientResult (const Handle(Standard_Transient)& ent) const; + //! Returns the resulting object as a Shape
+ //! Null Shape if no result or result not a shape
+ Standard_EXPORT TopoDS_Shape ShapeResult(const Handle(Standard_Transient)& ent) const; + //! Clears recorded result for an entity, according mode
+//! = -1 : true, complete, clearing (erasing result)
+//! >= 0 : simple "stripping", see ResultFromModel,
+//! in particular, 0 for simple internal strip,
+//! 10 for all but final result,
+//! 11 for all : just label, status and filename are kept
+//! Returns True when done, False if nothing was to clear
+ Standard_EXPORT Standard_Boolean ClearResult (const Handle(Standard_Transient)& ent, + const Standard_Integer mode) ; + //! Returns an entity from which a given result was produced.
+ //! If = 0 (D), searches in last root transfers
+ //! If = 1, searches in last (root & sub) transfers
+ //! If = 2, searches in root recorded results
+ //! If = 3, searches in all (root & sub) recordeds
+ //! can be, either a transient object (result itself) or
+ //! a binder. For a binder of shape, calls EntityFromShapeResult
+ //! Returns a Null Handle if not recorded
+ Standard_EXPORT Handle_Standard_Transient EntityFromResult (const Handle(Standard_Transient)& res, + const Standard_Integer mode = 0) const; + //! Returns an entity from which a given shape result was produced
+ //! Returns a Null Handle if not recorded or not a Shape
+ Standard_EXPORT Handle_Standard_Transient EntityFromShapeResult (const TopoDS_Shape& res, + const Standard_Integer mode = 0) const; + //! Returns the list of entities from which some shapes were
+ //! produced : it corresponds to a loop on EntityFromShapeResult,
+ //! but is optimised
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient EntitiesFromShapeList (const Handle(TopTools_HSequenceOfShape)& res, + const Standard_Integer mode = 0) const; + //! Returns the CheckList resulting from transferring , i.e.
+ //! stored in its recorded form ResultFromModel
+ //! (empty if transfer successful or not recorded ...)
+ //!
+ //! If is the Model, returns the complete cumulated
+ //! check-list, is ignored
+ //!
+ //! If is an entity of the Model, applies as follows
+ //! : -1 for only, LAST transfer (TransientProcess)
+ //! : 0 for only (D)
+ //! 1 for and its immediate subtransfers, if any
+ //! 2 for and subtransferts at all levels
+ Standard_EXPORT Interface_CheckIterator CheckList(const Handle(Standard_Transient)& ent, + const Standard_Integer level = 0) const; + //! Returns True if an entity (with a final result) has checks :
+ //! - failsonly = False : any kind of check message
+ //! - failsonly = True : fails only
+ //! Returns False if is not recorded
+ Standard_EXPORT Standard_Boolean HasChecks (const Handle(Standard_Transient)& ent, + const Standard_Boolean failsonly) const; + //! Returns the list of starting entities to which a given check
+ //! status is attached, IN FINAL RESULTS
+ //! can be an entity, or the model to query all entities
+ //! Below, "entities" are, either plus its sub-transferred,
+ //! or all the entities of the model
+ //!
+ //! = -2 , all entities whatever the check (see result)
+ //! = -1 , entities with no fail (warning allowed)
+ //! = 0 , entities with no check at all
+ //! = 1 , entities with warning but no fail
+ //! = 2 , entities with fail
+ //! : if True, only entities with an attached result
+ //! Remark : result True and check=0 will give an empty list
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient CheckedList(const Handle(Standard_Transient)& ent, + const Interface_CheckStatus withcheck = Interface_CheckAny, + const Standard_Boolean result = Standard_True) const; + //! Defines a new TransferProcess for reading transfer
+ //! Returns True if done, False if data are not properly defined
+ //! (the Model, the Actor for Read)
+ Standard_EXPORT Standard_Boolean BeginTransfer() ; + //! Tells if an entity is recognized as a valid candidate for
+ //! Transfer. Calls method Recognize from the Actor (if known)
+ Standard_EXPORT Standard_Boolean Recognize(const Handle(Standard_Transient)& ent) ; + //! Commands the transfer on reading for an entity to data for
+ //! Imagine, using the selected Actor for Read
+ //! Returns count of transferred entities, ok or with fails (0/1)
+ //! If is True (D), the result is recorded by RecordResult
+ Standard_EXPORT Standard_Integer TransferOne(const Handle(Standard_Transient)& ent, + const Standard_Boolean rec = Standard_True); + //! Commands the transfer on reading for a list of entities to
+ //! data for Imagine, using the selected Actor for Read
+ //! Returns count of transferred entities, ok or with fails (0/1)
+ //! If is True (D), the results are recorded by RecordResult
+ Standard_EXPORT Standard_Integer TransferList(const Handle(TColStd_HSequenceOfTransient)& list, + const Standard_Boolean rec = Standard_True); + //! Transfers the content of the current Interface Model to
+ //! data handled by Imagine, starting from its Roots (determined
+ //! by the Graph ), using the selected Actor for Read
+ //! Returns the count of performed root transfers (i.e. 0 if none)
+ //! or -1 if no actor is defined
+ Standard_EXPORT Standard_Integer TransferRoots(const Interface_Graph& G) ; + //! Clears the results attached to an entity
+ //! if equates the starting model, clears all results
+ Standard_EXPORT void TransferClear(const Handle(Standard_Transient)& ent, + const Standard_Integer level = 0) ; + //! Prints statistics on current Trace File, according and
+ //! . See PrintStatsProcess for details
+ Standard_EXPORT void PrintStats(const Standard_Integer what,const Standard_Integer mode = 0) const; + //! Returns the CheckList resulting from last TransferRead
+ //! i.e. from TransientProcess itself, recorded from last Clear
+ Standard_EXPORT Interface_CheckIterator LastCheckList() const; + //! Returns the list of entities recorded as lastly transferred
+ //! i.e. from TransientProcess itself, recorded from last Clear
+ //! If is True , considers only roots of transfer
+ //! If is False, considers all entities bound with result
+ Standard_EXPORT Handle_TColStd_HSequenceOfTransient LastTransferList(const Standard_Boolean roots) const; + //! Returns a list of result Shapes
+ //! If is True , sees RecordedList
+ //! If is False, sees LastTransferList (last ROOT transfers)
+ //! For each one, if it is a Shape, it is cumulated to the list
+ //! If no Shape is found, returns an empty Sequence
+ Standard_EXPORT Handle_TopTools_HSequenceOfShape ShapeResultList(const Standard_Boolean rec) ; + //! This routines prints statistics about a TransientProcess
+ //! It can be called, by a TransferReader, or isolately
+ //! Prints are done on the default trace file
+ //! defines what kind of statistics are to be printed :
+ //! 0 : basic figures
+ //! 1 : root results
+ //! 2 : all recorded (roots, intermediate, checked entities)
+ //! 3 : abnormal records
+ //! 4 : check messages (warnings and fails)
+ //! 5 : fail messages
+ //!
+ //! is used according :
+ //! = 0 : is ignored
+ //! = 1,2,3 : as follows :
+ //! 0 (D) : just lists numbers of concerned entities in the model
+ //! 1 : for each entity, gives number,label, type and result
+ //! type and/or status (fail/warning...)
+ //! 2 : for each entity, gives maximal information (i.e. checks)
+ //! 3 : counts per type of starting entity (class type)
+ //! 4 : counts per result type and/or status
+ //! 5 : counts per couple (starting type / result type/status)
+ //! 6 : idem plus gives for each item, the list of numbers of
+ //! entities in the starting model
+ //!
+ //! = 4,5 : modes relays on an enum PrintCount :
+ //! 0 (D) : ItemsByEntity (sequential list by entity)
+ //! 1 : CountByItem
+ //! 2 : ShortByItem (count + 5 first numbers)
+ //! 3 : ListByItem (count + entity numbers)
+ //! 4 : EntitiesByItem (count + entity numbers and labels)
+ Standard_EXPORT static void PrintStatsProcess(const Handle(Transfer_TransientProcess)& TP, + const Standard_Integer what, + const Standard_Integer mode = 0) ; + //! Works as PrintStatsProcess, but displays data only on the
+ //! entities which are in (filter)
+ Standard_EXPORT static void PrintStatsOnList(const Handle(Transfer_TransientProcess)& TP, + const Handle(TColStd_HSequenceOfTransient)& list, + const Standard_Integer what, + const Standard_Integer mode = 0) ; + + DEFINE_STANDARD_RTTI(XSControl_TransferReader) + +private: + + +Handle(XSControl_Controller) theController; +TCollection_AsciiString theFilename; +Handle(Interface_InterfaceModel) theModel; +Handle(Interface_HGraph) theGraph; +Handle(Dico_DictionaryOfTransient) theContext; +Handle(Transfer_ActorOfTransientProcess) theActor; +Handle(Transfer_TransientProcess) theTransfer; +TColStd_DataMapOfIntegerTransient theResults; +Handle(TopTools_HSequenceOfShape) theShapeResult; +}; +#endif diff --git a/src/XSControl/XSControl_TransferWriter.cdl b/src/XSControl/XSControl_TransferWriter.cdl deleted file mode 100644 index 08adbe812c..0000000000 --- a/src/XSControl/XSControl_TransferWriter.cdl +++ /dev/null @@ -1,117 +0,0 @@ --- Created on: 1996-03-13 --- Created by: Christian CAILLET --- Copyright (c) 1996-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 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. - -class TransferWriter from XSControl inherits TShared - - ---Purpose : TransferWriter gives help to control transfer to write a file - -- after having converted data from Cascade/Imagine - -- - -- It works with a Controller (which itself can work with an - -- Actor to Write) and a FinderProcess. It records results and - -- checks - -uses Transient, - Shape from TopoDS, - CheckIterator from Interface, - InterfaceModel from Interface, - FinderProcess, Controller, ReturnStatus - -is - - Create returns mutable TransferWriter; - ---Purpose : Creates a TransferWriter, empty, ready to run - -- with an empty FinderProcess (but no controller, etc) - - FinderProcess (me) returns mutable FinderProcess; - ---Purpose : Returns the FinderProcess itself - - SetFinderProcess (me : mutable; FP : mutable FinderProcess); - ---Purpose : Sets a new FinderProcess and forgets the former one - - Controller (me) returns Controller; - ---Purpose : Returns the currently used Controller - - SetController (me : mutable; ctl : Controller); - ---Purpose : Sets a new Controller, also sets a new FinderProcess - - Clear (me : mutable; mode : Integer); - ---Purpose : Clears recorded data according a mode - -- 0 clears FinderProcess (results, checks) - -- -1 create a new FinderProcess - - TransferMode (me) returns Integer; - ---Purpose : Returns the current Transfer Mode (an Integer) - -- It will be interpreted by the Controller to run Transfers - -- This call form could be later replaced by more specific ones - -- (parameters suited for each norm / transfer case) - - SetTransferMode (me : mutable; mode : Integer); - ---Purpose : Changes the Transfer Mode - - PrintStats (me; what : Integer; mode : Integer = 0); - ---Purpose : Prints statistics on current Trace File, according what,mode - -- See PrintStatsProcess for details - - -- Operations themselves - - RecognizeTransient (me : mutable; obj : Transient) returns Boolean; - ---Purpose : Tells if a transient object (from an application) is a valid - -- candidate for a transfer to a model - -- Asks the Controller (RecognizeWriteTransient) - -- If is a HShape, calls RecognizeShape - - TransferWriteTransient (me : mutable; model : mutable InterfaceModel; - obj : Transient) - returns ReturnStatus; - ---Purpose : Transfers a Transient object (from an application) to a model - -- of current norm, according to the last call to SetTransferMode - -- Works by calling the Controller - -- Returns status : =0 if OK, >0 if error during transfer, <0 if - -- transfer badly initialised - - RecognizeShape (me : mutable; shape : Shape from TopoDS) returns Boolean; - ---Purpose : Tells if a Shape is valid for a transfer to a model - -- Asks the Controller (RecognizeWriteShape) - - TransferWriteShape (me : mutable; model : mutable InterfaceModel; - shape : Shape from TopoDS) - returns ReturnStatus; - ---Purpose : Transfers a Shape from CasCade to a model of current norm, - -- according to the last call to SetTransferMode - -- Works by calling the Controller - -- Returns status : =0 if OK, >0 if error during transfer, <0 if - -- transfer badly initialised - - CheckList (me) returns CheckIterator; - ---Purpose : Returns the check-list of last transfer (write), i.e. the - -- check-list currently recorded in the FinderProcess - - ResultCheckList (me; model : InterfaceModel) returns CheckIterator; - ---Purpose : Returns the check-list of last transfer (write), but tries - -- to bind to each check, the resulting entity in the model - -- instead of keeping the original Mapper, whenever known - - PrintStatsProcess (myclass; TP : FinderProcess; - what : Integer; mode : Integer = 0); - ---Purpose : Forecast to print statitics about a FinderProcess - -fields - - theController : Controller; - theTransferWrite : FinderProcess; - theTransferMode : Integer; - -end TransferWriter; diff --git a/src/XSControl/XSControl_TransferWriter.cxx b/src/XSControl/XSControl_TransferWriter.cxx index 5903847c03..bb3f3373f1 100644 --- a/src/XSControl/XSControl_TransferWriter.cxx +++ b/src/XSControl/XSControl_TransferWriter.cxx @@ -11,8 +11,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include +#include #include #include #include @@ -21,7 +22,24 @@ #include #include #include +#include +#include +#include +#include +#include +#include +IMPLEMENT_STANDARD_TYPE(XSControl_TransferWriter) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_TransferWriter) + + +IMPLEMENT_DOWNCAST(XSControl_TransferWriter,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_TransferWriter) XSControl_TransferWriter::XSControl_TransferWriter () { theTransferWrite = new Transfer_FinderProcess; theTransferMode = 0; } diff --git a/src/XSControl/XSControl_TransferWriter.hxx b/src/XSControl/XSControl_TransferWriter.hxx new file mode 100644 index 0000000000..66c9363109 --- /dev/null +++ b/src/XSControl/XSControl_TransferWriter.hxx @@ -0,0 +1,119 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef _XSControl_TransferWriter_HeaderFile +#define _XSControl_TransferWriter_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Transfer_FinderProcess; +class Standard_Transient; +class Interface_InterfaceModel; +class TopoDS_Shape; +class Interface_CheckIterator; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(MMgt_TShared); +class XSControl_TransferWriter; + +DEFINE_STANDARD_HANDLE(XSControl_TransferWriter,MMgt_TShared) + +//! TransferWriter gives help to control transfer to write a file
+//! after having converted data from Cascade/Imagine
+//!
+//! It works with a Controller (which itself can work with an
+//! Actor to Write) and a FinderProcess. It records results and
+//! checks
+class XSControl_TransferWriter : public MMgt_TShared { + +public: + + //! Creates a TransferWriter, empty, ready to run
+//! with an empty FinderProcess (but no controller, etc)
+ Standard_EXPORT XSControl_TransferWriter(); + //! Returns the FinderProcess itself
+ Standard_EXPORT Handle_Transfer_FinderProcess FinderProcess() const; + //! Sets a new FinderProcess and forgets the former one
+ Standard_EXPORT void SetFinderProcess(const Handle(Transfer_FinderProcess)& FP) ; + //! Returns the currently used Controller
+ Standard_EXPORT Handle(XSControl_Controller) Controller() const; + //! Sets a new Controller, also sets a new FinderProcess
+ Standard_EXPORT void SetController(const Handle(XSControl_Controller)& ctl) ; + //! Clears recorded data according a mode
+//! 0 clears FinderProcess (results, checks)
+//! -1 create a new FinderProcess
+ Standard_EXPORT void Clear(const Standard_Integer mode) ; + //! Returns the current Transfer Mode (an Integer)
+//! It will be interpreted by the Controller to run Transfers
+//! This call form could be later replaced by more specific ones
+//! (parameters suited for each norm / transfer case)
+ Standard_EXPORT Standard_Integer TransferMode() const; + //! Changes the Transfer Mode
+ Standard_EXPORT void SetTransferMode(const Standard_Integer mode) ; + //! Prints statistics on current Trace File, according what,mode
+//! See PrintStatsProcess for details
+ Standard_EXPORT void PrintStats(const Standard_Integer what,const Standard_Integer mode = 0) const; + //! Tells if a transient object (from an application) is a valid
+//! candidate for a transfer to a model
+//! Asks the Controller (RecognizeWriteTransient)
+//! If is a HShape, calls RecognizeShape
+ Standard_EXPORT Standard_Boolean RecognizeTransient(const Handle(Standard_Transient)& obj) ; + //! Transfers a Transient object (from an application) to a model
+//! of current norm, according to the last call to SetTransferMode
+//! Works by calling the Controller
+//! Returns status : =0 if OK, >0 if error during transfer, <0 if
+//! transfer badly initialised
+ Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient(const Handle(Interface_InterfaceModel)& model,const Handle(Standard_Transient)& obj) ; + //! Tells if a Shape is valid for a transfer to a model
+//! Asks the Controller (RecognizeWriteShape)
+ Standard_EXPORT Standard_Boolean RecognizeShape(const TopoDS_Shape& shape) ; + //! Transfers a Shape from CasCade to a model of current norm,
+//! according to the last call to SetTransferMode
+//! Works by calling the Controller
+//! Returns status : =0 if OK, >0 if error during transfer, <0 if
+//! transfer badly initialised
+ Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape(const Handle(Interface_InterfaceModel)& model,const TopoDS_Shape& shape) ; + //! Returns the check-list of last transfer (write), i.e. the
+//! check-list currently recorded in the FinderProcess
+ Standard_EXPORT Interface_CheckIterator CheckList() const; + //! Returns the check-list of last transfer (write), but tries
+//! to bind to each check, the resulting entity in the model
+//! instead of keeping the original Mapper, whenever known
+ Standard_EXPORT Interface_CheckIterator ResultCheckList(const Handle(Interface_InterfaceModel)& model) const; + //! Forecast to print statitics about a FinderProcess
+ Standard_EXPORT static void PrintStatsProcess(const Handle(Transfer_FinderProcess)& TP,const Standard_Integer what,const Standard_Integer mode = 0) ; + + DEFINE_STANDARD_RTTI(XSControl_TransferWriter) + +private: + + + Handle(XSControl_Controller) theController; + Handle(Transfer_FinderProcess) theTransferWrite; + Standard_Integer theTransferMode; +}; +#endif diff --git a/src/XSControl/XSControl_WorkSession.cdl b/src/XSControl/XSControl_WorkSession.cdl deleted file mode 100644 index bdf1c550e5..0000000000 --- a/src/XSControl/XSControl_WorkSession.cdl +++ /dev/null @@ -1,235 +0,0 @@ --- Created on: 1995-06-01 --- Created by: Christian CAILLET --- 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 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. - -class WorkSession from XSControl inherits WorkSession from IFSelect - - ---Purpose : This WorkSession completes the basic one, by adding : - -- - use of Controller, with norm selection... - -- - management of transfers (both ways) with auxiliary classes - -- TransferReader and TransferWriter - -- -> these transfers may work with a Context List : its items - -- are given by the user, according to the transfer to be - -- i.e. it is interpreted by the Actors - -- Each item is accessed by a Name - -uses CString, Transient, DictionaryOfTransient, - InterfaceModel, CheckIterator, - TransientProcess, FinderProcess, - TransferReader, TransferWriter, Controller, Vars, ReturnStatus, - Messenger from Message, - Shape from TopoDS - -is - - Create returns mutable WorkSession from XSControl; - - ClearData (me : mutable; mode : Integer) is redefined; - ---Purpose : In addition to basic ClearData, clears Transfer and Management - -- for interactive use, for mode = 0,1,2 and over 4 - -- Plus : mode = 5 to clear Transfers (both ways) only - -- mode = 6 to clear enforced results - -- mode = 7 to clear transfers, results - - - -- Norm Management -- - - SelectNorm (me : mutable; normname : CString; profile : CString = "") - returns Boolean; - ---Purpose : Selects a Norm defined by its name. - -- A Norm is described and handled by a Controller - -- Returns True if done, False if is unknown - -- - -- A Profile may be set too. If no Profile is provided, the - -- current Profile for this Norm is taken - -- If the asked Profile is not defined for this Norm, it remains - -- in current Profile, returned value is True - - SelectProfile (me : mutable; profile : CString) returns Boolean; - ---Purpose : Sets a Profile as current for the current Norm - -- Returns True if done, False if is unknown for this norm - -- - -- For more infos on Profile, query the Profile of the Controller - - SetController (me : mutable; ctl : mutable Controller); - ---Purpose : Selects a Norm defined by its Controller itself - - AdaptNorm (me : mutable) is virtual; - ---Purpose : This method is called once a new norm has been successfully - -- selected. It can be redefined, default does nothing - - SelectedNorm (me; rsc : Boolean = Standard_False) returns CString; - ---Purpose : Returns the name of the last Selected Norm. If none is - -- defined, returns an empty string - -- By default, returns the complete name of the norm - -- If is True, returns the short name used for resource - - NormAdaptor (me) returns mutable Controller; - ---Purpose : Returns the norm controller itself - - -- Context used for Transfer : it is a DictionaryOfTransient (no control here) - - Context (me) returns DictionaryOfTransient; - ---Purpose : Returns the current Context List, Null if not defined - -- The Context is given to the TransientProcess for TransferRead - - SetAllContext (me : mutable; context : DictionaryOfTransient); - ---Purpose : Sets the current Context List, as a whole - -- Sets it to the TransferReader - - ClearContext (me : mutable); - ---Purpose : Clears the whole current Context (nullifies it) - - -- Management and Actions of Transfer (Read) -- - -- performed by TransferReader - -- WorkSession adds some useful accesses - -- It is actually oriented to shapes and transient objects - - PrintTransferStatus (me; num : Integer; wri : Boolean; S : Messenger from Message) - returns Boolean; - ---Purpose : Prints the transfer status of a transferred item, as beeing - -- the Mapped n0 , from MapWriter if is True, or - -- from MapReader if is False - -- Returns True when done, False else (i.e. num out of range) - - InitTransferReader (me : mutable; mode : Integer); - ---Purpose : Sets a Transfer Reader, by internal ways, according mode : - -- 0 recreates it clear, 1 clears it (does not recreate) - -- 2 aligns Roots of TransientProcess from final Results - -- 3 aligns final Results from Roots of TransientProcess - -- 4 begins a new transfer (by BeginTransfer) - -- 5 recreates TransferReader then begins a new transfer - - SetTransferReader (me : mutable; TR : mutable TransferReader); - ---Purpose : Sets a Transfer Reader, which manages transfers on reading - - TransferReader (me) returns mutable TransferReader; - ---Purpose : Returns the Transfer Reader, Null if not set - - MapReader (me) returns mutable TransientProcess; - ---Purpose : Returns the TransientProcess(internal data for TransferReader) - - SetMapReader (me : mutable; TP : mutable TransientProcess) returns Boolean; - ---Purpose : Changes the Map Reader, i.e. considers that the new one - -- defines the relevant read results (forgets the former ones) - -- Returns True when done, False in case of bad definition, i.e. - -- if Model from TP differs from that of Session - - Result (me; ent : Transient; mode : Integer) - returns mutable Transient; - ---Purpose : Returns the result attached to a starting entity - -- If = 0, returns Final Result - -- If = 1, considers Last Result - -- If = 2, considers Final, else if absent, Last - -- returns it as Transient, if result is not transient returns - -- the Binder - -- = 10,11,12 idem but returns the Binder itself - -- (if it is not, e.g. Shape, returns the Binder) - -- = 20, returns the ResultFromModel - - TransferReadOne (me : mutable; ents : Transient) returns Integer; - ---Purpose : Commands the transfer of, either one entity, or a list - -- I.E. calls the TransferReader after having analysed - -- It is cumulated from the last BeginTransfer - -- is processed by GiveList, hence : - -- - a Selection : its SelectionResult - -- - a HSequenceOfTransient : this list - -- - the Model : in this specific case, all the roots, - -- with no cumulation of former transfers (TransferReadRoots) - - TransferReadRoots (me : mutable) returns Integer; - ---Purpose : Commands the transfer of all the root entities of the model - -- i.e. calls TransferRoot from the TransferReader with the Graph - -- No cumulation with former calls to TransferReadOne - --- Other actions : see the class TransferReader - --- BeginTransferRead (me : mutable) returns Boolean; and --- RecognizeRead (me : mutable; ent : Transient) see TransferReader --- TransferReadOne (me : mutable; ents : Transient) -> TransferOne/List --- TransferReadRoots (me : mutable) returns Integer; --- TransferReadCheckList (me) returns CheckIterator; -> LastCheckList --- TransferReadCheckOne (me; ent : Transient; level : Integer = 0) --- -> CheckList avec en plus level = -1 (last) --- TransferredReadList (me; ents : Transient; -> CheckedList --- withcheck : Integer = 0; level : Integer = 0) withcheck a change --- TransferReadClear (me : mutable; ents : Transient; level : Integer = 0); --- ShapeResultList (me : mutable) returns HSequenceOfShape from TopTools; --- + rec : Boolean (recorded/last) - - - -- Management of Transfer (Write) -- - -- It is actually oriented to shapes - - NewModel (me : mutable) returns mutable InterfaceModel from Interface; - ---Purpose : produces and returns a new Model well conditionned - -- It is produced by the Norm Controller - -- It can be Null (if this function is not implemented) - - TransferWriter (me) returns mutable TransferWriter; - ---Purpose : Returns the Transfer Reader, Null if not set - - MapWriter (me) returns mutable FinderProcess; - ---Purpose : Returns the FinderProcess (internal data for TransferWriter) - - SetMapWriter (me : mutable; FP : mutable FinderProcess) returns Boolean; - ---Purpose : Changes the Map Reader, i.e. considers that the new one - -- defines the relevant read results (forgets the former ones) - -- Returns True when done, False if is Null - - SetModeWriteShape (me : mutable; mode : Integer); - ---Purpose : Sets a mode to transfer Shapes from CasCade to entities of the - -- current norm, which interprets it (see various Controllers) - -- This call form could be later replaced by a more general one - - ModeWriteShape (me) returns Integer; - ---Purpose : Records the current Mode to Write Shapes - - TransferWriteShape (me : mutable; shape : Shape from TopoDS; - compgraph : Boolean = Standard_True) - returns ReturnStatus; - ---Purpose : Transfers a Shape from CasCade to a model of current norm, - -- according to the last call to SetModeWriteShape - -- Returns status :Done if OK, Fail if error during transfer, - -- Error if transfer badly initialised - - TransferWriteCheckList (me) returns CheckIterator; - ---Purpose : Returns the check-list of last transfer (write) - -- It is recorded in the FinderProcess, but it must be bound with - -- resulting entities (in the resulting file model) rather than - -- with original objects (in fact, their mappers) - - - Vars (me) returns Vars; - - SetVars (me : mutable; newvars : Vars); - - ClearBinders (me : mutable); - ---Purpose : Clears binders - - Destroy(me: mutable) - ---C++: alias ~ - is static; - -fields - - theController : Controller; - theTransferRead : TransferReader from XSControl; - theTransferWrite : TransferWriter from XSControl; - theContext : DictionaryOfTransient; - theModeWriteShape : Integer; - theVars : Vars; - -end WorkSession; diff --git a/src/XSControl/XSControl_WorkSession.cxx b/src/XSControl/XSControl_WorkSession.cxx index 7a3ab6d953..8386799f6f 100644 --- a/src/XSControl/XSControl_WorkSession.cxx +++ b/src/XSControl/XSControl_WorkSession.cxx @@ -13,9 +13,10 @@ //:i1 pdn 03.04.99 BUC60301 -#include +#include #include #include +#include #include #include @@ -41,6 +42,33 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +IMPLEMENT_STANDARD_TYPE(XSControl_WorkSession) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(IFSelect_WorkSession), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSControl_WorkSession) + + +IMPLEMENT_DOWNCAST(XSControl_WorkSession,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSControl_WorkSession) //======================================================================= //function : XSControl_WorkSession diff --git a/src/XSControl/XSControl_WorkSession.hxx b/src/XSControl/XSControl_WorkSession.hxx new file mode 100644 index 0000000000..55e5ee060e --- /dev/null +++ b/src/XSControl/XSControl_WorkSession.hxx @@ -0,0 +1,212 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef _XSControl_WorkSession_HeaderFile +#define _XSControl_WorkSession_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_Controller; +class XSControl_TransferReader; +class XSControl_TransferWriter; +class Dico_DictionaryOfTransient; +class XSControl_Vars; +class Message_Messenger; +class Transfer_TransientProcess; +class Standard_Transient; +class Interface_InterfaceModel; +class Transfer_FinderProcess; +class TopoDS_Shape; +class Interface_CheckIterator; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(IFSelect_WorkSession); + +DEFINE_STANDARD_HANDLE(XSControl_WorkSession,IFSelect_WorkSession) + + +//! This WorkSession completes the basic one, by adding :
+//! - use of Controller, with norm selection...
+//! - management of transfers (both ways) with auxiliary classes
+//! TransferReader and TransferWriter
+//! -> these transfers may work with a Context List : its items
+//! are given by the user, according to the transfer to be
+//! i.e. it is interpreted by the Actors
+//! Each item is accessed by a Name
+class XSControl_WorkSession : public IFSelect_WorkSession +{ + +public: + + Standard_EXPORT XSControl_WorkSession(); + //! In addition to basic ClearData, clears Transfer and Management
+//! for interactive use, for mode = 0,1,2 and over 4
+//! Plus : mode = 5 to clear Transfers (both ways) only
+//! mode = 6 to clear enforced results
+//! mode = 7 to clear transfers, results
+ Standard_EXPORT virtual void ClearData(const Standard_Integer mode) ; + //! Selects a Norm defined by its name.
+//! A Norm is described and handled by a Controller
+//! Returns True if done, False if is unknown
+//!
+//! A Profile may be set too. If no Profile is provided, the
+//! current Profile for this Norm is taken
+//! If the asked Profile is not defined for this Norm, it remains
+//! in current Profile, returned value is True
+ Standard_EXPORT Standard_Boolean SelectNorm(const Standard_CString normname,const Standard_CString profile = "") ; + //! Sets a Profile as current for the current Norm
+//! Returns True if done, False if is unknown for this norm
+//!
+//! For more infos on Profile, query the Profile of the Controller
+ Standard_EXPORT Standard_Boolean SelectProfile(const Standard_CString profile) ; + //! Selects a Norm defined by its Controller itself
+ Standard_EXPORT void SetController(const Handle(XSControl_Controller)& ctl) ; + //! This method is called once a new norm has been successfully
+//! selected. It can be redefined, default does nothing
+ Standard_EXPORT virtual void AdaptNorm() ; + //! Returns the name of the last Selected Norm. If none is
+//! defined, returns an empty string
+//! By default, returns the complete name of the norm
+//! If is True, returns the short name used for resource
+ Standard_EXPORT Standard_CString SelectedNorm(const Standard_Boolean rsc = Standard_False) const; + //! Returns the norm controller itself
+ Standard_EXPORT Handle_XSControl_Controller NormAdaptor() const; + //! Returns the current Context List, Null if not defined
+//! The Context is given to the TransientProcess for TransferRead
+ Standard_EXPORT Handle_Dico_DictionaryOfTransient Context() const; + //! Sets the current Context List, as a whole
+//! Sets it to the TransferReader
+ Standard_EXPORT void SetAllContext(const Handle(Dico_DictionaryOfTransient)& context) ; + //! Clears the whole current Context (nullifies it)
+ Standard_EXPORT void ClearContext() ; + //! Prints the transfer status of a transferred item, as beeing
+//! the Mapped n0 , from MapWriter if is True, or
+//! from MapReader if is False
+//! Returns True when done, False else (i.e. num out of range)
+ Standard_EXPORT Standard_Boolean PrintTransferStatus(const Standard_Integer num,const Standard_Boolean wri,const Handle(Message_Messenger)& S) const; + //! Sets a Transfer Reader, by internal ways, according mode :
+//! 0 recreates it clear, 1 clears it (does not recreate)
+//! 2 aligns Roots of TransientProcess from final Results
+//! 3 aligns final Results from Roots of TransientProcess
+//! 4 begins a new transfer (by BeginTransfer)
+//! 5 recreates TransferReader then begins a new transfer
+ Standard_EXPORT void InitTransferReader(const Standard_Integer mode) ; + //! Sets a Transfer Reader, which manages transfers on reading
+ Standard_EXPORT void SetTransferReader(const Handle(XSControl_TransferReader)& TR) ; + //! Returns the Transfer Reader, Null if not set
+ Standard_EXPORT Handle_XSControl_TransferReader TransferReader() const; + //! Returns the TransientProcess(internal data for TransferReader)
+ Standard_EXPORT Handle_Transfer_TransientProcess MapReader() const; + //! Changes the Map Reader, i.e. considers that the new one
+//! defines the relevant read results (forgets the former ones)
+//! Returns True when done, False in case of bad definition, i.e.
+//! if Model from TP differs from that of Session
+ Standard_EXPORT Standard_Boolean SetMapReader(const Handle(Transfer_TransientProcess)& TP) ; + //! Returns the result attached to a starting entity
+//! If = 0, returns Final Result
+//! If = 1, considers Last Result
+//! If = 2, considers Final, else if absent, Last
+//! returns it as Transient, if result is not transient returns
+//! the Binder
+//! = 10,11,12 idem but returns the Binder itself
+//! (if it is not, e.g. Shape, returns the Binder)
+//! = 20, returns the ResultFromModel
+ Standard_EXPORT Handle_Standard_Transient Result(const Handle(Standard_Transient)& ent,const Standard_Integer mode) const; + //! Commands the transfer of, either one entity, or a list
+//! I.E. calls the TransferReader after having analysed
+//! It is cumulated from the last BeginTransfer
+//! is processed by GiveList, hence :
+//! - a Selection : its SelectionResult
+//! - a HSequenceOfTransient : this list
+//! - the Model : in this specific case, all the roots,
+//! with no cumulation of former transfers (TransferReadRoots)
+ Standard_EXPORT Standard_Integer TransferReadOne(const Handle(Standard_Transient)& ents) ; + //! Commands the transfer of all the root entities of the model
+//! i.e. calls TransferRoot from the TransferReader with the Graph
+//! No cumulation with former calls to TransferReadOne
+ Standard_EXPORT Standard_Integer TransferReadRoots() ; + //! produces and returns a new Model well conditionned
+//! It is produced by the Norm Controller
+//! It can be Null (if this function is not implemented)
+ Standard_EXPORT Handle_Interface_InterfaceModel NewModel() ; + //! Returns the Transfer Reader, Null if not set
+ Standard_EXPORT Handle_XSControl_TransferWriter TransferWriter() const; + //! Returns the FinderProcess (internal data for TransferWriter)
+ Standard_EXPORT Handle_Transfer_FinderProcess MapWriter() const; + //! Changes the Map Reader, i.e. considers that the new one
+//! defines the relevant read results (forgets the former ones)
+//! Returns True when done, False if is Null
+ Standard_EXPORT Standard_Boolean SetMapWriter(const Handle(Transfer_FinderProcess)& FP) ; + //! Sets a mode to transfer Shapes from CasCade to entities of the
+//! current norm, which interprets it (see various Controllers)
+//! This call form could be later replaced by a more general one
+ Standard_EXPORT void SetModeWriteShape(const Standard_Integer mode) ; + //! Records the current Mode to Write Shapes
+ Standard_EXPORT Standard_Integer ModeWriteShape() const; + //! Transfers a Shape from CasCade to a model of current norm,
+//! according to the last call to SetModeWriteShape
+//! Returns status :Done if OK, Fail if error during transfer,
+//! Error if transfer badly initialised
+ Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& shape,const Standard_Boolean compgraph = Standard_True) ; + //! Returns the check-list of last transfer (write)
+//! It is recorded in the FinderProcess, but it must be bound with
+//! resulting entities (in the resulting file model) rather than
+//! with original objects (in fact, their mappers)
+ Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; + + Standard_EXPORT Handle_XSControl_Vars Vars() const; + + Standard_EXPORT void SetVars(const Handle(XSControl_Vars)& newvars) ; + //! Clears binders
+ Standard_EXPORT void ClearBinders() ; + + Standard_EXPORT void Destroy() ; +~XSControl_WorkSession() +{ + Destroy(); +} + + DEFINE_STANDARD_RTTI(XSControl_WorkSession) + +private: + +Handle(XSControl_Controller) theController; +Handle(XSControl_TransferReader) theTransferRead; +Handle(XSControl_TransferWriter) theTransferWrite; +Handle(Dico_DictionaryOfTransient) theContext; +Standard_Integer theModeWriteShape; +Handle(XSControl_Vars) theVars; + +}; +#endif diff --git a/src/XSControl/XSControl_WorkSession_Handle.hxx b/src/XSControl/XSControl_WorkSession_Handle.hxx new file mode 100644 index 0000000000..cd1b8950f0 --- /dev/null +++ b/src/XSControl/XSControl_WorkSession_Handle.hxx @@ -0,0 +1,26 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef _XSControl_WorkSession_Handle_HeaderFile +#define _XSControl_WorkSession_Handle_HeaderFile + +#include + +typedef Handle(XSControl_WorkSession) XSControl_WorkSession_Handle; + +#endif \ No newline at end of file diff --git a/src/XSControl/XSControl_Writer.cdl b/src/XSControl/XSControl_Writer.cdl deleted file mode 100644 index 85edf34a2b..0000000000 --- a/src/XSControl/XSControl_Writer.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Created on: 1997-05-14 --- Created by: Christian CAILLET --- Copyright (c) 1997-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 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. - -class Writer from XSControl - - ---Purpose : This class gives a simple way to create then write a - -- Model compliant to a given norm, from a Shape - -- The model can then be edited by tools by other appropriate tools - -uses CString, - InterfaceModel from Interface, WorkSession from XSControl, - ReturnStatus from IFSelect, - Shape from TopoDS - -is - - Create returns Writer; - ---Purpose : Creates a Writer from scratch - - Create (norm : CString) returns Writer; - ---Purpose : Creates a Writer from scratch, with a norm name which - -- identifie a Controller - - Create (WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True) returns Writer; - ---Purpose : Creates a Writer from an already existing Session - -- If is True (D), clears already recorded data - - SetNorm (me : in out; norm : CString) returns Boolean; - ---Purpose : Sets a specific norm to - -- Returns True if done, False if is not available - - SetWS (me : in out; WS : mutable WorkSession from XSControl; - scratch : Boolean = Standard_True); - ---Purpose : Sets a specific session to - - WS (me) returns WorkSession from XSControl; - ---Purpose : Returns the session used in - - Model (me : in out; newone : Boolean = Standard_False) returns InterfaceModel; - ---Purpose : Returns the produced model. Produces a new one if not yet done - -- or if is True - -- This method allows for instance to edit product or header - -- data before writing - - TransferShape (me : in out; sh : Shape from TopoDS; mode : Integer = 0) - returns ReturnStatus; - ---Purpose : Transfers a Shape according to the mode - - WriteFile (me : in out; filename : CString) returns ReturnStatus; - ---Purpose : Writes the produced model - - PrintStatsTransfer (me; what : Integer; mode : Integer = 0); - ---Purpose : Prints Statistics about Transfer - -fields - - thesession : WorkSession from XSControl; - -end Writer; diff --git a/src/XSControl/XSControl_Writer.cxx b/src/XSControl/XSControl_Writer.cxx index f42690a6d4..c8d2003a83 100644 --- a/src/XSControl/XSControl_Writer.cxx +++ b/src/XSControl/XSControl_Writer.cxx @@ -13,12 +13,14 @@ //:i1 gka 03.04.99 BUC60301 -#include +#include #include #include #include #include - +#include +#include +#include XSControl_Writer::XSControl_Writer () { diff --git a/src/XSControl/XSControl_Writer.hxx b/src/XSControl/XSControl_Writer.hxx new file mode 100644 index 0000000000..802e1b1e37 --- /dev/null +++ b/src/XSControl/XSControl_Writer.hxx @@ -0,0 +1,76 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSControl_Writer_HeaderFile +#define _XSControl_Writer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XSControl_WorkSession; +class Interface_InterfaceModel; +class TopoDS_Shape; + + +//! This class gives a simple way to create then write a
+//! Model compliant to a given norm, from a Shape
+//! The model can then be edited by tools by other appropriate tools
+class XSControl_Writer { +public: + + DEFINE_STANDARD_ALLOC + + //! Creates a Writer from scratch
+ Standard_EXPORT XSControl_Writer(); + //! Creates a Writer from scratch, with a norm name which
+ //! identifie a Controller
+ Standard_EXPORT XSControl_Writer(const Standard_CString norm); + //! Creates a Writer from an already existing Session
+ //! If is True (D), clears already recorded data
+ Standard_EXPORT XSControl_Writer(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True); + //! Sets a specific norm to
+ //! Returns True if done, False if is not available
+ Standard_EXPORT Standard_Boolean SetNorm(const Standard_CString norm) ; + //! Sets a specific session to
+ Standard_EXPORT void SetWS(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ; + //! Returns the session used in
+ Standard_EXPORT Handle_XSControl_WorkSession WS() const; + //! Returns the produced model. Produces a new one if not yet done
+ //! or if is True
+ //! This method allows for instance to edit product or header
+ //! data before writing
+ Standard_EXPORT Handle_Interface_InterfaceModel Model(const Standard_Boolean newone = Standard_False) ; + //! Transfers a Shape according to the mode
+ Standard_EXPORT IFSelect_ReturnStatus TransferShape(const TopoDS_Shape& sh,const Standard_Integer mode = 0) ; + //! Writes the produced model
+ Standard_EXPORT IFSelect_ReturnStatus WriteFile(const Standard_CString filename) ; + //! Prints Statistics about Transfer
+ Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,const Standard_Integer mode = 0) const; + + +private: + + Handle_XSControl_WorkSession thesession; +}; +#endif diff --git a/src/XSDRAW/FILES b/src/XSDRAW/FILES index e44a4add2f..8079ed028f 100755 --- a/src/XSDRAW/FILES +++ b/src/XSDRAW/FILES @@ -1 +1,7 @@ +XSDRAW.hxx +XSDRAW.cxx +XSDRAW_Vars.hxx +XSDRAW_Vars.cxx +XSDRAW_Functions.hxx +XSDRAW_Functions.cxx XSDRAW_Commands.hxx diff --git a/src/XSDRAW/XSDRAW.cdl b/src/XSDRAW/XSDRAW.cdl deleted file mode 100644 index 172a6f37d0..0000000000 --- a/src/XSDRAW/XSDRAW.cdl +++ /dev/null @@ -1,223 +0,0 @@ --- Created on: 1995-03-14 --- Created by: Christian CAILLET --- 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 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. - -package XSDRAW - - ---Purpose : Basic package to work functions of X-STEP (IFSelect & Co) - -- under control of DRAW - -- - -- Works with some "static" data : a SessionPilot (used to run) - -- with its WorkSession and Model and TransferReader, a - -- FinderProcess - -uses TCollection, TColStd, TopTools, - gp, Geom, Geom2d, TopoDS, MoniTool, - Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW, Message - -is - - class Functions; - ---Purpose : Gathers general commands for XSDRAW : initialisation control, - -- also commands to analyse the result of a transfer - -- (it is an appendix made of user callable functions) - -- - -- Loaded by LoadDraw - - class Shape; - ---Purpose : Gathers commands which only apply to shapes/geometry, and are - -- not concerned by XSTEP features for files - -- This set of functions just enriches the standard DRAW set, - -- with either useful but lacking basic functions, or complements - -- used in transfer operations, or specific control functions - -- Loaded by LoadDraw - - class Vars; - ---Purpose : Takes variables to/from the DRAW session - - --class ProgressIndicator; - ---Purpose : Implements ProgressIndicator for DRAW - - -- Linking with DRAW function set - - ChangeCommand (oldname,newname : CString); - ---Purpose : Changes the name under which a command of xstep is known by - -- Draw. This allows to avoid collisions - -- To be called before LoadDraw or any other xstep initialisation - - RemoveCommand (oldname : CString); - ---Purpose : Removes a command from the interpretation list of Draw - -- To be called before LoadDraw or any other xstep initialisation - - LoadSession returns Boolean; - ---Purpose : Defines the basic context to work with a X-STEP Session : - -- it performs the basic inits, also records the Controller - -- If the Controller is not yet set, it must be set after - -- (call to SetController) - -- LoadSession is called by LoadDraw - -- Returns True the first time, False if already called - - LoadDraw (theCommands : in out Interpretor from Draw); - ---Purpose : Defines the context for using a X-STEP Session under DRAW - -- Once the various INITs have been done, a call to LoadDraw - -- records the defined commands for the X-STEP SessionPilot, - -- into the DRAW interpretation list. - -- "Set" commands are accessed under command xset - -- SDS>xset name command ... - -- Other commands can be accessed directly or under command xstep - -- SDS>command ... and SDS>xstep command ... are equivalent - -- - -- Only the command xinit is accessed directly only : - -- SDS>xinit (from the already defined Controller) - -- SDS>xinit iges (first defines the Controller as for "iges") - -- - -- It also records the function to be called by DRAW (not - -- declared because specific). - -- And it defines the context variables, i.e. a WorkSession, then - -- it calls SetController with the currently defined Controller - -- Remark : at least, the standard commands are recorded - -- - -- See also Controller : it is part of the Context, but it must - -- be precised separately - - Execute (command : CString; var : CString = "") returns Integer; - ---Purpose : Allows to execute a xstep-draw command from C++ program - -- Fixed form : Execute("command args..."); - -- Form with a variable text part : add %s for the variable : - -- Execute ("command args %s args..",var) [var is a CString] - -- Returns the same value as returned by call from DRAW - - Pilot returns mutable SessionPilot from IFSelect; - ---Purpose : Returns the SessionPilot (can be used for direct call) - - Session returns mutable WorkSession from XSControl; - ---Purpose : Returns the WorkSession defined in AddDraw (through Pilot) - -- It is from XSControl, it brings functionnalities for Transfers - - SetController (control : Controller from XSControl); - ---Purpose : Defines a Controller for the command "xinit" and applies it - -- (i.e. calls its method Customise) - - Controller returns Controller from XSControl; - ---Purpose : Returns the Controller, a Null Handle if not yet defined - - SetNorm (normname : CString; profile : CString = "") returns Boolean; - ---Purpose : Sets a norm by its name (controller recorded as ) - -- Returns True if done, False if this norm is unknown - -- If is given, also sets the norm to - -- (if is undefined for , it is ignored) - - -- Additionnal access to XSTEP data - - Protocol returns Protocol from Interface; - ---Purpose : Returns the actually defined Protocol - - Model returns mutable InterfaceModel from Interface; - ---Purpose : Returns the Model of the Session (it is Session()->Model() ) - - SetModel (model : mutable InterfaceModel from Interface; file : CString = ""); - ---Purpose : Sets a Model in session (it is Session()->SetModel(model) ) - -- If is defined, SetLoadedFile is also done - - NewModel returns InterfaceModel from Interface; - ---Purpose : Produces a new model (from the Controller), can be Null - -- Does not set it in the session - - Entity (num : Integer) returns Transient; - ---Purpose : Returns the entity n0 of the Model of the Session - -- (it is StartingEntity) - -- Null Handle if is not suitable - - Number (ent : Transient) returns Integer; - ---Purpose : Returns the number of an entity in the Model (StartingNumber) - -- 0 if unknown in the model, or null - - SetTransferProcess (TP : mutable Transient); - ---Purpose : Sets a TransferProcess in order to analyse it (see Activator) - -- It can be either a FinderProcess or a TransientProcess, in - -- that case a new TransferReader is created on it - - TransientProcess returns TransientProcess from Transfer; - ---Purpose : Returns the TransferProcess : TransientProcess detained by - -- the TransferReader - - FinderProcess returns FinderProcess from Transfer; - ---Purpose : Returns the FinderProcess, detained by the TransferWriter - - - InitTransferReader (mode : Integer); - ---Purpose : Initialises a TransferReader, according to mode : - -- 0 nullifies it, 1 clears it (not nullify) - -- 2 sets it with TransientProcess & Model - -- 3 idem plus roots of TransientProcess - -- Remark : called with 0 at least at each SetModel/NewModel - - TransferReader returns TransferReader from XSControl; - ---Purpose : Returns the current TransferReader, can be null - -- It detains the TransientProcess - - -- Some useful functions - - - GetEntity (name : CString = "") returns Transient; - ---Purpose : Takes the name of an entity, either as argument, or (if - -- is empty) on keybord, and returns the entity - -- name can be a label or a number (in alphanumeric), it is - -- searched by NumberFromLabel from WorkSession. - -- If doesn't match en entity, a Null Handle is returned - - GetEntityNumber (name : CString = "") returns Integer; - ---Purpose : Same as GetEntity, but returns the number in the model of the - -- entity. Returns 0 for null handle - - GetList (first : CString = ""; second : CString = "") - returns HSequenceOfTransient from TColStd; - ---Purpose : Evaluates and returns a list of entity, from : - -- keyboard if and are empty, see below - -- first if second is empty : can be a number/label of an entity - -- or the name of a selection to be evaluated (standard) - -- first : name of a selection, evaluated from a list defined by - -- second - -- In case of failure, returns a Null Handle - - FileAndVar (file, var, def : CString; - resfile, resvar : out AsciiString from TCollection) - returns Boolean; - ---Purpose : Analyses given file name and variable name, with a default - -- name for variables. Returns resulting file name and variable - -- name plus status "file to read"(True) or "already read"(False) - -- In the latter case, empty resfile means no file available - -- - -- If is null or empty or equates ".", considers Session - -- and returned status is False - -- Else, returns resfile = file and status is True - -- If is neither null nor empty, resvar = var - -- Else, the root part of is considered, if defined - -- Else, is taken - - MoreShapes (list : in out mutable HSequenceOfShape from TopTools; - name : CString) returns Integer; - ---Purpose : Analyses a name as designating Shapes from DRAW variables or - -- XSTEP transfer (last Transfer on Reading). can be : - -- "*" : all the root shapes produced by last Transfer (Read) - -- i.e. considers roots of the TransientProcess - -- a name : a name of a variable DRAW - -- - -- Returns the count of designated Shapes. Their list is put in - -- . If is null, it is firstly created. Then it is - -- completed (Append without Clear) by the Shapes found - -- Returns 0 if no Shape could be found - -end XSDRAW; diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index 4db12ed129..1e42b8df3a 100644 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -11,25 +11,22 @@ // 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 #include #include #include #include - #include #include #include - #include #include @@ -37,6 +34,16 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static int deja = 0, dejald = 0; //unused variable diff --git a/src/XSDRAW/XSDRAW.hxx b/src/XSDRAW/XSDRAW.hxx new file mode 100644 index 0000000000..40d295657a --- /dev/null +++ b/src/XSDRAW/XSDRAW.hxx @@ -0,0 +1,215 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSDRAW_HeaderFile +#define _XSDRAW_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class Draw_Interpretor; +class IFSelect_SessionPilot; +class XSControl_WorkSession; +class XSControl_Controller; +class Interface_Protocol; +class Interface_InterfaceModel; +class Standard_Transient; +class Transfer_TransientProcess; +class Transfer_FinderProcess; +class XSControl_TransferReader; +class TColStd_HSequenceOfTransient; +class TCollection_AsciiString; +class TopTools_HSequenceOfShape; +class XSDRAW_Functions; +class XSDRAW_Shape; +class XSDRAW_Vars; + + +//! Basic package to work functions of X-STEP (IFSelect & Co)
+//! under control of DRAW
+//!
+//! Works with some "static" data : a SessionPilot (used to run)
+//! with its WorkSession and Model and TransferReader, a
+//! FinderProcess
+class XSDRAW { +public: + + DEFINE_STANDARD_ALLOC + + //! Takes variables to/from the DRAW session
//! Implements ProgressIndicator for DRAW
//! Changes the name under which a command of xstep is known by
+ //! Draw. This allows to avoid collisions
+ //! To be called before LoadDraw or any other xstep initialisation
+ Standard_EXPORT static void ChangeCommand(const Standard_CString oldname,const Standard_CString newname) ; + //! Removes a command from the interpretation list of Draw
+ //! To be called before LoadDraw or any other xstep initialisation
+ Standard_EXPORT static void RemoveCommand(const Standard_CString oldname) ; + //! Defines the basic context to work with a X-STEP Session :
+ //! it performs the basic inits, also records the Controller
+ //! If the Controller is not yet set, it must be set after
+ //! (call to SetController)
+ //! LoadSession is called by LoadDraw
+ //! Returns True the first time, False if already called
+ Standard_EXPORT static Standard_Boolean LoadSession() ; + //! Defines the context for using a X-STEP Session under DRAW
+ //! Once the various INITs have been done, a call to LoadDraw
+ //! records the defined commands for the X-STEP SessionPilot,
+ //! into the DRAW interpretation list.
+ //! "Set" commands are accessed under command xset
+ //! SDS>xset name command ...
+ //! Other commands can be accessed directly or under command xstep
+ //! SDS>command ... and SDS>xstep command ... are equivalent
+ //!
+ //! Only the command xinit is accessed directly only :
+ //! SDS>xinit (from the already defined Controller)
+ //! SDS>xinit iges (first defines the Controller as for "iges")
+ //!
+ //! It also records the function to be called by DRAW (not
+ //! declared because specific).
+ //! And it defines the context variables, i.e. a WorkSession, then
+ //! it calls SetController with the currently defined Controller
+ //! Remark : at least, the standard commands are recorded
+ //!
+ //! See also Controller : it is part of the Context, but it must
+ //! be precised separately
+ Standard_EXPORT static void LoadDraw(Draw_Interpretor& theCommands) ; + //! Allows to execute a xstep-draw command from C++ program
+ //! Fixed form : Execute("command args...");
+ //! Form with a variable text part : add %s for the variable :
+ //! Execute ("command args %s args..",var) [var is a CString]
+ //! Returns the same value as returned by call from DRAW
+ Standard_EXPORT static Standard_Integer Execute(const Standard_CString command,const Standard_CString var = "") ; + //! Returns the SessionPilot (can be used for direct call)
+ Standard_EXPORT static Handle_IFSelect_SessionPilot Pilot() ; + //! Returns the WorkSession defined in AddDraw (through Pilot)
+ //! It is from XSControl, it brings functionnalities for Transfers
+ Standard_EXPORT static Handle_XSControl_WorkSession Session() ; + //! Defines a Controller for the command "xinit" and applies it
+ //! (i.e. calls its method Customise)
+ Standard_EXPORT static void SetController(const Handle(XSControl_Controller)& control) ; + //! Returns the Controller, a Null Handle if not yet defined
+ Standard_EXPORT static Handle_XSControl_Controller Controller() ; + //! Sets a norm by its name (controller recorded as )
+ //! Returns True if done, False if this norm is unknown
+ //! If is given, also sets the norm to
+ //! (if is undefined for , it is ignored)
+ Standard_EXPORT static Standard_Boolean SetNorm(const Standard_CString normname,const Standard_CString profile = "") ; + //! Returns the actually defined Protocol
+ Standard_EXPORT static Handle_Interface_Protocol Protocol() ; + //! Returns the Model of the Session (it is Session()->Model() )
+ Standard_EXPORT static Handle_Interface_InterfaceModel Model() ; + //! Sets a Model in session (it is Session()->SetModel(model) )
+ //! If is defined, SetLoadedFile is also done
+ Standard_EXPORT static void SetModel(const Handle(Interface_InterfaceModel)& model,const Standard_CString file = "") ; + //! Produces a new model (from the Controller), can be Null
+ //! Does not set it in the session
+ Standard_EXPORT static Handle_Interface_InterfaceModel NewModel() ; + //! Returns the entity n0 of the Model of the Session
+ //! (it is StartingEntity)
+ //! Null Handle if is not suitable
+ Standard_EXPORT static Handle_Standard_Transient Entity(const Standard_Integer num) ; + //! Returns the number of an entity in the Model (StartingNumber)
+ //! 0 if unknown in the model, or null
+ Standard_EXPORT static Standard_Integer Number(const Handle(Standard_Transient)& ent) ; + //! Sets a TransferProcess in order to analyse it (see Activator)
+ //! It can be either a FinderProcess or a TransientProcess, in
+ //! that case a new TransferReader is created on it
+ Standard_EXPORT static void SetTransferProcess(const Handle(Standard_Transient)& TP) ; + //! Returns the TransferProcess : TransientProcess detained by
+ //! the TransferReader
+ Standard_EXPORT static Handle_Transfer_TransientProcess TransientProcess() ; + //! Returns the FinderProcess, detained by the TransferWriter
+ Standard_EXPORT static Handle_Transfer_FinderProcess FinderProcess() ; + //! Initialises a TransferReader, according to mode :
+ //! 0 nullifies it, 1 clears it (not nullify)
+ //! 2 sets it with TransientProcess & Model
+ //! 3 idem plus roots of TransientProcess
+ //! Remark : called with 0 at least at each SetModel/NewModel
+ Standard_EXPORT static void InitTransferReader(const Standard_Integer mode) ; + //! Returns the current TransferReader, can be null
+ //! It detains the TransientProcess
+ Standard_EXPORT static Handle_XSControl_TransferReader TransferReader() ; + //! Takes the name of an entity, either as argument, or (if
+ //! is empty) on keybord, and returns the entity
+ //! name can be a label or a number (in alphanumeric), it is
+ //! searched by NumberFromLabel from WorkSession.
+ //! If doesn't match en entity, a Null Handle is returned
+ Standard_EXPORT static Handle_Standard_Transient GetEntity(const Standard_CString name = "") ; + //! Same as GetEntity, but returns the number in the model of the
+ //! entity. Returns 0 for null handle
+ Standard_EXPORT static Standard_Integer GetEntityNumber(const Standard_CString name = "") ; + //! Evaluates and returns a list of entity, from :
+ //! keyboard if and are empty, see below
+ //! first if second is empty : can be a number/label of an entity
+ //! or the name of a selection to be evaluated (standard)
+ //! first : name of a selection, evaluated from a list defined by
+ //! second
+ //! In case of failure, returns a Null Handle
+ Standard_EXPORT static Handle_TColStd_HSequenceOfTransient GetList(const Standard_CString first = "",const Standard_CString second = "") ; + //! Analyses given file name and variable name, with a default
+ //! name for variables. Returns resulting file name and variable
+ //! name plus status "file to read"(True) or "already read"(False)
+ //! In the latter case, empty resfile means no file available
+ //!
+ //! If is null or empty or equates ".", considers Session
+ //! and returned status is False
+ //! Else, returns resfile = file and status is True
+ //! If is neither null nor empty, resvar = var
+ //! Else, the root part of is considered, if defined
+ //! Else, is taken
+ Standard_EXPORT static Standard_Boolean FileAndVar(const Standard_CString file,const Standard_CString var,const Standard_CString def,TCollection_AsciiString& resfile,TCollection_AsciiString& resvar) ; + //! Analyses a name as designating Shapes from DRAW variables or
+ //! XSTEP transfer (last Transfer on Reading). can be :
+ //! "*" : all the root shapes produced by last Transfer (Read)
+ //! i.e. considers roots of the TransientProcess
+ //! a name : a name of a variable DRAW
+ //!
+ //! Returns the count of designated Shapes. Their list is put in
+ //! . If is null, it is firstly created. Then it is
+ //! completed (Append without Clear) by the Shapes found
+ //! Returns 0 if no Shape could be found
+ Standard_EXPORT static Standard_Integer MoreShapes(Handle(TopTools_HSequenceOfShape)& list,const Standard_CString name) ; + +private: + +friend class XSDRAW_Functions; +friend class XSDRAW_Shape; +friend class XSDRAW_Vars; + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) + + +#endif diff --git a/src/XSDRAW/XSDRAW_Functions.cdl b/src/XSDRAW/XSDRAW_Functions.cdl deleted file mode 100644 index ddbea60ae5..0000000000 --- a/src/XSDRAW/XSDRAW_Functions.cdl +++ /dev/null @@ -1,37 +0,0 @@ --- Created on: 1995-03-16 --- Created by: Christian CAILLET --- 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 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. - -class Functions from XSDRAW - - ---Purpose : Defines additionnal commands for XSDRAW to : - -- - control of initialisation (xinit, xnorm, newmodel) - -- - analyse of the result of a transfer (recorded in a - -- TransientProcess for Read, FinderProcess for Write) : - -- statistics, various lists (roots,complete,abnormal), what - -- about one specific entity, producing a model with the - -- abnormal result - -- - -- This appendix of XSDRAW is compiled separately to distinguish - -- basic features from user callable forms - -uses CString - -is - - Init (myclass); - ---Purpose : Defines and loads all basic functions for XSDRAW (as ActFunc) - -end Functions; diff --git a/src/XSDRAW/XSDRAW_Functions.cxx b/src/XSDRAW/XSDRAW_Functions.cxx index f2953c524b..b896f1fbbc 100644 --- a/src/XSDRAW/XSDRAW_Functions.cxx +++ b/src/XSDRAW/XSDRAW_Functions.cxx @@ -11,7 +11,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include void XSDRAW_Functions::Init () diff --git a/src/XSDRAW/XSDRAW_Functions.hxx b/src/XSDRAW/XSDRAW_Functions.hxx new file mode 100644 index 0000000000..f6ec87d4ab --- /dev/null +++ b/src/XSDRAW/XSDRAW_Functions.hxx @@ -0,0 +1,44 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSDRAW_Functions_HeaderFile +#define _XSDRAW_Functions_HeaderFile + +#include +#include +#include + +//! Defines additionnal commands for XSDRAW to :
+//! - control of initialisation (xinit, xnorm, newmodel)
+//! - analyse of the result of a transfer (recorded in a
+//! TransientProcess for Read, FinderProcess for Write) :
+//! statistics, various lists (roots,complete,abnormal), what
+//! about one specific entity, producing a model with the
+//! abnormal result
+//!
+//! This appendix of XSDRAW is compiled separately to distinguish
+//! basic features from user callable forms
+class XSDRAW_Functions +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Defines and loads all basic functions for XSDRAW (as ActFunc)
+ Standard_EXPORT static void Init() ; +}; +#endif diff --git a/src/XSDRAW/XSDRAW_Shape.cdl b/src/XSDRAW/XSDRAW_Shape.cdl deleted file mode 100644 index 5ee7570334..0000000000 --- a/src/XSDRAW/XSDRAW_Shape.cdl +++ /dev/null @@ -1,32 +0,0 @@ --- Created on: 1997-04-22 --- Created by: Christian CAILLET --- Copyright (c) 1997-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 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. - -class Shape from XSDRAW - - ---Purpose : Defines functions to control shapes (in way useful for XSTEP), - -- additional features which should be basic, or call tools which - -- are bound with transfer needs. - -- But these functions work on shapes, geometry, nothing else - -- (no file, no model, no entity) - -uses CString, Interpretor from Draw - -is - - InitCommands (myclass; theCommands : in out Interpretor from Draw); - ---Purpose : Defines and loads all basic functions for XSDRAW on Shapes - -end Shape; diff --git a/src/XSDRAW/XSDRAW_Shape.cxx b/src/XSDRAW/XSDRAW_Shape.cxx index 9e2f7909bd..ac57a52e66 100644 --- a/src/XSDRAW/XSDRAW_Shape.cxx +++ b/src/XSDRAW/XSDRAW_Shape.cxx @@ -11,8 +11,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include +#include //unused variable //static int initactor = 0; diff --git a/src/XSDRAW/XSDRAW_Shape.hxx b/src/XSDRAW/XSDRAW_Shape.hxx new file mode 100644 index 0000000000..32ea9f31b6 --- /dev/null +++ b/src/XSDRAW/XSDRAW_Shape.hxx @@ -0,0 +1,44 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSDRAW_Shape_HeaderFile +#define _XSDRAW_Shape_HeaderFile + +#include +#include +#include + +class Draw_Interpretor; + + +//! Defines functions to control shapes (in way useful for XSTEP),
+//! additional features which should be basic, or call tools which
+//! are bound with transfer needs.
+//! But these functions work on shapes, geometry, nothing else
+//! (no file, no model, no entity)
+class XSDRAW_Shape +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Defines and loads all basic functions for XSDRAW on Shapes
+ Standard_EXPORT static void InitCommands(Draw_Interpretor& theCommands); + +}; + +#endif diff --git a/src/XSDRAW/XSDRAW_Vars.cdl b/src/XSDRAW/XSDRAW_Vars.cdl deleted file mode 100644 index b1e5ba2075..0000000000 --- a/src/XSDRAW/XSDRAW_Vars.cdl +++ /dev/null @@ -1,56 +0,0 @@ --- Created on: 1998-07-22 --- 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 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. - -class Vars from XSDRAW inherits Vars from XSControl - - ---Purpose : Vars for DRAW session (i.e. DBRep and DrawTrSurf) - -uses CString, Transient, - Pnt from gp, Pnt2d from gp, - Geometry from Geom, Curve from Geom, Curve from Geom2d, Surface from Geom, - Shape from TopoDS - -is - - Create returns mutable Vars from XSDRAW; - - Set (me : mutable; name : CString; val : Transient) is redefined; - --- Get (me; name : CString) returns Transient is redefined; unused here - - - GetGeom (me; name : in out CString) returns Geometry is redefined; - - GetCurve2d (me; name : in out CString) returns Curve from Geom2d is redefined; - - GetCurve (me; name : in out CString) returns Curve from Geom is redefined; - - GetSurface (me; name : in out CString) returns Surface from Geom is redefined; - - SetPoint (me : mutable; name : CString; val : Pnt from gp) is redefined; - - SetPoint2d (me : mutable; name : CString; val : Pnt2d from gp) is redefined; - - GetPoint (me; name : in out CString; pnt : out Pnt from gp) returns Boolean is redefined; - - GetPoint2d (me; name : in out CString; pnt : out Pnt2d from gp) returns Boolean is redefined; - - - SetShape (me : mutable; name : CString; val : Shape from TopoDS) is redefined; - - GetShape (me; name : in out CString) returns Shape from TopoDS is redefined; - -end Vars; diff --git a/src/XSDRAW/XSDRAW_Vars.cxx b/src/XSDRAW/XSDRAW_Vars.cxx index 7ff8757a22..ab1195b3f7 100644 --- a/src/XSDRAW/XSDRAW_Vars.cxx +++ b/src/XSDRAW/XSDRAW_Vars.cxx @@ -11,16 +11,35 @@ // 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 +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_TYPE(XSDRAW_Vars) +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + STANDARD_TYPE(XSControl_Vars), + STANDARD_TYPE(MMgt_TShared), + STANDARD_TYPE(Standard_Transient), + +IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(XSDRAW_Vars) +IMPLEMENT_DOWNCAST(XSDRAW_Vars,Standard_Transient) +IMPLEMENT_STANDARD_RTTI(XSDRAW_Vars) XSDRAW_Vars::XSDRAW_Vars () { } @@ -28,8 +47,6 @@ void XSDRAW_Vars::Set (const Standard_CString name, const Handle(Standard_Transient)& val) { - //char* nam = name; -// selon type DeclareAndCast(Geom_Geometry,geom,val); if (!geom.IsNull()) { DrawTrSurf::Set(name,geom); @@ -40,19 +57,8 @@ void XSDRAW_Vars::Set DrawTrSurf::Set(name,geom); return; } -// ?? } -/* -Handle(Standard_Transient) XSDRAW_Vars::Get (const Standard_CString name) const -{ - Handle(Standard_Transient) val; - if (!thevars->GetItem (name,val)) val.Nullify(); - return val; -} -*/ - - Handle(Geom_Geometry) XSDRAW_Vars::GetGeom (Standard_CString& name) const { //char* nam = name; return DrawTrSurf::Get(name); diff --git a/src/XSDRAW/XSDRAW_Vars.hxx b/src/XSDRAW/XSDRAW_Vars.hxx new file mode 100644 index 0000000000..41e1b8de0a --- /dev/null +++ b/src/XSDRAW/XSDRAW_Vars.hxx @@ -0,0 +1,80 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _XSDRAW_Vars_HeaderFile +#define _XSDRAW_Vars_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_Transient; +class Geom_Geometry; +class Geom2d_Curve; +class Geom_Curve; +class Geom_Surface; +class gp_Pnt; +class gp_Pnt2d; +class TopoDS_Shape; +class Standard_Transient; +class Handle(Standard_Type); +class Handle(XSControl_Vars); +class XSDRAW_Vars; + +DEFINE_STANDARD_HANDLE(XSDRAW_Vars,XSControl_Vars) + +//! Vars for DRAW session (i.e. DBRep and DrawTrSurf)
+class XSDRAW_Vars : public XSControl_Vars { + +public: + + Standard_EXPORT XSDRAW_Vars(); + + Standard_EXPORT virtual void Set(const Standard_CString name,const Handle(Standard_Transient)& val) ; + + Standard_EXPORT virtual Handle_Geom_Geometry GetGeom(Standard_CString& name) const; + + Standard_EXPORT virtual Handle_Geom2d_Curve GetCurve2d(Standard_CString& name) const; + + Standard_EXPORT virtual Handle_Geom_Curve GetCurve(Standard_CString& name) const; + + Standard_EXPORT virtual Handle_Geom_Surface GetSurface(Standard_CString& name) const; + + Standard_EXPORT virtual void SetPoint(const Standard_CString name,const gp_Pnt& val) ; + + Standard_EXPORT virtual void SetPoint2d(const Standard_CString name,const gp_Pnt2d& val) ; + + Standard_EXPORT virtual Standard_Boolean GetPoint(Standard_CString& name,gp_Pnt& pnt) const; + + Standard_EXPORT virtual Standard_Boolean GetPoint2d(Standard_CString& name,gp_Pnt2d& pnt) const; + + Standard_EXPORT virtual void SetShape(const Standard_CString name,const TopoDS_Shape& val) ; + + Standard_EXPORT virtual TopoDS_Shape GetShape(Standard_CString& name) const; + + DEFINE_STANDARD_RTTI(XSDRAW_Vars) + +}; + +#endif