From 99ec196bb8c8c7924645e17d3e7ea5cb53760d88 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 30 Jan 2008 15:58:30 +0000 Subject: [PATCH] Merge from BR_Dev_For_4_0 branch (from tag mergeto_BR_QT4_Dev_17Jan08) --- bin/Makefile.am | 7 +- bin/NSparam.py | 4 +- bin/addToKillList.py | 16 +- bin/appli_gen.py | 3 +- bin/appliskel/killCurrentPort | 2 +- bin/appliskel/runAppli | 2 +- bin/appliskel/runRemote.sh | 4 +- bin/envSalome.py | 9 +- bin/killSalome.py | 27 +- bin/killSalomeWithPort.py | 6 +- bin/launchConfigureParser.py | 149 +- bin/nameserver.py | 102 +- bin/orbmodule.py | 13 +- bin/runNS.py | 102 +- bin/runSalome | 6 +- bin/runSalome.csh | 2 +- bin/runSalome.ksh | 2 +- bin/runSalome.py | 100 +- bin/server.py | 60 +- bin/setenv.py | 36 +- bin/shutdownSalome.py | 28 + bin/virtual_salome.py | 67 +- bin/waitContainers.py | 53 + bin/waitNS.py | 4 + bin/waitNS.sh | 9 + clean_configure | 4 + configure.ac | 33 +- doc/Makefile.am | 16 +- doc/salome/Makefile.am | 5 + doc/salome/batch.dox | 10 + doc/salome/install.dox | 378 + doc/salome/kernel_resources.dox | 559 ++ doc/salome/kernel_services.dox | 236 + doc/salome/main.dox | 82 + doc/salome/salome_application.dox | 373 + doc/salome/salome_file.dox | 123 + doc/salome/tui/KERNEL/doxyuser.in | 19 +- doc/salome/tui/KERNEL/sources/footer.html | 25 +- .../tui/KERNEL/sources/kernel_about_4.png | Bin 0 -> 134730 bytes doc/salome/tui/KERNEL/sources/myheader.html | 24 +- doc/salome/tui/Makefile.am | 22 +- doc/salome/unittests.dox | 207 + idl/DSC_Engines.idl | 27 +- idl/DSC_Engines.xml | 3 + idl/Makefile.am | 44 +- idl/SALOMEDS.idl | 22 +- idl/SALOME_Component.idl | 338 +- idl/SALOME_Component.xml | 19 +- idl/SALOME_ContainerManager.idl | 65 +- .../SALOME_Exception.xml | 25 +- idl/SALOME_ModuleCatalog.idl | 53 +- idl/SALOME_Registry.idl | 2 + idl/SALOME_Session.idl | 4 + resources/CatalogResources.xml.in | 67 +- resources/KERNELCatalog.xml.in | 24 + resources/Makefile.am | 3 +- salome_adm/unix/config_files/Makefile.am | 5 +- salome_adm/unix/config_files/check_boost.m4 | 5 + salome_adm/unix/config_files/check_cppunit.m4 | 3 +- salome_adm/unix/config_files/check_htmlgen.m4 | 2 +- salome_adm/unix/config_files/check_libxml.m4 | 53 + salome_adm/unix/config_files/check_mpi.m4 | 21 +- salome_adm/unix/config_files/check_omniorb.m4 | 26 +- salome_adm/unix/config_files/check_openmpi.m4 | 56 + salome_adm/unix/config_files/check_swig.m4 | 7 + salome_adm/unix/config_files/install-sh | 323 - salome_adm/unix/config_files/ltmain.sh | 6443 ----------------- salome_adm/unix/config_files/missing | 190 - salome_adm/unix/config_files/production.m4 | 79 +- salome_adm/unix/make_common_starter.am | 1 + src/Batch/BatchLight_BatchManager.cxx | 272 + src/Batch/BatchLight_BatchManager.hxx | 94 + src/Batch/BatchLight_BatchManager_PBS.cxx | 375 + src/Batch/BatchLight_BatchManager_PBS.hxx | 59 + src/Batch/BatchLight_BatchManager_SLURM.cxx | 327 + src/Batch/BatchLight_BatchManager_SLURM.hxx | 62 + .../BatchLight_Job.cxx} | 44 +- src/Batch/BatchLight_Job.hxx | 62 + src/Batch/Makefile.am | 18 +- src/Batch/MpiImpl.cxx | 212 + src/Batch/MpiImpl.hxx | 131 + src/CASCatch/CASCatch.hxx | 55 - src/CASCatch/CASCatch_CatchSignals.cxx | 333 - src/CASCatch/CASCatch_CatchSignals.hxx | 63 - src/CASCatch/CASCatch_ErrorHandler.cxx | 122 - src/CASCatch/CASCatch_ErrorHandler.hxx | 92 - src/CASCatch/CASCatch_Failure.cxx | 126 - src/CASCatch/CASCatch_Failure.hxx | 60 - src/CASCatch/Makefile.am | 41 - src/Communication/SALOME_Communication.hxx | 2 +- src/Container/Component_i.cxx | 222 +- src/Container/Container_i.cxx | 330 +- src/Container/Makefile.am | 33 +- src/Container/SALOME_Component_i.hxx | 28 + src/Container/SALOME_Container.cxx | 56 + src/Container/SALOME_ContainerManager.cxx | 189 +- src/Container/SALOME_ContainerManager.hxx | 20 +- src/Container/SALOME_ContainerPy.py | 2 - src/Container/SALOME_Container_i.hxx | 3 +- src/Container/Salome_file_i.cxx | 1062 +++ src/Container/Salome_file_i.hxx | 106 + src/Container/TestSalome_file.cxx | 154 + src/DF/DF_Application.cxx | 79 + src/DF/DF_Application.hxx | 47 + src/DF/DF_Attribute.cxx | 42 + src/DF/DF_Attribute.hxx | 60 + src/DF/DF_ChildIterator.cxx | 80 + src/DF/DF_ChildIterator.hxx | 38 + src/DF/DF_Container.cxx | 196 + src/DF/DF_Container.hxx | 85 + src/DF/DF_Document.cxx | 125 + src/DF/DF_Document.hxx | 65 + src/DF/DF_Label.cxx | 477 ++ src/DF/DF_Label.hxx | 155 + src/DF/DF_definitions.hxx | 125 + src/DF/Makefile.am | 99 + src/DF/testDF.cxx | 311 + src/DSC/DSC.dox | 49 + src/DSC/DSC_Basic/ConnectionManager_i.cxx | 53 +- src/DSC/DSC_Basic/ConnectionManager_i.hxx | 26 +- src/DSC/DSC_Basic/DSC_Basic.hxx | 3 +- .../SALOME_ConnectionManagerServer.cxx | 1 + src/DSC/DSC_Python/Makefile.am | 79 + src/DSC/DSC_Python/calcium.i | 565 ++ src/DSC/DSC_Python/dsccalcium.py | 53 + src/DSC/DSC_User/Basic/basic_port_factory.hxx | 4 +- .../Basic/data_short_port_provides.cxx | 51 +- .../Basic/data_short_port_provides.hxx | 8 + .../DSC_User/Basic/data_short_port_uses.cxx | 6 - .../DSC_User/Basic/data_short_port_uses.hxx | 6 - .../DSC_User/Datastream/AdjacentFunctor.hxx | 10 + src/DSC/DSC_User/Datastream/Calcium/Calcium.c | 3 +- .../DSC_User/Datastream/Calcium/Calcium.cxx | 114 + .../DSC_User/Datastream/Calcium/Calcium.hxx | 17 + .../Calcium/CalciumCouplingPolicy.hxx | 47 +- .../Calcium/CalciumGenericProvidesPort.hxx | 9 +- .../Calcium/CalciumGenericUsesPort.hxx | 5 +- .../Datastream/Calcium/CalciumInterface.hxx | 146 +- .../Calcium/CalciumTypes2CorbaTypes.cxx | 4 + .../Datastream/Calcium/Copy2CorbaSpace.hxx | 8 + .../Datastream/Calcium/Copy2UserSpace.hxx | 4 + .../Calcium/CorbaTypes2CalciumTypes.cxx | 4 + .../DSC_User/Datastream/Calcium/Makefile.am | 14 +- src/DSC/DSC_User/Datastream/Calcium/calcium.h | 1 - .../Calcium/calcium_port_factory.hxx | 4 +- .../DSC_User/Datastream/Calcium/calciumf.c | 120 + src/DSC/DSC_User/Datastream/Calcium/fortoc.h | 20 + .../Datastream/CorbaTypeManipulator.hxx | 4 + src/DSC/DSC_User/Datastream/GenericPort.hxx | 85 +- .../DSC_User/Datastream/GenericUsesPort.hxx | 23 +- .../Datastream/Palm/palm_port_factory.hxx | 4 +- src/DSC/DSC_User/Makefile.am | 5 +- src/DSC/DSC_User/Superv_Component_i.cxx | 98 +- src/DSC/DSC_User/Superv_Component_i.hxx | 44 +- src/DSC/DSC_User/port_factory.hxx | 61 + src/DSC/DSC_User/uses_port.hxx | 8 - src/DSC/Makefile.am | 4 +- src/DSC/ParallelDSC/ParallelDSC_i.cxx | 3 +- src/DSC/ParallelDSC/ParallelDSC_i.hxx | 2 - src/HDFPersist/HDFascii.cc | 182 +- src/HDFPersist/HDFascii.hxx | 4 +- src/HDFPersist/HDFcontainerObject.cc | 4 +- src/HDFPersist/HDFcontainerObject.hxx | 6 +- src/HDFPersist/HDFdataset.cc | 4 +- src/HDFPersist/HDFdataset.hxx | 8 +- .../HDFexport.hxx} | 33 +- src/HDFPersist/HDFfile.hxx | 4 +- src/HDFPersist/HDFgroup.cc | 2 +- src/HDFPersist/HDFgroup.hxx | 6 +- src/HDFPersist/HDFinternalObject.cc | 2 +- src/HDFPersist/HDFinternalObject.hxx | 6 +- src/HDFPersist/HDFobject.cc | 4 +- src/HDFPersist/HDFobject.hxx | 6 +- src/HDFPersist/Makefile.am | 8 +- src/KERNEL_PY/Help.py | 6 +- src/KERNEL_PY/batchmode_salome.py | 2 +- src/KERNEL_PY/salome.py | 49 + src/KERNEL_PY/salome_iapp.py | 2 +- src/KERNEL_PY/salome_study.py | 3 + src/Launcher/Makefile.am | 129 + src/Launcher/SALOME_Launcher.cxx | 275 + src/Launcher/SALOME_Launcher.hxx | 82 + .../SALOME_LauncherServer.cxx} | 63 +- src/LifeCycleCORBA/Makefile.am | 25 +- .../SALOME_FileTransferCORBA.cxx | 4 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 70 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 2 + .../Test/LifeCycleCORBATest.cxx | 13 +- src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py | 15 +- .../TestContainerManager.cxx | 47 +- src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx | 6 - .../Test/TestLifeCycleCORBA_SWIG.py | 13 +- src/Makefile.am | 11 +- src/ModuleCatalog/Makefile.am | 10 +- .../SALOME_ModuleCatalog_Acomponent_impl.cxx | 2 +- .../SALOME_ModuleCatalog_Acomponent_impl.hxx | 4 +- .../SALOME_ModuleCatalog_Client.cxx | 2 - .../SALOME_ModuleCatalog_Handler.cxx | 1108 +-- .../SALOME_ModuleCatalog_Handler.hxx | 188 +- .../SALOME_ModuleCatalog_Parser.hxx | 40 +- .../SALOME_ModuleCatalog_Server.cxx | 23 +- .../SALOME_ModuleCatalog_impl.cxx | 222 +- .../SALOME_ModuleCatalog_impl.hxx | 21 +- src/NamingService/SALOME_NamingService.cxx | 293 +- src/NamingService/SALOME_NamingServicePy.py | 17 +- src/NamingService/Test/TestNamingService.py | 5 +- src/ParallelContainer/Makefile.am | 24 +- .../Parallel_Salome_file_i.cxx | 358 + .../Parallel_Salome_file_i.hxx | 74 + .../SALOME_ParallelComponent_i.cxx | 399 +- .../SALOME_ParallelComponent_i.hxx | 55 +- .../SALOME_ParallelContainerNodeDummy.cxx | 52 +- .../SALOME_ParallelContainerNodeMpi.cxx | 70 +- .../SALOME_ParallelContainer_i.cxx | 33 +- .../SALOME_ParallelContainer_i.hxx | 3 + src/Registry/RegistryService.cxx | 13 +- src/Registry/RegistryService.hxx | 5 + src/Registry/SALOME_Registry.hxx | 3 +- src/Registry/SALOME_Registry_Server.cxx | 9 +- src/ResourcesManager/Makefile.am | 12 +- .../SALOME_LoadRateManager.cxx | 46 +- .../SALOME_LoadRateManager.hxx | 3 +- .../SALOME_ResourcesCatalog_Handler.cxx | 513 +- .../SALOME_ResourcesCatalog_Handler.hxx | 38 +- .../SALOME_ResourcesCatalog_Parser.cxx | 62 +- .../SALOME_ResourcesCatalog_Parser.hxx | 14 +- .../SALOME_ResourcesManager.cxx | 431 +- .../SALOME_ResourcesManager.hxx | 48 +- ...DS_DataMapNodeOfDataMapOfIntegerString.hxx | 80 - ...LOMEDS_DataMapNodeOfDataMapStringLabel.hxx | 102 - .../Handle_SALOMEDS_DrawableAttribute.hxx | 102 - .../Handle_SALOMEDS_ExpandableAttribute.hxx | 102 - .../Handle_SALOMEDS_ExternalFileDef.hxx | 86 - src/SALOMEDS/Handle_SALOMEDS_FileType.hxx | 87 - src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx | 102 - .../Handle_SALOMEDS_LocalIDAttribute.hxx | 102 - .../Handle_SALOMEDS_OCAFApplication.hxx | 102 - .../Handle_SALOMEDS_OpenedAttribute.hxx | 102 - .../Handle_SALOMEDS_PersRefAttribute.hxx | 102 - .../Handle_SALOMEDS_PixMapAttribute.hxx | 102 - .../Handle_SALOMEDS_PythonObjectAttribute.hxx | 85 - .../Handle_SALOMEDS_SelectableAttribute.hxx | 102 - ...le_SALOMEDS_SequenceOfIntegerAttribute.hxx | 98 - ...andle_SALOMEDS_SequenceOfRealAttribute.hxx | 98 - ...ndle_SALOMEDS_StudyPropertiesAttribute.hxx | 85 - ...andle_SALOMEDS_TableOfIntegerAttribute.hxx | 85 - .../Handle_SALOMEDS_TableOfRealAttribute.hxx | 85 - ...Handle_SALOMEDS_TableOfStringAttribute.hxx | 84 - .../Handle_SALOMEDS_TargetAttribute.hxx | 102 - .../Handle_SALOMEDS_TextColorAttribute.hxx | 102 - ...e_SALOMEDS_TextHighlightColorAttribute.hxx | 102 - src/SALOMEDS/Makefile.am | 71 +- src/SALOMEDS/SALOMEDS.cdl | 59 - src/SALOMEDS/SALOMEDS_AttLong_i.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttLong_i.hxx | 1 - src/SALOMEDS/SALOMEDS_AttReal_i.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttReal_i.hxx | 1 - src/SALOMEDS/SALOMEDS_AttributeComment.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeComment.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx | 10 +- src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx | 2 +- .../SALOMEDS_AttributeExpandable_i.cxx | 4 +- .../SALOMEDS_AttributeExpandable_i.hxx | 2 +- .../SALOMEDS_AttributeExternalFileDef.cxx | 10 +- .../SALOMEDS_AttributeExternalFileDef.hxx | 2 +- .../SALOMEDS_AttributeExternalFileDef_i.cxx | 5 +- .../SALOMEDS_AttributeExternalFileDef_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFileType.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeFileType.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFlags.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttributeFlags.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeIOR.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeIOR.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeInteger.cxx | 15 +- src/SALOMEDS/SALOMEDS_AttributeInteger.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeName.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName_i.cxx | 5 +- src/SALOMEDS/SALOMEDS_AttributeName_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeOpened.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeOpened.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeParameter.cxx | 49 +- src/SALOMEDS/SALOMEDS_AttributeParameter.hxx | 2 +- .../SALOMEDS_AttributeParameter_i.cxx | 43 +- .../SALOMEDS_AttributeParameter_i.hxx | 2 +- .../SALOMEDS_AttributePersistentRef.cxx | 9 +- .../SALOMEDS_AttributePersistentRef.hxx | 2 +- .../SALOMEDS_AttributePersistentRef_i.cxx | 5 +- .../SALOMEDS_AttributePersistentRef_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributePixMap.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttributePixMap.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx | 2 +- .../SALOMEDS_AttributePythonObject.cxx | 12 +- .../SALOMEDS_AttributePythonObject.hxx | 2 +- .../SALOMEDS_AttributePythonObject_i.cxx | 11 +- .../SALOMEDS_AttributePythonObject_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeReal.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeReal.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx | 2 +- .../SALOMEDS_AttributeSelectable_i.cxx | 6 +- .../SALOMEDS_AttributeSelectable_i.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfInteger.cxx | 24 +- .../SALOMEDS_AttributeSequenceOfInteger.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfInteger_i.cxx | 31 +- .../SALOMEDS_AttributeSequenceOfInteger_i.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfReal.cxx | 24 +- .../SALOMEDS_AttributeSequenceOfReal.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfReal_i.cxx | 27 +- .../SALOMEDS_AttributeSequenceOfReal_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeString.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeString.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeString_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeString_i.hxx | 2 +- .../SALOMEDS_AttributeStudyProperties.cxx | 70 +- .../SALOMEDS_AttributeStudyProperties.hxx | 8 +- .../SALOMEDS_AttributeStudyProperties_i.cxx | 72 +- .../SALOMEDS_AttributeStudyProperties_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger.cxx | 110 +- .../SALOMEDS_AttributeTableOfInteger.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger_i.cxx | 135 +- .../SALOMEDS_AttributeTableOfInteger_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal.cxx | 108 +- .../SALOMEDS_AttributeTableOfReal.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal_i.cxx | 128 +- .../SALOMEDS_AttributeTableOfReal_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfString.cxx | 109 +- .../SALOMEDS_AttributeTableOfString.hxx | 2 +- .../SALOMEDS_AttributeTableOfString_i.cxx | 147 +- .../SALOMEDS_AttributeTableOfString_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTarget.cxx | 18 +- src/SALOMEDS/SALOMEDS_AttributeTarget.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx | 23 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx | 26 +- src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx | 2 +- .../SALOMEDS_AttributeTextColor_i.cxx | 22 +- .../SALOMEDS_AttributeTextColor_i.hxx | 2 +- .../SALOMEDS_AttributeTextHighlightColor.cxx | 25 +- .../SALOMEDS_AttributeTextHighlightColor.hxx | 2 +- ...SALOMEDS_AttributeTextHighlightColor_i.cxx | 22 +- ...SALOMEDS_AttributeTextHighlightColor_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx | 130 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx | 74 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeUserID.cxx | 14 +- src/SALOMEDS/SALOMEDS_AttributeUserID.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_Attributes.hxx | 2 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx | 6 +- src/SALOMEDS/SALOMEDS_ChildIterator.cxx | 8 +- src/SALOMEDS/SALOMEDS_ChildIterator.hxx | 4 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_Client.cxx | 18 +- src/SALOMEDS/SALOMEDS_ClientAttributes.hxx | 2 +- ...ataMapIteratorOfDataMapOfIntegerString.hxx | 95 - ...aMapIteratorOfDataMapOfIntegerString_0.cxx | 46 - ...DS_DataMapIteratorOfDataMapStringLabel.hxx | 114 - ..._DataMapIteratorOfDataMapStringLabel_0.cxx | 64 - ...DS_DataMapNodeOfDataMapOfIntegerString.hxx | 132 - ..._DataMapNodeOfDataMapOfIntegerString_0.cxx | 95 - ...LOMEDS_DataMapNodeOfDataMapStringLabel.hxx | 154 - ...MEDS_DataMapNodeOfDataMapStringLabel_0.cxx | 113 - .../SALOMEDS_DataMapOfIntegerString.hxx | 127 - .../SALOMEDS_DataMapOfIntegerString_0.cxx | 49 - src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx | 146 - .../SALOMEDS_DataMapStringLabel_0.cxx | 67 - src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl | 73 - src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx | 114 - src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx | 127 - src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_Driver_i.cxx | 111 +- src/SALOMEDS/SALOMEDS_Driver_i.hxx | 81 +- src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl | 73 - src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx | 114 - src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx | 127 - src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl | 73 - src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx | 114 - src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx | 110 - src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx | 75 - src/SALOMEDS/SALOMEDS_FileType.cdl | 73 - src/SALOMEDS/SALOMEDS_FileType.cxx | 114 - src/SALOMEDS/SALOMEDS_FileType.hxx | 110 - src/SALOMEDS/SALOMEDS_FileType.ixx | 74 - src/SALOMEDS/SALOMEDS_FileType.jxx | 37 - src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx | 162 - src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx | 72 - src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 22 +- src/SALOMEDS/SALOMEDS_GenericAttribute.hxx | 6 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 41 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 12 +- src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx | 185 - src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx | 80 - src/SALOMEDS/SALOMEDS_IORAttribute.cdl | 73 - src/SALOMEDS/SALOMEDS_IORAttribute.cxx | 117 - src/SALOMEDS/SALOMEDS_IORAttribute.hxx | 131 - src/SALOMEDS/SALOMEDS_IORAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_IORAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_IParameters.cxx | 18 +- src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl | 72 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx | 114 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx | 127 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_OCAFApplication.cdl | 45 - src/SALOMEDS/SALOMEDS_OCAFApplication.cxx | 66 - src/SALOMEDS/SALOMEDS_OCAFApplication.hxx | 114 - src/SALOMEDS/SALOMEDS_OCAFApplication.ixx | 87 - src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl | 74 - src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx | 114 - src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx | 127 - src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl | 73 - src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx | 113 - src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx | 125 - src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl | 73 - src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx | 113 - src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx | 125 - src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx | 46 - .../SALOMEDS_PythonObjectAttribute.cdl | 83 - .../SALOMEDS_PythonObjectAttribute.cxx | 89 - .../SALOMEDS_PythonObjectAttribute.hxx | 126 - .../SALOMEDS_PythonObjectAttribute.ixx | 68 - .../SALOMEDS_PythonObjectAttribute.jxx | 29 - src/SALOMEDS/SALOMEDS_SAttribute_i.hxx | 63 - src/SALOMEDS/SALOMEDS_SComponent.cxx | 11 +- src/SALOMEDS/SALOMEDS_SComponent.hxx | 2 +- src/SALOMEDS/SALOMEDS_SComponentIterator.cxx | 11 +- src/SALOMEDS/SALOMEDS_SComponentIterator.hxx | 2 +- .../SALOMEDS_SComponentIterator_i.cxx | 11 +- .../SALOMEDS_SComponentIterator_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SComponent_i.cxx | 29 +- src/SALOMEDS/SALOMEDS_SComponent_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 56 +- src/SALOMEDS/SALOMEDS_SObject.hxx | 8 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 69 +- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 8 +- src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl | 74 - src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx | 114 - src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx | 127 - src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx | 43 - .../SALOMEDS_SequenceOfIntegerAttribute.cdl | 101 - .../SALOMEDS_SequenceOfIntegerAttribute.cxx | 151 - .../SALOMEDS_SequenceOfIntegerAttribute.hxx | 134 - .../SALOMEDS_SequenceOfIntegerAttribute.ixx | 85 - .../SALOMEDS_SequenceOfIntegerAttribute.jxx | 46 - .../SALOMEDS_SequenceOfRealAttribute.cdl | 100 - .../SALOMEDS_SequenceOfRealAttribute.cxx | 153 - .../SALOMEDS_SequenceOfRealAttribute.hxx | 137 - .../SALOMEDS_SequenceOfRealAttribute.ixx | 85 - .../SALOMEDS_SequenceOfRealAttribute.jxx | 46 - src/SALOMEDS/SALOMEDS_Server.cxx | 6 +- src/SALOMEDS/SALOMEDS_Study.cxx | 137 +- src/SALOMEDS/SALOMEDS_Study.hxx | 5 +- src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 72 +- src/SALOMEDS/SALOMEDS_StudyBuilder.hxx | 4 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 97 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 9 +- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 42 +- src/SALOMEDS/SALOMEDS_StudyManager.hxx | 2 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 111 +- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 15 +- .../SALOMEDS_StudyPropertiesAttribute.cdl | 107 - .../SALOMEDS_StudyPropertiesAttribute.cxx | 217 - .../SALOMEDS_StudyPropertiesAttribute.hxx | 148 - .../SALOMEDS_StudyPropertiesAttribute.ixx | 68 - .../SALOMEDS_StudyPropertiesAttribute.jxx | 35 - src/SALOMEDS/SALOMEDS_Study_i.cxx | 224 +- src/SALOMEDS/SALOMEDS_Study_i.hxx | 13 +- src/SALOMEDS/SALOMEDS_TMPFile_i.cxx | 10 - src/SALOMEDS/SALOMEDS_TMPFile_i.hxx | 6 - .../SALOMEDS_TableOfIntegerAttribute.cxx | 399 - .../SALOMEDS_TableOfIntegerAttribute.hxx | 163 - .../SALOMEDS_TableOfIntegerAttribute.ixx | 68 - .../SALOMEDS_TableOfIntegerAttribute.jxx | 35 - .../SALOMEDS_TableOfRealAttribute.cxx | 405 -- .../SALOMEDS_TableOfRealAttribute.hxx | 171 - .../SALOMEDS_TableOfRealAttribute.ixx | 68 - .../SALOMEDS_TableOfRealAttribute.jxx | 35 - .../SALOMEDS_TableOfStringAttribute.cxx | 423 -- .../SALOMEDS_TableOfStringAttribute.hxx | 170 - .../SALOMEDS_TableOfStringAttribute.ixx | 67 - .../SALOMEDS_TableOfStringAttribute.jxx | 34 - src/SALOMEDS/SALOMEDS_TargetAttribute.cdl | 70 - src/SALOMEDS/SALOMEDS_TargetAttribute.cxx | 122 - src/SALOMEDS/SALOMEDS_TargetAttribute.hxx | 133 - src/SALOMEDS/SALOMEDS_TargetAttribute.ixx | 87 - src/SALOMEDS/SALOMEDS_TargetAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl | 69 - src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx | 93 - src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx | 122 - src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx | 87 - .../SALOMEDS_TextHighlightColorAttribute.cdl | 68 - .../SALOMEDS_TextHighlightColorAttribute.cxx | 92 - .../SALOMEDS_TextHighlightColorAttribute.hxx | 122 - .../SALOMEDS_TextHighlightColorAttribute.ixx | 87 - .../SALOMEDS_TextHighlightColorAttribute.jxx | 40 - src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 29 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 36 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 8 +- src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx | 18 +- src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx | 13 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx | 4 +- src/SALOMEDS/SALOME_DriverPy.py | 4 +- src/SALOMEDS/Test/Makefile.am | 12 +- src/SALOMEDS/Test/SALOMEDSTest.cxx | 11 +- src/SALOMEDS/Test/SALOMEDSTest.hxx | 24 +- .../Test/SALOMEDSTest_AttributeExpandable.cxx | 10 +- .../Test/SALOMEDSTest_AttributeSelectable.cxx | 10 +- ...ALOMEDSTest_AttributeSequenceOfInteger.cxx | 1 + .../SALOMEDSTest_AttributeTableOfInteger.cxx | 15 +- .../SALOMEDSTest_AttributeTableOfReal.cxx | 1 - .../Test/SALOMEDSTest_AttributeTextColor.cxx | 2 +- .../Test/SALOMEDSTest_AttributeTreeNode.cxx | 19 +- .../Test/SALOMEDSTest_AttributeUserID.cxx | 13 +- .../Test/SALOMEDSTest_ChildIterator.cxx | 2 +- src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx | 1 + src/SALOMEDS/Test/SALOMEDSTest_Study.cxx | 2 +- .../Test/SALOMEDSTest_StudyBuilder.cxx | 65 +- .../Test/SALOMEDSTest_StudyManager.cxx | 10 +- src/SALOMEDS/Test/TestSALOMEDS.cxx | 4 - src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 1 + src/SALOMEDSImpl/Makefile.am | 10 +- .../SALOMEDSImpl_AttributeComment.cxx | 30 +- .../SALOMEDSImpl_AttributeComment.hxx | 37 +- .../SALOMEDSImpl_AttributeDrawable.cxx | 30 +- .../SALOMEDSImpl_AttributeDrawable.hxx | 40 +- .../SALOMEDSImpl_AttributeExpandable.cxx | 30 +- .../SALOMEDSImpl_AttributeExpandable.hxx | 36 +- .../SALOMEDSImpl_AttributeExternalFileDef.cxx | 30 +- .../SALOMEDSImpl_AttributeExternalFileDef.hxx | 40 +- .../SALOMEDSImpl_AttributeFileType.cxx | 30 +- .../SALOMEDSImpl_AttributeFileType.hxx | 40 +- .../SALOMEDSImpl_AttributeFlags.cxx | 33 +- .../SALOMEDSImpl_AttributeFlags.hxx | 35 +- .../SALOMEDSImpl_AttributeGraphic.cxx | 83 +- .../SALOMEDSImpl_AttributeGraphic.hxx | 39 +- .../SALOMEDSImpl_AttributeIOR.cxx | 41 +- .../SALOMEDSImpl_AttributeIOR.hxx | 36 +- .../SALOMEDSImpl_AttributeInteger.cxx | 58 +- .../SALOMEDSImpl_AttributeInteger.hxx | 42 +- .../SALOMEDSImpl_AttributeLocalID.cxx | 50 +- .../SALOMEDSImpl_AttributeLocalID.hxx | 40 +- .../SALOMEDSImpl_AttributeName.cxx | 30 +- .../SALOMEDSImpl_AttributeName.hxx | 40 +- .../SALOMEDSImpl_AttributeOpened.cxx | 31 +- .../SALOMEDSImpl_AttributeOpened.hxx | 36 +- .../SALOMEDSImpl_AttributeParameter.cxx | 58 +- .../SALOMEDSImpl_AttributeParameter.hxx | 48 +- .../SALOMEDSImpl_AttributePersistentRef.cxx | 31 +- .../SALOMEDSImpl_AttributePersistentRef.hxx | 40 +- .../SALOMEDSImpl_AttributePixMap.cxx | 32 +- .../SALOMEDSImpl_AttributePixMap.hxx | 45 +- .../SALOMEDSImpl_AttributePythonObject.cxx | 51 +- .../SALOMEDSImpl_AttributePythonObject.hxx | 40 +- .../SALOMEDSImpl_AttributeReal.cxx | 49 +- .../SALOMEDSImpl_AttributeReal.hxx | 42 +- .../SALOMEDSImpl_AttributeReference.cxx | 50 +- .../SALOMEDSImpl_AttributeReference.hxx | 41 +- .../SALOMEDSImpl_AttributeSelectable.cxx | 31 +- .../SALOMEDSImpl_AttributeSelectable.hxx | 41 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.cxx | 104 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.hxx | 52 +- .../SALOMEDSImpl_AttributeSequenceOfReal.cxx | 106 +- .../SALOMEDSImpl_AttributeSequenceOfReal.hxx | 49 +- .../SALOMEDSImpl_AttributeString.cxx | 30 +- .../SALOMEDSImpl_AttributeString.hxx | 38 +- .../SALOMEDSImpl_AttributeStudyProperties.cxx | 226 +- .../SALOMEDSImpl_AttributeStudyProperties.hxx | 127 +- .../SALOMEDSImpl_AttributeTableOfInteger.cxx | 405 +- .../SALOMEDSImpl_AttributeTableOfInteger.hxx | 106 +- .../SALOMEDSImpl_AttributeTableOfReal.cxx | 416 +- .../SALOMEDSImpl_AttributeTableOfReal.hxx | 115 +- .../SALOMEDSImpl_AttributeTableOfString.cxx | 420 +- .../SALOMEDSImpl_AttributeTableOfString.hxx | 115 +- .../SALOMEDSImpl_AttributeTarget.cxx | 95 +- .../SALOMEDSImpl_AttributeTarget.hxx | 49 +- .../SALOMEDSImpl_AttributeTextColor.cxx | 65 +- .../SALOMEDSImpl_AttributeTextColor.hxx | 40 +- ...LOMEDSImpl_AttributeTextHighlightColor.cxx | 68 +- ...LOMEDSImpl_AttributeTextHighlightColor.hxx | 40 +- .../SALOMEDSImpl_AttributeTreeNode.cxx | 315 +- .../SALOMEDSImpl_AttributeTreeNode.hxx | 122 +- .../SALOMEDSImpl_AttributeUserID.cxx | 36 +- .../SALOMEDSImpl_AttributeUserID.hxx | 38 +- src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx | 14 +- src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx | 2 - src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx | 21 +- .../SALOMEDSImpl_ChildIterator.cxx | 38 +- .../SALOMEDSImpl_ChildIterator.hxx | 30 +- .../SALOMEDSImpl_ChildNodeIterator.cxx | 12 +- .../SALOMEDSImpl_ChildNodeIterator.hxx | 31 +- src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx | 66 +- .../SALOMEDSImpl_GenericAttribute.cxx | 40 +- .../SALOMEDSImpl_GenericAttribute.hxx | 37 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx | 86 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx | 14 +- .../SALOMEDSImpl_OCAFApplication.cxx | 65 - .../SALOMEDSImpl_OCAFApplication.hxx | 51 - src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx | 61 +- src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx | 29 +- .../SALOMEDSImpl_SComponentIterator.cxx | 29 +- .../SALOMEDSImpl_SComponentIterator.hxx | 16 +- src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx | 169 +- src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx | 82 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 861 +-- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 189 +- .../SALOMEDSImpl_StudyBuilder.cxx | 578 +- .../SALOMEDSImpl_StudyBuilder.hxx | 88 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx | 39 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx | 38 +- .../SALOMEDSImpl_StudyManager.cxx | 625 +- .../SALOMEDSImpl_StudyManager.hxx | 121 +- src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx | 7 - src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx | 13 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 247 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx | 25 +- .../SALOMEDSImpl_UseCaseBuilder.cxx | 233 +- .../SALOMEDSImpl_UseCaseBuilder.hxx | 50 +- .../SALOMEDSImpl_UseCaseIterator.cxx | 39 +- .../SALOMEDSImpl_UseCaseIterator.hxx | 29 +- src/SALOMEDSImpl/Test/Makefile.am | 3 +- src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx | 15 +- src/SALOMEDSImpl/testDS.cxx | 126 +- src/SALOMELocalTrace/LocalTraceBufferPool.hxx | 2 +- src/SALOMELocalTrace/LocalTraceCollector.cxx | 1 + .../Test/TestSALOMELocalTrace.py | 5 +- src/SALOMELocalTrace/utilities.h | 2 +- src/TOOLSDS/Makefile.am | 4 +- src/TOOLSDS/SALOMEDS_Tool.cxx | 221 +- src/TestContainer/Makefile.am | 4 +- src/UnitTests/UnitTests.py | 13 +- src/Utils/Utils_ORB_INIT.cxx | 15 +- 674 files changed, 20030 insertions(+), 31366 deletions(-) create mode 100755 bin/shutdownSalome.py create mode 100755 bin/waitContainers.py create mode 100755 bin/waitNS.py create mode 100755 bin/waitNS.sh create mode 100644 doc/salome/batch.dox create mode 100644 doc/salome/install.dox create mode 100644 doc/salome/kernel_resources.dox create mode 100644 doc/salome/kernel_services.dox create mode 100644 doc/salome/main.dox create mode 100644 doc/salome/salome_application.dox create mode 100644 doc/salome/salome_file.dox create mode 100644 doc/salome/tui/KERNEL/sources/kernel_about_4.png create mode 100644 doc/salome/unittests.dox rename src/SALOMEDS/SALOMEDS_OCAFApplication.jxx => idl/SALOME_Exception.xml (67%) create mode 100644 salome_adm/unix/config_files/check_libxml.m4 create mode 100644 salome_adm/unix/config_files/check_openmpi.m4 delete mode 100755 salome_adm/unix/config_files/install-sh delete mode 100644 salome_adm/unix/config_files/ltmain.sh delete mode 100644 salome_adm/unix/config_files/missing create mode 100644 src/Batch/BatchLight_BatchManager.cxx create mode 100644 src/Batch/BatchLight_BatchManager.hxx create mode 100644 src/Batch/BatchLight_BatchManager_PBS.cxx create mode 100644 src/Batch/BatchLight_BatchManager_PBS.hxx create mode 100644 src/Batch/BatchLight_BatchManager_SLURM.cxx create mode 100644 src/Batch/BatchLight_BatchManager_SLURM.hxx rename src/{SALOMEDS/SALOMEDS_ExternalFileDef.jxx => Batch/BatchLight_Job.cxx} (62%) create mode 100644 src/Batch/BatchLight_Job.hxx create mode 100644 src/Batch/MpiImpl.cxx create mode 100644 src/Batch/MpiImpl.hxx delete mode 100644 src/CASCatch/CASCatch.hxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.cxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.hxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.cxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.hxx delete mode 100644 src/CASCatch/CASCatch_Failure.cxx delete mode 100644 src/CASCatch/CASCatch_Failure.hxx delete mode 100644 src/CASCatch/Makefile.am create mode 100644 src/Container/Salome_file_i.cxx create mode 100644 src/Container/Salome_file_i.hxx create mode 100644 src/Container/TestSalome_file.cxx create mode 100644 src/DF/DF_Application.cxx create mode 100644 src/DF/DF_Application.hxx create mode 100644 src/DF/DF_Attribute.cxx create mode 100644 src/DF/DF_Attribute.hxx create mode 100644 src/DF/DF_ChildIterator.cxx create mode 100644 src/DF/DF_ChildIterator.hxx create mode 100644 src/DF/DF_Container.cxx create mode 100644 src/DF/DF_Container.hxx create mode 100644 src/DF/DF_Document.cxx create mode 100644 src/DF/DF_Document.hxx create mode 100644 src/DF/DF_Label.cxx create mode 100644 src/DF/DF_Label.hxx create mode 100644 src/DF/DF_definitions.hxx create mode 100644 src/DF/Makefile.am create mode 100644 src/DF/testDF.cxx create mode 100644 src/DSC/DSC.dox create mode 100644 src/DSC/DSC_Python/Makefile.am create mode 100644 src/DSC/DSC_Python/calcium.i create mode 100644 src/DSC/DSC_Python/dsccalcium.py create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Calcium.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calciumf.c create mode 100644 src/DSC/DSC_User/Datastream/Calcium/fortoc.h create mode 100644 src/DSC/DSC_User/port_factory.hxx rename src/{SALOMEDS/SALOMEDS_TextColorAttribute.jxx => HDFPersist/HDFexport.hxx} (57%) create mode 100644 src/Launcher/Makefile.am create mode 100644 src/Launcher/SALOME_Launcher.cxx create mode 100644 src/Launcher/SALOME_Launcher.hxx rename src/{Container/SALOME_ContainerManagerServer.cxx => Launcher/SALOME_LauncherServer.cxx} (58%) rename src/{Container => LifeCycleCORBA}/TestContainerManager.cxx (76%) create mode 100644 src/ParallelContainer/Parallel_Salome_file_i.cxx create mode 100644 src/ParallelContainer/Parallel_Salome_file_i.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_FileType.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SAttribute_i.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx diff --git a/bin/Makefile.am b/bin/Makefile.am index 827b9ec38..2cf221ead 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -61,8 +61,11 @@ dist_salomescript_SCRIPTS=\ setenv.py \ launchSalome.py \ nameserver.py \ - server.py - + server.py \ + waitNS.sh \ + waitNS.py \ + waitContainers.py \ + shutdownSalome.py EXTRA_DIST = appliskel diff --git a/bin/NSparam.py b/bin/NSparam.py index 5ec527e11..652e6da66 100755 --- a/bin/NSparam.py +++ b/bin/NSparam.py @@ -36,7 +36,7 @@ def getNSparams(info=""): my_host="" if os.environ.has_key("OMNIORB_CONFIG"): file = open(os.environ["OMNIORB_CONFIG"], "r") - s = file.read() + s = file.readline() while len(s): l = string.split(s, ":") if string.split(l[0], " ")[0] == "ORBInitRef" or \ @@ -48,7 +48,7 @@ def getNSparams(info=""): my_host = l[len(l)-2] break; pass - s = file.read() + s = file.readline() pass pass if info=='host': diff --git a/bin/addToKillList.py b/bin/addToKillList.py index f29cccef7..537dfaf3d 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -64,8 +64,8 @@ def addToKillList(command_pid, command): if verbose(): print process_id for pid, cmd in process_id.items(): #print "see process %s : %s"% (pid, cmd[0]) - if pid == command_pid: - already_in=1 + if pid == command_pid: + already_in=1 pass pass pass @@ -73,14 +73,14 @@ def addToKillList(command_pid, command): command=(command.split(" "))[0] if already_in == 0: try: - process_ids.append({command_pid: [command]}) - fpid=open(filedict,'w') + process_ids.append({command_pid: [command]}) + fpid=open(filedict,'w') pickle.dump(process_ids, fpid) - fpid.close() + fpid.close() except: - print "addToKillList: can not add command %s to the kill list"% filedict - pass - pass + print "addToKillList: can not add command %s to the kill list"% filedict + pass + pass pass def killList(): diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 6d70fe939..89e30a94e 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -215,7 +215,8 @@ def install(prefix,config_file): f.write(module) f.write(',') pass - f.write(_config["guimodules"][-1]) + if len(_config["guimodules"]) > 0: + f.write(_config["guimodules"][-1]) f.write('"/>') command=""" diff --git a/bin/appliskel/killCurrentPort b/bin/appliskel/killCurrentPort index e1eb19268..41b14866a 100755 --- a/bin/appliskel/killCurrentPort +++ b/bin/appliskel/killCurrentPort @@ -21,7 +21,7 @@ currentPort=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` echo $currentPort # --- kill current salome session - +${KERNEL_ROOT_DIR}/bin/salome/shutdownSalome.py ${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py $currentPort # --- delete config files diff --git a/bin/appliskel/runAppli b/bin/appliskel/runAppli index 7693557c1..2bd9f1dae 100755 --- a/bin/appliskel/runAppli +++ b/bin/appliskel/runAppli @@ -22,7 +22,7 @@ fi # by arguments to this command) if [ $# -ne 0 ] ; then - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* else ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py diff --git a/bin/appliskel/runRemote.sh b/bin/appliskel/runRemote.sh index 3cbfbf55c..21bc0b0c1 100755 --- a/bin/appliskel/runRemote.sh +++ b/bin/appliskel/runRemote.sh @@ -63,4 +63,6 @@ echo "ORBInitRef $initref" > $OMNIORB_CONFIG shift 2 -${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh --rcfile $HOME/$APPLI/.bashrc -c "$*" +# suppress --rcfile option because of problem on Mandriva2006 - B Secher mai 2007 +#${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh --rcfile $HOME/$APPLI/.bashrc -c "$*" +${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh -c "$*" diff --git a/bin/envSalome.py b/bin/envSalome.py index 9ea098c10..1d0d61cb6 100755 --- a/bin/envSalome.py +++ b/bin/envSalome.py @@ -29,14 +29,15 @@ sys.path[:0]=[kernel_root+"/bin/salome"] #import runSalome argv = sys.argv[1:] +sys.argv = argv[1:] #sys.argv = [sys.argv[0]] #if len(argv) > 3: # sys.argv += argv[3:] -if len(argv) > 2: - sys.argv = argv[2:] - -args, modules_list, modules_root_dir = setenv.get_config() +#if len(argv) > 2: +# sys.argv = argv[2:] + +#args, modules_list, modules_root_dir = setenv.get_config() #runSalome.set_env(args, modules_list, modules_root_dir) setenv.main(); diff --git a/bin/killSalome.py b/bin/killSalome.py index 9e65ae4ce..2f1388182 100755 --- a/bin/killSalome.py +++ b/bin/killSalome.py @@ -33,20 +33,21 @@ def killAllPorts(): killMyPort(mo.groups()[0]) pass - cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log" - a = os.system(cmd) - try: - fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log") - prc = fpidomniNames.read() - fpidomniNames.close() - if prc != None : - for field in prc.split(" ") : - field = field.strip() - if field != None and len(field) != 0: - os.system('kill -9 '+field) - except: + if not sys.platform == 'win32': + cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log" + a = os.system(cmd) + try: + fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log") + prc = fpidomniNames.read() + fpidomniNames.close() + if prc != None : + for field in prc.split(" ") : + field = field.strip() + if field != None and len(field) != 0: + os.system('kill -9 '+field) + except: + pass pass - pass if __name__ == "__main__": killAllPorts() diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 86d112af8..79c168279 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -102,10 +102,10 @@ def killMyPort(port): if pidfield != "egrep" : if sys.platform == "win32": import win32pm - print 'stop process '+pidfield+' : omniNames' + print 'stop process '+pidfield+' : omniNames' win32pm.killpid(int(pidfield),0) else: - if verbose(): print 'stop process '+pidfield+' : omniNames' + if verbose(): print 'stop process '+pidfield+' : omniNames' os.system('kill -9 '+pidfield) pidfield = field except: @@ -138,7 +138,7 @@ def killMyPort(port): while pid != "" and len(a.split(" ")) < 2: a = commands.getoutput("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid") pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"") - print pid + print pid pass diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index e34150400..150f15598 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -49,6 +49,8 @@ terminal_nam = "terminal" interp_nam = "interp" except_nam = "noexcepthandler" terminal_nam = "terminal" +pinter_nam = "pinter" +batch_nam = "batch" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -60,9 +62,13 @@ port_nam = "port" salomeappname = "SalomeApp" script_nam = "pyscript" +# possible choices for the "embedded" and "standalone" parameters +embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ] +standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer", "supervContainer"] + # values of boolean type (must be '0' or '1'). # xml_parser.boolValue() is used for correct setting -boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam ) +boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam ) intKeys = ( interp_nam, ) # values of list type @@ -172,6 +178,23 @@ def setVerbose(level): _verbose = level return +# -- + +def process_containers_params( standalone, embedded ): + # 1. filter inappropriate containers names + if standalone is not None: + standalone = filter( lambda x: x in standalone_choices, standalone ) + if embedded is not None: + embedded = filter( lambda x: x in embedded_choices, embedded ) + + # 2. remove containers appearing in 'standalone' parameter from the 'embedded' + # parameter --> i.e. 'standalone' parameter has higher priority + if standalone is not None and embedded is not None: + embedded = filter( lambda x: x not in standalone, embedded ) + + # 3. return corrected parameters values + return standalone, embedded + # ----------------------------------------------------------------------------- ### @@ -189,6 +212,12 @@ class xml_parser: parser = xml.sax.make_parser() parser.setContentHandler(self) parser.parse(fileName) + standalone, embedded = process_containers_params( self.opts.get( standalone_nam ), + self.opts.get( embedded_nam ) ) + if standalone is not None: + self.opts[ standalone_nam ] = standalone + if embedded is not None: + self.opts[ embedded_nam ] = embedded pass def boolValue( self, str ): @@ -252,11 +281,11 @@ class xml_parser: if nam in boolKeys: self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1 elif nam in intKeys: - self.opts[key] = self.intValue( val ) # assign integer value + self.opts[key] = self.intValue( val ) # assign integer value elif nam in listKeys: - self.opts[key] = val.split( ',' ) # assign list value: [] + self.opts[key] = filter( lambda a: a.strip(), re.split( "[:;,]", val ) ) # assign list value: [] else: - self.opts[key] = val; + self.opts[key] = val pass pass @@ -291,6 +320,54 @@ booleans = { '1': True , 'yes': True , 'y': True , 'on' : True , 'true' : True , boolean_choices = booleans.keys() +def check_embedded(option, opt, value, parser): + from optparse import OptionValueError + assert value is not None + if parser.values.embedded: + embedded = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.embedded ) ) + else: + embedded = [] + if parser.values.standalone: + standalone = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.standalone ) ) + else: + standalone = [] + vals = filter( lambda a: a.strip(), re.split( "[:;,]", value ) ) + for v in vals: + if v not in embedded_choices: + raise OptionValueError( "option %s: invalid choice: %r (choose from %s)" % ( opt, v, ", ".join( map( repr, embedded_choices ) ) ) ) + if v not in embedded: + embedded.append( v ) + if v in standalone: + del standalone[ standalone.index( v ) ] + pass + parser.values.embedded = ",".join( embedded ) + parser.values.standalone = ",".join( standalone ) + pass + +def check_standalone(option, opt, value, parser): + from optparse import OptionValueError + assert value is not None + if parser.values.embedded: + embedded = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.embedded ) ) + else: + embedded = [] + if parser.values.standalone: + standalone = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.standalone ) ) + else: + standalone = [] + vals = filter( lambda a: a.strip(), re.split( "[:;,]", value ) ) + for v in vals: + if v not in standalone_choices: + raise OptionValueError( "option %s: invalid choice: %r (choose from %s)" % ( opt, v, ", ".join( map( repr, standalone_choices ) ) ) ) + if v not in standalone: + standalone.append( v ) + if v in embedded: + del embedded[ embedded.index( v ) ] + pass + parser.values.embedded = ",".join( embedded ) + parser.values.standalone = ",".join( standalone ) + pass + def store_boolean (option, opt, value, parser, *args): if isinstance(value, types.StringType): try: @@ -314,6 +391,13 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="gui", help=help_str) + help_str = "Launch in Batch Mode. (Without GUI on batch machine)" + o_b = optparse.Option("-b", + "--batch", + action="store_true", + dest="batch", + help=help_str) + help_str = "Launch in GUI mode [default]." o_g = optparse.Option("-g", "--gui", @@ -403,26 +487,28 @@ def CreateOptionParser (theAdditionalOptions=[]): # Embedded servers. Default: Like in configuration files. help_str = "CORBA servers to be launched in the Session embedded mode. " - help_str += "Valid values for : registry, study, moduleCatalog, " - help_str += "cppContainer [by default the value from the configuration files is used]" + help_str += "Valid values for : %s " % ", ".join( embedded_choices ) + help_str += "[by default the value from the configuration files is used]" o_e = optparse.Option("-e", "--embedded", metavar="", type="string", - action="append", + action="callback", dest="embedded", + callback=check_embedded, help=help_str) # Standalone servers. Default: Like in configuration files. help_str = "CORBA servers to be launched in the standalone mode (as separate processes). " - help_str += "Valid values for : registry, study, moduleCatalog, " - help_str += "cppContainer, pyContainer, [by default the value from the configuration files is used]" + help_str += "Valid values for : %s " % ", ".join( standalone_choices ) + help_str += "[by default the value from the configuration files is used]" o_s = optparse.Option("-s", "--standalone", metavar="", type="string", - action="append", + action="callback", dest="standalone", + callback=check_standalone, help=help_str) # Kill with port. Default: False. @@ -493,9 +579,17 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="save_config", default=True, help=help_str) + # Launch with interactive python console. Default: False. + help_str = "Launch with interactive python console." + o_pi = optparse.Option("--pinter", + action="store_true", + dest="pinter", + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop + o_b, # Batch o_l,o_f, # Use logger or log-file o_u, # Execute python scripts o_r, # Configuration XML file @@ -509,7 +603,9 @@ def CreateOptionParser (theAdditionalOptions=[]): o_z, # Splash o_c, # Catch exceptions o_a, # Print free port and exit - o_n] # --nosave-config + o_n, # --nosave-config + o_pi] # Interactive python console + #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", # "xterm", "modules", "embedded", "standalone", @@ -684,13 +780,16 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # Options: gui, desktop, log_file, py_scripts, resources, # xterm, modules, embedded, standalone, # portkill, killall, interp, splash, - # catch_exceptions + # catch_exceptions, pinter # GUI/Terminal, Desktop, Splash, STUDY_HDF args["session_gui"] = False + args[batch_nam] = False args["study_hdf"] = None if cmd_opts.gui is not None: args[gui_nam] = cmd_opts.gui + if cmd_opts.batch is not None: + args[batch_nam] = True if args[gui_nam]: args["session_gui"] = True if cmd_opts.desktop is not None: @@ -737,21 +836,19 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # Embedded if cmd_opts.embedded is not None: - args[embedded_nam] = [] - listlist = cmd_opts.embedded - for listi in listlist: - args[embedded_nam] += re.split( "[:;,]", listi) + args[embedded_nam] = filter( lambda a: a.strip(), re.split( "[:;,]", cmd_opts.embedded ) ) # Standalone if cmd_opts.standalone is not None: - args[standalone_nam] = [] - listlist = cmd_opts.standalone - standalone = [] - for listi in listlist: - standalone += re.split( "[:;,]", listi) - for serv in standalone: - if args[embedded_nam].count(serv) <= 0: - args[standalone_nam].append(serv) + args[standalone_nam] = filter( lambda a: a.strip(), re.split( "[:;,]", cmd_opts.standalone ) ) + + # Normalize the '--standalone' and '--embedded' parameters + standalone, embedded = process_containers_params( args.get( standalone_nam ), + args.get( embedded_nam ) ) + if standalone is not None: + args[ standalone_nam ] = standalone + if embedded is not None: + args[ embedded_nam ] = embedded # Kill if cmd_opts.portkill is not None: args[portkill_nam] = cmd_opts.portkill @@ -769,6 +866,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): if cmd_opts.save_config is not None: args['save_config'] = cmd_opts.save_config + # Interactive python console + if cmd_opts.pinter is not None: + args[pinter_nam] = cmd_opts.pinter + #################################################### # Add values to args for add_opt in theAdditionalOptions: diff --git a/bin/nameserver.py b/bin/nameserver.py index aacb59ed9..dd03c51a3 100755 --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -22,68 +22,67 @@ class NamingServer(Server): os.environ["BaseDir"]=os.environ["HOME"] else: os.environ["BaseDir"]="/tmp" - - try: - os.mkdir(os.environ["BaseDir"] + "/logs") + + try: + os.mkdir(os.environ["BaseDir"] + "/logs") os.chmod(os.environ["BaseDir"] + "/logs", 0777) - except: - #print "Can't create " + os.environ["BaseDir"] + "/logs" - pass - - upath = os.environ["BaseDir"] + "/logs/"; - if sys.platform == "win32": - upath += os.environ["Username"]; - else: - upath += os.environ["USER"]; - - try: - os.mkdir(upath) - except: - #print "Can't create " + upath - pass - - #os.system("touch " + upath + "/dummy") - for fname in os.listdir(upath): - try: - os.remove(upath + "/" + fname) - except: - pass - #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") - - print "Name Service... " - #hname=os.environ["HOST"] #commands.getoutput("hostname") + except: + #print "Can't create " + os.environ["BaseDir"] + "/logs" + pass + + upath = os.environ["BaseDir"] + "/logs/"; if sys.platform == "win32": - hname=getShortHostName(); + upath += os.environ["Username"]; else: - hname = socket.gethostname(); - - print "hname=",hname - - f=open(os.environ["OMNIORB_CONFIG"]) - ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) - print "ss = ", ss - f.close() + upath += os.environ["USER"]; + + try: + os.mkdir(upath) + except: + #print "Can't create " + upath + pass + + #os.system("touch " + upath + "/dummy") + for fname in os.listdir(upath): + try: + os.remove(upath + "/" + fname) + except: + pass + #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") + + print "Name Service... ", + #hname=os.environ["HOST"] #commands.getoutput("hostname") + if sys.platform == "win32": + hname=getShortHostName(); + else: + hname = socket.gethostname(); + #print "hname=",hname + + f=open(os.environ["OMNIORB_CONFIG"]) + ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) + print "ss = ", ss, + f.close() sl=ss[0] ll = sl.split(':') aPort = ll[-1] #aPort=(ss.join().split(':'))[2]; - #aPort=re.findall("\d+", ss[0])[0] - - #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" - #print "sed command = ", aSedCommand - #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) - print "port=", aPort - if sys.platform == "win32": - #print "start omniNames -start " + aPort + " -logdir " + upath + #aPort=re.findall("\d+", ss[0])[0] + + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" + #print "sed command = ", aSedCommand + #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) + #print "port=", aPort + if sys.platform == "win32": + #print "start omniNames -start " + aPort + " -logdir " + upath self.CMD=['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] - #os.system("start omniNames -start " + aPort + " -logdir " + upath) - else: + #os.system("start omniNames -start " + aPort + " -logdir " + upath) + else: #self.CMD=['omniNames -start ' , aPort , ' -logdir ' , upath , ' &'] self.CMD=['omniNames','-start' , aPort, '-logdir' , upath ] - #os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + #os.system("omniNames -start " + aPort + " -logdir " + upath + " &") - print "ok" - print "to list contexts and objects bound int the context with the specified name : showNS " + print "... ok" + print "to list contexts and objects bound into the context with the specified name : showNS " def initArgs(self): @@ -95,7 +94,6 @@ class NamingServer(Server): self.CMD=['xterm', '-e']+ env_ld_library_path + ['python'] self.initNSArgs() - # In LifeCycleCORBA, FactoryServer is started with rsh on the requested # computer if this Container does not exist. Default is localhost. # Others Containers are started with start_impl method of FactoryServer Container. diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 86c89201e..7de5715c1 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# +# import sys,os,time import string from nameserver import * @@ -35,14 +35,11 @@ class client: # Initialise the ORB self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Initialise the Naming Service - print "Obtain a reference to the root naming context" - print args self.initNS(args) # -------------------------------------------------------------------------- def initNS(self,args): - print "Obtain a reference to the root naming context" # Obtain a reference to the root naming context obj = self.orb.resolve_initial_references("NameService") try: @@ -50,7 +47,7 @@ class client: return except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None - print "Lancement du Naming Service", + print "Launch Naming Service++", # On lance le Naming Server (doit etre dans le PATH) NamingServer(args).run() @@ -151,9 +148,9 @@ class client: print "Searching %s in Naming Service " % theName, while(1): try: - aPid, aStatus = os.waitpid(thePID,os.WNOHANG) - except Exception, exc: - raise "Impossible de trouver %s" % theName + os.kill(thePID,0) + except: + raise "Process %d for %s not found" % (thePID,theName) aCount += 1 anObj = self.Resolve(theName) if anObj: diff --git a/bin/runNS.py b/bin/runNS.py index 5af2c5af5..444760369 100755 --- a/bin/runNS.py +++ b/bin/runNS.py @@ -6,11 +6,11 @@ import os, commands, sys, re, string, socket from Utils_Identity import getShortHostName if sys.platform == "win32": - # temporarily using home directory for Namning Service logs - # to be replaced with TEMP later... - os.environ["BaseDir"]=os.environ["HOME"] + # temporarily using home directory for Namning Service logs + # to be replaced with TEMP later... + os.environ["BaseDir"]=os.environ["HOME"] else: - os.environ["BaseDir"]="/tmp" + os.environ["BaseDir"]="/tmp" os.environ["Username"]=os.environ["USER"] @@ -21,50 +21,50 @@ os.environ["Username"]=os.environ["USER"] # clear log files def startOmni(): - try: - os.mkdir(os.environ["BaseDir"] + "/logs") - os.chmod(os.environ["BaseDir"] + "/logs", 0777) - except: - #print "Can't create " + os.environ["BaseDir"] + "/logs" - pass - - upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"] - - try: - os.mkdir(upath) - except: - #print "Can't create " + upath - pass - - #os.system("touch " + upath + "/dummy") - for fname in os.listdir(upath): - try: - os.remove(upath + "/" + fname) - except: - pass - #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") - - print "Name Service... " - #hname=os.environ["HOST"] #commands.getoutput("hostname") - if sys.platform == "win32": + try: + os.mkdir(os.environ["BaseDir"] + "/logs") + os.chmod(os.environ["BaseDir"] + "/logs", 0777) + except: + #print "Can't create " + os.environ["BaseDir"] + "/logs" + pass + + upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"] + + try: + os.mkdir(upath) + except: + #print "Can't create " + upath + pass + + #os.system("touch " + upath + "/dummy") + for fname in os.listdir(upath): + try: + os.remove(upath + "/" + fname) + except: + pass + #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") + + print "Name Service... " + #hname=os.environ["HOST"] #commands.getoutput("hostname") + if sys.platform == "win32": hname=getShortHostName() - else: - hname=socket.gethostname() - - print "hname=",hname - - f=open(os.environ["OMNIORB_CONFIG"]) - ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) - print "ss = ", ss - f.close() - aPort=re.findall("\d+", ss[0])[0] - - #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" - #print "sed command = ", aSedCommand - #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) - global process_id - print "port=", aPort - if sys.platform == "win32": + else: + hname=socket.gethostname() + + print "hname=",hname + + f=open(os.environ["OMNIORB_CONFIG"]) + ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) + print "ss = ", ss + f.close() + aPort=re.findall("\d+", ss[0])[0] + + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" + #print "sed command = ", aSedCommand + #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) + global process_id + print "port=", aPort + if sys.platform == "win32": #import win32pm #command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" ) @@ -72,11 +72,11 @@ def startOmni(): #print command pid = win32pm.spawnpid( string.join(command, " "), -nc ) process_id[pid]=command - else: - os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + else: + os.system("omniNames -start " + aPort + " -logdir " + upath + " &") - print "ok" - print "to list contexts and objects bound int the context with the specified name : showNS " + print "ok" + print "to list contexts and objects bound into the context with the specified name : showNS " # In LifeCycleCORBA, FactoryServer is started with rsh on the requested # computer if this Container does not exist. Default is localhost. diff --git a/bin/runSalome b/bin/runSalome index fdb94657b..abc4c763b 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -1,10 +1,6 @@ #!/bin/bash -if [ $# -ne 0 ] ; then - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* -else - python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py -fi +${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* # ----------------------------------------------------------------------------- # examples: diff --git a/bin/runSalome.csh b/bin/runSalome.csh index 73798c25c..ff93222ff 100755 --- a/bin/runSalome.csh +++ b/bin/runSalome.csh @@ -1,3 +1,3 @@ #!/bin/csh -f -runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --containers=cpp,python --killall +runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall diff --git a/bin/runSalome.ksh b/bin/runSalome.ksh index cbee4003d..5a0e5a894 100644 --- a/bin/runSalome.ksh +++ b/bin/runSalome.ksh @@ -39,7 +39,7 @@ searchFreePort if [[ "$*" = "-nothing" ]]; then echo "port:$NSPORT" elif [ $# -ne 0 ] ; then - python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* + python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* else python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py fi diff --git a/bin/runSalome.py b/bin/runSalome.py index 69f974aff..6c01d90e4 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -88,10 +88,10 @@ class InterpServer(Server): global process_id command = self.CMD print "INTERPSERVER::command = ", command - if sys.platform == "win32": + if sys.platform == "win32": import win32pm pid = win32pm.spawnpid( string.join(command, " "),'-nc' ) - else: + else: pid = os.spawnvp(os.P_NOWAIT, command[0], command) process_id[pid]=self.CMD self.PID = pid @@ -102,9 +102,9 @@ class CatalogServer(Server): def __init__(self,args): self.args=args self.initArgs() - #if sys.platform == "win32": - # self.SCMD1=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_ModuleCatalog_Server' + ".exe",'-common'] - #else: + #if sys.platform == "win32": + # self.SCMD1=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_ModuleCatalog_Server' + ".exe",'-common'] + #else: self.SCMD1=['SALOME_ModuleCatalog_Server','-common'] self.SCMD2=[] home_dir=os.getenv('HOME') @@ -182,9 +182,9 @@ class ContainerPYServer(Server): def __init__(self,args): self.args=args self.initArgs() - if sys.platform == "win32": + if sys.platform == "win32": self.CMD=[os.environ["PYTHONBIN"], '\"'+os.environ["KERNEL_ROOT_DIR"] + '/bin/salome/SALOME_ContainerPy.py'+'\"','FactoryServerPy'] - else: + else: self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] # --- @@ -193,9 +193,9 @@ class ContainerSUPERVServer(Server): def __init__(self,args): self.args=args self.initArgs() -# if sys.platform == "win32": + # if sys.platform == "win32": # self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer'] -# else: +# else: self.CMD=['SALOME_Container','SuperVisionContainer'] # --- @@ -215,11 +215,10 @@ class SessionServer(Server): def __init__(self,args): self.args = args.copy() # Bug 11512 (Problems with runSalome --xterm on Mandrake and Debian Sarge) - self.args['xterm']=0 + #self.args['xterm']=0 # self.initArgs() self.SCMD1=['SALOME_Session_Server'] - self.SCMD2=[] if 'registry' in self.args['embedded']: self.SCMD1+=['--with','Registry', @@ -301,11 +300,11 @@ class SessionServer(Server): # --- -class ContainerManagerServer(Server): +class LauncherServer(Server): def __init__(self,args): self.args=args self.initArgs() - self.SCMD1=['SALOME_ContainerManagerServer'] + self.SCMD1=['SALOME_LauncherServer'] self.SCMD2=[] if args["gui"] : if 'registry' in self.args['embedded']: @@ -468,10 +467,10 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/myStudyManager",myServer.PID) # - # Lancement ContainerManagerServer + # Lancement LauncherServer # - myCmServer = ContainerManagerServer(args) + myCmServer = LauncherServer(args) myCmServer.setpath(modules_list,modules_root_dir) myCmServer.run() @@ -498,7 +497,7 @@ def startSalome(args, modules_list, modules_root_dir): # attente de la disponibilite du Container C++ local dans le Naming Service # - if ('cppContainer' in args['standalone']) | (args["gui"] == 0): + if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : myServer=ContainerCPPServer(args) myServer.run() if sys.platform == "win32": @@ -582,7 +581,11 @@ def startSalome(args, modules_list, modules_root_dir): print "i=",i anInterp=InterpServer(args) anInterp.run() - + + # set PYTHONINSPECT variable + if args['pinter']: + os.environ["PYTHONINSPECT"]="1" + return clt # ----------------------------------------------------------------------------- @@ -603,7 +606,7 @@ def useSalome(args, modules_list, modules_root_dir): traceback.print_exc() print print - print "--- erreur au lancement Salome ---" + print "--- Error during Salome launch ---" #print process_id @@ -657,6 +660,7 @@ def useSalome(args, modules_list, modules_root_dir): i = 0 while i < len( toimport ) : if toimport[ i ] == 'killall': + clt.showNS() killAllPorts() import sys sys.exit(0) @@ -702,24 +706,51 @@ def searchFreePort(args, save_config=1): limit=limit+10 while 1: import os - status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT)) - if status: + import re + from os import getpid + from os import system + + if sys.platform == "win32": + tmp_file = os.getenv('TEMP'); + else: + tmp_file = '/tmp/' + tmp_file += 'hostname_%s'%(getpid()) + +# status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT)) + + system( "netstat -a -n > %s" % tmp_file ); + + f = open( tmp_file, 'r' ); + lines = f.readlines(); + f.close(); + + pattern = "tcp.*:([0-9]+).*:.*listen"; + regObj = re.compile( pattern, re.IGNORECASE ); + + status = 1; + for item in lines: + m = regObj.search( item ) + if m: + try: + p = int( m.group(1) ) + if p == NSPORT: + status = 0; + break; + except: + pass + pass + + if status == 1: print "%s - OK"%(NSPORT) # - from os import getpid - if sys.platform == "win32": - tmp_file = os.getenv('TEMP'); - else: - tmp_file = '/tmp/' - tmp_file += 'hostname_%s'%(getpid()) - #tmp_file = '/tmp/hostname_%s'%(getpid()) - from os import system system('hostname > %s'%(tmp_file)) f = open(tmp_file) myhost = f.read() myhost = myhost[:-1] f.close() - system('rm -f %s'%(tmp_file)) + + os.remove( tmp_file ); + # home = os.environ['HOME'] appli=os.environ.get("APPLI") @@ -734,8 +765,12 @@ def searchFreePort(args, save_config=1): f = open(os.environ['OMNIORB_CONFIG'], "w") import CORBA if CORBA.ORB_ID == "omniORB4": + initref += "\ngiopMaxMsgSize = 2097152000 # 2 GBytes"; + initref += "\ntraceLevel = 0 # critical errors only"; f.write("InitRef = %s\n"%(initref)) else: + initref += "\nORBgiopMaxMsgSize = 2097152000 # 2 GBytes"; + initref += "\nORBtraceLevel = 0 # critical errors only"; f.write("ORBInitRef %s\n"%(initref)) pass f.close() @@ -743,7 +778,11 @@ def searchFreePort(args, save_config=1): # if save_config: from os import system - system('ln -sf %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home)) + if sys.platform == "win32": + import shutil + shutil.copyfile( os.environ['OMNIORB_CONFIG'], "%s/.omniORB_last.cfg"%( home ) ) + else: + system('ln -s -f %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home)) pass # break @@ -775,6 +814,7 @@ def no_main(): def main(): """Salome launch as a main application""" import sys + print "runSalome running on ",os.getenv('HOSTNAME') args, modules_list, modules_root_dir = setenv.get_config() kill_salome(args) save_config = True diff --git a/bin/server.py b/bin/server.py index 88e74720e..5bd61799d 100755 --- a/bin/server.py +++ b/bin/server.py @@ -14,7 +14,7 @@ class Server: def initArgs(self): self.PID=None self.CMD=[] - self.ARGS=[] + self.ARGS=[] if self.args['xterm']: self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] @@ -32,15 +32,65 @@ class Server: + os.getenv("LD_LIBRARY_PATH")] myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path command = myargs + self.CMD - print "command = ", command - if sys.platform == "win32": + #print "command = ", command + if sys.platform == "win32": import win32pm #cmd_str = "\"" + string.join(command, " ") + "\"" #print cmd_str #pid = win32pm.spawnpid( cmd_str ) pid = win32pm.spawnpid( string.join(command, " "), '-nc' ) #pid = win32pm.spawnpid( string.join(command, " ") ) - else: - pid = os.spawnvp(os.P_NOWAIT, command[0], command) + else: + #pid = os.spawnvp(os.P_NOWAIT, command[0], command) + pid=self.daemonize(command) process_id[pid]=self.CMD self.PID = pid + return pid + + def daemonize(self,args): + # to daemonize a process need to do the UNIX double-fork magic + # see Stevens, "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) + # and UNIX Programming FAQ 1.7 How do I get my program to act like a daemon? + # http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 + #open a pipe + c2pread, c2pwrite = os.pipe() + #do first fork + pid=os.fork() + if pid > 0: + #first parent + os.close(c2pwrite) + #receive real pid from child + data=os.read(c2pread,24) #read 24 bytes + os.waitpid(pid,0) #remove zombie + os.close(c2pread) + # return : first parent + return int(data) + + #first child + # decouple from parent environment + os.setsid() + os.close(c2pread) + + # do second fork : second child not a session leader + try: + pid = os.fork() + if pid > 0: + #send real pid to parent + os.write(c2pwrite,"%d" % pid) + os.close(c2pwrite) + # exit from second parent + os._exit(0) + except OSError, e: + print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror) + os.write(c2pwrite,"-1") + os.close(c2pwrite) + sys.exit(1) + + #I am a daemon + os.close(0) #close stdin + os.open("/dev/null", os.O_RDWR) # redirect standard input (0) to /dev/null + try: + os.execvp(args[0], args) + except OSError, e: + print >>sys.stderr, "(%s) launch failed: %d (%s)" % (args[0],e.errno, e.strerror) + os._exit(127) diff --git a/bin/setenv.py b/bin/setenv.py index b401b3709..7e1b93d80 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -37,9 +37,9 @@ salome_subdir = "salome" def add_path(directory, variable_name): """Function helper to add environment variables""" if sys.platform == "win32": - splitsym = ";" + splitsym = ";" else: - splitsym = ":" + splitsym = ":" if not os.environ.has_key(variable_name): os.environ[variable_name] = "" pass @@ -77,7 +77,7 @@ def get_lib_dir(): __lib__dir__ = "lib64" else: __lib__dir__ = "lib" - return get_lib_dir() + return __lib__dir__ # ----------------------------------------------------------------------------- @@ -120,7 +120,7 @@ def get_config(): to_remove_list=[] for module in modules_list : - module_variable=module.upper()+"_ROOT_DIR" + module_variable=module+"_ROOT_DIR" if not os.environ.has_key(module_variable): print "*******************************************************" print "*" @@ -145,8 +145,8 @@ def get_config(): modules_list.remove("GUI") pass - if "SUPERV" in modules_list and not 'superv' in args['standalone']: - args['standalone'].append("superv") + if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']: + args['standalone'].append("supervContainer") pass return args, modules_list, modules_root_dir @@ -158,6 +158,8 @@ def set_env(args, modules_list, modules_root_dir): python_version="python%d.%d" % sys.version_info[0:2] modules_root_dir_list = [] + if os.getenv('SALOME_BATCH') == None: + os.putenv('SALOME_BATCH','0') if args["gui"] : modules_list = modules_list[:] + ["GUI"] modules_list = modules_list[:] + ["KERNEL"] @@ -240,9 +242,9 @@ def set_env(args, modules_list, modules_root_dir): "PYTHONPATH") - if sys.platform == "win32": - add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), - "PATH") + if sys.platform == "win32": + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), + "PATH") else: add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH") @@ -260,18 +262,20 @@ def set_env(args, modules_list, modules_root_dir): #if os.getenv("GUI_ROOT_DIR"): #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" - # set CSF_PluginDefaults variable only if it is not customized - # by the user - if not os.getenv("CSF_PluginDefaults"): - os.environ["CSF_PluginDefaults"] \ - = os.path.join(modules_root_dir["KERNEL"],"share", - salome_subdir,"resources","kernel") os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ = os.path.join(modules_root_dir["KERNEL"],"share", salome_subdir,"resources","kernel") if "GEOM" in modules_list: - if verbose(): print "GEOM OCAF Resources" + if verbose(): print "GEOM OCAF Resources" + + # set CSF_PluginDefaults variable only if it is not customized + # by the user + + if not os.getenv("CSF_PluginDefaults"): + os.environ["CSF_PluginDefaults"] \ + = os.path.join(modules_root_dir["GEOM"],"share", + salome_subdir,"resources","geom") os.environ["CSF_GEOMDS_ResourcesDefaults"] \ = os.path.join(modules_root_dir["GEOM"],"share", salome_subdir,"resources","geom") diff --git a/bin/shutdownSalome.py b/bin/shutdownSalome.py new file mode 100755 index 000000000..0c96154bb --- /dev/null +++ b/bin/shutdownSalome.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import orbmodule +import Engines +import Registry +import SALOME +import SALOMEDS +import SALOME_ModuleCatalog +clt=orbmodule.client() +obj = clt.Resolve('Kernel/Session') +if obj != None: + ses = obj._narrow(SALOME.Session) + ses.StopSession() +obj = clt.Resolve('SalomeLauncher') +if obj != None: + cm = obj._narrow(Engines.SalomeLauncher) + cm.Shutdown() +obj = clt.Resolve('Kernel/ModulCatalog') +if obj != None: + mc = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) + mc.shutdown() +obj = clt.Resolve('Registry') +if obj != None: + reg = obj._narrow(Registry.Components) + reg.Shutdown() +obj = clt.Resolve('myStudyManager') +if obj != None: + sm = obj._narrow(SALOMEDS.StudyManager) + sm.Shutdown() diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index 44cb0b8a2..4efd5979f 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -87,7 +87,7 @@ def get_lib_dir(): __lib__dir__ = "lib64" else: __lib__dir__ = "lib" - return get_lib_dir() + return __lib__dir__ # ----------------------------------------------------------------------------- @@ -114,10 +114,8 @@ def link_module(options): module_doc_tui_dir=os.path.join(module_dir,'doc','salome','tui') module_doc_dir=os.path.join(module_dir,'doc','salome') module_sharedoc_dir=os.path.join(module_dir,'share','doc','salome') - - if not os.path.exists(module_lib_py_dir): - print "Python directory %s does not exist" % module_lib_py_dir - return + module_sharedoc_gui_dir=os.path.join(module_dir,'share','doc','salome','gui') + module_sharedoc_tui_dir=os.path.join(module_dir,'share','doc','salome','tui') bin_dir=os.path.join(home_dir,'bin','salome') lib_dir=os.path.join(home_dir,'lib','salome') @@ -129,6 +127,8 @@ def link_module(options): doc_tui_dir=os.path.join(home_dir,'doc','salome','tui') doc_dir=os.path.join(home_dir,'doc','salome') sharedoc_dir=os.path.join(home_dir,'share','doc','salome') + sharedoc_gui_dir=os.path.join(home_dir,'share','doc','salome','gui') + sharedoc_tui_dir=os.path.join(home_dir,'share','doc','salome','tui') verbose = options.verbose @@ -164,34 +164,59 @@ def link_module(options): pass #directory lib/py_version/site-packages/salome : create it and link content - mkdir(lib_py_shared_dir) - for fn in os.listdir(module_lib_py_dir): - if fn == "shared_modules": continue - symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn)) - pass - if os.path.exists(module_lib_py_shared_dir): - for fn in os.listdir(module_lib_py_shared_dir): - symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn)) - pass - pass + if not os.path.exists(module_lib_py_dir): + print "Python directory %s does not exist" % module_lib_py_dir else: - print module_lib_py_shared_dir, " doesn't exist" - pass + mkdir(lib_py_shared_dir) + for fn in os.listdir(module_lib_py_dir): + if fn == "shared_modules": continue + symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn)) + pass + if os.path.exists(module_lib_py_shared_dir): + for fn in os.listdir(module_lib_py_shared_dir): + symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn)) + pass + pass + else: + print module_lib_py_shared_dir, " doesn't exist" + pass #directory share/doc/salome (KERNEL doc) : create it and link content if os.path.exists(module_sharedoc_dir): mkdir(sharedoc_dir) for fn in os.listdir(module_sharedoc_dir): + if fn == 'gui':continue + if fn == 'tui':continue symlink(os.path.join(module_sharedoc_dir, fn), os.path.join(sharedoc_dir, fn)) pass pass - pass + #directory share/doc/salome/gui : create it and link content + if os.path.exists(module_sharedoc_gui_dir): + mkdir(sharedoc_gui_dir) + for fn in os.listdir(module_sharedoc_gui_dir): + symlink(os.path.join(module_sharedoc_gui_dir, fn), os.path.join(sharedoc_gui_dir, fn)) + pass + pass + + #directory share/doc/salome/tui : create it and link content + if os.path.exists(module_sharedoc_tui_dir): + mkdir(sharedoc_tui_dir) + for fn in os.listdir(module_sharedoc_tui_dir): + symlink(os.path.join(module_sharedoc_tui_dir, fn), os.path.join(sharedoc_tui_dir, fn)) + pass + pass #directory share/salome/resources : create it and link content - mkdir(share_dir) - for fn in os.listdir(module_share_dir): - symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn)) + if os.path.exists(module_share_dir): + mkdir(share_dir) + for fn in os.listdir(module_share_dir): + symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn)) + pass + pass + else: + print "resources directory %s does not exist" % module_share_dir + pass #html files in doc/salome directory if os.path.exists(module_doc_dir): diff --git a/bin/waitContainers.py b/bin/waitContainers.py new file mode 100755 index 000000000..65198a3e3 --- /dev/null +++ b/bin/waitContainers.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +import sys +import time +import orbmodule +import CosNaming +clt = orbmodule.client() +clt.waitNS("/ContainerManager") +obj = clt.orb.resolve_initial_references("NameService") +rootContext = obj._narrow(CosNaming.NamingContext) +cname = [] +cname.append(CosNaming.NameComponent('Containers', 'dir')) + +while(1): + try: + ccontext = rootContext.resolve(cname) + break + except CosNaming.NamingContext.NotFound, ex: + time.sleep(1) + except CosNaming.NamingContext.InvalidName, ex: + time.sleep(1) + except CosNaming.NamingContext.CannotProceed, ex: + time.sleep(1) + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): + time.sleep(1) + +def waitContainer(mycont): + while(1): + bl,bi=ccontext.list(0) + if bi is not None: + ok,b=bi.next_one() + while(ok): + for s in b.binding_name : + if s.kind == "dir": + obj=ccontext.resolve([s]) + scontext = obj._narrow(CosNaming.NamingContext) + bll,bii=scontext.list(0) + if bii is not None: + ok,bb=bii.next_one() + while(ok): + for s in bb.binding_name : + if s.id == mycont: + print s.id + return + ok,bb=bii.next_one() + ok,b=bi.next_one() + sys.stdout.write('+') + sys.stdout.flush() + time.sleep(1) + +for cont in sys.argv: + if cont != sys.argv[0]: + waitContainer(cont) + diff --git a/bin/waitNS.py b/bin/waitNS.py new file mode 100755 index 000000000..e439f5fef --- /dev/null +++ b/bin/waitNS.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +import orbmodule +clt=orbmodule.client() +clt.waitNS("/Kernel/ModulCatalog") diff --git a/bin/waitNS.sh b/bin/waitNS.sh new file mode 100755 index 000000000..3d875f992 --- /dev/null +++ b/bin/waitNS.sh @@ -0,0 +1,9 @@ +#! /bin/sh +status=1 +while [ $status -ne 0 ]; do + ls $HOME/$APPLI/.omniORB_last.cfg >& /dev/null + status=$? + sleep 1 + echo -n "#" +done +./runSession waitNS.py \ No newline at end of file diff --git a/clean_configure b/clean_configure index a0073fb98..8869dadab 100755 --- a/clean_configure +++ b/clean_configure @@ -11,6 +11,7 @@ libdir=salome_adm/unix/config_files cd $libdir # Files created by libtoolize rm -f config.guess config.sub ltmain.sh +rm -f mdate-sh texinfo.tex # Files created by automake rm -rf install-sh missing compile depcomp py-compile cd $here @@ -21,3 +22,6 @@ find resources -name Makefile.in | xargs rm -f find salome_adm -name Makefile.in | xargs rm -f find src -name Makefile.in | xargs rm -f rm -f Makefile.in +# Other files +cd doc/salome +rm -f Batch.info stamp-vti version.texi diff --git a/configure.ac b/configure.ac index ad4ad88bf..43814e023 100644 --- a/configure.ac +++ b/configure.ac @@ -99,8 +99,8 @@ echo Configuring production echo --------------------------------------------- echo # production.m4 -AC_ENABLE_DEBUG(yes) -AC_DISABLE_PRODUCTION +AC_ENABLE_DEBUG(no) +AC_ENABLE_PRODUCTION(no) echo echo --------------------------------------------- @@ -181,14 +181,6 @@ echo CHECK_HDF5 -echo -echo --------------------------------------------- -echo Testing OpenCascade -echo --------------------------------------------- -echo - -CHECK_CAS - # ---------------------------------------------------------------------------- # --- test corba @@ -239,20 +231,19 @@ AC_SUBST_FILE(CORBA) echo echo --------------------------------------------- -echo Testing QT +echo BOOST Library echo --------------------------------------------- echo -# Qt must be kept because kernel makes use of qxml and some other -# non-graphical stuff. -CHECK_QT + +CHECK_BOOST echo echo --------------------------------------------- -echo BOOST Library +echo Testing libxml2 echo --------------------------------------------- echo -CHECK_BOOST +CHECK_LIBXML fi # --- end test corba @@ -419,9 +410,9 @@ function check_fatal_error { # -------------------------------------- if test x$corba_gen = xtrue; then - basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok" + basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok" else - basic_mandatory_products="cc_ok threads_ok hdf5_ok occ_ok" + basic_mandatory_products="cc_ok threads_ok hdf5_ok" fi echo --- General mandatory products - Light configuration: @@ -429,7 +420,7 @@ summary $basic_mandatory_products check_fatal_error $basic_mandatory_products echo -corba_mandatory_products="omniORB_ok qt_ok boost_ok" +corba_mandatory_products="omniORB_ok boost_ok libxml_ok" if test x$corba_gen = xtrue; then echo --- CORBA mandatory products - default configuration: summary $corba_mandatory_products @@ -548,11 +539,11 @@ AC_OUTPUT([ \ ./src/Basics/Test/Makefile \ ./src/Batch/Makefile \ ./src/Batch_SWIG/Makefile \ - ./src/CASCatch/Makefile \ ./src/Communication/Makefile \ ./src/Communication_SWIG/Makefile \ ./src/Container/Makefile \ ./src/ParallelContainer/Makefile \ + ./src/DF/Makefile \ ./src/DSC/Makefile \ ./src/DSC/DSC_Basic/Makefile \ ./src/DSC/DSC_User/Makefile \ @@ -561,9 +552,11 @@ AC_OUTPUT([ \ ./src/DSC/DSC_User/Datastream/Palm/Makefile \ ./src/DSC/DSC_User/Datastream/Calcium/Makefile \ ./src/DSC/ParallelDSC/Makefile \ + ./src/DSC/DSC_Python/Makefile \ ./src/GenericObj/Makefile \ ./src/HDFPersist/Makefile \ ./src/KERNEL_PY/Makefile \ + ./src/Launcher/Makefile \ ./src/LifeCycleCORBA/Makefile \ ./src/LifeCycleCORBA/Test/Makefile \ ./src/LifeCycleCORBA_SWIG/Makefile \ diff --git a/doc/Makefile.am b/doc/Makefile.am index c504425be..cfa250da1 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -30,13 +30,13 @@ SUBDIRS = salome doc_DATA = if RST2HTML_IS_OK - doc_DATA += \ - index.html \ - UnitTests.html \ - SALOME_Application.html \ - INSTALL.html \ - kernel_resources.html \ - KERNEL_Services.html +# doc_DATA += \ +# index.html \ +# UnitTests.html \ +# SALOME_Application.html \ +# INSTALL.html \ +# kernel_resources.html \ +# KERNEL_Services.html endif EXTRA_DIST=$(doc_DATA) @@ -55,4 +55,4 @@ usr_docs: (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) dev_docs: - (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) \ No newline at end of file + (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index b1075e0b8..86089e1b9 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -49,3 +49,8 @@ info_TEXINFOS = Batch.texi install-data-local: html usr_docs cp -rp $(top_builddir)/doc/salome/Batch.html $(docdir) + +EXTRA_DIST= main.dox install.dox \ + kernel_resources.dox kernel_services.dox \ + salome_application.dox unittests.dox \ + salome_file.dox batch.dox diff --git a/doc/salome/batch.dox b/doc/salome/batch.dox new file mode 100644 index 000000000..7e0e4e29b --- /dev/null +++ b/doc/salome/batch.dox @@ -0,0 +1,10 @@ +/*! + +\page batch_page Batch + + Batch documentation + +*/ + + + diff --git a/doc/salome/install.dox b/doc/salome/install.dox new file mode 100644 index 000000000..8090ff92f --- /dev/null +++ b/doc/salome/install.dox @@ -0,0 +1,378 @@ +/*! + \page INSTALL Installation instructions + +NOT UP TO DATE %SALOME 4 +WORK in PROGRESS, INCOMPLETE DOCUMENT + +You'll find here generic instructions for installing the SALOME2 platform. + +\section Summary + +
    +
  1. \ref S1_install
  2. +
  3. \ref S2_install
  4. +
  5. \ref S3_install
  6. +
  7. \ref S4_install
  8. +
  9. \ref S5_install
  10. +
  11. \ref S6_install
  12. +
  13. \ref S7_install
  14. +
  15. \ref S8_install
  16. +
+ +\section S1_install Quick Overview + +First of all, you have to check (or install if needed) the dependant +software programs on your system. These programs are: + +- common development tools as gcc, automake, autoconf and libtools. +- third party softwares used in SALOME building or runtime process + (python, OCC, VTK, ...) + +Further details can be found in sections [2] and [3]. + +If the dependencies are installed on your system, then you have to set +your shell environment to get access to the software components +(cf. [4]. "Preparing the shell environment"). + +The next step is to install the KERNEL (cf. [5] "Installing KERNEL"): + +\code +$ mkdir +$ mkdir +$ cd +$ ./build_configure +$ cd +$ /configure --prefix= +$ make +$ make install +\endcode + +Then, the %SALOME components GEOM, MED, VISU, ... can be installed +with a similar procedure (cf. [6]). + +Eventually, the platform ccodean be run by executing the shell script +runSalome (cf. [7]). Here, somme additionnal variables have to be set +to describe the %SALOME runtime configuration (_ROOT_DIR, +OMNIORB_CONFIG) + +The following provides you with specific instructions for each step. + + +\section S2_install System configuration + +%SALOME is compiled and tested on differents platforms with native packages: +- Debian sarge +- Mandrake 10.1 +- ... + +If you have another platform, we suggest the following configuration +for building process: + +- gcc-3.3.x or 3.4.x +- automake-1.7 or more (only aclocal is used) +- autoconf-2.59 +- libtool-1.5.6 + +remarks: + +- This is the minimum level of automake, autoconf and libtool, if you need + to compile all the third party softwares (included OpenCascade 5.2.x). + +\section S3_install Third-party dependencies + +The %SALOME platform relies on a set of third-party softwares. The +current version depends on the following list +(versions given here are from Debian Sarge, except OpenCascade, VTK and MED, +which are not Debian packages): + +- CAS-5.2.4 OpenCascade (try binaries,a source patch is needed) +- VTK-4.2.6 VTK 3D-viewer +- PyQt-3.13 Python-Qt Wrapper +- Python-2.3.5 Python interpreter +- SWIG-1.3.24 SWIG library +- boost-1_32_0 C++ library (only include templates are used) +- hdf5-1.6.2 Files Database library +- med-2.2.2 MED Data Format support for file records +- omniORB-4.0.5 ORB used in %SALOME +- qt-x11-free-3.3.3 Qt library +- qwt-4.2 Graph components for Qt +- sip4-4.1.1 langage binding software + +And, in order to build the documentation: + +- doxygen-1.4.2 +- graphviz-2.2.1 + + +Additionnal software may be installed for optional features: + +- netgen4.3 + patch +- tix8.1.4 +- openpbs-2.3.16 +- lsf-??? + +To Do + +- Instructions for installing these software programs can be found in a + special note doc/configuration_examples/install-prerequis. +- Installation shell scripts are also provided. + These scripts have to be adapted to your own configuration. + +- See doc/configuration_examples/* + +In the following, we assume that all the third-party softwares are +installed in the same root directory, named /prerequis. +Then, your file system should probably look like:: + +\code +/prerequis/Python-2.2.2 +/prerequis/omniORB-3.0.5 +/prerequis/qt-x11-free-3.0.5 +... +\endcode + +\section S4_install Preparing the shell environment + +Some variables have to be set to get acces to third-party software +components (include files, executable, library, ...) during building +process and runtime. + +The shell file prerequis.sh, embedded in the KERNEL source package, +provides a template for setting those variables. In this example, all the +softwares are supposed to be installed in the same root directory, +named here INSTALLROOT. + +Copy the prerequis.sh in a working directory and adjust the settings +to your own configuration. To get the shell prepared, just +execute the following command in the building shell: + +\code +$ source prerequis.sh +\endcode + +(we assume here a ksh or bash mode) + + +\section S5_install Installing the KERNEL component + +We use here the notation to specify the source directory +of the KERNEL component. The shell environment is supposed to have +been set (cf. 4). + +Installing the KERNEL from a source package needs three directories: + +- the source directory, denoted here by . + +- the build directory, denoted by in the following. This + directory can't be the same directory as . + +- the install directory, denoted by in the following. This + directory can't be the same directory as or + . + +The installing process is: + +STEP 1: + preparing directories + + create the and the directories: + + \code +$ mkdir +$ mkdir +\endcode + +STEP 2: + build configure script + + go to directory and generate the "configure" script: + + \code +$ cd +$ ./build_configure + \endcode + + If it doesn't work, check your system automake tools as specified in + section [2]. + +STEP 3: + configure the building process + go to the build directory and execute the configuration process:: + + \code +$ cd +$ /configure --prefix= + \endcode + + Note that must be an absolute path. + + When the configure process is complete, check the status of + third-party softwares detection. You should have a status like:: + + \code + --------------------------------------------- + Summary + --------------------------------------------- + Configure + cc : yes + boost : yes + lex_yacc : yes + python : yes + swig : yes + threads : yes + OpenGL : yes + qt : yes + vtk : yes + hdf5 : yes + med2 : yes + omniORB : yes + occ : yes + sip : yes + pyqt : yes + qwt : yes + doxygen : yes + graphviz : no + openpbs : no + lsf : no + Default ORB : omniORB + ---------------------------------------------- + \endcode + +If a software get a status "no", then it's not "seen" in the system: + +- the software is not installed, or +- the shell environment is not set correctly. + +In this example, the software programs graphviz, openpbs and lsf are not +installed (optional for most usages). + + +STEP 4 : + Building the binary files + + Execute make in the directory:: + + \code +$ make + \endcode + +STEP 5: + Installing binary files, scripts and documentation + + Execute install target in the directory:: + + \code +$ make install + \endcode + +\section S6_install Installing the SALOME components + +TInstalling a component is done by following the same +instructions as given for the KERNEL, replacing KERNEL by + (build_configure, configure, make, make install). + +You just have to be aware of the dependencies between components: + +- MED depends on KERNEL +- GEOM depends on KERNEL +- SMESH depends on KERNEL, MED, GEOM +- VISU depends on KERNEL, MED +- SUPERV depends on KERNEL + +For example, installing the component SMESH needs the previous +installation of the KERNEL component, and then the GEOM and MED components. + +The building process uses the variables _ROOT_DIR to +localize the dependant components. The variables must be set to the +install path directory of the components (ex: +KERNEL_ROOT_DIR=). + +In the above example, the three variables KERNEL_ROOT_DIR, +GEOM_ROOT_DIR and MED_ROOT_DIR have to be set before configuring the +building process of the SMESH component (STEP 3). + + +\section S7_install Runtime + +See SALOME_Application to define your own configuration of %SALOME and run it +on one or several computers. This is the recommended way of configuration. + +The following explains the general principles. + +To run the %SALOME platform, the procedure is: + +- set the shell environment to get acces to third-party softwares: + +\code +$ source prerequis.sh +\endcode + +- define the %SALOME configuration by setting the whole set of + variables _ROOT_DIR. Here, you just have to set the + kernel and the components you need:: + + \code +$ export KERNEL_ROOT_DIR= +$ export MED_ROOT_DIR= +$ ... + \endcode + +- define the CORBA configuration file by setting the variable + OMNIORB_CONFIG. This variable must be set to a writable file + path. The file may be arbitrary chosen and doesn't need to exist + before running. We suggest:: + + \code +$ export OMNIORB_CONFIG=$HOME/.omniORB.cfg + \endcode + +- run the %SALOME platform by executing the script runSalome: + + \code +$KERNEL_ROOT_DIR/bin/salome/runSalome + \endcode + +\section S8_install Suggestions and advices + +For convenience or customization, we suggest the following organisation: + +- chose and create a root directory for the %SALOME platform, say + . + +- install the third-party softwares in a sub-directory "prerequis" + +- install the %SALOME components in a sub-directory "SALOME2" + +- make personnal copies of the files prerequis.sh and runSalome in + : + + \code +$ cp /prerequis.sh /. +$ cp /bin/salome/runSalome /. + \endcode + + Edit the file prerequis.sh and adjust it to your own configuration. + +- define the SALOME2 configuration + + This step consists in setting the KERNEL_ROOT_DIR, the whole set of + variables _ROOT_DIR you need, and the OMNIORB_CONFIG + variable. + + We suggest to create a shell file envSalome.sh containing those + settings. Then the configuration consists in loading envSalome.sh in + the runtime shell: + +\code +$ source envSalome.sh +\endcode + +- When installed with this file organisation, running %SALOME is done + with the following shell commands:: + + \code + $ source /prerequis.sh + $ source /envSalome.sh + $ ./runSalome + \endcode +*/ diff --git a/doc/salome/kernel_resources.dox b/doc/salome/kernel_resources.dox new file mode 100644 index 000000000..6401e942b --- /dev/null +++ b/doc/salome/kernel_resources.dox @@ -0,0 +1,559 @@ +/*! + +\page kernel_resources SALOME Kernel resources for developer + +WORK in PROGRESS, INCOMPLETE DOCUMENT + + +\section S1_kernel_res Abstract + +This document describes the development environment for +C++ and Python. Makefiles generation and usage are +introduced in another document: "using the %SALOME +configuration and building system environment". +Development environment is intended here as: trace and +debug macros usage; %SALOME exceptions usage, in C++ and +Python; user CORBA exceptions usage, in C++ and Python, +with and without Graphical User Interface; some general +purpose services such as singleton, used for CORBA +connection and disconnection. + +\section S2_kernel_res Trace and debug Utilities + +During the development process, an execution log is +useful to identify problems. This log contains +messages, variables values, source files names and line +numbers. It is recommended to verify assertions on +variables values and if necessary, to stop the +execution at debug time, in order to validate all parts +of code. + +
    +
  1. +Two modes: debug and release + +The goal of debug mode is to check as many features as +possible during the early stages of the development +process. The purpose of the utilities provided in +%SALOME is to help the developer to add detailed traces +and check variables values, without writing a lot of code. + +When the code is assumed to be valid, the release mode +optimizes execution, in terms of speed, memory, and +display only user level messages. + +But, some informations must always be displayed in both +modes: especially messages concerning environment or +internal errors, with version identification. When an +end user is confronted to such a message, he may refer +to a configuration documentation or send the message to +the people in charge of %SALOME installation, or to the +development team, following the kind of error. +
  2. +
  3. +C++ Macros for trace and debug + +%SALOME provides C++ macros for trace and debug. These +macros are in: + +\code +KERNEL_SRC/src/SALOMELocalTrace/utilities.h +\endcode + +This file must be included in C++ source. Some +macros are activated only in debug mode, others are +always activated. To activate the debug mode, ``_DEBUG_`` +must be defined, which is the case when %SALOME +Makefiles are generated from configure, without +options. When ``_DEBUG_`` is undefined (release mode: +``configure --disable-debug --enable-production``), the +debug mode macros are defined empty (they do nothing). +So, when switching from debug to release, it is +possible (and recommended) to let the macro calls +unchanged in the source. + +All the macros generate trace messages, stored in a +circular buffer pool. %A separate %thread reads the +messages in the buffer pool, and, depending on options +given at %SALOME start, writes the messages on the +standard output, a file, or send them via CORBA, in +case of a multi machine configuration. + +Three informations are systematically added in front of +the information displayed: + +- the %thread number from which the message come from; + +- the name of the source file in which the macros is set; + +- the line number of the source file at which the macro + is set. + +
      +
    1. +Macros defined in debug and release modes +\n +INFOS_COMPILATION + + The C++ macro INFOS_COMPILATION writes on the trace + buffer pool informations about the compiling process: + + - the name of the compiler : g++, KCC, CC, pgCC; + + - the date and the time of the compiling processing process. + + This macro INFOS_COMPILATION does not have any + argument. Moreover, it is defined in both compiling + mode : _DEBUG_ and _RELEASE_. + + Example: + + \code +#include "utilities.h" +int main(int argc , char **argv) +{ + INFOS_COMPILATION; + ... +} +INFOS(str) + \endcode +\n +INFOS + + In both compiling mode _DEBUG_ and _RELEASE_, The C++ + macro INFOS writes on the trace buffer pool %the string + which has been passed in argument by the user. + + Example: + + \code +#include "utilities.h" +int main(int argc , char **argv) +{ + ... + INFOS("NORMAL END OF THE PROCESS"); + return 0; +} + \endcode + + Displays: + + \code +main.cxx [5] : NORMAL END OF THE PROCESS + \endcode +\n +INTERRUPTION(str) + + In both compiling mode _DEBUG_ and _RELEASE_, The C++ + macro INTERRUPTION writes on the trace buffer pool the + %string, with a special ABORT type. When the %thread in + charge of collecting messages finds this message, it + terminates the application, after message treatment. + +IMMEDIATE_ABORT(str) + + In both compiling mode _DEBUG_ and _RELEASE_, The C++ + macro IMMEDIATE_ABORT writes the message str immediately on + standard error and exits the application. Remaining + messages not treated by the message collector %thread + are lost. + +
    2. +
    3. +Macros defined only in debug mode +\n +MESSAGE(str) + + In _DEBUG_ compiling mode only, the C++ macro MESSAGE + writes on the trace buffer pool the %string which has + been passed in argument by the user. In _RELEASE_ + compiling mode, this macro is blank. + + Example: + + \code +#include "utilities.h" +#include + +using namespace std; + +int main(int argc , char **argv) +{ + ... + const char *str = "Salome"; + MESSAGE(str); + ... const string st; + st = "Aster"; + MESSAGE(c_str(st+" and CASTEM")); + return 0; +} + + \endcode + + Displays: + + \code +- Trace main.cxx [8] : Salome +- Trace main.cxx [12] : Aster and CASTEM + \endcode + +\n +BEGIN_OF(func_name) + + In _DEBUG_ compiling mode, The C++ macro BEGIN_OF + appends the %string "Begin of " to the one passed in + argument by the user and displays the result on the + trace buffer pool. In _RELEASE_ compiling mode, this + macro is blank. + + Example: + + \code +#include "utilities.h" +int main(int argc , char **argv) +{ + BEGIN_OF(argv[0]); + return 0; +} + \endcode + + Displays: + + \code + - Trace main.cxx [3] : Begin of a.out + \endcode +\n +END_OF(func_name) + + In _DEBUG_ compiling mode, The C++ macro END_OF appends + the %string "Normal end of " to the one passed in + argument by the user and displays the result on the + trace buffer pool. In _RELEASE_ compiling mode, this + macro is blank. + + Example: + + \code +#include "utilities.h" +int main(int argc , char **argv) +{ + END_OF(argv[0]); + return 0; +} + \endcode + + Displays: + + \code +- Trace main.cxx [4] : Normal end of a.out + \endcode +\n +SCRUTE(var) + + In _DEBUG_ compiling mode, The C++ macro SCRUTE + displays its argument which is an application variable + followed by the value of the variable. In _RELEASE_ + compiling mode, this macro is blank. + + Example: + + \code +#include "utilities.h" +int main(int argc , char **argv) +{ + const int i=999; + if( i > 0 ) SCRUTE(i) ; i=i+1; + return 0; +} + \endcode + + Displays: + + \code +- Trace main.cxx [5] : i=999 + \endcode +\n +ASSERT(condition) + + In _DEBUG_ compiling mode only, The C++ macro ASSERT + checks the expression passed in argument to be not + NULL. If it is NULL the condition is written with the + macro INTERRUPTION (see above). The process exits after + trace of this last message. In _RELEASE_ compiling + mode, this macro is blank. N.B. : if ASSERT is already + defined, this macro is ignored. + + Example: + + \code +#include "utilities.h" +... +const char *ptrS = fonc(); +ASSERT(ptrS!=NULL); +cout << strlen(ptrS); +float table[10]; +int k; +... +ASSERT(k<10); +cout << table[k]; + \endcode + +
    4. +
    +
  4. +
+ +\section S3_kernel_res Exceptions + +
    +
  1. +C++ exceptions: class SALOME_Exception + +
      +
    1. +definition + +The class SALOME_Exception provides a generic method to +send a message, with optional source file name and line +number. This class is intended to serve as a base class +for all kinds of exceptions %SALOME code. All the +exceptions derived from SALOME_Exception could be +handled in a single catch, in which the message +associated to the exception is displayed, or sent to a +log file. + +The class SALOME_Exception inherits its behavior from +the STL class exception. +
    2. +
    3. +usage + +The header %SALOME/src/utils/utils_SALOME_Exception.hxx +must be included in the C++ source, when raised or trapped: + +\code +#include "utils_SALOME_Exception.hxx" +\endcode + +The SALOME_Exception constructor is: + +\code +SALOME_Exception( const char *text, + const char *fileName=0, + const unsigned int lineNumber=0 ); +\endcode + +The exception is raised like this: + +\code +throw SALOME_Exception("my pertinent message"); +\endcode + +or like this: + +\code +throw SALOME_Exception(LOCALIZED("my pertinent message")); +\endcode + +where LOCALIZED is a macro provided with +``utils_SALOME_Exception.hxx`` which gives file name and +line number. + +The exception is handled like this: + +\code + try +{ + ... +} +catch (const SALOME_Exception &ex) +{ + cerr << ex.what() < +
    +
  2. +
  3. +CORBA exceptions + +
      +
    1. +definition + +The idl SALOME_Exception provides a generic CORBA +exception for %SALOME, with an attribute that gives an +exception type,a message, plus optional source file +name and line number. + +This idl is intended to serve for all user CORBA +exceptions raised in %SALOME code, as IDL specification +does not support exception inheritance. So, all the +user CORBA exceptions from %SALOME could be handled in a +single catch. + +The exception types defined in idl are: + + - COMM CORBA communication problem, + + - BAD_PARAM Bad User parameters, + + - INTERNAL_ERROR application level problem (often irrecoverable). + +CORBA system and user exceptions already defined in the +packages used within %SALOME, such as OmniORB +exceptions, must be handled separately. + +
    2. +
    3. +usage +
        +
      1. +CORBA servant, C++ + + The CORBA Server header for SALOME_Exception and a + macro to throw the exception are provided with the + header ``KERNEL_SRC/src/Utils/Utils_CorbaException.hxx``: + + \code +#include "Utils_CorbaException.hxx" + \endcode + + The exception is raised with a macro which appends file + name and line number: + + \code +if (myStudyName.size() == 0) + THROW_SALOME_CORBA_EXCEPTION("No Study Name given", + SALOME::BAD_PARAM); + \endcode + +
      2. +
      3. +CORBA Client, GUI Qt C++ + + NO MORE AVAILABLE in %SALOME 3.x + + The CORBA Client header for SALOME_Exception and a Qt + function header that displays a message box are + provided in: + + ``KERNEL_SRC/src/SALOMEGUI/SALOMEGUI_QtCatchCorbaException.hxx`` + + \code +#include "SALOMEGUI_QtCatchCorbaException.hxx" + \endcode + + %A typical exchange with a CORBA Servant will be: + + \code +try +{ + ... // one ore more CORBA calls +} + +catch (const SALOME::SALOME_Exception & S_ex) +{ + QtCatchCorbaException(S_ex); +} + \endcode + +
      4. +
      5. +CORBA Client, C++, without GUI + + Nothing specific has been provided to the developer + yet. See the idl or the Qt function + SALOMEGUI_QtCatchCorbaException.hxx to see how to get + the information given by the exception %object. + +
      6. +
      +
    4. +
    +
+ +\section S4_kernel_res Miscellaneous tools + +
    +
  1. +Singleton +
      +
    1. +Definition + +%A singleton is an application data which is created and +deleted only once at the end of the application +process. The C++ compiler allows the user to create a +static singleton data before the first executable +statement. They are deleted after the last statement execution. + +The ``SINGLETON_`` template class deals with dynamic +singleton. It is useful for functor objects. For +example, an %object that connects the application to a +system at creation and disconnects the application at deletion. + +
    2. +
    3. +Usage + +To create a single instance of a POINT %object: + +\code +# include "Utils_SINGLETON.hxx" +... +POINT *ptrPoint=SINGLETON_::Instance() ; +assert(ptrPoint!=NULL) ; +\endcode + +No need to delete ptrPoint. Deletion is achieved +automatically at exit. If the user tries to create more +than one singleton by using the class method +SINGLETON_::Instance(), the pointer is returned +with the same value even if this is done in different +functions (threads ?): + +\code +POINT *p1=SINGLETON_::Instance() ; +... +POINT *p2=SINGLETON_::Instance() ; + +assert(p1==p2) +\endcode + +
    4. +
    5. +Design description + +Here are the principles features of the singleton +design: + +- the user creates an %object of class TYPE by using the + class method ``SINGLETON_::Instance()`` which + returns a pointer to the single %object ; + +- to create an %object, ``SINGLETON_::Instance()`` + uses the default constructor of class TYPE ; + +- at the same time, this class method creates a + destructor %object which is added to the generic list + of destructor objects to be executed at the end of + the application (atexit) ; + +- at the end of the application process all the + deletions are performed by the ``Nettoyage()`` C function + which executes the destruction objects end then + deletes the destructions objects themselves ; + +- the ``Nettoyage()`` C function using ``atexit()`` C function + is embedded in a static single %object ``ATEXIT_()``. + +
    6. +
    +
  2. +
+ +*/ diff --git a/doc/salome/kernel_services.dox b/doc/salome/kernel_services.dox new file mode 100644 index 000000000..d363c84cf --- /dev/null +++ b/doc/salome/kernel_services.dox @@ -0,0 +1,236 @@ +/*! + \page KERNEL_Services KERNEL Services for end user (Python interface) + +WORK in PROGRESS, INCOMPLETE DOCUMENT + +In a %SALOME application, distributed components, servers and clients use +the CORBA middleware for comunication. CORBA interfaces are defined via idl +files. All the different CORBA interfaces are available for users in Python, +see CORBA interfaces below. + +For some general purpose services, CORBA interfaces have been encapsulated +in order to provide a simple interface (encapsulation is generally done in +C++ classes, and a Python SWIG interface is also generated from C++, to +ensure a consistent behavior between C++ modules and Python modules or user +script). + +\section S1_kernel_ser General purpose services + +
    +
  1. +%SALOME services access from a Python shell + +See \ref SALOME_Application for detailed instructions to launch a Python +interpreter with full acces to the %SALOME environment and services. + +You can use the embedded Python interpreter in Grahic User Interface, or an +external interpreter, with: + +\code +./runSession +python +\endcode + +In either cases, %SALOME services access is done with: + +\code +import salome +salome.salome_init() +\endcode + +In the embedded interpreter, it is already done, but there is no problem to +do it several times, so it is preferable to add these instructions +systematically in your scripts, to allow them to work in all configurations. + +
  2. +
  3. +Container and component instanciation + +See LifeCycleCORBA for the C++ interface (Python interface obtained with SWIG +is very similar). + +In the following example, a test component provided in KERNEL is launched +in the local container, "FactoryServer", created when %SALOME starts: + +\code +import salome +salome.salome_init() + +import LifeCycleCORBA +lcc = LifeCycleCORBA.LifeCycleCORBA() +obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") + +import Engines +comp=obj._narrow(Engines.TestComponent) + +comp.Coucou(1) +\endcode + +The answer is something like: + +\code +'TestComponent_i : L = 1' +\endcode + +The _narrow() instruction is not always mandatory in Python, but sometimes +useful to be sure you have got the right type of %object. Here, Testcomponent +interface is defined in CORBA module Engines. With this example, it works also +without the _narrow() instruction: + +\code + obj.Coucou(1) +\endcode + +In the next example, a component instance is created in a specific Container +defined by it's computer hostname and it's name. Here we use the local +computer. Note that in Utils_Identity, getShortHostName() gives the short +hostname of the computer, without domain suffixes, which is used in %SALOME. +The container process is created here if it does not exists, and a new +component instance is created: + +\code +import salome +salome.salome_init() +import LifeCycleCORBA +lcc = LifeCycleCORBA.LifeCycleCORBA() + +import Utils_Identity +host = Utils_Identity.getShortHostName() + +import Engines +params={} +params['hostname']=host +params['container_name']='myContainer' +comp=lcc.LoadComponent(params,'SalomeTestComponent') +comp.Coucou(1) +\endcode + +If you want to get a list of containers and component instances, client %object +from orbmodule provides a list: + +\code +import orbmodule +clt=orbmodule.client() +clt.showNS() +\endcode + +The list looks like: + +\code +Logger. +ContainerManager.object +Containers.dir + cli70ac.dir + FactoryServerPy.object + SuperVisionContainer.object + FactoryServer.object + FactoryServer.dir + SalomeTestComponent_inst_1.object + myContainer.object + myContainer.dir + SalomeTestComponent_inst_1.object + SalomeTestComponent_inst_2.object +Registry.object +Kernel.dir + ModulCatalog.object + Session.object +Study.dir + Study2.object + extStudy_1.object + extStudy_2.object + extStudy_3.object +myStudyManager.object +SalomeAppEngine.object +\endcode + +
  4. +
  5. +File transfer service + +See SALOME_FileTransferCORBA for the C++ interface (Python interface obtained with +SWIG is very similar). + +The following example shows how to tranfer a file from a remote host to the +client computer. Remote hostname is 'cli76cc', we would like to copy +'tkcvs_8_0_3.tar.gz' from remote to local computer. %A full pathname is +required. %A container is created on remote computer if it does not exist, +to handle the file transfer: + +\code +import salome +salome.salome_init() + +import LifeCycleCORBA +remotefile="/home/prascle/tkcvs_8_0_3.tar.gz" +aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile) +localFile=aFileTransfer.getLocalFile() +\endcode + +
  6. +
  7. +CORBA Naming service access + +See SALOME_NamingService for the C++ interface. The Python interface +SALOME_NamingServicePy is not yet derived from the C++ interface and offers +only the most useful functions. + +
  8. +
  9. +Batch services + +See \ref batch_page documentation (in french only). + +
  10. +
+ +\section S2_kernel_ser All IDL Interfaces + +
    +
  1. +Containers and component life cycle, File transfer service + +- Engines : engines CORBA module. +- Engines::Component : generic component interface. All %SALOME components inherit this interface. +- Engines::Container : host for C++ and Python components components instances +- Engines::fileTransfer : agent for file transfer created by a container copy a local file to a distent client +- Engines::fileRef : reference to a file, used by a container for file transfers +- Engines::ContainerManager : unique instance, in charge of container creation on remote computers +- Engines::MPIContainer : an exemple of parallel implementation for containers and components +- Engines::MPIObject + +
  2. +
  3. +Study management + +- SALOMEDS : SALOMEDS CORBA module +- SALOMEDS.idl +- SALOMEDS_Attributes.idl + +
  4. +
  5. +High speed transfer, object life cycle, exceptions, GUI interface... + +- SALOME : %SALOME CORBA module +- SALOME_Comm.idl +- SALOME_GenericObj.idl +- SALOME_Exception +- SALOME_Session.idl + +
  6. +
  7. +Miscelleanous + +- SALOME_ModuleCatalog +- SALOME_RessourcesCatalog +- SALOME_Registry.idl +- Logger.idl + +Other idl for test purposes +\n +- nstest.idl +- SALOME_TestComponent.idl +- SALOME_TestModuleCatalog.idl +- SALOME_TestMPIComponent.idl +- TestNotif.idl + +*/ diff --git a/doc/salome/main.dox b/doc/salome/main.dox new file mode 100644 index 000000000..7515c353c --- /dev/null +++ b/doc/salome/main.dox @@ -0,0 +1,82 @@ +/*! \mainpage SALOME KERNEL Reference Documentation + \image html kernel_about_4.png + + \section S1_main Introduction + + Welcome to the %SALOME KERNEL documentation ! + + Following your kind of usage of %SALOME, you will find some specific + introductory documentation, listed below. + + \section S2_main End user + +
      +
    1. + How to configure a %SALOME application + \n The end user may have to configure his own %SALOME application by selection of a + subset of availables %SALOME modules. He also may want to install his + application on several computers. + See \subpage SALOME_Application to define your own configuration of %SALOME and run it + on one or several computers. This is the recommended way of configuration. +
    2. +
    3. + How to launch %SALOME in a %SALOME application + \n See \ref SALOME_Application. +
    4. +
    5. + How to use KERNEL services in Python scripts + \n The %SALOME KERNEL offers a list of services available in Python. See \subpage KERNEL_Services. +
    6. +
    + + \section S3_main Application Integrator + + Applications integrators are in charge of configuration and installation of + specific %SALOME applications over a local network. Application Integrators + built %SALOME modules binaries from sources tarballs. + +
      +
    1. + How to install %SALOME + \n See \subpage INSTALL for general information on required configuration and + prerequisites, compilation procedure, setting environment principles. +
    2. +
    3. + How to configure a %SALOME application + \n See \ref SALOME_Application to define your own configuration of %SALOME and run it + on one or several computers. This is the recommended way of configuration. +
    4. +
    + + \section S4_main Module maintainer + + Module maintainers are in charge of the development and debug of the %SALOME + modules. Each %SALOME module is stored in a CVS base. CVS bases are organised + in separate branches for developments and debug. All official or development + releases are identified by a CVS tag. + +
      +
    1. + Source code structuration and Unit Tests + \n See \subpage UnitTests for general information on code directories structure, + unit tests associated to the different kind of classes, and how to run + the unit tests. +
    2. +
    3. + Some development utilities + \n See \subpage kernel_resources for information on basic utilities for C++ and Python + development, like trace and debug, exceptions, singleton. +
    4. +
    + + \section S5_main SALOME programming model + + You will find in the next pages informations about + specific points of %SALOME Kernel : + + - \subpage dsc_page : DSC documentation page. + - \subpage salome_file_page : Salome_file documentation page. + - \subpage batch_page : BATCH documentation page. + +*/ + diff --git a/doc/salome/salome_application.dox b/doc/salome/salome_application.dox new file mode 100644 index 000000000..0060c7794 --- /dev/null +++ b/doc/salome/salome_application.dox @@ -0,0 +1,373 @@ +/*! + \page SALOME_Application SALOME Application Concept + + Configuration for one or more computers + + + **WORK in PROGRESS, INCOMPLETE DOCUMENT** + +The following explains how to configure your own application with your list of +modules, how to define and run this application on one or more computers. + +\section S1_sal_appl General principles + +%A %SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...). + +%A %SALOME User can define several %SALOME Applications. These applications are +runnable from the same user account. These applications may share the same +KERNEL and modules. Thus, the application configuration is independant of +KERNEL and must not be put in KERNEL_ROOT_DIR. + +Furthermore, prerequisites may not be the same on all the applications. + +%A %SALOME Session can run on a several computers. + +Binary modules and prerequisites are installed on the different computers. +There is no need to have all the modules on each computer (the minimum is +KERNEL). + +There is no need of standardization or centralised information on the details +of configuration on each computer (PATH, LD_LIBRARY_PATH, environment +variables) provided the application modules are version - compatible. Details +of configuration stay private to the computer, and are held by scripts on each +computer. + +There is no hierarchy between the computers (for example only one master +computer used to launch application). + +The %SALOME user has an account on all the computers. Access between +account@computer is via rsh or ssh and must be configured for use without +password (key exchange for ssh). Account may be different on each +computer. + +\section S2_sal_appl Application Directory + +There is two ways for creation of an application directory + +
      +
    1. + First way - references to different module directories + +The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/SALOME creates an +application directory with the given path in parameter. ${APPLI} is a path +relative to ${HOME}. + +The directory is only a skeleton, the user has to edit several files to +configure his own application. These files are described after, the list is: + +- env.d/atFirst.sh +- env.d/envProducts.sh +- env.d/envSALOME.sh +- CatalogResources.xml +- SALOMEApp.xml + +
    2. +
    3. + Second and easiest way - one single virtual install directory + +The user must create a %SALOME application configuration file by modifying a +copy of ${KERNEL_ROOT_DIR}/bin/SALOME/config_appli.xml. +The file describes the list of %SALOME modules used in the application, with +their respective installation path. The configuration file also defines the +path of an existing script which sets the %SALOME prerequisites, +and optionnaly, the path of samples directory (SAMPLES_SRC). +The following command:: + +\code +python /bin/SALOME/appli_gen.py --prefix= --config= +\endcode + +creates a virtual installation of %SALOME in the application directory ${APPLI} +(bin, lib, doc, share...), with, for each file (executable, script, data, +library, resources...), symbolic links to the actual file. + +Providing an existing an existing script for %SALOME prerequisites (the same one +used for modules compilation, or given with the modules installation), the +installation works without further modification for a single computer (unless +some modules needs a special environment not defined in the above script). +For a distributed application (several computers), one must copy and adapt +CatalogResources.xml from ${KERNEL_ROOT_DIR}/bin/SALOME/appliskel (see below). +
    4. +
    + +\section S3_sal_appl General rules + +Directory ${APPLI} must be created on each computer of the application. +The easiest way is to use the same relative path (to ${HOME}) on each computer. +(Sometimes it is not possible to use the same path everywhere, for instance +when ${HOME} is shared with NFS, so it is possible to define different path +following the computers). + +The ${APPLI} directory contains scripts for environment and runs. Environment +scripts must be configured (by the user) on each computer. All the environment +scripts are in the ${APPLI}/env.d directory. + +The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d +in alphanumeric order (after edition, think to remove backup files). the envd +script is used by run scripts. + +
      +
    1. +env.d scripts + +With the first way of installation, each user **must define** his own +configuration for these scripts, following the above rules. +With the virtual installation (second way, above), env.d +scripts are built automatically. + + **The following is only an example proposed by createAppli.sh, (first way of installation) not working as it is**. + +- atFirst.sh + Sets the computer configuration not directly related to %SALOME, + like useful tools, default PATH. + +- envProducts.sh + Sets the %SALOME prerequisites. + +- envSALOME.sh + Sets all the MODULE_ROOT_DIR that can be used in the %SALOME application. + + SALOMEAppConfig is also defined by: + +\code +export SALOMEAppConfig=${HOME}/${APPLI} +\endcode + + where SALOMEAppConfig designates the directory containing SALOMEApp.xml. + Note that ${APPLI} is already defined by the calling scripts when + env.d/envSALOME.sh is sourced. +
    2. +
    3. +User run scripts + +The %SALOME user can use 4 scripts: + +- runAppli + Launches a %SALOME Session + (similar to ${KERNEL_ROOT_DIR}/bin/SALOME/runSALOME but with a different + name to avoid confusions). + +- runSession + Launches a shell script in the %SALOME application environment, with access + to the current (last launched) %SALOME session (naming service), if any. + Without arguments, the script is interactive. With arguments, the script + executes the command in the %SALOME application environment. + +- runConsole + Gives a python console connected to the current %SALOME Session. + It is also possible to use runSession, then python. + +- runTests + Similar to runSession, used for unit testing. runSession tries to use an + already existing naming service definition from a running session (hostname + and port number), runTests defines a new configuration for naming service + (new port number). +
    4. +
    5. +%SALOME internal run scripts + +- envd + Sets %SALOME application environment, envd is sourced by other scripts. + +For remote calls, %SALOME uses one script. + +- runRemote.sh + This script is mainly used to launch containers. The first 2 arguments + define the hostname and port userd for naming service, the remaining + arguments define the command to execute. +
    6. +
    7. +Other configuration files + +- SALOMEApp.xml + This file is similar to the default given + in ${GUI_ROOT_DIR}/share/SALOME/resources/gui + + +- CatalogRessources.xml + This files describes all the computers the application can use. The given + example is minimal and suppose ${APPLI} is the same relative path + to ${HOME}, on all the computers. %A different directory can be set on a + particular computer with a line: + +\code +appliPath="my/specific/path/on/this/computer" +\endcode + +
    8. +
    + +\section S4_sal_appl Examples of use + +
      +
    1. +Launch a %SALOME session with a GUI interface + +Launch is done with a command like:: + +\code +./runAppli --logger +\endcode + +The --logger option means here : collect all the traces from the all the +distributed process, via CORBA, in a single file : logger.log. + +There are a lot of options, a complete list is given by:: + +\code +./runAppli --help +\endcode + +Note that, without argument, runAppli is a non interactive Python application, +and, with arguments, runAppli is an interactive Python interpreter. + +Several options are already defined by default in SALOMEApp.xml files. Optional +arguments given in the command override the SALOMEApp.xml configuration. + +Several sessions can run simultaneously, each session use a different port for +CORBA naming service, so the sessions are totally separated from each other. + +When the GUI is closed, the different %SALOME servers are still running. +
    2. +
    3. +Close a %SALOME session, kill all the servers + +Inside the interactive python interpreter you get when you use runAppli +with arguments, you can kill all the servers of your session with:: + +\code +>>> killLocalPort() +\endcode + +or the servers of all the sessions with:: + +\code +>>> killAllPorts() +\endcode + +If you have no active Python interpreter connected to your session, you can +kill all the %SALOME servers of **all the sessions** on a given computer:: + +\code +./runSession killSALOME.py +\endcode + +Remember! it's the same idea in *Windows (R) operating system* (Microsoft and Windows are either registered trademarks or trademarks of + Microsoft Corporation in the United States and/or other countries) : +use the start menu to stop... + +When you use only one session at a time, you don't need more. + +To kill a given session (when several session are running), one needs +the naming service port number:: + +\code +./runSession killSALOMEWithPort 2810 +\endcode + +Note that the port number of the last launched session can be found on Linux, +in the prompt, within a runSession shell (see below). + +It is also possible to get the Naming Service host and port number of +the last launched session with:: + +\code +./runSession NSparam.py +\endcode + +
    4. +
    5. +Launch a %SALOME session without GUI interface + +This is used to launch a %SALOME Python script without GUI +(no GUI %server = SALOME_session_server) + +Example of script (test_session_geom.py): + +\code +import SALOME_session +SALOME_session.startSession(modules=["GEOM"]) +import GEOM_usinggeom +raw_input("Press a key and the servers will be killed ...") +\endcode + +This script is run in a non interactive way with:: + +\code +./runSession python test_session_geom.py +\endcode + +All the process are automatically killed when Python is closed +(with SALOME_session delete). +
    6. +
    7. +Add an external Python interpretor to a running session + +It's often easier to develop and try Python scripts outside the GUI embedded +Python interpreter. Imagine, for instance, you are writing a script involving +geometry and mesh modules. +first, launch a %SALOME session with gui, then, on another terminal:: + +\code +./runSession +python +\endcode + +Import %SALOME module. SALOME_init() without arguments creates a new study +in the running session (note: SALOME_init(n) attachs to a running session whose +studyId is n):: + +\code +import SALOME +SALOME.SALOME_init() +\endcode + +An example of script given with SMESH:: + +\code +import ex01_cube2build +\endcode + +It is possible to connect the GUI interface to the study created in the above +script with the file/connect menu, then browse study and display objects. +Further modifications on study can be done either with GUI or external script +(use refresh popup in GUI %object browser to see study modifications generated +by the external script). **AVOID modifications with GUI when a Python script +is running**. Not all the modules are protected against concurrent actions... +
    8. +
    9. +Different uses of the runSession shell interpreter + +runSession invoked without arguments gives an interactive shell with the full +environment of %SALOME (PATH, LD_LIBRARY_PATH, PYTHONPATH, other variables). +If there are running sessions of the same %SALOME application, runSession +connects to the last launched session (i.e. gets the naming service references +of the session: hostname and port) + +On Linux, the shell prompt (bash) gives information on naming service +references, hostname and port:: + +\code +[NS=cli76cc:2811]prascle@cli76cc:~/SALOME2/Run/Virtual$ +\endcode + +If there is no running session, prompt looks like:: + +\code +[NS=:]prascle@cli76cc:~/SALOME2/Run/Virtual$ +\endcode + +runSession is useful to launch any script or program which needs the complete +%SALOME environment, with or without a session already running. +For instance, to launch the ddd debugger interface on the gui %server, first +launch a %SALOME session with gui, then, on another terminal:: + +\code +./runSession ddd +\endcode + +Then attach to the running SALOME_Session_Server process. +
    10. +
    + +*/ diff --git a/doc/salome/salome_file.dox b/doc/salome/salome_file.dox new file mode 100644 index 000000000..dffb378b9 --- /dev/null +++ b/doc/salome/salome_file.dox @@ -0,0 +1,123 @@ +/*! + +\page salome_file_page Salome_file + +This page introduces the Salome_file feature. Salome_file is based on the +SALOME_FileTransfer. It extends it to enable a higher model for managing files into +%SALOME applications. + +\section S1_Salome_file Principles + +Salome_file is a CORBA %object. It's role is to managed many system files. When a Salome_file +is created, no files are managed. Then, files are added using Salome_file interface. %A file is represented +by a name and a path. + +There is two different cases when a file is added : + +- Local file : the file added exists or it will be created by the user with the path and the name used in +its registration. +- Distributed file : the file added exists into a distributed localization. + +To be able to get a distributed file, the Salome_file has to be connected with an another Salome_file that +managed this file. This distributed Salome_file could be located into a distributed resource. + +\section S2_Salome_file Simple example + +This section shows a simple example of the use of Salome_file. The objective is to create +two Salome_file; one is managing a local file, the other is managing a distributed file. +Then, these Salome_files are connected to enable the copy of the real file gbetween the two Salome_files. + +Firstly, two Salome_files are created : + +\code +#include "Salome_file_i.hxx" + +int main (int argc, char * argv[]) +{ + Salome_file_i file_source; + Salome_file_i file_dest; + +\endcode + +Secondly, the real files are registered into the Salome_files. + +\code + file_source.setLocalFile("/bin/cat"); + file_dest.setDistributedFile("/tmp/cat_copy"); +\endcode + +Thirdly, we connect the destination file with the source file : + +\code + file_dest.connect(file_source); +\endcode + +Finally, the file is sended using Salome_file interface. + +\code + file_dest.recvFiles(); + // Status check + state = file_dest.getSalome_fileState(); + print_state(state); // You have to implement this function. +}; +\endcode + +\section S3_Salome_file Advanced example + +This advanced example illustrates a part of the Salome_file API dedicated +for situations where multiple files are managed. + +This is the situation : + +\code + +#include "Salome_file_i.hxx" + +int main (int argc, char * argv[]) +{ + Salome_file_i file_source_a; + Salome_file_i file_source_b; + Salome_file_i file_dest; + + file_source_a.setLocalFile("/bin/cat"); + file_source_a.setLocalFile("/bin/ls"); + + file_source_b.setLocalFile("/bin/echo"); + file_source_b.setLocalFile("/bin/cp"); + + file_dest.setDistributedFile("/tmp/cat_copy"); + file_dest.setDistributedFile("/tmp/echo_copy"); +\endcode + +There is two problems in this case. + +The first problem is in the file_dest Salome_file, there is two files. If +the method connect is used, the Salome_file cannot know if the reference is for cat_copy or +echo_copy. Indeed echo_copy could be provided by another Salome_file that for cat_copy. + +The second problem comes from the two files of file_source_a Salome_file. Indeed when connect is used, +there is no information about the choice of the source file into the source Salome_file. For +cat_copy, did the used want cat or echo ? + +To avoid these cases, Salome_file API provides advanced methods : + +\code + file_dest.connectDistributedFile("cat_copy", file_source_a); + file_dest.setDistributedSourceFile("cat_copy", "cat"); + + file_dest.connectDistributedFile("cat_echo", file_source_b); + file_dest.setDistributedSourceFile("cat_echo", "echo"); + + file_dest.recvFiles(); + // Status check + state = file_dest.getSalome_fileState(); + print_state(state); // You have to implement this function. +}; +\endcode + +\section S3_Salome_file Using Salome_file into %SALOME services + +Currently you can't use Salome_file into YACS schema. In the next version of %SALOME, +files ports will be available to connect output files to input files. + +*/ diff --git a/doc/salome/tui/KERNEL/doxyuser.in b/doc/salome/tui/KERNEL/doxyuser.in index 854a69cc4..d3387500b 100644 --- a/doc/salome/tui/KERNEL/doxyuser.in +++ b/doc/salome/tui/KERNEL/doxyuser.in @@ -58,8 +58,8 @@ GENERATE_BUGLIST = NO GENERATE_DEPRECATEDLIST= NO ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 25 -SHOW_USED_FILES = NO -SHOW_DIRECTORIES = NO +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- @@ -77,6 +77,7 @@ WARN_LOGFILE = log.txt # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = \ + @top_srcdir@/doc/salome \ @top_srcdir@/bin \ @top_srcdir@/idl \ @top_srcdir@/src/Container \ @@ -85,7 +86,7 @@ INPUT = \ @top_srcdir@/src/Notification \ @top_srcdir@/src/Utils \ @top_srcdir@/src/DSC -FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here +FILE_PATTERNS = *.dox *.idl *.hxx *.cxx python_extension_must_be_here RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO @@ -96,15 +97,15 @@ EXAMPLE_RECURSIVE = NO IMAGE_PATH = sources/ INPUT_FILTER = FILTER_PATTERNS = -FILTER_SOURCE_FILES = YES +FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO +SOURCE_BROWSER = YES +INLINE_SOURCES = YES STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES USE_HTAGS = NO VERBATIM_HEADERS = YES @@ -124,7 +125,7 @@ HTML_OUTPUT = KERNEL HTML_FILE_EXTENSION = .html HTML_HEADER = sources/myheader.html HTML_FOOTER = sources/footer.html -HTML_STYLESHEET = sources/doxygen.css +HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = @@ -134,7 +135,7 @@ BINARY_TOC = YES TOC_EXPAND = YES DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- diff --git a/doc/salome/tui/KERNEL/sources/footer.html b/doc/salome/tui/KERNEL/sources/footer.html index 8aa47dfe0..56d52a61a 100755 --- a/doc/salome/tui/KERNEL/sources/footer.html +++ b/doc/salome/tui/KERNEL/sources/footer.html @@ -1,15 +1,10 @@ - - - + + + + + +
    +
    Copyright © 2003-2007 CEA, EDF
    +
    + + diff --git a/doc/salome/tui/KERNEL/sources/kernel_about_4.png b/doc/salome/tui/KERNEL/sources/kernel_about_4.png new file mode 100644 index 0000000000000000000000000000000000000000..5c9c09a795758f733b327c4e39d9d7d80ad6943b GIT binary patch literal 134730 zcmbrmWl$wSwXx9K}G_s#cS#Qb_u zQBf;bsC6#era85Hw(5;J9!w{}{JC{&+GiNB!78TCa(nu&2zNah4W7~7Bm6Y`0xs>%I;*}z z^nytTVWy}HvX7qYMtDE`J*|9Kp`&EOjetXCr~m61@4agt-p?t z$^Qq(6XgHzUjGdK6MJug9sN)1|2fcq;zJmk{~Gmw-QYhlF*l&&zxjWr;1mD5&;JLH zA}jwNasP=0?E;+sAJPAb|KF1Tuk!!@O8&pgmm+-e|JwchhRPZNCm%C}L=FS^P=R6z z^?$pHINROl7XR%${uMtMoQ_wy;in}2c=gKTj~v*lDN8FR4rbxOo*P%*_l-S}rXU%8 zCy&J^YM(vFeH$Q%0r1n|cNkTZ_ z09t5-{0mrF+BIPzNUajr&Lyxp$&XG-7I_}gXwZ7U7 zA=BcH(%vdZuOfA;6R1JB9^lc7wFG&^46yWvtL_h zAOIv6##ElgBchtq{y}m^;@6&ym5mFWIBOI@R*^7*D1*YvVA`k)2>L{VV9Zmxnauqg zxi}j}aFP`KMLhzBVEOEJkB~h)tHx|`a;lHphl7Bj*te!$4BoMSS}atMC|s)d_mCAW zA!9(Cr}!BvaQ`?xP_`!!FQ9&R?BS`Bf`?2esQCf9Agzz$q`qCFU)Jj9Edo?se`IBj z0%P*_<<2rL;RJqc?-wW z;QdXy5MIl8p%kY-oL6kYS9fq31+R5`S3fJgR=w?H~GuP*=v5-7J8Tmn90i7eLvU4xh0PH(j z#0fJ*5VN3&zbSA2VqC=i`Iuz5sSH1V$?dI&>nm4EZQB+HcnX3I`Jxy_GcImZr?f^G zsh_@L2+)OZ>C^y|y7ZI(aTlxhj(^=ar{@_xIMgw`hB+OR0h@*D@2dSz1$+u}w!rus z)1=+*2QAqAebUg3O=}qe*!x+7PU`k1FihW~f<+&IwPgH=DiPjzy9d`b9{3Q136eZx z4qh6Dn2u7~tT6pv1YSU`o40{Lq%Sx!=;~KRCyWk7`WGKumVtRMQyS>xUhf>Pvg~Rl zeQ`Br`d4gl$PwF1Zfgd!Jjs}A1SA%xCpB>ANMJ`_@g`)v4 zUYcd(qPTd=BZUAOImnKA{=T~;P_qq|jHd=}fYGGm#gB3qHwUVQMIG><_;mLj9v)IZ z#=HONVfr(on+&YKx>^(7xoP-{bh`NM%g&x=n`D6J&U-O60e%d13`K72hnXT#JLR=I zX0>f1mI#!TC75so8|5!1On~7*01L#Fkj;Wz5o+52VPgI=glQQ?Er!zQ3p^1rH|yN+ zHDIO4150A(DZs+Mj*b}3(eGy6fW}Ygp+j#pFEc1&t#$MG(`^R} z<(E{g5eYr~c=qAN8NGS%s=kpy-c!+_2H5xJVW-h)V=F*fb!afVXk99lMcFvJ^O&<4&6J~?=C%+eMT9n!bN^PngJZb zptD`HJq=MwwZ5Uf?)L=D))$dmY}fiPh1DuiLFo24ZX8S&Mr-xGGS7HaB}Vn0f@ZLHc1fjdBAJ#&bL=2 z!KVTcq@jmkdSjj_P6}XXN_gNJJ2Fd}oz3sGh-H^jz?+;wclo6nl2uu)uU+q)4!4Na z;}F@^0nyX6zM7jS+@iV3hZtFfe5nTb z?POWsqfXK^4(bAu9ouB`5n&u)XzO~rU=#x;twXHw6doY@tIxUXWCi`d_?8N6uCcI> zT>MWxX3qcq9iH!lVNY3oL%PV`nY>zLPIXzaxmeA^dGOHG$vrAPLd>@uj_`pYJ}`zc zgT^>-X^)dbW2s9`QLgQT&~VMP;0wcx2?b6M)2Xc=jAV-M;qP?)-8;_{hnKa)b!Pr<3f@_Hwq3M0c5`k^a);jOg_In zhdt%_;}J z8kM`jbb~{2VwI1f1f>iDWdqC>Q_BO!Rx~XvO9aUzXTG79J>pW?WzM~Bbz;LIAxd0p z_WgTh6{2(HVyHMn+0>-OR>yG3%CI;Qs-^&!#KmPa8~H&jBCBV&`N)k1H!v;)EZ3E} zU+TD;UB{e)HIq3Lnsyg>=^R#{MnUa`Np+t!2FbMyrv{0wK?c5YBPJYXM-N7|Xywl@ zab+EgH@!AgWol7w$msLRxnx`kbfz`C8HYR>t#p>bK(e{zs34 zwL*p;JfV>7I+3{wkH>HcWt_EBh%?BjrQ=1w>z-?I_i)(sTLF7Z+(#wDKm>LMdZX)gSeAaOmbPX7f|sj^|H?uLhrY{vX0skO46J zNU(I7RGG1<)iOSgoj=v_;VQorFW{=1s8n=ilDs3{pVA7KHMmXyXDQEibMCs0#5a!C z7c+)8b$MvL=jDaULG-!4ffacXRbW-0_HHVMZYsVxkCvl{vUbS3120?iC$*Kkob%LU z5%SCfOPHWL+l5feBx&bYzq?~oL|SuErl4f2G~8Z(`BeujqZeLvB3&anm8UfKG0hf# zKHiBlXHULSIWtCvPE6=!gg@D^V9vuEi)py*Uem8%6v2L{qxALCIGA54YgvH4S2t$u z0!@PO)vTyx!6v4*Ax|qPnp4hTwi5B|xbS!bzR$a>H;6{Jmnkq*o;a>5&W+x$n>7 zR^)kH1P{TPsXy18nm<#5Mz98!%_ihjOfowm|`ltbmlI=Mr;qz%!9f+tAI79fr-3=n*bpRH zTmiW)y=eC*#e?N9HibupyMO{$v${5@SU56hZU_}8rN*WEBB{PvMp`6tVdKVBw?bLXVbWPWcX7-*c_<;WmjX^UudJ+msPb*jluayD`Z9k z@^Q-hh%I(#|!YjZC64 zT?r_bfn=M7cQw3T)$HYouLF;v)3;Jn`;)}xgoh2Fb)}eVYVDs7m!?kWZ}YiUa@10crt@E0EOd$sFU6EQI((wb}suxa%NuaP6>HDLrI z>ixU9ZKERcEe7r``JGzj^1Dgap7PdOsfk~Z?^#B;%byE1!XW0? z+KSK+L?I~0wPLFSvg)jo%;^`+_x=D0-VWTuIy0~lFA#krBU%Y#moIx>$J<*C9w2=2nW-z%1@@zczw-HV-*+Jol^2<$|3ibk2!o^ zmR@N{C_S!XSojMh%8I=6gU!B&QV zM%5pXak(El=PrRV6Gd~?h+N6U=%gF{;Jbb9S~=`{Y}O1~Z<;?!`E91&89TVD`GSaf zW~452s|h~yaPZXuW3o~lQzvW=b80|Vsh`_bHG6mVMBY7h-NBdnNsm7f<_gMPTy#Gi z&I$hu7}Bk*SZ7%fPY-J1j|$=~>{O6nGI$z+jZk2oR}h`nH?vlR#HV5l#eXZT+H*dJj zn)6n(1`rsUqy8|yc{~Nu;Q=DFo6*yx%>6;R9Izj`DlGPHGS-ei&gWMvBsyaHl^0O7 zP9`2OxN4M{uby2C4_+iHHfKE%R4wr3Eg7l>^}AAOS!g8?)A2}Nz`y=AXN@poHg}NS z8&c-Y2P(%ADNF2}!6dGF5z+pgF;s4~VN-#|%3~iUHG-tIs;fIIA(Ne1GD&t?+o;1M z5ARd7%x94jv*!m}o)lk8TfSg!q;hm;nJbaUhH>c}Z>C)4j9qF@ucc1;+-MqZB6F=i zjW@{1e6yZjqGFs~CVX#Q3Q`o+6wAFYiS+eDmMyPpvNjztt$@g&mjoe{YiWcdwkZz| zI+&Sf`pVA&lVw3EMY`4cdI0NnC`WK2+SE?TcpG_Bhsu-;8**or)M9LJfJ zazu-|S3cuQ!9^OsC8j*hK1SBhICA-c{@S0rEBgsP9 zX$jF=_Re!b!-sFubKP8-TTLQEzFcBqcJ8;d4~ z9bAt*!Alb+STP$fI4qQZ=m~CQf}b?y`0fvQ(b7rNhmJdo(lB{KJk{0N*_pT5s=RnL zpOnf?4fc|vp|uGV)UEyXjsdnwbH`#jXrM!3~yFdd|B5i{K8QMk@*j2uiRgOCD+ga1(aFN=!f9Bz-W!2Kz3>_=I<=FfDNz~=((84`3!1>JYe7e9mw)M zx21_Jk<&p^0=&E|O?C3ATxYz#rS5cXCUf{C1|QA-siniq@ADaQw82zJK@u+d7I74{|Sl7gr?c{dy!Io(dBf*#ULQ zX%L;5Z!)n zQ6KIlcu+0t_VU4_9`2{_f&ahA1_f#ogQ2(^lLbKEw6jH4p8t*)%j>?`%H-(-vRmy*r zDBUtRq&p=aDH`=c2{dc$qaViMGIipzj6lh#zGaW{9xm3+$t(Y3{}XQJ8O^f`Ci`Nv zrI?~{b!Apb3+=s-_z2qYVU{em?}ZPv{l*N<7LRBGCYX0#t3M#*;}kIJ5#x>W1EVlKp2!OF|ZWz^h>*=iR^WD>CI{E zf-3tu>rA}2_!XYb1_X|E?X3v|Xb)fBQI27q6g`CUdRwui*Ap?s@{}BmVC!N;Z8|X- z$<$ZBwKd4=Wh-R&a5%UBw)n<0&QSwTzHx$`p6;tP! z5X_7f8G)T~SiY&}S#2|J9Ti7JZnghU^L<-%YDVmVC1OHfoYpU!b4MUl_QHbt!elN- z`w|0H0EBMW{_MvA)l16|oq(^CS*q5DqhA}8MQ>IN9(zof`V#UsyiK2f5W#K>92 zX>c>uHkMB17*(`xhU-5Ba&!|NnYYyzj4eM^T`vxtleN8eKxs?R%r;-{bGCT9{C zH?pD?Yvs6D0n3bO)tF`B%dV)_W2vJtO@LN_8qAL3<#1>BK=Q-+M;N#JUoKs7fH%&y zhHA}okWR7|e)gumF0YqW>a=Y1!cNXD&D&fPe1OG*RLI9hAW=i)&yu{&UA59^qijg0 zb*4J3A1EV)IWK6YXo1416_oV@E@%E?9v;!VrwRQCNPMw=J+O?Zm=f`R2Hp`SyeM$O{qOgyZETW@xfX%HL|wy!vg}Hl zggUbkTP~ly&~2D&%1E)`Xq*53sbC^C*0!0Zv&&Jx;+8-OSYupO$IzMx{1=;dN*3h{ z^pb&KfitKZ{ayiUU`m5ww|D*j98(^_#2s`eue}bm1o+!KC6@Kf=OM_c5MSy!MGeJD zQyiCyZA6ZXT;#K>A?bC{a7rS_<3UU+U z(WpohZ-4X=S1ShJnam-+Wkg0Pb-u+)7*z?mlZlgdvEQ%m2Vi+>G!607t0-uPsf42D@Vn|r}GHp9NEFFWw%HAeA&W+k$hQ{mlKL_ zMgt`{f0HyO%1OGcgsAdcj<&k=6koA2HGZ9yM}kQjOR2RG3{8-04%mKB;%T50Q{0Z4 z`4$yHQY+h)p4NurHFNEE9f*UJtLn>F&pRYm{Lxt+mw~f7&F{m&S%Zbq&&KzMNw5=o zrY8T)^NhYP&jMmXUmj~?$%elmk;FXkUVp{rck9fw<=q>Xd)Z`eRz5_-8_aB>9j}f9|6#zeMn?_@AA1ObZ zy=*WboOWr{1@vI4xlE=vXCavAFtt#Khj;w#oDR9s?iecyxVU@rVNse|k0u&ESVL)4 zi=N|hYO@rkd7}95EzuJvOit9x4IsV$X5U@CP}}!)11Rd~2fmpqhEY{t;Tl1a-ixLlzCx8Wv z2+1vuoD#BiFhLqb`3RpLVYJZ9bRfM?nd7I=!YWlvIfZqy&5GcRHygn9RDp+l+=c7@ zn(HdbKuYhQ&^O`}z$rZ*vN*98FQv!`9z;Fd?|1@~Dg$cq$o7cqP?;`(D61Mga-tCJ z?W-&LcF|mc`1JG$^-V1KXZivG@$uL;qd%_l<%ftd>cot04sVF!-vO_W$Qc;GiRTv( z$r@$R97!Hsp_`mw=uoWRkLf4%$#7kTR1#Ku=|zpW9MDxG#c&CyInS}C zN!GF#pMK66dN`PLu2-xgs7X%+2?XGdl>N=6n#clhYs&I{hZ()9d}O5S{Xtq9DyL=8 zL?eXea6pAyrj6Qz>WdBUxL>xrt~g2q>VwJl!yD3V5Wyiz=$i=FWk+dN*2}?hLMRBT z+!%z>H04&;+v09uzgs(cpy&EY{;m*kGs{Bru{J|V-2oSw^$^nOfG~qUxF+DtV0u;$ ztx89HJjSRy%_YuM>uTr-Nlh#_FMBMm#hDhX@0L^jB&+JqV{X22z!hO%(qg$kUw67! z(KJ(nS)AO{+*Py`7F@`f!;K-5EeK?$#cJtJYP|Az`($>9_@G`e6Wz#rrGC6eQCxQd zwv*&FPs=EIAr~lrs)!b8#ING4I}(!g!f(JNEIhNP98bunSXQpvmozVF8z)5NXf`6F zYk42APy+(8-}^CM*p6C?B?3t9bp-?acaXPb94g;9C2kzr3~dsI=KwNzx)HY$1Y;tlKj zol;}6hyx;OQ~8U2&2Bfk3e$DCDQdy%D0l;6dK?2ZcKpQn6mO2U<9t}m?&^UXQ6DNJ zdiQ_OA!ca1B0$<8UW)ypnTUWDT02G7GUW`>DSiFQ2#(7CG# zEeZ!oKe_4E`+K4cnN4g5>Dkh|r4bcxAm&?LQA60nYqCUiP>0C^D20uUmfAM+e%z|! zU%Kk{6hqP!g1{wH>zFNdFeHV~B0|F%*hJwC-`rNP=d6t@Sgh@_a(dk% z*rI`+0z#d4JX~*7G&-n9F@0}8C1TpKghZDppz^|+w1OviqDxn>L_8OX52(xWqjy#T z9~d2-edOKg{Wx}(eYBp-ywU#SD>(qWN{EMdP)t75&QSWVB|@;XLS>A(FRa zorzUfQEJzKOQv+0!!p+tmC}R75R-9FsnxT@v~69?4_HR_@ON!UYkA;Go_a76 zi7};g9gUwW915bzzI?bHi&KsmtX&NSe$yJSMa0wPTOEdfvvV3ed^x5aGY72$%|xm^ zK2K%H4OU#I`erx7y4OvdeSCg?tubR4`_n;u9cUVOd5*|tZ)D7HY~v-Zh&6TTA8Wv! zs^wmiGOPut!ZK`BAM#CUQ?PXWR8}1ATPU5%?ES_OxepIFIb8jeLG$FJqWbxGhiQji3!!ZhXk-_=!>`simWRaUAzFF-2C-=ZCw(J-Wj$o;1nlv zNE&Q-q;j;}c4$Bdnua$uHNXNg|Iqk5;Gxv2oHin}oQ?FH@v(yuUMatX71DKe(H%3- zb;SlkD+JC5mJ&u9h(r0BVm06648WFARv3<0M_{7N7|q z$0`?yjmJ@@FOCUq9;owI?xx%kCCCIpK3yLyMJFk(aix5TNTu%jF8^%T>G4!$9JpN_3xtvE6}0qNJhJ5^&1m38oChWcJwEmzM~YYNS^-wmtuRLPV0MDXU8rPMZ^87+M#i#c>Pv

    KVHX9C@uxw!Yt;J6lmZ@Z@ z2W8$s(zn4JZ%?R|Xc%&3IvxSqln7FjBRZ-qpJKB~Op$^hqATCOs%xT3FdD@?5=k*V zLPA2|>&hPyqz2Io{ z)C&xN+8LtNSyXmh0yfrSLczRHtE{k2&!iPT(r<8iu5%jqki_SGX#>_Gs%+x2i_Pih zOK%iA35&6Gb`(^|vC(vcHKOEW%2ZLDdipG=3K`o#i@Kmw$*T2oiF}E>UNi^a6%o(U za|4MT`r|C)hH|JXxA#gqiLwG%=mGG7>RMwJo|%i1U5rrr^D_E+vHQ1 zuF4eW!%6WV4d@VMNSNEydcnMb!WucVKP9EXz4bQCu7U>UDrRAYjdY{`zU<-Q(zS|u znNu%H;g~@n{cm2R02@Z~T%7(yGO|be5786&+>EG+`VQC zPUcZHbtQyk$eVl1OG92t0TdRfWIn@M70^qNz3+_n}Y)BQe%e9Gx(sw z_mM1bMB*Nb%^U%KObk@*WJvDLXog{SugivYIzx3M+yJG{-}2*F=<(w>#jU$F%d-c0 z3GBbjRNfbgQ#w4!(Aoglj>`SX=(No=)VLNhuTZ{B(C={FvO;Rtk$nE!7xjBE>Nk|N zB>}3-XAVf}3d{*3 zR%(GNw8K^p7cO`?+R44wITFnj&-s(Hiwx^xqLi*=_B8xc0pT!>KXr;-ZRs+-DW^xV zOM{lx*>Yzv*6>@T<`?7&imZERC&>`C4|p1s!O|YOT?XzfuwuUadLaMKPgU|k(Q>Xt zX(o9|=Pp0YWKwU3UeQ$WT_Qot}|83U&f`mja?B~ou#x|q;k{(PSn4V%*;4r({ z`CA>jU=bArwdVfvG5JhhC6d|cwp|&t_uK+&A5GrJT?dW%z-xJEM*Pu@&)wUM_knbS zT@T7or!zV=@{&6D8BHk`uV@`pYcERyGYaJuVRebMPH_SK8N`z`+Tq=;AGTf5nA{#_j6#9ma$3=xF{$IK&vmyex-KLifX4( zl|E&rX~lFUulqON~&_4etD%i!{2 zYX6g6FPIy=Lr<(3Gf1+|t0|k#H;29#C*3+-#EfBP5Eu?>j#ulrz?$Qv0MBS;OpN6#F*vZPUWM;;ri&&G}1scpB9^RZJ_$BY4^Obr?- z-mJI}WMdV#rf>I?ZBp=LnK(xo`n(%~O9a0iy_=rMVYEmvbcq6llonq)z4*>r|MpP~ zFgikFl;DLxBkIkm`c-C6$;Lqi9KH3%v5N*D+aED$ENkVN}OH@ z-|gl`nG2e5!!(|krI9OvMYly6a>`QuSLNkAgNe~hJQ_E8h!E zW7#orzZR^#KOm4f{fVhf+*(V#Ge*CSkVTh-IdK9+wW7k{v@vI9HnQu0pn1O z4&ZFU&X3}Z(+OS02CGilu1?zuG{}Ur7;U2=X^y?tSma+bQ<7C_5US8mInPFDB;IPi zdL-;NXQ`JwLTJ@wY%XGr4i5 zjd6*Ul!&`Ct!)cs7c5KG9vl%Ht1k`bD2D~<{n1f;l4|PNn~68(rpo#^UyB^i7<}Sw zoc;?`%mUoaZf^oDSJ%_w#ce8D%@Z9yXk?YF#1c>(!Iq;cgH`ZR`0K~r`zZd%Iw>Nm zR(E&7)buMUc6M!AVs3)oL9LaOQe*V0h@?=J-8qz?ZU8QI-a{8a&xO()u@c58fxEj zp8YDj(y(S#&`Cd2CLQ{fJSx?+Ib_;Qc`o|Q^E*w1RNh?ULg(GH#Yf*6!WO4yxx%D} z9V$1xaQQXj?;d=~uO&Zopa>-0d67IV-ejYT41+9;3%EYEbWsxL{V$1*pi%a_rzi=$ zfz_8xAejAbui+-~^UL9^Gf82Ad~x4YzPQ`jlDkE_R(4`SZNZ74M{R&3Jf7}D@ygYk zMOM~|;U>}HeuU@Vvfl!5}|e6YFGE&}r+1zhHh@=!9#3byBZ!wv;S0YOoEm(pG(Pn0Kx%}d#_l&@Enu&_EZ`Mo~s+KK6R)Vsk{R^XQrf%!~S#NSc z~v4nn|b1p4nA`Bc>lPBb*&(NLSCX>F$rT%`k@7w?{HZed_#ueFoaRb42G|MVC{M zuJNDpG6dJ`G;DV%JI6o2y2pPx|Ylp@Pw7 zn3JP5gWh)4o?8vRq%TU|o43BpO>}YcHKzbUj}i>?Mj;x4gs87HIp<}sABrx{_zE;X z`+Ku(H{kLVKgUju=BQr$1b^cA{5iFTjLerkA;Yi!e86`3`ZkDYxpRaO#2z zW=QM3v%nclZlHDBNHm>nFrkqEmAK4H(+ISL{e>SQX6O`^{PnMH<_Jp1JzAFfV}R{R zEEX@{=8;bQ%I@N33mfO}z3wF}YEkE`6=M^deGs213YgK*^O&<%*`*Ej5}4jJ7rl@Kd*4buDXfH z)3I^3Z$=YV-U`I7qS@so9E-y`!fj1?+Ffdrl0%1 z?slK=o`fAQNP@%6)XySK2m2^qvon%Ye+c>T;c?{0PSMDkx~qoVy~9d?9^s@yNM3gn%bnTi z0L$LZ=i&n`48-n^-|t5cb}9+1%%RNWm0t*WGy;$Ai^b&ucaZT?5c34>uGFpPHeb*6 zo8sNO2_ZkbteDN9gI8B^vpK2T@Vr}N)n^7ELZ$m8&FK4)riU$|>4#wS~K7;vZo% z+O4Gp;pr~%`%7?h0GzX=OmSP{y_khbpi;vaRccg0|LcwM0UJvWkH4C=Szg}FU`?+~ z4{KrYKVZ=oqXtO7VbMvf7}^8klS&metJqNvgr0G?xWyY*t)*6pQW)ixuy0FUX^na= z{nh_Q2CV%~2|D4_=CGOE&Tt=HX4NDNVT@K<;{IklVJ1+-w-rGB6RR12Bf9LwIBg44#6_Uk#un0Coysf+qM`46om;77{3%0Q z#f}>!)VSq?C=yHCx6+nJTy)%w4kd_rEB=rm#~;;Mj!~nMp+yPFql&o$nY0a4^Wr;> z=H+6A`waaAa$E&51&BA9T)}B6Kjys2?{mM2%qd_SwHbv8kVLnc zpe><&3J;f&R6X4_oFZ{FW27W*uZF>_tmjCXL8Sv^`Xt_rCU>4NXI@lz(Sg<-=SBQ2 z@zdr#ji%(_FO(*sz!O?Qlh$PV(VX;S2gfa^z^FEG9#V<0o}G z`P%W(p$E5b62k3c%|nGucOZ$9xzt>pIwu+fTHwydR-Z5A5w-N`lG51gGpe{yOoueI zOm&^6Yz*k`^rACJCJ}cH9@PwEQ`Rz|+P1LS#g=kfX96{0W8zw{tr`;N5}!gERSoim zLG}`(y?q99JUw}hTja-8iX-rujVCfm*#$W?f!gkeQf@OQRlaNjlZo+FNq_xgv)}$| zm?yPirP0ag??7Zjf0j0rin%v7sE2xgdbS$aWrXcNP|p1XHC%5=`hnfBxRUgD8AjAY zJK0-n1levk`R%%kL9CIW8@)uQBwkue{xB@IVP(*kiH#gpyV+8t+Ly7IqO=$o;N%Y zNR!_z)4%uxQAJnv7cWM_lXjlAe1c<#>K`F7co8h$_y_^SpAX}OncQ-V^p8!i$_tV% zbO7>6S)eG>7o=`=98{yi>wG){=fJQPWVGTT;|xMHP3O}o-PwGKPlW=Gmz3$l&W!Va z1*>4h@oh>X*5)FWpZV6RXP%LyCAoDsZ*v2o6<%DZxDE>i4C^M(A`u%}n3tJw&abI< z(Wb2nsP?^Jy!JFw;LeX$5rVLlLg82dcSKu?kyHlTv>SjK zY0^O%><+xV)DKx#A{h$x<`qPNiM(=9qn3=?M^C$T^O;#{S4?55%b_n5`S!5$vSAya zS#@M$0fC~;3zF(x8GYh1y#o-3(Rwy}!>(s|p)F*wBR(nsT_m~{*jG>1kPCf4XG8g9 z81I#(wQ?{tSJXV5i>m(F%p)PlOa;TZ;)g=V_hf;HsKk87AQ2G^rJ;n9cdR?-xzD{{ zd+Ok!wLxI(K}9*5)tOr71cOme!sdb-W-!NT-`{BYs&6&3py$|iSJ8&ucRh?SYn(^OD3=?CKk)J1cwsy zvV(bgyTQUph9`v_b@|q7Sobv2@fA_|sI$1$flmGA@$MxcVh=Q%Hwjur4(s)ZUzN%T zb6)BLbtnk5xJ)@3_AcB$LumeK&aDejgbYoLb>K3Sry9Oa$J)dak#3<~_2m5o2kSkF z#h}2i1w>Wqboh{=&io)=vv8y?4Qq716NWm{TZYj{`_{loR08yIyzTm7Tn24hUC%l= z4q`j2sQIoy!UmUrfWrD0R^XSuoVz$0WpT51ZbKydMS6tYVc4IwH;%^sPr+*9Wez_;#qO9*E97Qq;i||r_sEaRXI=h&L0}{sq zse6sz9>p~kJZqDzA(4M#m7_MNFQ=u{|4SEUB(4GAlZ;@&MQK7C(ufj_5{dWugJG*O zoVBv5k|Qz)={Yk?9(5W!w(g79Uy~cigB5;Iv}CFMRMgekFuFLM#ZQ0CME{v4X56J?Cr|w|?lw@8tN=%8B&x%uT)4ATt21H&4cqwYTH<6KC zcFbFSI_bF;1#Q7y@}Q#1=>`)(6&{IqN0?qEBD5q9j;4dtneh@XydZd5Rdu={k$n>N zLu8Y}mija3a+{jpW@3e}8xyZ~n(4mSHP&su|3tNITvfY*qfIU68+np)hRkM=2ziLrTLqt=ox{VC zOlDaqUZm^;&7)YjhZs9{{p$EP`*=r-D-kt*rXRjpmzDNa6j3$f?)B-=R;-1vs#4n^ z+&W`K$mowP9YA{g`w%aW@1rlQtYwFrtKFaOmId*wG}_R{PQc{8+n*WfdjcyC_Y;75 zQv-R8iLQ-au*V-C@Ix?5m>Wp>b(i=BP#z4&nTgm282ry@e`qGshX~&WkhG;;E-ue# zzV#2oI;+R5XFwABtSFt=6w{o+n6u2;|B*SvH zC`@-{wqFn#s%JP$%JziJX3>dC(#d>DgFc<@k&>5^CdzBfI#fcJgvzQvlRo^?EiC9< zL!xK+bi;ljxj)GxnpEPa1qQ;aCbS=i;4W2LSR{5AF(tt$bS)FHy0YX(jyVD?Tql%a zg%=lyuvjXDF#qio@W1v2&% zFuzLZ&_UAw5&8pot&F{Jx;)cQ$@I)8@ix1WQ1DG9dJJTiM*RAP8rZbGH>xk>nBtW zygqNvZ#?}2uSv1Af8@2NggDLCvfg|ITeWCT->!nR6}aSegSTyp#>L2YS}$bHf}3S8 zIYN_LwSweYaFgyzS&|Gx{yzYMKz+Yjgg&9=l2GjH(t05U794bHo;c^0Ff;PDVcWJr z%W`7o7EMt3qKs8L7h9;IIwo=MxxXV1tXd+(-)^RC7;=&=;X z@zJ|s%K_Qmu;mA~#{;}=-ds~?}-mxF=D94WD_-HA&t*n#MXtnHR1;B&#w5{Fjr8R0^ zmJJ)E6dYy8aqKRV^=5phHD&VpS}eXX4fRHt(-50mr0PgwP3nS8i6tEoMPl#p7{b3! zV#}IF$9f|-DBL_baj#_udOW4n#b?eGNiFSco1^|REo*vm z%&bZ>>>8q|hmr1u8km-N&dvOgbQ#`0ZJae;racP%B6$G=BPAW z2cIqSbNOhs*bjLr)JsA$yYlMK3bktJAph;#w;|`G9z$em=Hsu85#wj5jW)A)Ij;bv zzV7q+TMK#Y1`3ap!05`cPP^<3g-$Y>3TU|nfa%~&ArNOIO%5;)l;Z=+;@Kj8J^Hn2 z;cdy9|D94y$1JMuv?NRQ&@zD)PQNcu!RcI(9hGT;HhC*4p1DQ-bd3B@m{ z=(u2JgE5*K5;FL7wn_D(@!uGhMieNJ(|Pw}sLfT-fctroYG74+ zeOzmEL=HkGw1ikon)L~0KL)qYKwvL=BQ*fRv@GM$07`U-*ncU`oQVkPw0PCFbWt2m zni5Xj+8C6hjMv)>kYd>hvev~AMq%vqOC4T#mExysOZXy^ID)3$cWDUgST33rnstpJ z`R{8{J{!zzAm#VpLwkX*yvIxQgj&U}!H_f40jjwlK{3?;Kv{}JtF^Pwd%h4&CF?@# zDEYZmbJeTp)z9XiugdGSd$Wi@(zy&2!AcG0RE+)C&K73E^Z7(61;=qTFi{zhl`}_G zTjR}@&W6KztIP>A zd-Q+`a2%!+(Zpb7B+e~iSJ>w2q5?g3*K(TeII#&#IM>L3pM!{SNbwRk14xjgK#H21 zQ5mWhfTt-TV*}^`WF2Do(F`xr+rcQcj_qIuQZj(a} z(u=~`Vw#Vfb3@QMb8prZ?t2@kiSx$ z9W91^Drq#}QYXC&g=u0BCK4G+eav0>+k?@JwaUyWF+mYyb2ZU*PA&&_No6eUyaFln z`^@55U4dZq_VgymHuqH-^d{uAI;?k)jG<|jnxuujRYb#U=@N&`U-#*(C@w|BQFqjL zW{Y!mvhB`Xj$ZbAIyXMU+0ywE41Deuxfat}sMg!t8-D!wvCw_=r~wQ`))-_sx_MT| z@;V*%oDzE#=^aZ4eW6VQkhw6?ELa`tW#uo#{9gsE#f>5nRctn}DA7F=1Ji1mWn`@Q z#H#$a|Nh_c_VzXalYQSCK$$_y>@pge%ic7${<~@&RTcZYu~p1A{~Wt*{7P`w#qX}V zJ5|*dJ1M?#kcBPZTskK=jT;QWTMtoly@dglnp!J1vv`_#b$7L(y0%cqV!Sjhq@sjU zWNc$#eZbJd01c@09IKk9Zl$48c9fD)at2GWx)m8~qGYCFX6yG=VFv*QJk)!RIlEC8 zhT6}F$d31TH_)PofR&*_DAwu-85uPC3VL~l&dXh-{wb!FUO5G8*@4Ckk+~%{*FFx1v^3fpS*+-NB{b~ZEepaXC!I7R zH8<&`F-Lf{6Ff<~k2F-l0sB~Xj3KaS#7LOuy_*KSPD zH<*OW6xxuVfWLNU+8~zJHNctkUq%KXT267HgPKO|!BLJOD~Ki?3MO{vq@R!)WH##LIB3&4nBc)8&~+_x0Z?l85?V`()p@BU zjFmvP0)-iruEeUVa}|Nc3{EO2sLW<%V<`z(1gW}!LP^Egk5Pj)cOb6eZV_Bma8orf z^}j13BG%AK@f2ITyf*u0d4;;H`L*ytZ za+oc;93Ey_f(==^StNi^@%1nzg*dTbFcOxc0p22KbzWArbxmT0;)cf2`L%FRMl zoi~*_&#AK>T$5ZU=t4bW4P41ChAHo z3$-sKjhYXNY|tWSq7e<@Gqq04WaS$T$*0x3PfFLD(eRpch}!7P&`~iT7CRl-9C}HT zD=au_)=yM-jnqk?PK17=Bx3C42xTx`_RooKto|9vmGd=yS5F&qT}FWE;5l0Lsj1Do zT5brevoN_5UxvjmIiq4XnFjPk-4I|M#k*j?y<^=m&SjAvt&NlZXG}CbqXJsAk_eR9 z_`61T_aL#k)9s*TxIm1J!;9g3l1ypLbh(Ph zH=P2vGRG)Ro?{W{qI|jz7(82odoLagMgv&_l=}Q_+lJmeE0O99I+$!TW=G+lQw+= zvqc_|RM(6Sa)Sz-YWYMxBV|}*mD_yX{^#LsR_ZIg#~bx*mIhMDTBO(TIAaW^zHo9t z^)P)3Tk}RsB_G?%D5$L&;^nI1ZDQWv-%%9U@U&!F5$J9?CnX2 zAZ5*ZG(~c)3A;^;i69;*W_lI{sy&)CD6pd_LX9D# zpMi)@IV=4qyl_4(diI>kJ<+qXcK0-WPY{>Zz&;V_!FoPPn?TI#)fz;LdhV?(6WcKN z;Tgfe+F8{TL*sR&lQ22}F^Vk{=p>wsS`=NB0p_r1BG?w?QBccM@0igMRI?XG@P?^r9tPmM1}7Z^b&yhB2~E68dI?a7 z$V%#}C)R8QMCQDcCR)D`)Y23nX~2|*CT&A@Qc9qyG_&eJyls!h+{|T}lv0bNsQ=xB zum1N+s5^wqh1V@*4{J{bAV~Z)?F4PUI3A{b5It}3d;?Wm1Be{$PiykZ7{c6)ok-q@ z?+95XF{j0uM&WwtJqfY=OElC6@gBv_Q&%5B$Ks_1|reCzuPQM$Y@^OUXjr5~tR~$gI(B zc}kwaq-x#1*>pVQO%$~h2+R#7a-hgD=pcI_Ucym~h01xefH*d$##o-CeSdi+T!oid z$OW&lMtEB2LJgBs@>D%)p;j%6W1@aJw8lAslc6jkUWYsjTt^0knm(d0d{$b=-1$zR9ReI2A+2}c35 z`qt|zdHCBg)!6H`eR#*!xtp#=^_%Fjykq4cUA7GPlsgEaZi6Q2>P24soYWg$p7Ku4 zAcQ8J=n6%gQgZRv#@EEI=ka_#Tlrzd*u=7ihEmK>COKt}^qs9D29?oJD#eA{hyKC` zxdJD{pTH_ckQz%kQAbii#L2ZYu@NHr=`qa?ovI-*AYX>x0~XR&%Q+o9@R9+kf7cDn z9C5#L{6s*s@9*8=m+XE%R6y#CiZ7x$KaueC>q8m?QqO5UPbobhVmTg_fl(FjCo?vd zB4#9dI6x^am@<|ws&0h`R@9rZwhqZ5B^DNAkr{Vp`>@vd+hzBD94Wd<0l@^Z+MgMcs#$gWL$A3iW+0(z`?;o%Mhak z&WuDE0s%u%Ujl}HfjiS12Bv-RebYU4AnTc~M}%+$X<_VIY&=g;>`cr=%>+Lopr zuXMUoJ#srdfmsK!ZBLk8bv?#XOgo0&>6ZaZJTFYVY$`YhwZ%ZTIizjnoY5&U_gub; zWoPZePpV}ZIdvb7Zk>9JkH=%^yA!ibDoeCGqq6V&vXm4*R|AgfLQnBPF>!Y$nWLuZ z73u;9hPWfk5QRh!;Vy4G@H%#bkd;&a3NydjwLc1Ep^rv*JKD! zNX|W7AT3T=M5auUDM=yNFPI30qW;0{Z**=ePu|cf?w*#DZ!C*lfS3rK_(Vz9P73o{ zKZ3$m-kC}+HN33%-m>G_w%ihh2X_tiMSKP>HHd9+CgB|ER>5Lp1kR9a5@B}GsnEfx z!__Jr*c5I*mma4-1l!Tj)1`&KkwV3QV)1fJ-QB-t7(#br!V6|%(FOT}Em=jH)KY;e zrpA)M9BS6VNcfx=*5aW=x5#5zI!kn=Ptjkam|SF<-N`otqS2L+FvsI#W=QDVNje6v zopl|bf&Uq+bV^_9oH?az&(~UGNZKyHYsgf!<%7)Ux&GPreVKF8N;E+`7lFpg%``J0 zA~H1iYpl&w;;+XsgR5BfsrOwi|HRTyWKm+tN>!0O%&ab&dhGsf2{>(SlOWE9SGj^^ zi%LqH%pn>GP+a_Y8xTZ^xQp*-!DfcAK-Wx*vy;5TtBs9`XEity%k#)2yM;!?1 zB4eb3D-j)RnOEI>iRjY`&76Uv3ra~BtbxwX8d~cS=G}g8_=%-0X=#$C$tm_CA$CqB zUFlRttL!ymc|0EY`1m--^Pe(5WOVzeq6fX|5{QV#v|sJoG*v6Y(v_a(+*N!y$CYso z!qr%kS$+Su(0WOG0yV2r3V_B=#L`bK(Wt70dI6U)_g5gLT_0sksV${o+qP5o)o~o{ zvsLzF2C>_=HP8}Y?>LSH^P{cgT3scawzl@D_`)ouX(Le+%9$H;F^X2J{g}cfVTOuC zY#BCguWh;|?La^vF6OKa|17z+0u{8B+HoU9Z2Rz>EQOuD4GS|vzyNcLTaX%SPv%zA zA}Al0+A75asZvbvE9F3u-C3QzcdxHbO>z^18(vB|TIs5Gwg36&??{}nr%W%dP)sR&&cN6t% zD2ok3bRkmXlern6HaZzIszjb^Q z3LXwXkhlfG_4Gz|cT)02T&!1shR(qLeBy4Cy-uJ-2xp5s$g02^sqHS5HLm8euHDil zX}N6BRA$p45R8xE)><+2kO=T0aaFL(;C>;{;Nt3&Px6a>geK$wBzDU=m6Jll#;<^s z#-v<;6e2<*%V4SBZ}xP~5@=nb{_{i16dE^mYHo`=hJ;jUwP`bF^tkO+_?n(d4-wOT zrtes>D6}jA=@KX?u6x#;92tZcQS>i5+auA^W!x+Yu4TlScH*Knwpp~PJ^ zO37IcJ=?;oHJI~ghp(Fw1=#z*MOPKIL~ZsGkoacMKv8ndi8k@AMOv_fkj%!MB=56h zz{J|BfSlE@F%AbHdH}n1G?v4|;+(D4QXu8S0_)_%Y`!i;HSsMs0KzFF=f~Kf)%7Y$ z*88f*=iB`K#5bgzyCJ}{ol0$fNIfIPHmgrOo=<1186O`%@KIBLoo!=g6sbTiZl1cM zN97pUu;h#rS!;y{QexL-RDbu{BUtIn%nT$n`hS&8QWvn4vLjvg3X60G13me)_JtTq zDM8@W;D^@T{p3BLN-tE)OU*{+;3#qJvu!8)SU3zS{idNeOibe(0x@E5;<2;r;C`6F zT8);{3RYtIWYY>hETNvgJGg&X}3fg4z7FYdI<9M+29&m7aE&BqX1f>Ki-u+z_5P}qf90ENGARc|72Sj)5|Ed$aD=_|_J* zegCjF00^ybTxv0p6g8)&=17T}&NNgHa;lV13-_@Pa!M7ffWf~QCUf|-#JB~+P#5!* zvgMPw9k~=~We9{DzLq7TOQ+^-^odm4$(Eo2I58ZaUy>3Hw6aZ>$$J?vH1(ZSwXJIl zKe7uY3U_t7krA{F{~vYlwj4>4WQiSBGmk)KRbQrimNWZ6Qux6CApNs5hlXAz zc~O^zD0YZ>?yh-fcIZ-K_1(YkVN2Xpx+Ib7wBvHJ3Rh29mA$QcmK++FB&M2ddn?;O zSu>0a5zwh@_V_Jf=gi}x&>cw%m#Th2Ht7e(Z@wSzS!6VU6sFnX^JFOXo&;rG`{{Zt zfOn)Cdde4}#fm&xw>2>B3Y?tu9LpH>y6}$DSmZo9%IBJ%5Xj8vxYn;sx61iFnasy^ zoA{Lu=6aYpcW%>$uh6I8N2l%9!mecICBJVugXlu4 zV-jm-R**oAft0prRF-U*Ck1~;0Mb&uN&d)S^a`Y8VQqfi@touL24HEeSr?D*zRe9H zX1a)thNlm+ckqa($2RfMI4a<>IZ(lfj$lL`3XM_F%6O$r8KO&8&^CRsfmO2$GlS~g z{Fx#k_Tv%PCb?6Et1sA=ic3n+mYhXm=Ry}-YmF^=K-57x7gXBj^Bx5CEI>8SvjG(v z<4PW>;^9W>`;PDZFL=CtLvIEwzJC23w(VuCc>!$186@>lj&vK-)Ots$8}9T4Oa;I% zXxS#tZ2f(%^;wHl4t|zIR}`+xfjPQQ3}67Xg(ihi zx9Z?Rlhy$Xx;siznGgZ8lBD|fAP}I>kmVNm90m}(iM3TRt^V_hmvtA z>y4VHuRHSup{*g`y+=j@Qljnz5HU)6?%+AK@E$ZWW2AD>2IOPFhjm|lCK|xTgljW_ zQM@)_jCLYw*#SWBdIAiTXwu0>BoOEG+xYwlIj2u^0_(2(teyskR-@@kR&_@F7J+Y-uVvtluzXSk;G}S%&g$?MtsnU z&|$Zkh3&`U!mF`T?gf&ON{mab%rR$$na`}%>Gkn-*VzWRLmg$t86KCbA$kYe?>c4VW?X8K`8ylR-}| z_&Zvcv&H$!xsx?0`MCrL%?-`*?;)g3x)f%{&%gUKdT)3khu1u&+Zr4 zIA1+ETt(1f+6>|1JvF`vGFz?+uflY8!HDY28&cK*7}P-yg?5cx*QO@!+&IQ>o_9NR zab!TLZct*2nSXSMyrDn#VZn}4L`%JG5I9=_HFpaDE$&X`l2}LArG%L!UBPjTSS{{; z0%{vgi8R2qM!)>>-#vUz@zc+Y+wEn>HuUB(6n$uaL@Z6V_l8pMCZ;U~+wDFaj`+FTpcKQP7BAFNWds*jFbhg zKqW>eb+yRZpi9e=;x}HbKp|&=T(Uh+I!u@>mLDhm#RNG>oiO3x;o|H<>*I5of)B={ z)QEL|SSE`aa8n0>QEo@D>;qLhNw3BM0-P+WG-9N6ag0R6bIuOYi?L890w`;29GsX1 z%_5&$pIIanrI4!2s0Sy&cOL8HKAP<68Mz>O82u1|KQN^n^A(;mD@Spx9(A(Iu~@Vy zbnzH+2zg6U0oR~Om&wiPjrhdq?erZdP(X{AHIL1XI+Uvnmvfd&2L7=@(gRz9MTc@^ zYUH9lcs?c{XriO$A^{ZrSi^G!hhe!N?+t}OlmcD4PmW{=`pz4oVcXkplm6o#Xe&U&*-K> znyVjz*=QsKu1&*pVOhnj>g9WvBOX5Y4y{3OYaD)1?4(I3OSF7Fr>MkDp!aDTr0%Vp zqI0wpNvkl>ns4o#+!FLeJSZvPjR+80*%nYv=cR>GNf9izRFvYQWQ(GYMB|YO0UZvs zE_%|{Tp3n|_T$>3|ez-mZN+GDWWH!M*3b6 zBP9@obQaNJRHchIZ$6*ynk;k9h|FW;W`9rHGH}V$jFqF&K+rRy&@bH#SsP;13osM2l|J8raS~ z==%z&7?A1v5M~k=)OrKlIy~Cvi7iFq-ZuM2DTE@$W8j+$VF9jD(B}!TvB~d> zzVDFsfb6?h%D9$I%(~m9IRJ5op{M(rGsyxojj_`KUPoNd_`jg{2ZXuY`y;mdS9AH+4cgT8r)|XH$8l=y&DZ1&+jbl0Nw8mI zEpTm+D6MY1Fl!J)nt{(c=?PC$jE_N1iocLL1g__sjH3GsXPSwx3*}8VPbn5-ho=dwLp76WRuXivBW3`(p?GOJrKrQkHhsI`BzSw%p(WJjJYRTYXs69#*YULP@=sLK*O8c z_@Gv{7`hd=bq}g8ZSdy=|J;!~iq-;r_^ehPNNHMFCm1=TIgUP}vMh2pwsBN2B>z zb2w#j(P7cn#avE4(!>w~nrYB&yGt|h0qlq##yom(b|5WWtA$k)6O-KtSY&q3^eOMK zD5QX11i;C06h+JbkB+3=;!Q-S=cPg?@$IrHb1g(L9ho5sR^+(Y=T064PWIo-$izsc z_l{aC_I+Q1)I#Gom^Y==rFM00608Va5F}9dJ|gXr_hS0RSSw5{S;n!L=K|qxfBAPG z8{Ev=$^|c9zd8%_Kx-RXzvJ=t%@^42$I$2SUZ)}2?CZVFk&D_o(7E`|zYa0Kia?2% zkzr_uB0-yqPX)?`$^{KT3y&ljP%$%0hqMOScXQ^505Qf;OJMD4;~ZbTK~()QA~(#0 zvjrQt+`&{QYdGGA4%OX5?Yilg3asc)8gjRbXaixh^%#s&H`KCOKwGzS;BSBZ4;$gA z;LGn6U%&nyR4TSw(Dog&tM{|XxHn_BF?-dHQg7g`qRI<|6tX|8$7f77*xk7EF^sHc z>sYKe^u9YliQP`B=B0F#irD*@N#@bEQlW5QtDy#=*$`Pp*QxYba`2?_O&s6ouyD5Mc=Lcizfz{VDekQlRyRzim8r97 z)E7{i<&RzE(X5+tb4Ch^rUh?|gy;-XkXVAGH;Mint5cwnL1JZ+W!$h^>#OYG0+Ad) zbp#}aozkiCTz@jyz#~hfXJ&=V!9FhW*t(8< z{M^YpflJZuxNp)(AI&Vx06HR=OD&X>s;~h zUIu7C^i#>%COx0is!xg6vOgXmdVuH^I~#k#wSbth-72w7 zXr`5Mk>->ql(~yIL5Ie)xvAKZZ7l0BCdeP1V6AW5bI{1Qbvo-DFle?me1| zPN|>(sCBE)o4uA3%&obF04^TXMdO+ri%&Nnb1iig&(SfI-D#mx%p+Y4nV3SGbhHnv z_(kq{2U%Tyq`5~hTrTLN?07L(hjh2USvb8vIYMsfX#yaP?%pV~ZYBD(&HJkzp#?j@c8iatp&S==Z~aNXLgb4*6f`6O9* znjGktBcmfgIcsLtak7XG>->8To{t?q9~>fmKQVW4cqDhvQB-<5(-uoLPLFeBLoz_g zHsj1PWzEMiS7aH3I%|@}v{(H(L#!H!%g(YKN77fin5*oUImS8%!i69<1E%DO_m?lIzThd;L~i%U3N%&Lzm_uWYhT* z8&sz0a4cRRD=}hH^(0sZx&^Fh?~o=S(GmEj&WeG_fdtRIt5KVgw#by&Y6q}0Y9EJl zZl=D5k8}c)(AdO-dB2eM+;;13odRY>?=}|u+h6}3O&WS@&_DbM_m`is-Csr%H+yFh%dE{0Ull6bOoEUC+1rZ`xDH^?WnytrN8vw6kZS{p`cbC38%A6kY>nRE#_k3 zh(xvsUTJM97aVLsEU0Yt(4*MVscB0VoE!p!0R{wKm`G+drU+Sq0hSVFgv!s|2&5@= zYDGgc0|n?U1Gmtl@X+mrh*+KRfipJ@-idd5d9@&Mp8L(XJqY4pM#O{Wpn zQ>NtdIi4#GV%Hms$CdSZ{X3mN#Ts{it)Usmjsx_jJfw6%POCa4vFtqicacK^G%w#j zQsYZ1{gdbfIxyA#{KBrAg{lEMVu8=O8yW26P&WX0d3jl!IPw3`sO%p47E$(=jYLlY z;Cq7LQ*6Zr`;${^i3orD>;DVpg1X&M%FO_RxF&;k^!{+5aziZ}O8H_zl5Iz8Z|L0| zCNf6*DJ2%R0Rs_OHgDjyLcPuplzKz027m%g+=@>Th@igc$9+~iQWU*d3U4I8y2hkS zOW7r5xY@>tmU3IX`shSPv28cduIPo(+U^O)4iI@qsoh3&rGU1ZiAHuwN!>Cw zoYhhw)TbcN zErtVt1pUW^t~|>QM}bs~xOmK|nXVNm@%<;;YJgoYmh!pBr1uzTO_s=ejou&F>tg`B zO4JhBF;0>1s=&6D@my-HX30+D7Qzf)i_y{y&b!jq97_QcNFgkd`Q#1C&2OT?@a^e2 z)LQ&z-A}YW`6{AkkM`$AJ?{b=ieh8vuxDctFYD(qz-{M7= z&-whOivT_>uQNZNJeC@NXV+^$v2ne08Re3_)m1S82z%z#GhuB6wPn`iXcOkdYJ`Bc z_gLuGG3Z*sF!v;rInJ6bz0mC>`##zDgGZ4@dPIX|O2sC(XsI4d2QEpDzrj@e%s2ixHD=q2J&#wiY{ zov|qFE+0ES%=UVUPZOB8@TQ`*SN!cS|7IC8ZO6~Q`zPFAej3)|?RJO0DVW914|jZu zvQGj$uZArX4X`9z?fuY$Hp@d}xvNOXe7kMfiY4vE&HpMXmeYk;Y5~j4BZ*!1Ql!TW zrUX)aGDPVlskZ_Vb-}99P{cgs^W^Qwiy9b~)EAAtqILrHwC$qgCW`0IkzY`F1ko7E zPBdV;_pm3+vK9yfkZiM_yX;6UjY32wx@d0Cz~steJa7DZ>QbIA9XiCtlNT?RBwowQ zkb*|>TCibUXoNY9C~8j>?h@Tc#dR$*M9MLmQCFB7&Xi?HkzvECpGhl#iiKqn#+VII zx4F+8hSu6(vLZUU_dWxY67GHuQs}aG=B)0(hl1I#l*dEzNlTIdlU^_i^a1nn(db6= z8SugP{veC8>}r=C-T4?@*>*3%5GUY~#$~yi=eP*3yYsN9+8~nXcI`K$az9M2zYUzGdhHfN-C-H56nNaV%zsj9b-(;LX2_x|_=fBWlyVBg=++5^A;!$0He zPk;0X|BBoF%XkfKSdd*L{CGtvCdA!tH*kxF`N!1Z=wv;o4O&t2%}BeVQO8TED4XdN zdKau4i&dm1-NdY=SY)pzJwf3qq_PtS1IWZ~ecT7b4%}sw7pmw4JSjmo07-c3xmt{F zERb8Rm!qBun8M=gizM60NeI`99#jEdc2@+fSaLt||4HYOO?AY0`E~bJk?4$g_01S{rq+XU%~~@f+#hnlDsz2#CYd*`pVUw7_RvJr{!6 zixr+6m6S1EzY@njVQ;QRKku?Aa~$-p7Uh#H4jnt2P79@t8uUox#r@9tgHFVvAJ>q0elEOUfYoEno6ul=(0|zjh_5I zT7`o;ZO~UeHA`8gk4JJ#vZT_%03xAdIgY%tMLGU#wa!cue~c(@%+DcbqC9I%J~Acm zjfLXztl%&7FWmr!1CiF=oLR9C;(}64H_`cFB1``oJNsgmYO_{L-)+Gc_gY#)9~dyf zC{-|-PEuhp3%!|@xDcc5%><$1c-0eDyL9aB4PAC?PDZ#U*YR+yBJ+AM<|E7(c8_K# zt2G0wx|mu<)WRSOz{v+64Z)M?rh{#7IA_5AItl89gT34TxfpY8!0Lv&Dcb%W-@pA8 z(z}n*cKr0yA8`Njv%Lo|U(7;G-z`@~noUDOEG~jljj7t|&ED_kQU2%BF`JzH@Bi!n z`F{;+uh;>K6T7;tXvEJViK>#oWoS-PzJ8>ojvZ1YvxYi3Ew0&7TwGf+E*721tI>MM z@%h9^j6yNjtjx?5In~BXsOcumnH|C!I{jBIJf23o2y2heUWa@8tBvgA^H0K=NQQL?BjT@Ff-oX-cG;w>fbnlU%Gssu0r_Y&$nOx4a}Qm zpODp^NZ--gtM$G3C?t|p2iu?_1dWf5oc|Q}KfrTF+@V*(Oi>x0cZt9s<3nI$jIK_y zSoD7D4ZXi%Z*LHEZ|3E}Sg5lxXI)ijNn{yqgh?Po!co-9agrTgmwUG6dBS|qhVpQT z`M}5=S*DY~H;c3B z+OafQ)91jVCHGE@akB{ZnEaam4FG$xCto>)u0*aG5alt{vyis@`j4Q=94Y>qi^tpd zhsoDW(-CBN(G6cQvpfy7UdqQ zZXZ7vKXx6xKivHzgUJk?#~}DcAndM054a0+gi1$&X-#UqLt|8>g8lJ|zy9Ul2B^99 zuae*`KKuXwqmc;Ut68&8V6L7KHP*pr0J4!9sxBz#?-uj`r zcD?!aZq6LQG$kW|1*zl4z2B_sy*YNhDi|F-)~e}tST;*=WS@-jNq~+h;qw)+Yy}*< z?p$T3YJp{;$0;_83l?SUatwQEOLO_|C16r6Nck-mW<*;b7Trvt4ZY8H3 z=~6L}qWPIA)wJs}k%-h)2~CeG>gG3;CYJxAYBziWT1##zKkiwJ!9?I~v)x&1m?oVB z6KI*~%osPCRDR`RRp~xX+o}bv?X4NbS;}Z3j%fSih~dfybJU}JX8ds$%+eVw5HIKb zV&P6jiI;*8y4Irn3UkdT#j=Oc!K53?j*h`_{MuO&o`&fzBJJbCx`LOKr1PYKc>-LW zo2LsK@Kv(yrON-4Be3)1&uom9af@r87j&k=1ISkEzmMKj}> zMnJe=WOB;v0!WZjwvYDlgDY-af38UzQi)M$YWLUxlZ%T^M@E_b-S4fX&NNbE;G?Ct zc`W}Ams7*j^1{2?7-F`8#Qht_F_-#EWDlCNC%qiz;sRX>e}gwT|2g|;I>tduWct9 zJ;pX7;*<|1s#s5qLn+0_X0ims#V)IO{5_)pMSY&dv*Cu;Ws0N6N5qp~8C;{7ke2YX zc>GZk74i4}EGrjpYNqAljObzsVVzgbkHE7S`^3e`7lVkzT3qeg>>cMNGs6Hw8T7C; z@v)JQY7qT7Gqb`{VR_iB*)O;ujP?2I<_hb*^+83)3l>rFUoW;Js{&g?A;0rBHe*UuxfZv_P*;qqPtWy5>3ACr*dBw0~?MjZQzY2j1 z4T_!^$5rHf1yqi?Fd>&wN7v#p>C1b4a04ADi@`dmns!2Dv&B@J+gqFI*rcP@&4a=! zig(mlhLZpujbB`UVRmA3)O09VOmottVebvv6%aCam6(mMwFmb0edskxz57U~&Mcq- zE-01b>DcTjQlTEPWq`52=K_GN7?I27nPUVNiY3QQ3icu0Hg=?QG|t4(QVe9EB@1%a z3(k=X)Tac}K+1k>Ei}X8UCHnBJn~su+wuDPi?cfhHeOzS0y>;Uv2T0;mZYl!IEyE0 z?3W#`8+KJIucb21uX;>djO>59@HXsw$5!o4xZjH_qIF4%&9=P)0#{#XyCjGl{XEv; zLx-G`P=b#b`Vh3Fat?y?CdQ1MQONG#N}aG%B^PQg&I;>O+^YN;T` zNQSlDoB8}7t@+Q4ApgaFily`9p!9IiqQhgaBWGpRC+KNZxh`l}iYWDv=|YET54}H) zIk708!bu;}8ngiZd~D=M`|FQ@kMr+(H{kX&luIgo)(gNwpm&?6Q{#nSdq>eP9h#^0 zT}Fg*^4;W;5V?mv?$iA37zAd~5- zBb-3KQlt~JmFWoAvt=j!jToOBkPl*B=Sr`&8zu4!39Fnu+@s&wwVvS_tVH{To~QQ z2O}w#=E%jxcwCC*pgGXUWq%OUlY~x0Q@nljgVe2#sNF!QW)(Bb%~lz`xlIdLM20j( zsdM~ddJHE=dY_9=IB<&1rX{Mo)%@dy?BiD0L+2D*nZaMNTaArV*XyFd?#-Dkc8m&i zkb!q1G>?l1V~lr*W@ud8qO9%NlwP?JIG6bG&He83Fop;dFfylK(y!J403ZNKL_t(t zAIAu979}bO#3qPt&1=YY?HbB@5GHF&?&?kgHZa(=Tab@af8DcOlqT3X-JlaQ!n!)D zKxWt!x=v@kjF`V{?|ZHSS-{1z@E#!3r+4I611r5m2l;j8P(@84PoeAiAHjxvH0Jp= zW36Weg}4}Zth?|d$hmF?^&E=nYFPXsH?pqmjBITqgO1X{2s!-@L${ZDO_pe(HEJMt{WBlg@D zt~1jkF)0)be*l%#x~*XurVbGrY>LHT2#Ac?AgY6{i1o@I$3{%j8`Ks&DElOVH*Dd| zZ2*EmeZSuiW4hdf#Yt4Frk9c3z+bbX!{UriDVqU9SUyVsz?F!D|{s#6{n)sC8yE-w7Eoi9_W81%zFI z21fUh$^(i98ga_x+L*A&nG1>CHkIz4?%L|zy7-vJ1YmKjVwP;LsaDT1 zz^V|}9U_KF#L#>NLdwA@6cV~{63PnmdIR>c|Jvoe7MMdzO^~qjjzTTxYE$%(Z?mA z(WlG1zUu(`_;r5x+Ua`aGZ$@sAEb3zpTF|*nkLKO*B2RJ$h|ki{+#~)9yrPW7r{xh zQn%YuHE=Dmettai^EonIM}cjvH(#*Y9Etk^YR|8E*jS(EF%^$ZZ~k>#Fnez(#YCmF zy+GL501>+nQy31QK%pq5Mf&%O9ZL*FtK}96r6!3s8(p*(Dui)Qj?7fORdmdfO-RUa;-^UHtr$p z9*nbFk*)sDj-`&$$}$|L=F}Fvy?*zp%8U@WIjGrgcMuUCk5{iFIHwES7;mz4HFmCf zZcQlwYYp648+=6t*cElFDBET}>V0h$4mwIy!D@D-sD_?BKK58lY$>6l!$ur{NSsNT ztd0(j>uFW?uMzS9k2Ra@u_d>wNgz9WbB{JWyX+T?~yG;;hv726R%q1)x!k*<|l+ zL^`WCKnJp))bP{*A&FrJ6T`CtfJuD@nj*pd28l`@s-{`V8Hmq?Z?1gzWZ2tQ$M{eO z<(PV44*N-cHfp$72@7Z$qAkKOzy;OEFfCd|j0cN4rBMRA4KdPXA?HRNI^JZyqEQmiY$NfCK__br6AJ(XxM+O$kC8z9-@qf_;06f#Q%)jdoF&&=;F&}{% z`4CXj#W{0^T5|_YL)dr}%w|{3)d=PYWb!yQyKBrrwf!oM&JieGiJMoTbllquRj8P^DHs!#K1OGySXGXJ9YNb4`2M%Q z09_#a4*9a%1hi9E(nV0i$|e|8G=-ANb1@*gW^uSUu9o6uOEeH@oV;8Zq`{m-`fTV? z?DzJ90XQfHBQdS7FN*Xk+Y)y7X5t$Gx5}`F1~uk{42*RD*j;Y3_psAW-~iJ;c{=OG z4%fdP!q5`B76M*ee7hHdfYAwfgX?Ah+y!U~yorJeqot)iZelU^;E{Q<8&iO2be>|U zXxhy7Nz${BK;uMa25Lp?eN+d)+m)5rC`J|ZT}*#cY{t3o&VqTjg{b1x+M7l_G)OcW zRRem(n~=G+25W^W9$wGrb6odlm8xS0dq~gyw8C{^QPwd}j{X*_2?fo`gocH`@a{l!o86i8f&YV{KUgoxf(4}HYIF!Hecd|YIKtLtk; z&e}+>8lIz>ESjeD18e$g8rFI?#e1yK6%c%OjIM&*)}QaAc~w(+<&r?mxu1qzYiJ>4 zrQW=QrvtKEMvc2f9*^%fj^1uV|iP=&T`kf4c41Q(YrktB6rY` zb)980q7C_j3R9K~Ro_TI2uw82eOrDjA5`_qWORmRZ)gF`;fZA9(@#n3iU! zJDDgp#ofvRrF*n^&`6-+z_oEoWIPlbsK7u~zqmzZC1?VO8AO zK*~$;ur(1pM9}~=C3Ge95OZ~)c@{z(0Ev(@*n-~VyyGe~BeVmc6ejFSs2WMWX1}@< za0AeZ@v4eD0}oMrsf?W&-}h#^4u4VIoj;&xEOoZ2SVzy|44|2BB4TWWf?P!B3vx<{ zRiDR%MKSuBqW6f{f}^wv%I0%Z5wt$l`=SY~4wh!xW@u@}P48g3$x3!TIiQhei$Z2; z4yAaji{QeBPfyG^IIt-CxiQP}CY`e|bmS+zmu5y_`ovV}X|dt;f}-!_zMU=K@99u} zTUI64Gn~deLnQjXYv-69lgB=b*z{r%rcVH|_o@J%g{wWa#k`|AdCshyS&O5a=c5GJ zQ~K)%;O+T)_c`(Mc^oB6*39vm4}G7KZ$#NE0$k(31aK`N+CUH#vI0JV;%$FJAwp3C zP=Ib45B6hY-zVdGq;N_Qp;CnmmU?#p(R}Q3gGzyD^CaBeV)(n|qZF>5Q=+H$`0NIA zv90nb_cLnUK#DOLfQXk6Dl8q=H}cGk-~aJuYfk{YKEoJgSm%ALr`F3NDA5>)sM~_)?ka!?7Hvr^dUY!{ zAFKA_t-FOB&1L_;xcDxXs`Gl^3J??zH=slnUw^h}dCtP>;^RA?XqYavyYsgCxVizjO8QL+M`EuJ z0i0m#eB`*0v*B-V-^T_k?mXM=1i`Xy29vMuE<*68rrIEK0O{HC&Ix5(Trhql? z&f(&t3!V00WltWgsHOO0&fW2ifO{cq6_GOR zleBapGyJ`K$0E^#DheC^;`}mslur$E$Q)#TR)#I zq;$07e!wuC(_a5R_Y{4=pnOJ~`pgM+%t?_Hi$7d`rwkNIJu(-^Xb9uyY-uTSUc~b{ zHe&0~BGnJK4hID1%vKE zZ_)v8zNP>>Dnq0B_2+HY%g~I>CoOa2ucpy7md7AO0RX*WyZ^z6gj^foBQ({Uf5@p zBOcyIMg-ge+)43L7&l@ADIR(MCbr9es5n6JWJZ|wLzVr_0Jx}Iu;31$852L+cYWcF zqNiyGWfZl_fTK_ok)0y;d)a|kfiXC2AQUfbYaD)8S&f0uw;1=NQy_gFvu9zMHt2*)Ie`$ZE)B1t5oIcC_Cn z)UGFCStpgfqSceLh4`>kPS~R3ym%t`ImrL?4Bk7MlM~6|>Q6zsZVrm#xbpjt<#8(d5~962Mh-I8NbtA*Y5iryY*?JXs+ zn$1@sK9E7MYO^CT6t} zlWpu{b0{KcyN#*l;q4%V@OY-Xs^{;-bJIvtM|VcX?|Rz&{I)e)b_;3io+V=0#@Y!v1M-OmN=bg=`HF4()^wpEl`!J?k*s>{tw z#lp$B_+qT7u~s^W3uGXt2Jqf+XTp~P+=+2x z9>C;*nL)A(@PLUt8vt};Du~O-;g~lFj4T!DG)7e;W39M0MH!N2s?m^3Vob_ltP0N% z8#Y#{tDq^N!7jcHiVj2SRV*81D+MnE+$v!cM(2WuDAXM^j}V?w4nyM+^PK1MeyR-t z#cXHxo5WZJ7==xP()W&+uV2vi9c{OfP9bNBR1X4CoWsm$9W7d&U?v&U&2Z)mk8Bhi zWN7-q!usK2e36MUh#gHa`$wq&N6dEOR%D74NflTAn;+sLevs(+?d7x2f5AWEcU{?K z>7r{0!#a8R`jTvY;=M*UOa>@N5$Cg!#(CuNx!3Ri8q! z=4-p4)E{Suo*lbq;~_j1A=4^oC%@{QrpNx*b_#au$@OM9^NHd>j9iY0inje)oqFXb4!+?d|sBt|A_}ELob-n%lA+jP~|_d*(|HK;-3$ zCZ{sRO98{-W9xBFB6fD_tuKrwQvu&9YQ3S<8{SIA+v_(M+3E^V=*cYJs309TTJ{jM zyvPvFSt%K?wBAvjcB|D8Y#-W`G>P+W98R>aMyHPwDo^q3MC#&UFBKqhriJH)=2l@+ z0oMX1)5iS1R%|aD?jpD`a3jKvjG=e~p^4>->ZLcC!)HIm&dMYwiWkoU<^#)?jjWj4!Z(c?1X%DF>w*>#Mwaj-Nx97L5~I$!fRn{ zs`#Z@ny-e_CvMQCjGd0A1zaKxQlfdPcy>y-4j9cx6t~;W5jKy7I>d_{uQkA?Ye>`` zQF<7MEWE~$ztGy2OGg^{J#c~16ZGtxcwx8bVyV^VMwv)u&Y zN!)Qi>8TJi5@6#o>xV$$J@6C^(p(Vj+-0_~&J0jKlY{aZVeKh=@4%+T0vQd#Q9BNdZ!IDUMjDr)6}HaX}s2V|t0nsc+OC&k7BuK}c*Yg4Q&ux>XW zXB71QHcIk{Ohg*FDWOk^-)oj(11c8QRzW2GnkS<*#lw+DI$53H|M8#4v9bxshFb5~ zwlApL9ktfEjwga(-Vh4KbNWjH+8Zvc{A6Ik63ndX&l^R8{HraLJN+53Td_n@3o z+#y8cLNSWTT_Hj7#R2FFDlxW5C|u12gOT~6*ec^i88=n@ycHBBY@XBcO@Y?knFGeI z>MV!tj|;6z_5d4WcO^2)0Y~`VuuWl%cLtd1)B=KkfLlAn<&0@0awO1QAi{Qih#kM??GdnGw1fkfSA^b-9~IT zELF=vF;|s!8TDqh0o%(R`|F#h+1hR<7@4*0R>$x}b0oaX^Gk3Y{Cd))(Av{80oL*C zOh5Z%VH}IkyV-6uW2$vdE0N~<`sDe3w*UA8sVT0*=l(vF^Il(%UOJ0@r4HqjKXV)( zyr)CSEXMdbTJH~Q9D6$NNe@n+A7xMup@r|*liw529-Tl}&BoVy6?#{g`e6>s0nC(A zekhpjBQfzuxiOqJNjQMM(Xo~6b__x-w%KLa0=f&C)-SC3VtqCu4idcZFUnMj3Mz#Y zv3ur@Yb@Moz@^SBH$<%?yD73sEVhH{=E0^m(t!gW4OgU>=ZXk;#J-Ea{t6}=1Box< zE0YpyL>Zkv|Mcg7UE=jE9>3biif<_8j&1Yok_cJz$J=gJ4InbfnMrT_Lv<>Kbo{B$bvtu{t{R>LD;eLOytd!SZOoK8ycuptG#Xkn4 zB4Z9(o$U}^XZUo1e2C1!p=_S*ZFBonp66ovJUQ!221v49e>5gDW`uhoOSXlo328Z! zXzgUbso)Oa>&Dm=_`-x6Gk$s4gm+iqAwXxN1-p`q8GQ#+X$H3uxnl@(Qdrm}G@hm6 z?aIW(mVKHTD^!Y~s5(O0rZjBQsutTX)=5+uXx#wU(1f@+mE6zHfN;T^G*qy)Yr^8_ zD;502j0fA`rl{F9cL3kJjgN8-jnYi`%=cYXJ0@M!-a`PbH*DKxt{ivmm|fgvo!kA6 z_IQkY4Tn^2b}p_vU%!YIDL+3|4`vpHQfOLAmmc{cLu8g&laF@lS=cvjgme<4+Ks~= zP+TV@Auc^Ck7rk{vL+|e7pGCcY z2B5q*8kyhsM2AAM0F+Z`--p3&lGs%&{cZ=Un|q~kst$t(%5&>vz?eslzM z)HWW&+uQ;(&z_;_@tl)!ti2kAeKX{pa2n$X6%gr&e~6fk5$2!;%reF(>bj07F0^)K zjO0{`0kmL@YKR$?tH}Xcfrx26NG28Ko+Pv_tX$a;bfSuz9O600UTQW@-ftDGNqa~{-<^_4I zhk?7PL?&xX$p#!!9j#Bas~nbREJOZz{Q>B= z6l*>KB_9EloLzGK{IU4(LqnC`GpDh5i1LZ6jdh4Y-PQu_ z3Jj5EGgTX_xk#gfCiWCDCgB;XX35R!NYyR5Wce6hkvTY1I`o*#)Ar46YO9#W<1*Lp`pYo)yfW@OckjP!q|_Q^6DC* zsQ6Brl%U8W%~4MFQyL+1>Y5)eJho5lCjdkt(V4^k*kmo8Ty4kDWuBzH3tBf<(FjT; z!i@+&SH^2sD?lUyiQ=2`xS^_G7`*XlC7vZ&)>jnHp0NH&?H1ss zQJLjHbcUUrfLlgPgUF#Xi*mi8OGAp|$m6OX2iJviY;`h?i7x8(sYOAe-R+M#C_k$U`HX;fN$i!JxAO7hW+H(E7Nkm1aIeMv>a3QD&gfLhRcy3AV z*D?k&u{J&^9=>3wwPk~7xgkrgqHGVM)_vILLETUu|u zXm@)-Rp@EHIbAUHM4hsh2ok0kP{rPG^PuCDpD|1KQfM21)*3dhC|g0%g5J8zKYiEQ z)syi6rsT0!K>=HOUAQ6uNb8_#Y{FdycbJ9vg&AK9;n6xCUD1j0P0Z%rc>{Axnj2$5 z%sU<@GL}L!3QY+(p-}bIe$yjZ)(cI_HNXmH=IIm^^+a#-=wE4mTzfaBW29t;c130C zdK3T)z}4)ry@3lGJ0#ZnDQv*wu8Oa0A}5eo`Jvb`0h#zWl4!TBnBIhAlwl>0@bQj0 zsMs$6Khc6kpxHXSZC~(^Z!WDOch#r*9$m*=n$Df6OuxR#F(wOh1_dGKTGM6UTUpH& zP!_SXK)o!pPXRF@jr#txrKZ2V4&~P?T7Ug3d-jZvcG*RvkrGdH$JVKD!n^;TrJoog{m&)I%BNVd ztk(%ov1D)~Cd?2`DP`ws0L(jOMW*7vc2wR>3FI^=M;T$t$f zEJwsU016_WgS^g!qc0#8@0A1wHZa%0N(2~Cclg96=%@w4C^3O&u!w614XK4Nw$vN8 z+Y2^taJFnK6FTR@&2ZX;XqJh9Qc&yNEYscEjBPyR;dER)Mg+?UY)$?xz5#0vQu;c6 zbNxwg`zR5dqo#w@dpI`qiEDulP=&5-#W7P7cvu>7qF1LRkTPQNzjkTRow3!5?Pj?r z(q{_osE{vY&Xb;QPU>ufMR1OI-LES6sTNcSUdYBf@ONM&001BWNklPMs{cq%_ye<1fv4*UmFa742yqR;=ARnmbL7 z0^8Kjqwc9@SKALYfasW&V$rm(Y|iIl#eohw>?BX!Jnz|vkIoVO`;gAxn}_lbMPbV| zLQls#gjL+Ve&ZU#LTQel*IHpZjXEaFk`~>#R}d{gg7!A7s?jNS64=uWJIue|?mgRK z-0%_LIK0}rf6Q8BFmn(f7d~f~#C_b#U-4;x@}oKwN|gniVhqHEmGhXIYlmPH0Hvv0 z)8-VdsO5$9j=eu-E4#A|i@?*F16#mxx@IW?;nF53!o?y#Y-nOi9ojLGw|P-G65Oj)$hP74-e_Pycna#$)JDZuU_(z_lyEScuFJ)?6N`Bbd|v zY}t^YES7z=m6jNPxDLi= z7xua0V;$hGf(pXdy5R+a@1oenLd|v`=@bC978@nqHk2*U9h~W~=P^nJ!$l-hC~U<- z^9`m2bz6BKWiUe1k+M+6oOfW1Qj48XB*tD81&J7ozy_K`j27U+=&nQI!Xp%~)M_I! z0M*Aq7PH?+Xd1ymiXYNa2-F3yL&yd2W=i-j9c8oj%+?I`58htNCI|=PMKdKtRi-A03 zFG8ed(3{O&=lL(A5`vcRx!UpA1`;}GhjSoR3cqm%3Bx#(pbgUBMp4biP!^xhnsAc4H6W><@o_+91-< z`kM(iX(s8?VeP}B!SLb5!dOKMy^b+>lopDInZ@0xcZByctd+@*0&B5xActPtHG;MfQ@691bsc=^gSx1e!i+^InB{JxVxa;+pMy_-s zi+k%DARJvUS%P;e+@SbEz_-@X6?mXxr-ml>7BjQCYeZ0L8Naud3W-o2 zr{T)bQ@{gs)I;H1EXzEWz|cvAD9TWBS>_(32Y{kU_XYx27nqL3*BN;quiIvd2K>-{ z{8b8C@4moegr$`_WUkpb4l7>h=Pn-+_3;zJD_YX{-nKeAvT8)d8ce zqs2wQ0wl1sXi(1dHw~NQA#DI@`##=mEOFg59Y6`S44@*G<57_8W68Hc2X%{dtAMUs zMct~;6x&$nrFU?xD22UONAUv1ODXuuz_+g0Rq^@|w9=qltwl%eL@qq3)X-Qk6Uw%E zdMklLB*#4598oC6h~!wF_G_oOxbPCXmgktW{0YNXE#kkwFsL%@eDshY7H=e`f#_6i zEG0_N-cfHi6O}asS-p2qsqXd1Xb`p=Fk2+OdgqV@mY{3}U*cD&Le!#{nTq+}f^+L|Ie zG#Qf@M~5}%S{-ySDzbv21axF?Kw;Esw34(A1U2Nl;1_26R2er|Kg~l4!fcDHcI-{T zrK3jqU@T@lvkojdVVl{POLu_IyAWj-J_l zD*4>t=--*aZDTiMf*!vh=NL-d9nfW-!+dOQ9lN4qjs5YyKZRFA@XXdQO*-e-DidG~ z4b|jE28H~g7T_QvezLV#>H)5tAD_u1`Og!|uB_K^bp5~r`gzxt+U}m)a;o{&v9!I%DV*N%?yuSW*M4^=8fp1XDhjCVG2JID0-r4|o zeY#;7qPjITlY+j=DO0Hnd$j6=5P;Gfd$>3_Q-UFY3NMHVIMJHp8FWDt#kN&*wh#@9 z>O}=N02>N^@&);=E8bMC_>Ze44XW9ew{05-n21djBs%7BqyX0mWCCE-QpSlFiB1GU z*<79M8732;@VfK%nqBE`U#6_pnd6(O7za8>oV<)U|K1vIw`x1NqF#2@j45y{ATfu2 z*Jg`gaEMnW8kb#7jfw}Xg9fU&LGiU(9YG_-*TVRv$-wRH z_csMh&;87o@Bgz;9gp>BJ3fwhF4%}8I5`22oEUl#o_+*SuD<8oXnY06`ny1-FyZk@ z2Ics=uE5|~q})b_4uuv^k>mlzMj||~Cjvp6cz9$(bJxxkw+;?#x_4~BNn_cZ&PwT+ z>v$ZEoDhr~;2~=n>to1aUhuw4>A) z)NR8}zT)u!dVjNtL9sUGVI%kS*`duDj#H~4sHdBsULj!L9R|`_%Cc6Si7hNV-eBf5 z{-Ig0MOZZ_3ZvSKgOquYZCAZyuMnZP4k|`P)vcoRjtznrC~jgSp&bli!rR{Q5TI-Y z472Tq3#V?I<#)tIyjfToJ3?n>11auSDdS>s6}VT}MvHRjF7j#;F~8#i8OK1)UUsB* z3E)~lu(o5;(4Z((*(uAgCKE^-Zkr_ps#t@k^agBoiavGbrv$yG)!CCSPJdcC;+qIc zu@m@3b+_Q&AbIxC{%xV^DGu$=Q;un(~GKO2BkE zD!Sghc^MaI-bbWG%x8Ty1qMYVU!Ot7HA_b)KPfUT>@^-2}3($0KiqSAw(# z>5BH)(cA7qP1n|i)i<%c`oxBQJt`HXM5erlS&R|yCk@acC0H*Y`|5y}<|T1QUO1x*|7Tfxg#@e?a*@3;~0 z+U!kvRfd#mf*jq22B%_Z$BDD#HV>T83arq3B(VGDC9n zG%>|=vm6wTIivb`2tKY-fwC1|iFzjx5y-nH8VX*;Kn#_F8!2uK{8T+VMHDS1&2rk+ zWr1tH!3PjnYXF0VFw}m#eZkx7HxMy;q!TVmSszQq{;(9!KbQ%l>N=SKFj8oiGe*m% zpMAwG)HDQccFsmH6dxLoW06+@sQS6$s4ULs?(AI70tmrAr!mj+(w;2@w05L@s+UK9 z8x6{Tn(OE95KsQ-p9Kj2ikExkn8}}8TsFFf#mUoB!|O#pr`TqIb0tJQMixAalF#DE zAGHRDAik7>eczw5GV!@1So(~Bwr)4q--&N3O|MYd!HK7cix8x_^RD^WfjoGOX)MCa zD3mNmOLGxndR?LaIwn6OK#0h~wAigemz*R@=v&i*I+$mDe(L3pn*nkMOYF=?*$kYN z7nFMQ2>iMvpbyJ?7wp*Wo*2#?KQ4NaZY&}YX(;3t<#1C*mWl&zbLiMO&D=OLn6DcV zxZd&g%TL&A#olh%`|A+d0?F}|vSds@Xv)QUtp}rp-pqYH=i(||?N**DOX+SoZpsJd zgwx-PQ+V@h0#fqgBfn7cEFUu)fLp_z6}PhC%U1Ac4UZ;xZGxQuAx7DXXS`eC9(#l^ ziI^vRGmsL|>Gu6z2*?hUgvak?b;^*YO%+)yS`<(d zVi&bPP~aLh86i=Oe)3*V`J7V%=elCRl!VM3s+t;Bv3=q+tuR9o6Z6H4~MQXf&=P$ zs30_ITaZR$>F^eOO4*h`Hb&();WfCe?9ITr85BhUvJO=1C`f^c_m!mmk^m;KN8nll z-K_0sQ1ahti@A4qcFxg75!#vyMgED(()pT214fLIQa-r|O#@J}Qo^`dMTUiILAX{8 zRiz;m4A`nhD4et}T1M?X>Y%N;q{;8`0*r!Ih>ey)tz~y1xp0ILiHuNy?Fs7<-z3WD zF$0!99wUHiey)$34(!Ig8o=jvNkQN;x@H zi;L*pdMjr87GZ4-_2vq8E-zzr@gg>^EaTF>?}yp7SAYix7-ztBo$SKi2NiUY{(n%X ziU1dig^EE{M#;b^D2O=H!1XgX) zc;hZ>KNQ)f#4T!K(kF*)j0T!nmEIyeMl!edxHMYJN3Y22PCQmRLtTXlw+%PlWZd*K z4bo_0T$eE=01OlKCNa>C(b}A`g?^^{VYb1ZeB$FjiofxneCGdGmgm%|Q}~Hb{pV8w zN*BR?> zbtMM%D*Z|n^;^QGvL_H51P@TK@S~9c3k4n_*RGLvrp0?GONDMdPt_p82pbdFr);O# z_X9Ojr0N3&9<5OhB+#vP9oEF!Xq^t~VuUh#2C!5D7@%T)Ee#wTEOmIbCSw8 z9D+w9gw0L(^>z4_71UR*pk7%44~M8%R#}GOP4S@e;((rUWLE&UFd0mo7EfDIwv7RPpjiEFe ziOhwEK?MoRF+>;`pa4(;s2Lb#8ynLb|v`By5s+mtt#nT-F`6BJri3JzAexvj}1V7ELc6?t&4T zKATRnvGF-X0~%u^EYXXywKCq)xnZ~4COQSMPvr`lno9k8ky&ki?nX&7n z(R%R&O{3(P7?M=!xIajOw75NFtW$&Q00b6ii3XZAA!nS%`J9(ba=VVyL{WaUE`va2 z0ir@dp$2PG(`=uPT+9eOuII6V+Tfo%OpNYJUX#*62BB_d3vr!W*uPK5Rc1Y?95X)&yEy%@WmJiO=RAd(QcGFh>sXm)dR4MkA`Bn`^KXT$@%(X~9JE;<0P z96&`0Uk%}Xjp1k=3>_D_88|lpQ9r#8GQh}^WFhU-QPbjbK~C;!=-y!YDJHi&w#PY? zHkqb#AS7ze6(km6LvV!!8NiYeEk_*x=te+s<4E!YlfVmG14{-r1oWBF4~%{Y@IfXL zn?7Jv1;DA(2U3_9={7Qebt*IkX&`Ll9*Q7EW^7uAX!Nw8#e5X>?{xelVXj9YE?z{vyez=v$`vemkEN=@nc)zJti^zgFgL0T3W`XBVOS=3BfWuCI2dIeNXHx$ zM-pT;A4ME6L3t}?Mj%23$vW`_lvZj2Y7KcCan!YBi!O2IuIZk{X?oJC3fhbX99tE@ z3Ek>5y4f1jjFDo2QONiDxcK_^niv;23(df3k|{YuOB|YTIo7YEY*c086#1(SQ1wkQ z`XF`@g=lMz{Y_z985#kEiI0KXVv_i{Nbfn57M_NQGA%*&cmiry@4yoqwDN+)oGltZ zH8Zw1NBVx~Mod?)^Y7Wm>#x6#-~R32#`*K-F*7qWaRYDbfp~1DJ|?Q2F!IO??6w>Q zbw$w~wq!fNr1_o4X#Yw25*X8B7bh|@oy?Z*_n3681Ye1UgbavniV4WOm_l7kz@qoc zrZx$#(*A3*J*#~onXxDhf+5brN?CyjH=Cw$iE ziqNbDg;8-o;DhW@Wf|8983S2Yz)}J09ISK6I$g8IDVWY^ZNkBUnZcgHp-N_pzznBr zzO@#?*BG&wQR1jAFeO8Yv69PT479{nGG=@&;$&Y95xhrTjgU9gyJ8mB&7&y$k~}+F z2cc>wWUJQ4VJsvKof`9)H<5)!HI(mdGaWN`t~lhKVaoI>?2fF*M4N z3)R(xQ$-stXE&L#1WN&f!eC$x${^y{wV_8{F)9wInP6)V51=dzs4V0J9(#Mp!Z{mT z5%m8los5g3fUsH=jj0KIIag}gp8_0f;EchYhxbbEh>mdTTgs0~;q#;?k?H z;<>doyfz%-N?qfXjSXC`m>q%AQ(;BbNORzvz2hmtWvzUa5c_Gg z*P*e1rP8)sb>zwG-zN(@Ueo?=i58Gz6POF3>D8f_>5}cc zfmse|AnaM#t>bHh!Wa~;Kw%3Q=ir=^tS2J)KyY#Nt>4Nw8Dl|}Eau)<%^Ds8h*-kVje)iOG%2a; zA%d?YoR4KVN33Omc^hw>sZ+*~G@_p-n!A0pqUc znNG!fhE>#SlZHi_iDfSq^Q{BH8Ve+F001BWNkl)zwBl@;`j!A|EeXD#Ne#j({@cxK$v zmp5}1LSnNjy>K}&th$VtrHDxcSaR_P&mbe9EN-?w2n!^qeqp(yLM15c5;S0~*7u^; z(@Q~sH-s_>aH+L9I@g$RrZZ_y70vY$L+F||Y9M%FfV|huKF(B$(Hwv{Efnn|ehkVF zYVnQK5v4>(WO|FH6tg3x&sw@U%j@Y{PE(GG_b{$d@rvZpP!LxZwWMw|@&5^(yb4T? z5~Ge{r<+KNbSMksx-n{NXaL%B;&eR#W!p2LJXyLc!0%X%Q+n!O0?1fiUdH+J=W*%M zC9JHhU~O#;bzSQT(6lzmxS6l5t>Mz8OITW3N{*G))m5B0aUy;0*|TSH_Uu^z^OISm zuDc3&lfiSGUcYJDkw)Zt?I5_VzQ=Y%tqn*iPz^^@0a`BDJe_q=99^*X7k7fY1`qD; z?hxE%ad!yrzPMX(3+|BM?i$?P-GYAm-umvX+CQhJYG%)z^Yqid?#|UGoRQ7@i}y;~ z{j?sd5gcC@0Q+Osd!cJ?4k?^`sq0z~m?M>!pP99)K|vsSOoEvLg3tQg@e>&`w^4_( z^%dK*z~+AJFC#GG$xT-<{!8hUAMAP)~Q^FzVZZ36Hq&4Q z5Co$^f*u%?FKyvf@YKa3rB`Hrj(Db@M&Yxx@x&mP0}Apk!HCD7?aNR45^` zT(!Nlq-xX^yVLFpsbuJju3S~Mo%l=Z=6rP(kHvZ%1@CMV2tMmeSj!*ortKU`r|Chx zIn9ds*~#1+?7c~%buO!sT)={N?51aGAcfRQGV85wrGI1!cx3hdbp?L8_PQSof-xP6 z$v`Zh>)}49hCwOCw=EMzvA?3Oa=Y*m^W5Ztwh45NEVW!QOZHcw>`wJ;%nUJIypYu} zVEK1Mu_+0A6M;1!hKR2}>5dq_;-{nf%po0!8fNChuX;70h8j~lT!EVK=vZ5+n5Zs$ z2+`lN)(euF@ygVUjGeRuyvajKm=APY!||!9*g1ke zI5f(61Ma_P5t3)#zqKSAQKg16jsO_9>m@kem-L4`S)ZA_&ITRIhS^k8cDW^! zta+4hj0QSfLhCq(q>8gN9~Hx4G|?Q}I%XXyyrIeRR07&8kRNGT;Yo%d$Q)&fg-(F2 z5u!wuA4+?<8}Mb6-voxX^q71Z($2^Dh=V!C1RtIvpDDn zA3F1mWS$gLxoY4ee2|J3^f2@uq&C020?tBP}AY4y-+z z!*6n|zb^jK=`2kW0dTPWF-(0~SgRHq#pevb;~;|2ET|ED9#gM|?W}B`e>`3I8g=Ff zd(a1}v6ZdV2!_cZIf~?JM(}tiQzHrvJe`o>K*DH1cRd6Ns;WVI@a(@kygb2}NiD

    eTAqSYsScu0q%7_n~s*`{vm1A?zx(1UW z`6$F590wrWbW!1XQK{ZLSr?6@h{U;J6}}5r^maHeQohSjD>$&$*rzNz)Rn>xG*TmS zRqTvGe z$z#KjuVx{?QEc!RC56ug(FH>FQbc?HYQh`8GY#bfWS?!L&74j5v4#*8>uY|Q6s1QT zpalZ7zT&|dAt9-~BI1bwKcRB6gWOT6;N9)f{?w(oCsU4t9=?SReN?jcag`dDjydrb z%xjw#=KL|3E~G`tVPEwroRE#=rsnLpR2ZCeHYCCQPSKY?Q0pZ{CRI?V0Ult>$sWG? zyC1&NnY_-#iK?AUu`Q>L4q8ezZ5I#01-%zdU-cWd6^83qKSrh?EZKxq!@LcL&^lho zB~GwCR2hRSIrH*z#?#mphr76Rb2}uZYZvfRCLE&dcUubyf87jctk*%(02_h25vPZ` z9{u$1OCZAX@^X)wvS74joM4<9b8e4<0q1!TRRT9z(y-$SA`pWe$Uz9hutyx{Vyt2K zinb7*i>;d&+AfJ?K*YQtDiUQLPJuAXYMe5FCzWcme%u5_lLreq@S$}!gcFEBfgJnJ z3o2;Lu$BJ?J(UlW+?0VxYux~6HI`t`ZyH{`w?p?xOHZ$Q($o4cYb6r`b<2Yt=kao& zuWw2rd%nsUmq~vp3~Ai!<#`-4R?uX(oQgLlPysqJC1KtBZQb|hWn0j1Z#Xkh4YAfH zPn78zMZ^8Om=DE;RiRq(#~tPe?vz{^nXG8L?*k}$-y0-Ci_yJ!mLLR ztkL}X{rh_x7gBOxJ73>IwG=nzS_XpNsnl(`A6*8$3P@^+a-gMwgWHD+N}r-GF-ZVO z=@}v`2S^pXA&6pnz)>X2R-EDqXH7zOAnvEN-Np8D9a3b23Zg#FZ&>{2@XNU2rfk`o zL>YT(Sa3v6V*W@)e!UyKO3miEG#LhmuvuCFC(NY7TRK3zib(K~na5!k<9iFdFeoW( z3>8@%D=78eScBavGG;DZ{xvA%G8WF+nAka!V&RPW(1&FNGr|~7N^RwVo4)XmHswFjy6w~lO1{^)LF?X#o}(j)6T4_nY6*SaqA5?+ zO|GL*V&GVDmwaAANtYyzBYj&7whGTqi~?5{g3XrCmCt4W`&B!xxPupYYibo zv+WKc5TOas7-UJ{4tVTx)#X?1H@inp^{NwXu;?=N-0($6^>b0PETO9qU|SEtSCEY9 z!W|)EDWT5q?>pi5l+VVVhd31Ch^Rv1v3`SA8Koue=an)5JJMnYjPMXc(8Uyr`2#i4 zXf*jX5}L-j*alI~NnIoYl{P7?c@Qvg+FH~s)~2)urv%YUGUOo$Mg?&SQTTG5AZ$T- z)qBqOmT;sA7Cu;GoZb@XnsCh(9jwoNyUM?p_{tDrVaJMcA%#cA87gp^J3uq#dk&?P z2jrL7UB{^a@@UN7U@Q>W-4?SBgJB`Fdk&l=3!W9hiIaGPl4&QYS2YN8f>V{AlQ{E% zR(1-LZUmz;M5f;#|3d*o{}&jqy}E)c>x<63P|2pX zIrXMe5rIw5LO*HGb$5QDx8yHz?|(39l#D-znEu@5UJb<1DDAFo`F_W~{nH6bS`8j_ zuD9a4j6$DA_;jZj+o!j*fb}{qBJCR%dLf^fxZk=zba`%p;_+RB@ZF^mibTS#-8Oo^ z#JxVK6I|M)~Am<1R!;%E^L4XmtGS!&*wwi0-128?N{?(3C|#vw!}&qvp7 zL|noEE8 zb%R*t%I`SDz`Y2Es0~Oh6%ft+*eWnW;E`S*BjY5YR;p6-h_zBWg7{B-_B_gTO6YEs zeeaN1rt+m>vp4(8bq28l>7oDFIlv-wqXY}3OUV%a)Wl@a0xhCx`?qjrL0Ax>N$~t` zZ%4eMPcbJoca-W0t55o1delcir(!i=!K|{;46fZ74LL=RlwdL$3Ce+K6R8&4sz*3} z9%SDMjum4-t((2cr_~M2{cgqj?+Y|0Aw`H?ngX34rFjwu;?p^Sv9kr%VmS{Etu{2T zDAI#XE*vzYC?eWgDjh;z$xafMFS;2C-Doqxw4r=c4Wl~NudQjEl6-IAeII;XOK3gp z;8+r6-y-MRD#6G@Ww2NqHmsx!PVr>(^VCb7?1-90D_0-;p?FdIGh$3C4li# z0imkED_i+vJ{n7+W{)a`+ z>7PfW+rQ%l*xg?eE+;3Z#(r$VLOD_=?TZV)IryGTcXdkktfzEy5x)od@51>%3$Brj z{_(#38{4~G?CQggEC)}{%09)LA_;MLnguW)@7|;qv94+NdM2O5#SgggR_c*?`3pe{ ziz%f-e2qteZp#_v#jKRT2XBSH2p+Vi#qUy`-p(%;J=$Q1zgO))R4hzrx}W=#JZx0X zo9F8pkpVwLF4H0&572}Yw5|(sEerfM;+0L=p#NYyX`v8aN-ee&jhfs@S&YUtxg3yyUa;sgO4t$XNDJc@%q5Thp8 zj7P9?d`=<;pt)(6n)G{ymcN7SvZ9+~+?jPOW+p+4QJ2u7Oo&S56C8^5;l>Y5arw#J z3FK+n0R66B4z+&C>CT0PN*Q1Do)d}*`m#3p{kCLF=EMk5X( z`Sxb(7M!-MEeer}Py9Faa;W~L)osG!!&Tc>$&tNjKM@0sEE@te8;7YfDNc5?fvgKZ zwGCoNto}Nda@+Xj*ikhM$*cFC-!0A8wY9ZH0cS#^=wMHf*3}1fTv1+EjiDT;Fi@aG zuz1!LS$|B}|LV#AOZVq%cYJI2`vs5JHCY^~aGYA1pndJ?wuz-16{t+A&m<%f8%fOCm2%uLqe@ z9ldKxGrzu$EOae?wThGB^|)ervuaxlir3ww48ahNF6=R85vko0htK|00?0M}l2$dN zhbo7X^A3A+pxf$c@h01=6^CZ+lxfAfg%YF}shD{S5G2mg{~|KVtqVl)^?L_aq;N~# zzU_5PcrSxTn4<%wY3)H_K`bzftT`0WY<*-U4WiAN7U8HY5^&3t?{ZgKmiMU&go>@G zx-YpmoVD)6#sVaP-__cCF9m(vnkWoxotxC!NOI^08G#0_14tLT&-vv{rSe~-`&ilu zuG7#Fk*0A%f>rqFe%DF?xI$^`LraBjAqVxqj!NF4RMje@miqVNO&?;zNy5()d)J^W_R^8ICs-8hqB06XbTvHCWv0KkwbNV=Y5ew*oj(`m!Ft{4x6ZCjXrJd1AC}CjYaK(Ib?= zp|UZPT`8BZ`9g88FAS;8_a9pvQ5S+TkpZElMy8&EEPLhI{mpUYt@xUma^8uoX+ z=#V74QUhl?YIGIaTmze_h)ljmVcKW^ZI-|oI#f>?b76}s1CDCWT$P!Qq9t%p&M1Ja zEw%yyk8D<#6^j$$%H*6NhrxVMdz)UV{j z_>bfG>tEe3zW{;LewVJ#&%?rTMbh!Rw+G|edU~Cu*G}{Wc53gexwn`8e~vbuc3lIm zb}EFg__zL{c0E)(?u^p>901$&*~xhqy~`vck994*+H2aq|CX3{{_~guJ_MNb+XDZK z-KY4k268<&c~cetr3SotUXOns|FrnJ`WQKW3~rBRx0pdHVv+K5hJ|S4bl^IlSM-X$wSbbMH7nE9>+Ld34|8N zY{n2k5LKz-cGbl8Wb@0(doYAwJkRyOeeDv8#eLv`n!eGBW5B(=aL$6XbkvgsF4zX_ zg{#d@J#If|2K>G4Xp9=#V)#1RCRH9pPbgzI4W!uNu76=u-c)-8Mj$iCdd(po2A`^< zz{K#cSX3%l$O#b@fi~r3J`@1aOC#o7X}<3irNu~cKTL_Xd&{K=%g@lgyTrPMX?&;) zHT3ZZW&#D-VBv8j<~lkjt2mKSVmOWS9!A zcGyM{<(<2X4-g1x@F~uzaEF#5r|?#;ql{x9^;5PV+!wTJ3w8Ae4l4Ux41g6i_4B;? z50hVcd=IFuGqqG1*CW4qc|DeI4|dkB(2Kqj?3dWsEDp|9BPjq2zEe|KH558FQA*UA z9q?vSgD3K2nEOc+%$OHfVtTFzOt&ZrEv`0gr~f`=ZL}oGj``&zioYgw}@i|>;8dk^z?o;Uoq z4)|r84UC;wj%0Dvp5SUHe7flMyYf2Yl$OiR&PKSG61ClInNS-N0ER^x*h|-@`=^#1 z53`U*ac?c$fzrzYH6ay^RaPl5R@@-R=1f%3EaXD+iroAZDKE+y8Hl-&Z`7wsQ(+=Y zeQWI>;sU7e8D<(|3viw4bhwLt>M!%1cvqfz7iwh2t~};&Y8nmn2YaJ$ix!rtO7TCF zwc`^F1Qp)gPvL8qWvQB9m^Z0W1zMT1ed8>e?kS-1h&h*pWEw5#PYyy*p2^nVOJGMR zK41CG?blpCSFMIcRTZa+OS!B&axLW~7^K^D`qu4LHs;@SM_f(*OKhA|529*B_#dP?r z0<|>7UA{9cCrsf|y%w{;rlt{u!80g~-7Svz{Of{%%+h|K5VHF1Fs7x-B`Mh`l}Tbs zUqpVyp`fJF&dH}n0r?x_VKAm#ORK&T(2HRbA@%pOzJcaxa&o8pCG%&H-yUbxgWLkU zYlAg?!@^CI0FGW@1~!qb8cqF7YOhyaE1lW^CR8fyCiIUD+O$?^Sfa8Odh2iHT1dS0 z%DM!W64`8?{Q{309(M~Ul&6%DwAQqmnwoW8U2*@`z8L?wfmU#HaNn=7w>~v{m&Yh! z-Od?&>Ut6+67t3S`MQ2|-2?Tdc=}FP11+SiMHfl$qSkwCODUhG6=(!TOnSCHe+T&O zYFqLU?a~|lL+pBNuH6BHP`D=d=l&^;+_w4wOX|6dwxt77_BXqk=wlz);7uD2Y}?9E z2L@a}`ICGecYnUM;EbNVN0M2y;PvoEh_^CrKS!}I5rru(76OFdK5T83b39^- z=Pj02<>t323ad9*e@x4(t@Vxo_bA%-Sob)U7a5(Y?^lAI=^2WQ&|n3Pw@n}MslwA} zKRFK9GRd3C9Uso%Fy2gnPbN+Q0$)1Fxy*}v2D?9x~n6sDx6147~ngni+qc9 zP90upJSOTi$uGhdb3viq#quP_q|Y__gNX>w=yiN%}P>#1Vp=$Rr>|bA6;@DZlsAA zVKPXIOQ~WRn`(1)H0vsMr=rtE=%W5W1~t~AiGggIPy?NtOFjwm&nFB215vx$g6$G> zWEE*kIB@$fYyX!8AayP8H7A|Yop)2&?}Ye4NX>VWWYr)MIRL!O+<~HiwjY~Je^P2> z{HmC82Ccir&);6RvEN?nRE=#kO*u|QFurD_cQ_q2HT zTW)%SJqLoKHv@zu00yb1lL?x{^Uu`4W82~afFo0J^W+wi`)RZYWTi?ii z72 z9!hz|Zn!!gd3*lnoAY^YlI`sXMf`UCFiHQsvM>rDW9*9iyBQ)Ok`F)8hV}ewA6`E7W!yAgp9zmrLwuE84G(CzvEvS9=((H_+ z#B|g{;<=dd+oul_I{70}fe~a$kw>r1nK75SZ@+*!&3=@D(Ao;ee1j6Bz59#u7Q|HD zz9OCW%@TkvndD3pP-2i)0cQYM{03E+6;r9_~&?h%Z`q*rz zzV@@iioangCl;GH<`jPv?*w*_YjA=xY8zJM+SK+7Ai6KVmhG$FDkV!A=K{QO6U;I% zisRi_<-+v?ygO%#U9t@(`NB$8XHey8&#H}UHy2>=8=we!sLGvoEGX7%4y8(DFjHVR zFA1hxR&H@Yn_|b>x@N)3E@drUz3(i!0dH=#A`#^ksZ@YEm@y;->7~F`#vxafIM+W!kg*nLJc)gsO~@j#tbxTd za|Vv?z-UW^$K}9==VsKur!L%wRQjY$Q)G{>dq~)H=ABzXM`^)~L|7Sm3aVdU>7eL1 z_sMX6_k2x3A@7O*hDXqQa-?O3=9>`AhcTX854vDNOez32q7}Ey`7kqp((Z_VJgp4{ z_RJPZ*L$6?MH^;1RKbyW0r)-616`H$(K|`TL`mk+2V4@_sU4~&+G(_W}*b{o`-7%ijn6Yc7Nnrf>TN`=WDHB&d$y*boRD91l~6(umY%&?CU4kNWTX@Auco z?Z^IBeOw;vA((kZ&bV0mZFSNX;gg*qxobhpEKjjV058D zW0b6s=-l+%KaL<*hHLgvtQC^}6&_6Xq>o-SW1=ASb3(_Jo-P=Y-7IEX)ks(3i{)9< z)uGe0v76OhUBf0HIwtm%`Z-7>c z^*L6fT69CoyLcHINIWpff%P)6j+NZ-o*FjLz2WDhMaY6HStERzUf6do0=B>fJO_2| z6Z(bb`+p06(KMPNjJ{;ww2=0`R=;NFJV8i&U&j3kO6kl)7unBlqjre&8RkWgt@O_~ z5fm@ge5}})4XtcJ#~LjBD$|CC9`bM_Q7_LRGS5do+g8j*^QB)(W9xKmbeXJ(Dsq2+ zkR$BlJb^kuX0D#BKq#uZ{+ly3{ba0JQZ*xKE!A=RnV`x_l` zPh|~};%xgIt>6*zJ079}gPn=VsO$%lcGYOmfvYWZAvwiVdG?k!o@BS30a3ir3vHhF zDP7gi-@zTqEG7T>2@V}6)ayQ1oqaeHlO`S>IN&XE`Ny+Gj^9Vq%jR85;!r{IXF#^t z#^%`XmXXpkgly`M#4QjF}D9pGHKqkHW+HT?n7eUK1eqj zB6R!%p*3NA86F~QGSBe+RxLPsw2dc?66ZY8x29@NCym zaPKYOXz^#iJp?81I7OmCdUqO{GQPa~o2ra84D^N|dFciyP1tNNN(ueIeA!nP^fH)G zWYTv$33rpgXUxo5mv>X-iil+4=a1<%4g~-FyMNN&Nqt~7$|*d)tN-GX&ctt>di%^rz{f}d3#C1YkigTRhOVd3&PQXx1R8Q~rmj^_Mgg^Zgss2dBq1+vQ)1nO=?ATmyo$QmXYP8CqCK#ERx4DOM0%B#f&QeYkT5;G)b{w>cWWv7>-ti3Z z9B6-+C>9=6`X$XV(Av<2;ND+xM65sS02U|xkxhCwMXV`@`icEm-5x@-sYT9B6Zj5N z+|GZea(Pdh%51iaj}KeA*2v)Dqq#Zpz*Y<_T!;w6>LQQ)y`lQH-GQy0M6FbXVJ}hD zE_pH=qB^vB7LtGzD&g6_M82HusEYIQ=M0V0%kQloU3l#p+dp;nL6d0LEh{?rxHu|C zo!@XnnkTOoAs73+eu=m?Q`L#+i~in4 z1Y&7`)u2*<|K&eulV#W7K#wU7Unj*R^7TaF8lLAK$}^t#+kc1(a5!$q{&U4B1=j0<5%5HgoAE9xkXlP&sIkUe^qukuT|ba_i~qWgb+op(M|IR_ zMD#_;MiD~T#(yugQ^YjJ#ZO_f|EV0dnz+={*T=N(_jG|tI-bdH>GX1Mt>5M(+OrxL z!dOb(!a3}=oBxyn|LF_VL++x&F(i(=rZIYh^}liahyV(+ucj8E9>uLa?X_dp7F2@E zyC=&0s%mOX-QBSl<#rE@S!6^^92`)=`>(mqF7Xq|P<@$^wJy$sAbT=HmQL5k>(&z# zP}tSn9Omxs4iiEyXXVa|Q19$J>q6+ypyRA*_BgM@qoaE83vinWX6l-(STl=@Mtw~a z&guaYq;|nrAWC(Q=#%49Dcd!KjDd$dPUJhGTsQo+E7MzJL8wxI{6<#>Q$LZ)lANnY zZC+-Fpw5Bp@>QhZ5H0yqmd&_fhHYEDl%_bWIAmN1s8%gIp(^_a%Tw+hBVlUutekgL zj<+N%BYSr;mTpw?-(*l^Ymdc3Yyw~H&7~kx)F6xQcUujg-JB3k$$8Oq>$=@|pZjd1 z?_x4>Z?kO5GdC&zqwDK`pu6x{Il%ZX`i3ZRu3{`20>SMOdp6&En*&SO^nnP2`d$nBaB9QmK+4DhckN3m+zKppI7&)==|p zRK8-s)`53EXqmbeHZOb3-h#yk*<)hwaEjXZe3_L<&>IU^>1V&6G%6tP=Jan2Z8W6i zR8B9LB=GLci{`SNIeSpSg2B1ujYZlLh}OmRg2L1zpOwYWNKg;9wL$#zgpkhyr~Xhb z2n_#zIs~s`F|VXCxF5b*L(BECAuaq8R8iIc|LIx%PH${;N4PN;!|W{VYdCkL@@l4H z?}t(`5~2+R5K?I5O+>)6`P<)VU!vEi3wyyQ5C|m2UaEXD^v>^e*gUR7aOY8U3eE7} zeWryxF@)d5uVB$lz%m;2i%_M6pWgWvswvM8ub^V87R)u&$%2 z+z@&Tr~OC0VSwBl6_U}sgyMReY0@(5cw*b)uoZ_`_ttO_6kJ`Mqfz1Y9(9gBfv)3E zRMYt;99YH(RWn6c$@Ooy>$~SzIaQP#o3I-&loEP{iHv1l959m#GkMqQAUQQtZrc64 zdgv-pT?xB6KQdAU50}!0niFt69;$cfDHo4L_r>OGIVI?u6^BH%sSt2As_tcAPKFY4 zW~3B4uK9^EEp>$^S9*d~Hf^_xr7o52H_Cwv;vxs?lpLAfi3FZ)74~8PVlEDwC+)## z0Q&WyAa@)?^AfFM2V_}3#~7g1AKymgOKSlFSBY%g$cVP0{|4q5)n%RPMKto5RF(4= zj~Y0pA4K^akZNWSlam=-Y~LiR@e`sA8<7ehjS;u=am4_UyO`mKuXew($>zkV!;aBL z03}pdIJ7xA2|Fc&yiR&vX>Q71eovA zu>gF?>qX@cqOH}3n4StAYcNsCfx?9;UkX8hC}n`D0&Fi$ z1MjxpgurF2rXSLzp=P3hoBvY?u(-bJ)F$6e| zqPJE}!@*EaYy4~HU_RXve5l3mh2a|Z@H=|PG--BV_`LFi|58#^V!lw-Mcvh_r(~Ri zL!Y?qCbk2G zL9FNM{YGsI#0VL577AFoRqE?dga_5YJ9q{nycD3LfwCE#TFD zA~jZ&E?9dC;I#LmqNr~5FG3e`Sk{5$s?4%kA1V8q!q0L{?2R&t^9=BwPgtf;&}_1EvUpv8yl^{c7~&p)XLvK zn9?OMM9tqCihPJk56D70&K9|PM>qXmvpa|Qq8gWO;@p`)_V6648SfXupZ$m4%J1&> z7HxvjCy{j_-`d*W^U7@bR-4;hN6pAenvYI58AU7Fp)%MG<(>-T=*S_lb(|F!5pz$_ z2(P>;(2DfA(=1->qn%vt0OqCyHj>ctWZJI4af^L)Uyr2Om{dA8x`lEJUftlm@~9># zc0C(@WN_}!^smo(jqL;v96KI7o-?WdL68)MlL0sbpJDg~E6iun^!_%c?S2kv z`9_?yXS>U@fEJPQg}u&fr&>}HT20cOU*${5ZHHKxaje&N=DySet2CJ#5oJ=S+i~v2 zdGeLtm5qpF8T3Y$()=4)lP7vH$`{pS3lxF}L}WMa=I}eAB-v&b@O#>RN{- z5*;MVxSo@4@62R2*=m_(lZky1rM#D%54pQMQU&x6gen*5&@?U&iD)}0l%WUkD&}*v zz1FO;vg5U4{}c`&`7b`4n@h6uSI;M6=y46C3DL#=EFhs;(jd|+MpqWOr_KJMytITIA%6er2ll-url*16ghtz^;8oAl-X8bo z)mFa(y2@&)D|~LfM;7vO24f#xaWoB!H(kHNKXh z%c|O3ti#RkE&^Cm>_RB-JamG;IKpg3M;M7?r%w6Q^CfMb;e00GCjDc;?F9v-95WaL z4B8-NaI7MbbM^%p>cvCw8@P*UJCr}V6ZOfVL$9r#`} zf5t=g8!n$=n<;=1+O2?!OH-enq<36M+0XD4 zm~3=js$*mECbxyxM?u*O!e&Gm{!L!w>kbX9ign-h8pf-q&F-;|org}N`+ERW{n`=k zj(T2lm=z1bA-kBSbYug|0^7)a-Xr|>FunK1|6jV(zkPb`Cz4;Az-rpMai4Q!h|bDj zI>a8{j1E{afL1CXtpN+5mR3P^e!A2h{dbtOA4T}l1gmw6oW^1yA8orzk{B=!an87m zz`u)JP&u2gBk{L|P06{bG z-me@B_Wt`qGV=x%OmsC+$bVnW`BYN~19?F3x`~d}`&&vMvJAnL=wYVOuHn?NF&!AS z=i4#s8(W;Ku7?4KSab!b%t#Aqs{A(A-&;)Gs5RV5Z{i9Ts^oinU{@%j`+AoHjYB~S zW$`REcvHisDZ|Tm&{~Rz3(;g>;qWF0+S&ueO6NINUQ#03oC#b{OjxQBgia>D`pj`) z4-25pa>kviLJ_%eg*FUJq%1~W?gMn-G<~Y=`9dMtV=Y1XA_{vldRD&Gv68nLK6wI0 z6Z6r-l;pb3VjLtSD}i+EQg_8?SysLS{l~>4N+S&W`h!y|hc1e;KM2PLxEBK@dn!Fd z$A;x)wGzy8St{T)iL!zq|8Un4EQ%8)`9<$-;J+4vD>c#VWDYdd%QDz2gZ_3GNmPwXk|7 zV*i+Egw?epd_!E$#5d9P7R0_`IW3`YyZ_xC_MvwH*tsp@J*!z>d0*p=;sSW!ATC=>X`!{eZXC+INCY zuRTz`=f}u8BUwscXeL0D5#A97qb2PpC2R@8rp;In-l(iNx9>wx>eEbl7X2yB(uJ)jW)laRXp(fb-5p-pB#C9+(gvkSW9FUD+&xJgQ)(# z%Ff;A+h-3Lpc9n+@*OKo8#%XsFb4O(dNr>rRy-_ionO6XqEgKUSilyVkQAbPuPf*C zlOr03`;cBTRxZyicf$Yl$Ziw_R;>P~)o?)fXAqaq?HGOS_P?W_!}7H`aOfuf4i1I< z*5DE(TU*=e^~g9Ro^gJgCg|=P!tS80=dA!@fYb2|`T1ri;Z!^2?q<6y&Ew@p%=_!p z-eI=me_+-8^RQ1m_;9l$%m_uhUUvlp(w2F>cFHi1_&iY)qI`95i+&m*{XFF&f=xA^ zrxJ}#b|q27)}F-&_!=A4rgmn@H~&D@-PQajY{x08pChLh7GsCHnL@DyZ`;44~KOVK%eU$=(ju$N3yp>wS^ZhvPk-8af1ti0T=1J|rN9 zyLrPf&${<>+=PzJpqt4+HF^eXr41fw!+GW7Q@r!zBv#Psj(vNBPUfj*rZEjt7`D5L zTfdu#9LFOW2XDE_cQ>*7L!}sQ83rY373Ga1cotvSj&k&0EqbxnuRa#0@IC zp-u|KBClxFfJHG8y!ioAetHU0 z+boQdWBT}*#^&S6>Aj-v`!98SGvvOntsl%)V60OyXpHHo?l)~6J@mv9XVs~)f@z$YN+H;jFN|(79I@6`3c_ za9Ev?t(%@&ws(GDY2x&7sxgt~cm8uFDly(05q-=5;i)_D-IHYC?MxO?<<3h{D}yw_*J{Ged+NOETAcR&?`d!MWf_?4zp=C9 z`3R(gLB*jVsbq{CsV3*-d}t+5mq)b_-n&qlQZ50#REj`4%zq2q=kdH(k$VIBi0D5h zG|t$%4TfBY-`;%r8wBO^L09kewSR)u%9M7%6(u}Ak9IB2Cu>AJjH)RE)H=mtIIRvH zb`d9)X4x_y0w%ypqvy`IWbIQKr~3MtR%RFAe)CjJte+qEWzPE}=vCkf zU@$nx`+GunwbSSF)2G+CxS$5VZ-(Y`37-_NDqTY76S_SVD49%RDe8qBv z?un!d_+f)QE;Gdw17?(XcuN5Fx<(ytbf5)r-G}qRSTsXIA}Z=PjG=pH9pDn`iO}=d z&j3PUr>(Uit|y+um3knKkH;0bSVg0K6WOu@^9SzcQ;%Opt~FrfW^dT}?b#XZIihQ6 zc>}x{LLJS`siJi5@~d&|zYsv7-7E#%U-v(^Px}kh+Znx|YW;Wlf8u*;s!unjva${w z5DyMY67hR5=qyg>@P^XZASlKveTAXD(Z#Hug3)hxfdS`}@K7T%2+t*P+$kt> zl*rBXo%XsjDU&88nn!$0dGv5+i43C3+I~?0L(?}(souTil;I%PR9|fWM=j8gxi(x%+-=*#s_j) zW!J1Rx_>H**{^1WnaDlRjY7zU3cfyaC&LnV637Up2F-7Q4kKraMJ~*?Kv84J4y>c~ zf0!Xs5u^nkGyUnzDi*E64x%Bb2>7KeXV&&x z2<*J0u5wtrhx1HL%|9zj+E&qSAtAv_JztNF42d_yf@-ny zt`eB#_S>{DD3Bu0GskyRNTxi22>wlfZm`fqB^8RLkdCAD8!%?+ zxoF*r6a4wE<9pNk!N`>Rn~ZFlEY~}#@If2Dxr&TZWg@G95f^AXh{MDXWu+p4xvxHB zH_%{lM*#PiUE-{;+4#&@#{r&AN(3=5tdm<|eMY)SbzF8p-6E43q!!U=OjT6i4;cm- zt9pT9j!aBDZa(wFo=n|6%;yrH*=fDmRtuvcPson|oRvh#PpI4l?$MfbV0&^9(1m;* zTa_mD^FDV4v4W}95LZ+Ujhz~~ zx#KF694iKTF*nu=A3HGPA7V8UT9SwswbxwET9ETCUKgVI3Q_ZbXJc|~D~of)$2#^2 z;``g8&hV{%bQ-OP!ou>DYylHmCPx%i6KcN1*W&YZMH*IaXc;;? zQFv-AlW)+Y65&QV^V&WMH3$x8jJo7(De;nQp0Z6n;cksBzIu~VKdm{{jpjCvFlbK- zk#PP&-q#tEtzy~^^itS{SZn{CI(r=O>|RjdE?mkZ^rsKD*?nW0kozi*`aReRTPK;L z=&uj~0$V<@_L~xy^{RF;uv8JX1U< zJc7tZq~1I8@>JL7SLNkuV_MC`m|xVvhEIGzj_cKL=C9ylOiMGkgz_r=uN0duSG-&Q zaEcmy>?F45R0;}h&R*Xj%h2b>eMw3wwy6FeO=lStSJ!lH+}#=62X_tb?hqgZcMI+s z+?^Y@0fGi65ZonbaDsaX?#_33zIrM6J3!Um=XCd4>uP!v47P~N8~M8QDXLt2O*mMM z7jH~5()_2kg5gx-H=%^L*q{)l;Y0{7ObeVw7AwjzKJ`i3-SNJ@4vPxGpjtM-j0?uo>x=Q|`7dFIV7tY3|6ukrug6UzWr}hUzSmu~SGbLrQ!k&0?kA|S zF=XvYDkM$({-!9Tvo0SDxdK1ZPoF*kXH}|p_yKj@4^JlK;^O^DD*T!SY&Ei%NFu{Q z%J~gApBC2TUI;%3o*EVoOt$>}%_I}dMO^O~d{vS?U-R4WKDoq$$p)iw0p*+=7?_i{ zWeqzCl?jr}9#rz-O1=Z>NQ)#}`}T+Kxy1u7~&n(nmkQzPoX@v(*+L@U*aZ z?6dd9*2LA7ls)jF4Wa11=EwTB@VDC;X_G`7byb0vwT+jx{g<3X?_y?m0;yygvO5x= zFf8Yj72b}k$qxc<`^uW-=uG{hqy0!2^j&@*vKw;&7|`0^x0f#Z(Qo-<=9%+&~X0R$ti)dNd+0u9q@)W3BIz+n~lPG zQpU~O7xB>_!avr*li1$E6xQH7WrF!E)5;rmROU!ohi0ZY!YG|4`;cQ7i)7ICLmejlZcojf3iqGZvSC`H1V7Nl#RPt^vI&3*p8fJHlUErhtcQh8)4v&7 z$S~1NW#p&P*-u|)=s*;|k`Il=Jhxwe{Z|kBUV4BXLg_YcjNr>=%K8tT9%s{9gXbX{#p3(7}xvdskTQ4gEHI%CeA%WQ9W@0 z(RA$xSW?nFj9ag8K!tHK2o`%&;X7>?m{d5;tb#Yr^yB)7)<|sT;RNm%A2SQ*Bn9LC zP7fE&47wPu!bxLRFn>8s*XTHtYX!CT%BDhgu83mlosfXa~jdU7e8ZeUzam0S2U{h)= zgeDQ6+zCI(2}%9Z^+3-CphQ%E^y%5AG*A^tbidsGxu4j0R*9o!n1}LXN+Y3JMjRnE zFfi!r>w^K1Ds`=`QGqr^2V({Z#IUj+O}Lwr1U_Y`!4(9lQjHaM`5XVq3J4;~$f>68 zJCLYJIGjKDf5I(L;}yi7`C!+BDV0$i)&N(fAs9%05HeOp6&2(RH@7*mD>Ez(jUx-@ ziONpNZ8i8|G3O@M=OEcA70kwR^MewYY`k(*3qnc z9#%r2Y<$JzyIT+~kb*C~7b9htAfTQ4M?yMtt&zPmqkM_8MY)UNSlMaNERaD;bY6TI zR56!T#>!@mez1T>_Ha1!@zyq>*gHXz(cRJRW1CRc!EkcEDv`?f_{HNyp6w!W7(va3 zq1vfZJ3NNuY22Aq?F#JdG4hICZHQK!v}9_fKE68QqwQ9xJR&(Ndd>EMW~+E?6fZQZ zfp?#u&oSSyl=z(r)xwOB4*#Pg#kPv(AcoP_|N0o;-+l9`J6)7Leo%`0Nkj0zsB%%b`;hp( z%d9IT#9_d&`aks4-RYY5^Tn_WFsq15Of+|M!=-{77x6&*xY0H+25+XPgMAW56*T9; zKfOnrrds`!+M2ipj-(uhxHYS++<$f6@l4{LCYJJ zX$zvQksd9|$+O2;)H)p#@HeE6q=92g`nkqNkCu4agi%M|vjSy$9OQl7HWQoJNG~?Ul z1Lx43U8O`i5*I|B_@)U(@)z_P)1RKk9n$#^XasQL`g$7V1nOWG2%XL#4UHlbwuQY{ z-Z#kQ4XB9Ehja_Cb5^>0%Lb%VYQQfdjKJp-XV^_0$yow~mUD18Eq1E&G%W`C{)9%@ zN6yv;1?{FRS-4b2NGk4yd?TjHKoH1?`^nRWvJ#eEPH`1ea_JHxH!EzJLi*uB|Hd3^ zAx`slF6s}4*ts}-%y{b(pC|#E{4yVJBAh~fp+~%Q$wPaBJi<4Qqw2~U^lZE9;@+>i zL@MghHW1Cy!WMIQ@BT;5Dn$`?T%gd|C?A)ZbtDvshd5Qoov*=2K`CZ6*hGwNeFQrH1P@ zZHn1ERE2Ilhq|5U=u1><+b$suYG?z?jMER`yS}rYC2YySmBKPm@INZweX#wW5I<(w z01?;>VVFD4wT)+c6jvr1CJu%kjYI#q1I$q{#Nhe5KSYqw{Ve;KC65G%n1BBKah}}T zio~SnuDU<#3TX7c2>&TA=y8O{_W9>PxL^GT59QFqB~`_`#5JC^Z{>02TDvFZ*u;z) zdmn>1SSqm85230Cj}^IUL2KSdpER|IE7E24ZJJQR>op-d@?)(65lk*s3ykXO)cn-e zN^=w!_MA=H%oyM9+X)mia%=r}q8lq;FD+3r9&Fj}YNpL4JXPG#PAS(lRTly4 zT?U^S85M;he>cJ2-?Z=8H2b!i@;1LlFPBAehna5Vld~65pd8VxtgP*&C-q#S(=p9) zAEPC>yqQ#Aw?l3>A|5j$m>!0j*XodwX_AJIR}zIujGp#FkvMWa9pW>#^E~SaA2ed{ z)+lK{rORkTF3OT6KC67U3ka=p@2~9ZyMzl5Ad;3Sq8`f2dU1Bv?IfdJToPBd8TBJd z?>&RHVhdd|CHqh#z`_pC=@OD;oo=I#losdH3O3F0b8OYqXue^!Ub30WV44w=>7YlD zN{a%+^9Y_{D~FiaFL;mi?dIPfEuNqMmp}aB?dYxV+1Q^V+)N%FO0jgBL6RZN;<+rn zj}6Mvr+~a?elc<9kiUD7B;GvQ{!zHn+n)soDYBqu{sVjWv#V6i#d6y)9ZvqAyy;f7 z(j~39ZQ+(64CDJgLRll5+1c65?CieYw*JiZc9Iz&yO;T91yH z%F4>>TGo4O+Sd|!65|qetC}J6zWNyz0=CTt;9oc|r{%?&4dFkX!ch9TpRioRYKHWv zf!K!&&hVn5f^wt=IMrK4eofGy0?A^)gfl<|eXpJ)QU+ZiYW4=%L=yKAqb@=droPYl z(e;E^i-y%;F)GH6QsG8fzT(*Dvc!nG2~}3iKd485rsk^Ilv)t+GXcj+p(W3VO&B>u z3_7?zT!01ihYw4@WBz*u1% z)NyuJvPWd6YFu+&i?pc{#!)JDxFc4!dFfANZk1@Sh&bBCd54X%GGjR!Q~z(&rKTy6 zhGfqs)TkKUQj=zaS3ixuZxOVTM_M2-l*$A7)xD&s_vCDAh{qMLTvXBd%BaYbnx!A`3e z{uynfV49k0oPaoFVZjce2A5DW$X|ar+no6n_BJ2E4yxi+w3l&W(y2hPB?qY~&e-j^ zy=?^rx3T+^69NhDI(?lA@tNg)+reay7I57k1NTyAeS@Eo>7TBaJPtYV^m`%^1lc_1 zLZV-1~3TQKy1(tYk)@%U7I;gN=trppcBVCs`ala? z#-wqp=(TV?2QdZ3@W22ZJw1IyL_5laq?m`l{sBQ7JLcmEUHiiXsg4X#l)e~=)t^E9 z!@dqcms7&6&d^|qrG0_{keDz*cZ-2^*furIz*Uk2%-37}kr#7XYDFR~B;O`Ge)&_Q z+-DWM+ItXsKk}^mor$pBAAbk&Dnw5{-@VVpfuaV8@|pmy+tk!lj-kRuIt zQU}(+hNi$ro-Z~={6hQ5Ov6ZXMJ+3n+=H~2kdR^pAD13{VW{U(aFdt)EFg3RRrv^GPRk5u4fe=R*dgQkV@b3M>1_4itk4>-v3c^*U?1#n4p0= zGd;nY;Km=i*#Y`p=fBl@+fZHt315s5b!t%$9v!3^78CHLkB6GWv6ZtZO68YBXsftd zrHf3-Qdn;)XFP^5J}<*$AYqJ;>zYYw{rX8wQHqVH*?+XGnkp*@5^m&2v0znfJAYzQ zOe#*1#b`(=G1X85Pq5WW2VctXly=14=6kEk#@rMhYopVt4yA zQDzWA{2P=e-{Y`oh;*qXH}Y|^_raH*i2YtfO*ESQd4FTL^z9@_=3tTx!)X>&x)7HM zwWNi&B=P}OC*zQX#iXKg8WsAiAP~0TEvw)_X1pOc-ko$_nzU+a9;w8=`-z(9)YgiPK zQTj;{qr9Idj*NdzjzW;@(oaL9zm50Pp_iZSG05WLl2*0W?pnDkY3W8I=V^a|0H7k# z8u?ya*;?=m3PuBrh3i8NWi_>(=`EW3Ga!i$2eZ}l+8OV@4Pb9JSDNkpCy#d%lwWFU zSp84k3i`deuE=sfc&YCGhJM1V-W-eHq3}tXgDoK@F;A&-XkU|EW-6K{&OeVbqf$5N z=XG9BMA&=|mSSdvQ$wGUkAWauG})%3l6&1dHCGUts^y!*)+myg#Xu8{^F(@h~*q-lr7ZHE?(9lQFOLS@5~ z(5R0#ATP@5hTV9f3u3@fRz^rpi)eJ(CxOTynT?c4iq@iEwg#*5WK5uJ-5Z9jB8H3F zZR!N2;CfKUXd*LC*_>WN_?^^w1@UDw{~E-WawZ0CM@+Uc3c+tOW(k7&g&w^5FWOA& zILg3?FesnuR+rBWXEQQrekwFdtMy%0YqFFiq3G$`nx<_DnpTNZ>3EbKe zQu+@Rzos1zvh@*@pt50pbTeAg-rSyuZlFytlB7)IZuGufd}VWb-q{!mbIWWY*fHp5 z3ja-%hKO0b)K0id`WPGQEWLC|{;}3@h&vC1-4$9h7Y*D)5~3?YHe`eSK&s zz`Cy+Vz;uZVvn*3kJs< z-Q7Nc3_};qwH?79jXp$wc^UsmQklzbJ=x=j={QuRGTK{Mq%a2?49J?oH*;Fv$MwV0 zcFlG5^&t%`7rmwb?oSKI-v-J@%VA2f$ybP8DiCmrxQwEkgTw9Uv43@uBIwB0w@#y& zXQ&(8-pET-XGv>A3olM-GsgerYe?3NDBPu8eil-YUJBuqw$=M=p{!yQA5>6`C%^Z~ z$V1Cd_H2|wR0Xn(jzSsDv>wOh3)r_Vf@VdEnOFS1jqgwa?Mm5{@*ACs_KmvO8=Ynb zs@UvXuabhFRMNlC@_7}4(}uKotaz5FD>mLAdld>9ETk<8BRkv6F{P z2M0JLS^d~yQRG?@$u0xbq$0&jv0RpC5jRD(-7W+=dmOyYS8cCjAG_lIGk!nA$BTBa zW5zG|qW7DyqQ-mQrNI*|_wHQ<0k_NA_s1*EsDPBiV!OV&+KcnFBSx*sGe9vi>Gzp= z;Z-O+ddN=bUv5rJijd#W^}`zI>IIf5JWDfDxm0Ij+EpT+6m|_aK9I4RlLeE07iM+? zFPSQhFV!nc%o4k$crxU&m~KZjtlW1jCW-WG;%A;qm!#Yc-CmR_@P~zE?_t+w7<+t_ z{t3x>uV5w#5XV>)sEjQWvdvA&b7{71gxzp$3SSb@L%^E0N0jI`mV(W7Fn#7#gq3Mr znYOA(dey!#sSRokqn)``u6h#K&vMUVLcr_Y%XhH5Q znr6`i9jL{K*bic_$y#gO6*Dl6<$;ICZ5ZjuZ<3O(3Z_^ z>q6;_^PBzs7xInVG56#h zMi&qu(q@}s84Z|xzQLHx?OgwzJ@jn9k1n{6MxS2Kg1gPHZ-$#L^b7N()t0D z+XD7SUM9GWOO_WM1w{BbTo{iT9y6G8ws!UL{FyMncWzEwv5z$d2I%I1ueycp!x_l^ z9N-g*eA|~U1CPvM*i;I7rp?D6iQq-}%b10<0uh{>8xKITFPi;Z81Csd$3e-C_CY&X zM@NCFvG(L!>B!2;>1JeYLGKh`Q2s#P^(E*Z$$il4@y2#x=IhH0#S8Z9ed1fItnIOd z&`^XTgbOIzfk;_vz!Ts4+ok~s@vU4&ad(+E>q6DM2)ZkL9wl6M7R>AjV;3cd zb@esQbd&|upc8VVbD|Df?9ou@?+`BEQsQ0Nm*eIH(K}(_GfUf8p7oD{8OwrppVR%N zOH?A5M(-J3m>a>Lk;K%59tDiDNExO*gU?WoaDF?<{jDZFkdy#UGqSW61}K*p}|k9 z*p*hazg+m5g>+V{Y_S5QxW|)|!PrtZFvO_LG6ndwJlLg(-+L*LMMk*-w>z!mST0~= z>F58*OiGQS%@P>x{)R0R+yIZls2C?7W6slDm8*AqB@m_1bj%$%gpISla{)(ba&tXcNOq~5CBf)$UE|n z-wk_5QyFIdx=#bMG_NxwpfZK9D0!a&x(JY-alYDDG5qO{tfi%O=q|L>XpOnQzYlox z^T}$vM~pd!HlwFR<9`^5pi;mz(O*!+%Y^t+VkjP`fle!6jRtvrsrfZsXVG&nf`w%= zxWZ&CKb!PCPn1fpjJIFZ*K@A6xgi1@JOBo2q+sSlVTCRNqF%Qfxkk| z8tiWvqAfpu)VH(@e-V6y#uK;MGO-!MHclYO#t4A6(Ol%UqCzTC*IWtx*#*yVNE? z1;uojeB(~~1(&xfr?)tt%Zv*uj-+Q-lul}$UWE-+D+|m`voj$T%aww6VerX0wRccv z-+5)h`41^sQ56c4fF2xpctmMtA$ae!gJpR7%4k7@^LZ=lAG=X)m%vkgpklso$>PeFX zF@5`v1>&OyYpoJeOxIDc358X5_*UBFv6Z$BF)(+fI7O2W|HT2(`PoVsj8k6L27ECC3$RM{j!$??5#y(Ffk;Qzc$TufR}$}Qeu6j z5%=4gB;pggBA3{;7R{MR;pI@|q{cIAji_X=>{-Q!o#4{?g{Xq7t`F03Pz_7idWZt& z;f~?y0Y7)v|Ha9bVfBp0;fr}`WgYGNG+O`!BlJREZDu4?V8(z<;rV-NXQ|#?zhj=$)Saw>i>Q7EEOq?VS_0k@=CdSyVUG(f`5H_{HoK!przC z1-*G0wj^rwfUoaG$fclgS^#Hm2@ioW=mWfnEZ51)uLq7gT@t8_V1lI#QGAY{8Q@_R zigJ=D?E#yfCKmV635Hr1n{o?xU5{p^LKK7mAb%}WgdFa6`3Q@G-o(JLnH%B;0^!5x zOb-|i+}=w|NhjTl>93XUtuL<7b|>prP5jnBf*jpR?9%RlFAa{+MX}#JBFcO@&gc|w zWa{C+GCI`Uj>#$kG%(2E4qocB9S$NZiFtW)#i_7L)G>x5UfLZ_nckJj9EN}V&&x1Q6BwO0)Ndp!_>8zCZSBr!T zQ|I_nXX9W}t^(>0m%0Qp)k0k^+sGk9SO}h)0-U-skqR+sL>p)wEKoD8i2~1)8}}a` z&sa)wasznR9p=eX&7h*gH(x$2+p`=a2xRi#$)e}0jDAvYA36V~{A_^jUD^#t5 z69(#~epxED-6bMcuz0cpx4{JYL>*FaOE9u}Q7{+WUi6ihKU7=rUr$t1D}+Ed z+^$*Z4!J|mdR8mPSe@`+WV$rUDkqY)8!CQaeI2)ZPszAgHNhTVZ=?-Yg4 zp9g2TBkR02`W^gKq1ozO8Iar+GxUZ=Aj^{}yEtnq8(}{M| z@dkhFm%x*UBJ=69JC~~?n`{jbyu@Or%TU%r$B_#marZf!LU;SDG4y3Nv*p~05%r(|4GNQtr(?tFq z_S0}pmD7))W+0Ak<S7!NA)wGe3W5;2ti`z>a0<=IXrcHyiI*Ux|yYC`fHF*U|OA zu@qE1n$uZX+?)vH-2%Ra+$bTA4f{jvrsXXI0*u%)B3Qm`!b3bm@qRf-DfC|ErR*q1 zKog4mKaj1qVsG4qw+wy?h^{!K>>Bdg0awHlTqw^~9&9%LHLh>2Rc3}s-D3$#GxaO> z6Z`=(3c-SbhMccABUCnNg733gjm)xLFCM}A-Bu-eZq-tcW;O;LA4}Dq+SlzF*PfSzwT){G^OP-CyWzb0LM=Z9+cG0>>ALQR9W-h!LT zlRNagB~>`0HU2ybZl)QPyKto)w3v}~#JK}&?18bW$v>ZCLkHBT za|!&K$SnlB;W?G?Gk`YWe=RX>PBJ5pwSoB1`x)o?g*XJJENE>g#`0>6gQ7nwQbann8Qe za(Iq=MTiMHjU9>?<35Nq+#>=MH|px0P+09*8Kohd+dC9ng80OXm8Q9++@W0ftbfwC zJM#L(|08g$F-?=G;9+tUFWLM_Dp{mCW@+Wdy3ViyI{cb0M0ir=lJfHngSrA8(| zElfg%gMi6iCNr~5juc!kd~nBmZPgrsO@V8Pr(3%r@i0D1qk{*?G%^~STfhi@Zcf4d zNBcNJa$LT_Q28vifMPGM!VjRTat`Pl>x*0siPlueAxcmBV{F}qt+=1O!bfzLMqu$8 z#a=Xfvc(?g3?p`PGsRHsK>Aq*(o#{u2rfNW+IaZqy));-vi_-t^=RINnor=t8}Wx> zX|P(*5vM;uAp||H1En3CQAd>0e{5R|HJ_^evof(44Q68D;#aGv^-nOd+|8jZMxIgi zUe9K?t1WW@`jB;9TXVbu@fA=-Z3AdnJ$?ONAm#HeNdcwR`|FYa%lZI-P>zX)tuv>i zKe+8vZJz$L9NewhYrS~<(&ko#?WK`uoW!!?#yclR1;)k2eea|I^6}HhFZ@{a((d#G z3=73NptNumL&1`-vWryz{T@U_0rL_v%wSLz2^(1ZMoK8OftK%QRG}!L>F!MH9wA%T zzg?kqe7@d_8(aKZz{$<{&dwYY5wOgoY+LwiL{Or!hd$4zkO$VZ$XjULY>crG3HJo% zq#kAnre!x`Hh~##&$Mv!DIXO|LnW)Be4bWQJt^!OY;NKh-QZB<(2NBx+&GJISmL~^ z(wR%SwZW%M=q>{zcnihheUs!Ur22!|%b*m!0_uxZC{m?HWmTlJOe?f*kOMh^aOyRh;gM@2>e!@-3q+7qPc3xbH&cA9H+h z9as_891j9P|78^zN#8jCQ5@x{ae-@iz%I+$jtK0a1O5GvHMo&F5QYP%5qyKK-xPOK53zeQ0??r2{|?{?Qj$*`mQT zH8TUP%cNvM=SrzVTUN!lO^MD5qz@-j3xdJDdB|1q7ggj$cX9F^H7}OZ3Roq4^*bUAY zzBN#MBl=5>nHD!)WtQHmbe0}vaL0~{A#_o(g{cFpQs`$&s~mgyq}0Lu&zPooCM-}u z=@b&THCgck`G+rI02dN&`=<3RH5gG#kN88qEmoBH!nf7PUF0q3f3QPRn0(h;RVab> zs7{vf^L;R<>s|3@tn51j0Hy`j)ZX~{QjKejTGNJ&5N!ks6CDo--2wCmK8#B zJfuWP2@e;ZwuRFG9}A~AM_Jy()lqqA10RpU=q}l_uS@vj`}of26dDAK?XtA8(#Ku! zhBsLtICY3W4@Qy1nxB}29|MY~_A4AyD__jlBSZ%7S1qiFoSNw3&=YBcOyO_lG`?ZZ z^=TWW7fkExr`rW@yGAe>QxY zO)X#eaHD76GwE9=F*b1@HQ*tgG9P#@7G5lXQd-9JAOm`Jv;AQ+=L2!p6Mp)8;`hYG2=og^xw)Y z)IN;wiZOUqP_^25y8_C@ai|n)Q1y7ylNsO+Jk; zb0=|nD}YN2k@J%Ljc|Tu#XHyROPg5o`X54$Zn+<7#!4<#W*ZKRQo0k9JkAAuizKfA z$2lj9EoqtliKXVxX2O0|9pnErf|D72yrpN;9=W)7{>>=R!dI11QCJe|raf(1z-d90 zZ&%x1f;zt=RKm(PgEj*XsrH`L;fp<~_XES0=m|oSO>!49hh8>FgI4r-heAQK1XqgD z((5FU-y(YxS$0@&+6l6ZDK3dTn*o@vaG&hFiL3M&CC4Ni%Z#|&cs&DLa(DBjrl89% z4X1O948jWo0dT+lp-Ue&Fir?ucsy!WEAXQjrHh&R8QbFZKb>->f+6AL@ZR1)Wy3OY=X3CmN-3UDN!=bYncCrFuv=|DNWX9Z zEe9C4j*m}nZq9`2wRR#Mh%hIn?Zbq^$Y+sh0L?lvJ!i|GrKR?8Yq2XH+;y{BCQVIM zOjc8s!DsurQOCCH_{LkvHjG2XI$)}`?xv+ zr7jkm=seHM2r7-(P5N!J3-S31=_0TfF5ZZ zD`&)Np5wlQiR7Qf7)deowy|mp8CVmc<~-7yQJ#ie4YNt0`9yCzZ~C31-47pTY9jatuK(^`QN?yN99;u~culxGedtFK?_ z<|CX8^pIVvD&qV;!T7yE8fQfvQXYmE){AIe3)-xmL^_?e2FKf=LHT`c^RfCr5lOni z(IciuiomGJQYC?#)Asw`F_iBf?KbxGBwkX%G?Mx)=Qm#hQM+7`{ZQ9SQ@iiZCC15D zHYoXCU(en|jr>k{l?CEQI~}i?5Gmw~o5>#2ap4oe)fTOXopMmUlKr8vxN71uD1Sog zPGEnAIPb@6-9NnD|Hr{cy~(z}1VpZfMQ;QMPFIyA9HHeE^Yhp)ioqO!aIISv{<+g+r8H-)>&te<1ogi--cLt=^*CCNIi{!@3oC)gtCeXIzH>u-NZJ< z>*56q3(C@4& zdPY?ZWq9^_vD4ma$=|s(ouz}j$SDWa>TW7u#^N9hb5T_r2AW% zK02gg&3v{PCW%3=FRS)J$Z4OfLOsVQ#-A;JVB$LjbTu)yoCuHvWNo6Z|%hiqDLn#A^2 z(E7`MsMD~{{HkYcGe3?NYoy32{X>CtX7rwA)C1l{4W$YT6qQ0CBz|H?g7BSWUcG>k z7i&T5D*J+FLx|SSVkIjQ2VCO7$m6ePH&|G_b@^wg#K2Xw)Wubz8mB4!KQ(C&rx<#k zOX=;L_%&$sB%`#2x)`lU#-mPH@c@`OxpMyi2`e4HaV--%OScD3Qgg3H2li!<9%ccVi9C#VueL030dI7?m55Oejfs^uS85R2#fq(nR-#1$9;ylf9e8i_moZ zj+T}P{DbKX;r!A#i+e4x8%JeT^cMFG2}B5z&0A>K=NxMhaV8b0yhdO za)<31YRv=8$$*?mKVUIVAo~yj@D)t~k`b_M<$U_=c%z-2KXhwFm}{qfOq4++NH-*hh%bwaR7Y*>idU|jiCSwEX0W@wks`Q zXfrTt-3yz6J(z@mCOJ{E6pc{>Rp`)8za}>bo82&`VFQpm0A|NK9@W@bu6u(JPKMxM z0Jj34pGey_-do^6lk@iM(Pe*}xZ`f!uN7Fz4)#L04OM662En7Cx1$W#>a#99Sm{|k zYXE*CF%4M<3oSdsU`#kUp9PG!YFquKzL*@ZvO4XDN|qtxV`;?95kxLc^~*2yzLBYM z%RQ+xIB*HbAzLEi%<+Y2?xrSR;eS%`esbUx zut;bjjpBYy*P(wu?p3FLx)!_ z(R~kwRB*Hb<_JKy+sy61zZWR`_N_kXE%1GF03s&2!|tB{Jy5v;R6QVb{tj9FmhWpf zoMQzj3IDNu?t41xPK=MAAbYTgyR0jiY`Y_<@0#hwO(Y)zur)=^z)Y3j8PF<#eOu^R z^8wXXVMqXgqYt3%I0FY2kQv+dHR2|Uc|{^?Vy3@_vEh`u7a69I%)`mrCN%$-;0dg! z`QfzI2M|}!7e0M44Gbg){7yuFco)vyZG45#yJPQkUG|PV47)u`Ie*(Goy1fK38?Bm z3Oylw09EA)xWE8P{vZH5dB5y!^Ge~$JesrgR=IPecr;|rul@jU_5I_4aRq=DhQvBH z8;lA#1A2#ny|zv`urQv5mDSYVo;e@Hj1JKDpkBP53h;>D{mCHwSS;Be``{SkWz0$fm6cv54g2SO1@-d)m3X8v{ zZ6-k&?G|OMH7hg>)(GZvfMBH;WXrEcG{>c|^8Xr|%VmP+6swX8kncr^>u~u$FFQ4oR`hhgfMbjU>`~Q%rUXbgw{Fv%A_xjnK)IR4sK{Agv@sxq_gpOES8~q`%i# ztK?p!f*Z+qbd3-5ms{)O+^Bc&FLE5!+~BFl;(L9-{P zHlW)jv&m_NoMcc?*q{v0XL@&2CiDK|99lFPlO`8DX_Se6F81$^M%lLe>3^h0DQx12 zNMOzAYKC0{bNe=Ht6#@ksa-%kL0~4|9=^qHN*J>+XJ5GlUE36!g@&FE$>29QK8%FX zhR+IDHB`~n+>FLj^IVz(DGI(66U~LW3fmA%K@Tg)k$ziN2P@h(Nq?hf|5@0{y}fny z@1|94q!SX+EXXew#_ywU-LSzi8;Y_`yo59`O z#oz{NoBlXH_f5U22wzV_4zGO+0|yCf##KWPVqX6qh=#kyJ)i+=xrAPyr`|}#p0_ad z4LZ)sdrG0%;ItvEhVB0N0mi1l zwRnF*8yTs#9M3Szq@%FG8L`SFjA|SsFf%iI->rH5PrCc*!R%-_DcEFCBmFZEP}YF% zeQ0xhSVzl@dsl14J}rZ(Fr-g|UOEQD@g3l9N9Nv0Cz;3v&^=-AGRA5zz{ zW75uLlgYu#uoaP}6BTE>=pC6!gOO$Si&ECJDY>#L;fr}x!sRy2CS!A0;Kx`%_v9^o zZ9LJClp>rc7d8}$dGn8j3JD4DF{5l9HgYLOB=f>dj%Yv_8>2dcjP5P*NO5JP~YPAEoqkzOgDf8vVM%GjT&oRg)hr!d)Qfz&lj8|8WHh{tIEjo|C2QE-HK zFy_+A`q0y-Pu|w{sApfk@DH)?44JGDDeK1~*UbC|f(zj7R%xqbd~Ckle*fCVbKZ)o zyT@Gr$E>N%Phu~qHt{Njf6jQ>#)&K`*098Gwh1o)l+wGA(EDnF9{`vwUtdif=SWe0 zg;1{Iat>dbod|oUGWUoVO`}-m@-lG-{m!0(;Pi|9%`|%Auif0lmBVRxPi_P1xqJIs z#Id)b8f94Um>?FOQcXZOfU>!+iw4e_8SqX3;w68Q?W1LI$;b6WnXCDLsoM7M!rVi#Xmc?xURuo%rs z8z?5zUc7h_7cXAK2OoTZ`T6-Y63o}NxKV@<(CKtWS}XK=y);t$B#)^4(a@;9@bl7Q zm}}A?%~Fm)4;pCI==B35D5^<7R7|Z)1xiFtlx(o3uyui(D5&_qpn=q<&s1&+Ja}~q`>1FFBM%q z8&*li6}borM$KfxQJPzMpa+%%dSlTt3f_rzx(}#gHk#st=tCp{GM?qU6M0yaCM$S> z8;usLdT1CTR1sN`qDVOg4YeX{lx@6QIh@+qKz~5`yX`%;y-#RJloXnb=;U$#RLl5y z;Y%;!g)jdE=8nvvv)x6f*M$$2M1V_iBDoPE5L#2?_~E%zxN_wR&YwSz8#ivG=Q=pG z8xutv-c^#b6Hs{v7Y*8^l2-%L@R$5th@E)cC=VPs0HsvQHHxFJ!DFLM3+=HzXidyQ zo3b_qi-o;N8Y{<<3!v4vruq z3KCSzHZdR_I7qFbAYk4>4*I5hTpP^K-^BH+TtIJZY>ZrYIEshIzKxMnruK;;Xe%o# zICt)D@`+hqUjF}$D614(+pGH&C?f#65e15Z5o5N-9O3~nl!knBKqjh*V2lK^CLR-# zQc>%MAxjGMjG00TjCQDmo>)ekwSh*F&X*SYo+5%Z1Zy3f;_H>P0uhhRLmX8~;AIRw z&5MHMAxcQiY(hBX`lFoasuW=4nhrE1J&p;)v9nLdN_bC!&=^tX#b@HYMCrAz$4^N` zO(8G+*dGM zc%=|V@wgIqUWAMT6V209ZCgOGvCdq#dF&?7Bf*hDj(?y!uPB$EW00)ds58RQx71Jl zXH}R4u{OypvCK50is72WFl-h`MlDhuXD8E0NMA%=v|=MR ztu%^~UxzXhvL%1V$PBu)8k0t0+-QtxLf-}S0?S>iIBtSU=!gR3M2XWZV!*JjIV#bd zN@*CY5uE26%og?gRe+XU2_>()?<;(`a0i#JypQG8Wvr~N;MVPVbh@2Sw7?xXd=yVS z_9UKs{3$&4@Z)H;TJTV)Dh|o(^m^Ftb`@dfaK zQqfa+$KwD&&Qg{}BtP4Nb1O_Cg{y@wN)B`cB?CF{D>(1auPS)&;Df8@$8q*3>83Gi zoM+BDABYY{_@taEX7TY#NLis0DFD$y(z^;FI8?3@k};3Q$a@&=pr{9O9XQwH;FJ3z zkS*9^97SsyWosJ7wt?VzffBC@67LqG0Ou;W$|3lQ7o$)o{wB+IV_=Pfu?1{lIr?3j zgiMB5@JNh%)$hakDs^-bx;4h2C|fYb@_iupZjkrustVrmIicVYN%!?8P&?Y1bUq3W z5-mzO*E$8R1@BN*6`bpdR8-UxN{I!6g)R8^%c5i$Iu$SVb|1tu!gDnS^1 zV*%FMz-T5i+M>j+@e)(x1#H1zhY)j>wF%Bhu)p)LDxgrI_VbC?iZVm;;pC;ULpjm> zdO&H}1LYHscQE?*`i`*CQ|P&d_#UQRK)0-LO6%-qE=aiRX0D(dcNh^d7!VAUD#T;T z^5&=rE&$F4SnFYn0A~VRC3#;JArOZI22>zoB+hO3aQn(-DJ(M7f@(Q@5It~2Nqj71 zGWXcLE6?+wC@)6xW0Ms*X&gs1?5%BIt;BXY+0hPr5F!Jmon8r)kusZDH}x8t z*{3jB+2?arm04KVg_RU4)}n~BWw64=ljmYav$-1-ck2BBSn^PcP)fRRp_zwKiGO1d zPkk+&D+DIwSOmqaW&(`W@PR-DPB_L!gKG{k<1cLMM+OwyDAX&~ico{LdszT-Zd`^>04&uhklFzm^ z7&97UMxia-6XQu_t&*uo)Zi+S((GVK0e$CSq&o`Yj6)Q2D0s8wwmyXsy*#t<`Eh$6B@R z@%Ww7@9N-J^&HzORF7Ig!~qdY0g)*aLlTlOL&9iDvUjrg`#kqr=a04S;d$O2@cRB{ zU)R0@d+&F8hWlRYw|;~4;oPV?ak`$G5=x_)AErth8U3x9Z$8dWQ4unZYJ<=i zFk{GL(z%54M4yl{!dyDu3VR##&ipe~f zp^V6=I*CgT*ei(GB^pD;^q{30vI&7;cx3Fl;~*3#nADz+oYT-)NGqd;OLtj`MGB>3 z6)6_J($GXTK~)EJ@04EzTMtUIEQeg6Xtqy-s_G%SY_pHeg5?!Om+mwI({WyKik4+1 zmkf=EW-d7-J$Le}aSoM8+YUUY`?jQjrp}PS$#K>BV!p&0`cy_ilhY2Ax=?YEe~}jl z58tbjX`6`310e!m_2A-0lTc1Z2!yG?sJx;eeXsP!Mu4FCsc3>&02Lva{E9@fVWMcU zQdJI39drS60@OOw>rs^?w`8+BI9=p)X6oTskrwUpjCnQ~pdQp<2xg6pW7YxVmNx{f zJmd&eJ#X%@4A-|C!Ny|sphgHB3G)yU)PsSdB*K`kYYp*h8q`fNWWii|jS(JSE5eV$ zg3tu?`~8#@Ti3OAFwn7F6B?aICLay$#7Clu;U()`iXB6sn+B0b2u*Sj*6S=QlQ@nL z3PM}D&eBc7)3M$l+WeK!BG!{3W|AoBYactl$asxES=Q>;tO^k?PbJc zGD|W=M-18%MbF}FIv>*_Ex5R@V!l?q*5cZce2vJVkp|qN?AylX$o_>H)S-C3j8sUd zp}9(SWs+o*v=rwPe`gs?+Jb2r%`W|p*hrI(3X-dG+SuS>*9klmZVEDA_6^B7X2us{ z>EIlhi0O*aT~}iKV$$iob+EBHcTQBkT)bvfN5zek5|7AbWHnYAMyPg%I8r3dq%n{O zp$E7@Qo%&DoQfQ_QYGvnKO?1TQ*!i824{wPBxRR4U5~6`ArHJ@H#eB+{mTIG@PK6qQcYw(}oCPozK?i}kQl z=S_{PuBg%{w{+hKEqge)p0bZ)m|L7Nao}XBt>X`uL#F`iII^LFAcwj6$}9YAZho9% ztRw8|lQ|qqNOERMiXfmz4h{icbkyU8;K6V~o%BMZ5?bwYHI#}9J+*T{GthsTtT-X{ zRtZf536w`?Mi_NYBd9A!I(Fb-)jGjdO41!n50dN_ab6EX#Q_ypDcdH6yMf?H$21`{ zc@ZS#YYe7q)DqAz>sY7O#MdB=h9Jky4q3*nU=O96XD~etS5*iA>cAKb1~z)pc`Jut zP-F#f?yh}unB^Ttoqq3OwTx!*XhiM3QNX4gDe*>{O%Vp{w4;KeDtdq01#FSxWFsL8 zIiE*3q#`T5Mj`Ply$XcmV&YmRX3lFTWaKjmsO3i48j;2#A$~@i)2badgE*-5 zzim)N4lqbJrgUnN(&(5sP%^x7@F{UsqJ)tFwfPJRq9ERbhMsUpmfD;gwqkjf4YV8; z_S!?PpL<75$_1-*Fp>`ZDkZ5ler`AoPScVhZ?!SY3Au>qA}BA0;=CAPeclM@mPraty?!6LWh8oL+MV6f)mKGv8Bt zE0oAa*b+DuS?J`4rQ*vBO9k22gTz8=C685Y&B|e<@9=%?r=A>0GdEaoMZc9jp z+3W*IBct*d=i_BOBP-&a%NSTz{ZR5gNs{l5iYlXAZU_ObDz8v=tiVE}3!%3URZ*$M zwi%rj5wSCH$q$7L8b>mavN2z(j1@xE;6LSr*y|3|P{})&NwO}!Zeu6Fs&6q3y>plj z>f=(`ys8pTH(=c~7^ImgKn-gb6>~})S%+(_n4OHOS0&l5vZ?j+l4Ws7&_F?ER){jr z-JJ(ZgXyUngTZt{C!()}15h=Mnjo>s{d!fz?%=GQ2~Cp_h+rd`>A|#x_%Z4_U|{BI zA!K4}ZSSSdT~RJk*l2_TI| zAR-N4jM3yI?FRVBp0ZPzf!E2b#g++!2Ixrj|sst-!q@e3Rb+ROiQthEC`PAuD}@V1EVyy@dnmZMTGf|F5O znG}xF*pJ~Uq_^n6a3skWg$;2Ma*)XRLM~9mxvY3m_&S-BQF+}4BiGw_%9qFV#VWR$ zMm*jSZE2ee7PO$&{nPRjk&ekBxpsC=0ZyjtIwGJw^^wVF4yE_V;1nn*B+9!pBR4Rm z0tLmj?uzv9$RG7_I^w<7*{s5l@&aKqfUL+TG=vJdb5a^PXPH5vz;Cmw?a;9;yli5I zAKN;iO3~cVm0wj5K^WAiJR4Ebq4HIF$za;-sLysq+F+^D@+mlK2FXxV{Zv&#Omrj8 zn@45L@tl|pQ@RMK;XDU*xpN62=!MRtDiQ`}If4^`3!FL|hB=hlNp&WlW41I%5;Q?a zBUNR}pO9RDU{eD1gfTOai$DKIcQ5>J5f{497^Q{ z#sY#gJ^77CJTs~#LLO&Q_pKP(3GZlm@pDMv@k1r<6ID$H0+m zaY6)z*G?Q|7Q7Tr6o?KtD4Jh7r_SfGFtNtdnMfp&;jR8xK3cHjtVKfzAr&)mKlR@B z)ykua4U8%AVisA1)Hohjuz`j4-n@nDhG2XyZ|}t>6Qp`_=LFuIb`zB%@dBf-QXZ8H zvnm3u*(}B45@p6!r6V411Sl~Bn#SODnxWN}(SXK05KFV1_9Ue(hB<6}OKjW;~O zlTU855sr=-I?>@SD$G*kgB2Q)v^!;Rx~6p!W*K32gfwQHA>am}rm-i9;~hmPf)yts zUcr#SdV{4l$ZptRT#uf|wbx$z(klGY*Gpe7ea-kaJ($vU%X|0`G~%L1aN=7e*)F7A z{&yyWt5O0sK5Z2Xzv)~jBH%8fC$?UeV>Qb1-bh+>o?0Z<ldTlo3mWDGMFpFr5K))Vl^kCpiNB=FcGh zm%e8Fnt$LT#e7NqaH7?C}3B9`vT-<4{hpnXsrs3ruceS!Fz)D zZ6hEW21|xXYm|qN>K)*dUkZyL)V2Ps;|3YsS(VAIN+4HQO2ZCRnp;7uErwn|k&O%x z8Y2yoQ-aT!2P*U2=o!k_uqs2m^Wa9Kx>J?kQ`LtSJRwC$i*a7WMWZ(l1i|mDI9VmU zY-VXh2pljqHNc>*(MW@VNrFS6PxqGV!K~F~RGCPSNS4>> zn&(`&X7E{B5>LS}A-3#V6PXjn#j1MnhB8K(aFpB!QI!;1rbCGFr zW0sKKU;3F;j<45C_El*^3{-gJI08m0px?`+>MS!a{L)g#r~mex8LNR%PY;w6VfQZTCH>BHEFwUYTMrsScdN)tQpoUYj@D;JWq5kvBLC&}0&8Q#dw zkpSR}R^W;n1?WN019F5jF`o0)iD5pl?l zvt8+YyMRrZevup-Nw#FsBzB*9I8@H-Js9sh%1*K|p;;pT4}$T1_EmLf(^%XIXM(=H zu#*6AfI|Sd0t6TYHB1e@N_%(Y$&~&u@qNaEOghIxAgBT}D)ZbInVCVqH~;(unmE!0 zBl1U}1xFL-RjxfBbOm!=H;nogNs(&B00W~W z=&|U6_p2ajo1Y4M~H(UO$dZvK)G z&z)YJB~h*jlSz%KuGX+ z1)`8Pi?~p$BWK8kiCwcX87wLT(xT)T;L^*4azST>YcONKs9K<)D!v9GvHgX`njBM- zbPE({I(G=cp0}|^C-Mo}$0a#=T0`lGJF^nX3hYjSLPV$?DZ$#?{pkQ7@B3674l9<* zE_<&ANc z7pP9iW4PEdN=#$sR;VJuB_yS4&B|KjDr((`F)P4P=9@U@)f1(PE_vGBCO-qp833`0 z&4GJHfVK41GJGhS|UPH=&@N%A9TiRir@eJcjKdf^k-PJ z<{sFFWq&XA$I#pA& zi_d!kVxv-MdAc=Y0NXIo)=iz91c1nY=o-eDaz;}+1Y`wzK?;pkS=uYeX<_2Tcn-*3HbUx?!ZuiENvK=%{w{jsSd&w#qq+!hS>S|_i>~i1Cf^OrSlZ2I zNmQF4E3DF3MN6`QPE$7uX_}7Akt;6gcypRbCiKAgNO+1- zGerjnR0Iix%4D*RdSDllJWC5c0#isABoXHYzylm&#sf0L+a%f9C%_2C6#+rA zd#JQ6wbLv!7{l89$0}9-qDMfF2(z5WsPh=>RhSMsPN_xxW|IF4N9MN_Z2pcRU$nc5 zW=tln)C<}!)Jjnr1|vpWPzW2LMav^h0#TMb3!GZ@g6b>tt$b|vSbvdP6D6;InITjZT#9)RMu>` zA%BPnFKe)7StU{{YCUzVt{p%aAEVcRQ?IzR+2(Mu*vROpNV~!0!%&W~(k5ynRPVvT z0z=7}Q*j>o4Q;>iSa}$UAH`^pS_MhDbEFM4`A$$84OV>(IrTAXEY|9*(eUMFMJPh> zK-usx-fzVyA+U-8QV<)Jj=a*HVxbX2;I`5-j`~{1&n{*OY)RH_hg&KS0}bIz_H%10 zC7R-KZb+hEZ1h4T0<&$cksIPLT%dHuCjjg^X!9GQ1~oQ;P16)+XM1T(isFu$XZA0V zVSklY7@>2hdcD^B3;`DZ(tccWN;fF1l>3%rq|%78EJEYh6OvUxr8GYR1I{Gj(O1l; z$Qlop?0rIoF`T4ia*a12%l~ogY_y-zVX`8G2&xk5J8jIJrqqj5r&|)TJq;-mA}WoT z8N`$V4olRo>cZd5Qgm%Ob=R4poA>I187o$9BwOJV(#%(}Y(xvLGz;|_@Wf33dr4hf@SNa9 zB_VOnHHjptcr%8=^|9*dO&`$e1QX0|8(`%<>Oli`497}f4xvKN2`Ui!9vF2FW8R_h zJ@{$_gSyer%gW~w08&}UD;c-wRXu}jIi*I6T{F>2j16%R5xr3i$%z>_$*?`Ti<-50 z4g@235wH`mRPZj2b}IAgF%KC;44c{=lVIoob&D7j>vLQ{desPemSGWHPowukkr$=~ z90La~oR9at_jmBMuYVV-*KLA#g2NAA2>@8PZUaX9qmZDZEkz8Z6FVy%QzSD#G#>$& zOpiLpDVk-K4aE>=r6^G1@0}Ass zhqsXzgHspFDYGe~vMv%5W1uKpXXCVjRn$}3`4UE!Ruwpe5ft}N)hCQrol2x*RWF@N zMGGdN@(z9DaB0R=1+v%>Db5WF^rVG=w2n_!%wPrsGAhP)t(v4LBm+|#`IN^fkxM(H z1g^Dt67Nu6QKbm94451mo{DAg2+$J&iH`{(DMXNq>^O?@SsUjARBZM$C}PSi9P@bU zT3f(uIs5$)+fPD5_d*fA*G; zy$6*%M0@SX=`4*VBZ{afYG3zepAo#6XXTvNQF{E0sTh=GF6yf)AwwEYXyap{f}{)e zE(60?fNK~%=K;@f!RO-_M2i+=tN*|OGY%XVl!z(08GFvupMNFhCKGvwc6ryHjGhk6w&TKx`H|lWpa&nX2EWTgAQGe>8WWv z{pjN$0V-c%boMOFU2+hfdgxJ1?wU*+_uPXI#OU}Kh#aQ&?7_AN9!|5#(eZH{aPUHG zd+-rV@0m_Kn7NA&#MtcF5CGG=_h9?Oj~TxwVAkx}Sg`D1Jo)hB80?t>Du5ft0ZSKQ zboLk?x_47CJ7rB79jOpPjrj*3ge6BF22W~6wfXkd*z?S@m_@)e5jX&&`_9HuuRH;6 zbQB_tXP`Enth*0K9DO*JEMEeF;D(>xh~1Num_0s@)6aP=K)}80H{ziO9xX`U+65iFY%z{J z`cMdf2ev$d^>=Sj2jnIokPLB3;x)JIkb|+$_-w3MdmmoC>LeU+z#L3WOycI7@4~K$ ziK4^lW#VzwPuKWqr=5uT^XGs8Oit{<+VvZ;efu+D0Q2Y1!OE3O0RRgZ%)?119*ynW zp249jmH_}3%%6u7PdEmfH$RA7yCy&Y4wyd&uUYj<0Km?PNnHEm8%i)8^B2s+f&=Da z%L9*KZxY|2ws2oDvXbh z;mN0-!Og#1oks|*h1AAU2ByxRw?AHesy^4m!~}kF{Y`213dC7{+>-k9GljnUd-4X${2%A zhnq%PF5AVUL=DQ#+oiPLP9>kOMV&qQe%~>{$1KP6V5=lvJoGn8xnnATAL$N(9goY)J0phvu7AHf`Su+^HI1BOj zk_hcZ>D1<<#5LLo$KFvQ#pZYcBn|_Kjt!)VFB;kOmqCmmD2c)gTCwn!UY8k0ts z=c0)kLQ=%rc{c7;;349rGvq6(cS_VHp(8AvaZk+4aqvBRjnt?`)WWwEv0985%A`0B zK~Z#z6zFrt9CuGmVb9bwcI?;*YC=<56OvG9-5>`7DY1+S!1Vr z0T{vS9xg!?<*YO+2CTfZNGo8wmz+6>#}RibnwvU#r1*mtF8{12U(B<$Tk_ta*Ha}$ zVj+h-`%T#s=^*ONu!`M{6nQs=zkYJOEatW`Nm%)@YBOzhrmA~_k?SM}6{QQb72ITm zQ!6+c(mVo+c^LxCGKd&~lSxg8Zl;kXo`DP9jH5|S%0|%}<(v<^11G-m4BYv{Unr@J z9F9F_70$W*tr+Z{##0YHipqIZ&f^1r^XHg%&;l%Z#i2O$qI0n3N54Sj)FbBP^G?V4 zzxPh?bd6^od<^|wAC>d?@ZWv`^A;_{vZD^es!QI0yRNwby{ba5>f@wyUyJiUa2cBE z0iJpAF{_L{{@`yui@68Q$2~XRrZeyG{*=K%@&-~S&V!xOFHdY>f2rjtzJZyjBDQw^N zG{`xOkB{RMpZ+l3@w=B|pMA!0(4qtJrc2Mm5r?nD+BNs0ZbBl4RhEpLQgD5RKl<4F z@b-6HggJ9wjyGTW28@o5;KB>e!m3p#VeOg?n3|eK@A=&~0RRqJz8Gho z{wn;(^E>d~cPsZ~#UV>@)|sba&H4@4_T;m8-{o(^Xa36{V!?s~u#OFMHX(c+-VvVc&hnv1!x8c;(5*;EzB09_+jCKKR&2 z{u2mv$)>FV`V`%8aZiDRP!dVj*GxTboYP+W5=o zXo4acb<=j}ov}D6DztKF>mn!5bx4~f|D{m<5Sg8Rke0!m`k?5uCr+*r|HTwmRAk;f z|LikKKFfjIq}XCK)spIVk&j|C9?F!WHZP=f{F08ssr7C7Lwde@wqI6CLallU;cN|W zsaYe&iL02?yd>GBV*Z@Q8EoDsI&QIQ+DK86 zF$@wktWsf54k6T-UN{)MG{#ebKthvLN3fHy<*vIi zXYoQTT(Ja?+`Ab>ghNg^N;jwzkH-3+-UK1RL5D8~06cKly>QN9?&5`5@`}Up$i15Y z5LTRUGyq`biN|35bvFUzaL^I@n5}o-0|1zJ@IhF5)Zut^(^ilWR-SZ>KIVj@vF4{Y z!8?Zok5~Z!*nG!&c;^$0>AeFn z>KktdJHc7+c^d@4m;dxj*#5{9a8-rHhc3l?KJ`Jo^2}55lYhCU)rrTs>FF1qjg?0o zhHri4O5A$GtzcoCde$nu{rzvl#h1MaSAOkVNGvKVC_nk3&tUiN-8lEcvvBD<-h>Z* z`~&#%|NLLL@9s?)A0NXP|L$`*|4rxM&fC|5K)B%I*W(pOABL}gg9Sz&qb{3I5@4|Jiavpy{e{nV@!f9g)Ka|KKy2nAnYF%NFBH|NT$!yT5x0zVtu- zck+8kV*uxH>7}p7^5u*1cYps){OtN$ARz4fvT=On?>~o2E(yXppPeeiMo z#b-Z+uYcnzeD{0T0TQrf%ftAqFZ>by_dk9Y-~P_E5D~m))k%2kTh7O|KmG;&=5PNQ z3@dJG4>gxdjU--<2ap{}R#`mwe0TYwETgZWUT@+4z z<*~T*qO)<`&u_(-zxICs0Lzvwz~?^wVf@KQFURkF(w~>j8pN=Z(oC}e)w|`5srSvN__0Y@6HP&+T(!MI3wo2IA0JCBbU0}-M4~F%jXN$(?Y)Zy820sNi%- zi;vXhO}LVuPkBA7uTmC-3m76~#m4$aq=D|i{*1Y;Bh z1EHcSk70-tXR93NDWNrF8FVTd3Z+nMWCKeTMjC^(-kYPA|C`6KMSn(U1TY(lC`c$3 zx~XUgFmk^rC4xEezcLzGq;=XpTp6W7oTvh@P(6{294o2{E|3;kAp|G}5os14;vAgV z@HU9vg#BI*zEYpRreRD^4-gtf7i1{uZ zK+s1p*)Au}1f0`QzEsI8+n70E>s?wr?7wIMgci<@^7ZUhs}E%R9_+gs^)z zzV*kS!&g7>DeS2OCTqsszgmmy{^c4x{=lQ@+&r}L0Ucc&e2{U0vYb~~&*9k@pNmJf zK8%0+$&Gpw0=VV+Tkz zCb9K_N3nd_q9oUqDA!{KhuY?;ncoquxzB(7YXJaX``WkDBDs0C?sM(kI__J#9U^5>j+3IO1n-?}#CJ z{`H!lrJ&Ju_iVxg4?SkQDNYEizCK#7pGdVS_eclcG{ZN_jk@@5`B5bPQ?VAMg?Z-3 zxBkZdyJ14j9myx5op2k+O)Pt46S34 zOv}tFA?8lSa~49A3M)n3D)XfBiO}wckiV9+E?I6wWnM}$b`Jgi2zvbyRJ}fYub2Iz zq6FA`R6Rxd;%j*GK8c8_j$eGvT`F^r5^AL5JnzX=Kt5?9ML7BK^m;xKz)>hxy;nK1 zcjk%XHNVdHE0sL=j1$vSRZ)L*6xB%Ie(&IV_PfeEg&@saziBj0HOZ)2n(UYvK$c7! zXRn%F6a7u7#0n{QF=CZ6d95n-BIY8PO1&~*3YqLsrd06gi&7>gdY`R*T_S#&s~+-f zYtXN-hZ{5vgS|r?7_%HO62&?kgRBI#sHvOxF3BFrIW&P23mwGxk7s_39nU<60}oq{ zTd%$z3l3GT!5u%m0S6tv91B-2#j{Ur$AO0}!;Yt)!>_kL1M-9&&-@w-4_k&?uf7iR zS1!@V{OA|yG56ebI~E?c3_G5A4!?f#834eJr=P>Z!lI*WZ#B;9Wa+89zvgZdAq&<-7pBNetAu&XM{ zkJZ<%16jm}IbugcE}4Na-8z099!>!$aWqh25BQi&?9#ejxSpV90`EnoD}j^2B-cga zEpl>lIw!6hq$mYFV>kqpW-<++Y$WI6=e2uYsRSm0PLgLC@&KC&wVR1p+jWQK5L%-a zq8RPsP*r+fLQwz#ZSt=ahIL&+Z5Q#21mIXaM$eV>UXY78LI*`EeMqSAW1wjAKeN1mH$xv6eu{hL$*k(3lHmbEzaSLnq;oZ`f!@iER`i7ga=KlmsPJZw2`zy4+{K4JxK{o&8mIF4B@h@rZ34@ST8_~D=ZKRDub zr{JIykHO*-kHz8>kHu@>^ETZ0{h#3KZ~Q9=z^l%F4c_v>cjCFHp2g<%8}aDYhruFP zapa+<>S8ln%Y{ZLHo+zY5L=K`R7lw-Ti1iUX_@n=-e8T*#x-GC62g`@xcC}#=kAYJ zSV2^hEAL)+A9no54$PUeAKv-yH@DW3yVq^N^*{Od+#xmt8{=_e)dK)GHMnk))pcmp zNpbn|#rWbEKLrr5cFnz5z4{&y5e}HQKgP$$5T^I&g45Kt5I3j?(+I+7>N zr)rw#0)u^ka~^dwNPpWjxf^Sm8q?F$2`Y_?YmBGRgxZW~HT58o1mb7>EU$h503ZNK zL_t*Hx<;r68giCMrY=d+4F=8GCoJGWJYIrkD&*Iw1r%Iz`%I8}omVzSPDHNj=rF1& z){#U{1yP>5@?#2xah?n*uhI;jsP%95HgQ7|(N@ZEJ9)2TBRA8qQ5l){ZDnI8nM3$Odu zWUWvhnNVVg#9FB7$hl#IqZ#UmwnSHDu0#1pMDUU=6v%??x}%-0ReMBb$|6RcTBTKJ z&lI}oEz74w|61hNidvaGU5*ha^{H$5>A+_T5EjXbon(bCt!Nr;9wdsN(i)Il_#+o3 zn!pK6)n^s~&Z%)=&+fe@w1~zC1^1?q)|U-Mx+bk~fpe(pCaB|_*(bMV!-5>wOs-|N z5{=tnz8W5FxmK#sMC*8OOyIzhR5MXd+?cZ~TEr%OG7qoz?rC0zq&SLRBrZLV+1*E- zJp{f|;!qe2;Cnqxn;WS(LL=%**%zSiptE92FZS>V5DXv)u#`yB*zmxFp0Cg}0r&oL zHBNrx894B;SkiX*ln({+2s%^7&_A z{-Mio*ej32&#$}+Q^jNM{Mk+EF;n$41i-pmZpW)GI1BSvF2!N5JQmko@qJ9!4etKs zT{!2R7vr{{-Ut9#d-Lt6IlwhdiV5&eXW@M&G?SCK;|JH_rmKI7W@H3QPdplDzw=VO z_Tty$SO5MiJon@?c*_UhiO04+jKBZ0|AEPg-N}Xaf_Ghl!0M12rQHBfHw|{~*aZL> z8y{1%BGTk(0%3GkUr~!4J5e`H8llv6tu`~vsGBBjxV3#|DV!tgL5=61-w6Qtsn(N3?UmE8&RZc$A6${rod4#78-D<@sW?b z2LSN#k9`hXwmg(B^<$1c4D;vDL0u0($OQ_sA`HQhhS-G$E6R55n!rBevx}}vJEpN& zv(hX&G<9O^t0QWy_g-1hnU%Y4;CXv(qG1#yAvhs4XzD?7UUf!xa}Jo8*p1nFb1TYlwfU+uogs5Jn%5~Ozy_%@3;s6uyOT0n63xdxaMx0dD+D{ zv85~7vuD|Ux+;ulX!5` zmgEQVz>})$n8YLZZ$aNVIAM5JZcz^&qW~72 zcpO%q@oL=hgP&o;+Ium%dk-G?(Jv7CeO&V1x1m3)j|EE(0s!1~^Bs8p`JL%Jj?5lQ z8}H=q-6;SqA|YEhZN=oSNu0dumALY&S8DegwCXtDGdJD!T*!ykD+#>Z#l&p-Xel+EH?1uvXbBBlFc z(+n)CKv9Zgk39mrc1-|~KySZb!@V0pt{ByX0YWptiWN(-`mXiZxM7nSpy_=wK0ap1 zoqm=O>a@7kp*9<7F08NvM1b4xSc@~ycs1r9FbCV7d`eBqL~z`3hwI4i&UI*t0wpvJ znz~N1$@KHkpsuGoq&UsjL6TaAgu>KyZAEL*jZdMa(o|9W+lEJ}lWBui(%XogG1q4f{TOlQ`#EiMf&);{|@3<TeZT-B)DY^36(0A zfP}C_E};V<)Bz%kHk$`Hb=4IjkXHjRiOIdxK5poE;LTVLI4d5TCLui3 z$_YZsen~`k-_F)?a0R)wNY^c{lgfk0^l=*c}7TTn)r8wCQ8-J z%6T^flML((f;~Yn$%5UYu-k|O`Xrd;fKdeHs}P}Q&Zof~Zdn-j{qim>Shg6ye)1VS zxM>Tf>Ka=&Zo#wLpT>d9mtf6Jzrs{Kz@EW0b`Pd7RS&S{rrU7f@+Ej~`_p*f{`)cA z)Oc{?7Cg88X)IiJFxK93J9ZDIv8Ntj&-4IOO^r1-{R#&zUxH`1KaH)MHeHKRZPQX>) zx(f5=&%@;(eIG{0W?|OsS-AWU--mhg=i;hwUu|Jl`R3GIo+f1%MY<7N$X+&bLn5Gl z{j1-^0rThKgMav5jLaHET{pP&Ef?Ut^UuPzC$=Nlb80|bt($7l1*Q&pga71z`OnyY z-hK$7!SB57BCJ@s4F7V)_Y-U?Md~Ow4YqB25-V0N!|}%-1!l&)dHdtfKl?GPT)8YC z0}j~nydp`bpMDBXIPOS{kB@a04gEa-{EhDd0RG|&pTL3x=7E{<_P1V$3*UGae(`U& zV&kT*tz#9qK`_!J7vr@uz$+GcB7#tBFk|_*u`^k@VhO(V#XrG$=d98Z7Bjx{uRjF< zeCp%x$GkaqT;BY8oPXZyaN|w4VblE&wsJ-yQ7|-md~f{sUjYE#`|e9Idu$Z*=Di%B z`P3g^{`|QGL6{S#r%eXsWS5^tODzH?w~2}(LpJekL`C-c_pRsUnV+jmAZ2Du)r{$Z z1tXT7EOYxY+|6L(_S`+$u?q$bW6vO9s%GpNFs25KscHT1?)Oysj(;Dpr)Esm0fUAU zzbJ|cBB4L7immr*zsnshCmRQr{JTVkEk^EXjqZHDz>J!KLFgQB&LMV@5}>zWj(L#1 zAQLHgGk&KqyyChS9&&??oq0+AOvfVxGa`upzdrOn$pC873IdQ1*xKFDbl)cQ8EYDCC<`Ft%EY%UU`GkctHM2T?K>lsPb zn`~J#jVfQE>h;j;_fhqFIefFK(69O!85u=?bksiUDEcEK@KuFgucwct0ov>Ps7!N-Pi|&Ptt0XnpzmB0*1dKSsh$Aq0R1IUKa_N2bKxjZ1h{{(RyRjP< zY+1VjC!D{^MT*048@$;@banH4Z*xsg3EHmvmpfh>y_UH3*+LqUyQTP zKT8R%yC!hO*RI4>-@ZD1jubf_EQwgSh+0*NTFmjt@#^Xh`=cLRhq3W7y!GuD<2-u} z0QlCG-@~`Q@jb98Y#AcS4Bi;}IWH=1R9AfK|4Wa*@```Ol~;T(cbJ^V2P};L`su&I z=fChN{LlaQ^XV~HT=6|@+O!pi9=be55Zt%nethE_-^IJ$^=ACt-+Tcd{P3q|j2Yj! zX)8YYr+`pV*K;hznI?753jue|M0)AER3+E82NvHD%@>b2o1G2^b%Q?y?mM?8zu|fq#(&kk;5cK!f^R_DZn6) zN#Y*`NoyTZZY#?ejneu*q2OeTBxn9X$}eIhp9@VeZ!idiLC~Re-GCQ?KmqTysz8b!G^3bjwmlrv5coXe3N zgihi+x5E|9MLoVJZv{iVo+Jc#lL#ZI+jIP#?sqz6@y=O(S3Vb>J;X_BhMbQ?WgG7b zWp{R`h)P=5PC5P!;(gD|hbmM~jgU&u0hb&bGm)x9MM=GYq3V+?C4GgLI4SXiZ=&N)4)kQ}U4eit*>K7g@ah0#iL zbVi(qlYqXN^8^vp&>)+sx>!Mc z_VN7lJMh5$TM~j5_3-2S?t`T()Qjcr)$2`RCCSuIqPrmx`n^5`WCT!PpMCeiQbQIV z-trK3Pfle)RwQJv{o9s*$F zrY+dDb3)O;nX)?)2L~xokcJGe^(9X_@mLTD+qOT2?N2^i3gB!+)O50fD4CwMBi;)> zh~;Mt+1*D1smTv}JvAuP%o>&OAAQscFb8aV;wfx<@|n)YEr~}%g(IYzFA??`pN*9( zm+E7mdIn$p`@g{a`Ezmp#qUpZWfHP3s-H~L5+Su^Ro)CCyXcT)hb-<3LafY`!amdZ zq}c3VtPq;j17`I}lfTJf*eQKDpD7V|rFf4W9!x7J5NL5-vg19?NYtFk52a=2Ph}ob zF}5ibJ(<8*a#SR7{L1I<8n)Fe7zDy}Xrl_=Tx7iie5Lz^_k`Yv2jCDybCMdi0)@C$ zTy460T{|YBG>=Q`Xxj+1OoHwf3MJ>GRlJD2FvGSmb*ri>y`G4M14W`2uG7eA z>5^h&VKS61O=yk8rIWi8;~v`F9cj58x15q^uuG08S_C4PwFoL>KeD*W)Rq=->&UWl zf?#@DoAtU;3z7JlBcMQ(J#I?HQ7n>L(-Y3Bu!_7_R(7K5rF|JR~fXeHpI~s zhtTd4I!25tMK;CB)HGw%I}A9WCyZ%w=zBpQjPa_{*Cs}fl<4NfX;zJxMLsNFgcKGAkHf#J7{iA z<@4tI$mR#pga(7qm}d&7aUO|a$MZX|?yj}TE;@FfIhi=;oeioPRJ72u9L)~4>z zIiI`jf`wm7ciVX^FM=*~Y}n)5)WslJN-$}Xk)f4q*4}Hm7*a^Ni^7WA(r#hFpMUlv zcel8IO0rcID^8e;IovhLl0l{aNAnQWoD`PF6H-v(Rn5pUUxM^8J#; z$#UMqS3OkDzyt|Oogno)fmfnz3ZW#JWxg}+kv2}6VdPqZg3Q&+qtz-_=S^T#-W4}g zQN(xiA4DaiN_cbW1UF4UH#CaP#yIJ`g^@+_nn=s>=akzHCjeDs?=7SoqP!6F{)!ML z;CemXyqW-KnLa}oO^VI!5V4ACZdw2)!R`>y2QcD+X%_Syq33`RFnS^wC15}RRTfU@ z0Cs?9LgfgxP_D;JzU9q##if*9dz=XBqH1#H*r@DxMW%Yrp>oEQCMCGlLa51MN*Ka~ zng!wo!VW=zs?vh4ii~c`H&bLLID_6(TzZt4Npy5DoiGM&0r*z5eiwt^9mez&LuUyN^j)MxEJ9V$h7E{iX zU89_W5h<@StwoWBGBT*s!nAU6X6oQu5$aZ4yH2XEWM|2eNY_4H`QmDMJy?voH1S*q zGr1~A??qRiP&Tx?^lPrY0k3_{EAf>t|0S;d(G3_MpN%)Z;SB8BHHj;}{R1m}bNaFC zkX^gJC;2c*i|z?jyq+ z7?p`|8J*&^(PCyqsP+D5KxOQ?IoZ<}z9(@sU&xD-Q*691MRZgXKNFWSWx;?619oT_ zEialZ2d2a?N=;frx-ND6YDmxu_-vY{V~|J5*)^#|<8e15yvW^{sR%9KODqst?zMY$ zi5r?7T2WP4VxY~>ndv@G#%S?==62pxDzxH8UYMtq2vQu^uw+Fn3iG*cA(ni|@IwAU z`M9y|?UKyos8u{bvKe0GJ>WgKCujmIiVsShy!3|IvV2Gh(NCuQ-9qRQ(1=SN69Z}d;)qa@O1Fi80KIwZo&%dy%XybSp8!1& zMkr)`2lrY^_54z-$Px86svBYys0CX!p{IMn^01O0+WeV*6Q2H)074--Bf8~ z;#M79z}7B7rH&l_{l;J6t~=N1W*Z5N@p=SxQeks}5mf=wS*@~lcvb;O3)-btZbeis zWJI8_KxbvW$Hu@34JquBVP}W45gi;`T|dgMxp>!9b}7*vvP*;v>A00ekuw-okUMK4 z!s@m6;qCAGD9(Sw={WwlBOxNV=Gvd*>L1;JC!W~e8Pkw;O$<Z z&PI1-<>WCK#7N^_0nnJ@%=w(nV%T}Q*GhSML@CmBO1S``ay(UDPl?q0!Y;PdNxn`f z14&U7Q9+pJwu-2jI=oO3ERwDBiQI5*PvrfG0HH~V-c;~G*m#o>VUolNDZ(eCMSrxo zr#vchMYKX1aT|c3mLKYuR8@-32a}OYk>I4~rOGMNj+6OgT58fruWT-2#Ez}!r<`!U zL@V6N_fT2-rZb`}#o(ee*Vg%;C!ZYa;)dWT%f*^lF{MRNGHeNMV@?1{_>E*LYsM#HK~A<3dGNpe3$Lp|8_i1z%f(q?Cw2_aS5s!S5gvKesD z;)DeQQ#?(_j04fAYyu_bv=UFFBc&>FRAw90T#41rKOQh)DWtx(a6}?gN%|@(^tcH2 zOt)Xx4Ww%?R4TwI+niI|5y*;ePKZ}bLuRv9Zz(dYkcp;x(RMtBQn|>fqU>at?Za!E z!IFIr%7I$8a8p52i|)KCi!;e(VOB==v)t_!=As=kWs>i+v>0+?g`q3p+HO`$^mr-B z4rM4dY%sq-_Mg*F&%B z!~3e`keO*bp`Co(CDL~IDKdj}xJy#(cGj)@of+W&y^RJ0z(_^PN$F9`)iok+Tu3%$ z28Y-ovyU0Gc!oE*8BN2i(4Y>-Ch<;O+yA8G-$m3UZ^ZHSB(Ir;#Xpf2CR5FD&QI$b zDl_&@1Lag{qCvFI5qjPsaD_$$wFD!^XM}a*x;6Pdr~5M>Cs*79F&Q^Ik9YVmzG~U! z$3m@D%nD{y1jRLBZ{%tz+-BqXjU;j@ink#Tp1s)Mmf?$g`@7cjNr(Iz4b>vTB5l*l zq3hZWCs~(bhVCt8i9Lyqn^+JlTaOA11mtQ9?(f(Bt#j?goY7bTH}myCTF45eM&Q^HvJthZ zWnxLi!lxb?(LJ(2f(n~%vVxUe9HZu9i;Bsr7Clb+0jc12tx<)PC`-AJ4Q;SRF%%2L zmTf?MZ@vxdDz4vh!IqRvoD~Hu=658L2+g`ka<==16?Ik!b$Zjn?t*6^$nK3(Ag#rE zxUd<9(qRs+ze#~Ib=%uSaTnHzTAY9>tAs%iq-4yvsYj~UN7j$>j@uCE#W)X|O; zpb;g?=HSTo^RfhM94H~)CDAgGQq7$;7RtV=T4sPcMjkGRL1>{ZrNmcW#H1~5w2?y-2!7`y*&s+{fo@>bmgYD~hVJKq(y=A-=d#Og@Cz(d#u^n{{^?S*;sU z$mUR?=$%=T>ZI$*kctzNf~E!9(l0}lH7BuE{%`NJz8ciE76IOYMaN21u*}o?Px-ma zBu)n)G@P;zf}NO@tpSFEFD^7ueSy92N(wn2azr&#$>`T{i*B-7oDfHu9suVND3gV? zfKb@2WpDve1on{W^EOQ*uPG5Wxw{cEuZMJ zC;*0`Q&D7zkJ4cMA{dS7#3BudepkisoACF&CiHHZ6w{$V#>mm{x~inT zKS(ij3lVkp_fFfMW#t3CFBW+Y) zS{6x6P_33@Br5n%|7hCFD7|NFjw2t9<*0w%1EZeS&UU~WB3X1nZ;J^iWFlulFYAh1{oxC9XMqtyA~feHXYaSEPy~oHpw5h3~%a@k={`3Po;a z8@lh&g6M)*Hv2EkUml4P*GCkDlb-eF6mwnN@79si96NSW3*#G*smqNE7!Dr$z)ExO z$X!vmpay`$rS#+!C0L7Xm@R5!Ms8{IR>3$SljUw$eFttE>4;*~l7~cZQbt9i$*U?@ z8DclkO^RyAeY*^X&Dw7arY0&5VkxF#si@5sR>})+x4D^pTrCU06C#VB^2jtEq!#sz z?&683b>H;eouq+jgSJil*RNl#5xQ2y!pU)D;X#I5rxS-ZB~NPXqbBXQLyu7g-hDA* zw-v`$CXpm6C8eJGqt3LrlZJ+Ew(ASJV}(J*p0kBQba!u92%w{AQ{B}g7~rU%S}3@F zMv`NXg?FaQPBNIpwtZa;yCu zD)ckg(*!y+e*~Klm+>E>Q{PY!0udUshHpR+O6uj9z|+*5I{zFF{0o0;{} zLb$vVn}Ff=P{lhqcf=ZmeMUd#pmvk#NT%(jSAJ5zTXB>g^kd5WKBw7WqZC70L?T>@A1a%!m6gdffeDs$nsD`hn-icX;Romb{+Y;mC&q3 zX5W=Mj$4hd8F~|^2^X`Jg<8(eB(Z<2 zTX1YNGhS!6-r4A6h|+j47U2XPXZ$Vlxkb4X6%gxCR5?fp_CNOL$>CKKPd8-<qja{6GTJ{ zK#2piPYg=TzSwC?KY5WA#~rJcb&RYK*b^mf z%$rB(V?-^u22MM`Fg>4GL;9^IfThkVsn*49N@1LKi&$D~6ndj~TlE9m#9$>y*!=k6 z`rYb+nqn3=-oc?$P(t+v+vB?HWd|%CF-u6YP4?l?Y&`bu7M@4bP_^s$q#cB7b-h_> z`9yva5$W%F)0V<=v4+OVfpJdc9`B3i9r=6g*FzMyM`O-~ov5q}lC;-BQx9Eh)zr1u zKo56LxBVq$y@U-z!v)ofvdHYo44@S1cC9{&(Q&GFzTvV^DF+Ln)(1m&0;lBA(LN^@ z<5K)Y%vU?set%b7*VP+sqcX@{Mg#`B?Vb!2RLQ=xt|h-hN+Zd*JXzuqaVtym(kFRWU+Jcm&T1h z1yONIpk z(e)E`9IDwe9dkwyDC&OF?rE9sa4-O_2I~6nqyBht%;cbEfX{l=pUfwBUBJl-CHA3h zX9~ZRvTf7dYFUWzukSVr5ozNd;!O_CoPQ$O#@+v}N&noxcYX{ktPm12n;9f5`WKoo zDPo+DX`L{lp5MEzjA+}$}{iH2l zNwl$yF2)2Kd+K1q*w8T*PyWf4gyThF9&&&Q8YY`Hd&WE;bT!6nPRC~mIako(^ zgITfQx}T1DqTN0>1PA+Ziq9YHpI8SL$2E^~CX2IHS1Bmmxa<0^-7G_P@45yjf}SY$ zrTKS@^ig@XK2v91uH|G!IY~28hnFFC*Px^Xy|DRq=0k>CC(+W--frB~y-hD5MwR*F z_{mn>iUh*zRa#2xT^rR$)WhNW;~Oxc;2R%$7af*4RlI+DJL_;R5E>onqaKacF?$8o z$_PCMc$`CRMTFj+2m*@wVLc81ar$`n>SM55Qy6BurDQ5dSj_b z%ZIsZ9brBg*#b!`FePHPG}eH~Lok^}k3A*jU%yC21p2m=UsT++jx_V61)%;AQPH17 zTyW5(gFy+I4)HzL*_P>|Uz<^@#V+^$4jM7snn1*GNDYpS*TZ?(h`M_%><**AYdmfe zFVcA2w3$R~&~;j?h;mMooJSLjj$+<;RrBL4ct^vgJ24cZ7}9qR0eV9d#^yw80z3-{ zE3`a64Nb^1d$P6EZU9RBc^p7RWFEFL_=;m1?QXpB_nROUcwfNlrTF5(tf^-GRn%_v zYb5@?6DhRKdlAc1(x_(;TG*n#5=x#gE}9c#bp0KvLcL$-T?do4gYE z=Lmg-(c-QIFeb(_(WnS8)?{H;uCf$j#t{?Ezyz8OFSC}$ZNgC`o3lnr7->lo+D7n2 zZom-NCl+%z87pS{kUK0Xx~>A#o|3K)&M4nshDh$8>M&aBQ z;X{|=`nbzZ^j$Af?1U^WFD0lGAX+Tp5GY^GN><-@v(SQjA4uF1NnHduHas%XoqC=5 z#kgyGtz1g4hGuU1g6aV>WD9DoX@2iFJYfJAwm9Fe>4^Os7EUE8PXtQ=V~rv`yZKyS zDiI7K)P78hg+!`W6}a2!;(k|LUoQ}s-iPE#k%EbmwM_zO;~;O1Mx;7LN6Kn&3upip zadT`0VzWTAs0pFSQg=1~eAqaKcuGS>%disGckLY&5&hR4&94JAbZv@X`yzHKieXmP z94o`Y7@a@!NjwJ3#q-o)ICMJE4u(&6bA<_X7%*Nd{gV;c1kruchLZslQ7PWlIDOv|K?m|Srh#-J%c z&}Zp!BXkx~8tZxs;a1>XM@`m|y*dDv0VIbL4^o>Upth9IS{sAw!fk{|0}Z2DFrjdP zmeO6F;#T}rC(t&2rZK`*D9Bwr{(2qg7`qrp4`K{Cf(1W;g*Y!PAY@1cQ>64MCX046fUO?s0QTolaXCae7aS1dVfgFBvp2 z;6Ka6w$as|4jRK=o5i&yl&V^I4+vZubK<=LnPLmx%Rpyz+ooBfYpvaB;mA(~D6HLD z%QjAEf1kjdvmORmqzj8R+X>O)@L|o)+0tbTgWt$;?m+?)>NK2G$uwdYz|~>Twy_RE zj)~OTg`@XfLEL(U5Yt>^L0)+OJfNq87Sj~O6R%FE@$R=$O$&NU1->DwxXJ}}2940| z(E?4Zswk!;M+q(n=_mB|Z!)nrk~fv0hv-%GaTG*Iwp(V=*~U_WFZWfNEk|*H0xI^l;ZC zfUa33s!ZGQj!fASy48*7k|i-Gv3mRSQKN!2A3_%fX8$vSw#omhgm+bZT`e~yS-~{} zlfGsI-HOIBagR19@CzY|VY(JI1Pq4I!R|zh4xnySY}d>0+Jvz0sS1P!ySIiHi8bsdCcKbT$>(Gu_a*J_hINIy;oF`{U)I!ao4S8lq zcH_LZ9?G&-97iydM#a}qk8DUIptdmu?MMJJi`95#%REAXqbASpHJ3wxOW*H$S6&=J zX|_YBE+#YsOeg)y%#!5v+s;PCyqM6V)a}=y^}9E7OU31<7Om1OL&3HP+qhL~rn~y- zO?&Yj&Gf!$Pnbr)Thlqzj!@YFjMUt;8OQxl(~1D^@4N3Q(vZQ>Z3JdRBlWG6PK_@6 z_6xqC82va9@x*cGs%-f$2944@?++WSrSN*?WikS|IRKS3=oHqm8#fo>d_?&tXW@0MR%^?YYL3_zfcb_d7fwuU?)#HfWcYn8L1!0*Y|g%o9vDp-GE!R#xYovU zFJqkPwWnU2A2@I_z#Z4Bm*!Cvx^95~8p`J`COf;j$W|Na zWhNR_>Wo-b=_9LXoFHu0DF-8(ojdiuJ0O|^+rEGQjSJ?uAUCiwxZkrkVgm{ z>_bscG-AB%3>%shC0LP#2_!LrQ^#R;kS{2ueQ0mn#C)z*tE4p9(lrR^37~0muC`2b zbIY`!_Z)|s==bV?VZ1c^C?!yFF(ubx@B4KkVmB0e zm|BIV@H_`QY!+pynm~pBPwv~0tMw=`L2D47PMcVM-eCg_JrHSJ9{YA8yG9wv3@ftW z?{C5Ndf_S;-tRlR2%^JEqopqI)AjppHfZfu;Xa$i#&w|^FJ}q>j6f-{TK@M%o^jTh zEE}(84SxT=IBE$1v}>_u#|~%(k{U-ZVS`aX4#LKHaa|+g<+x!dB{Pu9{FYHwL|@1S zX0z)krCCl6r=+T&HQiIfsXE?cdjNq)mropj{W}awKCU!v%KHZH+AQRVvkq|cih0hK2D=g#E!3z^#G_$`&rm~k4(~0D{7@C z1b03-6b92qQ!=UqMiaBxf!{-2T?l>G8}+{Net+Zr{f+Oxf8!F>wzY)|tiJEi(V|I@ z(o^#^oRU;KIt6>;r*`FjJFSbU^4puN(rTG0rWdBD3hfD%v7#DiTA1kYp)jwcz~(HB zy*31Y*Be>|e6{9d4P&A?DTPWxq;Hm2$`i6WW{)G(`vv@Cvbw$ z&yqKCUF^r`YW@2AH@?1p;kpXG@Aq&DA(vK06HUY{P4MeCeeFSFN#wfO0ClntCHYDK zk0bUbdioJE0!Fc$&MBr-k5SCVNWfzPBBCq%5*ZcEvgGvpb)oy$lCbFFIocPIvyk=x zg_hCQ9-!=43eAkcZhR2gN6k#kERxN708K)|6Tl*xwMp6fyS-L6!r1+YLl---pxJZ_ z0srF0rd$SAN*}Waw#n|j2vEwaq)eZ@mc&s|9CZc&Ynd#6-;652Tbhob>Zav)ibto7 z#diM8mc&v&xk>BsX@`k6juxqSyFNvL%UYtvU1DyuC}gsL&~s&=C6>rC7*qwd00mi} zlp2f4duT%Xv1$e>!PU5)z$qUNe&DnL(Xq^LzW3&=9r#{Jtz?e_VA;!E_V>q6LDgtN zZnZ4zVV>33v<8|AkZjg-cFY#6af?4xX@_YQLA@*PyMdGY{l@!#s&*U5X?dU}|yKk@)5vFDxTSr&#a32dK65aY|ulN+Y&OLpd6=g1NK}$n$i#jV0n{ zMP5XOJbIzdri7X{8x7UFn&ojsZKu`H1z6AqU_$9&f2}5#YGsQz3}_{y~fW+_e0da)ZFQyhP2w4t4|s~ zG6mzN4C4<6ZT7h9s3*8+L|3t90!2}IAO9`)vgGj{(uibXljc*|BuZWZ;k22})u8BNJFkERwFD)OG`yHrAbPV*cEtC30TikM12k$KsFb zkM{iQM&si^oVAUsnSy4p>SD2V^5LbDR|JW0!HC#g_T84yIB`yPIxtwxoUE zcil((NA`s1tUY=9?-awXWXyGQz;SUDB<82kq}5oGZ3AEs zk>;i`7HtK{VWd_ijgu1F=!birfXg&Ra*~1iA(gr&Fy1p|^IRf(BF38GmfkDp1c=mO z5@0U)`o;M5*FT{DXM4?8qyg{RBBzN<61RF-4x)I~{yqRgYa|vWuoBo}lB+p?dVH|l z{j@*E2I1l}I*|BkcH-JPXf9^6odx@FOoQ&5B&ElS3pba`dUnK|EZ+HJ#z+fNQ*9%h zyH?ZEgbrK#9aYiQaZ!{2UMvMvR1zH?=jXyQ-eT^Ht|UqtDco&BOaM1L~{Y6hB4jD+6*CI zeoeDAI3_pll0?&U+_w5oOhykxoHQ${dx2vT>e5DlJCAX6U3e!Dg5CQSlUp||Q(t5W z>!{)oOP~KulXGBZ0AhE_?9z$jOrp~$a1T&Y?^o&tqCKEd#lM7LIbQhdvSK|ZT&%5; z9KfqI#^4{X)*icH)IhTM22#bx>MiM70o+P>3nh|8gTY_{tfV0oG3;!V-z%b(f72Y? zY?T?lzkBFf=~^R#;`{Al%;w%usV4Mn;6~Mg+5+HocHJ{R`u%-ZfEgDTJDExv5s3(j z1z6@zo5nCJb6<0NDJOEY#iS4|5*)P;Q+<)4%u zC-tFq2|)lZflcHdf@eNBRoqo^d+4u>HnapxIbRd56Dp)eKD0Um7nham0$rtl4!&kp z8RFc_8)6}7ItI-G&n~P9sc_MaAXakMPRiOtvsA^}W$mIU+)$mkOCtjfrC~`f*98c0 zo6h7aep;6y#znT|jX6;aZLpWsHngU+p9JsCM2_bcBhj z2SB2Iv!p50BhmaCHYs!c^i8(tl*AiCoO*jQhC4;kqsO~twi=a0ZSI;{$c>X|PQ*-wq~WuT&vnO~?8ZS$T)yg&CeJ~6 zngq-{?Z$4S`qz7;QD1}(P_B#c*Xz|>FEowEDBHTkCMdVvE>&RTn+bzZzE@MVQ*^74 zBH@?O6_SA)#X`ZMUG>M2YHLtwB0plg&x)XG3-e4w678=fQmb0%zgXkrnqhZ%WA$`M7R`_K5esJ;VIQY>aDnA}(s?@Ev$*)@% zl^$^O(Lobas`Kv-*RJU|dka9TaBJ651(sm`s5g?}1hU5*^#oo&Qj%V*=~fuU(xr!s zs9m&IYw&G8cqL6Vm_|X3m-wjkg1^3r0zEy|QDTo=CsR&Wfu`$P1C2j0$MtHKug1I> zurUR29N%~|F=3QY&9N80`*EniR&C8@Rcf%os#}8^;wvr$6^rQ4hX^K3L3YVrO~KI; zg~fh~fF_lthS3tk>DLIr!~lapg;wDz#<;;hR8@83`iQW%Ut3X8to!J`Z@gZwwy@c# zswc&E#4ZCQ&~Uo+=jgWM$S`S)xE?S}&5@G>-~#(Xgzw*PyuL16Ul+cA-@_3W6uE8u zGOElq*~!Bg##$ny6>+Xd-;O%sdpkRUuvWD1rVwlQ3oY!)%!ushVA1`I`ALwO5B>DG z!LFbq0;oJsUR!}z=4qLP=xHz$-lv14Pq+G*DY_kVO739@(V*E%qd zSu(!HP;*Yr5%=slDGw!b zwgs@(0Zv5sY-nt8k97<+6bMsDvSltg#E#kQ%&p=@x$Uu66rt^A_3GmS%%^@zT^S1C zatf=DKFC}sGA$pJ7#asDrIhw2Sc0H48TGE6#qi~flidg1sWY=F)P`hj{u#o0B#vLE zf<%U*$!11mw|Bdc?ZP4>uO%YW1UN#Hp68orOe0GhQCJuw6J#AaBThUo{<>^7#vYm8 zL^d0QcrS&W;-l_D!~2>n#G3y-vK2DjL@8i+6XLcAAT#-e@9#IRt3~5Cch9{2Xa}%S zOiQUfI%;2X6!fq@%2JZ)fNX@oQcrf*X-=C9*fb^ME^<*l2w~6L_tQB0sLs#7n?72L z$8)2Fbx}Mq2>Q&dOu+q#fmqzq$M2JE((9?SWG9f-4cPKT&r`DH3{bb=Bb>fe@$po> zWny&yy)Vn@I02J|nZddN&e#75yrk=815i$2XZL&3zghZrGcr&=G`9QBoSIru#DW_Q zKolZSF(I$zZ*lR$RPOD>z+gFgq`SLxYHbIc+V+^4NhRXGH@Mg~p8N+O9oI=3Cmlqu zKLsi2vzkKEX5p%X4xS4RgAQ`k$=LTZf$CwEp`mx9P(I48wUpK?MWyY1d|-$i$Vsp< z#{f33fYFde)4P5Q2;O1LXA(06+|Etg%^HN8NPPpv0kV(+=xG&G#M)8K7l$QFNz6cxhDyv!PT~L3L1T z@Ar-Jx>~EVCk5N6Nz>*vMjsUPEbHU%!ATVKDRcu^b9U_a`)(lRRq*|Nr;EznHo0LH>8N9xx;I}bXTyU;j;lq9mo z*(sJjCz?i^|JL;qbZNS?{pZiu4J+A+mTwvAH5D@U7H%>g6$6k&3!A&UBmHxTy>`BC z$7{F=eI>o0ZY=SXUn0Wgg?lOrA>a1z{>F=COt^-?g;g468ifc|?!Niuz!xI2cf#VDs&6W~Y{aA^p+RvCqYo-tw%SE#v~ z#)qoY0jV^a(hKis{=C=x1Vx*;hzZ4Z8z`BZNp%w;PQicA6u?m)Ev0I9?fuP`8ml2l zO`-4F#%ECIT~RLTC|&0hIB6D>8nY$A6g>-)6Wj<5(kpWkBjbbi1B&-sAo@ai704~t zR*l|}+r8OI2Y};gH?b)mXy+QAAlUTlEvCqhVm4XWt7sR_E|xWImX<;>{X_)pCQr#Z z^EAHMZOU5~0_Pdb3S2@`^JgMszZvfhNy~jRQ_0Ks>HhKc2d{5i{HK|X9BsjSk?RpC zd;k*LQ4469HWoYGp8(Akpn!ff-kBrnm+v8SU(U&()6Z_lL(?_M)YeUQNu$)^{9{kT zrXGl?E}p#wV1e8=cJ@YI6M{y4NbGoxpw9IQ6|4kxY2 z3{o_VOLTMNIx~_AUjKCbH)jI5R^!n9qn??vpOa<=#LIbu7D?~+{@2<*H2DFh^4~oN zvQ1IoV`AfJ!ZX{(4AKTZFR9v+ZInRVoH%3DFbV2hn+;KV7sQ8Yd6wcLCbF7HX9~Q>(W#BZiQPy1kigbOUX{Y}okM zi_O(~O|&lh_2C+d@!T#ForJZTM4q&KkJ4yIZXrT(Y$G`@%r0EEQ5mfKP((t2ng8A! zg%nbF65zG2$uR+o{ zhyti#F3nkVa0sH84~7^F+K+KkcUg?-kK>=fOyjBhhpC+?I^TiERxtlUx z1ovG{moi0BYZl~=EE9BwC8_m;6D8_FhJ$3)jfj^LZu)B=id)`b6qKs~H*nYYIwsn% zDS8?kXnrlkt>2)#hCnu!%=YQWX!LDDDScoC@@NTk+E8^%A0JzG4~xes0hM;Az8yUn z!FqhYnO926aN9AVi^heg@6Hm+}ouVH%AJ)liPoc_8kykVA?r?Ka}|)G$u{`Ximm;|OI-_b24=I2P~&$7$onF*)}1{Ua{X`C>YZcY1s6 z0i4jpO43x_eiD4f_lgo7fvuqMX=KEqarKF@ST^eqOw)FAp8$%8v|`kUjo}17b|TrI zx_5Ht%g;oz^9XDQR8pdi)s9@@9uT@gQrc217Ms9Lr!wRMcU$*NKj%r$MAY(OEQ-8Z zehQZY(Yu4LQqT`#ObpoQM`12eYTB4oCg^}hv(?viiwZ#A0^EdhUAW5C*U=eFp3CYTAHo}T~*J+d+0Z(UWf|T?>)BdCrmJqN8oDl%^o^u?fYSs!A%DQX6wj#@Y6Z=|a`o-85>YR(D9I zje=N&WLS#TfI1^moBeaM605Y$M?!KR5JKKeEa`<>cNJ`i>E<#r_C}^S-}$>caEXb9 zuB!eZR!pMOV8dk9;I`V^I5h;75xf06sH=6|E^oUrMHTOQ_Zn;m2T39u1+a-V2`$UL z`z70nk>c=A@%LeIO%d&6&BqncCY~jt*3T3_hq+~y_RPr>o5E~kJ|S~NVF4F<)I^L; zeRVI>)J{w}VD9luv=iUy3P2X7;8}YTpYKx{-ZFBUF8F<$@VpuRMC3Ym;CyCUK5A4> zqbWKBtxerC@$`6PLv%k9da{$wT{ZFb5)uCX`|rhV^3y*tm~hsE>~u+Imyd}?4mv0Q zyG(7p3o{(514LSOW3AG{Ji87By_bm4T7Ijj?I$J(Wkz8ght(?P*r0w0>lsu8NWH-z zkd1eI?G%w#`SBk1V=}vNl{z9aOtk4qsm(yq7#C(u z`}hb>4x`W*dq3Y7jUA#cEFe+bx4T!Z#?!~=HXVRuB`luy|lN*gXhesqlUPB=Yc_eyVWMfXp^j#ww zzh|9bVG!bG&UVw*D*bbt6HOH@E}E|bVnTi2psz+(_RT*CZ@aZRygwcHNVd4@qQSrl zkaV@~4l8!PF-JmXh1`nkb)oPJ_xp{QD3-DnHw(z_?+)O6y>lRvS_d?Aa7;o`J!&8( zVeGsSd4__{ry$?-%CvCpS(Yd=j^8NQbhN|~iixgw-viAj@nDNfnhV`6lHGouDcuAD z!q3ln8KG-_*|_nbnOVOs+mX%g^Uv-b|9tB9t%(^>W2=!Vs$6>>iBs%7D}wUrI(TLX!p zH=wOwr3+`HrCzC(qUQ0BS<6G%8=H1-2vGeXRa@&lw|1X43KFn#ijmO3sI>Z+8?Ub~ zJ9u;7J91znrRUqKQhvskJ%W>2cm2l6%d zRuRbe8(&{9lbLur2G`0GM(A(X!w@G8n<&!-wCc56^A=oq8T+#B|!ND~8h;=T87i zJ29V6wKIDXfoT64|4gS59|J`A=YRckV^#likaA)?ekvk%qr@j5GFzaxT9m^5z*!Yd z2y3BWE%;Ncs)GP&;~to1r8^TrKy3z$!o$@=%CGj4Yr>afUsM3>4qs6>glPhj{ zcjkjj!Rxxx7{|*5eS>YIraaE*j#z)bzkheZ=dP=09tFjb=n?4o?45qDYuSMl?{RL- zzDH}gb1^K9L`TL4nzLCvZkU)m6Tj2EJVqW&hv;itzpKsq)zkXO$2zt9fFRS7h$Z|@(dc6%4*Cg0Y;tDgSXh^a)=VSrS8jxVAEwqfHc4MKR z0F);^h%?Oop8oyczaJO!p8^&7)E)Hcdk|_a9vGINY&`L_Qmgi`HmV9jfm;5B>k->~ zVx4e0I?R|a`}c}MYNmm4AXPhv`N6bzz+t#|VoBg_+BVPbkXljnvKkPJVDAjLsR^rs zM4%>!?P;j4^)tzUNbT2JF_#c=ZdqQOFRt0x32aa9pC5t~hYSgvNOS9W)|0IK!qWw2 z4a*s*=o8cO2dp2uNH)|fC-#65Qt2e=P}Jh*ePf+Hm-Ph ziYo0CBfnu&Om}CEzfR5iEK~Yo>HjVpWT{J${SeYRSkiz7rnCP!(bCdgB`HjHRJ}79 zo9_!Ae{V?^J+1*Gv6hfOTg^a12Sw6YB?0bRP)ZY`HNo%*X+tV`)83XEe(8oa(RF+l zF^o))1BBkE6`UZ{F#P`gjbFch;kwXLXEB|?H$GPi06^on>2Qzq>sV}L*iTBdh-HcL z>M%AeUKFlr$^km-IDkhR?81g%6_M7i5!@F}%V_rh8R{PMYGYy?V z(MV))pRmzlRXmbrfClAk~82>_8{u^~=m6*=sF!-$|`Y2_bb$GNq22 zbo|?azz-j%gOm2Q+A;k<1t-(qBqCNNquU9CTfL8V>`5QfM?47Jf`;?Hzo`OAB1EUe zA~ztgzMAQ@=pdz(G4~VuH}@72Z5+LUab;8b+wa(*voXW}-XqJ?rj)%OQTx!N zqA7m|(Q3Ip&E6N$ta<$B{E(fvjcAiZYG{O+77^`UQaL`8`SBEc*294hp)n`jEhBeg zfk=^uIjOWOJZ5z4APauyQBQX#P2&X(*WzgO_0-_;y}y6|#;?DA;ftt)l)kysd0Y~; zA*5OV(f^x_*wp`ioF=Rf$G{ZfY(iOd2dofHwmX>cC>h zO!Oed{!hF(Vp90vJhGbV2J)d`qw$zTx~i@p3qfJweH)`c4K)6F^W2Jb51?#KuZr zecc04)Cy<`uh&}k5V6~V=uGPj?K95$&_BsE1 zOQWT3RdzjG2OHioWP?J);zlU2=ye&D{fsIdLNy**jvVegVv6PGl80=@U(C4v~28uuN#Rpd0cwXBy@9y4(WNP_M^j~Q@#{0iJ~p!r-BsX%+%oPAjk5_0 zJ+k{yCtZQ!a}wWXDw13#+IxUt8k!Ruqh095)*^{ui%uMo4i-atxLs|d9v}OJY5)!S zHq)=mC2{c9WlHI=sTxj$2s(@hXM|V%WU&D!epA1{->nJx*O&G8=*D`QH(=kCyVl8W z4hlEg3^r$wIA+}&5oH=L4TQWO_vGL)-E5%qsOY1O7QET0Hk$@cSsgnk%I^8i%!Yrz zrmrdOK?7}U%`v+n&);V-qK{c4r!m))_GE1IA8f^-^LXdLpqw&Ph=Bk4AOG(Vaz5CC zXAA419pTTG;-{RJ0Z{a4Gd=;7)Axe+c`dH>=}WY>gBTQ`LMS%o@$0$c?i=pJ7JnEd?=f2W!g|Ll2>Vlq|WYbYt3$Xmn*o zT994owqCYSIZPv`F=+|Os@@zLbv>KHL6zD(@od6ptH7>RRuDvinVQ7WGi$Pdq7F{> zT{uxBtKmdAgOho|yWdSY|Mhy|{eDjx5Y6Md{uT{~nK(P-cJ>`TZRL%GQ~8&s&2($k zoirZvX>KRP+({?;rvIP|SecTO?m{;@4_>a*r%irlR^sLs5&QD{Chf_N3Fz=y^gv;g zQ;oxb_6AFjnm1u$;f$8d<37p&*PN3bo8qTaZ?|kG?V6lBb6-xg-^y_N=&LQD+8FJwWZ5Ci;|G9 z=2}8&|pT_4U<3%G@avqxUtm7I#EC7eLYk z=Ir`RU_quhGI=uuR+-6mIztP-ZAGq!51n<1e6L5pZD?To6=Ly;1Ak3trjA zH!AI#VN$$G;}9hFwK>x{^$Ae`5ty`(2qRA4uzLfqEts|5K@&wFOCj$EMHzdYr`D2( zz=df3$g=c!{;M>15sKx*9JCw8IB~zO+OEY=Xa#P8nLNf`EkD$oM7Pl=4YU&%PfW?j z-xYxTr9n~VR8^Y=Y40N#$*I}?DRF)=(feQ5)rGVaPDD*mGc~Q+X2FVS&VFW7a^WCb zq`mg zHhO^#Ejw=t`~#=P(+Gt8^*@~Em)@Nu#9il|5jc%SZ@}{8oG!-o z-kmPM%K-`#gc;ZCf|5e+c3;1)7X*z>aex90;iqSM@Qd(z6_giSK&Rs9hv0H~6{$ ztu0A5sGhmxBs$gHGcnJ1$QJeMYVPIxzB>(FLZY5;WceCaOTf<~AN1IH8lum>x3}^D zfehzPFYwX{NYFr0k>a-tC5mQr((NJ%lyqf~KwJB8Ux$3*ptJ4-L7Ow{Rib;PvmpqH zirX=fPKWi;fJvL6HwyW|YK|Vc1^0d9x-J7OlL|hzbEfyfP7L|FZE2Ca=gV2|pb-#E zi{De2R9y0EtteD*U9S|%G>>*935h8+AjA%wPoos}+?dJMoP?RWibLZI-o75nsW3Fp z(I091CO3b>$7~Y>Yq1(Axy<30(s)ycPU(wXlTKtXC?X?uoCsp!nrzYoxhueg%Q}CGr`y{5 zQIr9uUN=LeKvmr8A*NP*NDaieW9T#{YU`M3YoKSRq;nDW|IP;lPH-9kb(XDuPxEUk_+R!QG%jib8V@6P- z(+nfNjvDI6AuSVxOTjJgA^gGwc6I{Xd8DIxQ;MvI3uL=f2f*ukEnt9m-cjgw9#ij% za=q|+U3lL$wGl@kdHRkpb9_WEK#kDUN=-i6W;`p2ff$K;+`h z9VnU|SSN;rKQk79;-CNgR~sArLDTT=amNO!$I;MFn3?!KDB+JpvOm$zEIJT7Y`dM` zZMxTWS=2>Ap$nz7zl&Cgjq{U!#F($*A$!t}dl#dpp1)uTwC*Ab46ek(c$IOQpG1Vi zZai+fa$UV|#z!2x*IaO=%|4C#C^Jj0Yw-oM-gnDtVMev@yRHjbj1(}GsWm!u6as6r zCrVC+ky@U+!s0c4@zoe2#`3(0O1h5Yz0lsNzw%;=jj7NHz=c`Kg9n z6iqwP>h3v>bmnI|XPgu+xtI%iWD>O`)K;)#9&5SReKDN=yZJ zM(x-&$de^lHxcS;&8WD@=Hq$1wbj$~yc*uHCz3}#r=IP+X7;X;hd(T52 zR4o4s3uAg+Pq`1wyg6A3ARIK+C7Z2u9)JB7%Dbt0v362V6^r{9N=cpWrlJS@QO-`!RX8`naoOle%0khafTt(RhIrqkicY7))8;(C_Q0k@mctfy@0sDbi=`jnvNbsg6Or46dyKv> zieW=t^ICQak_fzLitqkud4k=g>BgH}GVH7ubyv=gz3AH~9iB!ihC^~pwH9aw3PU{t z`gNJ3M|+5x1I|8bQ*===AqTb1Zj=Z#VpRLxv6@|J#vFYk*yc1_#%LZ)% za_}Mo-GLJv7z}(I-S9zUF`hpqecQf9AZbeCXMjH&J**&0AICd8ZOxN5V+J{Z;$MFU z_T&!%%86O|1WQTb>^#MO~_5AeTnB2)@K!uHEs4@!l%%mZrja|K75V28DZ`;*g zMvGu)jhnfDPXidX23U-~Xv`y`zQL#K!bX-&WGmr!x7Wem;WKUavD3(bNo+(;Y-K<2 zpv8XlpAVHU;(*M22*7(-(I*eCmfnl^#D?qxf-`7;w+lsO2e#%!h^yj{?Jt@K)tD(I#QHlV^Z8rr?!!xN-^1nc=- zL@h*4OGzNaKX(q_zjo6P;i(r8QrI(z(8J;x;SaXy)eQ-6G#l!IMK`C!n2A&xK3u@aq-Y!xD^SZJq=f)>b?0%i+4h?2K$- zHj>$uu*1>;7({wdurCVSy)WIbznchX-Z*s}=N}-?yn9k|E%idJ{(gommfB7pR0_1V zo9TL$7TQ;3uvFfFy`UYZ+%#PmgXz$I+@n6)d2MIf*a&SgX_=m#Gb799{jMk%qe#KK z%IaRw$fQjFK5{AtU&6CL79cjGXwMeevcD1ouAK7UUU9$ z{gH;{lg-%Ip`SjdKLI4m<8|`bG$~B@^?IS2^QH-93z)73PYQ#n1&F}{L}P|h?Ae)F zd}eCIL}xP{oHTI2WNb~hvJdu@8~}NEq+q+@Zp$b8VZ{Q_VC+lmV~HcAFsiIo%^t1L zYVUVxphHuKUWm%~k#Jx+B(N%et@Iuw-$#>kcmMxwj9t?E8$p_S>_?O#922iC(!wTM z@yi#1dY1r_rvC#-AyW_sI;Iy4?sO5mNM>J5lorvgP9hhIH;ti33WZPAlTy?0g+^;} z*gIoDQW90px>sH^4{#jnZ1tuYt?1_o4^2a)`Fk}{(QC=xkHh&h%LF3BhOSdKita`x_)6?a5*6a9OGl54 z%Lzd37S1`Pb#dYLuH2{8Cb*8x~H^8mZ{(b*h~c>8W=Hirzt zX5RO=C^ZPVDA2HJ$F(iE#iVB*wAbcqRTVYyt^F=*{v!o&m2q^QA{hDz$;U{u_REW>BnBaDPf49jHcX+RSVyCyrYup)C3lopc@6pmVAl<( zXYk@k`=RFj0Z(lIt+5U#+R0of3kXqJ8IrK!&ndQ%0lP&(T5(+k%!K={Q>tjwr$j6F za&k`M>2br;rnPx40$a-3Hd!b%or>nov;*%QOS02#EP~ZT9!mJkbjN_`L3?u0oW#-8 zIf{O_c|Nz~u7PKtg}a|xeYfxb4xIdeLHhLP{e6$ko#_#vq!GqOZ2JF;i|2ncK#4Rq z6QRD}wk|QaTox88P_594p>0rEBnFDs>Eef`$X=-Cb%Bj-V5SzFhIXRyOcCn$CTu)Z zg9dLr1|==y7=cJd%3GPX+rG{)d)`aw1+i{4pi*!ZEA?~jq-#@ByEiR5ukv;EgSpuI zq?4nk?Ily-WcWUh-kxiz3)Rb!=3Ix}0=tfUvNk22$ePU+BlpAueR`tcdWxJk3e~Yu(iC(S!HPRt zqCGg;Ms=>TpGPSgW9xMfW{7rqvFms4NSa>4*Tk6Hd7wV2UNnOeP4f`U#dgf4-I(Ng zHwDQ}u7S~D?ww3BGh>@R9aY8a^=fqOe4XfNe3PwZ+1fg#n@*Y%37gMd1+S}sF2dcx zwkJuNSe!yP$y7Mpet8ZP1nCN7W)Ue(ImCqh#(l^<`HA3jCn(*;yZ0vJIZl2zLOQf6 zZ~q?*Ombt_B=II$mZCmPa}sNOP5P*P2s)iVe1A?i&=ws22$;+_Zp`SBoa;lhuth)F z;P3RY_cD|gpV(>F-62X|0M@wC4#ilQFm z#=)&N1f*T$+DAOv-xjuhoN|?wRnW<@oSX~cHTI|zhJb-O^mFR@C2?XN_sWf?BQbyB z>n`KyksNV0LfF=cL=ZCroA}v9;D=DU81KVa)3O69UgyFAP+oi1L;>vc8r;HE@0w0# zKEHB7O+K~JSxoc9KFk*}Q_x+si-TNKF=44Z`Vz9w3* zKo6DE!3=@6^PEjF;O3+jjfi6HG=o}wsFsLece1g4e3 zMvabfP7)#0s3pJ#$oc0}t_xqk{@RO&w~KyGDjkpAc5`3oC2}Tynb7!r{1ozjSG-;q zUe2U+J8?NbXD0kBDJdJ$%p+NVn3LiwLCniL8BNN5P zsP$7{&U|P&Ye*jAODgp=>J>2T&y6K20367`bS9~F9ox0j4~{vgZ@mtkjhJ;g5i~IImN@92 zO9UV@hzVUiNmTog{`~}0+?>J0t)<#ehF#=}yrGT-g}{aJe%E#XQ#CQudI*_2eC8W? zt4;C8vTmBe&Pe#J#-8kco+kAOAvGluO@)9uEvTCqd1qK?^BTtHj4U?vn8ckI6*Frw zURS!RPjkK~Orl|3+>er`W>G@2lcnzp2tQ(;Qm$T%CF-ooZKv_6cZLu4n9T+L>#x5y zlc@cv6>$-mIrvGV(p3ML0tY=xIZtQax8UpRg|DxI`xXm5n>T2?7JV5d&HO-`Ym%#A z=7QsN5O8puZhl%dPCwlou!(O!M#0BClnH#OiA4RJ*K6p5HXw^qDgA$YJFao(bbV9Y zSa|_3mUuC)(?=l0lTBLFfni>Z0s1h0ne{!gXwaf|Ms>5n>W(o9M^t-e^{#m|LO6nf zKV?2n1%H2%gOX7BPeiW&0c)~qf4s}+LZP8Csj3jI#`cvKXHOTnw0liUo0mur1&u5U zulvkFw28PcMXg3)V~4iF4v0iQ&iT-RhQ{-tVY{dDXQ5_8Jk+Zix~q@>8Q<~%jGVMMpM&~Nnx8q)mw7dlBPsG(f7MZ(J;BZI|6KWfW-eSP7wu8MOo zZ}3pX4vRq9(x%pmC*dOZ5JKu!zSuZhtKhl{Uax}tzEQZWo1X55hwFdrMgaSfr)|m6 zEBBgXy6q5oZ2Je-=*lQ$SKi|Y>cCng4YTN?$I%U~ygM0w z8ac;X=gfqB+KFNj=(zVhxM~@v5dN6?*#FySrsYRX$-zzdk;(cGSd;aDIy!R1wS*=# z1rt=7#TNjstAI*@NX12jyS|5A*CW#>+iV{p%(WT1c3KqXHIHaBQu%x-=&C{CX}#M- z&;JbY=wnCO?mBmn!gHGKJf`{SbJ&c2cw$yIPbTH1l#tBp|8`Nj8CDwBXVu(0ZjjR_ zO%#)nH*g&6&^cdXd$ER1WF+a3iE-D>fP(*eVQ7ew*msxi$*wnW5h&4?0pMLS=(La` zSj)h4#wVMbJ=^B;n54gl{k3wlizURnYtbC-v4y#H>4cI%Y(V5ZD=MX+#*;~T!Nn-U z>TQsLDFxxp%m_2#*VnIU^WTlUCI-lXG>!V}yy0rr3{n1R&r->4vrdO<3yS+Hs4`N0 z)zxlIL6EPj19L(XWulw$hlW{j&y!I-J5aD^q@Lctr+bS|1(vFvX^Pi`s2%~x^4LA| z(oTm{N!pqsh&|i*a9WG6Llu9tsHUTs>VBfAAM{~Q&$I5vd#xOB)qCKNGe^#&EB%iE z%E>1EpNwxljRlwg=2k<(t^Kb%Q3%EK9t2WCtvA@5h2?5rt5S1NSakKcTg1Zg<^yLG zBF`)Y&7o}pgnk08Cor~L*AGR0C(yGng`{|#WBuTH4u(TMhO0Rc@nq<9fRA-0n%mi( zJ<%|QnLmpQVJ=0;0;`dA!fBMzM?Qsz^=NlGe9)hqoGrS{*hYwqcaZc=U+S0z&KsD$ z_?_k<>Nz-4tQ`==T!PK>)@jnP5p=~HZNy`L24pEt8&O;|zp-p;Z#yAC7NDqjvPo0k z95>?xooJ0FU@BlO{c~>uu?te`;4;F`a~T5OSseT8*I$DX*b{GyLo7LUCV>}_b3DR; z0x3@3vUl3e69wJv@v2G#DdmOteRoCuGOvzZ28mSO0KF}HLd&?YUE2?f$A%I3(Q-DW z^>zuj2Ep8Xf9Pa8PG6h)MW+9cWqu$^^Y1w~1`kZm6IM{HU@0a^|8bWp(R82bGJ%!D z9R4(CAJ=WTa#dEl@FbEw0hONtmj6{bDEpK2zr&dPRJSyjS&oex*2Z3es~vubjg6{z zV{^$;PFa(v)5i?8R+P(fyXrmmt?AmV_nkJ=3|`7n>-6c`T5Rh-0N+0aDN8lVhu;?? z`^UJ76OjIs4xKrfw!3oz>Cw7`HnH~$b2&b{E5`bc#boRjmxGY$bW&nZ%0{p9Gm!F` zj^Yr%8OciyJOPARpN5Of$1(SCHWKHx4{wDhl?X#ZtX<}x}M3=t>G zW~a`avLq<-&&0@NXl8Y+&KX7dpaTjU$cEuz10=4;Axl%-_2sA~-_F0|_4;ZjAw4q! z3_1W78$Cuk64_PK=DMZTi-$Hyzs7meK+Lw*c6zJ0F2?)&ZMVocu{6-)?{}R7&8!)j zb${;G@j0%q`wpAHm7Q*>@_aZzbV73)9ArOX6w>D2L6E=42x-7{XrxBZQR=iV0gzWf zw;?{W#m@rg}1{rr93%}8X4uD(^N)TT?}c5U7wpm&8z>8z;2 zwI~i!tf{@;YoqrA!!!On3sG^r+#2|`eBEM@xfX9 zogg0%ug}wU=e;EAP-a$mSCF_o*Ve_OlUirIo24{Awn&am?HxNY0(S-}e=zbnpYive zdm{4m`N0wJ^Tlqpwc}?F-{*;U{+aV3q-s0%*Jh@qI_Egb4`qO>a%y-F zwxMe)%~SR03v-3&s;ASa9Wf?21&2*7-af7#_n5g4Igg1R!H4zLebTG!>N8G%3YA_4 zxad(!CypaSLAj;VE=aG42Jo)No)mRGr!Y!jWw zr*l77yhwck3xd*F+6^lQ?6UAS)9Im1dDe`v$!VK&iz-wqZn?o1zy;8n1LBAR(*S@- za=|feu63FVD<9r&UpNk@p#fet^yoCAnBV95=koZ*T@YnIj_ts?1VBc?RpY>~^hJ+S zw0_Jr(h;;cy~etMrSW+)uc@(5QHP7zHg$~X%Cz>r5*+haR`z9D0|ddTm06l64a!dd z(Eo1W@FP>hAA*oiUvF7dzSp#ZR8<2XMR4H@!p&M=HKa}VplwRx(>}Yd+>$V z3tP7Lq@n41=fwWb<%<3@4PcE3kl6im!DebLwz;%LytD}L>TQyNA?P$|FNE6|cV@vC z_HKqWx5b)vNrh2s9f-D~9>2rx%2V<{FAt;p|uA|gCdoUyI z9IuG4>sM#s<`exUDQIQuX~x5o=RYV;GR_Xm4wA=%< zfQ6OdIXSxYbk}baX!`bl>fzaL!W!+mA4&lan>d$=-6F!prXL%yX!Ouf%)*JH-Lva(|2+qH z%tKDgk)5OHLezXSV+MtDrjIU%qut5*^gOE6Vcsx_mo~f>8>arswryT!qn%B(v^Xmfp z&<0#=?V9y8NrY+ur?Dh8l`lHmU0z?fUatXQMEBzvjpOvpsESIDs7L_Ge$EXzYSH}u z_*c6#N~1=I!B=}j?ph~Fg|$bjhWzoYy`a6wWRH@q2!VD)0ePp(M7Mdj0Mn7mjip4r zTAFcy5G%5BJw?||JdAWcZ85~$+9RJ9g3asq8X%v;cZPH zK`Fj|IeEmHYv|UwtDqFZ#f%E{cH;KbWxL@MWSLv(dWbm!6aweGfaLJPR=BIvXkw;J z`-iRTNNAl=zv78wD$MJgNCVJ7bQ`;wqS`t|NzVccuo zc?0%n8Ie#(M|E(Lu2(x)O5mg;C>W(HgMslLD-{7-Fz8M^T}*Sia}+J1i1w;VDUG2l znpU3q5a1tPDeXNI=IJ#zTu^0*yrtHpeR0NSJ{*f?O=L_8ul6-|FjY)$P`CjUd%YK? zo(G<0LOpNHM4k(EP5#F4Vei)kz$7}B_L14mX<@O|(_-*RRlY?$8*qP4zE0qBYgBDvWyt6>xHjh zUx|(JHtX%E2M3$(^j{QmdWMd(ous%e`%Rrrk+NMk?-`t=jj}J80%ge2QAActu{V>KJ`&%qugeANTVDJxuiw^_xHD5 zJBP;9a(}Q%%cm=QyP)sHe3%&6CKim&8-3J+?CyW5lElY_c?%v+9Y3E|o2Y3{frNkP z1lec6i+AF6%CM3DJbA}Lhl9yh)B;b=?5W^B&er3w5*zQ$HlrLsBS@zpu@)J zv9K?XqFJPQL$ZG0a4hkQ&EpZ#*iM~D2u{1LN z$Az_92L26ESPM{N5cJ_Jv?+V)WoKu>pL!{u42q^4!m~y|nkMB;Jaq`<_#E{_7={+WH;Djhpkb5eMPTC0U(--G?MAK&D zGI9p2ZXpSx69ab!Cr=E(3846lSCOyjF5aC^eM7AF420*=!Ei6Ib&oV~(wzts+d06A z^lJF~{_gK(trfN2s8u>hDc7|$GvsTxKHP))+$E&z>zn(1cH@r-DIeztkN3oi#7xuex?=wpp*ZxFpv%Z=;$0;7P8;N;6eN4rn&`<-%677HwAy^RTF@#`F(mSBHq^R@okUq|1OP9LThdQ(yy!^(J@8V zyF$?DNJ42@3|)YC^?PXsyY0rcmLugpFk3offCjK;Y^IU=)v0Y%(unV_6o3?RVlB7v zmq<)~Y->T`Vpi~17QhnOdnHrnOk_y})r5KP@Bi8YzuqJ+-+}3+I9+X@+j|Nc+%zEX zsPR4;ESyRwWf})FuM7ORE+w^%_uBg(CZs}vN_PUN|L6bpe=m7bb7smDqq1r}(C@jd z2azK%Ic-#12IYrK-|n&LkTLU-y_!YT6GO-bi0Z8JC&iFjZn=LiiA%!r#pN-3y;jpzrE`%V)ME@d-@JbN^D*Dg<=Ybh7F6uiRc=I_Ug z$KkZry68Ml0dhXR=`2cmFO4j)pT9i2AUYgknreO_(^!Y;pwrlclr=?F!zg6D(LG6z zs5MpUK2&MFV0c?ey*)+D4Vrdg2@n~nqs3)}=;NsB1s(GOwBG-1E`uHY-ll0z9pacNk?;9f3KuH5A&Y%E5 zq561O(3p;#4h6c*^Jv4K%-JN1urYKdDSptdi=2s~A3({8mFPf+wg28<*Vi*Z(Y>QD z1G?mR?RiIjJn5Qp-j58QBnnwLq2O-)3pZX(Q3b zSQ?8Rm`^dGYPl}^y#%2azDaeY-?m9Yff{pCy8wGkJ^ZoybL|~D?b=|w$4_B!vD~j3 z`wTW;dnPgpY&c}W88nhda7aWAN%R;9yfG0dM9mY+|f-{6hDlr9en8Q!uLZ{i{X@UG?nOs8DHVa%S47uCr;^n7sDyBu*zsBYa)2&WsF4&lRB1VB%NakPf5-QFM}SW^h-*!}Du@hIoVzGk zQ#BVdSr0WA+gu@<#mgVlsk#WHUl@~}9C10%*XU2Tmxg=cS{?5|_t?0Q2k(({P2|l< zdhY~EiNd_2(<%7wTKr4b&hdF%#I@I5q?}uwg0`7Deco9q=6r6G*NN0zw!7T~H)r=^ zPOCIqWs|F?X=zV6`sN%{eCxP?-hwPbZ!;oGBO;M!s#WLDtM507rLefCz&X~*jE)#r z1J^r+RQG6PKe&o{iS?Sfa7a0rjP_xQ(|aYhDvw$lnQpyh5qdt|Gosbit+{TtRmpU; zxhEnjy|p;m!i}A2G!$wW$JHfEO5!3Srb2`fvRtN)Fj8jhH13c|V;3{__1Z=l$rdAH zWSPN~vJ7RvZuVum7+aZfY}1h4G-b(^`qH=ieEB`U=RN0rKE2=GbN=&FuzSIMaak>gqE!ZSSAVOBDZlk6jCWI(SYOWMo=BnZNle<555~K#ByGGUpzZ# zXkhseTWh(jBB1Cwb$+`}>H};cxBXa9ZB*-NQQqv&Va;U+8BVyx#!i3(+cMV{NYsVI zW{CLsKif)hZI%t3dW;A*$6jT>LSL1m@tBD#^k7gBuO&@uomI1!>Fwpk<9-B6Rhpo~ zHRm0s-Gle`&>B=0h$NF`7ZVB}QsD5C7Iiv?)#0yk+cS7EKs7|l zKEHQRaaprE)Vk97BM-!FU40`KfNoe%Rs2ee?^5G+n<6EDiQ~&NcIao3i>7DWfp!SJ zJQCc*)>~9UyjxTJ=84%BFRF&4Cm5sE zYHa@Y_>oj~VOtFaSTr*+diYFv=r@}%eF1fau;w{g2qZnXMw;#ScayvJ18EJ(N~q}x z`J#+IzH^CsnP(m2!4B_f^SirEk7i2h1*spYO~jV@aFre>1~^wfvO;9yIoDRy$w8O) zb?rb0kf+#;aAJ%f;oC|vu;uQXEZ#Sr7!|APyh3Bwk?T)Ku z_tUb8O&OsG4Z|tt95uR3VDzYY=x+W6ft4y;4yW&aKodr;FTu%>@gtjrTO=EkJ`n_=#42u^#x9(5n>)LIVwA>}C z;7L?K!x8kRdTU()494<*_NS0IB` z09z3tuqP89|ZROcP1mPf6Q+1uF4EirS{_uWBFjv8S>xnUAbc8|pD+!UBC^b*`m;U4QM- zgm+K~tH2{)))T3l|C0n3ihHa$L-E-(AZe{YXl2l|T!AKH1qa8eO*FH$dL>g>e)ZSE$docBPsVuhgqf255LG_EReiQdQ-EZBJr3 zmw*KN3fzV)ehaY8NVGf3bx - - Main Page - - + $title + + - -  - - - - - - - -
      General KERNEL Documentation    End User KERNEL Services  
    -


    - - +
    +SALOME documentation central +
    +
    diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 993af3090..9088dfa1c 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -48,13 +48,21 @@ usr_docs: fi; \ $(DOXYGEN) ./doxyuser1; \ cd ..; - $(INSTALL) -d $(docdir)/tui/KERNEL; - cp -fr KERNEL $(docdir)/tui - cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL; - cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL; +# $(INSTALL) -d $(docdir)/tui/KERNEL; + cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir); + cp -fr $(srcdir)/KERNEL/sources/ $(docdir); + cp -fr KERNEL/[a-f]*.* $(docdir) + cp -fr KERNEL/[g-l]*.* $(docdir) + cp -fr KERNEL/[m-z]*.* $(docdir) + cp -fr $(srcdir)/KERNEL/HTML/ $(docdir); + cp -f $(srcdir)/pythfilter.py $(docdir); + cp -fr $(srcdir)/KERNEL/exemple/ $(docdir); +# cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL; +# cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL; +# cp -fr KERNEL $(docdir)/tui +# cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL; +# cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL; +# cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL; dev_docs: cp -fr $(srcdir)/KERNEL/* ./INPUT; \ diff --git a/doc/salome/unittests.dox b/doc/salome/unittests.dox new file mode 100644 index 000000000..fc5ebdd47 --- /dev/null +++ b/doc/salome/unittests.dox @@ -0,0 +1,207 @@ +/*! + +\page UnitTests Source code structuration and Unit Tests + +WORK in PROGRESS, INCOMPLETE DOCUMENT + +You will find here general information on code directories structure, +unit tests associated to the different kind of classes, and how to run +the unit tests. + +\section S1_unit SALOME KERNEL source code structuration + +
      +
    1. General structure of KERNEL_SRC + +- KERNEL_SRC : + Some README files and configuration tools for build + +- KERNEL_SRC/adm_local : + Part of the configuration files, other modules have a directory with the + same name. Not used in KERNEL. + +- KERNEL_SRC/bin : + Python and shell scripts used at run time. + Kit to install a %SALOME Application. + +- KERNEL_SRC/doc : + Kit for KERNEL end user documentation production: + public interfaces, Python, CORBA. + Integrator and Developper documentation. + +- KERNEL_SRC/idl : + All CORBA interfaces from KERNEL are regrouped here. + +- KERNEL_SRC/resources : + Configuration files for servers (examples). + Interfaces definitions for KERNEL test components. + +- KERNEL_SRC/salome_adm : + Configuration files used by autotools (M4 macros & co.) + +- KERNEL_SRC/src : + The source code (C++ and Python) + +
    2. +
    3. +Directory src: C++ and Python source code + +
        +
      1. +Basic services non related to CORBA + +- Basics + %A set of general purpose C++ services, not related to CORBA. + Some general purpose services that are in Utils directory (CORBA related), + are progressivley moved here, as they are not related to CORBA. + + +- SALOMELocalTrace + %A multithread trace system that allows message tracing on standard error + or a file. + +- CASCatch + Exceptions and signal handler. + +- HDFPersist + %A C++ interface to HDF. + +
      2. + +
      3. +Basic CORBA services + +- Logger : + %A CORBA %server that collects the trace messages from differents CORBA + process. + +- SALOMETraceCollector : + %A multithread trace system derived from SALOMELocalTrace, that sends messages + to Logger %server via CORBA. + +- Utils : + %A set of general purpose services related to CORBA, such as basic CORBA + exception system. See also Basics directory above. + +- NamingService : + C++ and Python interfaces to name, store and retrieve CORBA objects + +- GenericObj : + %A generic CORBA interface for CORBA objects, to count distributed references, + and to allow destruction by client. + +
      4. +
      5. +Miscellaneous CORBA servers + +- %Registry : + Implements SALOME_registry.idl. + Provides a CORBA %server library and a separate %server program. + +- ModuleCatalog : + Implements SALOME_moduleCatalog.idl. + Provide a CORBA %server library and separate %server and client programs. + +- ModuleGenerator : + Tool to generate a module catalog from CORBA idl + +- ResourcesManager : + library included in container %server + +- Notification : + library included in differents servers (container) + +- NOTIFICATION_SWIG + +
      6. + +
      7. +CORBA Containers for %SALOME Modules + +- Container + +- TestContainer + +- LifeCycleCORBA + +- LifeCycleCORBA_SWIG + +
      8. + +
      9. +STUDY %server and related interfaces and tools + +- SALOMEDSClient + +- TOOLSDS + +- SALOMEDSImpl + +- SALOMEDS + +
      10. +
      11. +Python interface to %SALOME + +- KERNEL_PY + +
      12. +
      13. +Efficient CORBA transfer services + +- Communication + +- Communication_SWIG + +
      14. +
      15. +%A Parallel container with MPI + +- MPIContainer + +- TestMPIContainer + +
      16. +
      17. +Batch interface library + +- Batch + +- Batch_SWIG + +
      18. +
      19. +Unit tests + +- UnitTests + +
      20. +
      +
    4. +
    + +\section S2_unit Tools and principles used for Unit testing + +**TO BE COMPLETED** + +Unit Testing rely on cppunit package for C++ testing, and on unittest module +for Python. See these products for general principles of unit testing. + +The cppunit package is optional. When the prerequisite is detected, the unit +tests are compiled. + +Unit Tests sources are in directories Test under the src/directories +containing the classes to test. + +Test are ordered following the order of directories given above. + +Tests can be run as a whole, or for a particular directory. In this case, only +a partial test is run (the classes to test, and the classes used, i.e. the +preceding test directories). + + +Today, only some tests are written as an example. There are not yet python +scripts in KERNEL_SRC, but it's a matter of days, there are working scripts +to test LifeCycleCORBA_SWIG interface. + +*/ diff --git a/idl/DSC_Engines.idl b/idl/DSC_Engines.idl index 9ace69068..25c6ec7eb 100644 --- a/idl/DSC_Engines.idl +++ b/idl/DSC_Engines.idl @@ -340,8 +340,20 @@ module Engines { \exception Engines::ConnectionManager::BadId */ void disconnect(in connectionId id, - in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId); + in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId, + Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortReference); + /*! + Shutdown the ConnectionManager process. + */ + oneway void ShutdownWithExit(); + + /*! + Returns the PID of the connection manager + */ + long getPID(); }; /*--------------------------------------------------------------------------------------------*/ @@ -370,7 +382,7 @@ module Engines { This interface defines the operations needed to add a paco++ port into a parallel DSC component. */ - interface Parallel_DSC : Engines::DSC { + interface Parallel_DSC : Engines::Superv_Component, Engines::Parallel_Component { /*! This operation gives the proxy node of a paco++ port to all the nodes. @@ -385,17 +397,8 @@ module Engines { void set_paco_proxy(in Object ref, in string provides_port_name, in Ports::PortProperties port_prop); - - /*! - The SUPERV module call this method before starting the service. Thus the service - can add is dynamics ports before is started. - - \param service_name service's name. - \return true if the service is correctly initialised. - */ - boolean init_service(in string service_name); - }; + }; }; #endif diff --git a/idl/DSC_Engines.xml b/idl/DSC_Engines.xml index 5db294c08..a4d5603b6 100644 --- a/idl/DSC_Engines.xml +++ b/idl/DSC_Engines.xml @@ -46,6 +46,9 @@ set_paco_proxy distributed + + + Superv_Component init_service distributed diff --git a/idl/Makefile.am b/idl/Makefile.am index 8ddeafd24..b6a3f3d0b 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,9 +26,6 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -# To avoid problems with parallel compilation. -MAKEFLAGS = -j1 - AM_CXXFLAGS = -fPIC BASEIDL_FILES = \ @@ -94,8 +91,13 @@ BASEIDL_SOURCES =\ Calcium_PortsSK.cc \ Palm_PortsSK.cc -DYNIDL_SOURCES=\ - Calcium_PortsDynSK.cc +DYNIDL_SOURCES = \ + SALOME_PortsDynSK.cc Calcium_PortsDynSK.cc SALOME_ContainerManagerDynSK.cc \ + SALOME_CommDynSK.cc SALOME_RegistryDynSK.cc SALOME_ModuleCatalogDynSK.cc \ + SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \ + DSC_EnginesDynSK.cc SALOME_ComponentDynSK.cc SALOME_GenericObjDynSK.cc \ + Palm_PortsDynSK.cc SALOME_ExceptionDynSK.cc SALOMEDS_AttributesDynSK.cc \ + LoggerDynSK.cc MPIIDL_SOURCES = \ SALOME_MPIObjectSK.cc \ @@ -115,26 +117,39 @@ endif IDL_SOURCES += $(DYNIDL_SOURCES) +$(DYNIDL_SOURCES) : $(IDL_SOURCES) + # also install all generated headers to use result library from another modules salomeinclude_DATA= $(STATIDL_SOURCES:%SK.cc=%.hh) if WITH_PACO_PARALLEL -PAR = SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc \ +PAR = SALOME_ExceptionPaCO.h SALOME_ExceptionPaCO.cc \ + SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc \ SALOME_PortsPaCO.h SALOME_PortsPaCO.cc \ DSC_EnginesPaCO.h DSC_EnginesPaCO.cc PAR_LIB = libSalomeParallelIDLKernel.la -IDL_PACO = SALOME_ComponentPaCO.idl SALOME_PortsPaCO.idl DSC_EnginesPaCO.idl +IDL_PACO = SALOME_ExceptionPaCO.idl SALOME_ComponentPaCO.idl SALOME_PortsPaCO.idl DSC_EnginesPaCO.idl GEN_PACO = SALOME_ComponentPaCO_Engines_Container_server.cc \ SALOME_ComponentPaCO_Engines_Container_client.cc \ SALOME_ComponentPaCO_Engines_Component_server.cc \ SALOME_ComponentPaCO_Engines_Component_client.cc \ + SALOME_ComponentPaCO_Engines_Parallel_Component_server.cc \ + SALOME_ComponentPaCO_Engines_Parallel_Component_client.cc \ + SALOME_ComponentPaCO_Engines_fileTransfer_server.cc \ + SALOME_ComponentPaCO_Engines_fileTransfer_client.cc \ + SALOME_ComponentPaCO_Engines_Salome_file_server.cc \ + SALOME_ComponentPaCO_Engines_Salome_file_client.cc \ + SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.cc \ + SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.cc \ SALOME_PortsPaCO_Ports_Port_server.cc \ SALOME_PortsPaCO_Ports_Port_client.cc \ DSC_EnginesPaCO_Engines_DSC_server.cc \ DSC_EnginesPaCO_Engines_DSC_client.cc \ + DSC_EnginesPaCO_Engines_Superv_Component_server.cc \ + DSC_EnginesPaCO_Engines_Superv_Component_client.cc \ DSC_EnginesPaCO_Engines_Parallel_DSC_server.cc \ DSC_EnginesPaCO_Engines_Parallel_DSC_client.cc @@ -142,7 +157,17 @@ INCLUDES_PACO = SALOME_ComponentPaCO_Engines_Container_server.h \ SALOME_ComponentPaCO_Engines_Container_client.h \ SALOME_ComponentPaCO_Engines_Component_server.h \ SALOME_ComponentPaCO_Engines_Component_client.h \ + SALOME_ComponentPaCO_Engines_Parallel_Component_server.h \ + SALOME_ComponentPaCO_Engines_Parallel_Component_client.h \ + SALOME_ComponentPaCO_Engines_fileTransfer_server.h \ + SALOME_ComponentPaCO_Engines_fileTransfer_client.h \ + SALOME_ComponentPaCO_Engines_Salome_file_server.h \ + SALOME_ComponentPaCO_Engines_Salome_file_client.h \ + SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.h \ + SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.h \ + SALOME_ExceptionPaCO.h \ SALOME_ComponentPaCO.h \ + SALOME_Exception.h \ SALOME_Component.h \ SALOME_PortsPaCO_Ports_Port_server.h \ SALOME_PortsPaCO_Ports_Port_client.h \ @@ -150,12 +175,14 @@ INCLUDES_PACO = SALOME_ComponentPaCO_Engines_Container_server.h \ SALOME_Ports.h \ DSC_EnginesPaCO_Engines_DSC_server.h \ DSC_EnginesPaCO_Engines_DSC_client.h \ + DSC_EnginesPaCO_Engines_Superv_Component_server.h \ + DSC_EnginesPaCO_Engines_Superv_Component_client.h \ DSC_EnginesPaCO_Engines_Parallel_DSC_server.h \ DSC_EnginesPaCO_Engines_Parallel_DSC_client.h \ DSC_EnginesPaCO.h \ DSC_Engines.h -XML = SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml +XML = SALOME_Exception.xml SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml endif idldir = $(prefix)/idl/salome @@ -164,6 +191,7 @@ nodist_salomeinclude_HEADERS = ${INCLUDES_PACO} BUILT_SOURCES = $(IDL_SOURCES) $(PAR) +SALOME_ExceptionPaCO.h SALOME_ExceptionPaCO.cc : SALOME_Exception.idl SALOME_Exception.xml SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc : SALOME_Component.idl SALOME_Component.xml SALOME_PortsPaCO.h SALOME_PortsPaCO.cc : SALOME_Ports.idl SALOME_Ports.xml DSC_EnginesPaCO.h DSC_EnginesPaCO.cc : DSC_Engines.idl DSC_Engines.xml diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 73dd4b1e8..6fd42cd02 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -23,10 +23,6 @@ // Author : Yves FRICAUD // $Header$ -/*! \mainpage - \image html Application-About1.jpg -*/ - /*! \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment and modification of the %Study @@ -309,6 +305,12 @@ during each working session. Returns True if the %study has been modified and not saved. */ boolean IsModified(); + +/*! + Marks the %study as being modified and not saved. +*/ + void Modified(); + /*! Determines the file where the %study has been saved */ @@ -708,6 +710,18 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin */ void ping(); + void Shutdown(); + +/*! + Returns the PID of the server +*/ + long getPID(); + +/*! + Shutdown the StudyManager process. +*/ + oneway void ShutdownWithExit(); + /*! \brief Creation of a new study Creates a new study with a definite name. diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index d750af377..08aea29fc 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -26,6 +26,8 @@ #ifndef _SALOME_COMPONENT_IDL_ #define _SALOME_COMPONENT_IDL_ +#include "SALOME_Exception.idl" + /*! \brief This is a package of interfaces used for connecting new components to %SALOME application. It also contains a set of interfaces used for management of %MED @@ -53,6 +55,7 @@ module Engines interface Component ; interface fileRef ; interface fileTransfer ; + interface Salome_file; /*! \brief Interface of the %Container. This interface defines the process of loading and registration @@ -159,6 +162,16 @@ module Engines */ fileRef createFileRef(in string origFileName); + /*! + returns a Salome_file object if origFileName exists and is readable + else returns null object. + + \param origFileName name of the file to be managed (can contain the path). + + \return Salome_file CORBA reference. + */ + Salome_file createSalome_file(in string origFileName); + /*! returns a fileTransfer object used to copy files from the container machine to the clients machines. Only one fileTransfer instance is @@ -168,8 +181,6 @@ module Engines }; - - /*! \brief Interface of the %component. This interface is used for interaction between the %container and the %component and between the components inside the container. @@ -275,10 +286,104 @@ module Engines */ TMPFile DumpPython(in Object theStudy, in boolean isPublished, - out boolean isValidScript); + out boolean isValidScript); + + + /*! + Returns a CORBA Ref of a input Salome_file managed by a service. + + \param service_name service's name. + \param file_name name of the requested file. + + \return CORBA Ref of the requested file. + + \exception contains informations of what if the component cannot + sends the file's reference. + */ + Engines::Salome_file getInputFileToService(in string service_name, + in string Salome_file_name) raises(SALOME::SALOME_Exception); + + /*! + This method is used before the activation of the service. It calls + recvFiles() on all the input Salome_file files of the service. + + Before each recvFiles(), it uses the callback method named configureSalome_file. + This method allows the user to configure the files managed by the Salome_file. + + By default, there is no files managed when a Salome_file is created, + but the supervisor set some files managed by the Salome_file from the information contained + into the schema file. + + \param service_name service's name. + + \exception contains informations about files that are not in a good state. + */ + void checkInputFilesToService(in string service_name) raises(SALOME::SALOME_Exception); + + /*! + This method adds a input Salome_file to a service of the component. + + \param service_name service's name. + \param Salome_file_name name of the Salome_file + + \return a reference of the Salome_file + + \exception raises an exception if there is already + a Salome_file with this name for the service. + */ + Engines::Salome_file setInputFileToService(in string service_name, + in string Salome_file_name) raises(SALOME::SALOME_Exception); + + /*! + Returns a CORBA Ref of a output Salome_file managed by a service. + + \param service_name service's name. + \param file_name name of the requested file. + + \return CORBA Ref of the requested file. + + \exception contains informations of what if the component cannot + sends the file's reference. + */ + Engines::Salome_file getOutputFileToService(in string service_name, + in string Salome_file_name) raises(SALOME::SALOME_Exception); + + /*! + This method is used at the end of the service. It calls + recvFiles() on all the output Salome_file files of the service. + + Before each recvFiles(), it uses the callback method named configureSalome_file. + This method allows the user to configure the files managed by the Salome_file. + + By default, there is no files managed when a Salome_file is created, + but the supervisor set some files managed by the Salome_file from the information contained + into the schema file. + + \param service_name service's name. + + \exception contains informations about files that are not in a good state. + */ + void checkOutputFilesToService(in string service_name) raises(SALOME::SALOME_Exception); + /*! + This method adds an output Salome_file to a service of the component. + + \param service_name service's name. + \param Salome_file_name name of the Salome_file + + \return a reference of the Salome_file + + \exception raises an exception if there is already + a Salome_file with this name for the service. + */ + Engines::Salome_file setOutputFileToService(in string service_name, + in string Salome_file_name) raises(SALOME::SALOME_Exception); } ; + interface Parallel_Component : Engines::Component { + void send_parallel_proxy_object(in Object proxy_ref); + }; + /*! A block of binary data used for file transfer. The maximum size of the block is defined on server side. @@ -314,7 +419,187 @@ module Engines fileBlock getBlock(in long fileId); }; - /*! \brief Interface of fileTransfer. + /*! + This is a file managed by a Salome_file. It contains file's name, path and status. + The status is : "present" or "notpresent". + */ + struct file { + string file_name; + string path; + string type; + string source_file_name; + string status; + long node; + Engines::Container container; + }; + + /*! + A sequence of Engines::file. + */ + typedef sequence files; + + + /*! + It is the state of a Salome_file. It contains the Salome_file's name, the name + of the hdf5 file where it can be saved, the number of files managed and the information + if all the files are received. + */ + struct SfState { + string name; + string hdf5_file_name; + long number_of_files; + boolean files_ok; + }; + + /*! \brief Interface of a Salome_file managed + This file is independent of a Salome module. It can managed one or more + real files. It's useful for parallel files. Currently Salome_file cannot manage + two files that have the same name but not the same path. + */ + interface Salome_file : Engines::fileTransfer + { + /*! + Load a Salome_file from a hdf5 file. + + \param hdf5_file name (with path) of the hdf5_file. + + \exception contains informations of errors if the loading doesn't succeed. + */ + void load(in string hdf5_file) raises (SALOME::SALOME_Exception); + + /*! + Save a Salome_file into a hdf5_file. + + \param hdf5_file name (with path) of the hdf5_file. + + \exception contains informations of errors if the save doesn't succeed. + + */ + void save(in string hdf5_file) raises (SALOME::SALOME_Exception); + + /*! + Save a Salome_file into a hdf5_file. All files that are managed + are saved into the hdf5_file + + \param hdf5_file name (with path) of the hdf5_file. + + \exception contains informations of errors if the save doesn't succeed. + + */ + void save_all(in string hdf5_file) raises (SALOME::SALOME_Exception); + +/**************/ + + /*! + Add a Local file to the Salome_file. + + \param file_name name of the file with the path. + + \exception raised if the file is already added into the Salome_file. + */ + void setLocalFile(in string comp_file_name) raises (SALOME::SALOME_Exception); + + /*! + Add a Distributed file to the Salome_file. + + \param comp_file_name name of the file with the path. + + \exception raised if the file is already added into the Salome_file. + */ + void setDistributedFile(in string comp_file_name) raises (SALOME::SALOME_Exception); + + /*! + Connect a Salome_file with another Salome_file. + It works only if the Salome_file managed only one file + + \param source_Salome_file Salome_file that managed the distributed version of the file. + + \exception raised if there is more or less than one file. + */ + void connect(in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception); + + /*! + Connect the managed file file_name to a Salome_file. + + \param file_name name of the file without the path. + \param source_Salome_file Salome_file that managed the distributed version of the file. + + \exception raised if the file doesn't exist. + */ + void connectDistributedFile(in string file_name, + in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception); + + /*! + Connect the file_name with a Distributed file_name. + + \param file_name name of the file without the path. + \param source_file_name It's the name of the file managed by the distributed source Salome_file. + + \exception raised if the file doesn't exist. + */ + void setDistributedSourceFile(in string file_name, + in string source_file_name) raises (SALOME::SALOME_Exception); + +/**************/ + + /*! + Get all the distributed files managed by the Salome_file and + check all the local files. + + \exception raised if some of the files are not ok. + */ + void recvFiles() raises (SALOME::SALOME_Exception) ; + +/**************/ + + /*! + Remove a file of the Salome_file. + + \param file_name name of the file. + + \exception raised if the file doesn't exist. + */ + void removeFile(in string file_name) raises (SALOME::SALOME_Exception); + + /*! + Remove all the files of the Salome_file. + */ + void removeFiles(); + +/**************/ + + /*! + Get the list of the files managed by the Salome_file. + The list can be empty. + */ + Engines::files getFilesInfos(); + + /*! + Get a file managed by the Salome_file. + + \param file_name the name of the file. + + \return CORBA file reference. + + \exception raised if the file doesn't exist. + */ + Engines::file getFileInfos(in string file_name) raises (SALOME::SALOME_Exception); + + /*! + Return the state of the Salome_file. + */ + Engines::SfState getSalome_fileState(); + + + /*! + Set the container where files are. + + \param container container CORBA's reference. + */ + void setContainer(in Engines::Container container); + }; + + /*! \brief Interface of fileRef. The fileTransfer and fileRef interfaces provide a file transfer service between different computers. @@ -344,6 +629,49 @@ module Engines string getRef(in string machine); }; -} ; + /*! \brief Interface of a Parallel_Salome_file + This interface is used by parallel components and containers. + It adds methods to enable to choose on which node of the parallel component the file has to + be received. + */ + interface Parallel_Salome_file : Engines::Salome_file { + + /*! + Set a number of node for the file. Default is the node 0. + + \param file_name name of the file. + \param node_nbr node number where the file is. + + \exception raised if the file doesn't exist. + */ + void setFileNode(in string file_name, in long node_nbr) raises (SALOME::SALOME_Exception); + + /*! + Get the number of the node that actually managed the file. + + \param file_name name of managed file. + + \return node number of the file + + \exception raised if the file doesn't exist. + */ + long getFileNode(in string file_name) raises (SALOME::SALOME_Exception); + + /*! + This method update the state of file for the Parallel_Salome_file. + + \param new_file the new state of file. + */ + Engines::Container updateFile(in Engines::file new_file); + + /*! + This method is used by the parallel implementation of recvFiles. + + \exception raised if the file cannot be ok. + */ + void recvFiles_node() raises (SALOME::SALOME_Exception); + + }; +}; #endif diff --git a/idl/SALOME_Component.xml b/idl/SALOME_Component.xml index 22b783fc2..2b65d9058 100644 --- a/idl/SALOME_Component.xml +++ b/idl/SALOME_Component.xml @@ -47,9 +47,26 @@ Component - ping + setInputFileToService + distributed + + + setOutputFileToService distributed + + Parallel_Component + + send_parallel_proxy_object + distributed + + + + Salome_file + + + Parallel_Salome_file + diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 84ec3c794..c53d27a9c 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -27,29 +27,39 @@ module Engines { /*! - Type to describe properties of wanted resource. + Type to transmit list of machines. +*/ + typedef sequence MachineList; + typedef sequence CompoList; + typedef sequence FilesList; + typedef sequence ModulesList; + +/*! + Type to describe properties of resource. */ struct MachineParameters { string container_name; string hostname; + string alias; + string protocol; + string username; + string applipath; + ModulesList modList; string OS; long mem_mb; long cpu_clock; long nb_proc_per_node; long nb_node; boolean isMPI; + string mpiImpl; + string batch; // PaCO specific informations string parallelLib; long nb_component_nodes; }; -/*! - Type to transmit list of machines. -*/ - typedef sequence MachineList; - /*! exception thrown if a computer is not found in the catalog */ @@ -58,6 +68,27 @@ struct MachineParameters enum policy {P_FIRST,P_CYCL,P_BEST}; typedef policy ResPolicy; +/*! \brief Interface of the %salomelauncher + This interface is used for interaction with the unique instance + of SalomeLauncher +*/ + interface SalomeLauncher + { + long submitSalomeJob( in string fileToExecute, + in FilesList filesToExport, + in FilesList filesToImport, + in long NumberOfProcessors, + in MachineParameters params ) raises (SALOME::SALOME_Exception); + string querySalomeJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception); + void deleteSalomeJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception); + void getResultSalomeJob( in string directory, in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception); + + void Shutdown(); + + long getPID(); + + } ; + /*! \brief Interface of the %containerManager This interface is used for interaction with the unique instance of ContainerManager @@ -79,17 +110,31 @@ struct MachineParameters in MachineList possibleComputers); Container StartContainer( in MachineParameters params, - in ResPolicy policy); + in ResPolicy policy, + in CompoList componentList ); + + Container GiveContainer( in MachineParameters params, + in ResPolicy policy, + in CompoList componentList ); + + void ShutdownContainers(); + } ; + +/*! \brief Interface of the %resourcesManager + This interface is used for interaction with the unique instance + of ResourcesManager +*/ + interface ResourcesManager + { string FindFirst(in MachineList possibleComputers); MachineList GetFittingResources( in MachineParameters params, - in string componentName ) + in CompoList componentList ) raises (SALOME::SALOME_Exception); - void Shutdown(); + MachineParameters GetMachineParameters( in string hostname ); - void ShutdownContainers(); } ; }; diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx b/idl/SALOME_Exception.xml similarity index 67% rename from src/SALOMEDS/SALOMEDS_OCAFApplication.jxx rename to idl/SALOME_Exception.xml index 3ea3ada01..33d565323 100644 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx +++ b/idl/SALOME_Exception.xml @@ -1,6 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, + + + + -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#include "SALOMEDS_OCAFApplication.hxx" -#endif + diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 27f81b0f6..9fc9dac5b 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -87,6 +87,40 @@ The list of the parameters of service. typedef sequence ListOfServicesParameter; typedef sequence ListOfServicesDataStreamParameter; + typedef sequence ListOfString; + enum TypeKind + { + NONE , + Dble , + Int , + Str , + Bool , + Objref , + Seq , + Array , + Struc + }; + struct MemberDefinition + { + string name; /*! Name of the member */ + string type; /*! Type of the member */ + }; + typedef sequence ListOfMemberDefinition; +/*! + * Struct to get the definition of types used in Salome catalogs + */ + struct TypeDefinition + { + string name; /*! Name of the type */ + TypeKind kind; /*! Kind of the type.*/ + string id; /*! id (if needed) */ + string content; /*! Content type (if needed) */ + ListOfString bases; /*! Content type (if needed) */ + ListOfMemberDefinition members; /*! Members types (if needed) */ + }; + + typedef sequence ListOfTypeDefinition; + /*! This struct contains fields completely defining each service. */ @@ -143,7 +177,7 @@ List of path prefixes /*! Description of a component */ - struct Component + struct ComponentDef { ComponentType type; string name; @@ -303,6 +337,21 @@ This interface is used for creation of the module catalog in %SALOME application { void ping(); +/*! + Returns the PID of the server +*/ + long getPID(); + +/*! + Shutdown the ModuleCatalog process. +*/ + oneway void ShutdownWithExit(); + +/*! + * Get the types of the catalog + */ + ListOfTypeDefinition GetTypes(); + /*! Gets a list of names of computers of the catalog */ @@ -337,7 +386,7 @@ Gets one component of the catalog. /*! Gets the description of a component of the catalog. */ - Component GetComponentInfo(in string componentName) raises(NotFound); + ComponentDef GetComponentInfo(in string componentName) raises(NotFound); /*! Reads a xml file and imports new components from this file. diff --git a/idl/SALOME_Registry.idl b/idl/SALOME_Registry.idl index e33e2ccd1..5f27977f6 100644 --- a/idl/SALOME_Registry.idl +++ b/idl/SALOME_Registry.idl @@ -48,6 +48,7 @@ module Registry interface Components { void ping(); + long getPID(); unsigned long add ( in Infos lesInfos ) ; void remove ( in unsigned long id ) ; unsigned long size() ; @@ -55,6 +56,7 @@ module Registry AllInfos history () ; oneway void end() ; oneway void hello( in unsigned long id ) ; + void Shutdown(); } ; } ; diff --git a/idl/SALOME_Session.idl b/idl/SALOME_Session.idl index f067b753a..041df52a7 100644 --- a/idl/SALOME_Session.idl +++ b/idl/SALOME_Session.idl @@ -101,6 +101,10 @@ module SALOME Determines whether the server has already been loaded or not. */ void ping(); +/*! + Returns the PID of the server +*/ + long getPID(); /*! Get Active study ID */ diff --git a/resources/CatalogResources.xml.in b/resources/CatalogResources.xml.in index c83cafac5..874d32492 100644 --- a/resources/CatalogResources.xml.in +++ b/resources/CatalogResources.xml.in @@ -1,48 +1,43 @@ - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + + diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 02afa4055..347458ed4 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -8,6 +8,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am index 0c5dca94a..687202153 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -31,8 +31,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # =============================================================== # -DEPRECATED_FILES=\ - DEPRECATED/Plugin +DEPRECATED_FILES= dist_salomeres_DATA=\ CatalogResources.xml \ diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index 31675283a..bd95886a5 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -68,11 +68,11 @@ check_htmlgen.m4 \ check_lam.m4 \ check_lsf.m4 \ check_mpi.m4 \ +check_openmpi.m4 \ check_mpich.m4 \ check_omniorb.m4 \ check_opengl.m4 \ check_openpbs.m4 \ -check_qt.m4 \ check_sockets.m4 \ check_swig.m4 \ check_withihm.m4 \ @@ -80,4 +80,7 @@ enable_pthreads.m4 \ production.m4 \ pyembed.m4 \ python.m4 \ +check_libxml.m4 + +dist_salome4depr_DATA=\ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index d1b673c81..27ae50c73 100644 --- a/salome_adm/unix/config_files/check_boost.m4 +++ b/salome_adm/unix/config_files/check_boost.m4 @@ -53,6 +53,11 @@ if test "x${BOOSTDIR}" != "x" ; then BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}" fi +if test "x${BOOSTDIR}" = "x/usr" ; then + BOOST_CPPFLAGS="" + BOOST_LIBS="" +fi + boost_ok=no boost_headers_ok=no boost_binaries_ok=no diff --git a/salome_adm/unix/config_files/check_cppunit.m4 b/salome_adm/unix/config_files/check_cppunit.m4 index 4029ea190..e78b4fa24 100644 --- a/salome_adm/unix/config_files/check_cppunit.m4 +++ b/salome_adm/unix/config_files/check_cppunit.m4 @@ -69,8 +69,7 @@ else AC_LANG_CPLUSPLUS CPPFLAGS_old=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES" - CPPFLAGS="$CPPFLAGS $QT_INCLUDES" - + AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no) CPPFLAGS=$CPPFLAGS_old diff --git a/salome_adm/unix/config_files/check_htmlgen.m4 b/salome_adm/unix/config_files/check_htmlgen.m4 index 8e42b102e..ec51ec269 100644 --- a/salome_adm/unix/config_files/check_htmlgen.m4 +++ b/salome_adm/unix/config_files/check_htmlgen.m4 @@ -41,7 +41,7 @@ then DOXYGEN_WITH_PYTHON=yes DOXYGEN_WITH_STL=yes ;; - [1-9].[5-9]*) + [[1-9]].[[5-9]]*) DOXYGEN_WITH_PYTHON=yes DOXYGEN_WITH_STL=yes ;; diff --git a/salome_adm/unix/config_files/check_libxml.m4 b/salome_adm/unix/config_files/check_libxml.m4 new file mode 100644 index 000000000..ad4841c00 --- /dev/null +++ b/salome_adm/unix/config_files/check_libxml.m4 @@ -0,0 +1,53 @@ +AC_DEFUN([CHECK_LIBXML],[ + +AC_CHECKING(for libxml library) + +AC_SUBST(LIBXML_INCLUDES) +AC_SUBST(LIBXML_LIBS) + +LIBXML_INCLUDES="" +LIBXML_LIBS="" + +libxml_ok=no + +LOCAL_INCLUDES="" +LOCAL_LIBS="" + +if test "x$LIBXML_DIR" != "x" +then + LOCAL_INCLUDES="-I$LIBXML_DIR/include/libxml2" + LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2" +else + LOCAL_INCLUDES="-I/usr/include/libxml2" + LOCAL_LIBS="-lxml2" +fi + +dnl libxml2 headers + +CPPFLAGS_old="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" +AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no") +CPPFLAGS="$CPPFLAGS_old" + +if test "x$libxml_ok" = "xyes" +then + +dnl libxml2 library + + LIBS_old=$LIBS + LIBS="$LIBS $LOCAL_LIBS" + AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",) + LIBS=$LIBS_old +fi + +if test "x$libxml_ok" = "xyes" +then + LIBXML_INCLUDES="$LOCAL_INCLUDES" + LIBXML_LIBS="$LOCAL_LIBS" +fi + +AC_MSG_RESULT(for libxml: $libxml_ok) + +])dnl +dnl + diff --git a/salome_adm/unix/config_files/check_mpi.m4 b/salome_adm/unix/config_files/check_mpi.m4 index 57b796b72..6422c8b1d 100644 --- a/salome_adm/unix/config_files/check_mpi.m4 +++ b/salome_adm/unix/config_files/check_mpi.m4 @@ -24,6 +24,10 @@ AC_DEFUN([CHECK_MPI],[ AC_REQUIRE([AC_PROG_CC])dnl +AC_ARG_WITH(mpi_lib, + [AC_HELP_STRING([--with-mpi_lib=DIR],[directory path of MPICH lib installation])], + MPILIBREQUESTED="$withval") + AC_ARG_WITH(mpi, [AC_HELP_STRING([--with-mpi=DIR],[root directory path of MPICH installation])], MPIREQUESTED="yes",MPIREQUESTED="no") @@ -51,6 +55,10 @@ if test x"$MPIREQUESTED" = xyes; then fi fi + if test x"$MPILIBREQUESTED" != x; then + MPI_LIBS="-L$MPILIBREQUESTED" + fi + CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$MPI_INCLUDES $CPPFLAGS" AC_CHECK_HEADER(mpi.h,WITHMPI="yes",WITHMPI="no") @@ -69,7 +77,7 @@ if test x"$MPIREQUESTED" = xyes; then if test "$WITHMPI" = "yes";then mpi_ok=yes - MPI_LIBS="$MPI_LIBS -lmpi" + MPI_LIBS="$MPI_LIBS -lmpi -lmpio -lmpiCC" else mpi_ok=no fi @@ -96,6 +104,17 @@ dnl fi + if test "$WITHLAM" = no; then +dnl +dnl --------------------------------------------- +dnl testing OPENMPI +dnl --------------------------------------------- +dnl + + CHECK_OPENMPI + + fi + fi if test x$WITHMPI2 = xyes; then diff --git a/salome_adm/unix/config_files/check_omniorb.m4 b/salome_adm/unix/config_files/check_omniorb.m4 index b59b6caea..f82428747 100644 --- a/salome_adm/unix/config_files/check_omniorb.m4 +++ b/salome_adm/unix/config_files/check_omniorb.m4 @@ -61,31 +61,31 @@ then OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION" case $build_cpu in sparc*) - AC_DEFINE(__sparc__) + # AC_DEFINE(__sparc__) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__" ;; *86*) - AC_DEFINE(__x86__) + # AC_DEFINE(__x86__) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__" ;; esac case $build_os in osf*) - AC_DEFINE(__osf1__) + # AC_DEFINE(__osf1__) __OSVERSION__=5 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [5], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__osf1__" ;; solaris*) - AC_DEFINE(__sunos__) + # AC_DEFINE(__sunos__) __OSVERSION__=5 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [5], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__" ;; linux*) - AC_DEFINE(__linux__) + # AC_DEFINE(__linux__) __OSVERSION__=2 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [2], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__" ;; esac @@ -188,7 +188,7 @@ if test "x$omniORB_ok" = "xyes" then OMNIORB_IDLCXXFLAGS="-Wba -nf -I${OMNIORB_ROOT}/idl" - OMNIORB_IDLPYFLAGS_1='-bpythonbe -p ${top_srcdir}/salome_adm/unix' + OMNIORB_IDLPYFLAGS_1='-bpython -p ${top_srcdir}/salome_adm/unix' OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl" OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2} @@ -214,15 +214,15 @@ then AC_SUBST(OMNIORB_IDL_TIE_H) AC_SUBST(OMNIORB_IDL_TIE_CXX) - AC_DEFINE(OMNIORB) + AC_DEFINE([OMNIORB], [], [Description]) CORBA_HAVE_POA=1 - AC_DEFINE(CORBA_HAVE_POA) + AC_DEFINE([CORBA_HAVE_POA], [], [Description]) CORBA_ORB_INIT_HAVE_3_ARGS=1 - AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS) + AC_DEFINE([CORBA_ORB_INIT_HAVE_3_ARGS], [], [Description]) CORBA_ORB_INIT_THIRD_ARG='"omniORB"' - AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB") + AC_DEFINE([CORBA_ORB_INIT_THIRD_ARG], [], [omniORB]) fi diff --git a/salome_adm/unix/config_files/check_openmpi.m4 b/salome_adm/unix/config_files/check_openmpi.m4 new file mode 100644 index 000000000..03f3378fd --- /dev/null +++ b/salome_adm/unix/config_files/check_openmpi.m4 @@ -0,0 +1,56 @@ +dnl Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl + +AC_DEFUN([CHECK_OPENMPI],[ +AC_ARG_WITH(openmpi, + AC_HELP_STRING([--with-openmpi=DIR],[root directory path of openmpi installation]), + WITHOPENMPI="yes",WITHOPENMPI="no") + +MPI_INCLUDES="" +MPI_LIBS="" +mpi_ok=no + +if test "$WITHOPENMPI" = yes; then + + OPENMPI_HOME=$withval + + if test "$OPENMPI_HOME"; then + MPI_INCLUDES=`$OPENMPI_HOME/bin/mpicxx --showme:compile` + MPI_LIBS=`$OPENMPI_HOME/bin/mpicxx --showme:link` + fi + + CPPFLAGS_old="$CPPFLAGS" + CPPFLAGS="$MPI_INCLUDES $CPPFLAGS" + AC_CHECK_HEADER(mpi.h,WITHOPENMPI="yes",WITHOPENMPI="no") + CPPFLAGS="$CPPFLAGS_old" + + AC_MSG_CHECKING(for openmpi) + if test "$WITHOPENMPI" = "yes";then + mpi_ok=yes + AC_MSG_RESULT(yes) + else + mpi_ok=no + AC_MSG_RESULT(no) + fi +fi +])dnl + diff --git a/salome_adm/unix/config_files/check_swig.m4 b/salome_adm/unix/config_files/check_swig.m4 index db9d234e9..019755067 100644 --- a/salome_adm/unix/config_files/check_swig.m4 +++ b/salome_adm/unix/config_files/check_swig.m4 @@ -57,6 +57,13 @@ EOF AC_MSG_RESULT($swig_ok) fi +numpydir=`$PYTHON -c "import numpy;print numpy.get_include()" 2>/dev/null` +if test -d "$numpydir"; then + SWIG_FLAGS="$SWIG_FLAGS -DWITH_NUMPY" + PYTHON_INCLUDES="$PYTHON_INCLUDES -I$numpydir" + AC_DEFINE([WITH_NUMPY], [], [Python has numpy extension]) +fi + AC_SUBST(SWIG_FLAGS) AC_SUBST(SWIG) diff --git a/salome_adm/unix/config_files/install-sh b/salome_adm/unix/config_files/install-sh deleted file mode 100755 index 6ebe46de6..000000000 --- a/salome_adm/unix/config_files/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2004-12-17.09 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit 0;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit 0;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/salome_adm/unix/config_files/ltmain.sh b/salome_adm/unix/config_files/ltmain.sh deleted file mode 100644 index 6828dc0e0..000000000 --- a/salome_adm/unix/config_files/ltmain.sh +++ /dev/null @@ -1,6443 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# define SED for historic ltconfig's generated by Libtool 1.3 -test -z "$SED" && SED=sed - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.6 -TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)" - - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () { - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} -# End of Shell function definitions -##################################### - -# Darwin sucks -#eval std_shrext=\"$shrext_cmds\" - -# And fixing for Darwin sucks for everybody else -if test -z "$shrext_cmds" && test -n "$shrext"; then - eval shrext_cmds=\"$shrext\" -fi -eval std_shrext=\"$shrext_cmds\" - -# This value is evaluated to 32768, so place it here as a compatilibity hack -# because older libtool.m4 didn't define this variable -test -z "$max_cmd_len" && max_cmd_len=32768 - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $EXIT_SUCCESS - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $EXIT_SUCCESS - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - - for arg - do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - if test "$deplibs_check_method" != pass_all; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - [0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $revision in - [0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $age in - [0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - tmp_deplibs= - inst_prefix_arg= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then - inst_prefix_arg="$test_deplib" - else - tmp_deplibs="$tmp_deplibs $test_deplib" - fi - ;; - esac - done - deplibs="$tmp_deplibs" - if test -n "$inst_prefix_arg"; then - deplibs="$inst_prefix_arg $deplibs" - fi - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$save_output-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" - fi - last_robj=$output_objdir/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext - objlist=$obj - len=1 - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask - else - umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $EXIT_SUCCESS - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/salome_adm/unix/config_files/missing b/salome_adm/unix/config_files/missing deleted file mode 100644 index 7789652e8..000000000 --- a/salome_adm/unix/config_files/missing +++ /dev/null @@ -1,190 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/salome_adm/unix/config_files/production.m4 b/salome_adm/unix/config_files/production.m4 index e4a61870b..b43c055a1 100644 --- a/salome_adm/unix/config_files/production.m4 +++ b/salome_adm/unix/config_files/production.m4 @@ -28,30 +28,20 @@ dnl version $Id$ dnl author Patrick GOLDBRONN dnl -# AC_ENABLE_PRODUCTION -AC_DEFUN([AC_ENABLE_PRODUCTION], [dnl -define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(production, -changequote(<<, >>)dnl -<< --enable-production[=PKGS] build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_production=yes ;; -no) enable_production=no ;; -*) - enable_production=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_production=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl +dnl AC_ENABLE_PRODUCTION +dnl +dnl This macro enables production build : optimized + no debugging information (-g) +dnl default = not enabled +dnl +AC_DEFUN([AC_ENABLE_PRODUCTION], +[define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([production], + [AC_HELP_STRING([--enable-production], + [compile in optimized mode @<:@default=]AC_ENABLE_PRODUCTION_DEFAULT[@:>@])], + [ + enable_production=$enableval + ], + [enable_production=]AC_ENABLE_PRODUCTION_DEFAULT) AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS) AC_CXX_OPTION(-Wparentheses,CXXFLAGS) @@ -65,36 +55,29 @@ if test "X$enable_production" = "Xyes"; then CFLAGS="$CFLAGS -O" AC_CXX_OPTION(-Wuninitialized,CXXFLAGS) CXXFLAGS="$CXXFLAGS -O " +else + CFLAGS="$CFLAGS -g" + CXXFLAGS="$CXXFLAGS -g" fi ]) # AC_DISABLE_PRODUCTION - set the default flag to --disable-production AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)]) -# AC_ENABLE_DEBUG -AC_DEFUN([AC_ENABLE_DEBUG], [dnl -define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(debug, -changequote(<<, >>)dnl -<< --enable-debug[=PKGS] build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_debug=yes ;; -no) enable_debug=no ;; -*) - enable_debug=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_debug=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl +dnl AC_ENABLE_DEBUG +dnl +dnl This macro enables debugging build : debug + trace +dnl default = not enabled +dnl +AC_DEFUN([AC_ENABLE_DEBUG], + [define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl + AC_ARG_ENABLE([debug], + [AC_HELP_STRING([--enable-debug], + [build with debug and trace information @<:@default=]AC_ENABLE_DEBUG_DEFAULT[@:>@])], + [ + enable_debug=$enableval + ], + [enable_debug=]AC_ENABLE_DEBUG_DEFAULT) if test "X$enable_debug" = "Xyes"; then CFLAGS="$CFLAGS -g -D_DEBUG_ " diff --git a/salome_adm/unix/make_common_starter.am b/salome_adm/unix/make_common_starter.am index 007845b44..258e057af 100644 --- a/salome_adm/unix/make_common_starter.am +++ b/salome_adm/unix/make_common_starter.am @@ -22,6 +22,7 @@ salomeresdir = $(prefix)/share/@PACKAGE@/resources/@MODULE_NAME@ salomeadmdir = $(prefix)/salome_adm salomeadmuxdir = $(salomeadmdir)/unix salomem4dir = $(salomeadmdir)/unix/config_files +salome4deprdir = $(salomeadmdir)/unix/config_files/DEPRECATED # Shared modules installation directory sharedpkgpythondir =$(pkgpythondir)/shared_modules diff --git a/src/Batch/BatchLight_BatchManager.cxx b/src/Batch/BatchLight_BatchManager.cxx new file mode 100644 index 000000000..4e0241f38 --- /dev/null +++ b/src/Batch/BatchLight_BatchManager.cxx @@ -0,0 +1,272 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include +#include +#include +#include +#include "BatchLight_Job.hxx" +#include "BatchLight_BatchManager.hxx" +#include "Batch_Date.hxx" +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager::BatchManager(const batchParams& p) throw(SALOME_Exception) : _params(p) + { + SCRUTE(_params.hostname); + SCRUTE(_params.protocol); + SCRUTE(_params.username); + // On verifie que le hostname est correct + if (!gethostbyname(_params.hostname.c_str())) { // hostname unknown from network + string msg = "hostname \""; + msg += _params.hostname; + msg += "\" unknown from the network"; + throw SALOME_Exception(msg.c_str()); + } + _mpiImpl = NULL; + } + + // Destructeur + BatchManager::~BatchManager() + { + MESSAGE("BatchManager destructor "<<_params.hostname); + std::map < int, const BatchLight::Job * >::const_iterator it; + for(it=_jobmap.begin();it!=_jobmap.end();it++) + delete it->second; + if(_mpiImpl) delete _mpiImpl; + } + + // Methode pour le controle des jobs : soumet un job au gestionnaire + const int BatchManager::submitJob(Job* job) + { + BEGIN_OF("BatchManager::submitJob"); + int id; + + // temporary directory on cluster to put input files for job + setDirForTmpFiles(); + SCRUTE(_dirForTmpFiles); + + // export input files on cluster + exportInputFiles(job->getFileToExecute(),job->getFilesToExportList()); + + // build salome coupling script for job + buildSalomeCouplingScript(job->getFileToExecute()); + + // build batch script for job + buildSalomeBatchScript(job->getNbProc()); + + // submit job on cluster + id = submit(); + + // register job on map + _jobmap[id] = job; + END_OF("BatchManager::submitJob"); + return id; + } + + void BatchManager::setDirForTmpFiles() + { + int i; + + _dirForTmpFiles = string("Batch/"); + Batch::Date date = Batch::Date(time(0)) ; + std::string thedate = date.str() ; + int lend = thedate.size() ; + i = 0 ; + while ( i < lend ) { + if ( thedate[i] == '/' || thedate[i] == '-' || thedate[i] == ':' ) { + thedate[i] = '_' ; + } + i++ ; + } + _dirForTmpFiles += thedate ; + } + + void BatchManager::exportInputFiles(const char *fileToExecute, const Engines::FilesList filesToExportList) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager::exportInFiles"); + string command = _params.protocol; + int status; + + command += " "; + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"mkdir -p "; + command += _dirForTmpFiles ; + command += "\"" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + + command += fileToExecute; + command += " "; + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + int i ; + for ( i = 0 ; i < filesToExportList.length() ; i++ ) { + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + command += filesToExportList[i] ; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + } + + END_OF("BatchManager::exportInFiles"); + } + + void BatchManager::importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager::importOutputFiles"); + string command; + int status; + + const BatchLight::Job* myJob = _jobmap[jobId]; + Engines::FilesList filesToImportList = myJob->getFilesToImportList(); + + for ( int i = 0 ; i < filesToImportList.length() ; i++ ) { + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += filesToImportList[i] ; + command += " "; + command += directory; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + } + + END_OF("BatchManager::importOutputFiles"); + } + + string BatchManager::BuildTemporaryFileName() const + { + //build more complex file name to support multiple salome session + char *temp = new char[19]; + strcpy(temp, "/tmp/command"); + strcat(temp, "XXXXXX"); +#ifndef WNT + + mkstemp(temp); +#else + + char aPID[80]; + itoa(getpid(), aPID, 10); + strcat(temp, aPID); +#endif + + string command(temp); + delete [] temp; + command += ".sh"; + return command; + } + + void BatchManager::RmTmpFile() + { + if (_TmpFileName != ""){ + string command = "rm "; + command += _TmpFileName; + char *temp = strdup(command.c_str()); + int lgthTemp = strlen(temp); + temp[lgthTemp - 3] = '*'; + temp[lgthTemp - 2] = '\0'; + system(temp); + free(temp); + } + } + + MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl) throw(SALOME_Exception) + { + if(mpiImpl == "lam") + return new MpiImpl_LAM(); + else if(mpiImpl == "mpich1") + return new MpiImpl_MPICH1(); + else if(mpiImpl == "mpich2") + return new MpiImpl_MPICH2(); + else if(mpiImpl == "openmpi") + return new MpiImpl_OPENMPI(); + else if(mpiImpl == "indif") + throw SALOME_Exception("you must specify a mpi implementation in CatalogResources.xml file"); + else{ + ostringstream oss; + oss << mpiImpl << " : not yet implemented"; + throw SALOME_Exception(oss.str().c_str()); + } + } + +} diff --git a/src/Batch/BatchLight_BatchManager.hxx b/src/Batch/BatchLight_BatchManager.hxx new file mode 100644 index 000000000..a8ea0061a --- /dev/null +++ b/src/Batch/BatchLight_BatchManager.hxx @@ -0,0 +1,94 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_H_ +#define _BL_BATCHMANAGER_H_ + +#include +#include +#include +#include "Utils_SALOME_Exception.hxx" +#include +#include +#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) +#include "MpiImpl.hxx" + +namespace BatchLight { + + class Job; + + struct batchParams{ + std::string hostname; // serveur ou tourne le BatchManager + std::string protocol; // protocole d'acces au serveur: ssh ou rsh + std::string username; // username d'acces au serveur + std::string applipath; // path of apllication directory on server + std::vector modulesList; // list of Salome modules installed on server + unsigned int nbnodes; // number of nodes on cluster + unsigned int nbprocpernode; // number of processors on each node + std::string mpiImpl; // mpi implementation + }; + + class BatchManager + { + public: + // Constructeur et destructeur + BatchManager(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager(); + + // Methodes pour le controle des jobs : virtuelles pures + const int submitJob(BatchLight::Job* job); // soumet un job au gestionnaire + virtual void deleteJob(const int & jobid) = 0; // retire un job du gestionnaire + virtual std::string queryJob(const int & jobid) = 0; // renvoie l'etat du job + void importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception); + + protected: + batchParams _params; + MpiImpl *_mpiImpl; + + std::map _jobmap; + std::string _dirForTmpFiles; // repertoire temporaire sur le serveur + std::string _TmpFileName; + std::string _fileNameToExecute; + + virtual int submit() throw(SALOME_Exception) = 0; + void setDirForTmpFiles(); + void exportInputFiles( const char *fileToExecute, const Engines::FilesList filesToExportList ) throw(SALOME_Exception); + virtual void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception) = 0; + virtual void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception) = 0; + + std::string BuildTemporaryFileName() const; + void RmTmpFile(); + MpiImpl *FactoryMpiImpl(std::string mpiImpl) throw(SALOME_Exception); + + private: + + }; + +} + +#endif diff --git a/src/Batch/BatchLight_BatchManager_PBS.cxx b/src/Batch/BatchLight_BatchManager_PBS.cxx new file mode 100644 index 000000000..bba030a0c --- /dev/null +++ b/src/Batch/BatchLight_BatchManager_PBS.cxx @@ -0,0 +1,375 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_BatchManager_PBS.hxx" +#include "utilities.h" +#include "BatchLight_Job.hxx" +#include +#include +#include +#include + +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager_PBS::BatchManager_PBS(const batchParams& p) throw(SALOME_Exception) : BatchManager(p) + { + // pbs batch system needs to know mpi implementation + _mpiImpl = FactoryMpiImpl(_params.mpiImpl); + } + + // Destructeur + BatchManager_PBS::~BatchManager_PBS() + { + MESSAGE("BatchManager_PBS destructor "<<_params.hostname); + } + + // Methode pour le controle des jobs : retire un job du gestionnaire + void BatchManager_PBS::deleteJob(const int & jobid) + { + BEGIN_OF("BatchManager_PBS::deleteJob"); + string command; + int status; + ostringstream oss; + oss << jobid; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"qdel " ; + command += oss.str(); + command += "\""; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + MESSAGE("jobId = " << jobid << "killed"); + END_OF("BatchManager_PBS::deleteJob"); + } + + // Methode pour le controle des jobs : renvoie l'etat du job + string BatchManager_PBS::queryJob(const int & jobid) + { + BEGIN_OF("BatchManager_PBS::queryJob"); + // define name of log file + string jstatus; + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"qstat -f " ; + ostringstream oss2; + oss2 << jobid; + command += oss2.str(); + command += "\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status && status != 153 && status != 256*153){ + MESSAGE("status="<> jstatus; + iss >> jstatus; + iss >> jstatus; + } + else + jstatus = "U"; + } + + MESSAGE("jobId = " << jobid << " " << jstatus); + END_OF("BatchManager_PBS::queryJob"); + return jstatus; + } + + void BatchManager_PBS::buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeCouplingScript"); + int status; + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + _fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + _TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "cd " ; + tempOutputFile << _params.applipath << endl ; + tempOutputFile << "export PYTHONPATH=~/" ; + tempOutputFile << _dirForTmpFiles ; + tempOutputFile << ":$PYTHONPATH" << endl ; + tempOutputFile << "if test " ; + tempOutputFile << _mpiImpl->rank() ; + tempOutputFile << " = 0; then" << endl ; + tempOutputFile << " ./runAppli --terminal --modules=" ; + for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) { + tempOutputFile << _params.modulesList[i] ; + if ( i != _params.modulesList.size()-1 ) + tempOutputFile << "," ; + } + tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ; + tempOutputFile << " for ((ip=1; ip < "; + tempOutputFile << _mpiImpl->size(); + tempOutputFile << " ; ip++))" << endl; + tempOutputFile << " do" << endl ; + tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ; + tempOutputFile << " done" << endl ; + tempOutputFile << " sleep 5" << endl ; + tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ; + tempOutputFile << " ./runSession python ~/" << _dirForTmpFiles << "/" << _fileNameToExecute << ".py" << endl; + tempOutputFile << " ./runSession killCurrentPort" << endl; + tempOutputFile << "else" << endl ; + tempOutputFile << " sleep 5" << endl ; + tempOutputFile << " ./runSession waitNS.py" << endl ; + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'"; + tempOutputFile << _mpiImpl->rank() << endl ; + tempOutputFile << "fi" << endl ; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(_TmpFileName.c_str(), 0x1ED); + SCRUTE(_TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + + command += _TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + command += "/runSalome_" ; + command += _fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(_fileNameToExecute) ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + RmTmpFile(); + + END_OF("BatchManager_PBS::buildSalomeCouplingScript"); + } + + void BatchManager_PBS::buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeBatchScript"); + int status; + + int nbmaxproc = _params.nbnodes * _params.nbprocpernode; + if( nbproc > nbmaxproc ){ + MESSAGE(nbproc << " processors asked on a cluster of " << nbmaxproc << " processors"); + throw SALOME_Exception("Too much processors asked for that cluster"); + } + + int nbnodes; + if( nbproc < _params.nbnodes ) + nbnodes = nbproc; + else + nbnodes = _params.nbnodes; + + _TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); + + ostringstream filenameToExecute; + filenameToExecute << " ~/" << _dirForTmpFiles << "/runSalome_" << _fileNameToExecute << "_Batch.sh"; + + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "#PBS -l nodes=" << nbnodes << endl ; + tempOutputFile << "#PBS -o ~/" << _dirForTmpFiles << "/runSalome.log${PBS_JOBID}" << endl ; + tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbnodes); + tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,filenameToExecute.str()); + tempOutputFile << _mpiImpl->halt(); + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(_TmpFileName.c_str(), 0x1ED); + SCRUTE(_TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + command += _TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + command += "/" ; + command += _fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + RmTmpFile(); + END_OF("BatchManager_PBS::buildSalomeBatchScript"); + + } + + int BatchManager_PBS::submit() throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::submit"); + + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"qsub " ; + command += _dirForTmpFiles ; + command += "/" ; + command += _fileNameToExecute ; + command += "_Batch.sh\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read id of submitted job in log file + char line[128]; + FILE *fp = fopen(logFile.c_str(),"r"); + fgets( line, 128, fp); + fclose(fp); + + string sline(line); + int pos = sline.find("."); + string strjob; + if(pos == string::npos) + strjob = sline; + else + strjob = sline.substr(0,pos); + + int id; + istringstream iss(strjob); + iss >> id; + + END_OF("BatchManager_PBS::submit"); + return id; + } + +} diff --git a/src/Batch/BatchLight_BatchManager_PBS.hxx b/src/Batch/BatchLight_BatchManager_PBS.hxx new file mode 100644 index 000000000..e7e5789c7 --- /dev/null +++ b/src/Batch/BatchLight_BatchManager_PBS.hxx @@ -0,0 +1,59 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_PBS_H_ +#define _BL_BATCHMANAGER_PBS_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include "BatchLight_BatchManager.hxx" + +namespace BatchLight { + + class Job; + + class BatchManager_PBS : public BatchManager + { + public: + // Constructeur et destructeur + BatchManager_PBS(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager_PBS(); + + // Methodes pour le controle des jobs : virtuelles pures + void deleteJob(const int & jobid); // retire un job du gestionnaire + std::string queryJob(const int & jobid); // renvoie l'etat du job + + private: + void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception); + void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception); + int submit() throw(SALOME_Exception); + }; + +} + +#endif diff --git a/src/Batch/BatchLight_BatchManager_SLURM.cxx b/src/Batch/BatchLight_BatchManager_SLURM.cxx new file mode 100644 index 000000000..9a740e328 --- /dev/null +++ b/src/Batch/BatchLight_BatchManager_SLURM.cxx @@ -0,0 +1,327 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_BatchManager_SLURM.hxx" +#include "utilities.h" +#include "BatchLight_Job.hxx" +#include +#include +#include +#include + +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager_SLURM::BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception) : BatchManager(p) + { + } + + // Destructeur + BatchManager_SLURM::~BatchManager_SLURM() + { + MESSAGE("BatchManager_SLURM destructor "<<_params.hostname); + } + + // Methode pour le controle des jobs : retire un job du gestionnaire + void BatchManager_SLURM::deleteJob(const int & jobid) + { + BEGIN_OF("BatchManager_SLURM::deleteJob"); + string command; + int status; + ostringstream oss; + oss << jobid; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bkill " ; + command += oss.str(); + command += "\""; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + MESSAGE("jobId = " << jobid << "killed"); + END_OF("BatchManager_SLURM::deleteJob"); + } + + // Methode pour le controle des jobs : renvoie l'etat du job + string BatchManager_SLURM::queryJob(const int & jobid) + { + BEGIN_OF("BatchManager_SLURM::queryJob"); + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bjobs " ; + ostringstream oss2; + oss2 << jobid; + command += oss2.str(); + command += "\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read staus of job in log file + char line[128]; + ifstream fp(logFile.c_str(),ios::in); + fp.getline(line,80,'\n'); + + string sjobid, username, jstatus; + fp >> sjobid; + fp >> username; + fp >> jstatus; + + MESSAGE("jobId = " << jobid << " " << jstatus); + END_OF("BatchManager_SLURM::queryJob"); + return jstatus; + } + + void BatchManager_SLURM::buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + int status; + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + _fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + _TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "cd " ; + tempOutputFile << _params.applipath << endl ; + tempOutputFile << "export PYTHONPATH=~/" ; + tempOutputFile << _dirForTmpFiles ; + tempOutputFile << ":$PYTHONPATH" << endl ; + tempOutputFile << "if test $SLURM_PROCID = 0; then" << endl ; + tempOutputFile << " ./runAppli --terminal --modules=" ; + for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) { + tempOutputFile << _params.modulesList[i] ; + if ( i != _params.modulesList.size()-1 ) + tempOutputFile << "," ; + } + tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ; + tempOutputFile << " for ((ip=1; ip < ${SLURM_NPROCS} ; ip++))" << endl; + tempOutputFile << " do" << endl ; + tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ; + tempOutputFile << " done" << endl ; + tempOutputFile << " ./runSession waitNS.sh" << endl ; + tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ; + tempOutputFile << " ./runSession python ~/" << _dirForTmpFiles << "/" << _fileNameToExecute << ".py" << endl; + tempOutputFile << " ./runSession killCurrentPort" << endl; + tempOutputFile << "else" << endl ; + tempOutputFile << " ./runSession waitNS.sh" << endl ; + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'${SLURM_PROCID}" << endl ; + tempOutputFile << "fi" << endl ; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(_TmpFileName.c_str(), 0x1ED); + SCRUTE(_TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + + command += _TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + command += "/runSalome_" ; + command += _fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + RmTmpFile(); + + END_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + } + + void BatchManager_SLURM::buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeBatchScript"); + int status; + _TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); + + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "#BSUB -n " << nbproc << endl ; + tempOutputFile << "#BSUB -o " << _dirForTmpFiles << "/runSalome.log%J" << endl ; + tempOutputFile << "mpirun -srun ~/" << _dirForTmpFiles << "/runSalome_" << _fileNameToExecute << "_Batch.sh" << endl ; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(_TmpFileName.c_str(), 0x1ED); + SCRUTE(_TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + command += _TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += _dirForTmpFiles ; + command += "/" ; + command += _fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + RmTmpFile(); + END_OF("BatchManager_SLURM::buildSalomeBatchScript"); + + } + + int BatchManager_SLURM::submit() throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::submit"); + + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bsub < " ; + command += _dirForTmpFiles ; + command += "/" ; + command += _fileNameToExecute ; + command += "_Batch.sh\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read id of submitted job in log file + char line[128]; + FILE *fp = fopen(logFile.c_str(),"r"); + fgets( line, 128, fp); + fclose(fp); + + string sline(line); + int p1 = sline.find("<"); + int p2 = sline.find(">"); + string strjob = sline.substr(p1+1,p2-p1-1); + + int id; + istringstream iss(strjob); + iss >> id; + + END_OF("BatchManager_SLURM::submit"); + return id; + } + +} diff --git a/src/Batch/BatchLight_BatchManager_SLURM.hxx b/src/Batch/BatchLight_BatchManager_SLURM.hxx new file mode 100644 index 000000000..ed21624dd --- /dev/null +++ b/src/Batch/BatchLight_BatchManager_SLURM.hxx @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_SLURM_H_ +#define _BL_BATCHMANAGER_SLURM_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include "BatchLight_BatchManager.hxx" + +namespace BatchLight { + + class Job; + + class BatchManager_SLURM : public BatchManager + { + public: + // Constructeur et destructeur + BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager_SLURM(); + + // Methodes pour le controle des jobs : virtuelles pures + void deleteJob(const int & jobid); // retire un job du gestionnaire + std::string queryJob(const int & jobid); // renvoie l'etat du job + + protected: + void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception); + void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception); + int submit() throw(SALOME_Exception); + + private: + + }; + +} + +#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx b/src/Batch/BatchLight_Job.cxx similarity index 62% rename from src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx rename to src/Batch/BatchLight_Job.cxx index 7a0cd5471..9762a98a6 100644 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx +++ b/src/Batch/BatchLight_Job.cxx @@ -17,21 +17,29 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif +/* + * Job.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_Job.hxx" +using namespace std; + +namespace BatchLight { + + // Constructeur + Job::Job(const char *fileToExecute, const Engines::FilesList& filesToExport, const Engines::FilesList& filesToImport, const int nbproc) : _fileToExecute(fileToExecute), _filesToExport(filesToExport), _filesToImport(filesToImport), _nbproc(nbproc) + { + // Nothing to do + } + + Job::~Job() + { + MESSAGE("Job destructor"); + } + +} diff --git a/src/Batch/BatchLight_Job.hxx b/src/Batch/BatchLight_Job.hxx new file mode 100644 index 000000000..23ac8f3bb --- /dev/null +++ b/src/Batch/BatchLight_Job.hxx @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * Job.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_JOB_H_ +#define _BL_JOB_H_ + +#include "utilities.h" +#include +#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) + +namespace BatchLight { + + class Job + { + public: + // Constructeurs et destructeur + Job(const char *fileToExecute, const Engines::FilesList& filesToExport, const Engines::FilesList& filesToImport, const int nbproc); + virtual ~Job(); + + const char *getFileToExecute() const { return _fileToExecute; } + const Engines::FilesList getFilesToExportList() const { return _filesToExport; } + const Engines::FilesList getFilesToImportList() const { return _filesToImport; } + const int getNbProc() const { return _nbproc; } + + protected: + const char* _fileToExecute; + const Engines::FilesList _filesToExport; + const Engines::FilesList _filesToImport; + const int _nbproc; + + private: + + }; + +} + +#endif diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am index 095173c50..425e39f5c 100644 --- a/src/Batch/Makefile.am +++ b/src/Batch/Makefile.am @@ -59,7 +59,12 @@ LIB_INCLUDES = \ Batch_PyVersatile.hxx \ Batch_RunTimeException.hxx \ Batch_StringType.hxx \ - Batch_TypeMismatchException.hxx + Batch_TypeMismatchException.hxx \ + BatchLight_BatchManager.hxx \ + BatchLight_BatchManager_PBS.hxx \ + BatchLight_BatchManager_SLURM.hxx \ + BatchLight_Job.hxx \ + MpiImpl.hxx LIB_SRC = \ @@ -91,7 +96,12 @@ LIB_SRC = \ Batch_PyVersatile.cxx \ Batch_RunTimeException.cxx \ Batch_StringType.cxx \ - Batch_TypeMismatchException.cxx + Batch_TypeMismatchException.cxx \ + BatchLight_BatchManager.cxx \ + BatchLight_BatchManager_SLURM.cxx \ + BatchLight_BatchManager_PBS.cxx \ + BatchLight_Job.cxx \ + MpiImpl.cxx LIB_CPPFLAGS = \ @@ -203,8 +213,10 @@ libSalomeBatch_la_CPPFLAGS = \ @PYTHON_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ + -I$(srcdir)/../Utils \ -I$(top_builddir)/salome_adm/unix \ - $(LIB_CPPFLAGS) + -I$(top_builddir)/idl \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ $(LIB_CPPFLAGS) libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeBatch_la_LIBADD = \ diff --git a/src/Batch/MpiImpl.cxx b/src/Batch/MpiImpl.cxx new file mode 100644 index 000000000..036018b1e --- /dev/null +++ b/src/Batch/MpiImpl.cxx @@ -0,0 +1,212 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include +#include +#include +#include "utilities.h" +#include "MpiImpl.hxx" + +using namespace std; + +// Constructor +MpiImpl::MpiImpl() +{ + MESSAGE("MpiImpl constructor"); +} + +// Destructor +MpiImpl::~MpiImpl() +{ + MESSAGE("MpiImpl destructor"); +} + +// lam implementation +// Constructor +MpiImpl_LAM::MpiImpl_LAM() : MpiImpl() +{ +} + +// Destructor +MpiImpl_LAM::~MpiImpl_LAM() +{ + MESSAGE("MpiImpl_LAM destructor"); +} + +string MpiImpl_LAM::size() +{ + return "${LAMWORLD}"; +} + +string MpiImpl_LAM::rank() +{ + return "${LAMRANK}"; +} + +string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes) +{ + ostringstream oss; + oss << "lamboot " << machinefile << endl; + return oss.str(); +} + +string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_LAM::halt() +{ + ostringstream oss; + oss << "lamhalt" << endl; + return oss.str(); +} + +// mpich1 implementation +// Constructor +MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl() +{ +} + +// Destructor +MpiImpl_MPICH1::~MpiImpl_MPICH1() +{ + MESSAGE("MpiImpl_MPICH1 destructor"); +} + +string MpiImpl_MPICH1::size() +{ + throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session"); +} + +string MpiImpl_MPICH1::rank() +{ + throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session"); +} + +string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes) +{ + return ""; +} + +string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_MPICH1::halt() +{ + return ""; +} + +// mpich2 implementation +// Constructor +MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl() +{ +} + +// Destructor +MpiImpl_MPICH2::~MpiImpl_MPICH2() +{ + MESSAGE("MpiImpl_MPICH2 destructor"); +} + +string MpiImpl_MPICH2::size() +{ + return "${PMI_SIZE}"; +} + +string MpiImpl_MPICH2::rank() +{ + return "${PMI_RANK}"; +} + +string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes) +{ + ostringstream oss; + oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl; + return oss.str(); +} + +string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_MPICH2::halt() +{ + ostringstream oss; + oss << "mpdallexit" << endl; + return oss.str(); +} + +// openmpi implementation +// Constructor +MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl() +{ +} + +// Destructor +MpiImpl_OPENMPI::~MpiImpl_OPENMPI() +{ + MESSAGE("MpiImpl_OPENMPI destructor"); +} + +string MpiImpl_OPENMPI::size() +{ + return "${OMPI_MCA_ns_nds_num_procs}"; +} + +string MpiImpl_OPENMPI::rank() +{ + return "${OMPI_MCA_ns_nds_vpid}"; +} + +string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes) +{ + return ""; +} + +string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_OPENMPI::halt() +{ + return ""; +} + diff --git a/src/Batch/MpiImpl.hxx b/src/Batch/MpiImpl.hxx new file mode 100644 index 000000000..beeac0301 --- /dev/null +++ b/src/Batch/MpiImpl.hxx @@ -0,0 +1,131 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_MPIIMPL_H_ +#define _BL_MPIIMPL_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include + +class MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl(); // constrcuctor + virtual ~MpiImpl(); //Destructor + + virtual std::string size() = 0; // get number of process of current job + virtual std::string rank() = 0; // get process number of current job + virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command + virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command + virtual std::string halt() = 0; // get stop command + +protected: + +private: + +}; + +class MpiImpl_LAM : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_LAM(); // constructor + virtual ~MpiImpl_LAM(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_MPICH1 : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_MPICH1(); // constructor + virtual ~MpiImpl_MPICH1(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_MPICH2 : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_MPICH2(); // constructor + virtual ~MpiImpl_MPICH2(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_OPENMPI : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_OPENMPI(); // constructor + virtual ~MpiImpl_OPENMPI(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +#endif diff --git a/src/CASCatch/CASCatch.hxx b/src/CASCatch/CASCatch.hxx deleted file mode 100644 index 03541f951..000000000 --- a/src/CASCatch/CASCatch.hxx +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_HeaderFile -#define _CASCatch_HeaderFile - -#include -#include - - -#ifdef try -# undef try -#endif - -#ifdef catch -# undef catch -#endif - -#ifdef NO_CXX_EXCEPTION -# if defined(DO_ABORT) -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - K_SETJMP = 1 ; \ - if(DoesNotAbort(_Function)) -# else //If DO_ABORT is not defined -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - if(DoesNotAbort(_Function)) -# endif //DO_ABORT -# define CASCatch_CATCH(Error) \ - else if(_Function.Catches(STANDARD_TYPE(Error))) -#else -# define CASCatch_TRY try -# define CASCatch_CATCH catch -#endif //NO_CXX_EXCEPTION - - -#endif diff --git a/src/CASCatch/CASCatch_CatchSignals.cxx b/src/CASCatch/CASCatch_CatchSignals.cxx deleted file mode 100644 index b039baaa2..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.cxx +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CASCatch_CatchSignals.hxx" - -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include - -#define MAX_HANDLER_NUMBER 6 - - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_CatchSignals - */ -//================================================================================ -CASCatch_CatchSignals::CASCatch_CatchSignals() - :myIsActivated(Standard_False) -{ - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = NULL; -} - -#ifndef WNT - -//================================ UNIX part ================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef LIN -#include -#endif - -//============================== -typedef void (ACT_SIGIO_HANDLER)(void) ; - -ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ; - -typedef void (* SIG_PFV) (int); - -#ifdef SUN -# include -#endif - -#ifdef SOLARIS -# include -# include -# include -# include -#endif - -#include -#include - -#ifdef LIN -# include -# include -#else -# ifdef SA_SIGINFO -# ifndef AIX -# include -# endif -# endif -#endif - - -#ifdef IRIX -# include -# include -#endif - - -//================================================================================ -/*! Private - - * \brief universal handler for signals - */ -//================================================================================ -static void Handler(const OSD_Signals theSig, const OSD_Signals) -{ - sigset_t set; - sigemptyset(&set); - sigaddset(&set, theSig); - sigprocmask(SIG_UNBLOCK, &set, NULL) ; - - TCollection_AsciiString aMessage(theSig); - aMessage+=" signal detected"; - - CASCatch_Failure::Raise(aMessage.ToCString()); -} - - -#ifdef SA_SIGINFO -//================================================================================ -/*! Private - - * \brief handler for SIGSEGV signal - */ -//================================================================================ -static void SegvHandler(const OSD_Signals, const Standard_Address, const Standard_Address) -{ - sigset_t set; - sigemptyset(&set); - sigaddset(&set, SIGSEGV); - sigprocmask (SIG_UNBLOCK, &set, NULL); - - CASCatch_Failure::Raise("SIGSEGV detected"); -} -#endif - - -//================================================================================ -/*! Public - - * \brief activates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Activate() -{ - if(myIsActivated) return; - - struct sigaction act; - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = new struct sigaction(); //Initialize structures - - int stat; - act.sa_handler = (SIG_PFV) &Handler ; - sigemptyset(&act.sa_mask) ; - - - stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]); // ...... hangup - stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]); // ...... floating point exception - stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]); // ...... interrupt - stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]); // ...... quit - stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]); // ...... bus error - stat = sigaction(SIGILL,&act,(struct sigaction*)mySigStates[5]); // ...... illegal instruction - -#ifdef SA_RESTART - act.sa_flags = SA_RESTART ; -#else - act.sa_flags = 0 ; -#endif - act.sa_handler = (SIG_PFV) &SegvHandler ; - -#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX - act.sa_flags = act.sa_flags | SA_SIGINFO ; -# ifdef SOLARIS - act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ; -# endif -#endif - - stat = sigaction( SIGSEGV , &act , (struct sigaction*)mySigStates[6]); // ...... segmentation violation - - myIsActivated = Standard_True; -} - - -//================================================================================ -/*! Public - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Deactivate() -{ - if(!myIsActivated) return; - - struct sigaction oact; - int stat; - - stat = sigaction(SIGHUP,(struct sigaction*)mySigStates[0],&oact); // ...... hangup - stat = sigaction(SIGFPE,(struct sigaction*)mySigStates[1],&oact); // ...... floating point exception - stat = sigaction(SIGINT,(struct sigaction*)mySigStates[2],&oact); // ...... interrupt - stat = sigaction(SIGQUIT,(struct sigaction*)mySigStates[3],&oact); // ...... quit - stat = sigaction(SIGBUS,(struct sigaction*)mySigStates[4],&oact); // ...... bus error - stat = sigaction(SIGILL,(struct sigaction*)mySigStates[5],&oact); // ...... illegal instruction - stat = sigaction(SIGSEGV,(struct sigaction*)mySigStates[6],&oact); // ...... segmentation violation - - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - delete (struct sigaction*)mySigStates[i]; - - myIsActivated = Standard_False; -} - - - -#else -//====================================== WNT part ==================================================== -#include - -#include -#include -#include - -#define _OSD_FPX ( _EM_DENORMAL | _EM_INEXACT | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_OVERFLOW) //Mask these exceptions - -//================================================================================ -/*! Private - - * \brief handler for unexpected exceptions - */ -//================================================================================ -static Standard_Integer WntHandler(const Standard_Address theExceptionInfo) -{ - LPEXCEPTION_POINTERS lpXP = ( LPEXCEPTION_POINTERS )theExceptionInfo; - DWORD dwExceptionCode = lpXP -> ExceptionRecord -> ExceptionCode; - - TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode); - aMessage+=" Exception code - unexpected exception"; - - CASCatch_Failure::Raise(aMessage.ToCString()); - - return EXCEPTION_EXECUTE_HANDLER; -} - -void SIGWntHandler(int , int ) ; -static void (*SIGWNTHANDLER)(int) = ( void (*)(int) ) ( &SIGWntHandler ) ; - - -//================================================================================ -/*! Private - - * \brief handler for signals - */ -//================================================================================ -static void SIGWntHandler(const int signum , const int theCode) -{ - - void (*OLDSIGWNTHANDLER)(int) ; - switch( signum ) { - case SIGFPE : - _fpreset() ; - _clearfp() ; - _controlfp ( _OSD_FPX, _MCW_EM ); - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - - if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return; - CASCatch_Failure::Raise ("Floating point error"); - break; - case SIGSEGV : - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Access violation"); - break; - case SIGILL : - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Illegal instruction" ); - break; - } -} - - -//================================================================================ -/*! Public - - * \brief activates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Activate() -{ - if(myIsActivated) return; - - mySigStates[0] = SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )&WntHandler); - - myFloatOpWord = _controlfp(0, 0); - _controlfp ( _OSD_FPX, _MCW_EM ); //Enable floating point exceptions - - mySigStates[1] = signal( SIGSEGV , SIGWNTHANDLER ); - mySigStates[2] = signal( SIGFPE , SIGWNTHANDLER ); - mySigStates[3] = signal( SIGILL , SIGWNTHANDLER ); - - myIsActivated = Standard_True; -} - -//================================================================================ -/*! Public - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Deactivate() -{ - if(!myIsActivated) return; - - SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )mySigStates[0]); - - _controlfp ( myFloatOpWord, _MCW_EM ); - - signal( SIGSEGV , ( void (*)(int) )mySigStates[1]); - signal( SIGFPE , ( void (*)(int) )mySigStates[2]); - signal( SIGILL , ( void (*)(int) )mySigStates[3]); - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = NULL; - - myIsActivated = Standard_False; -} - -#endif - -//================================================================================ -/*! Private - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Destroy() -{ - if(myIsActivated) Deactivate(); -} - diff --git a/src/CASCatch/CASCatch_CatchSignals.hxx b/src/CASCatch/CASCatch_CatchSignals.hxx deleted file mode 100644 index a3fc42c3e..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_CatchSignals_HeaderFile -#define _CASCatch_CatchSignals_HeaderFile - -#include - -/*! - * \class CASCatch_CatchSignals - * \brief This class controls an exception handling - * - */ -class CASCatch_CatchSignals { - -public: - - // Methods PUBLIC - // -Standard_EXPORT CASCatch_CatchSignals(); -Standard_EXPORT void Destroy() ; -~CASCatch_CatchSignals() { Destroy(); } -Standard_EXPORT void Activate() ; -Standard_EXPORT void Deactivate() ; - -private: - -/*!\var mySigStates[7], private - * \brief stores signals' handler functions - */ -Standard_Address mySigStates[7]; - -/*!\var myFloatOpWord - * \brief stores a float operation word, private - */ -Standard_Integer myFloatOpWord; - -/*!\var myIsActivated - * \brief stores a flag whether a catcher is activated, private] - */ -Standard_Boolean myIsActivated; - -}; - - -#endif diff --git a/src/CASCatch/CASCatch_ErrorHandler.cxx b/src/CASCatch/CASCatch_ErrorHandler.cxx deleted file mode 100644 index 49af8d356..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifdef NO_CXX_EXCEPTION - -#include "CASCatch_ErrorHandler.hxx" - -// During setjmp()/longjmp() K_SETJMP_CASCatch is non zero (try) -// So if there is an abort request and if K_SETJMP_CASCatch is non zero, the abort -// request will be ignored. If the abort request do a raise during a setjmp -// or a longjmp, there will be a "terminating SEGV" impossible to handle. - - -Standard_EXPORT int K_SETJMP_CASCatch = 0 ; - -static Handle(CASCatch_Failure) GlbError; //Last caught Error, Null if there is no error - -static CASCatch_ErrorHandler* Top = 0; //The top of the Errors Stack - -//======================================================================= -//function : CASCatch_ErrorHandler -//purpose : Constructor -//======================================================================= -CASCatch_ErrorHandler::CASCatch_ErrorHandler () -{ - Previous = Top; - Top = this; - CaughtError.Nullify(); - GlbError.Nullify(); -} - -//======================================================================= -//function : ~CASCatch_ErrorHandler -//purpose : Destructor : Delete the ErrorHandler and Abort if there is a 'Error'. -//======================================================================= -CASCatch_ErrorHandler::~CASCatch_ErrorHandler() -{ - Top = Top->Previous; - if( !GlbError.IsNull() ) Abort(); -} - -//======================================================================= -//function : Abort: make a longjmp to the saved Context. -//purpose : Abort if there is a non null 'Error' -//======================================================================= -void CASCatch_ErrorHandler::Abort () -{ - //==== Check if can do the "longjmp" ======================================= - if(Top == NULL || Top->Label == NULL) { - cout << "*** Abort *** an exception was raised, but no catch was found." << endl; - cout << "\t... The exception is:" << GlbError; - exit(1); - } - -#ifdef DO_ABORT - if ( K_SETJMP_CASCatch ) - cout << "Recursive abort ===> Terminating SEGV ..." << endl ; - K_SETJMP_CASCatch = 1 ; -#endif - - longjmp(Top->Label, Standard_True); -} - -//======================================================================= -//function : Catches -//purpose : If there is a 'Error', and it is in good type -// returns True and clean 'Error', else returns False. -//======================================================================= -Standard_Boolean CASCatch_ErrorHandler::Catches - (const Handle(Standard_Type)& AType) -{ -#ifdef DO_ABORT - K_SETJMP_CASCatch = 0 ; -#endif - if(GlbError.IsNull()) - return Standard_False; - - if(GlbError->IsKind(AType)){ - CaughtError = GlbError; - GlbError.Nullify(); - return Standard_True; - } else { - return Standard_False; - } -} - -//======================================================================= -//function : LastCaughtError -//purpose : -//======================================================================= -Handle(CASCatch_Failure) CASCatch_ErrorHandler::LastCaughtError() -{ - return Top->CaughtError; -} - -//======================================================================= -//function : Error -//purpose : -//======================================================================= -void CASCatch_ErrorHandler::Error(const Handle(CASCatch_Failure)& aError) -{ - GlbError = aError; -} - -#endif diff --git a/src/CASCatch/CASCatch_ErrorHandler.hxx b/src/CASCatch/CASCatch_ErrorHandler.hxx deleted file mode 100644 index 05c6b2356..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_ErrorHandler_HeaderFile -#define _CASCatch_ErrorHandler_HeaderFile - -#include "CASCatch_Failure.hxx" - -#include -#include - - -extern int K_SETJMP_CASCatch ; - -/*! - * \class CASCatch_ErrorHandler - * \brief This class is an exception handler, private - * - */ -class CASCatch_ErrorHandler -{ - friend class CASCatch_Failure; // To execute the raise exception. - - public: - - Standard_EXPORT CASCatch_ErrorHandler(); - Standard_EXPORT ~CASCatch_ErrorHandler(); - Standard_EXPORT Standard_Boolean Catches (const Handle(Standard_Type)&); - - private: - Standard_EXPORT static void Abort(); - Standard_EXPORT static void Error(const Handle(CASCatch_Failure)&); - Standard_EXPORT static Handle(CASCatch_Failure) LastCaughtError(); - - //==== The fields =========================================================== - private: - CASCatch_ErrorHandler* Previous; - Handle(CASCatch_Failure) CaughtError; - - public: - jmp_buf Label; - -}; - -#undef CASCatch_TRY -#define CASCatch_TRY try - -#undef CASCatch_CATCH -#define CASCatch_CATCH catch - - -#ifdef NO_CXX_EXCEPTION -# undef CASCatch_TRY -# undef CASCatch_CATCH - -# if defined(DO_ABORT) - -# define DoesNotAbort_CASCatch(aHandler) !(K_SETJMP_CASCatch = setjmp(aHandler.Label)) - -# define CASCatch_TRY CASCatch_ErrorHandler _Function; \ - K_SETJMP_CASCatch = 1 ; \ - if(DoesNotAbort_CASCatch(_Function)) - -# else //If DO_ABORT is not defined -# define DoesNotAbort_CASCatch(aHandler) !setjmp(aHandler.Label) - -# define CASCatch_TRY CASCatch_ErrorHandler _Function; \ - if(DoesNotAbort_CASCatch(_Function)) -# endif //DO_ABORT - - -# define CASCatch_CATCH(Error) else if(_Function.Catches(STANDARD_TYPE(Error))) -#endif //NO_CXX_EXCEPTION - -#endif //_CASCatch_ErrorHandler_HeaderFile diff --git a/src/CASCatch/CASCatch_Failure.cxx b/src/CASCatch/CASCatch_Failure.cxx deleted file mode 100644 index 6e5d3d884..000000000 --- a/src/CASCatch/CASCatch_Failure.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include -#include -#include - -IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) -IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient ) - - -#ifndef NO_CXX_EXCEPTION -static Handle(CASCatch_Failure) RaisedError; -#endif - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_Failure - */ -//================================================================================ -CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";} - - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_Failure with a message - * \param an exception message - */ -//================================================================================ -CASCatch_Failure::CASCatch_Failure (const Standard_CString AString) -{ - if(AString) { - myMessage = new Standard_Character[strlen(AString) + 1]; - strcpy(myMessage,AString); - } -} - -//================================================================================ -/*! Public - - * \brief returns the last caught exception - */ -//================================================================================ -Handle(CASCatch_Failure) CASCatch_Failure::Caught() -{ -#ifdef NO_CXX_EXCEPTION - return CASCatch_ErrorHandler::LastCaughtError(); -#else - return RaisedError ; -#endif -} - -//================================================================================ -/*! Public - - * \brief raises a CASCatch_Failure exception - * \param an exception message - */ -//================================================================================ -void CASCatch_Failure::Raise (const Standard_CString AString) -{ - Handle(CASCatch_Failure) E = new CASCatch_Failure() ; - E->Reraise (AString) ; -} - - -//================================================================================ -/*! Public - - * \brief re-raises a CASCatch_Failure exception - * \param an exception message - */ -//================================================================================ -void CASCatch_Failure::Reraise (const Standard_CString AString) -{ - if(AString){ - myMessage = new Standard_Character[strlen(AString) + 1]; - strcpy(myMessage,AString); - } - -#ifdef NO_CXX_EXCEPTION - CASCatch_ErrorHandler::Error(this) ; - CASCatch_ErrorHandler::Abort(); -#else - RaisedError = this ; - Throw() ; -#endif -} - -//================================================================================ -/*! Public - - * \brief returns an exception message - */ -//================================================================================ -Standard_CString CASCatch_Failure::GetError() const -{ - return myMessage; -} - -//================================================================================ -/*! Public - - * \brief Is called when using standard C++ exceptions - */ -//================================================================================ -void CASCatch_Failure::Throw() const -{ -#ifndef NO_CXX_EXCEPTION - throw CASCatch_Failure() ; -#endif -} - diff --git a/src/CASCatch/CASCatch_Failure.hxx b/src/CASCatch/CASCatch_Failure.hxx deleted file mode 100644 index 102f0ec4e..000000000 --- a/src/CASCatch/CASCatch_Failure.hxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _CASCATCH_FAILURE_HeaderFile -#define _CASCATCH_FAILURE_HeaderFile - -#include -#include -DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) - -#include - -/*! - * \class CASCatch_Failure - * \brief This class presents an exception to be thrown - * - */ -class CASCatch_Failure : public Standard_Transient -{ - -public: - -Standard_EXPORT CASCatch_Failure(); -Standard_EXPORT CASCatch_Failure(const Standard_CString aString); -Standard_EXPORT void Reraise(const Standard_CString aMessage) ; -Standard_EXPORT Standard_CString GetError() const; -Standard_EXPORT static Handle_CASCatch_Failure Caught() ; -Standard_EXPORT static void Raise(const Standard_CString aMessage = "") ; -Standard_EXPORT virtual void Throw() const;public: - -public: - -DEFINE_STANDARD_RTTI( CASCatch_Failure ) - -private: -/*!\var myMessage - * \brief stores an exception message - */ -Standard_CString myMessage; - -}; - - -#endif diff --git a/src/CASCatch/Makefile.am b/src/CASCatch/Makefile.am deleted file mode 100644 index 23fc4c7b4..000000000 --- a/src/CASCatch/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Sergey RUIN (OCN) -# Module : SALOME - -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - - -salomeinclude_HEADERS = CASCatch.hxx \ - CASCatch_CatchSignals.hxx \ - CASCatch_ErrorHandler.hxx \ - CASCatch_Failure.hxx - -lib_LTLIBRARIES = libCASCatch.la -libCASCatch_la_SOURCES = \ - CASCatch_CatchSignals.cxx \ - CASCatch_ErrorHandler.cxx \ - CASCatch_Failure.cxx - -COMMON_CPPFLAGS = \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ - -libCASCatch_la_CPPFLAGS = $(COMMON_CPPFLAGS) -libCASCatch_la_LIBADD = $(CAS_KERNEL) diff --git a/src/Communication/SALOME_Communication.hxx b/src/Communication/SALOME_Communication.hxx index c3593fbc5..93c11cc56 100755 --- a/src/Communication/SALOME_Communication.hxx +++ b/src/Communication/SALOME_Communication.hxx @@ -44,4 +44,4 @@ #define COMMUNICATION_EXPORT #endif -#endif \ No newline at end of file +#endif diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 558275659..af8380f8c 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -45,6 +45,7 @@ #else #include int SIGUSR11 = 1000; +#include #endif @@ -209,8 +210,13 @@ CORBA::Long Engines_Component_i::getStudyId() void Engines_Component_i::ping() { +#ifndef WNT MESSAGE("Engines_Component_i::ping() pid "<< getpid() << " threadid " << pthread_self()); +#else + MESSAGE("Engines_Component_i::ping() pid "<< _getpid()<< " threadid " + << pthread_self().p ); +#endif } //============================================================================= @@ -358,11 +364,19 @@ bool Engines_Component_i::Kill_impl() bool Engines_Component_i::Stop_impl() { +#ifndef WNT MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self() << " pid " << getpid() << " instanceName " << _instanceName.c_str() << " interface " << _interfaceName.c_str() << " machineName " << GetHostname().c_str()<< " _id " << hex << _id << dec << " _ThreadId " << _ThreadId ); +#else + MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self().p + << " pid " << _getpid() << " instanceName " + << _instanceName.c_str() << " interface " << _interfaceName.c_str() + << " machineName " << GetHostname().c_str()<< " _id " << hex << _id + << dec << " _ThreadId " << _ThreadId ); +#endif bool RetVal = false ; @@ -390,11 +404,19 @@ bool Engines_Component_i::Stop_impl() bool Engines_Component_i::Suspend_impl() { +#ifndef WNT MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self() << " pid " << getpid() << " instanceName " << _instanceName.c_str() << " interface " << _interfaceName.c_str() << " machineName " << GetHostname().c_str()<< " _id " << hex << _id << dec << " _ThreadId " << _ThreadId ); +#else + MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self().p + << " pid " << _getpid() << " instanceName " + << _instanceName.c_str() << " interface " << _interfaceName.c_str() + << " machineName " << GetHostname().c_str()<< " _id " << hex << _id + << dec << " _ThreadId " << _ThreadId ); +#endif bool RetVal = false ; #ifndef WNT @@ -429,11 +451,19 @@ bool Engines_Component_i::Suspend_impl() bool Engines_Component_i::Resume_impl() { +#ifndef WNT MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self() << " pid " << getpid() << " instanceName " << _instanceName.c_str() << " interface " << _interfaceName.c_str() << " machineName " << GetHostname().c_str()<< " _id " << hex << _id << dec << " _ThreadId " << _ThreadId ); +#else + MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self().p + << " pid " << _getpid() << " instanceName " + << _instanceName.c_str() << " interface " << _interfaceName.c_str() + << " machineName " << GetHostname().c_str()<< " _id " << hex << _id + << dec << " _ThreadId " << _ThreadId ); +#endif bool RetVal = false ; #ifndef WNT if ( _ThreadId > 0 && pthread_self() != _ThreadId ) @@ -569,8 +599,13 @@ PortableServer::ObjectId * Engines_Component_i::getId() void Engines_Component_i::beginService(const char *serviceName) { +#ifndef WNT MESSAGE(pthread_self() << "Send BeginService notification for " <>= value; // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC. #if defined __GNUC__ - int ret = setenv(cle.c_str(), value, overwrite); +// int ret = setenv(cle.c_str(), value, overwrite); + setenv(cle.c_str(), value, overwrite); #else //CCRT porting : setenv not defined in stdlib.h std::string s(cle); @@ -619,7 +655,8 @@ void Engines_Component_i::beginService(const char *serviceName) s+=value; // char* cast because 1st arg of linux putenv function // is not a const char* ! - int ret=putenv((char *)s.c_str()); +// int ret=putenv((char *)s.c_str()); + putenv((char *)s.c_str()); //End of CCRT porting #endif MESSAGE("--- setenv: "<find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have this Salome_file"; + throw SALOME::SALOME_Exception(es); + } + Salome_file_i * Sfile = (*_map)[Salome_file_name]; + + return Sfile->_this(); +} + +Engines::Salome_file_ptr +Engines_Component_i::setInputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we add it. + _Service_file_map_it = _Input_Service_file_map.find(service_name); + if (_Service_file_map_it == _Input_Service_file_map.end()) { + _t_Salome_file_map * _map = new _t_Salome_file_map(); + _Input_Service_file_map[service_name] = _map; + } + _t_Salome_file_map * _map = _Input_Service_file_map[service_name]; + + // Try to find the Salome_file ... + _Salome_file_map_it = _map->find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + Salome_file_i * Sfile = new Salome_file_i(); + Engines::Container_ptr container = this->GetContainerRef(); + Sfile->setContainer(Engines::Container::_duplicate(container)); + (*_map)[Salome_file_name] = Sfile; + } + + Salome_file_i * Sfile = (*_map)[Salome_file_name]; + return Sfile->_this(); +} + +void +Engines_Component_i::checkInputFilesToService(const char* service_name) +{ + // Try to find the service, if it doesn't exist, nothing to do. + _Service_file_map_it = _Input_Service_file_map.find(service_name); + if (_Service_file_map_it != _Input_Service_file_map.end()) { + _t_Salome_file_map * _map = _Input_Service_file_map[service_name]; + _t_Salome_file_map::iterator begin = _map->begin(); + _t_Salome_file_map::iterator end = _map->end(); + + for(;begin!=end;begin++) { + Salome_file_i * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); + file->recvFiles(); + } + } +} + +Engines::Salome_file_ptr +Engines_Component_i::getOutputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we throw an exception. + _Service_file_map_it = _Output_Service_file_map.find(service_name); + if (_Service_file_map_it == _Output_Service_file_map.end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have salome files"; + throw SALOME::SALOME_Exception(es); + } + _t_Salome_file_map * _map = _Output_Service_file_map[service_name]; + + // Try to find the Salome_file ... + _Salome_file_map_it = _map->find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have this Salome_file"; + throw SALOME::SALOME_Exception(es); + } + Salome_file_i * Sfile = (*_map)[Salome_file_name]; + + return Sfile->_this(); +} + +Engines::Salome_file_ptr +Engines_Component_i::setOutputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we add it. + _Service_file_map_it = _Output_Service_file_map.find(service_name); + if (_Service_file_map_it == _Output_Service_file_map.end()) { + _t_Salome_file_map * _map = new _t_Salome_file_map(); + _Output_Service_file_map[service_name] = _map; + } + _t_Salome_file_map * _map = _Output_Service_file_map[service_name]; + + // Try to find the Salome_file ... + _Salome_file_map_it = _map->find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + Salome_file_i * Sfile = new Salome_file_i(); + Engines::Container_ptr container = this->GetContainerRef(); + Sfile->setContainer(Engines::Container::_duplicate(container)); + (*_map)[Salome_file_name] = Sfile; + } + + Salome_file_i * Sfile = (*_map)[Salome_file_name]; + return Sfile->_this(); +} + +void +Engines_Component_i::checkOutputFilesToService(const char* service_name) +{ + // Try to find the service, if it doesn't exist, nothing to do. + _Service_file_map_it = _Output_Service_file_map.find(service_name); + if (_Service_file_map_it != _Output_Service_file_map.end()) { + _t_Salome_file_map * _map = _Output_Service_file_map[service_name]; + _t_Salome_file_map::iterator begin = _map->begin(); + _t_Salome_file_map::iterator end = _map->end(); + + for(;begin!=end;begin++) { + Salome_file_i * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); + file->recvFiles(); + } + } + +} + +//============================================================================= +/*! + * C++ method: used to configure the Salome_file into the runtime. + * \param service_name name of the service that use this Salome_file + * \param file_port_name name of the Salome_file + * \param file Salome_file C++ object + */ +//============================================================================= +void +Engines_Component_i::configureSalome_file(std::string service_name, + std::string file_port_name, + Salome_file_i * file) +{ + // By default this method does nothing +} + diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 6e58840bc..61d3e2a61 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -44,6 +44,7 @@ int SIGUSR1 = 1000; #include //#ifndef WNT #include CORBA_SERVER_HEADER(SALOME_Component) +#include CORBA_SERVER_HEADER(SALOME_Exception) //#else //#include //#endif @@ -52,6 +53,7 @@ int SIGUSR1 = 1000; #include "SALOME_Component_i.hxx" #include "SALOME_FileRef_i.hxx" #include "SALOME_FileTransfer_i.hxx" +#include "Salome_file_i.hxx" #include "SALOME_NamingService.hxx" #include "OpUtil.hxx" @@ -101,12 +103,12 @@ Engines_Container_i::Engines_Container_i () : //============================================================================= Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, - PortableServer::POA_var poa, - char *containerName , + PortableServer::POA_var poa, + char *containerName , int argc , char* argv[], - bool activAndRegist, - bool isServantAloneInProcess - ) : + bool activAndRegist, + bool isServantAloneInProcess + ) : _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess) { _pid = (long)getpid(); @@ -118,8 +120,14 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, _argv = argv ; string hostname = GetHostname(); - MESSAGE(hostname << " " << getpid() << " Engines_Container_i starting argc " - << _argc << " Thread " << pthread_self() ) ; +#ifndef WNT + MESSAGE(hostname << " " << getpid() << + " Engines_Container_i starting argc " << + _argc << " Thread " << pthread_self() ) ; +#else + MESSAGE(hostname << " " << _getpid() << + " Engines_Container_i starting argc " << _argc<< " Thread " << pthread_self().p ) ; +#endif int i = 0 ; while ( _argv[ i ] ) @@ -156,14 +164,14 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ; CORBA::Object_var obj=_poa->id_to_reference(*_id); Engines::Container_var pCont - = Engines::Container::_narrow(obj); + = Engines::Container::_narrow(obj); _containerName = _NS->BuildContainerNameForNS(containerName, - hostname.c_str()); + hostname.c_str()); SCRUTE(_containerName); _NS->Register(pCont, _containerName.c_str()); MESSAGE("Engines_Container_i::Engines_Container_i : Container name " - << _containerName); + << _containerName); // Python: // import SALOME_Container @@ -177,33 +185,28 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, SCRUTE(myCommand); if (!_isSupervContainer) - { + { #ifdef WNT - //Py_ACQUIRE_NEW_THREAD; - PyEval_AcquireLock(); - /* It should not be possible for more than one thread state - to be used for a thread.*/ - PyThreadState *myTstate = PyGILState_GetThisThreadState(); - // if no thread state defined - if ( !myTstate ) - myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); - PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); + + PyEval_AcquireLock(); + PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); + PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); #else - Py_ACQUIRE_NEW_THREAD; + Py_ACQUIRE_NEW_THREAD; #endif #ifdef WNT - // mpv: this is temporary solution: there is a unregular crash if not - //Sleep(2000); - // + // mpv: this is temporary solution: there is a unregular crash if not + //Sleep(2000); + // // first element is the path to Registry.dll, but it's wrong - PyRun_SimpleString("import sys\n"); - PyRun_SimpleString("sys.path = sys.path[1:]\n"); + PyRun_SimpleString("import sys\n"); + PyRun_SimpleString("sys.path = sys.path[1:]\n"); #endif - PyRun_SimpleString("import SALOME_Container\n"); - PyRun_SimpleString((char*)myCommand.c_str()); - Py_RELEASE_NEW_THREAD; - } + PyRun_SimpleString("import SALOME_Container\n"); + PyRun_SimpleString((char*)myCommand.c_str()); + Py_RELEASE_NEW_THREAD; + } fileTransfer_i* aFileTransfer = new fileTransfer_i(); _fileTransfer = Engines::fileTransfer::_narrow(aFileTransfer->_this()); @@ -297,7 +300,8 @@ void Engines_Container_i::Shutdown() MESSAGE("Effective Shutdown of container Begins..."); LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); bp1->deleteInstance(bp1); - _orb->shutdown(0); + if(!CORBA::is_nil(_orb)) + _orb->shutdown(0); } } @@ -379,20 +383,20 @@ Engines_Container_i::load_component_Library(const char* componentName) PyObject *globals = PyModule_GetDict(mainmod); PyObject *pyCont = PyDict_GetItemString(globals, "pyCont"); PyObject *result = PyObject_CallMethod(pyCont, - "import_component", - "s",componentName); + "import_component", + "s",componentName); int ret= PyInt_AsLong(result); SCRUTE(ret); Py_RELEASE_NEW_THREAD; if (ret) // import possible: Python component - { - _numInstanceMutex.lock() ; // lock to be alone (stl container write) - _library_map[aCompName] = (void *)pyCont; // any non O value OK - _numInstanceMutex.unlock() ; - MESSAGE("import Python: "<string_to_object(iors.c_str()); - iobject = Engines::Component::_narrow( obj ) ; + CORBA::Object_var obj = _orb->string_to_object(iors.c_str()); + iobject = Engines::Component::_narrow( obj ) ; } return iobject._retn(); } @@ -478,8 +482,8 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, else { iobject = createInstance(genericRegisterName, - handle, - studyId); + handle, + studyId); return iobject._retn(); } } @@ -497,7 +501,7 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, Engines::Component_ptr Engines_Container_i::find_component_instance( const char* registeredName, - CORBA::Long studyId) + CORBA::Long studyId) { Engines::Component_var anEngine = Engines::Component::_nil(); map::iterator itm =_listInstances_map.begin(); @@ -506,13 +510,13 @@ Engines_Container_i::find_component_instance( const char* registeredName, string instance = (*itm).first; SCRUTE(instance); if (instance.find(registeredName) == 0) - { - anEngine = (*itm).second; - if (studyId == anEngine->getStudyId()) - { - return anEngine._retn(); - } - } + { + anEngine = (*itm).second; + if (studyId == anEngine->getStudyId()) + { + return anEngine._retn(); + } + } itm++; } return anEngine._retn(); @@ -534,7 +538,7 @@ Engines_Container_i::find_component_instance( const char* registeredName, Engines::Component_ptr Engines_Container_i::load_impl( const char* genericRegisterName, - const char* componentName ) + const char* componentName ) { string impl_name = string ("lib") + genericRegisterName +string("Engine.so"); Engines::Component_var iobject = Engines::Component::_nil() ; @@ -580,12 +584,12 @@ void Engines_Container_i::finalize_removal() void *handle = (*ith).second; string impl_name= (*ith).first; if (handle) - { - SCRUTE(handle); - SCRUTE(impl_name); -// dlclose(handle); // SALOME unstable after ... -// _library_map.erase(impl_name); - } + { + SCRUTE(handle); + SCRUTE(impl_name); +// dlclose(handle); // SALOME unstable after ... +// _library_map.erase(impl_name); + } } _toRemove_map.clear(); _numInstanceMutex.unlock(); @@ -667,6 +671,36 @@ Engines_Container_i::getFileTransfer() } +Engines::Salome_file_ptr +Engines_Container_i::createSalome_file(const char* origFileName) +{ + string origName(origFileName); + if (CORBA::is_nil(_Salome_file_map[origName])) + { + Salome_file_i* aSalome_file = new Salome_file_i(); + aSalome_file->setContainer(Engines::Container::_duplicate(this->_this())); + try + { + aSalome_file->setLocalFile(origFileName); + aSalome_file->recvFiles(); + } + catch (const SALOME::SALOME_Exception& e) + { + return Engines::Salome_file::_nil(); + } + + Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil(); + theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) + _Salome_file_map[origName] = theSalome_file; + _numInstanceMutex.unlock() ; + } + + Engines::Salome_file_ptr theSalome_file = + Engines::Salome_file::_duplicate(_Salome_file_map[origName]); + ASSERT(!CORBA::is_nil(theSalome_file)); + return theSalome_file; +} //============================================================================= /*! * C++ method: Finds an already existing servant instance of a component, or @@ -692,7 +726,7 @@ Engines_Container_i::getFileTransfer() Engines::Component_ptr Engines_Container_i::find_or_create_instance(string genericRegisterName, - string componentLibraryName) + string componentLibraryName) { string aGenRegisterName = genericRegisterName; string impl_name = componentLibraryName; @@ -707,44 +741,44 @@ Engines_Container_i::find_or_create_instance(string genericRegisterName, // --- find a registered instance in naming service, or create string component_registerBase = - _containerName + "/" + aGenRegisterName; + _containerName + "/" + aGenRegisterName; Engines::Component_var iobject = Engines::Component::_nil() ; try - { - CORBA::Object_var obj = - _NS->ResolveFirst( component_registerBase.c_str()); - if ( CORBA::is_nil( obj ) ) - { - iobject = createInstance(genericRegisterName, - handle, - 0); // force multiStudy instance here ! - } - else - { - iobject = Engines::Component::_narrow( obj ) ; - Engines_Component_i *servant = - dynamic_cast - (_poa->reference_to_servant(iobject)); - ASSERT(servant) - int studyId = servant->getStudyId(); - ASSERT (studyId >= 0); - if (studyId == 0) // multiStudy instance, OK - { - // No ReBind ! - MESSAGE(component_registerBase.c_str()<<" already bound"); - } - else // monoStudy instance: NOK - { - iobject = Engines::Component::_nil(); - INFOS("load_impl & find_component_instance methods " - << "NOT SUITABLE for mono study components"); - } - } - } + { + CORBA::Object_var obj = + _NS->ResolveFirst( component_registerBase.c_str()); + if ( CORBA::is_nil( obj ) ) + { + iobject = createInstance(genericRegisterName, + handle, + 0); // force multiStudy instance here ! + } + else + { + iobject = Engines::Component::_narrow( obj ) ; + Engines_Component_i *servant = + dynamic_cast + (_poa->reference_to_servant(iobject)); + ASSERT(servant) + int studyId = servant->getStudyId(); + ASSERT (studyId >= 0); + if (studyId == 0) // multiStudy instance, OK + { + // No ReBind ! + MESSAGE(component_registerBase.c_str()<<" already bound"); + } + else // monoStudy instance: NOK + { + iobject = Engines::Component::_nil(); + INFOS("load_impl & find_component_instance methods " + << "NOT SUITABLE for mono study components"); + } + } + } catch (...) - { - INFOS( "Container_i::load_impl catched" ) ; - } + { + INFOS( "Container_i::load_impl catched" ) ; + } return iobject._retn(); } } @@ -772,8 +806,8 @@ Engines_Container_i::find_or_create_instance(string genericRegisterName, Engines::Component_ptr Engines_Container_i::createInstance(string genericRegisterName, - void *handle, - int studyId) + void *handle, + int studyId) { // --- find the factory @@ -818,15 +852,15 @@ Engines_Container_i::createInstance(string genericRegisterName, sprintf( aNumI , "%d" , numInstance ) ; string instanceName = aGenRegisterName + "_inst_" + aNumI ; string component_registerName = - _containerName + "/" + instanceName; + _containerName + "/" + instanceName; // --- Instanciate required CORBA object PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(), - aGenRegisterName.c_str() ) ; + aGenRegisterName.c_str() ) ; if (id == NULL) - return iobject._retn(); + return iobject._retn(); // --- get reference & servant from id @@ -834,7 +868,7 @@ Engines_Container_i::createInstance(string genericRegisterName, iobject = Engines::Component::_narrow( obj ) ; Engines_Component_i *servant = - dynamic_cast(_poa->reference_to_servant(iobject)); + dynamic_cast(_poa->reference_to_servant(iobject)); ASSERT(servant); //SCRUTE(servant->pd_refCount); servant->_remove_ref(); // compensate previous id_to_reference @@ -880,7 +914,7 @@ void Engines_Container_i::decInstanceCnt(string genericRegisterName) if (_cntInstances_map[aGenRegisterName] == 0) { string impl_name = - Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str()); + Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str()); SCRUTE(impl_name); void* handle = _library_map[impl_name]; ASSERT(handle); @@ -961,8 +995,8 @@ void CallCancelThread() ; #ifndef WNT void SigIntHandler(int what , - siginfo_t * siginfo , - void * toto ) + siginfo_t * siginfo , + void * toto ) { //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers) // use of streams (and so on) should never be used because : @@ -985,32 +1019,36 @@ void SigIntHandler(int what , { ActSigIntHandler() ; if ( siginfo->si_signo == SIGUSR1 ) - { - SetCpuUsed() ; - } + { + SetCpuUsed() ; + } else if ( siginfo->si_signo == SIGUSR2 ) - { - CallCancelThread() ; - } + { + CallCancelThread() ; + } else - { - _Sleeping = true ; - // MESSAGE("SigIntHandler BEGIN sleeping.") ; - int count = 0 ; - while( _Sleeping ) - { - sleep( 1 ) ; - count += 1 ; - } - // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; - } + { + _Sleeping = true ; + // MESSAGE("SigIntHandler BEGIN sleeping.") ; + int count = 0 ; + while( _Sleeping ) + { + sleep( 1 ) ; + count += 1 ; + } + // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; + } return ; } } #else // Case WNT void SigIntHandler( int what ) { +#ifndef WNT MESSAGE( pthread_self() << "SigIntHandler what " << what << endl ); +#else + MESSAGE( "SigIntHandler what " << what << endl ); +#endif if ( _Sleeping ) { _Sleeping = false ; @@ -1021,21 +1059,21 @@ void SigIntHandler( int what ) { ActSigIntHandler() ; if ( what == SIGUSR1 ) - { - SetCpuUsed() ; - } + { + SetCpuUsed() ; + } else - { - _Sleeping = true ; - MESSAGE("SigIntHandler BEGIN sleeping.") ; - int count = 0 ; - while( _Sleeping ) - { - Sleep( 1000 ) ; - count += 1 ; - } - MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; - } + { + _Sleeping = true ; + MESSAGE("SigIntHandler BEGIN sleeping.") ; + int count = 0 ; + while( _Sleeping ) + { + Sleep( 1000 ) ; + count += 1 ; + } + MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; + } return ; } } diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 1f1a6debb..409e9e0bb 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -42,7 +42,8 @@ salomeinclude_HEADERS = \ SALOME_FileRef_i.hxx \ SALOME_ContainerManager.hxx \ Container_init_python.hxx \ - SALOME_Container.hxx + SALOME_Container.hxx \ + Salome_file_i.hxx # Scripts to be installed dist_salomescript_DATA =\ @@ -63,8 +64,8 @@ dist_salomescript_SCRIPTS=\ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @MPI_INCLUDES@ \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - @QT_INCLUDES@ \ + @HDF5_INCLUDES@ \ + -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -72,9 +73,10 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Registry \ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ + -I$(srcdir)/../HDFPersist \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -85,6 +87,8 @@ COMMON_LIBS =\ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ + ../HDFPersist/libSalomeHDFPersist.la \ + ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la\ @MPI_LIBS@ \ @CORBA_LIBS@ @@ -103,7 +107,8 @@ libSalomeContainer_la_SOURCES=\ SALOME_FileTransfer_i.cxx \ SALOME_FileRef_i.cxx \ Container_init_python.cxx \ - SALOME_ContainerManager.cxx + SALOME_ContainerManager.cxx \ + Salome_file_i.cxx libSalomeContainer_la_CPPFLAGS =\ $(COMMON_CPPFLAGS) @@ -126,7 +131,9 @@ endif # Executables targets # =============================================================== # -bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer +bin_PROGRAMS = SALOME_Container +noinst_PROGRAMS = TestSalome_file + SALOME_Container_SOURCES =\ SALOME_Container.cxx \ SALOME_Container_SignalsHandler.cxx @@ -137,15 +144,19 @@ SALOME_Container_CPPFLAGS =\ SALOME_Container_LDADD =\ libSalomeContainer.la \ $(COMMON_LIBS) \ - ../Basics/libSALOMEBasics.la + ../Basics/libSALOMEBasics.la \ + ../Batch/libSalomeBatch.la + +SALOME_Container_LDFLAGS =\ +-Xlinker -export-dynamic -SALOME_ContainerManagerServer_SOURCES =\ - SALOME_ContainerManagerServer.cxx +TestSalome_file_SOURCES =\ + TestSalome_file.cxx -SALOME_ContainerManagerServer_CPPFLAGS=\ +TestSalome_file_CPPFLAGS =\ $(COMMON_CPPFLAGS) -SALOME_ContainerManagerServer_LDADD =\ +TestSalome_file_LDADD =\ libSalomeContainer.la \ $(COMMON_LIBS) \ ../Basics/libSALOMEBasics.la diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 3bd3f85d0..de8a42e0e 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -43,6 +43,7 @@ #include #include CORBA_SERVER_HEADER(SALOME_Component) #include "NOTIFICATION.hxx" +#include "Salome_file_i.hxx" class RegistryConnexion; class Engines_Container_i; @@ -95,7 +96,19 @@ public: CORBA::Boolean isPublished, CORBA::Boolean& isValidScript); + // CORBA operations for Salome_file + virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name, + const char* Salome_file_name); + virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name, + const char* Salome_file_name); + virtual void checkInputFilesToService(const char* service_name); + virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name, + const char* Salome_file_name); + + virtual void checkOutputFilesToService(const char* service_name); + virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name, + const char* Salome_file_name); // --- local C++ methods PortableServer::ObjectId * getId(); @@ -116,6 +129,11 @@ public: long CpuUsed() ; void CancelThread() ; + virtual void configureSalome_file(std::string service_name, + std::string file_port_name, + Salome_file_i * file); + + protected: int _studyId; // -1: not initialised; 0: multiStudy; >0: study static bool _isMultiStudy; @@ -133,6 +151,16 @@ protected: NOTIFICATION_Supplier* _notifSupplier; std::map_fieldsDict; + // Map Salome_file_name to Salome_file* + typedef std::map _t_Salome_file_map; + // Map Service_name to _Salome_file_map + typedef std::map _t_Service_file_map; + + _t_Service_file_map _Input_Service_file_map; + _t_Service_file_map _Output_Service_file_map; + _t_Service_file_map::iterator _Service_file_map_it; + _t_Salome_file_map::iterator _Salome_file_map_it; + std::string _serviceName ; std::string _graphName ; std::string _nodeName ; diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index ab3e599a7..9a8cf992b 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -62,12 +62,68 @@ using namespace std; extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB); +#include +#include +#include +#include + +typedef void (*sighandler_t)(int); +sighandler_t setsig(int sig, sighandler_t handler) +{ + struct sigaction context, ocontext; + context.sa_handler = handler; + sigemptyset(&context.sa_mask); + context.sa_flags = 0; + if (sigaction(sig, &context, &ocontext) == -1) + return SIG_ERR; + return ocontext.sa_handler; +} + +void AttachDebugger() +{ + if(getenv ("DEBUGGER")) + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_Container " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } +} + +void Handler(int theSigId) +{ + std::cerr << "SIGSEGV: " << std::endl; + AttachDebugger(); + //to exit or not to exit + exit(1); +} + +void terminateHandler(void) +{ + std::cerr << "Terminate: not managed exception !" << std::endl; + AttachDebugger(); +} + +void unexpectedHandler(void) +{ + std::cerr << "Unexpected: unexpected exception !" << std::endl; + AttachDebugger(); +} + int main(int argc, char* argv[]) { #ifdef HAVE_MPI2 MPI_Init(&argc,&argv); #endif + if(getenv ("DEBUGGER")) + { + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + // Initialise the ORB. //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ; diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 7642e5ae8..043ed927d 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -26,6 +26,7 @@ #endif #include #include "Utils_CorbaException.hxx" +#include "Batch_Date.hxx" #ifdef WITH_PACO_PARALLEL #include "PaCO++.h" @@ -35,6 +36,10 @@ using namespace std; +vector SALOME_ContainerManager::_batchLaunchedContainers; + +vector::iterator SALOME_ContainerManager::_batchLaunchedContainersIter; + const char *SALOME_ContainerManager::_ContainerManagerNameInNS = "/ContainerManager"; @@ -47,27 +52,25 @@ const char *SALOME_ContainerManager::_ContainerManagerNameInNS = */ //============================================================================= -SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) +SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_ResourcesManager *rm, SALOME_NamingService *ns) { MESSAGE("constructor"); - _NS = new SALOME_NamingService(orb); - _ResManager = new SALOME_ResourcesManager(orb); + _NS = ns; + _ResManager = rm; _id=0; - PortableServer::POA_var root_poa = PortableServer::POA::_the_root_poa(); - PortableServer::POAManager_var pman = root_poa->the_POAManager(); - PortableServer::POA_var my_poa; + PortableServer::POAManager_var pman = poa->the_POAManager(); + _orb = CORBA::ORB::_duplicate(orb) ; CORBA::PolicyList policies; policies.length(1); PortableServer::ThreadPolicy_var threadPol = - root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL); + poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL); policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol); - my_poa = - root_poa->create_POA("SThreadPOA",pman,policies); + _poa = poa->create_POA("SThreadPOA",pman,policies); threadPol->destroy(); - PortableServer::ObjectId_var id = my_poa->activate_object(this); - CORBA::Object_var obj = my_poa->id_to_reference(id); + PortableServer::ObjectId_var id = _poa->activate_object(this); + CORBA::Object_var obj = _poa->id_to_reference(id); Engines::ContainerManager_var refContMan = Engines::ContainerManager::_narrow(obj); @@ -84,8 +87,6 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) SALOME_ContainerManager::~SALOME_ContainerManager() { MESSAGE("destructor"); - delete _NS; - delete _ResManager; } //============================================================================= @@ -98,10 +99,10 @@ void SALOME_ContainerManager::Shutdown() { MESSAGE("Shutdown"); ShutdownContainers(); - PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this); - _default_POA()->deactivate_object(oid); - _remove_ref(); - + _NS->Destroy_Name(_ContainerManagerNameInNS); + PortableServer::ObjectId_var oid = _poa->servant_to_id(this); + _poa->deactivate_object(oid); + //_remove_ref(); } //============================================================================= @@ -113,36 +114,34 @@ void SALOME_ContainerManager::Shutdown() void SALOME_ContainerManager::ShutdownContainers() { MESSAGE("ShutdownContainers"); - _NS->Change_Directory("/Containers"); - vector vec = _NS->list_directory_recurs(); - list lstCont; - for(vector::iterator iter = vec.begin();iter!=vec.end();iter++) - { + bool isOK; + isOK = _NS->Change_Directory("/Containers"); + if( isOK ){ + vector vec = _NS->list_directory_recurs(); + list lstCont; + for(vector::iterator iter = vec.begin();iter!=vec.end();iter++){ SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)) - { - lstCont.push_back((*iter)); - } + if(!CORBA::is_nil(cont)){ + lstCont.push_back((*iter)); + } } - MESSAGE("Container list: "); - for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) - { + MESSAGE("Container list: "); + for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ SCRUTE((*iter)); } - for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) - { + for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)) - { - MESSAGE("ShutdownContainers: " << (*iter)); - cont->Shutdown(); - } + if(!CORBA::is_nil(cont)){ + MESSAGE("ShutdownContainers: " << (*iter)); + cont->Shutdown(); + } else MESSAGE("ShutdownContainers: no container ref for " << (*iter)); } + } } //============================================================================= @@ -158,10 +157,6 @@ SALOME_ContainerManager:: FindOrStartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputers) { - long id; - string containerNameInNS; - char idc[3*sizeof(long)]; - Engines::Container_ptr ret = FindContainer(params,possibleComputers); if(!CORBA::is_nil(ret)) return ret; @@ -185,6 +180,11 @@ StartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputers, Engines::ResPolicy policy) { +#ifdef WITH_PACO_PARALLEL + std::string parallelLib(params.parallelLib); + if (parallelLib != "") + return FindOrStartParallelContainer(params, possibleComputers); +#endif long id; string containerNameInNS; char idc[3*sizeof(long)]; @@ -235,6 +235,28 @@ StartContainer(const Engines::MachineParameters& params, command = _ResManager->BuildCommandToLaunchRemoteContainer(theMachine,params,id); _ResManager->RmTmpFile(); + + //check if an entry exists in Naming service + if(params.isMPI) + { + containerNameInNS = "/ContainerManager/id"; + sprintf(idc,"%ld",id); + containerNameInNS += idc; + } + else + containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); + + SCRUTE(containerNameInNS); + CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); + if ( !CORBA::is_nil(obj) ) + { + // unregister the registered container if it exists + _NS->Destroy_Name(containerNameInNS.c_str()); + // unregister component instances ??? + //Engines::Container_var cont=Engines::Container::_narrow(obj); + } + + // launch container with a system call int status=system(command.c_str()); if (status == -1){ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << @@ -259,15 +281,6 @@ StartContainer(const Engines::MachineParameters& params, if ( count != 10 ) MESSAGE( count << ". Waiting for container on " << theMachine); - if(params.isMPI){ - containerNameInNS = "/ContainerManager/id"; - sprintf(idc,"%ld",id); - containerNameInNS += idc; - } - else - containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); - - SCRUTE(containerNameInNS); CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); ret=Engines::Container::_narrow(obj); } @@ -290,9 +303,10 @@ StartContainer(const Engines::MachineParameters& params, Engines::Container_ptr SALOME_ContainerManager:: StartContainer(const Engines::MachineParameters& params, - Engines::ResPolicy policy) + Engines::ResPolicy policy, + const Engines::CompoList& componentList) { - Engines::MachineList_var possibleComputers = GetFittingResources(params,""); + Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params,componentList); return StartContainer(params,possibleComputers,policy); } @@ -326,7 +340,7 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, INFOS("[FindOrStartParallelContainer] Starting a parallel container"); // Step 2.1 : Choose a computer - string theMachine = _ResManager->FindBest(possibleComputers); + string theMachine = _ResManager->FindFirst(possibleComputers); if(theMachine == "") { INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!"); INFOS("[FindOrStartParallelContainer] No possible computer found"); @@ -435,51 +449,28 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params, #endif //============================================================================= -/*! - * - */ -//============================================================================= - -Engines::MachineList * -SALOME_ContainerManager:: -GetFittingResources(const Engines::MachineParameters& params, - const char *componentName) -{ - MESSAGE("SALOME_ContainerManager::GetFittingResources"); - Engines::MachineList *ret=new Engines::MachineList; - vector vec; - try - { - vec = _ResManager->GetFittingResources(params,componentName); - } - catch(const SALOME_Exception &ex) - { - INFOS("Caught exception."); - THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM); - //return ret; - } - - // MESSAGE("Machine list length "<length(vec.size()); - for(unsigned int i=0;iFindFirst(possibleComputers); - return CORBA::string_dup(theMachine.c_str()); + char *valenv=getenv("SALOME_BATCH"); + if(valenv) + if (strcmp(valenv,"1")==0) + { + if(_batchLaunchedContainers.empty()) + fillBatchLaunchedContainers(); + return *(_batchLaunchedContainersIter++); + } + return StartContainer(params,policy,componentList); } //============================================================================= @@ -632,3 +623,17 @@ long SALOME_ContainerManager::GetIdForContainer(void) return _id; } +void SALOME_ContainerManager::fillBatchLaunchedContainers() +{ + _batchLaunchedContainers.clear(); + _NS->Change_Directory("/Containers"); + vector vec = _NS->list_directory_recurs(); + for(vector::iterator iter = vec.begin();iter!=vec.end();iter++){ + CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); + Engines::Container_ptr cont=Engines::Container::_narrow(obj); + if(!CORBA::is_nil(cont)){ + _batchLaunchedContainers.push_back(cont); + } + } + _batchLaunchedContainersIter=_batchLaunchedContainers.begin(); +} diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index aa7ab18c2..34888f98c 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -37,7 +37,7 @@ class CONTAINER_EXPORT SALOME_ContainerManager: { public: - SALOME_ContainerManager(CORBA::ORB_ptr orb); + SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_ResourcesManager *rm, SALOME_NamingService *ns); ~SALOME_ContainerManager(); Engines::Container_ptr @@ -51,13 +51,13 @@ public: Engines::Container_ptr StartContainer(const Engines::MachineParameters& params, - Engines::ResPolicy policy); - - Engines::MachineList * - GetFittingResources(const Engines::MachineParameters& params, - const char *componentName); + Engines::ResPolicy policy, + const Engines::CompoList& componentList); - char* FindFirst(const Engines::MachineList& possibleComputers); + Engines::Container_ptr + GiveContainer(const Engines::MachineParameters& params, + Engines::ResPolicy policy, + const Engines::CompoList& componentList); void Shutdown(); void ShutdownContainers(); @@ -83,11 +83,17 @@ protected: const Engines::MachineParameters& params, const std::string& name); + void fillBatchLaunchedContainers(); + long GetIdForContainer(void); long _id; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; SALOME_ResourcesManager *_ResManager; SALOME_NamingService *_NS; + static std::vector _batchLaunchedContainers; + static std::vector::iterator _batchLaunchedContainersIter; }; #endif diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index cc59382eb..843fa794f 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -32,8 +32,6 @@ import os import sys import string -import omnipatch # PAL10310 - from omniORB import CORBA, PortableServer import SALOMEDS import Engines, Engines__POA diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index fe32eba83..03c27e0d5 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -92,7 +92,7 @@ public: Engines::fileRef_ptr createFileRef(const char* origFileName); Engines::fileTransfer_ptr getFileTransfer(); - + virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName); // --- local C++ methods Engines::Component_ptr @@ -131,6 +131,7 @@ protected: int _numInstance ; std::map _listInstances_map; std::map _fileRef_map; + std::map _Salome_file_map; Engines::fileTransfer_var _fileTransfer; int _argc ; diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx new file mode 100644 index 000000000..8f10ad2cf --- /dev/null +++ b/src/Container/Salome_file_i.cxx @@ -0,0 +1,1062 @@ +// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : Salome_file_i.cxx +// Author : André RIBES, EDF +// Module : SALOME +// $Header: + +#include "Salome_file_i.hxx" +#include "utilities.h" +#include +#include +#include "HDFOI.hxx" +#include + +//============================================================================= +/*! + * Default constructor, + */ +//============================================================================= + +Salome_file_i::Salome_file_i() +{ + _fileId = 0; + _path_max = 1 + pathconf("/", _PC_PATH_MAX); + _state.name = CORBA::string_dup(""); + _state.hdf5_file_name = CORBA::string_dup(""); + _state.number_of_files = 0; + _state.files_ok = true; + _container = Engines::Container::_nil(); + _default_source_Salome_file = Engines::Salome_file::_nil(); +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= + +Salome_file_i::~Salome_file_i() +{ +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::load + */ +//============================================================================= +void +Salome_file_i::load(const char* hdf5_file) { + _state.hdf5_file_name = CORBA::string_dup(hdf5_file); + try + { + HDFfile *hdf_file; + HDFgroup *hdf_group; + HDFdataset *hdf_dataset; + int size; + int fd; + char * value; + char * buffer; + + hdf_file = new HDFfile((char*) hdf5_file); + hdf_file->OpenOnDisk(HDF_RDONLY); + + hdf_group = new HDFgroup("CONFIG",hdf_file); + hdf_group->OpenOnDisk(); + hdf_dataset = new HDFdataset("MODE",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string mode(value); + delete value; + + hdf_group = new HDFgroup("GROUP_FILES",hdf_file); + hdf_group->OpenOnDisk(); + hdf_dataset = new HDFdataset("LIST_OF_FILES",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string list_of_files(value); + delete value; + + std::istringstream iss(list_of_files); + std::string file_name; + while (std::getline(iss, file_name, ' ')) + { + std::string dataset_group_name("DATASET"); + dataset_group_name += file_name; + + hdf_group = new HDFgroup(dataset_group_name.c_str(), hdf_file); + hdf_group->OpenOnDisk(); + + hdf_dataset = new HDFdataset("NAME",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string name(value); + + hdf_dataset = new HDFdataset("PATH",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string path(value); + + hdf_dataset = new HDFdataset("TYPE",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string type(value); + + hdf_dataset = new HDFdataset("SOURCE_FILE_NAME",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string source_file_name(value); + + hdf_dataset = new HDFdataset("STATUS",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + value = new char[size]; + hdf_dataset->ReadFromDisk(value); + hdf_dataset->CloseOnDisk(); + std::string status(value); + + if (mode == "all") { + + // Changing path, is now current directory + char CurrentPath[_path_max]; + getcwd(CurrentPath, _path_max); + path = CurrentPath; + + std::string group_name("GROUP"); + group_name += file_name; + hdf_group = new HDFgroup(group_name.c_str(),hdf_file); + hdf_group->OpenOnDisk(); + hdf_dataset = new HDFdataset("FILE DATASET",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + buffer = new char[size]; + + if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "open failed"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + }; + hdf_dataset->ReadFromDisk(buffer); + if ( write(fd,buffer,size) <0) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "write failed"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + }; + // Close the target file + ::close(fd); + + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + + _fileManaged[file_name] = infos; + + // Update Salome_file state + _state.number_of_files++; + _state.files_ok = true; + } + else { + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + // Infos for parallel extensions... + infos.node = 0; + infos.container = Engines::Container::_duplicate(_container); + + _fileManaged[file_name] = infos; + + // Update Salome_file state + _state.number_of_files++; + if (status != "ok") + _state.files_ok = false; + } + } + } + catch (HDFexception) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "!!!! HDFexception"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::save + */ +//============================================================================= +void +Salome_file_i::save(const char* hdf5_file) { + _state.hdf5_file_name = CORBA::string_dup(hdf5_file); + try + { + HDFfile *hdf_file; + HDFgroup *hdf_group; + HDFdataset *hdf_dataset; + hdf_size size[1]; + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + + hdf_file = new HDFfile((char*) _state.hdf5_file_name.in()); + hdf_file->CreateOnDisk(); + + // Save mode information + hdf_group = new HDFgroup("CONFIG", hdf_file); + hdf_group->CreateOnDisk(); + std::string mode("infos"); + size[0] = strlen(mode.c_str()) + 1; + hdf_dataset = new HDFdataset("MODE", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) mode.c_str()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + + // List of files that are managed + std::string list_of_files; + for(;begin!=end;begin++) + { + Engines::file file_infos = begin->second; + std::string file_name(file_infos.file_name.in()); + + list_of_files = list_of_files + file_name + std::string(" "); + } + hdf_group = new HDFgroup("GROUP_FILES", hdf_file); + hdf_group->CreateOnDisk(); + size[0] = strlen(list_of_files.c_str()) + 1; + hdf_dataset = new HDFdataset("LIST_OF_FILES", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) list_of_files.c_str()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + + // Insert Files into the hdf5_file + begin = _fileManaged.begin(); + for(;begin!=end;begin++) + { + Engines::file file_infos = begin->second; + std::string file_name(file_infos.file_name.in()); + std::string comp_file_name(_fileManaged[file_name].path.in()); + comp_file_name.append(_fileManaged[file_name].file_name.in()); + std::string dataset_group_name("DATASET"); + dataset_group_name += std::string(_fileManaged[file_name].file_name.in()); + + hdf_group = new HDFgroup((char *) dataset_group_name.c_str(), hdf_file); + hdf_group->CreateOnDisk(); + size[0] = strlen(file_infos.file_name.in()) + 1; + hdf_dataset = new HDFdataset("NAME", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.file_name.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.path.in()) + 1; + hdf_dataset = new HDFdataset("PATH", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.path.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.type.in()) + 1; + hdf_dataset = new HDFdataset("TYPE", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.type.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.source_file_name.in()) + 1; + hdf_dataset = new HDFdataset("SOURCE_FILE_NAME", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.source_file_name.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.status.in()) + 1; + hdf_dataset = new HDFdataset("STATUS", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.status.in()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + } + + hdf_file->CloseOnDisk(); + + // delete hdf_dataset; + // delete hdf_group; ----> SEGFAULT !!! + // delete hdf_file; ----> SEGFAULT !!! + } + catch (HDFexception) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "!!!! HDFexception"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::save_all + */ +//============================================================================= +void +Salome_file_i::save_all(const char* hdf5_file) { + + _state.hdf5_file_name = CORBA::string_dup(hdf5_file); + // Test Salome_file status + if (_state.files_ok == false) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "File Not Ok !"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // For each file we create two groups + // First group contains file's informations + // Second group contains the file + // At the end we create a group and a dataset containing the names + // of all the files. + try + { + HDFfile *hdf_file; + HDFgroup *hdf_group; + HDFdataset *hdf_dataset; + hdf_size size[1]; + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + + hdf_file = new HDFfile((char*) _state.hdf5_file_name.in()); + hdf_file->CreateOnDisk(); + + // Save mode information + hdf_group = new HDFgroup("CONFIG", hdf_file); + hdf_group->CreateOnDisk(); + std::string mode("all"); + size[0] = strlen(mode.c_str()) + 1; + hdf_dataset = new HDFdataset("MODE", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) mode.c_str()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + + + // List of files that will be inserted + std::string list_of_files; + for(;begin!=end;begin++) + { + Engines::file file_infos = begin->second; + std::string file_name(file_infos.file_name.in()); + + list_of_files = list_of_files + file_name + std::string(" "); + } + hdf_group = new HDFgroup("GROUP_FILES", hdf_file); + hdf_group->CreateOnDisk(); + size[0] = strlen(list_of_files.c_str()) + 1; + hdf_dataset = new HDFdataset("LIST_OF_FILES", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) list_of_files.c_str()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + + // Insert Files into the hdf5_file + begin = _fileManaged.begin(); + for(;begin!=end;begin++) + { + Engines::file file_infos = begin->second; + std::string file_name(file_infos.file_name.in()); + std::string comp_file_name(_fileManaged[file_name].path.in()); + comp_file_name.append(_fileManaged[file_name].file_name.in()); + std::string group_name("GROUP"); + group_name += std::string(_fileManaged[file_name].file_name.in()); + std::string dataset_group_name("DATASET"); + dataset_group_name += std::string(_fileManaged[file_name].file_name.in()); + + hdf_group = new HDFgroup((char *) group_name.c_str(), hdf_file); + hdf_group->CreateOnDisk(); + HDFConvert::FromAscii(comp_file_name.c_str(), *hdf_group, "FILE DATASET"); + hdf_group->CloseOnDisk(); + + hdf_group = new HDFgroup((char *) dataset_group_name.c_str(), hdf_file); + hdf_group->CreateOnDisk(); + size[0] = strlen(file_infos.file_name.in()) + 1; + hdf_dataset = new HDFdataset("NAME", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.file_name.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.path.in()) + 1; + hdf_dataset = new HDFdataset("PATH", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.path.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.type.in()) + 1; + hdf_dataset = new HDFdataset("TYPE", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.type.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.source_file_name.in()) + 1; + hdf_dataset = new HDFdataset("SOURCE_FILE_NAME", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.source_file_name.in()); + hdf_dataset->CloseOnDisk(); + size[0] = strlen(file_infos.status.in()) + 1; + hdf_dataset = new HDFdataset("STATUS", hdf_group, HDF_STRING, size, 1); + hdf_dataset->CreateOnDisk(); + hdf_dataset->WriteOnDisk((void *) file_infos.status.in()); + hdf_dataset->CloseOnDisk(); + hdf_group->CloseOnDisk(); + + } + + hdf_file->CloseOnDisk(); + + // delete hdf_dataset; + // delete hdf_group; ----> SEGFAULT !!! + // delete hdf_file; ----> SEGFAULT !!! + } + catch (HDFexception) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "!!!! HDFexception"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::setLocalFile + */ +//============================================================================= +void +Salome_file_i::setLocalFile(const char* comp_file_name) +{ + std::string file_name(""); + std::string path(""); + std::string type("local"); + std::string source_file_name(""); + std::string status("not_ok"); + + std::string cp_file_name(comp_file_name); + std::size_t index = cp_file_name.rfind("/"); + if (index != -1) + { + file_name = cp_file_name.substr(index+1); + path = cp_file_name.substr(0,index+1); + } + else + { + file_name = comp_file_name; + char CurrentPath[_path_max]; + getcwd(CurrentPath, _path_max); + path = CurrentPath; + } + + // Test if this file is already added + _t_fileManaged::iterator it = _fileManaged.find(file_name); + if (it != _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "file already added"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // Test if the file is ok + if(fopen(comp_file_name,"rb") != NULL) + status = "ok"; + + // Adding file with is informations + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + // Infos for parallel extensions... + infos.node = 0; + infos.container = Engines::Container::_duplicate(_container); + + _fileManaged[file_name] = infos; + + // Update Salome_file state + _state.number_of_files++; + if (status != "ok") + _state.files_ok = false; +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::setDistributedFile + */ +//============================================================================= +void +Salome_file_i::setDistributedFile(const char* comp_file_name) +{ + std::string file_name(""); + std::string path(""); + std::string type("distributed"); + std::string source_file_name(""); + std::string status("not_ok"); + + std::string cp_file_name(comp_file_name); + std::size_t index = cp_file_name.rfind("/"); + if (index != -1) + { + file_name = cp_file_name.substr(index+1); + path = cp_file_name.substr(0,index+1); + } + else + { + file_name = comp_file_name; + char CurrentPath[_path_max]; + getcwd(CurrentPath, _path_max); + path = CurrentPath; + } + + // Test if this file is already added + _t_fileManaged::iterator it = _fileManaged.find(file_name); + if (it != _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "file already added"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // Adding file with his informations + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + // Infos for parallel extensions... + infos.node = 0; + infos.container = Engines::Container::_duplicate(_container); + + _fileManaged[file_name] = infos; + + if(!CORBA::is_nil(_default_source_Salome_file)) + { + _fileDistributedSource[file_name] = + Engines::Salome_file::_duplicate(_default_source_Salome_file); + } + + // Update Salome_file state + _state.number_of_files++; + _state.files_ok = false; +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::connect + */ +//============================================================================= +void +Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) +{ + if(CORBA::is_nil(_default_source_Salome_file)) + { + _default_source_Salome_file = Engines::Salome_file::_duplicate(source_Salome_file); + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) { + // Get the name of the file + std::string file_name = begin->first; + _t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name); + if (it == _fileDistributedSource.end()) + { + _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); + } + } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "already connected to a default Salome_file"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // We can connect this Salome_file if there is only one file managed + // by the Salome_file + //std::string fname; + //if (_fileManaged.size() == 1) + //{ + // only one file managed + // _t_fileManaged::iterator it = _fileManaged.begin(); + // fname = it->first; + // _fileDistributedSource[fname] = Engines::Salome_file::_duplicate(source_Salome_file); + //} + //else + //{ + // SALOME::ExceptionStruct es; + // es.type = SALOME::INTERNAL_ERROR; + // std::string text = "cannot connect"; + // es.text = CORBA::string_dup(text.c_str()); + // throw SALOME::SALOME_Exception(es); + //} +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::connectDistributedFile + */ +//============================================================================= +void +Salome_file_i::connectDistributedFile(const char * file_name, + Engines::Salome_file_ptr source_Salome_file) +{ + // Test if this file is added + _t_fileManaged::iterator it = _fileManaged.find(file_name); + if (it == _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "file is not added"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + else + { + _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); + } +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::setDistributedSourceFile + */ +//============================================================================= +void +Salome_file_i::setDistributedSourceFile(const char* file_name, + const char * source_file_name) +{ + std::string fname(file_name); + + // Test if this file is added + _t_fileManaged::iterator it = _fileManaged.find(fname); + if (it == _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "file is not added"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + else + { + _fileManaged[fname].source_file_name = CORBA::string_dup(source_file_name); + } +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::recvFiles + */ +//============================================================================= +void +Salome_file_i::recvFiles() { + + std::string files_not_ok(""); + + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) + { + bool result = true; + Engines::file file_infos = begin->second; + // Test if the file is local or distributed + if (std::string(file_infos.type.in()) == "local") + { + if (std::string(file_infos.status.in()) == "not_ok") + result = checkLocalFile(file_infos.file_name.in()); + } + else + { + if (std::string(file_infos.status.in()) == "not_ok") + result = getDistributedFile(file_infos.file_name.in()); + } + // if the result is false + // we add this file to files_not_ok + if (!result) + { + files_not_ok.append(" "); + files_not_ok.append(file_infos.file_name.in()); + } + } + + if (files_not_ok != "") + { + std::cerr << "tutu" << std::endl; + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "files not ready : " + files_not_ok; + es.text = CORBA::string_dup(text.c_str()); + std::cerr << "titi" << std::endl; + throw SALOME::SALOME_Exception(es); + } + else + { + // We change the state of the Salome_file + _state.files_ok = true; + } +} + +//============================================================================= +/*! + * local C++ method : This method is used by revFiles to check if a local + * managed file is ok. + * \param fileName name of the file + */ +//============================================================================= +bool +Salome_file_i::checkLocalFile(std::string file_name) +{ + bool result = true; + + std::string comp_file_name(_fileManaged[file_name].path.in()); + comp_file_name.append("/"); + comp_file_name.append(_fileManaged[file_name].file_name.in()); + if(fopen(comp_file_name.c_str(),"rb") == NULL) + { + INFOS("file " << comp_file_name << " cannot be open for reading"); + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + result = false; + } + + if (result) + { + _fileManaged[file_name].status = CORBA::string_dup("ok"); + } + return result; +} + +//============================================================================= +/*! + * local C++ method : this method is used by recvFiles to get a + * distributed file from is distributed source. + * If there is no source_file_name for the file, it tries to get + * the file from the source. In this case, the source distributed file has to managed + * only one file to be able to the send the file. + * + * \param fileName name of the file + */ +//============================================================================= +bool +Salome_file_i::getDistributedFile(std::string file_name) +{ + bool result = true; + const char * source_file_name = _fileManaged[file_name].source_file_name.in(); + int fileId; + FILE* fp; + std::string comp_file_name(_fileManaged[file_name].path.in()); + comp_file_name.append("/"); + comp_file_name.append(_fileManaged[file_name].file_name.in()); + + // Test if the process can write on disk + if ((fp = fopen(comp_file_name.c_str(),"wb")) == NULL) + { + INFOS("file " << comp_file_name << " cannot be open for writing"); + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + result = false; + return result; + } + + try + { + fileId = _fileDistributedSource[file_name]->open(source_file_name); + } + catch (...) + { + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + fclose(fp); + result = false; + return result; + } + + if (fileId > 0) + { + Engines::fileBlock* aBlock; + int toFollow = 1; + int ctr=0; + MESSAGE("begin of transfer of " << comp_file_name); + while (toFollow) + { + ctr++; + aBlock = _fileDistributedSource[file_name]->getBlock(fileId); + toFollow = aBlock->length(); + CORBA::Octet *buf = aBlock->get_buffer(); + int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); + ASSERT(nbWri == toFollow); + } + fclose(fp); + MESSAGE("end of transfer of " << comp_file_name); + _fileDistributedSource[file_name]->close(fileId); + } + else + { + INFOS("open reference file for copy impossible"); + result = false; + fclose(fp); + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + return result; + } + + _fileManaged[file_name].status = CORBA::string_dup("ok"); + return result; +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::removeFile + */ +//============================================================================= +void +Salome_file_i::removeFile(const char* file_name) +{ + MESSAGE("Salome_file_i::removeFile : NOT YET IMPLEMENTED"); +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::removeFiles + */ +//============================================================================= +void +Salome_file_i::removeFiles() { + MESSAGE("Salome_file_i::removeFiles : NOT YET IMPLEMENTED"); +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::getFilesInfos + */ +//============================================================================= +Engines::files* +Salome_file_i::getFilesInfos() { + + Engines::files * infos = new Engines::files(); + infos->length(_fileManaged.size()); + + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + int i = 0; + for(;begin!=end;begin++) { + (*infos)[i] = *(new Engines::file(begin->second)); + i++; + } + return infos; +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::getFileInfos + */ +//============================================================================= +Engines::file* +Salome_file_i::getFileInfos(const char* file_name) { + + std::string fname(file_name); + + // Test if this file is managed + _t_fileManaged::iterator it = _fileManaged.find(fname); + if (it == _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "file is not managed"; + throw SALOME::SALOME_Exception(es); + } + + Engines::file * infos = new Engines::file(_fileManaged[fname]); + return infos; +} + +//============================================================================= +/*! + * CORBA method + * \see Engines::Salome_file::getSalome_fileState + */ +//============================================================================= +Engines::SfState* +Salome_file_i::getSalome_fileState() +{ + return new Engines::SfState(_state); +} + +//============================================================================= +/*! + * CORBA method: try to open the file given. If the file is readable, return + * a positive integer else return 0; + * \param fileName file name to be transfered + * \return fileId = positive integer > 0 if open OK. + */ +//============================================================================= + +CORBA::Long +Salome_file_i::open(const char* file_name) +{ + int aKey = 0; + + std::string fname(file_name); + if (fname == "") { + // We enter in the simple case where the user + // has not used setDistributedSourceFile. + // In this case we try to see if the Salome_file + if (_fileManaged.size() == 1) + { + // only one file managed + _t_fileManaged::iterator it = _fileManaged.begin(); + fname = it->first; + } + else + { + // we can't choose the file so : + return aKey; + } + } + + _t_fileManaged::iterator it = _fileManaged.find(fname); + if (it == _fileManaged.end()) + { + return aKey; + } + + std::string comp_file_name(_fileManaged[fname].path.in()); + comp_file_name.append("/"); + comp_file_name.append(fname); + MESSAGE("Salome_file_i::open " << comp_file_name); + FILE* fp; + if ((fp = fopen(comp_file_name.c_str(),"rb")) == NULL) + { + INFOS("file " << comp_file_name << " is not readable"); + return aKey; + } + + aKey = ++_fileId; + _fileAccess[aKey] = fp; + return aKey; +} + +//============================================================================= +/*! + * CORBA method: close the file associated to the fileId given at open. + * \param fileId got in return from open method + */ +//============================================================================= + +void +Salome_file_i::close(CORBA::Long fileId) +{ + MESSAGE("Salome_file_i::close"); + FILE* fp; + if (!(fp = _fileAccess[fileId]) ) + { + INFOS(" no FILE structure associated to fileId " << fileId); + } + else fclose(fp); +} + +//============================================================================= +/*! + * CORBA method: get a block of data from the file associated to the fileId + * given at open. + * \param fileId got in return from open method + * \return an octet sequence. Last one is empty. + */ +//============================================================================= + +#define FILEBLOCK_SIZE 256*1024 + +Engines::fileBlock* +Salome_file_i::getBlock(CORBA::Long fileId) +{ + Engines::fileBlock* aBlock = new Engines::fileBlock; + + FILE* fp; + if (! (fp = _fileAccess[fileId]) ) + { + INFOS(" no FILE structure associated to fileId " <replace(nbRed, nbRed, buf, 1); // 1 means give ownership + return aBlock; +} + +void +Salome_file_i::setContainer(Engines::Container_ptr container) +{ + _container = Engines::Container::_duplicate(container); + + // Update All the files + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) { + begin->second.container = Engines::Container::_duplicate(container); + } +} + diff --git a/src/Container/Salome_file_i.hxx b/src/Container/Salome_file_i.hxx new file mode 100644 index 000000000..16b09034e --- /dev/null +++ b/src/Container/Salome_file_i.hxx @@ -0,0 +1,106 @@ +// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : Salome_file_i.hxx +// Author : André RIBES, EDF +// Module : SALOME +// $Header: + +#ifndef _SALOME_FILE_I_HXX_ +#define _SALOME_FILE_I_HXX_ + +#include + +#include CORBA_SERVER_HEADER(SALOME_Component) +#include CORBA_SERVER_HEADER(SALOME_Exception) + +#include +#include +#include + +class CONTAINER_EXPORT Salome_file_i: + public virtual POA_Engines::Salome_file +{ + public: + Salome_file_i(); + virtual ~Salome_file_i(); + + // Import and export methods + virtual void load(const char* hdf5_file); + virtual void save(const char* hdf5_file); + virtual void save_all(const char* hdf5_file); + + // Adding files + virtual void setLocalFile(const char* comp_file_name); + virtual void setDistributedFile(const char* comp_file_name); + + // Configure DistributedFile + virtual void connect(Engines::Salome_file_ptr source_Salome_file); + virtual void connectDistributedFile(const char * file_name, + Engines::Salome_file_ptr source_Salome_file); + virtual void setDistributedSourceFile(const char* file_name, + const char * source_file_name); + + // Recv and check files + virtual void recvFiles(); + + // Removing or deleting files + virtual void removeFile(const char* file_name); + virtual void removeFiles(); + + // Informations methods: + virtual void setContainer(Engines::Container_ptr container); + virtual Engines::files* getFilesInfos(); + virtual Engines::file* getFileInfos(const char* file_name); + virtual Engines::SfState* getSalome_fileState(); + + // ---------------- fileTransfert Methods ----------------------- + virtual CORBA::Long open(const char* file_name); + virtual void close(CORBA::Long fileId); + virtual Engines::fileBlock* getBlock(CORBA::Long fileId); + + protected: + // ---------------- local C++ methods --------------------------- + virtual bool checkLocalFile(std::string file_name); + virtual bool getDistributedFile(std::string file_name); + + protected: + + // Contains a relation between a file ID (int) with + // a fd descriptor (FILE*) open on the file. + typedef std::map _t_fileAccess; + + // Contains the informations of the files managed by the Salome_file. + typedef std::map _t_fileManaged; + + // Contains the CORBA reference for each distributed file managed. + typedef std::map _t_fileDistributedSource; + + int _fileId; + long _path_max; + _t_fileAccess _fileAccess; + _t_fileManaged _fileManaged; + _t_fileDistributedSource _fileDistributedSource; + Engines::SfState _state; + Engines::Container_ptr _container; + Engines::Salome_file_ptr _default_source_Salome_file; +}; + +#endif diff --git a/src/Container/TestSalome_file.cxx b/src/Container/TestSalome_file.cxx new file mode 100644 index 000000000..76d3b031f --- /dev/null +++ b/src/Container/TestSalome_file.cxx @@ -0,0 +1,154 @@ +#include "Salome_file_i.hxx" +#include +#include +#include +#include "HDFascii.hxx" + +using namespace std; + +void print_infos(Engines::file * infos) +{ + cerr << "-------------------------------------------------------------------" << endl; + cerr << "file_name = " << infos->file_name << endl; + cerr << "path = " << infos->path << endl; + cerr << "type = " << infos->type << endl; + cerr << "source_file_name = " << infos->source_file_name << endl; + cerr << "status = " << infos->status << endl; +} + +void print_state(Engines::SfState * state) +{ + cerr << "-------------------------------------------------------------------" << endl; + cerr << "name = " << state->name << endl; + cerr << "hdf5_file_name = " << state->hdf5_file_name << endl; + cerr << "number_of_files = " << state->number_of_files << endl; + cerr << "files_ok = " << state->files_ok << endl; +} + + +int main (int argc, char * argv[]) +{ + system("rm toto cat test.hdf test2.hdf"); + + Salome_file_i file; + Salome_file_i file2; + Salome_file_i file3; + Salome_file_i file4; + Salome_file_i file5; + Engines::file * infos; + Engines::SfState * state; + Engines::files * all_infos; + PortableServer::POA_var root_poa; + PortableServer::POAManager_var pman; + CORBA::Object_var obj; + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of setLocalFile()" << endl; + file.setLocalFile("/tmp/toto"); + infos = file.getFileInfos("toto"); + print_infos(infos); + + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of getFilesInfos()" << endl; + all_infos = file.getFilesInfos(); + for (int i = 0; i < all_infos->length(); i++) + { + print_infos(&((*all_infos)[i])); + } + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of getSalome_fileState()" << endl; + state = file.getSalome_fileState(); + print_state(state); + + // We start CORBA ... + CORBA::ORB_ptr orb = CORBA::ORB_init(argc , argv); + obj = orb->resolve_initial_references("RootPOA"); + root_poa = PortableServer::POA::_narrow(obj); + pman = root_poa->the_POAManager(); + pman->activate(); + + file2.setLocalFile("/tmp/toto_distributed_source"); + Engines::Salome_file_ptr file2_ref = file2._this(); + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of setDistributedFile()" << endl; + file.setDistributedFile("/tmp/toto_distributed"); + file.connectDistributedFile("toto_distributed", file2_ref); +// file.setDistributedSourceFile("toto_distributed", "toto_distributed_source"); + infos = file.getFileInfos("toto_distributed"); + print_infos(infos); + + // We create the files ... + std::ostringstream oss; + oss << "/tmp/toto"; + std::ofstream f(oss.str().c_str()); + if (f) + f << "blablabla" << std::endl; + + std::ostringstream oss2; + oss2 << "/tmp/toto_distributed_source"; + std::ofstream f2(oss2.str().c_str()); + if (f2) + f2 << "bliblibli" << std::endl; + + try + { + file.recvFiles(); + } + catch (SALOME::SALOME_Exception & e) + { + cerr << "Exception : " << e.details.text << endl; + } + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of getFilesInfos()" << endl; + all_infos = file.getFilesInfos(); + for (int i = 0; i < all_infos->length(); i++) + { + print_infos(&((*all_infos)[i])); + } + + cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cerr << "Test of getSalome_fileState()" << endl; + state = file.getSalome_fileState(); + print_state(state); + + orb->destroy(); + + file3.setLocalFile("/tmp/toto"); + file3.setLocalFile("/bin/cat"); + state = file3.getSalome_fileState(); + print_state(state); + file3.save_all("test.hdf"); + file3.setLocalFile("/bin/tutu"); + file3.save("test2.hdf"); + + file4.load("test.hdf"); + all_infos = file4.getFilesInfos(); + for (int i = 0; i < all_infos->length(); i++) + { + print_infos(&((*all_infos)[i])); + } + state = file4.getSalome_fileState(); + print_state(state); + file5.load("test2.hdf"); + all_infos = file5.getFilesInfos(); + for (int i = 0; i < all_infos->length(); i++) + { + print_infos(&((*all_infos)[i])); + } + state = file5.getSalome_fileState(); + print_state(state); + + // Test of ConvertFromHDFToASCII + // and ConvertFromASCIIToHDF + cerr << "Test of ConvertFromASCIIToHDF" << endl; + HDFascii::ConvertFromASCIIToHDF("/tmp/toto"); // RETURN NULL ! + cerr << "Test of ConvertFromHDFToASCII" << endl; + cerr << HDFascii::ConvertFromHDFToASCII("test2.hdf", false) << endl; + cerr << HDFascii::ConvertFromHDFToASCII("test2.hdf", true) << endl; + + cerr << "End of tests" << endl; +} diff --git a/src/DF/DF_Application.cxx b/src/DF/DF_Application.cxx new file mode 100644 index 000000000..1e2c50f1b --- /dev/null +++ b/src/DF/DF_Application.cxx @@ -0,0 +1,79 @@ +#include "DF_definitions.hxx" +#include "DF_Application.hxx" + +using namespace std; + +//Constructor +DF_Application::DF_Application() +{ + _currentID = 0; +} + +DF_Application::~DF_Application() +{ + _documents.clear(); +} + +//Creates a new document with given type, returns a smart pointer to +//newly created document. +DF_Document* DF_Application::NewDocument(const string& theDocumentType) +{ + DF_Document* aDoc = new DF_Document(theDocumentType); + aDoc->_id = ++_currentID; + _documents[aDoc->_id] = aDoc; + aDoc->_appli = this; + return aDoc; +} + +//Closes and removes the given Document +void DF_Application::Close(const DF_Document* theDocument) +{ + int id = -1; + if(theDocument) id = theDocument->GetDocumentID(); + + if(_documents.find(id) != _documents.end()) { + _documents[id]->Clear(); + _documents.erase(id); + delete theDocument; + } +} + +//Returns a Document by Document's ID +DF_Document* DF_Application::GetDocument(int theDocumentID) +{ + if(_documents.find(theDocumentID) == _documents.end()) return NULL; + + return _documents[theDocumentID]; +} + +//Returns a list of IDs of all currently opened documents +vector DF_Application::GetDocumentIDs() +{ + vector ids; + typedef map::const_iterator DI; + for(DI p = _documents.begin(); p!=_documents.end(); p++) + ids.push_back(p->first); + return ids; +} + +//Returns a number of existent documents +int DF_Application::NbDocuments() +{ + return _documents.size(); +} + + +//Restores a Document from the given file, returns a smart +//pointer to opened document. +DF_Document* DF_Application::Open(const string& theFileName) +{ + //Not implemented + return NULL; +} + + +//Saves a Document in a given file with name theFileName +void DF_Application::SaveAs(const DF_Document* theDocument, const string& theFileName) +{ + //Not implemented +} diff --git a/src/DF/DF_Application.hxx b/src/DF/DF_Application.hxx new file mode 100644 index 000000000..bae155e73 --- /dev/null +++ b/src/DF/DF_Application.hxx @@ -0,0 +1,47 @@ +#ifndef DFAPPLICATION_HXX +#define DFAPPLICATION_HXX + +#include "DF_definitions.hxx" +#include "DF_Document.hxx" +#include +#include + +//Class DF_Application responsible for creation and manipulation of Documents +class DF_Application { +public: + //Constructor + Standard_EXPORT DF_Application(); + + Standard_EXPORT ~DF_Application(); + + //Creates a new document with given type, returns a smart pointer to + //newly created document. + Standard_EXPORT DF_Document* NewDocument(const std::string& theDocumentType); + + //Closes and removes the given Document + Standard_EXPORT void Close(const DF_Document* theDocument); + + //Returns a Document by Document's ID + Standard_EXPORT DF_Document* GetDocument(int theDocumentID); + + //Returns a list of IDs of all currently opened documents + Standard_EXPORT std::vector GetDocumentIDs(); + + //Returns a number of existent documents + Standard_EXPORT int NbDocuments(); + + //Virtual methods to be redefined if required by specific application + + //Restores a Document from the given file, returns a smart + //pointer to opened document. + Standard_EXPORT virtual DF_Document* Open(const std::string& theFileName); + + //Saves a Document in a given file with name theFileName + Standard_EXPORT virtual void SaveAs(const DF_Document* theDocument, const std::string& theFileName); + +private: + int _currentID; + std::map _documents; + +}; +#endif diff --git a/src/DF/DF_Attribute.cxx b/src/DF/DF_Attribute.cxx new file mode 100644 index 000000000..c392dd9d2 --- /dev/null +++ b/src/DF/DF_Attribute.cxx @@ -0,0 +1,42 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" + +using namespace std; + +//Class DF_Attribute is used to store some data defined by the DF_Attribute type + +//Constructor +DF_Attribute::DF_Attribute() +{ + _node = NULL; +} + +DF_Attribute::~DF_Attribute() +{ + //Remove an attribute from a map of the node's attributes to + //avoid double deletion on the node destruction + if(_node) { + map::iterator mi; + for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) { + if(mi->second == this) { + _node->_attributes.erase(mi); + } + } + } +} + + //Returns a Label on which this Attribute is located. +DF_Label DF_Attribute::Label() const +{ + return DF_Label(_node); +} + + //Searches an Attribute with given ID located on the same Label as this Attribute. +DF_Attribute* DF_Attribute::FindAttribute(const string& theID) const +{ + if(!_node) return NULL; + return Label().FindAttribute(theID); +} + + diff --git a/src/DF/DF_Attribute.hxx b/src/DF/DF_Attribute.hxx new file mode 100644 index 000000000..5d2e65da3 --- /dev/null +++ b/src/DF/DF_Attribute.hxx @@ -0,0 +1,60 @@ +#ifndef DFATTRIBUTE_HXX +#define DFATTRIBUTE_HXX + +#include "DF_definitions.hxx" +#include + +class DF_Label; +class DF_LabelNode; + +//Class DF_Attribute is used to store some data defined by the DF_Attribute type +class DF_Attribute { +protected: + DF_LabelNode* _node; + +public: + //Constructor + Standard_EXPORT DF_Attribute(); + + Standard_EXPORT virtual ~DF_Attribute(); + + //Returns a Label on which this Attribute is located. + Standard_EXPORT DF_Label Label() const; + + //Searches an Attribute with given ID located on the same Label as this Attribute. + Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const; + + + Standard_EXPORT virtual std::string Save() { return ""; } + Standard_EXPORT virtual void Load(const std::string&) {} + + //######## Virtual methods that must be redefined in descendants of the DF_Attribute + + //This method must be redefined in all descendents of the DF_Attribute + //ID is a std::string that uniquely identify the given type of Attributes within the Application. + Standard_EXPORT virtual const std::string& ID() const = 0; + + //Restores a content of this Attribute from another Attribute + Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute) = 0; + + //Creates a new empty copy oà this Attribute + Standard_EXPORT virtual DF_Attribute* NewEmpty() const = 0; + + //Pastes a content of this Attribute into another Attribute + Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute) = 0; + + + //######## Callbacks + + Standard_EXPORT virtual void AfterAddition() {} + Standard_EXPORT virtual void BeforeForget() {} + +protected: + void Backup() {} + + +friend class DF_Label; + +}; + +#endif diff --git a/src/DF/DF_ChildIterator.cxx b/src/DF/DF_ChildIterator.cxx new file mode 100644 index 000000000..fe4573bcb --- /dev/null +++ b/src/DF/DF_ChildIterator.cxx @@ -0,0 +1,80 @@ +#include "DF_ChildIterator.hxx" + +using namespace std; + + +//Constructor +DF_ChildIterator::DF_ChildIterator(const DF_Label& theLabel, bool allLevels) + :_root(NULL), _current(NULL) +{ + Init(theLabel, allLevels); +} + +DF_ChildIterator::DF_ChildIterator() + :_root(NULL), _current(NULL) +{ +} + +DF_ChildIterator::~DF_ChildIterator() +{ + _root = NULL; + _current = NULL; +} + +//Initializes the iterator +void DF_ChildIterator::Init(const DF_Label& theLabel, bool allLevels) +{ + _root = theLabel._node; + _allLevels = allLevels; + if(_root) _current = _root->_firstChild; +} + +//Returns a current Label +DF_Label DF_ChildIterator::Value() +{ + return DF_Label(_current); +} + +//Returns true if there is a current Label +bool DF_ChildIterator::More() +{ + return bool(_current); +} + +//Moves to the next Label +void DF_ChildIterator::Next() +{ + if(!_allLevels) { + _current = _current->_next; //Move to the next brother + return; + } + else { + if(_current->_firstChild) { //Go down to the first child + _current = _current->_firstChild; + } + else { + if(_current->_next) { //Next Brother + _current = _current->_next; + } + else { + if(_current->_father && _current->_father != _root) { + DF_LabelNode *father = _current->_father; + _current = father->_next; + if(!_current) { + while(father && father != _root) { + father = father->_father; + if(father->_next) break; + } + if(father == _root) father = NULL; + if(father) _current = father->_next; + else _current = NULL; + } + } + else { + _current = NULL; //We iterate the whole sub tree + } + } + } + } +} + diff --git a/src/DF/DF_ChildIterator.hxx b/src/DF/DF_ChildIterator.hxx new file mode 100644 index 000000000..54e5ed6bc --- /dev/null +++ b/src/DF/DF_ChildIterator.hxx @@ -0,0 +1,38 @@ +#ifndef DFCHILDITERATOR_HXX +#define DFCHILDITERATOR_HXX + +#include "DF_definitions.hxx" +#include "DF_Label.hxx" + +#include + +//Class DF_ChildIterator is used to iterate a tree of Labels in the Document +class DF_ChildIterator { +public: + //Constructor + Standard_EXPORT DF_ChildIterator(const DF_Label& theLabel, bool allLevels = false); + + Standard_EXPORT DF_ChildIterator(); + + Standard_EXPORT ~DF_ChildIterator(); + + //Initializes the iterator, if allLevels is true the iterator before iterating the next + //brother of the current Label iterates the Label children + Standard_EXPORT void Init(const DF_Label& theLabel, bool allLevels = false); + + //Returns a current Label + Standard_EXPORT DF_Label Value(); + + //Returns true if there is a current Label + Standard_EXPORT bool More(); + + //Moves to the next Label + Standard_EXPORT void Next(); + +private: + DF_LabelNode* _root; + DF_LabelNode* _current; + bool _allLevels; +}; + +#endif diff --git a/src/DF/DF_Container.cxx b/src/DF/DF_Container.cxx new file mode 100644 index 000000000..d5f056486 --- /dev/null +++ b/src/DF/DF_Container.cxx @@ -0,0 +1,196 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Container.hxx" + +using namespace std; + +//Static method that returns an ID of the give type of attributes +const string& DF_Container::GetID() +{ + static string id = "DF_Container_srn"; + return id; +} + +//Creates if not exists a Container attribute and places if is not placed it the Label +DF_Container* DF_Container::Set(DF_Label& theLabel) +{ + DF_Attribute* attr = NULL; + if(!(attr = theLabel.FindAttribute(DF_Container::GetID()))) { + attr = new DF_Container; + theLabel.AddAttribute(attr); + } + + return dynamic_cast(attr); +} + +//Constructor +DF_Container::DF_Container() +{ + _ints.clear(); + _doubles.clear(); + _bools.clear(); + _strings.clear(); +} + +//Destructor +DF_Container::~DF_Container() +{ + _ints.clear(); + _doubles.clear(); + _bools.clear(); + _strings.clear(); +} + +//Sets an integer value of the attribute with given ID +void DF_Container::SetInt(const string& theID, int theValue) +{ + _ints[theID] = theValue; +} + +//Returns an integer value of the attribute with given ID +int DF_Container::GetInt(const string& theID) +{ + if(!HasIntID(theID)) + return 0; + return _ints[theID]; +} + +//Returns True if there is an integer with given ID +bool DF_Container::HasIntID(const string& theID) +{ + if(_ints.find(theID) != _ints.end()) return true; + return false; +} + +//Sets a double value of the attribute with given ID +void DF_Container::SetDouble(const string& theID, const double& theValue) +{ + _doubles[theID] = theValue; +} + + +//Returns a double value of the attribute with given ID +double DF_Container::GetDouble(const string& theID) +{ + if(!HasDoubleID(theID)) return 0.0; + return _doubles[theID]; +} + +//Returns True if there is a double with given ID +bool DF_Container::HasDoubleID(const string& theID) +{ + if(_doubles.find(theID) != _doubles.end()) return true; + return false; +} + +//Sets a string value of the attribute with given ID +void DF_Container::SetString(const string& theID, const string& theValue) +{ + _strings[theID] = theValue; +} + +//Returns a string value of the attribute with given ID +string DF_Container::GetString(const string& theID) +{ + if(!HasStringID(theID)) return ""; + return _strings[theID]; +} + +//Returns True if there is a string with given ID +bool DF_Container::HasStringID(const string& theID) +{ + if(_strings.find(theID) != _strings.end()) return true; + return false; +} + +//Sets a boolean value of the attribute with given ID +void DF_Container::SetBool(const string& theID, bool theValue) +{ + _bools[theID] = theValue; +} + +//Returns a boolean value of the attribute with given ID +bool DF_Container::GetBool(const string& theID) +{ + if(!HasBoolID(theID)) return false; + return _bools[theID]; +} + +//Returns True if there is a boolean value with given ID +bool DF_Container::HasBoolID(const string& theID) +{ + if(_bools.find(theID) != _bools.end()) return true; + return false; +} + +//Clears a content of the attribute +void DF_Container::Clear() +{ + _ints.clear(); + _doubles.clear(); + _strings.clear(); + _bools.clear(); +} + +//ID is a string that uniquely identify the given type of Attributes within the Application. +const string& DF_Container::ID() const +{ + return GetID(); +} + +//Restores a content of this Attribute from another Attribute +void DF_Container::Restore(DF_Attribute* theAttribute) +{ + Clear(); + + DF_Container* attr = dynamic_cast(theAttribute); + if(!attr) return; + + typedef map::const_iterator SI; + for(SI p = attr->_ints.begin(); p != attr->_ints.end(); p++) + _ints[p->first] = p->second; + + typedef map::const_iterator SD; + for(SD p = attr->_doubles.begin(); p != attr->_doubles.end(); p++) + _doubles[p->first] = p->second; + + typedef map::const_iterator SS; + for(SS p = attr->_strings.begin(); p != attr->_strings.end(); p++) + _strings[p->first] = p->second; + + typedef map::const_iterator SB; + for(SB p = attr->_bools.begin(); p != attr->_bools.end(); p++) + _bools[p->first] = p->second; +} + +//Creates a new empty copy oà this Attribute +DF_Attribute* DF_Container::NewEmpty() const +{ + return new DF_Container(); +} + +//Pastes a content of this Attribute into another Attribute +void DF_Container::Paste(DF_Attribute* theIntoAttribute) +{ + DF_Container* attr = dynamic_cast(theIntoAttribute); + if(!attr) return; + + attr->Clear(); + + typedef map::const_iterator SI; + for(SI p = _ints.begin(); p != _ints.end(); p++) + attr->_ints[p->first] = p->second; + + typedef map::const_iterator SD; + for(SD p = _doubles.begin(); p != _doubles.end(); p++) + attr->_doubles[p->first] = p->second; + + typedef map::const_iterator SS; + for(SS p = _strings.begin(); p != _strings.end(); p++) + attr->_strings[p->first] = p->second; + + typedef map::const_iterator SB; + for(SB p = _bools.begin(); p != _bools.end(); p++) + attr-> _bools[p->first] = p->second; +} + diff --git a/src/DF/DF_Container.hxx b/src/DF/DF_Container.hxx new file mode 100644 index 000000000..f26ce8d9e --- /dev/null +++ b/src/DF/DF_Container.hxx @@ -0,0 +1,85 @@ +#ifndef DFCONTAINER_HXX +#define DFCONTAINER_HXX + +#include "DF_definitions.hxx" +#include "DF_Attribute.hxx" +#include +#include + +//Class DF_Container is used to store several types of data +class DF_Container : public DF_Attribute +{ +public: + + //Static method that returns an ID of the give type of attributes + Standard_EXPORT static const std::string& GetID(); + + //Creates if not exists a Container attribute and places if is not placed it the Label + Standard_EXPORT static DF_Container* Set(DF_Label& theLabel); + + //Constructor + Standard_EXPORT DF_Container(); + + //Destructor + Standard_EXPORT ~DF_Container(); + + //Sets an integer value of the attribute with given ID + Standard_EXPORT void SetInt(const std::string& theID, int theValue); + + //Returns an integer value of the attribute with given ID + Standard_EXPORT int GetInt(const std::string& theID); + + //Returns True if there is an integer with given ID + Standard_EXPORT bool HasIntID(const std::string& theID); + + //Sets a double value of the attribute with given ID + Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue); + + //Returns a double value of the attribute with given ID + Standard_EXPORT double GetDouble(const std::string& theID); + + //Returns True if there is a double with given ID + Standard_EXPORT bool HasDoubleID(const std::string& theID); + + //Sets a string value of the attribute with given ID + Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue); + + //Returns a string value of the attribute with given ID + Standard_EXPORT std::string GetString(const std::string& theID); + + //Returns True if there is a string with given ID + Standard_EXPORT bool HasStringID(const std::string& theID); + + //Sets a boolean value of the attribute with given ID + Standard_EXPORT void SetBool(const std::string& theID, bool theValue); + + //Returns a boolean value of the attribute with given ID + Standard_EXPORT bool GetBool(const std::string& theID); + + //Returns True if there is a boolean value with given ID + Standard_EXPORT bool HasBoolID(const std::string& theID); + + //Clears a content of the attribute + Standard_EXPORT void Clear(); + + //ID is a std::string that uniquely identify the given type of Attributes within the Application. + Standard_EXPORT virtual const std::string& ID() const; + + //Restores a content of this Attribute from another Attribute + Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute); + + //Creates a new empty copy of this Attribute + Standard_EXPORT virtual DF_Attribute* NewEmpty() const; + + //Pastes a content of this Attribute into another Attribute + Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute); + + +protected: + std::map _ints; + std::map _doubles; + std::map _strings; + std::map _bools; +}; + +#endif diff --git a/src/DF/DF_Document.cxx b/src/DF/DF_Document.cxx new file mode 100644 index 000000000..47b9516e7 --- /dev/null +++ b/src/DF/DF_Document.cxx @@ -0,0 +1,125 @@ +#include "DF_definitions.hxx" +#include "DF_Document.hxx" +#include "DF_Label.hxx" +#include "DF_ChildIterator.hxx" + +using namespace std; + +//Class DF_Document is container for user's data stored as a tree of Labels +//with assigned Attributes + +DF_Document::DF_Document(const string& theDocumentType) +{ + _id = -1; + _type = theDocumentType; + _modified = true; +} + +DF_Document::~DF_Document() +{ + Clear(); +} + +DF_Application* DF_Document::GetApplication() +{ + return _appli; +} + +//Returns a Label of this Document with entry "0:1" +DF_Label DF_Document::Main() +{ + if(!_main.IsNull()) return _main; + + if(_root.IsNull()) { + _root = DF_Label(new DF_LabelNode()); + _root._node->_document = this; + } + + _main = _root.FindChild(1, true); + + return _main; +} + +//Returns a Label of this Document with entry "0:" +DF_Label DF_Document::Root() +{ + if(!_root.IsNull()) return _root; + + if(_root.IsNull()) { + _root = DF_Label(new DF_LabelNode()); + _root._node->_document = this; + } + + return _root; +} + + +//Returns an ID of this +int DF_Document::GetDocumentID() const +{ + return _id; +} + +//Returns a type of the Document +string DF_Document::GetDocumentType() +{ + return _type; +} + +//Clears the content of this Document +void DF_Document::Clear() +{ + if(_root.IsNull()) return; + + vector vn; + DF_ChildIterator CI(_root, true); + for(; CI.More(); CI.Next()) { + DF_LabelNode* node = CI.Value()._node; + if(node) vn.push_back(node); + } + + for(int i = 0, len = vn.size(); iReset(); +} + +//Returns true if this document is empty +bool DF_Document::IsEmpty() +{ + if(_root.IsNull()) return true; + + DF_ChildIterator CI(_root, true); + for(; CI.More(); CI.Next()) { + DF_LabelNode* node = CI.Value()._node; + if(node->_attributes.size()) return false; + } + + return true; +} + +//Returns true if this document is modified +bool DF_Document::IsModified() +{ + return _modified; +} + +//Sets whether a document is modified +void DF_Document::SetModified(bool isModified) +{ + _modified = isModified; +} + + +//Restores a content of the Document from the std::string theData +void DF_Document::Load(const std::string& theData) +{ + //Not implemented +} + +//Converts a content of the Document into the std::string +string DF_Document::Save() +{ + //Not implemented + return ""; +} diff --git a/src/DF/DF_Document.hxx b/src/DF/DF_Document.hxx new file mode 100644 index 000000000..de51652ae --- /dev/null +++ b/src/DF/DF_Document.hxx @@ -0,0 +1,65 @@ +#ifndef DFDOCUMENT_HXX +#define DFDOCUMENT_HXX + +#include "DF_definitions.hxx" +#include "DF_Label.hxx" + +#include + +class DF_Application; + +//Class DF_Document is container for user's data stored as a tree of Labels +//with assigned Attributes +class DF_Document { +public: + //Constructor + Standard_EXPORT DF_Document(const std::string& theDocumentType); + + Standard_EXPORT ~DF_Document(); + + Standard_EXPORT DF_Application* GetApplication(); + + //Returns a Label of this Document with entry "0:1" + Standard_EXPORT DF_Label Main(); + + //Returns a root Label with entry "0:" + Standard_EXPORT DF_Label Root(); + + //Returns an ID of this + Standard_EXPORT int GetDocumentID() const; + + //Returns a type of the Document + Standard_EXPORT std::string GetDocumentType(); + + //Clears the content of this Document + Standard_EXPORT void Clear(); + + //Returns true if this document is empty + Standard_EXPORT bool IsEmpty(); + + //Returns true if this document is modified + Standard_EXPORT bool IsModified(); + + //Returns true if this document is modified + Standard_EXPORT void SetModified(bool isModified); + + //########### Load/Save virtual methods ## + + //Restores a content of the Document from the std::string theData + Standard_EXPORT virtual void Load(const std::string& theData); + + //Converts a content of the Document into the std::string + Standard_EXPORT virtual std::string Save(); + + friend class DF_Application; + +private: + DF_Label _main; + DF_Label _root; + std::string _type; + int _id; + bool _modified; + DF_Application* _appli; +}; + +#endif diff --git a/src/DF/DF_Label.cxx b/src/DF/DF_Label.cxx new file mode 100644 index 000000000..08d8ae9f8 --- /dev/null +++ b/src/DF/DF_Label.cxx @@ -0,0 +1,477 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_ChildIterator.hxx" + +#include + +using namespace std; + +//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels. +//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:". +//For example "0:1:1" corresponds the following structure +// 0_ +// | +// |_1_ +// | +// |_ 1 + +DF_Label DF_Label::Label(const DF_Label& theLabel, const string& theEntry, bool isCreated) +{ + if(theLabel.IsNull()) return DF_Label(); + + DF_Label aLabel = theLabel.Root(); + if(theEntry == "0:") return aLabel; + if(theEntry == "0:1") return theLabel.GetDocument()->Main(); + + char* cc = (char*)theEntry.c_str(); + int n = 0; + vector tags; + + while (*cc != '\0') { + while ( *cc >= '0' && *cc <= '9') { + n = 10*n + (*cc - '0'); + ++cc; + } + if (*cc == ':' || *cc == '\0') { + tags.push_back(n); + n = 0; + if (*cc != '\0') ++cc; + } + else { + tags.clear(); + break; + } + } + + if(!tags.size()) return DF_Label(); + + for(int i = 1, len = tags.size(); !aLabel.IsNull() && i_document; +} + +//Returns true if theLabel equals to this label +bool DF_Label::operator==(const DF_Label& theLabel) +{ + if(IsNull() || theLabel.IsNull()) return false; + return (theLabel.Entry() == Entry()); +} + +//Returns true if theLabel doesn't equals to this label +bool DF_Label::operator!=(const DF_Label& theLabel) +{ + if(IsNull() || theLabel.IsNull()) return true; + return (theLabel.Entry() != Entry()); +} + + +//Returns a tag of this Label +int DF_Label::Tag() const +{ + if(!_node) return -1; + return _node->_tag; +} + +//Returns true if this Label is attached to the tree in the Document. +bool DF_Label::IsAttached() +{ + if(!_node) return false; + return (bool)(_node->_document); +} + +//Searches an Attribute with given ID located on this Label. +//Returns true if the Attribute is found. +DF_Attribute* DF_Label::FindAttribute(const std::string& theID) const +{ + if(!_node) return NULL; + + if(_node->_attributes.find(theID) == _node->_attributes.end()) return NULL; + return _node->_attributes[theID]; +} + +//Returns true if there is an Attribute with given ID on this Label. +bool DF_Label::IsAttribute(const std::string& theID) const +{ + if(!_node) return false; + + return (_node->_attributes.find(theID) != _node->_attributes.end()); +} + +//Adds theAttribute to the Label where this Attribute is located. +//Returns true if theAttribute was added. +bool DF_Label::AddAttribute(DF_Attribute* theAttribute) const +{ + if(!_node) return false; + + if(_node->_attributes.find(theAttribute->ID()) != _node->_attributes.end()) return false; + theAttribute->_node = _node; + _node->_attributes[theAttribute->ID()] = theAttribute; + theAttribute->AfterAddition(); + + return true; +} + +//Forgets an Attribute with given ID located on the this Label. +bool DF_Label::ForgetAttribute(const std::string& theID) const +{ + if(!_node) return false; + + if(_node->_attributes.find(theID) == _node->_attributes.end()) return false; + DF_Attribute* attr = _node->_attributes[theID]; + attr->BeforeForget(); + _node->_attributes.erase(theID); + delete attr; + + return true; +} + +//Forgets all Attributes located on this Label. +bool DF_Label::ForgetAllAttributes(bool clearChildren) const +{ + if(!_node) return false; + + vector va = GetAttributes(); + _node->_attributes.clear(); + + for(int i = 0, len = va.size(); iBeforeForget(); + delete va[i]; + } + + if(clearChildren) { + DF_ChildIterator CI(*this, true); + for(; CI.More(); CI.Next()) + CI.Value().ForgetAllAttributes(true); + } + + return true; +} + +//Returns Father of this Label. +DF_Label DF_Label::Father() const +{ + if(!_node) return DF_Label(); + + return _node->_father; +} + +//Returns is this Label is not initialized +bool DF_Label::IsNull() const +{ + return (!_node || (_node->_document == NULL)); +} + +//Returns is this Label is a Root label +bool DF_Label::IsRoot() const +{ + if(IsNull() || Father().IsNull()) return true; + return false; +} + + +//Returns true if this Label has Attributes. +bool DF_Label::HasAttributes() const +{ + if(!_node) return false; + + return !(_node->_attributes.empty()); +} + +//Returns a list of Attributes of this Label. +vector DF_Label::GetAttributes() const +{ + vector attributes; + if(!_node) return attributes; + + typedef map::const_iterator AI; + vector sorted; + for(AI p = _node->_attributes.begin(); p!=_node->_attributes.end(); p++) + sorted.push_back(p->first); + + sort(sorted.begin(), sorted.end()); + int len = sorted.size(); + for(int i = 0; i_attributes[sorted[i]]); + + return attributes; +} + +//Returns true if this Label has a child Label. +bool DF_Label::HasChild() const +{ + if(!_node) return false; + + return (bool)(_node->_firstChild); +} + +//Returns a number of child Labels. +int DF_Label::NbChildren() const +{ + if(!_node) return -1; + + if(!_node->_firstChild) return 0; + int nb = 1; + DF_LabelNode* next = _node->_firstChild->_next; + while(next) { + nb++; + next = next->_next; + } + + return nb; +} + +//Returns the depth (a number of fathers required to identify the Label) of this Label in the tree. +int DF_Label::Depth() const +{ + if(!_node) return -1; + + return _node->_depth; +} + +//Returns true if this Label is a descendant of theLabel. +bool DF_Label::IsDescendant(const DF_Label& theLabel) +{ + if(!_node) return false; + + DF_LabelNode* father = _node->_father; + if(!father) return false; + + while(father) { + if(father == theLabel._node) return true; + father = father->_father; + } + + return false; +} + +//Returns the root Label of a Label tree to which this Label belongs. +DF_Label DF_Label::Root() const +{ + if(!_node) return DF_Label(); + + return _node->_document->Main().Father(); +} + +//Finds a child Label of this Label with a given tag. If isCreate = true and there is no child +//Label with the given tag, the child Label is created. +DF_Label DF_Label::FindChild(int theTag, bool isCreate) +{ + if(!_node || IsNull()) return DF_Label(); + + DF_LabelNode *aLabel = NULL, *aPrevious = NULL, *aNext = NULL; + if(!_node->_firstChild && !isCreate) return DF_Label(); + + if(_node->_firstChild && _node->_firstChild->_tag == theTag) + return DF_Label(_node->_firstChild); + + if(_node->_lastChild) { + if(_node->_lastChild->_tag == theTag) return DF_Label(_node->_lastChild); + if(_node->_lastChild->_tag < theTag) aPrevious = _node->_lastChild; + } + + if(!aPrevious) { + aLabel = _node->_firstChild; + while(aLabel) { + if(aLabel->_tag == theTag) return DF_Label(aLabel); + if(aLabel->_tag > theTag) { + aNext = aLabel; + break; + } + if(aLabel->_tag < theTag) aPrevious = aLabel; + aLabel = aLabel->_next; + } + } + + if(!isCreate) return DF_Label(); + + DF_LabelNode* aChild = new DF_LabelNode(); + aChild->_father = this->_node; + aChild->_document = _node->_document; + aChild->_tag = theTag; + aChild->_depth = _node->_depth+1; + if(aNext) { + aChild->_previous = aNext->_previous; + aChild->_next = aNext; + aNext->_previous = aChild; + } + if(aPrevious) { + aChild->_previous = aPrevious; + aChild->_next = aPrevious->_next; + aPrevious->_next = aChild; + } + + if(!_node->_firstChild || (aNext && aNext == _node->_firstChild) ) _node->_firstChild = aChild; + if(!_node->_lastChild || !aNext) _node->_lastChild = aChild; + + return aChild; +} + +//Creates a new child Label of this Label. +DF_Label DF_Label::NewChild() +{ + if(!_node || IsNull()) return DF_Label(); + + int tag = 1; + if(_node->_lastChild) tag = _node->_lastChild->_tag+1; + + return FindChild(tag, true); +} + +//Returns a string entry of this Label +string DF_Label::Entry() const +{ + string entry = ""; + vector vi; + DF_LabelNode* father = this->_node; + while(father) { + vi.push_back(father->_tag); + father = father->_father; + } + + int len = vi.size(); + if(len == 1) { + entry = "0:"; + } + else { + char buffer[128]; + for(int i = len-1; i>=0; i--) { + int tag = vi[i]; + sprintf(buffer, "%d", tag); + entry+=string(buffer); + if(i) entry += ":"; + } + } + + return entry; +} + +bool DF_Label::IsEqual(const DF_Label& theLabel) +{ + if(theLabel.IsNull() || IsNull()) return false; + DF_Label L(theLabel); + return (L.Entry() == Entry()); +} + + +void DF_Label::Nullify() +{ + delete _node; + _node = NULL; +} + +void DF_Label::dump() +{ + if(!_node) cout << "DF_Label addr : " << this << " NULL " << endl; + else { + cout << "DF_Label addr : " << this->_node << " entry : " << Entry() << endl; + if(_node->_father) cout << " Father : " << _node->_father << " entry : " << Father().Entry() << endl; + else cout << " Father : NULL " << endl; + + if(_node->_firstChild) cout << " FirstChild : " << _node->_firstChild << " entry : " << DF_Label(_node->_firstChild).Entry() << endl; + else cout << " FirstChild : NULL " << endl; + + if(_node->_lastChild) cout << " LastChild : " << _node->_lastChild << " entry : " << DF_Label(_node->_lastChild).Entry() << endl; + else cout << " LastChild : NULL " << endl; + + if(_node->_previous) cout << " Previous : " << _node->_previous << " entry : " << DF_Label(_node->_previous).Entry() << endl; + else cout << " Previous : NULL " << endl; + + if(_node->_next) cout << " Next : " << _node->_next << " entry : " << DF_Label(_node->_next).Entry() << endl; + else cout << " Next : NULL " << endl; + } +} + + +/* + ############################################### + DF_LabelNode methods + ############################################### +*/ + +DF_LabelNode::DF_LabelNode() +{ + _depth = 0; + _tag = 0; + _attributes.clear(); + _document = NULL; + _father = NULL; + _firstChild = NULL; + _lastChild = NULL; + _previous = NULL; + _next = NULL; +} + +DF_LabelNode::~DF_LabelNode() +{ + vector va; + typedef map::const_iterator AI; + for(AI p = _attributes.begin(); p!=_attributes.end(); p++) + va.push_back(p->second); + + for(int i = 0, len = va.size(); i va; + typedef map::const_iterator AI; + for(AI p = _attributes.begin(); p!=_attributes.end(); p++) + va.push_back(p->second); + + for(int i = 0, len = va.size(); i +#include +#include + +class DF_Document; + + +class DF_LabelNode +{ +public: + DF_LabelNode(); + ~DF_LabelNode(); + void Reset(); +private: + int _tag; + int _depth; + DF_LabelNode* _father; + DF_LabelNode* _previous; + DF_LabelNode* _next; + DF_LabelNode* _firstChild; + DF_LabelNode* _lastChild; + DF_Document* _document; + std::map< std::string, DF_Attribute* > _attributes; + + friend class DF_Document; + friend class DF_Label; + friend class DF_ChildIterator; + friend class DF_Attribute; +}; + +//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels. +//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:". +//For example "0:1:1" corresponds the following structure +// 0_ +// | +// |_1_ +// | +// |_ 1 + +class DF_Label { +public: + + //Returns a Label by its entry, if isCreated true the Label will be created if not exists + Standard_EXPORT static DF_Label Label(const DF_Label& theLabel, const std::string& theEntry, bool isCreated = true); + + //Constructors: creates a root label + Standard_EXPORT DF_Label(); + + //Copy constructor + Standard_EXPORT DF_Label(const DF_Label& theLabel); + + //Creates a Label from the LabelNode + Standard_EXPORT DF_Label(DF_LabelNode* theNode); + + //Operator = + Standard_EXPORT DF_Label& operator=(const DF_Label& theLabel); + + //Destructor + Standard_EXPORT ~DF_Label(); + + //Returns a smart pointer to Document which contains this Label + Standard_EXPORT DF_Document* GetDocument() const; + + //Returns true if theLabel equals to this label + Standard_EXPORT bool operator==(const DF_Label& theLabel); + + //Returns true if theLabel doesn't equals to this label + Standard_EXPORT bool operator!=(const DF_Label& theLabel); + + //Returns a tag of this Label + Standard_EXPORT int Tag() const; + + //Returns true if this Label is attached to the tree in the Document. + Standard_EXPORT bool IsAttached(); + + //Searches an Attribute with given ID located on this Label. + //Returns true if the Attribute is found. + Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const; + + //Returns true if there is an Attribute with given ID on this Label. + Standard_EXPORT bool IsAttribute(const std::string& theID) const; + + //Adds theAttribute to the Label where this Attribute is located. + //Returns true if theAttribute was added. + Standard_EXPORT bool AddAttribute(DF_Attribute* theAttribute) const; + + //Forgets an Attribute with given ID located on the this Label. + Standard_EXPORT bool ForgetAttribute(const std::string& theID) const; + + //Forgets all Attributes located on this Label. + Standard_EXPORT bool ForgetAllAttributes(bool clearChildren = true) const; + + //Returns Father of this Label. + Standard_EXPORT DF_Label Father() const; + + //Return true if the label is not initialized + Standard_EXPORT bool IsNull() const; + + //Return true if the label is a Root label + Standard_EXPORT bool IsRoot() const; + + //Returns true if this Label has Attributes. + Standard_EXPORT bool HasAttributes() const; + + //Returns a list of Attributes of this Label. + Standard_EXPORT std::vector GetAttributes() const; + + //Returns true if this Label has a child Label. + Standard_EXPORT bool HasChild() const; + + //Returns a number of child Labels. + Standard_EXPORT int NbChildren() const; + + //Returns the depth (a number of fathers required to identify the Label) of this Label in the tree. + Standard_EXPORT int Depth() const; + + //Returns true if this Label is a descendant of theLabel. + Standard_EXPORT bool IsDescendant(const DF_Label& theLabel); + + //Returns the root Label of a Label tree to which this Label belongs. + Standard_EXPORT DF_Label Root() const; + + //Finds a child Label of this Label with a given tag. If isCreate = true and there is no child + //Label with the given tag, the child Label is created. + Standard_EXPORT DF_Label FindChild(int theTag, bool isCreate = true); + + //Creates a new child Label of this Label. + Standard_EXPORT DF_Label NewChild(); + + //Returns a string presentation of the entry + Standard_EXPORT std::string Entry() const; + + //Returns true if theLabel is the same as me + Standard_EXPORT bool IsEqual(const DF_Label& theLabel); + + Standard_EXPORT void dump(); + +private: + //Nullifies the content of the label + void Nullify(); + +friend class DF_Document; +friend class DF_ChildIterator; + +private: + DF_LabelNode* _node; +}; + +#endif diff --git a/src/DF/DF_definitions.hxx b/src/DF/DF_definitions.hxx new file mode 100644 index 000000000..816839cfa --- /dev/null +++ b/src/DF/DF_definitions.hxx @@ -0,0 +1,125 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef DF_DEF_HXX +#define DF_DEF_HXX + +#ifdef WIN32 +# ifdef DF_EXPORTS +# define DF_EXPORT __declspec( dllexport ) +# else +# define DF_EXPORT __declspec( dllimport ) +# endif +#else +# define DF_EXPORT +#endif + +#include +#include +#include + +template class df_shared_ptr: public boost::shared_ptr +{ +public: + df_shared_ptr() {} + + template + explicit df_shared_ptr(Y * p) + { + boost::shared_ptr::reset(p); + } + + template + df_shared_ptr(df_shared_ptr const & r): + boost::shared_ptr(r,boost::detail::dynamic_cast_tag()) + {} + + template + df_shared_ptr & operator=(df_shared_ptr const & r) + { + df_shared_ptr(r).swap(*this); + return *this; + } + + template df_shared_ptr& operator()(Y * p) // Y must be complete + { + if(T* pt = dynamic_cast(p)) + boost::shared_ptr::reset(pt); + else + boost::throw_exception(std::bad_cast()); + return *this; + } + +}; + +# if defined(WNT) && !defined(HAVE_NO_DLL) + +# ifndef Standard_EXPORT +# define Standard_EXPORT __declspec( dllexport ) +// For global variables : +# define Standard_EXPORTEXTERN __declspec( dllexport ) extern +# define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport ) +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT __declspec( dllimport ) extern +# define Standard_IMPORTC extern "C" __declspec( dllimport ) +# endif /* Standard_IMPORT */ + +# else /* WNT */ + +# ifndef Standard_EXPORT +# define Standard_EXPORT +// For global variables : +# define Standard_EXPORTEXTERN extern +# define Standard_EXPORTEXTERNC extern "C" +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT extern +# define Standard_IMPORTC extern "C" +# endif /* Standard_IMPORT */ + +# endif /* WNT */ + +# ifndef __Standard_API +//# ifdef WNT +# if !defined(WNT) +# define __Standard_API Standard_EXPORT +# define __Standard_APIEXTERN Standard_EXPORTEXTERN +# else +# define __Standard_API Standard_IMPORT +# define __Standard_APIEXTERN Standard_IMPORT +# endif // __Standard_DLL +//# else +//# define __Standard_API +//# endif // WNT +# endif // __Standard_API + +#include +class Standard_EXPORT DFexception +{ +public : + DFexception(const char *message) { + std::cerr << message << std::endl; + } +}; + + +#endif diff --git a/src/DF/Makefile.am b/src/DF/Makefile.am new file mode 100644 index 000000000..00dabed07 --- /dev/null +++ b/src/DF/Makefile.am @@ -0,0 +1,99 @@ +# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG +# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : Makefile.am +# Author : Guillaume Boulant (CSSI) +# Module : KERNEL + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Files to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS= \ + DF_Attribute.hxx \ + DF_Label.hxx \ + DF_Application.hxx \ + DF_Document.hxx \ + DF_ChildIterator.hxx \ + DF_Container.hxx \ + DF_definitions.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS=\ + -I$(srcdir)/../Basics \ + -I$(srcdir)/../SALOMELocalTrace \ + -I$(srcdir)/../HDFPersist \ + @HDF5_INCLUDES@ \ + @BOOST_CPPFLAGS@ + +# This flag is used to resolve the dependencies of OCC libraries. +LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS =\ + ../HDFPersist/libSalomeHDFPersist.la \ + @HDF5_LIBS@ \ + $(LDXMUFLAGS) + + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libDF.la +libDF_la_SOURCES = \ + DF_Attribute.cxx \ + DF_Label.cxx \ + DF_Document.cxx \ + DF_Application.cxx \ + DF_ChildIterator.cxx \ + DF_Container.cxx \ +\ + DF_Attribute.hxx \ + DF_Label.hxx \ + DF_Application.hxx \ + DF_Document.hxx \ + DF_ChildIterator.hxx \ + DF_Container.hxx \ + DF_definitions.hxx + +libDF_la_CPPFLAGS = $(COMMON_CPPFLAGS) +libDF_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libDF_la_LIBADD = $(COMMON_LIBS) + +# +# =============================================================== +# Executables targets +# =============================================================== +# +bin_PROGRAMS = testDF +testDF_SOURCES = testDF.cxx +testDF_CPPFLAGS = $(COMMON_CPPFLAGS) +testDF_LDADD = libDF.la $(COMMON_LIBS) + diff --git a/src/DF/testDF.cxx b/src/DF/testDF.cxx new file mode 100644 index 000000000..69dd8920c --- /dev/null +++ b/src/DF/testDF.cxx @@ -0,0 +1,311 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +//File: testDF.cxx +//Author: Sergey RUIN + +#include +#include +#include +#include + +#include "DF_definitions.hxx" +#include "DF_Application.hxx" +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_Container.hxx" +#include "DF_ChildIterator.hxx" + +#ifndef WNT +#include +#include +#include +#include +#else +#include +#include +#endif + +using namespace std; + +void printStr(const string& theValue) +{ + cout << "printStr: " << theValue << endl; +} + +void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds) +{ +#ifdef WNT + SYSTEMTIME st; + + GetLocalTime ( &st ); + + month = st.wMonth; + day = st.wDay; + year = st.wYear; + hours = st.wHour; + minutes = st.wMinute; + seconds = st.wSecond; +#else + struct tm transfert; + struct timeval tval; + struct timezone tzone; + int status; + + status = gettimeofday( &tval, &tzone ); + memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm)); + + month = transfert.tm_mon + 1; + day = transfert.tm_mday; + year = transfert.tm_year + 1900; + hours = transfert.tm_hour; + minutes = transfert.tm_min ; + seconds = transfert.tm_sec ; +#endif +} + +string GetUserName() +{ +#ifdef WNT + char* pBuff = new char[UNLEN + 1]; + DWORD dwSize = UNLEN + 1; + string retVal; + GetUserName ( pBuff, &dwSize ); + string theTmpUserName(pBuff,(int)dwSize -1 ); + retVal = theTmpUserName; + delete [] pBuff; + return retVal; +#else + struct passwd *infos; + infos = getpwuid(getuid()); + return string(infos->pw_name); +#endif +} + +string GetNameFromPath(const string& thePath) { + if (thePath.empty()) return ""; + int pos1 = thePath.rfind('/'); + int pos2 = thePath.rfind('\\'); + if(pos1 > 0) return thePath.substr(pos1+1, thePath.size()); + if(pos2 > 0) return thePath.substr(pos2+1, thePath.size()); + return thePath; +} + +string GetDirFromPath(const string& thePath) { + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); i splitString(const string& theValue, char separator) +{ + vector vs; + if(theValue[0] == separator && theValue.size() == 1) return vs; + int pos = theValue.find(separator); + if(pos < 0) { + vs.push_back(theValue); + return vs; + } + + string s = theValue; + if(s[0] == separator) s = s.substr(1, s.size()); + while((pos = s.find(separator)) >= 0) { + vs.push_back(s.substr(0, pos)); + s = s.substr(pos+1, s.size()); + } + + if(!s.empty() && s[0] != separator) vs.push_back(s); + return vs; +} + + +int main (int argc, char * argv[]) +{ + cout << "Test started " << endl; + + DF_Application* appli = new DF_Application; + DF_Document* doc1 = appli->NewDocument("doc_1"); + + /* + DF_Label root1 = doc1->Main(); + DF_Label child = root1.FindChild(3, true); //0:1:3 + + DF_Container* attr1 = DF_Container::Set(child); + attr1->SetInt("eighteen", 18); + + + DF_Attribute* attr = NULL; + if(!(attr = child.FindAttribute(DF_Container::GetID()))) { + cout << "Attribute wasn't found" << endl; + } + else { + attr1 = dynamic_cast(attr); + cout << "Attribute was found " << " HasID " << attr1->HasIntID("eighteen") << " value = " << attr1->GetInt("eighteen")<< endl; + } + + DF_Container *attr2 = (DF_Container*)child.FindAttribute(DF_Container::GetID()); + + if(!attr2) cout << "Can't find the attribute" << endl; + + cout << "Change find : " << attr2->GetInt("eighteen") << endl; + + + cout << "Forgetting " << child.ForgetAttribute(DF_Container::GetID()) << endl; + if(!child.FindAttribute(DF_Container::GetID())) { + cout << "Attribute wasn't found" << endl; + } + + + child = root1.NewChild(); //0:1:4 + + child.NewChild();//0:1:4:1 + + child.NewChild();//0:1:4:2 + + cout << "Is equal " << (child == child) << endl; + cout << "Is equal " << (child == root1) << endl; + + child = root1.NewChild(); //0:1:5 + + child.NewChild();//0:1:5:1 + root1.NewChild();//0:1:6 + + + DF_ChildIterator CI(root1.Father(), true); + //root1.dump(); + for(; CI.More(); CI.Next()) { + cout << CI.Value().Entry() << endl; + //CI.Value().dump(); + } + + DF_Label L = DF_Label::Label(child, "0:1:4:1"); + cout << "Found Label " << L.Entry() << endl; + + std::string s("012-56"); + + int pos = s.find('-'); + cout << "Fisrt part : " << s.substr(0, pos) << endl; + cout << "Last part : " << s.substr(pos+1, s.size()) << endl; + + vector vs = splitString("/dn20/salome/srn/salome2/", '/'); + for(int i = 0; iMain(); + DF_Label sco = root2.NewChild(); //0:1:1 + DF_Label so1 = sco.FindChild(3, true); //0:1:1:3 + DF_Label so5 = so1.FindChild(5, true); //0:1:1:5 + DF_Label so51 = so5.NewChild(); //0:1:1:5:1 + DF_Label so511 = so51.NewChild(); //0:1:1:5:1:1 + DF_Label so513 = so51.FindChild(3, true); //0:1:1:5:1:3 + DF_Label so5131 = so513.NewChild(); //0:1:1:5:1:3:1 + + + so51.FindChild(2, true); + + + DF_ChildIterator CI2(so5, true); + so5.dump(); + for(; CI2.More(); CI2.Next()) { + cout << " ###### Found child with entry = " << CI2.Value().Entry() << endl; + //CI2.Value().dump(); + } + + delete appli; + + cout << "Test finished " << endl; + return 0; +} + diff --git a/src/DSC/DSC.dox b/src/DSC/DSC.dox new file mode 100644 index 000000000..f80a7ccc9 --- /dev/null +++ b/src/DSC/DSC.dox @@ -0,0 +1,49 @@ +/*! + +\page dsc_page DSC + +DSC means Dynamic Software Component. It's an extension of the %SALOME programming model. +It provides a new paradigm to design %SALOME components. It also provides new ports for %SALOME services. +These ports are : interface ports and datastream ports. + +\section S1_DSC Datastream ports + +We list in this section the datastream ports that are provided by %SALOME. + +
      + +
    1. +BASIC datastream ports + + + +
      Port name Data type Idl Name Idl File
      BASIC_short short Data_Short_Port SALOME_Ports.idl
      +
    2. + +
    3. +CALCIUM datastream ports + + + + + + + + +
      Port name Data type Idl Name Idl File
      CALCIUM_integer sequence of long Calcium_Integer_Port Calcium_Ports.idl
      CALCIUM_real sequence of float Calcium_Real_Port Calcium_Ports.idl
      CALCIUM_double sequence of double Calcium_Double_Port Calcium_Ports.idl
      CALCIUM_string sequence of %string Calcium_String_Port Calcium_Ports.idl
      CALCIUM_logical sequence of boolean Calcium_Logical_Port Calcium_Ports.idl
      CALCIUM_complex sequence of float Calcium_Complex_Port Calcium_Ports.idl
      +
    4. + +
    5. +PALM datastream ports + + + + +
      Port name Data type Idl Name Idl File
      PALM_short short Palm_Data_Short_Port Palm_Ports.idl
      PALM_seq_short sequence of short Palm_Data_Seq_Short_Port Palm_Ports.idl
      +
    6. + +
    + +*/ + + diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.cxx b/src/DSC/DSC_Basic/ConnectionManager_i.cxx index 59f3b2624..2f7f089c9 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.cxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.cxx @@ -27,9 +27,13 @@ #include "SALOME_NamingService.hxx" ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) { + _orb = CORBA::ORB::_duplicate(orb) ; SALOME_NamingService * ns = new SALOME_NamingService(orb); const char * ConnectionManagerNameInNS = "/ConnectionManager"; - ns->Register(_this(), ConnectionManagerNameInNS); + CORBA::Object_var obref = _this(); + _remove_ref(); + ns->Register(obref, ConnectionManagerNameInNS); + delete ns; current_id = 0; pthread_mutex_init(&mutex, NULL); @@ -42,12 +46,9 @@ ConnectionManager_i::connect(Engines::DSC_ptr uses_component, const char* uses_port_name, Engines::DSC_ptr provides_component, const char* provides_port_name) -throw (Engines::DSC::PortNotDefined, - Engines::DSC::BadPortType, - Engines::DSC::NilPort) { - Ports::Port_ptr p_port = provides_component->get_provides_port(provides_port_name, false); + Ports::Port_var p_port = provides_component->get_provides_port(provides_port_name, false); uses_component->connect_uses_port(uses_port_name, p_port); provides_component->connect_provides_port(provides_port_name); @@ -75,8 +76,8 @@ throw (Engines::DSC::PortNotDefined, void ConnectionManager_i::disconnect(Engines::ConnectionManager::connectionId id, Engines::DSC::Message message) -throw (Engines::ConnectionManager::BadId) { + int err=0; // Connection id exist ? ids_it = ids.find(id); if (ids_it == ids.end()) @@ -85,11 +86,45 @@ throw (Engines::ConnectionManager::BadId) // TODO // We need to catch exceptions if one of these disconnect operation fails. connection_infos * infos = ids[id]; - infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(), + try + { + infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(), message); - infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(), - Ports::Port::_duplicate(infos->provides_port), + } + catch(CORBA::SystemException& ex) + { + std::cerr << "Problem in disconnect(CORBA::SystemException) provides port: " << infos->provides_port_name << std::endl; + err=1; + } + try + { + infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(), + infos->provides_port, message); + } + catch(CORBA::SystemException& ex) + { + std::cerr << "Problem in disconnect(CORBA::SystemException) uses port: " << infos->uses_port_name << std::endl; + err=1; + } delete infos; ids.erase(id); + + if(err) + throw Engines::DSC::BadPortReference(); +} + +void +ConnectionManager_i::ShutdownWithExit() +{ + if(!CORBA::is_nil(_orb)) + _orb->shutdown(0); + + //exit( EXIT_SUCCESS ); +} + +CORBA::Long +ConnectionManager_i::getPID() +{ + return (CORBA::Long)getpid(); } diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.hxx b/src/DSC/DSC_Basic/ConnectionManager_i.hxx index c0459f482..7696fc676 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.hxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.hxx @@ -52,10 +52,7 @@ class DSC_BASIC_EXPORT ConnectionManager_i : Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component, const char* uses_port_name, Engines::DSC_ptr provides_component, - const char* provides_port_name) - throw (Engines::DSC::PortNotDefined, - Engines::DSC::BadPortType, - Engines::DSC::NilPort); + const char* provides_port_name); /*! * CORBA method : releases a connection performed with @@ -64,17 +61,26 @@ class DSC_BASIC_EXPORT ConnectionManager_i : * \see Engines::ConnectionManager::disconnect */ void disconnect(Engines::ConnectionManager::connectionId id, - Engines::DSC::Message message) - throw (Engines::ConnectionManager::BadId); + Engines::DSC::Message message); + + /*! + Shutdown the ConnectionManager process. + */ + void ShutdownWithExit(); + + /*! + Returns the PID of the connection manager + */ + CORBA::Long getPID(); private : struct connection_infos { - Engines::DSC_ptr uses_component; + Engines::DSC_var uses_component; std::string uses_port_name; - Engines::DSC_ptr provides_component; + Engines::DSC_var provides_component; std::string provides_port_name; - Ports::Port_ptr provides_port; + Ports::Port_var provides_port; }; typedef std::mapactivate(); orb->run(); + orb->destroy(); }catch(CORBA::SystemException&){ MESSAGE("Caught CORBA::SystemException."); }catch(PortableServer::POA::WrongPolicy&){ diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am new file mode 100644 index 000000000..a40629e79 --- /dev/null +++ b/src/DSC/DSC_Python/Makefile.am @@ -0,0 +1,79 @@ +# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# +# File : Makefile.am +# Author : André RIBES (EDF), Eric Fayolle (EDF) +# Module : KERNEL +# + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ + -I$(top_srcdir)/src/DSC/DSC_User/Datastream \ + -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \ + -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \ + -I$(top_srcdir)/src/DSC/DSC_User/Basic \ + -I$(top_srcdir)/src/DSC/DSC_Basic \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -I$(top_srcdir)/src/Utils \ + -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -I$(top_builddir)/salome_adm/unix \ + -I$(top_builddir)/idl \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS = @CORBA_LIBS@ + +# +# =============================================================== +# Libraries targets +# =============================================================== +# + +AM_CFLAGS = -fexceptions +pkgpython_PYTHON = calcium.py dsccalcium.py +pkgpyexec_LTLIBRARIES = _calcium.la +MY_SWIG_FLAGS= $(SWIG_FLAGS) -noexcept +SWIG_SRC=calcium.i +_calcium_la_SOURCES = calcium_wrap.cpp +_calcium_la_LDFLAGS = -module +_calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ + ../DSC_User/Datastream/libSalomeDatastream.la \ + ../DSC_User/Basic/libSalomeDSCSupervBasic.la \ + ../DSC_User/libSalomeDSCSuperv.la \ + ../DSC_Basic/libSalomeDSCContainer.la \ + ../../Container/libSalomeContainer.la + +_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) + +calcium_wrap.cpp calcium.py:calcium.i + $(SWIG) $(MY_SWIG_FLAGS) -o calcium_wrap.cpp $< + +CLEANFILES = calcium_wrap.cpp + diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i new file mode 100644 index 000000000..3d093153c --- /dev/null +++ b/src/DSC/DSC_Python/calcium.i @@ -0,0 +1,565 @@ +%define DOCSTRING +"CALCIUM python wrapping : Superv_Component class +" +%enddef + +%module(docstring=DOCSTRING) calcium + +%feature("autodoc", "0"); + +%{ +//C++ Includes +#include +#include +#include +#include +#include + +//--- from omniORBpy.h (not present on Debian Sarge packages) + +struct omniORBpyAPI { + + PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj, + CORBA::Boolean hold_lock); + // Convert a C++ object reference to a Python object reference. + // If is true, caller holds the Python interpreter lock. + + CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj, + CORBA::Boolean hold_lock); + // Convert a Python object reference to a C++ object reference. + // Raises BAD_PARAM if the Python object is not an object reference. + // If is true, caller holds the Python interpreter lock. + + + omniORBpyAPI(); + // Constructor for the singleton. Sets up the function pointers. +}; + + omniORBpyAPI* api; + +%} + +%init +%{ + // init section + +#ifdef WITH_NUMPY + import_array() +#endif + + PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy"); + if (!omnipy) + { + PyErr_SetString(PyExc_ImportError, + (char*)"Cannot import _omnipy"); + return; + } + PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API"); + api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi); + Py_DECREF(pyapi); +%} + +%include "carrays.i" + +%array_class(int, intArray); +%array_class(float, floatArray); +%array_class(double, doubleArray); + +#ifdef WITH_NUMPY +/* + * Most of this code is borrowed from numpy distribution + * The following code originally appeared in enthought/kiva/agg/src/numeric.i, + * author unknown. It was translated from C++ to C by John Hunter. Bill + * Spotz has modified it slightly to fix some minor bugs, add some comments + * and some functionality. + */ + +%{ + +#include + +/* Macros to extract array attributes. + */ +#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) +#define array_type(a) (int)(PyArray_TYPE(a)) +#define array_dimensions(a) (((PyArrayObject *)a)->nd) +#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) +#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) + +/* Given a PyObject, return a string describing its type. + */ +char* pytype_string(PyObject* py_obj) { + if (py_obj == NULL ) return "C NULL value"; + if (PyCallable_Check(py_obj)) return "callable" ; + if (PyString_Check( py_obj)) return "string" ; + if (PyInt_Check( py_obj)) return "int" ; + if (PyFloat_Check( py_obj)) return "float" ; + if (PyDict_Check( py_obj)) return "dict" ; + if (PyList_Check( py_obj)) return "list" ; + if (PyTuple_Check( py_obj)) return "tuple" ; + if (PyFile_Check( py_obj)) return "file" ; + if (PyModule_Check( py_obj)) return "module" ; + if (PyInstance_Check(py_obj)) return "instance" ; + + return "unkown type"; +} + +/* Given a Numeric typecode, return a string describing the type. + */ +char* typecode_string(int typecode) { + char* type_names[20] = {"char","unsigned byte","byte","short", + "unsigned short","int","unsigned int","long", + "float","double","complex float","complex double", + "object","ntype","unkown"}; + return type_names[typecode]; +} + +/* Make sure input has correct numeric type. Allow character and byte + * to match. Also allow int and long to match. + */ +int type_match(int actual_type, int desired_type) { + return PyArray_EquivTypenums(actual_type, desired_type); +} + +/* Given a PyObject pointer, cast it to a PyArrayObject pointer if + * legal. If not, set the python error string appropriately and + * return NULL./ + */ +PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) { + PyArrayObject* ary = NULL; + if (is_array(input) && (typecode == PyArray_NOTYPE || + PyArray_EquivTypenums(array_type(input), + typecode))) { + ary = (PyArrayObject*) input; + } + else if is_array(input) { + char* desired_type = typecode_string(typecode); + char* actual_type = typecode_string(array_type(input)); + PyErr_Format(PyExc_TypeError, + "Array of type '%s' required. Array of type '%s' given", + desired_type, actual_type); + ary = NULL; + } + else { + char * desired_type = typecode_string(typecode); + char * actual_type = pytype_string(input); + PyErr_Format(PyExc_TypeError, + "Array of type '%s' required. A %s was given", + desired_type, actual_type); + ary = NULL; + } + return ary; +} + +/* Convert the given PyObject to a Numeric array with the given + * typecode. On Success, return a valid PyArrayObject* with the + * correct type. On failure, the python error string will be set and + * the routine returns NULL. + */ +PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, + int* is_new_object) +{ + PyArrayObject* ary = NULL; + PyObject* py_obj; + if (is_array(input) && (typecode == PyArray_NOTYPE || type_match(array_type(input),typecode))) { + ary = (PyArrayObject*) input; + *is_new_object = 0; + } + else { + py_obj = PyArray_FromObject(input, typecode, 0, 0); + /* If NULL, PyArray_FromObject will have set python error value.*/ + ary = (PyArrayObject*) py_obj; + *is_new_object = 1; + } + return ary; +} + +/* Given a PyArrayObject, check to see if it is contiguous. If so, + * return the input pointer and flag it as not a new object. If it is + * not contiguous, create a new PyArrayObject using the original data, + * flag it as a new object and return the pointer. + */ +PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object, + int min_dims, int max_dims) +{ + PyArrayObject* result; + if (array_is_contiguous(ary)) { + result = ary; + *is_new_object = 0; + } + else { + result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, + array_type(ary), + min_dims, + max_dims); + *is_new_object = 1; + } + return result; +} + +/* Convert a given PyObject to a contiguous PyArrayObject of the + * specified type. If the input object is not a contiguous + * PyArrayObject, a new one will be created and the new object flag + * will be set. + */ +PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, + int typecode, + int* is_new_object) { + int is_new1 = 0; + int is_new2 = 0; + PyArrayObject* ary2; + PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, + &is_new1); + if (ary1) { + ary2 = make_contiguous(ary1, &is_new2, 0, 0); + if ( is_new1 && is_new2) { + Py_DECREF(ary1); + } + ary1 = ary2; + } + *is_new_object = is_new1 || is_new2; + return ary1; +} + +/* Test whether a python object is contiguous. If array is + * contiguous, return 1. Otherwise, set the python error string and + * return 0. + */ +int require_contiguous(PyArrayObject* ary) { + int contiguous = 1; + if (!array_is_contiguous(ary)) { + PyErr_SetString(PyExc_TypeError, "Array must be contiguous. A discontiguous array was given"); + contiguous = 0; + } + return contiguous; +} + +/* Require the given PyArrayObject to have a specified number of + * dimensions. If the array has the specified number of dimensions, + * return 1. Otherwise, set the python error string and return 0. + */ +int require_dimensions(PyArrayObject* ary, int exact_dimensions) { + int success = 1; + if (array_dimensions(ary) != exact_dimensions) { + PyErr_Format(PyExc_TypeError, + "Array must have %d dimensions. Given array has %d dimensions", + exact_dimensions, array_dimensions(ary)); + success = 0; + } + return success; +} + +/* Require the given PyArrayObject to have one of a list of specified + * number of dimensions. If the array has one of the specified number + * of dimensions, return 1. Otherwise, set the python error string + * and return 0. + */ +int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) { + int success = 0; + int i; + char dims_str[255] = ""; + char s[255]; + for (i = 0; i < n && !success; i++) { + if (array_dimensions(ary) == exact_dimensions[i]) { + success = 1; + } + } + if (!success) { + for (i = 0; i < n-1; i++) { + sprintf(s, "%d, ", exact_dimensions[i]); + strcat(dims_str,s); + } + sprintf(s, " or %d", exact_dimensions[n-1]); + strcat(dims_str,s); + PyErr_Format(PyExc_TypeError, + "Array must have %s dimensions. Given array has %d dimensions", + dims_str, array_dimensions(ary)); + } + return success; +} + +/* Require the given PyArrayObject to have a specified shape. If the + * array has the specified shape, return 1. Otherwise, set the python + * error string and return 0. + */ +int require_size(PyArrayObject* ary, int* size, int n) { + int i; + int success = 1; + int len; + char desired_dims[255] = "["; + char s[255]; + char actual_dims[255] = "["; + for(i=0; i < n;i++) { + if (size[i] != -1 && size[i] != array_size(ary,i)) { + success = 0; + } + } + if (!success) { + for (i = 0; i < n; i++) { + if (size[i] == -1) { + sprintf(s, "*,"); + } + else + { + sprintf(s, "%d,", size[i]); + } + strcat(desired_dims,s); + } + len = strlen(desired_dims); + desired_dims[len-1] = ']'; + for (i = 0; i < n; i++) { + sprintf(s, "%d,", array_size(ary,i)); + strcat(actual_dims,s); + } + len = strlen(actual_dims); + actual_dims[len-1] = ']'; + PyErr_Format(PyExc_TypeError, + "Array must have shape of %s. Given array has shape of %s", + desired_dims, actual_dims); + } + return success; +} + +%} + +/* input typemap */ +%define TYPEMAP_IN3(type,typecode) +%typemap(in) type* IN_ARRAY3 + (PyArrayObject* array=NULL, int is_new_object) { + int size[1] = {-1}; + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { + array = obj_to_array_contiguous_allow_conversion($input, typecode, &is_new_object); + if (!array || !require_dimensions(array,1) || !require_size(array,size,1)) SWIG_fail; + $1 = (type*) array->data; + } +} +%typemap(freearg) type* IN_ARRAY3 { + if (is_new_object$argnum && array$argnum) Py_DECREF(array$argnum); +} +%enddef + +TYPEMAP_IN3(int, PyArray_INT) +TYPEMAP_IN3(float, PyArray_FLOAT ) +TYPEMAP_IN3(double, PyArray_DOUBLE) + +#undef TYPEMAP_IN3 + +%apply int* IN_ARRAY3 {int *val}; +%apply float* IN_ARRAY3 {float *val}; +%apply double* IN_ARRAY3 {double *val}; + +/* inplace typemaps */ + +%define TYPEMAP_INPLACE3(type,typecode) +%typemap(in) type* INPLACE_ARRAY3 (PyArrayObject* temp=NULL) { + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { + temp = obj_to_array_no_conversion($input,typecode); + if (!temp || !require_contiguous(temp)) SWIG_fail; + $1 = (type*) temp->data; + } +} +%enddef + +TYPEMAP_INPLACE3(int, PyArray_INT) +TYPEMAP_INPLACE3(float, PyArray_FLOAT ) +TYPEMAP_INPLACE3(double, PyArray_DOUBLE) + +#undef TYPEMAP_INPLACE3 + +%apply int* INPLACE_ARRAY3 {int *lval}; +%apply float* INPLACE_ARRAY3 {float *lval}; +%apply double* INPLACE_ARRAY3 {double *lval}; + +#endif + +%typemap(in) CORBA::Boolean +{ + $1=(CORBA::Boolean)PyInt_AsLong($input); +} + +%typemap(in) CORBA::ORB_ptr +{ + try { + CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); + $1 = CORBA::ORB::_narrow(obj); + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } +} + +%typemap(in) PortableServer::POA_ptr +{ + try { + CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); + $1 = PortableServer::POA::_narrow(obj); + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } +} + +%typemap(in) Engines::Container_ptr +{ + try { + CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); + $1 = Engines::Container::_narrow(obj); + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } +} + +%typemap(in) Ports::Port_ptr +{ + try { + CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); + $1 = Ports::Port::_narrow(obj); + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } +} + +%typemap(out) Ports::Port_ptr , Ports::PortProperties_ptr +{ + $result = api->cxxObjRefToPyObjRef($1, 1); +} + +/* + * Exception section + */ +// a general exception handler +%exception { + try { + $action + } catch(Engines::DSC::PortNotDefined& _e) { + PyErr_SetString(PyExc_ValueError,"Port not defined"); + return NULL; + } catch(Engines::DSC::PortNotConnected& _e) { + PyErr_SetString(PyExc_ValueError,"Port not connected"); + return NULL; + } catch(Engines::DSC::BadPortType& _e) { + PyErr_SetString(PyExc_ValueError,"Bad port type"); + return NULL; + } catch(...) { + PyErr_SetString(PyExc_ValueError,"Unknown exception"); + return NULL; + } +} + +/* + * End of Exception section + */ +namespace Engines +{ +class DSC +{ + public: + enum Message { AddingConnection, RemovingConnection, ApplicationError }; +}; +} + +class PySupervCompo:public Superv_Component_i +{ + public: + + PySupervCompo(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Engines::Container_ptr contai, + const char *instanceName, + const char *interfaceName); + + virtual ~PySupervCompo(); + CORBA::Boolean init_service(const char * service_name){return true;}; + virtual provides_port * create_provides_data_port(const char* port_fab_type) + throw (BadFabType); + virtual uses_port * create_uses_data_port(const char* port_fab_type) + throw (BadFabType); + virtual void add_port(const char * port_fab_type, + const char * port_type, + const char * port_name) + throw (PortAlreadyDefined, BadFabType, BadType, BadProperty); + template < typename SpecificPortType > + SpecificPortType * add_port(const char * port_fab_type, + const char * port_type, + const char * port_name) + throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty); + virtual void add_port(provides_port * port, + const char* provides_port_name) + throw (PortAlreadyDefined, NilPort, BadProperty); + virtual void add_port(uses_port * port, + const char* uses_port_name) + throw (PortAlreadyDefined, NilPort, BadProperty); + template + SpecificPortType * get_port( const char * port_name) + throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState); + virtual Ports::Port_ptr get_provides_port(const char* provides_port_name, + const CORBA::Boolean connection_error) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortType); + virtual void connect_uses_port(const char* uses_port_name, + Ports::Port_ptr provides_port_ref) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::BadPortType, + Engines::DSC::NilPort); + virtual void connect_provides_port(const char* provides_port_name) + throw (Engines::DSC::PortNotDefined); + virtual void disconnect_provides_port(const char* provides_port_name, + const Engines::DSC::Message message) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected); + + virtual void disconnect_uses_port(const char* uses_port_name, + Ports::Port_ptr provides_port_ref, + const Engines::DSC::Message message) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortReference); + + virtual Ports::PortProperties_ptr get_port_properties(const char* port_name); + + %extend + { + //To get the address of the component + long ptr() + { + return (long)self; + } + } +}; + +%apply int *OUTPUT { int *nval }; +%apply float *INOUT { float *ti }; +%apply float *INPUT { float *tf }; +%apply int *INOUT { int *niter }; +%apply double *INOUT { double *ti }; +%apply double *INPUT { double *tf }; + +extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend); + +#define CP_TEMPS 40 +#define CP_ITERATION 41 +#define CP_SEQUENTIEL 42 +#define CP_CONT 20 +#define CP_ARRET 21 + +int cp_cd(void *component,char *name); + +int cp_een(void *component,int dep,float t,int n,char *nom,int nval,int *eval); +int cp_edb(void *component,int dep,double t,int n,char *nom,int nval,double *eval); +int cp_ere(void *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_ecp(void *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_elo(void *component,int dep,float t,int n,char *nom,int nval,int *eval); + +int cp_len(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); +int cp_ldb(void *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval); +int cp_lre(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_lcp(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_llo(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); + +int cp_fin(void *component,int cp_end); + diff --git a/src/DSC/DSC_Python/dsccalcium.py b/src/DSC/DSC_Python/dsccalcium.py new file mode 100644 index 000000000..c96fdc16c --- /dev/null +++ b/src/DSC/DSC_Python/dsccalcium.py @@ -0,0 +1,53 @@ +import calcium +import SALOME_ComponentPy +import SALOME_DriverPy +import Engines + +class PyDSCComponent(SALOME_ComponentPy.SALOME_ComponentPy_i, + SALOME_DriverPy.SALOME_DriverPy_i): + """ + A Python SALOME component is implemented by a Python class that has + the name of the component and is located in a python module that has the + name of the component. + + This class is a base class for Python DSC components. + + You must derive it and implement init_service and those methods + that are services of the component. + """ + def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ): + SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, + contID, containerName, instanceName, interfaceName, 0) + SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName) + # create the DSC proxy + self.proxy=calcium.PySupervCompo(orb,poa,contID,instanceName,interfaceName ) + # Store a reference on naming service in _naming_service attribute + self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + + def init_service(self,service): + return True + + enums={Engines.DSC.RemovingConnection:calcium.DSC.RemovingConnection, + Engines.DSC.AddingConnection:calcium.DSC.AddingConnection, + Engines.DSC.ApplicationError:calcium.DSC.ApplicationError, + } + def get_provides_port(self,name,error): + return self.proxy.get_provides_port(name,error) + + def connect_uses_port(self,name,port): + self.proxy.connect_uses_port(name,port) + + def connect_provides_port(self,name): + self.proxy.connect_provides_port(name) + + def disconnect_provides_port(self,name,message): + self.proxy.disconnect_provides_port(name,message._v) + #self.proxy.disconnect_provides_port(name,self.enums[message]) + + def disconnect_uses_port(self,name,port,message): + self.proxy.disconnect_uses_port(name,port,message._v) + #self.proxy.disconnect_uses_port(name,port,self.enums[message]) + + def get_port_properties(self,name): + return self.proxy.get_port_properties(name) + diff --git a/src/DSC/DSC_User/Basic/basic_port_factory.hxx b/src/DSC/DSC_User/Basic/basic_port_factory.hxx index 7550ffaee..8407c217b 100644 --- a/src/DSC/DSC_User/Basic/basic_port_factory.hxx +++ b/src/DSC/DSC_User/Basic/basic_port_factory.hxx @@ -26,6 +26,7 @@ #ifndef _BASIC_PORT_FACTORY_HXX_ #define _BASIC_PORT_FACTORY_HXX_ +#include "port_factory.hxx" #include "data_short_port_provides.hxx" #include "data_short_port_uses.hxx" @@ -38,7 +39,8 @@ using namespace std; * to be used by Superv_Component_i. * It builds basic ports. */ -class basic_port_factory +class basic_port_factory : + public port_factory { public: basic_port_factory(); diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.cxx b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx index 08723ec70..5b204d41f 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_provides.cxx +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx @@ -27,18 +27,65 @@ data_short_port_provides::data_short_port_provides() { _val = 0; + short_termine = false; + short_mutex = new pthread_mutex_t(); + pthread_mutex_init(short_mutex, NULL); + short_condition = new pthread_cond_t(); + pthread_cond_init(short_condition, NULL); + short_termine_cp = true; + short_mutex_cp = new pthread_mutex_t(); + pthread_mutex_init(short_mutex_cp, NULL); + short_condition_cp = new pthread_cond_t(); + pthread_cond_init(short_condition_cp, NULL); } -data_short_port_provides::~data_short_port_provides() {} +data_short_port_provides::~data_short_port_provides() { + pthread_mutex_destroy(short_mutex); + delete short_mutex; + pthread_cond_destroy(short_condition); + delete short_condition; + pthread_mutex_destroy(short_mutex_cp); + delete short_mutex_cp; + pthread_cond_destroy(short_condition_cp); + delete short_condition_cp; +} void data_short_port_provides::put(CORBA::Short data) { + // On attend que le get soit fait + pthread_mutex_lock(short_mutex_cp); + while (short_termine_cp == false) + { + pthread_cond_wait(short_condition_cp, short_mutex_cp); + } + short_termine_cp = false; + pthread_mutex_unlock(short_mutex_cp); + + pthread_mutex_lock(short_mutex); _val = data; + short_termine = true; + pthread_cond_signal(short_condition); + pthread_mutex_unlock(short_mutex); } CORBA::Short data_short_port_provides::get() { - return _val; + CORBA::Short result; + pthread_mutex_lock(short_mutex); + while (short_termine == false) + { + pthread_cond_wait(short_condition, short_mutex); + } + result = _val; + short_termine = false; + pthread_mutex_unlock(short_mutex); + + // On indique que l'on a copie la valeur + pthread_mutex_lock(short_mutex_cp); + short_termine_cp = true; + pthread_cond_signal(short_condition_cp); + pthread_mutex_unlock(short_mutex_cp); + return result; } Ports::Port_ptr diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.hxx b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx index 2c5adca40..df33f6551 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_provides.hxx +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx @@ -29,6 +29,7 @@ #include #include "SALOME_Ports.hh" #include "provides_port.hxx" +#include /*! \class data_short_port_provides * \brief This class a port that sends a CORBA short with @@ -65,6 +66,13 @@ class data_short_port_provides : private : CORBA::Short _val; + pthread_mutex_t * short_mutex; + pthread_cond_t * short_condition; + bool short_termine; + pthread_mutex_t * short_mutex_cp; + pthread_cond_t * short_condition_cp; + bool short_termine_cp; + }; #endif diff --git a/src/DSC/DSC_User/Basic/data_short_port_uses.cxx b/src/DSC/DSC_User/Basic/data_short_port_uses.cxx index 70216b465..e67b38dff 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_uses.cxx +++ b/src/DSC/DSC_User/Basic/data_short_port_uses.cxx @@ -28,7 +28,6 @@ using namespace std; data_short_port_uses::data_short_port_uses() { - _my_port = Ports::Data_Short_Port::_nil(); _my_ports = NULL; } @@ -39,11 +38,6 @@ data_short_port_uses::get_repository_id() { return "IDL:Ports/Data_Short_Port:1.0"; } -bool -data_short_port_uses::set_port(Ports::Port_ptr port) { - _my_port = Ports::Data_Short_Port::_narrow(port); -} - void data_short_port_uses::put(CORBA::Short data) { // if (!CORBA::is_nil(_my_port)) diff --git a/src/DSC/DSC_User/Basic/data_short_port_uses.hxx b/src/DSC/DSC_User/Basic/data_short_port_uses.hxx index 7a28693b6..abe8f8e7c 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_uses.hxx +++ b/src/DSC/DSC_User/Basic/data_short_port_uses.hxx @@ -48,11 +48,6 @@ class data_short_port_uses : */ virtual const char * get_repository_id(); - /*! - * \warning deprecated - */ - virtual bool set_port(Ports::Port_ptr port); - /*! * This method is used by the component to send * a short value to all the provides ports connected. @@ -72,7 +67,6 @@ class data_short_port_uses : const Engines::DSC::Message message); private : - Ports::Data_Short_Port_ptr _my_port; Engines::DSC::uses_port * _my_ports; }; diff --git a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx index 76888edad..214ccc097 100644 --- a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx +++ b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx @@ -51,23 +51,31 @@ template < typename T > struct AdjacentFunctor { // Suppose que les valeurs passées en paramètres sont triées par ordre croissant bool operator()(const T &v1) { +#ifdef _DEBUG_ std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl; std::cout << "AdjacentFunctor: " << _min << _max << std::endl; +#endif if ( v1 <= _minValue && v1 >= _maxValue) { _equal= true; +#ifdef _DEBUG_ std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl; +#endif return true; } if ( v1 < _minValue ) { _min=v1;_minFound=true; +#ifdef _DEBUG_ std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl; +#endif } else if ( v1 > _maxValue ) { _max=v1;_maxFound=true; +#ifdef _DEBUG_ std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl; +#endif } @@ -94,7 +102,9 @@ template < typename T > struct AdjacentFunctor { bool isEqual() const { return _equal;} bool isBounded() const { return _minFound && _maxFound;} bool getBounds(TNoConst & min, TNoConst & max) const { +#ifdef _DEBUG_ std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl; +#endif if (_minFound && _maxFound ) { min=_min; max=_max; return true; } return false; } diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c index a9732b254..de497f752 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c @@ -27,6 +27,7 @@ #include "calcium.h" #include #include +#include // Interface C de SalomeCalcium @@ -150,7 +151,6 @@ InfoType cp_fin (void * component, int code) { fflush(stderr); \ fprintf(stderr,"Beginning of CPExx: %s %d %f\n",nomvar,i,t); \ if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \ - printf("cp_name : Valeur de nomvar %s\n",nomvar); \ \ InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \ nomvar, nbelem, \ @@ -170,3 +170,4 @@ CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,); CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,); CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,); CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,); + diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx new file mode 100644 index 000000000..c17ddb80a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx @@ -0,0 +1,114 @@ +#include "Calcium.hxx" +#include +#include +#include +#include +#include + +//#define _DEBUG_ + +PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Engines::Container_ptr contain, + const char *instanceName, + const char *interfaceName, + bool notif) : + Superv_Component_i(orb, poa,poa->reference_to_id(contain), instanceName, interfaceName) +{ +} + +PySupervCompo::~PySupervCompo() +{ +} + + +extern "C" +{ + void cp_exit(int err) + { + throw CalciumException(err,LOC("Abort coupling")); + } + + void setDependency(provides_port * port,char* type,CalciumTypes::DependencyType depend) + { + if(std::string(type)=="CALCIUM_real") + { + dynamic_cast(port)->setDependencyType(depend); + } + else if(std::string(type)=="CALCIUM_double") + { + dynamic_cast(port)->setDependencyType(depend); + } + else if(std::string(type)=="CALCIUM_integer") + { + dynamic_cast(port)->setDependencyType(depend); + } + else + { + std::cerr << "unknown type:" << std::endl; + } + } + + void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend) + { +#ifdef _DEBUG_ + std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl; +#endif + + if(std::string(mode) == "IN") + { + provides_port * port ; + //provides port + try + { + port = compo->create_provides_data_port(type); + compo->add_port(port, name); + if(std::string(depend) == "I") + setDependency(port,type,CalciumTypes::ITERATION_DEPENDENCY); + else if(std::string(depend) == "T") + setDependency(port,type,CalciumTypes::TIME_DEPENDENCY); + else + { + std::cerr << "create_calcium_port:unknown dependency: " << depend << std::endl; + } + } + catch(const Superv_Component_i::PortAlreadyDefined& ex) + { + //Port already defined : we use the old one + delete port; + std::cerr << "create_calcium_port: " << ex.what() << std::endl; + } + catch ( ... ) + { + std::cerr << "create_calcium_port: unknown exception" << std::endl; + } + } + else if(std::string(mode) == "OUT") + { + uses_port * uport ; + try + { + uport = compo->create_uses_data_port(type); + compo->add_port(uport, name); + } + catch(const Superv_Component_i::PortAlreadyDefined& ex) + { + //Port already defined : we use the old one + delete uport; + std::cerr << "create_calcium_port: " << ex.what() << std::endl; + } + catch ( ... ) + { + std::cerr << "create_calcium_port: unknown exception" << std::endl; + } + } + else + { + //Unknown mode + std::cerr << "create_calcium_port:Unknown mode: " << mode << std::endl; + } + } + +} + + diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.hxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.hxx new file mode 100644 index 000000000..a014eeefe --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.hxx @@ -0,0 +1,17 @@ +#include "Superv_Component_i.hxx" + +class PySupervCompo:public Superv_Component_i +{ + public: + PySupervCompo(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Engines::Container_ptr contain, + const char *instanceName, + const char *interfaceName, + bool notif = false); + virtual ~PySupervCompo(); + CORBA::Boolean init_service(const char * service_name){return true;}; +}; + + +extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index e64db491f..a6c301ee6 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -178,35 +178,51 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor{ MapIterator it2=it1; ++it2; size_t dataSize1 = DataManipulator::size(it1->second); +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl; +#endif // Gérer dans calcium la limite de la taille du buffer donnée par // l'utilisateur. size_t dataSize2 = DataManipulator::size(it2->second); +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl; +#endif size_t dataSize = std::min< size_t >( dataSize1, dataSize2 ); DataId dataId2 = it2->first; DataId dataId1 = it1->first; TimeType t2 = dataId2.first; TimeType t1 = dataId1.first; +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl; std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl; +#endif TimeType t = dataId.first; +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl; +#endif TimeType timeDiff = t2-t1; +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl; +#endif TimeType coeff = (t2-t)/timeDiff; +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl; +#endif InnerType const * const InIt1 = DataManipulator::getPointer(it1->second); +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl; std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator(std::cout," ")); std::cout << std::endl; +#endif InnerType const * const InIt2 = DataManipulator::getPointer(it2->second); +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl; std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator(std::cout," ")); std::cout << std::endl; +#endif Type dataOut = DataManipulator::create(dataSize); InnerType * const OutIt = DataManipulator::getPointer(dataOut); @@ -225,9 +241,11 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor{ // } } +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl; std::copy(OutIt,OutIt+dataSize,std::ostream_iterator(std::cout," ")); std::cout << std::endl; +#endif data = dataOut; } @@ -248,8 +266,10 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co AdjacentFunctor< key_type > af(expectedDataId); if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { +#ifdef _DEBUG_ std::cout << "-------- time expected : " << expectedDataId.first << std::endl; std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl; +#endif af.setMaxValue(key_type(expectedDataId.first*(1.0-_deltaT),0)); } isBounded = false; @@ -273,7 +293,9 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co typename AssocContainer::iterator current = prev; while ( (current != storedDatas.end()) && !af(current->first) ) { +#ifdef _DEBUG_ std::cout << "------- stored time : " << current->first << std::endl; +#endif // if ( af(current->first) ) break; prev = current++; } @@ -290,7 +312,9 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co else wDataIt1 = storedDatas.end(); +#ifdef _DEBUG_ std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl; +#endif return isEqual || isBounded; } @@ -318,7 +342,9 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { typedef typename Container::value_type value_type; typedef typename Container::iterator iterator; +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl; +#endif if ( _couplingPolicy._storageLevel == CalciumTypes::UNLIMITED_STORAGE_LEVEL ) return; @@ -327,8 +353,9 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { if (s > 0 ) { size_t dist=distance(storedDatas.begin(),wDataIt1); for (int i=0; i= expectedDataId iterator it1 = storedDatas.lower_bound(expectedDataId); +#ifdef _DEBUG_ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl; for (iterator it=storedDatas.begin();it!=storedDatas.end();++it) std::cout <<" "<<(*it).first ; std::cout <::disconn for(int i = 0; i < this->_my_ports->length(); i++) { CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]); try { - std::cerr << "-------- CalciumGenericUsesPort<>::disconnect"<< std::endl; + std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl; port->disconnect(provideLastGivenValue); } catch(const CORBA::SystemException& ex){ - throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode disconnect sur le port provide n°" - << i << " ( i>= 0)")); + std::cerr << "Can't call disconnect on provides port " << i << std::endl; } } diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx index 4669d6461..71f157f16 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx @@ -42,6 +42,7 @@ #include +//#define _DEBUG_ // Déplacer cette information dans CorbaTypeManipulator // Gérer en même temps la recopie profonde. @@ -58,8 +59,9 @@ struct IsSameType { -class CalciumInterface { -public : +//class CalciumInterface { +namespace CalciumInterface { +//public : static void @@ -85,9 +87,11 @@ public : // calcium_uses_port* myCalciumUsesPort= // dynamic_cast(myUsesPort); +#ifdef _DEBUG_ std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<< // typeid(myUsesPort).name() <<"-------------" << typeid(myCalciumUsesPort).name() <<"-------------" << std::endl; +#endif // if ( !myCalciumUsesPort ) // throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port " @@ -96,10 +100,14 @@ public : myCalciumUsesPort->disconnect(provideLastGivenValue); } catch ( const Superv_Component_i::BadCast & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif throw (CalciumException(CalciumTypes::CPTPVR,ex)); } catch ( const DSC_Exception & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif // Exception venant de SupervComponent : // PortNotDefined(CPNMVR), PortNotConnected(CPLIEN) // ou du port uses : Dsc_Exception @@ -114,23 +122,21 @@ public : // Uniquement appelé par l'utilisateur s'il a passé un pointeur de données NULL // à l'appel de ecp_lecture (demande de 0 copie) - template static void - ecp_free ( T1 * dataPtr ) - { - ecp_free ( dataPtr ); - } - - template static void + template static void ecp_free ( T1 * dataPtr ) - { - - typedef typename ProvidesPortTraits::PortType PortType; + { + typedef typename ProvidesPortTraits::PortType PortType; typedef typename PortType::DataManipulator DataManipulator; typedef typename DataManipulator::Type DataType; // Attention != T typedef typename DataManipulator::InnerType InnerType; DeleteTraits::value >::apply(dataPtr); + } + template static void + ecp_free ( T1 * dataPtr ) + { + ecp_free ( dataPtr ); } template static void @@ -171,26 +177,38 @@ public : CorbaDataType corbaData; long ilong; +#ifdef _DEBUG_ std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl; +#endif if (nomVar.empty()) throw CalciumException(CalciumTypes::CPNMVR, LOC("Le nom de la variable est ")); PortType * port; +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl; +#endif try { port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str()); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl; +#endif } catch ( const Superv_Component_i::PortNotDefined & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif throw (CalciumException(CalciumTypes::CPNMVR,ex)); } catch ( const Superv_Component_i::PortNotConnected & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl;; +#endif throw (CalciumException(CalciumTypes::CPLIEN,ex)); // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN } catch ( const Superv_Component_i::BadCast & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif throw (CalciumException(CalciumTypes::CPTPVR,ex)); } @@ -211,20 +229,30 @@ public : if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) { corbaData = port->get(ti,tf, 0); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl; +#endif } else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) { corbaData = port->get(0, i); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl; +#endif } else { // Lecture en séquence +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl; +#endif corbaData = port->next(ti,i); } +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl; +#endif size_t corbaDataSize = DataManipulator::size(corbaData); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl; +#endif // Vérifie si l'utilisateur demande du 0 copie if ( data == NULL ) { @@ -234,10 +262,14 @@ public : nRead = corbaDataSize; // Si les types T et InnerType sont différents, il faudra effectuer tout de même une recopie if (!IsSameType::value) data = new T1[nRead]; +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl; +#endif // On essaye de faire du 0 copy si les types T et InnerType sont les mêmes Copy2UserSpace< IsSameType::value >::apply(data,corbaData,nRead); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl; +#endif // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante : // old : Dans les deux cas la structure CORBA n'est plus utile @@ -247,18 +279,24 @@ public : // DataManipulator::delete_data(corbaData); } else { nRead = std::min < size_t > (corbaDataSize,bufferLength); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl; +#endif Copy2UserSpace::apply(data,corbaData,nRead); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl; +#endif // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante : // DataManipulator::delete_data(corbaData); } +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl; std::copy(data,data+nRead,std::ostream_iterator(std::cout," ")); std::cout << "Ptr :" << data << std::endl; std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl; +#endif return; @@ -297,24 +335,36 @@ public : typedef typename DataManipulator::Type CorbaDataType; // Attention != T1 typedef typename DataManipulator::InnerType InnerType; +#ifdef _DEBUG_ std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl; +#endif if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR, LOC("Le nom de la variable est ")); PortType * port; +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl; +#endif try { port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str()); +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl; +#endif } catch ( const Superv_Component_i::PortNotDefined & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif throw (CalciumException(CalciumTypes::CPNMVR,ex)); } catch ( const Superv_Component_i::PortNotConnected & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl;; +#endif throw (CalciumException(CalciumTypes::CPLIEN,ex)); // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN } catch ( const Superv_Component_i::BadCast & ex) { +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif throw (CalciumException(CalciumTypes::CPTPVR,ex)); } @@ -357,7 +407,9 @@ public : LOC(OSS()<<"Le buffer a envoyer est de taille nulle ")); - std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl; +#ifdef _DEBUG_ + std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl; +#endif CorbaDataType corbaData; @@ -385,26 +437,48 @@ public : //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) { - port->put(*corbaData,t, -1); + try + { + port->put(*corbaData,t, -1); + } + catch ( const DSC_Exception & ex) + { + throw (CalciumException(CalciumTypes::CPATAL,ex.what())); + } //Le -1 peut être traité par le cst DataIdContainer et transformé en 0 //Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl; +#endif } else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) { - port->put(*corbaData,-1, i); + try + { + port->put(*corbaData,-1, i); + } + catch ( const DSC_Exception & ex) + { + throw (CalciumException(CalciumTypes::CPATAL,ex.what())); + } +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl; +#endif } +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl; for (int i = 0; i < corbaData->length(); ++i) cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << endl; +#endif // if ( !IsSameType::value ) delete corbaData; // Supprime l'objet CORBA avec eventuellement les données qu'il contient (case de la recopie) delete corbaData; +#ifdef _DEBUG_ std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl; +#endif return; } @@ -436,12 +510,20 @@ ecp_fin_ (void * component, int code) { CalciumInterface::ecp_fin( *_component, provideLastGivenValue); } catch ( const CalciumException & ex) { //tester l'arrêt par exception +#ifdef _DEBUG_ std::cerr << ex.what() << std::endl; +#endif return ex.getInfo(); } return CalciumTypes::CPOK; }; +#ifdef _DEBUG_ +#define DEBTRACE(msg) {std::cerr<(dependencyType); \ \ if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \ - std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" << std::endl; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \ try { \ CalciumInterface::ecp_lecture< _type, _name >( *_component, \ _dependencyType, \ @@ -466,22 +548,24 @@ ecp_fin_ (void * component, int code) { nomvar, \ _bufferLength, _nRead, *data); \ } catch ( const CalciumException & ex) { \ - std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1b ------------------" << std::endl; \ - std::cerr << ex.what() << std::endl; \ - std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1ter ------------------" << std::endl; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1b ------------------" ) \ + DEBTRACE( ex.what() ) \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1ter ------------------" ) \ return ex.getInfo(); \ } \ if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \ - std::cout << "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" << std::endl; \ - std::cout << "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead << std::endl; \ - std::cout << "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead << std::endl; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \ } else *nRead = _nRead; \ if (_dependencyType == CalciumTypes::CP_SEQUENTIEL ) \ *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \ - std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \ + /* \ for (int i=0; i<_nRead;++i) \ printf("-------- CalciumInterface(lecture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,(*data)[i]); \ - std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \ + */ \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \ return CalciumTypes::CPOK; \ }; \ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \ @@ -497,11 +581,11 @@ ecp_fin_ (void * component, int code) { double _t=*t; \ size_t _bufferLength=bufferLength; \ if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \ - std::cout << "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" << std::endl; \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \ try { \ - printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar); \ + /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \ std::string essai(nomvar); \ - std::cout << "----------->-" << nomvar << std::endl; \ + DEBTRACE( "----------->-" << nomvar ) \ CalciumInterface::ecp_ecriture< _type, _name >( *_component, \ static_cast(dependencyType), \ _t,i,nomvar,_bufferLength,*data); \ @@ -509,11 +593,13 @@ ecp_fin_ (void * component, int code) { std::cerr << ex.what() << std::endl; \ return ex.getInfo(); \ } \ - std::cout << "-------- CalciumInterface(ecriture Inter Part), Valeur de data : " << std::endl; \ - std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(1) :" << data << std::endl; \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data : " ) \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Ptr(1) :" << data ) \ + /* \ for (int i=0; i<_bufferLength;++i) \ printf("-------- CalciumInterface(ecriture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,data[i]); \ - std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(2) :" << data << std::endl; \ + */ \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Ptr(2) :" << data ) \ return CalciumTypes::CPOK; \ }; \ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx index 0425a6baf..5cf6d10c5 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx @@ -48,12 +48,14 @@ table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEP table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ; +#ifdef _DEBUG_ std::cout << "CORBA_DEPENDENCY_TYPE() : table["<& ) *this ; +#ifdef _DEBUG_ std::cout << "CORBA_DEPENDENCY_TYPE() : ::operator["< MARK 1 ------------------" << std::endl; +#endif // Crée le type corba à partir du data sans lui en donner la propriété corbaData = DataManipulator::create(nRead,&data,false); +#ifdef _DEBUG_ std::cerr << "-------- Copy2CorbaSpace MARK 2 --(dataPtr : " << DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl; +#endif } }; @@ -68,11 +72,14 @@ Copy2CorbaSpace { corbaData = DataManipulator::create(nRead); InnerType * dataPtr = DataManipulator::getPointer(corbaData,false); +#ifdef _DEBUG_ std::cerr << "-------- Copy2CorbaSpace MARK 1 --(dataPtr : " << dataPtr<<")----------------" << std::endl; +#endif std::copy(&data,&data+nRead,dataPtr); +#ifdef _DEBUG_ std::cerr << "-------- Copy2CorbaSpace MARK 2 --(nRead: "< MARK 3 : " ; @@ -82,6 +89,7 @@ Copy2CorbaSpace { for (int i=0; i{ // Recopie des données dans le buffer allouée la méthode appelante // dans le cas d'une demande utilisateur 0 copie mais sur // des types utilisateurs et CORBA incompatibles. +#ifdef _DEBUG_ std::cerr << "-------- Copy2UserSpace MARK 1 --(dataPtr : " < MARK 2 --(nRead: "< MARK 3 --(data : " <(std::cout," ")); std::cout << std::endl; +#endif } }; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx index 1789bcf63..7c827dbb5 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx @@ -48,12 +48,14 @@ table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEP table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ; +#ifdef _DEBUG_ std::cout << "DEPENDENCY_TYPE() : table["< &table = (map&)*this ; +#ifdef _DEBUG_ std::cout << "DEPENDENCY_TYPE() : ::operator["< @@ -45,7 +46,8 @@ using namespace std; -class calcium_port_factory +class calcium_port_factory : + public port_factory { public: calcium_port_factory(); diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c new file mode 100644 index 000000000..a31eda3c2 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include + +static void* COMPO=0; + +#ifdef __cplusplus +extern "C" { +#endif + +static void fstrtocstr(char *cstr, char *fstr,int fstr_len) +{ + int i,iend; + for (iend = fstr_len-1; iend >= 0; iend--) + if (fstr[iend] != ' ') break; + for (i = 0; i <= iend; i++) + cstr[i] = fstr[i]; + cstr[i] = '\0'; +} + +static void cstrtofstr(char *cstr, char *fstr,int fstr_len) +{ + int i, len; + len = strlen(cstr); + if (len > fstr_len) len = fstr_len; + for (i = 0; i < len; i++) + fstr[i] = cstr[i]; + while (i < fstr_len) + fstr[i++] = ' '; +} + +static char * fstr1(char *nom,int nnom) +{ + char * cnom=(char*)malloc((nnom+1)*sizeof(char)); + fstrtocstr(cnom,nom,nnom); + return cnom; +} + +static char * free_str1(char *nom) +{ + free(nom); +} + +void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom)) +{ + /* nom is OUT argument */ + cp_cd((void *)*compo,STR_PTR(nom)); + /* replace in place ??? */ + cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom)); +} + +void F_FUNC(cplen,CPLEN)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), + int *max,int *n, int *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPLEN: %s %f %f\n",cnom,*ti,*tf); + *err=cp_len((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + fprintf(stderr,"End of CPLEN: %s \n",cnom); + free_str1(cnom); +} + +void F_FUNC(cpldb,CPLDB)(long *compo,int *dep,double *ti,double *tf,int *iter,STR_PSTR(nom), + int *max,int *n, double *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPLDB: %s %f %f \n",cnom, *ti,*tf); + *err=cp_ldb((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + fprintf(stderr,"End of CPLDB: %s %f %f \n",cnom,*ti,*tf); + free_str1(cnom); +} + +void F_FUNC(cplre,CPLRE)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), + int *max,int *n, float *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPLRE: %s %f %f \n",cnom, *ti,*tf); + *err=cp_lre((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + fprintf(stderr,"End of CPLRE: %s %f %f \n",cnom,*ti,*tf); + free_str1(cnom); +} + +void F_FUNC(cpedb,CPEDB)(long *compo,int *dep,double *ti,int *iter,STR_PSTR(nom),int *n, double *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPEDB: %s %f \n",cnom, *ti); + *err=cp_edb((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + fprintf(stderr,"End of CPEDB: %s %f \n",cnom, *ti); + free_str1(cnom); +} + +void F_FUNC(cpere,CPERE)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPERE: %s %f \n",cnom, *ti); + *err=cp_ere((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + fprintf(stderr,"End of CPERE: %s %f \n",cnom, *ti); + free_str1(cnom); +} + +void F_FUNC(cpeen,CPEEN)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPEEN: %s %f %d\n",cnom, *ti,*iter); + *err=cp_een((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + fprintf(stderr,"End of CPEEN: %s %f \n",cnom,*ti); + free_str1(cnom); +} + +void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err) +{ + fprintf(stderr,"CPFIN: \n"); + *err=cp_fin((void *)*compo,*dep); +} + +#ifdef __cplusplus +} +#endif + diff --git a/src/DSC/DSC_User/Datastream/Calcium/fortoc.h b/src/DSC/DSC_User/Datastream/Calcium/fortoc.h new file mode 100644 index 000000000..67b45336d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/fortoc.h @@ -0,0 +1,20 @@ + +#ifndef FORTRAN_H +#define FORTRAN_H + +/* Operateur de concatenation */ +#define _(A,B) A##B + +#ifdef __linux +#define F_FUNC(lname,uname) _(lname,_) /* Fortran function name */ +#define F_CALL(lname,uname) _(lname,_) /* Fortran function call */ +#define STR_PSTR(str) char *str /* fortran string arg pointer */ +#define STR_PLEN(str) , int _(Len,str) /* fortran string arg length */ +#define STR_PTR(str) str /* fortran string pointer */ +#define STR_LEN(str) _(Len,str) /* fortran string length */ + + +#endif + +#endif + diff --git a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx index 21fe061ee..a60cf98b3 100644 --- a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx +++ b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx @@ -214,9 +214,13 @@ public: // ATTENTION TESTER p184 si le pointeur est null // ATTENTION TESTER Si le flag release si la sequence contient des chaines // ou des object refs +#ifdef _DEBUG_ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl; +#endif InnerType * p_data = const_cast(data).get_buffer(true); +#ifdef _DEBUG_ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 2 ------"<< p_data <<"------------" << std::endl; +#endif // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie) // Les données seront automatiquement désallouées par appel interne à la méthode freebuf diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx index cc9a7e7eb..6148b8f8f 100644 --- a/src/DSC/DSC_User/Datastream/GenericPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -120,11 +120,15 @@ GenericPort::close (PortableServer::POA_var po template < typename DataManipulator, typename COUPLING_POLICY> void GenericPort::wakeupWaiting() { +#ifdef _DEBUG_ std::cout << "-------- wakeupWaiting ------------------" << std::endl; +#endif storedDatas_mutex.lock(); if (waitingForAnyDataId || waitingForConvenientDataId) { +#ifdef _DEBUG_ std::cout << "-------- wakeupWaiting:signal --------" << std::endl; std::cout << std::flush; +#endif cond_instance.signal(); } storedDatas_mutex.unlock(); @@ -144,9 +148,11 @@ void GenericPort::put(CorbaInDataType dataPara fflush(stdout); fflush(stderr); try { +#ifdef _DEBUG_ // Affichage des donnees pour DEBUGging cerr << "parametres emis: " << time << ", " << tag << endl; DataManipulator::dump(dataParam); +#endif // L'intérêt des paramètres time et tag pour ce port est décidé dans la politique de couplage // Il est possible de filtrer en prenant en compte uniquement un paramètre time/tag ou les deux @@ -165,9 +171,13 @@ void GenericPort::put(CorbaInDataType dataPara bool expectedDataReceived = false; +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 1 ------------------" << std::endl; +#endif if ( dataIds.empty() ) return; +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 1bis ------------------" << std::endl; +#endif // Recupere les donnees venant de l'ORB et relâche les structures CORBA // qui n'auraient plus cours en sortie de méthode put @@ -176,22 +186,30 @@ void GenericPort::put(CorbaInDataType dataPara int nbOfIter = 0; +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl; std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl; +#endif storedDatas_mutex.lock(); for (;dataIdIt != dataIds.end();++dataIdIt) { +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 3 ------------------" << std::endl; +#endif // Duplique l'instance de donnée pour les autres dataIds if (nbOfIter > 0) data = DataManipulator::clone(data); +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl; +#endif DataId currentDataId=*dataIdIt; +#ifdef _DEBUG_ std::cerr << "processing dataId : "<< currentDataId << std::endl; std::cout << "-------- Put : MARK 4 ------------------" << std::endl; +#endif // Ajoute l'instance de la donnee a sa place dans la table de données // ou remplace une instance précédente si elle existe @@ -201,18 +219,24 @@ void GenericPort::put(CorbaInDataType dataPara // <=> premier emplacement où l'on pourrait insérer notre DataId // <=> en général équivaux à (*wDataIt).first >= currentDataId typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId); +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 5 ------------------" << std::endl; +#endif // On n'a pas trouvé de dataId supérieur au notre ou // on a trouvé une clé > à cet Id if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) { +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 6 ------------------" << std::endl; +#endif // Ajoute la donnee dans la table wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data)); } else { // Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict // entre notre dataId et le DataId pointé c'est qu'ils sont identiques +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 7 ------------------" << std::endl; +#endif // Les données sont remplacées par les nouvelles valeurs // lorsque que le dataId existe déjà DataType old_data = (*wDataIt).second; @@ -221,15 +245,19 @@ void GenericPort::put(CorbaInDataType dataPara DataManipulator::delete_data (old_data); } +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 8 ------------------" << std::endl; +#endif // Compte le nombre de dataIds à traiter ++nbOfIter; +#ifdef _DEBUG_ std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl; std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl; std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl; std::cout << "-------- Put : expectedDataId : " << expectedDataId <<"---" << std::endl; std::cout << "-------- Put : MARK 9 ------------------" << std::endl; +#endif // A simplifier mais : // - pas possible de mettre des arguments optionnels à cause @@ -248,14 +276,18 @@ void GenericPort::put(CorbaInDataType dataPara ( waitingForConvenientDataId && isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) ) ) { +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 10 ------------------" << std::endl; +#endif //Doit pouvoir réveiller le get ici (a vérifier) expectedDataReceived = true; } } if (expectedDataReceived) { +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 11 ------------------" << std::endl; +#endif // si waitingForAnyDataId était positionné, c'est forcément lui qui a activer // expectedDataReceived à true if (waitingForAnyDataId) @@ -271,16 +303,22 @@ void GenericPort::put(CorbaInDataType dataPara // Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un ! // Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue // des lectures simultanées sur le même port ! +#ifdef _DEBUG_ std::cout << "-------- Put : new datas available ------------------" << std::endl; +#endif fflush(stdout);fflush(stderr); cond_instance.signal(); } +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 12 ------------------" << std::endl; +#endif // Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected... storedDatas_mutex.unlock(); +#ifdef _DEBUG_ std::cout << "-------- Put : MARK 13 ------------------" << std::endl; +#endif fflush(stdout); fflush(stderr); @@ -288,7 +326,6 @@ void GenericPort::put(CorbaInDataType dataPara catch ( const SALOME_Exception & ex ) { // On évite de laisser un mutex storedDatas_mutex.unlock(); - std::cerr << ex; THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR); } @@ -318,9 +355,13 @@ GenericPort::get(TimeType time, bool isEqual, isBounded; typedef typename DataManipulator::InnerType InnerType; +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 1 ------------------" << std::endl; +#endif expectedDataId = DataId(time,tag); +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 2 ------------------" << std::endl; +#endif typename DataTable::iterator wDataIt1; @@ -336,18 +377,23 @@ GenericPort::get(TimeType time, // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first // Méthode provenant de la COUPLING_POLICY isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1); +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 3 ------------------" << std::endl; +#endif // L'ordre des différents tests est important if ( isEqual ) { +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 4 ------------------" << std::endl; +#endif // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM. // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent // C'est EraseDataId qui choisi ou non de supprimer la donnée // Du coup interaction potentielle entre le 0 copy et gestion de l'historique dataToTransmit = (*wDataIt1).second; +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 5 ------------------" << std::endl; std::cout << "-------- Get : Données trouvées à t : " << std::endl; typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit); @@ -355,17 +401,22 @@ GenericPort::get(TimeType time, std::copy(InIt1, InIt1 + N, std::ostream_iterator< InnerType > (std::cout," ")); std::cout << std::endl; +#endif // Décide de la suppression de certaines instances de données // La donnée contenu dans la structure CORBA et son dataId sont désallouées // Méthode provenant de la COUPLING_POLICY typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas,wDataIt1); +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 6 ------------------" << std::endl; +#endif break; } +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 7 ------------------" << std::endl; +#endif //if ( isBounded() && COUPLING_POLICY::template needToProcessBoundedDataId() ) { // Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage @@ -379,7 +430,9 @@ GenericPort::get(TimeType time, // l'interpolation. // Les données calciulées sont donc stockées dans storedDatas. // La propriété des données N'EST PAS transférée à l'utilisateur en mode CALCIUM. +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 8 ------------------" << std::endl; +#endif typename COUPLING_POLICY::template BoundedDataIdProcessor processBoundedDataId(*this); //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1); @@ -392,6 +445,7 @@ GenericPort::get(TimeType time, // A déplacer en paramètre de la méthode précédente ? storedDatas[expectedDataId]=dataToTransmit; +#ifdef _DEBUG_ std::cout << "-------- Get : Données calculées à t : " << std::endl; typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit); size_t N = DataManipulator::size(dataToTransmit); @@ -400,6 +454,7 @@ GenericPort::get(TimeType time, std::ostream_iterator< InnerType > (std::cout," ")); std::cout << std::endl; std::cout << "-------- Get : MARK 9 ------------------" << std::endl; +#endif typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas,wDataIt1); @@ -414,17 +469,23 @@ GenericPort::get(TimeType time, // Réception bloquante sur le dataId demandé // Si l'instance de donnée n'est pas trouvee +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 10 ------------------" << std::endl; +#endif //Positionné à faux dans la méthode put waitingForConvenientDataId = true; +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 11 ------------------" << std::endl; // Ici on attend que la méthode put recoive la donnée std::cout << "-------- Get : waiting datas ------------------" << std::endl; +#endif fflush(stdout);fflush(stderr); cond_instance.wait(); +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 12 ------------------" << std::endl; +#endif } } catch (...) { @@ -435,7 +496,9 @@ GenericPort::get(TimeType time, // Deverouille l'acces a la table storedDatas_mutex.unlock(); +#ifdef _DEBUG_ std::cout << "-------- Get : MARK 13 ------------------" << std::endl; +#endif // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent @@ -472,7 +535,9 @@ GenericPort::next(TimeType &t, try { storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<::next(TimeType &t, waitingForAnyDataId = false; break; } +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 2 ------------------" << std::endl; +#endif //Positionné à faux dans la méthode put waitingForAnyDataId = true; +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 3 ------------------" << std::endl; // Ici on attend que la méthode put recoive la donnée std::cout << "-------- Next : waiting datas ------------------" << std::endl; +#endif fflush(stdout);fflush(stderr); cond_instance.wait(); if (lastDataIdSet) { +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 4 ------------------" << std::endl; +#endif wDataIt1 = storedDatas.upper_bound(lastDataId); } else { +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 5 ------------------" << std::endl; +#endif lastDataIdSet = true; wDataIt1 = storedDatas.begin(); } } +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 6 ------------------" << std::endl; +#endif t = getTime( (*wDataIt1).first ); tag = getTag ( (*wDataIt1).first ); dataToTransmit = (*wDataIt1).second; +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 7 ------------------" << std::endl; +#endif lastDataId = (*wDataIt1).first; typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas, wDataIt1); +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 8 ------------------" << std::endl; +#endif } catch (...) { +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 8bis ------------------" << std::endl; +#endif waitingForAnyDataId = false; storedDatas_mutex.unlock(); throw; } storedDatas_mutex.unlock(); +#ifdef _DEBUG_ std::cout << "-------- Next : MARK 9 ------------------" << std::endl; +#endif // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent diff --git a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx index 43357dc2e..f6f0ce912 100644 --- a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx @@ -55,7 +55,6 @@ public : virtual ~GenericUsesPort(); virtual const char * get_repository_id(); - virtual bool set_port(Ports::Port_ptr port); template void put(CorbaInDataType data, TimeType time, TagType tag); @@ -82,24 +81,6 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::get } -template -bool -GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::set_port(Ports::Port_ptr port) { - if (_my_ports) { - size_t n = _my_ports->length()+1; - _my_ports->length(n); - (*_my_ports)[n]=CorbaPortType::_narrow(port); - return true; - } else { - // Vérifier si port is_nil - _my_ports = new Engines::DSC::uses_port(); - _my_ports->length(1); - (*_my_ports)[0]=CorbaPortType::_narrow(port); - return true; - } - return false; -} - template template void @@ -123,11 +104,13 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put CorbaPortTypePtr port = CorbaPortType::_narrow((*_my_ports)[i]); //if (i) { PB1 copyOfData = DataManipulator::clone(data); +#ifdef _DEBUG_ std::cout << "-------- GenericUsesPort::put : Copie de data(" //<< DataManipulator::getPointer(data) <<") vers copyOfData (" <put(*copyOfData,time,tag); // catcher les exceptions @@ -154,7 +137,9 @@ GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort { if (_my_ports) delete _my_ports; +#ifdef _DEBUG_ std::cerr << "GenericUsesPort::uses_port_changed" << endl; +#endif _my_ports = new Engines::DSC::uses_port(*new_uses_port); } diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx index df030c2af..544a9c1eb 100644 --- a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx @@ -30,6 +30,7 @@ #ifndef _PALM_PORT_FACTORY_HXX_ #define _PALM_PORT_FACTORY_HXX_ +#include "port_factory.hxx" #include "uses_port.hxx" #include "provides_port.hxx" #include @@ -39,7 +40,8 @@ using namespace std; -class palm_port_factory +class palm_port_factory : + public port_factory { public: palm_port_factory(); diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am index ec9ce2fbc..42c20a9c3 100644 --- a/src/DSC/DSC_User/Makefile.am +++ b/src/DSC/DSC_User/Makefile.am @@ -23,7 +23,6 @@ # Author : André RIBES (EDF) # Module : KERNEL -SUBDIRS = Basic Datastream include $(top_srcdir)/salome_adm/unix/make_common_starter.am @@ -37,7 +36,8 @@ salomeinclude_HEADERS = base_port.hxx \ uses_port.hxx \ provides_port.hxx \ Superv_Component_i.hxx \ - DSC_Exception.hxx + DSC_Exception.hxx \ + port_factory.hxx # # =============================================================== @@ -93,3 +93,4 @@ test_DSC_Exception_CXXFLAGS = $(COMMON_CPPFLAGS) test_DSC_Exception_LDADD = $(top_builddir)/src/Utils/libOpUtil.la +SUBDIRS = Basic Datastream diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx index 2892ddabf..e94cad7c8 100644 --- a/src/DSC/DSC_User/Superv_Component_i.cxx +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -43,41 +43,67 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, bool notif) : Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) { +#ifdef _DEBUG_ std::cout << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; - _my_basic_factory = new basic_port_factory(); - _my_palm_factory = new palm_port_factory(); - _my_calcium_factory = new calcium_port_factory(); +#endif + register_factory("BASIC", new basic_port_factory()); + register_factory("PALM", new palm_port_factory()); + register_factory("CALCIUM", new calcium_port_factory()); } -Superv_Component_i::~Superv_Component_i() { - delete _my_basic_factory; +Superv_Component_i::~Superv_Component_i() +{ + factory_map_t::iterator begin = _factory_map.begin(); + factory_map_t::iterator end = _factory_map.end(); + for(;begin!=end;begin++) + { + delete begin->second; + } +} + +void +Superv_Component_i::register_factory(const std::string & factory_name, + port_factory * factory_ptr) +{ + factory_map_t::iterator it = _factory_map.find(factory_name); + + if (it == _factory_map.end() ) + { + _factory_map[factory_name] = factory_ptr; + } +} + +port_factory * +Superv_Component_i::get_factory(const std::string & factory_name) +{ + port_factory * rtn_factory = NULL; + factory_map_t::iterator it = _factory_map.find(factory_name); + + if (it != _factory_map.end() ) + { + rtn_factory = _factory_map[factory_name]; + } + + return rtn_factory; } provides_port * -Superv_Component_i::create_provides_data_port(const char* port_fab_type) +Superv_Component_i::create_provides_data_port(const std::string& port_fab_type) throw (BadFabType) { - assert(port_fab_type); - provides_port * rtn_port = NULL; - string the_type(port_fab_type); + std::string factory_name; + std::string type_name; int search_result; - search_result = the_type.find("BASIC_"); - if (search_result == 0) { - rtn_port = _my_basic_factory->create_data_servant(the_type.substr(search_result+6, - the_type.length())); - } - search_result = the_type.find("PALM_"); - if (search_result == 0) { - rtn_port = _my_palm_factory->create_data_servant(the_type.substr(search_result+5, - the_type.length())); - } + search_result = port_fab_type.find("_"); + factory_name = port_fab_type.substr(0,search_result); + type_name = port_fab_type.substr(search_result+1, port_fab_type.length()); - search_result = the_type.find("CALCIUM_"); - if (search_result == 0) { - rtn_port = _my_calcium_factory->create_data_servant(the_type.substr(search_result+8, the_type.length())); + port_factory * factory = get_factory(factory_name); + if (factory) { + rtn_port = factory->create_data_servant(type_name); } if (rtn_port == NULL) @@ -88,25 +114,21 @@ Superv_Component_i::create_provides_data_port(const char* port_fab_type) } uses_port * -Superv_Component_i::create_uses_data_port(const char* port_fab_type) +Superv_Component_i::create_uses_data_port(const std::string& port_fab_type) throw (BadFabType) { - assert(port_fab_type); - uses_port * rtn_proxy = NULL; - string the_type(port_fab_type); + std::string factory_name; + std::string type_name; int search_result; - search_result = the_type.find("BASIC_"); - if (search_result == 0) { - rtn_proxy = _my_basic_factory->create_data_proxy(the_type.substr(search_result+6, - the_type.length())); - } - - search_result = the_type.find("CALCIUM_"); - if (search_result == 0) { - std::cout << "---- Superv_Component_i::create_uses_data_port : MARK 1 ---- " << the_type.substr(search_result+8, the_type.length()) << "----" << std::endl; - rtn_proxy = _my_calcium_factory->create_data_proxy(the_type.substr(search_result+8, the_type.length())); + search_result = port_fab_type.find("_"); + factory_name = port_fab_type.substr(0,search_result); + type_name = port_fab_type.substr(search_result+1, port_fab_type.length()); + + port_factory * factory = get_factory(factory_name); + if (factory) { + rtn_proxy = factory->create_data_proxy(type_name); } if (rtn_proxy == NULL) @@ -132,9 +154,13 @@ Superv_Component_i::add_port(const char * port_fab_type, add_port(port, port_name); } else if (s_port_type == "uses") { +#ifdef _DEBUG_ std::cout << "---- Superv_Component_i::add_port : MARK 1 ---- " << std::endl; +#endif uses_port * port = create_uses_data_port(port_fab_type); +#ifdef _DEBUG_ std::cout << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl; +#endif add_port(port, port_name); } else diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index 1ee77c610..4bac01fc3 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -30,8 +30,9 @@ #include "base_port.hxx" #include "uses_port.hxx" #include "provides_port.hxx" +#include "port_factory.hxx" -// Les différentes fabriques de ports +// default ports factories on the Kernel #include "basic_port_factory.hxx" #include "palm_port_factory.hxx" #include "calcium_port_factory.hxx" @@ -104,7 +105,7 @@ public: {return NULL;} /*! - * This methode permits to create a provides port provided by the platform. + * This method permits to create a provides port provided by the platform. * (See documentation of DSC for knoing these ports). * * @@ -113,12 +114,12 @@ public: * * \note It's user repsonsability to destroy the provides port. */ - virtual provides_port * create_provides_data_port(const char* port_fab_type) + virtual provides_port * create_provides_data_port(const std::string& port_fab_type) throw (BadFabType); /*! - * This methode permits to create a uses port provided by the platform. + * This method permits to create a uses port provided by the platform. * (See documentation of DSC for knoing these ports). * * @@ -127,7 +128,7 @@ public: * * \note It's user repsonsability to destroy the uses port. */ - virtual uses_port * create_uses_data_port(const char* port_fab_type) + virtual uses_port * create_uses_data_port(const std::string& port_fab_type) throw (BadFabType); /*! @@ -234,12 +235,29 @@ public: const Engines::DSC::Message message); -private: + /*! + * Add a factory the component. If the factory_name is already + * used, the new library is not added. + * + * \param factory_name name of the factory (used by Superv_Component_i::create_provides_data_port + * and Superv_Component_i::create_uses_data_port) + * \param factory_ptr factory pointer (destroyed by the component) + */ + virtual void register_factory(const std::string & factory_name, + port_factory * factory_ptr); + + /*! + * Get a factory from the component. + * + * \param factory_name name of the factory. + * \return factory pointer, NULL if the factory doesn't exist. + */ + virtual port_factory * get_factory(const std::string & factory_name); - // Fabrics - basic_port_factory * _my_basic_factory; - palm_port_factory * _my_palm_factory; - calcium_port_factory * _my_calcium_factory; +private: + // Factory map + typedef std::map factory_map_t; + factory_map_t _factory_map; /*-------------------------------------------------*/ // A Superv_Component port. @@ -273,7 +291,9 @@ Superv_Component_i::add_port(const char * port_fab_type, assert(port_name); SpecificPortType * retPort; +#ifdef _DEBUG_ std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl; +#endif std::string s_port_type(port_type); if (s_port_type == "provides") { @@ -287,10 +307,14 @@ Superv_Component_i::add_port(const char * port_fab_type, else if (s_port_type == "uses") { uses_port * port = create_uses_data_port(port_fab_type); add_port(port, port_name); +#ifdef _DEBUG_ std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl; std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl; +#endif retPort = dynamic_cast(port); +#ifdef _DEBUG_ std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl; +#endif if ( retPort == NULL ) { delete port; throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " )); } diff --git a/src/DSC/DSC_User/port_factory.hxx b/src/DSC/DSC_User/port_factory.hxx new file mode 100644 index 000000000..e2920ce6c --- /dev/null +++ b/src/DSC/DSC_User/port_factory.hxx @@ -0,0 +1,61 @@ +// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : port_factory.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _PORT_FACTORY_HXX +#define _PORT_FACTORY_HXX + +#include "base_port.hxx" +#include "uses_port.hxx" +#include "provides_port.hxx" + +#include + +/*! \class port_factory + * \brief This class is an abstract for all the DSC ports factories that have to be + * registered into the component. + */ +class port_factory { + public: + virtual ~port_factory() {} + + /*! + * This method creates a provides port. + * + * \param type port's type. + * \return a pointer of the provides port. + */ + virtual provides_port * create_data_servant(std::string type) = 0; + + /*! + * This method creates a uses port. + * + * \param type port's type. + * \return a pointer of the uses port. + */ + virtual uses_port * create_data_proxy(std::string type) = 0; +}; + +#endif + diff --git a/src/DSC/DSC_User/uses_port.hxx b/src/DSC/DSC_User/uses_port.hxx index 940921989..5c33f094f 100644 --- a/src/DSC/DSC_User/uses_port.hxx +++ b/src/DSC/DSC_User/uses_port.hxx @@ -53,14 +53,6 @@ class uses_port : public base_port */ virtual const char * get_repository_id() = 0; - /*! - * DEPRECATED --- WILL BE REMOVED - * It was used when uses port where not multiple. - * It's an abstract method. - * - */ - virtual bool set_port(Ports::Port_ptr port) = 0; - /*! * This method is the uses port's callback to be aware of * connections states. diff --git a/src/DSC/Makefile.am b/src/DSC/Makefile.am index fb949237f..dc9af3cb8 100644 --- a/src/DSC/Makefile.am +++ b/src/DSC/Makefile.am @@ -27,4 +27,6 @@ if WITH_PACO_PARALLEL SUBDIR_PAR = ParallelDSC endif -SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR) +SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR) DSC_Python + +EXTRA_DIST= DSC.dox diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.cxx b/src/DSC/ParallelDSC/ParallelDSC_i.cxx index eba3c8e55..c4f15adb5 100644 --- a/src/DSC/ParallelDSC/ParallelDSC_i.cxx +++ b/src/DSC/ParallelDSC/ParallelDSC_i.cxx @@ -34,8 +34,9 @@ Engines_ParallelDSC_i::Engines_ParallelDSC_i(CORBA::ORB_ptr orb, char * ior, Engines_Parallel_Component_i(orb, ior, poa, contId, instanceName, interfaceName, notif), Engines::Parallel_DSC_serv(orb, ior), Engines::DSC_serv(orb, ior), -// Engines::Superv_Component_serv(orb, ior), + Engines::Superv_Component_serv(orb, ior), Engines::Component_serv(orb, ior), + Engines::Parallel_Component_serv(orb, ior), InterfaceParallel_impl(orb,ior) { } diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.hxx b/src/DSC/ParallelDSC/ParallelDSC_i.hxx index 0524de5ea..ed900566f 100644 --- a/src/DSC/ParallelDSC/ParallelDSC_i.hxx +++ b/src/DSC/ParallelDSC/ParallelDSC_i.hxx @@ -49,8 +49,6 @@ public: virtual ~Engines_ParallelDSC_i(); - //virtual CORBA::Boolean init_service(const char* service_name) {return true;} - /*! * \see Engines::DSC::add_provides_port */ diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 4d3d58f39..5e1cf18a8 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -26,16 +26,11 @@ #include "HDFOI.hxx" -#include -#include -#include -#include -#include - #include #include #include #include +#include #ifdef WNT #include @@ -44,6 +39,8 @@ using namespace std; +void Move(const string& fName, const string& fNameDst); +bool Exists(const string thePath); bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp); bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp); bool CreateGroupFromASCII(HDFcontainerObject *father, FILE *fp); @@ -52,7 +49,7 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident); void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident); void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident); -char* GetTmpDir(); +string GetTmpDir(); char* makeName(char* name); char* restoreName(char* name); void write_float64(FILE* fp, hdf_float64* value); @@ -104,13 +101,13 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, bool isReplace, const char* theExtension) { - TCollection_AsciiString aPath((char*)thePath); + string aPath(thePath); if(!isReplace) { if(theExtension == NULL) aPath += ".asc"; else aPath += (char*)theExtension; } - TCollection_AsciiString aFileName(aPath); + string aFileName(aPath); if(isReplace) aFileName=aPath+".ascii_tmp"; HDFfile *hdf_file = new HDFfile((char*)thePath); @@ -119,7 +116,7 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, char name[HDF_NAME_MAX_LEN+1]; int nbsons = hdf_file->nInternalObjects(), nbAttr = hdf_file->nAttributes(); - FILE* fp = fopen(aFileName.ToCString(), "w"); + FILE* fp = fopen(aFileName.c_str(), "w"); fprintf(fp, "%s\n", ASCIIHDF_ID); fprintf(fp, "%i\n", nbsons+nbAttr); @@ -131,7 +128,7 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, hdf_attribute = 0; } - for (Standard_Integer i=0; iInternalObjectIndentify(i,name); if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; @@ -156,17 +153,15 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, delete hdf_file; if(isReplace) { - OSD_Path anOSDPath(aFileName); - OSD_File anOSDFile(anOSDPath); - if(anOSDFile.Exists()) - anOSDFile.Move(aPath); + if(Exists(aFileName)) + Move(aFileName, aPath); else return NULL; } - int length = strlen(aPath.ToCString()); + int length = strlen(aPath.c_str()); char *new_str = new char[ 1+length ]; - strcpy(new_str , aPath.ToCString()) ; + strcpy(new_str , aPath.c_str()) ; return new_str; } @@ -180,15 +175,12 @@ void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident) { hdf_group->OpenOnDisk(); - TCollection_AsciiString anIdent(ident, '\t'); int nbsons = hdf_group->nInternalObjects(), nbAttr = hdf_group->nAttributes(); - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID);*/ fprintf(fp, "%s\n", GROUP_ID); char* name = makeName(hdf_group->GetName()); - /*fprintf(fp, "%s%s %i\n", anIdent.ToCString(), name, nbsons+nbAttr);*/ fprintf(fp, "%s %i\n", name, nbsons+nbAttr); delete name; @@ -220,7 +212,6 @@ void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident) } } - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID_END);*/ fprintf(fp, "%s\n", GROUP_ID_END); hdf_group->CloseOnDisk(); @@ -241,32 +232,22 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) hdf_byte_order order = hdf_dataset->GetOrder(); int nbAttr = hdf_dataset->nAttributes(); - TCollection_AsciiString anIdent(ident, '\t'); - TCollection_AsciiString anIdentChild(ident+1, '\t'); - char* name = makeName(hdf_dataset->GetName()); - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID);*/ fprintf(fp, "%s\n", DATASET_ID); - /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, nbAttr);*/ fprintf(fp, "%s %i %i\n", name, type, nbAttr); delete name; hdf_dataset->GetDim(dim); - /*fprintf(fp, "%s %i\n", anIdentChild.ToCString(), ndim);*/ fprintf(fp, " %i\n", ndim); for(int i = 0;i < ndim;i++) { - /*fprintf(fp, "%s%i", anIdentChild.ToCString(), dim[i]);*/ fprintf(fp, " %i", dim[i]); } - /*fprintf(fp, "%s\n", anIdentChild.ToCString());*/ fprintf(fp, "\n"); delete dim; - /*fprintf(fp, "%s%li:", anIdentChild.ToCString(), size);*/ -// fprintf(fp, "%li:", size); fprintf(fp, "%li %i:", size, order); if (type == HDF_STRING) { @@ -324,7 +305,6 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) hdf_attribute = 0; } - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID_END); */ fprintf(fp, "%s\n", DATASET_ID_END); hdf_dataset->CloseOnDisk(); @@ -341,15 +321,10 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) hdf_type type = hdf_attribute->GetType(); - TCollection_AsciiString anIdent(ident, '\t'); - TCollection_AsciiString anIdentChild(ident+1, '\t'); - char* name = makeName(hdf_attribute->GetName()); int size = hdf_attribute->GetSize(); - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID);*/ fprintf(fp, "%s\n", ATTRIBUTE_ID); - /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, size);*/ fprintf(fp, "%s %i %i\n", name, type, size); delete name; @@ -357,7 +332,6 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) if (type == HDF_STRING) { char* val = new char[size+1]; hdf_attribute->ReadFromDisk(val); - /*fprintf(fp, "%s:", anIdentChild.ToCString());*/ fprintf(fp, ":"); fwrite(val, 1, size, fp); fprintf(fp, "\n"); @@ -365,22 +339,18 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) } else if (type == HDF_FLOAT64) { hdf_float64 val; hdf_attribute->ReadFromDisk(&val); - /*fprintf(fp, "%s", anIdentChild.ToCString());*/ write_float64(fp, &val); fprintf(fp, "\n"); } else if(type == HDF_INT64) { hdf_int64 val; hdf_attribute->ReadFromDisk(&val); - /*fprintf(fp, "%s%li \n", anIdentChild.ToCString(), val);*/ fprintf(fp, "%li \n", val); } else if(type == HDF_INT32) { hdf_int32 val; hdf_attribute->ReadFromDisk(&val); - /*fprintf(fp, "%s%i \n", anIdentChild.ToCString(), val);*/ fprintf(fp, "%i \n", val); } - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID_END);*/ fprintf(fp, "%s\n", ATTRIBUTE_ID_END); hdf_attribute->CloseOnDisk(); @@ -397,11 +367,11 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) char* HDFascii::ConvertFromASCIIToHDF(const char* thePath) { // Get a temporary directory to store a file - TCollection_AsciiString aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf"); + string aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf"); // Build a full file name of temporary file - TCollection_AsciiString aFullName = aTmpDir + aFileName; + string aFullName = aTmpDir + aFileName; - HDFfile *hdf_file = new HDFfile(aFullName.ToCString()); + HDFfile *hdf_file = new HDFfile((char*)aFullName.c_str()); hdf_file->CreateOnDisk(); FILE *fp = fopen(thePath, "r"); @@ -450,9 +420,9 @@ char* HDFascii::ConvertFromASCIIToHDF(const char* thePath) hdf_file->CloseOnDisk(); delete hdf_file; - int length = strlen(aTmpDir.ToCString()); + int length = strlen(aTmpDir.c_str()); char *new_str = new char[ 1+length ]; - strcpy(new_str , aTmpDir.ToCString()) ; + strcpy(new_str , aTmpDir.c_str()) ; return new_str; } @@ -673,87 +643,92 @@ bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp) // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" //============================================================================ -char* GetTmpDir() +string GetTmpDir() { - //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; + //Find a temporary directory to store a file -#ifdef WNT - char *aTmp; - aTmp = getenv("TMP"); - if(aTmp != NULL) - aTmpDir = TCollection_AsciiString(aTmp); - else - aTmpDir = TCollection_AsciiString("C:\\"); + string aTmpDir; + + char *Tmp_dir = getenv("SALOME_TMP_DIR"); + if(Tmp_dir != NULL) { + aTmpDir = string(Tmp_dir); +#ifdef WIN32 + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - aTmpDir = TCollection_AsciiString("/tmp/"); + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; +#endif + } + else { +#ifdef WIN32 + aTmpDir = string("C:\\"); +#else + aTmpDir = string("/tmp/"); #endif + } srand((unsigned int)time(NULL)); - int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - TCollection_AsciiString aSubDir(aRND); - if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif - OSD_Path aPath(aTmpDir); - OSD_Directory aDir(aPath); - - for(aRND = 0; aDir.Exists(); aRND++) { - aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aPath = OSD_Path(aTmpDir); - aDir = OSD_Directory(aPath); + string aDir = aTmpDir; + + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name } - OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); - aDir.Build(aProtection); - - int length = strlen(aTmpDir.ToCString()); - char *new_str = new char[ 1+length ]; - strcpy(new_str , aTmpDir.ToCString()); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return new_str; + return aDir; } char* makeName(char* name) { - TCollection_AsciiString aName(name), aNewName; - Standard_Integer i, length = aName.Length(); + string aName(name), aNewName; + int i, length = aName.size(); char replace = (char)19; - for(i=1; i<=length; i++) { - if(aName.Value(i) == ' ') aNewName+=replace; - else aNewName += aName.Value(i); + for(i=0; i +#include "HDFexport.hxx" -class Standard_EXPORT HDFascii +class HDF_EXPORT HDFascii { public: diff --git a/src/HDFPersist/HDFcontainerObject.cc b/src/HDFPersist/HDFcontainerObject.cc index 70ecf2e13..6f8d1c353 100644 --- a/src/HDFPersist/HDFcontainerObject.cc +++ b/src/HDFPersist/HDFcontainerObject.cc @@ -30,10 +30,10 @@ extern "C" } #include "HDFcontainerObject.hxx" #include "HDFexception.hxx" -#include "utilities.h" +//#include "utilities.h" using namespace std; -HDFcontainerObject::HDFcontainerObject(char *name) +HDFcontainerObject::HDFcontainerObject(const char *name) : HDFinternalObject(name) { _nsons = 0; diff --git a/src/HDFPersist/HDFcontainerObject.hxx b/src/HDFPersist/HDFcontainerObject.hxx index fef43ed21..dfc237b26 100644 --- a/src/HDFPersist/HDFcontainerObject.hxx +++ b/src/HDFPersist/HDFcontainerObject.hxx @@ -33,16 +33,16 @@ extern "C" } #include "HDFobject.hxx" #include "HDFinternalObject.hxx" -#include +#include "HDFexport.hxx" -class Standard_EXPORT HDFcontainerObject : public HDFinternalObject +class HDF_EXPORT HDFcontainerObject : public HDFinternalObject { private : HDFinternalObject *_firstson; HDFinternalObject *_lastson; int _nsons; public : - HDFcontainerObject(char *name); + HDFcontainerObject(const char *name); virtual ~HDFcontainerObject(); virtual int nInternalObjects(); diff --git a/src/HDFPersist/HDFdataset.cc b/src/HDFPersist/HDFdataset.cc index de5d07afa..4a0b7b160 100644 --- a/src/HDFPersist/HDFdataset.cc +++ b/src/HDFPersist/HDFdataset.cc @@ -43,7 +43,7 @@ herr_t dataset_attr(hid_t loc_id, const char *attr_name, void *operator_data) return 1; } -HDFdataset::HDFdataset(char *name, HDFcontainerObject *father,hdf_type type, +HDFdataset::HDFdataset(const char *name, HDFcontainerObject *father,hdf_type type, hdf_size dim[], int dimsize, hdf_byte_order order) : HDFinternalObject(name) { @@ -66,7 +66,7 @@ HDFdataset::HDFdataset(char *name, HDFcontainerObject *father,hdf_type type, } -HDFdataset::HDFdataset(char *name,HDFcontainerObject *father) +HDFdataset::HDFdataset(const char *name,HDFcontainerObject *father) : HDFinternalObject(name) { _father = father; diff --git a/src/HDFPersist/HDFdataset.hxx b/src/HDFPersist/HDFdataset.hxx index 3eff4f0df..1e2a62401 100644 --- a/src/HDFPersist/HDFdataset.hxx +++ b/src/HDFPersist/HDFdataset.hxx @@ -33,9 +33,9 @@ extern "C" } #include "HDFinternalObject.hxx" #include "HDFcontainerObject.hxx" -#include +#include "HDFexport.hxx" -class Standard_EXPORT HDFdataset : public HDFinternalObject +class HDF_EXPORT HDFdataset : public HDFinternalObject { private : HDFcontainerObject *_father; @@ -48,10 +48,10 @@ private : char* _attribute; public: - HDFdataset(char *name, HDFcontainerObject *father,hdf_type type, + HDFdataset(const char *name, HDFcontainerObject *father,hdf_type type, hdf_size dim[],int dimsize, hdf_byte_order order = H5T_ORDER_NONE); - HDFdataset(char *name,HDFcontainerObject *father); + HDFdataset(const char *name,HDFcontainerObject *father); virtual ~HDFdataset(); void CreateOnDisk(); diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx b/src/HDFPersist/HDFexport.hxx similarity index 57% rename from src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx rename to src/HDFPersist/HDFexport.hxx index 739fc44e4..21b64d34e 100644 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx +++ b/src/HDFPersist/HDFexport.hxx @@ -1,6 +1,4 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or @@ -17,24 +15,25 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // -// File : SALOMEDS_TextColorAttribute.jxx -// Author : Yves FRICAUD +// File : HDFexport.hxx +// Author : Andre Ribes - EDF R&D // Module : SALOME -// $Header$ -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include +#ifndef _HDF_export_HXX_ +#define _HDF_export_HXX_ + +#ifdef WNT + #if defined WIN32 + #define HDF_EXPORT __declspec( dllimport ) + #else + #define HDF_EXPORT + #endif +#else + #define HDF_EXPORT #endif -#ifndef _SALOMEDS_TextColorAttribute_HeaderFile -#include "SALOMEDS_TextColorAttribute.hxx" + #endif diff --git a/src/HDFPersist/HDFfile.hxx b/src/HDFPersist/HDFfile.hxx index 431dc001e..51c9aa7f1 100644 --- a/src/HDFPersist/HDFfile.hxx +++ b/src/HDFPersist/HDFfile.hxx @@ -32,9 +32,9 @@ extern "C" #include "HDFtypes.h" } #include "HDFcontainerObject.hxx" -#include +#include "HDFexport.hxx" -class Standard_EXPORT HDFfile : public HDFcontainerObject +class HDF_EXPORT HDFfile : public HDFcontainerObject { private : hdf_access_mode _access_mode; diff --git a/src/HDFPersist/HDFgroup.cc b/src/HDFPersist/HDFgroup.cc index 467525320..2b0f2fb19 100644 --- a/src/HDFPersist/HDFgroup.cc +++ b/src/HDFPersist/HDFgroup.cc @@ -40,7 +40,7 @@ herr_t group_attr(hid_t loc_id, const char *attr_name, void *operator_data) return 1; } -HDFgroup::HDFgroup(char *name, HDFcontainerObject *father) +HDFgroup::HDFgroup(const char *name, HDFcontainerObject *father) : HDFcontainerObject(name) { _father = father; diff --git a/src/HDFPersist/HDFgroup.hxx b/src/HDFPersist/HDFgroup.hxx index 2641650e1..8c0d02b88 100644 --- a/src/HDFPersist/HDFgroup.hxx +++ b/src/HDFPersist/HDFgroup.hxx @@ -32,9 +32,9 @@ extern "C" #include "HDFtypes.h" } #include "HDFcontainerObject.hxx" -#include +#include "HDFexport.hxx" -class Standard_EXPORT HDFgroup : public HDFcontainerObject +class HDF_EXPORT HDFgroup : public HDFcontainerObject { private : HDFcontainerObject *_father; @@ -42,7 +42,7 @@ private : hdf_idt _mid; char* _attribute; public : - HDFgroup(char *name, HDFcontainerObject *father); + HDFgroup(const char *name, HDFcontainerObject *father); void CreateOnDisk(); void OpenOnDisk(); diff --git a/src/HDFPersist/HDFinternalObject.cc b/src/HDFPersist/HDFinternalObject.cc index a3cdc1f7f..716e6da49 100644 --- a/src/HDFPersist/HDFinternalObject.cc +++ b/src/HDFPersist/HDFinternalObject.cc @@ -33,7 +33,7 @@ extern "C" using namespace std; #endif -HDFinternalObject::HDFinternalObject(char *name) +HDFinternalObject::HDFinternalObject(const char *name) : HDFobject(name) { _previousbrother = NULL; diff --git a/src/HDFPersist/HDFinternalObject.hxx b/src/HDFPersist/HDFinternalObject.hxx index fa05249de..ee4c32e51 100644 --- a/src/HDFPersist/HDFinternalObject.hxx +++ b/src/HDFPersist/HDFinternalObject.hxx @@ -32,15 +32,15 @@ extern "C" #include "HDFtypes.h" } #include "HDFobject.hxx" -#include +#include "HDFexport.hxx" -class Standard_EXPORT HDFinternalObject : public HDFobject +class HDF_EXPORT HDFinternalObject : public HDFobject { private : HDFinternalObject *_previousbrother; HDFinternalObject *_nextbrother; public : - HDFinternalObject(char *name); + HDFinternalObject(const char *name); HDFinternalObject *GetPreviousBrother(); HDFinternalObject *GetNextBrother(); diff --git a/src/HDFPersist/HDFobject.cc b/src/HDFPersist/HDFobject.cc index 42bb19b0b..5adb8aafe 100644 --- a/src/HDFPersist/HDFobject.cc +++ b/src/HDFPersist/HDFobject.cc @@ -30,10 +30,10 @@ extern "C" #include "hdfi.h" #include } -#include "utilities.h" +//#include "utilities.h" using namespace std; -HDFobject::HDFobject(char *name) +HDFobject::HDFobject(const char *name) { // MESSAGE("-------- constructor " << name << " " << this); HDFerrorModeLock(); diff --git a/src/HDFPersist/HDFobject.hxx b/src/HDFPersist/HDFobject.hxx index a011003c1..3c829822a 100644 --- a/src/HDFPersist/HDFobject.hxx +++ b/src/HDFPersist/HDFobject.hxx @@ -31,14 +31,14 @@ extern "C" { #include "HDFtypes.h" } -#include +#include -class Standard_EXPORT HDFobject { +class HDF_EXPORT HDFobject { protected : char *_name; hdf_idt _id; public : - HDFobject(char *name); + HDFobject(const char *name); virtual ~HDFobject(); hdf_idt GetId(); diff --git a/src/HDFPersist/Makefile.am b/src/HDFPersist/Makefile.am index 92cb42c97..bb4f64d76 100644 --- a/src/HDFPersist/Makefile.am +++ b/src/HDFPersist/Makefile.am @@ -42,7 +42,8 @@ salomeinclude_HEADERS = \ HDFtypes.h \ HDFconvert.hxx \ hdfi.h \ - HDFascii.hxx + HDFascii.hxx \ + HDFexport.hxx # Libraries targets lib_LTLIBRARIES = libSalomeHDFPersist.la @@ -88,11 +89,12 @@ libSalomeHDFPersist_la_SOURCES =\ HDFascii.cc libSalomeHDFPersist_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeHDFPersist_la_CPPFLAGS = @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -DPCLINUX \ + +libSalomeHDFPersist_la_CPPFLAGS = @HDF5_INCLUDES@ -DPCLINUX \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Basics -libSalomeHDFPersist_la_LIBADD = @CAS_KERNEL@ @HDF5_LIBS@ +libSalomeHDFPersist_la_LIBADD = @HDF5_LIBS@ EXTRA_DIST = \ test1.c \ diff --git a/src/KERNEL_PY/Help.py b/src/KERNEL_PY/Help.py index fcc1e84b2..c8ddfe0e0 100755 --- a/src/KERNEL_PY/Help.py +++ b/src/KERNEL_PY/Help.py @@ -37,7 +37,7 @@ MODULE : salome module salome gives access to Salome ressources: variables: - salome:orb : CORBA + salome.orb : CORBA salome.naming_service : instance of naming Service class methods: Resolve(name) : find a CORBA object (ior) by its pathname @@ -130,12 +130,12 @@ A new python example avoids references to LifeCycleCORBA -help = SalomeDoc(''' +Help = SalomeDoc(''' Availables modules: salome : gives access to Salome ressources geompy : encapsulation of GEOM Engine methods supervision : gives access to SuperVision Engine -To obtain specific help on a module "truc", type: help.truc() +To obtain specific help on a module "truc", type: Help.truc() To run an example, type: import example3 ''') diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index 4de4212a2..c25b1dd80 100755 --- a/src/KERNEL_PY/batchmode_salome.py +++ b/src/KERNEL_PY/batchmode_salome.py @@ -5,7 +5,7 @@ # File : batchmode_salome.py # Module : SALOME -import salome_shared_modules +#import salome_shared_modules from omniORB import CORBA from LifeCycleCORBA import * diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py index 956a767bd..7b44adbd6 100755 --- a/src/KERNEL_PY/salome.py +++ b/src/KERNEL_PY/salome.py @@ -23,11 +23,57 @@ # Author : Paul RASCLE, EDF # Module : SALOME # $Header$ +""" +Module salome gives access to Salome ressources. + +variables: + + salome.orb : CORBA + salome.naming_service : instance of naming Service class + methods: + Resolve(name) : find a CORBA object (ior) by its pathname + Register(name) : register a CORBA object under a pathname + salome.lcc : instance of lifeCycleCORBA class + methods: + FindOrLoadComponent(server,name) : + obtain an Engine (CORBA object) + or launch the Engine if not found, + with a Server name and an Engine name + salome.sg + methods: + updateObjBrowser(bool): + getActiveStudyId(): + getActiveStudyName(): + + SelectedCount(): returns number of selected objects + getSelected(i): returns entry of selected object number i + getAllSelected(): returns list of entry of selected objects + AddIObject(Entry): select an existing Interactive object + RemoveIObject(Entry): remove object from selection + ClearIObjects(): clear selection + + Display(*Entry): + DisplayOnly(Entry): + Erase(Entry): + DisplayAll(): + EraseAll(): + + IDToObject(Entry): returns CORBA reference from entry + + salome.myStudyName : active Study Name + salome.myStudyId : active Study Id + salome.myStudy : the active Study itself (CORBA ior) + methods : defined in SALOMEDS.idl + +""" from salome_kernel import * from salome_study import * from salome_iapp import * +orb, lcc, naming_service, cm,sg=None,None,None,None,None +myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None + salome_initial=1 def salome_init(theStudyId=0,embedded=0): """ @@ -77,3 +123,6 @@ def salome_init(theStudyId=0,embedded=0): ============================================ """ raise + +#to expose all objects to pydoc +__all__=dir() diff --git a/src/KERNEL_PY/salome_iapp.py b/src/KERNEL_PY/salome_iapp.py index 8265ab631..4cd5d7cee 100644 --- a/src/KERNEL_PY/salome_iapp.py +++ b/src/KERNEL_PY/salome_iapp.py @@ -62,7 +62,7 @@ def hasDesktop(): salome_iapp_initial = 1 -class SalomeOutsideGUI: +class SalomeOutsideGUI(object): """ Provides a replacement for class SalomeGUI outside GUI process. Do almost nothing diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index 468c93258..22b460dd6 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -61,6 +61,9 @@ def DumpComponent(Study, SO, offset): #-------------------------------------------------------------------------- def DumpStudy(Study): + """ + Dump a study, given the ior + """ itcomp = Study.NewComponentIterator() while itcomp.More(): SC = itcomp.Value() diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am new file mode 100644 index 000000000..9c441ebc1 --- /dev/null +++ b/src/Launcher/Makefile.am @@ -0,0 +1,129 @@ +# SALOME Container : implementation of container and engine for Kernel +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# +# File : Makefile.am +# Author : Guillaume Boulant (CSSI) +# Module : KERNEL +# $Header$ + + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = \ + SALOME_Launcher.hxx + +# Scripts to be installed +dist_salomescript_DATA = + +# These files are executable scripts +dist_salomescript_SCRIPTS= + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS=\ + @PYTHON_INCLUDES@ \ + @MPI_INCLUDES@ \ + @LIBXML_INCLUDES@ \ + -I$(srcdir)/../Batch \ + -I$(srcdir)/../Basics \ + -I$(srcdir)/../SALOMELocalTrace \ + -I$(srcdir)/../NamingService \ + -I$(srcdir)/../Utils \ + -I$(srcdir)/../Registry \ + -I$(srcdir)/../Notification \ + -I$(srcdir)/../ResourcesManager \ + -I$(srcdir)/../Container \ + -I$(top_builddir)/salome_adm/unix \ + -I$(top_builddir)/idl \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS =\ + ../Registry/libRegistry.la \ + ../Notification/libSalomeNotification.la \ + ../Container/libSalomeContainer.la \ + ../ResourcesManager/libSalomeResourcesManager.la \ + ../NamingService/libSalomeNS.la \ + ../Utils/libOpUtil.la \ + ../SALOMELocalTrace/libSALOMELocalTrace.la \ + ../Basics/libSALOMEBasics.la \ + ../Batch/libSalomeBatch.la \ + $(top_builddir)/idl/libSalomeIDLKernel.la\ + @MPI_LIBS@ \ + @CORBA_LIBS@ + @LIBXML_LIBS@ + +# @PYTHON_LIBS@ + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeLauncher.la +libSalomeLauncher_la_SOURCES=\ + SALOME_Launcher.cxx + +libSalomeLauncher_la_CPPFLAGS =\ + $(COMMON_CPPFLAGS) + +libSalomeLauncher_la_LDFLAGS =\ + -no-undefined -version-info=0:0:0 \ + @LDEXPDYNFLAGS@ + +libSalomeLauncher_la_LIBADD =\ + $(PYTHON_LIBS) \ + $(COMMON_LIBS) + + +# +# =============================================================== +# Executables targets +# =============================================================== +# +bin_PROGRAMS = SALOME_LauncherServer + +SALOME_LauncherServer_SOURCES =\ + SALOME_LauncherServer.cxx + +SALOME_LauncherServer_CPPFLAGS=\ + $(COMMON_CPPFLAGS) + +SALOME_LauncherServer_LDADD =\ + libSalomeLauncher.la \ + $(COMMON_LIBS) \ + ../Basics/libSALOMEBasics.la \ + ../Batch/libSalomeBatch.la + + diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx new file mode 100644 index 000000000..3b73b7c02 --- /dev/null +++ b/src/Launcher/SALOME_Launcher.cxx @@ -0,0 +1,275 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "BatchLight_BatchManager_PBS.hxx" +#include "BatchLight_BatchManager_SLURM.hxx" +#include "BatchLight_Job.hxx" +#include "SALOME_Launcher.hxx" +#include "OpUtil.hxx" +#include +#ifndef WNT +#include +#endif +#include +#include "Utils_CorbaException.hxx" +#include "Batch_Date.hxx" + +#define TIME_OUT_TO_LAUNCH_CONT 21 + +using namespace std; + +const char *SALOME_Launcher::_LauncherNameInNS = "/SalomeLauncher"; + +//============================================================================= +/*! + * Constructor + * \param orb + * Define a CORBA single thread policy for the server, which avoid to deal + * with non thread-safe usage like Change_Directory in SALOME naming service + */ +//============================================================================= + +SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa) +{ + MESSAGE("constructor"); + _NS = new SALOME_NamingService(orb); + _ResManager = new SALOME_ResourcesManager(orb,poa,_NS); + _ContManager = new SALOME_ContainerManager(orb,poa,_ResManager,_NS); + _ResManager->_remove_ref(); + _ContManager->_remove_ref(); + + _orb = CORBA::ORB::_duplicate(orb) ; + _poa = PortableServer::POA::_duplicate(poa) ; + PortableServer::ObjectId_var id = _poa->activate_object(this); + CORBA::Object_var obj = _poa->id_to_reference(id); + Engines::SalomeLauncher_var refContMan = Engines::SalomeLauncher::_narrow(obj); + + _NS->Register(refContMan,_LauncherNameInNS); + MESSAGE("constructor end"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +SALOME_Launcher::~SALOME_Launcher() +{ + MESSAGE("destructor"); + delete _NS; + std::map < string, BatchLight::BatchManager * >::const_iterator it; + for(it=_batchmap.begin();it!=_batchmap.end();it++) + delete it->second; +} + +//============================================================================= +/*! CORBA method: + * shutdown all the containers, then the ContainerManager servant + */ +//============================================================================= + +void SALOME_Launcher::Shutdown() +{ + MESSAGE("Shutdown"); + _NS->Destroy_Name(_LauncherNameInNS); + _ContManager->Shutdown(); + _ResManager->Shutdown(); + PortableServer::ObjectId_var oid = _poa->servant_to_id(this); + _poa->deactivate_object(oid); + //_remove_ref(); + if(!CORBA::is_nil(_orb)) + _orb->shutdown(0); +} + +//============================================================================= +/*! CORBA Method: + * Returns the PID of the process + */ +//============================================================================= +CORBA::Long SALOME_Launcher::getPID() +{ + return (CORBA::Long)getpid(); +} + +//============================================================================= +/*! CORBA Method: + * Submit a batch job on a cluster and returns the JobId + * \param fileToExecute : .py/.exe/.sh/... to execute on the batch cluster + * \param filesToExport : to export on the batch cluster + * \param NumberOfProcessors : Number of processors needed on the batch cluster + * \param params : Constraints for the choice of the batch cluster + */ +//============================================================================= +CORBA::Long SALOME_Launcher::submitSalomeJob( const char * fileToExecute , + const Engines::FilesList& filesToExport , + const Engines::FilesList& filesToImport , + const CORBA::Long NumberOfProcessors , + const Engines::MachineParameters& params) +{ + MESSAGE("BEGIN OF SALOME_Launcher::submitSalomeJob"); + CORBA::Long jobId; + try{ + // find a cluster matching the structure params + Engines::CompoList aCompoList ; + Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + + // search batch manager for that cluster in map or instanciate one + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + SCRUTE(clustername); + if(it == _batchmap.end()) + _batchmap[clustername] = FactoryBatchManager( p ); + + // submit job on cluster + BatchLight::Job* job = new BatchLight::Job( fileToExecute, filesToExport, filesToImport, NumberOfProcessors ); + jobId = _batchmap[clustername]->submitJob(job); + } + catch(const SALOME_Exception &ex){ + MESSAGE(ex.what()); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR); + } + return jobId; +} + +//============================================================================= +/*! CORBA Method: + * Query a batch job on a cluster and returns the status of job + * \param jobId : identification of Salome job + * \param params : Constraints for the choice of the batch cluster + */ +//============================================================================= +char* SALOME_Launcher::querySalomeJob( const CORBA::Long jobId, + const Engines::MachineParameters& params) +{ + string status; + try{ + // find a cluster matching params structure + Engines::CompoList aCompoList ; + Engines::MachineList * aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + + // search batch manager for that cluster in map + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + if(it == _batchmap.end()) + throw SALOME_Exception("no batchmanager for that cluster"); + + status = _batchmap[clustername]->queryJob(jobId); + } + catch(const SALOME_Exception &ex){ + INFOS("Caught exception."); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM); + } + return CORBA::string_dup(status.c_str()); +} + +//============================================================================= +/*! CORBA Method: + * Delete a batch job on a cluster + * \param jobId : identification of Salome job + * \param params : Constraints for the choice of the batch cluster + */ +//============================================================================= +void SALOME_Launcher::deleteSalomeJob( const CORBA::Long jobId, + const Engines::MachineParameters& params) +{ + try{ + // find a cluster matching params structure + Engines::CompoList aCompoList ; + Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + + // search batch manager for that cluster in map + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + if(it == _batchmap.end()) + throw SALOME_Exception("no batchmanager for that cluster"); + + _batchmap[clustername]->deleteJob(jobId); + } + catch(const SALOME_Exception &ex){ + INFOS("Caught exception."); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM); + } +} + +//============================================================================= +/*! CORBA Method: + * Get result files of job on a cluster + * \param jobId : identification of Salome job + * \param params : Constraints for the choice of the batch cluster + */ +//============================================================================= +void SALOME_Launcher::getResultSalomeJob( const char *directory, + const CORBA::Long jobId, + const Engines::MachineParameters& params) +{ + try{ + // find a cluster matching params structure + Engines::CompoList aCompoList ; + Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + + // search batch manager for that cluster in map + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + if(it == _batchmap.end()) + throw SALOME_Exception("no batchmanager for that cluster"); + + _batchmap[clustername]->importOutputFiles( directory, jobId ); + } + catch(const SALOME_Exception &ex){ + INFOS("Caught exception."); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM); + } +} + +//============================================================================= +/*! + * Factory to instanciate the good batch manager for choosen cluster. + */ +//============================================================================= + +BatchLight::BatchManager *SALOME_Launcher::FactoryBatchManager( const Engines::MachineParameters* params ) throw(SALOME_Exception) +{ + // Fill structure for batch manager + BatchLight::batchParams p; + p.hostname = params->alias; + p.protocol = params->protocol; + p.username = params->username; + p.applipath = params->applipath; + for(int i=0;imodList.length();i++) + p.modulesList.push_back((const char*)params->modList[i]); + p.nbnodes = params->nb_node; + p.nbprocpernode = params->nb_proc_per_node; + p.mpiImpl = params->mpiImpl; + + string sb = (const char*)params->batch; + if(sb == "pbs") + return new BatchLight::BatchManager_PBS(p); + else if(sb == "slurm") + return new BatchLight::BatchManager_SLURM(p); + else{ + MESSAGE("BATCH = " << params->batch); + throw SALOME_Exception("no batchmanager for that cluster"); + } +} + diff --git a/src/Launcher/SALOME_Launcher.hxx b/src/Launcher/SALOME_Launcher.hxx new file mode 100644 index 000000000..08570fe72 --- /dev/null +++ b/src/Launcher/SALOME_Launcher.hxx @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __SALOME_LAUNCHER_HXX__ +#define __SALOME_LAUNCHER_HXX__ + +#include +#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) +#include "SALOME_ContainerManager.hxx" +#include "BatchLight_BatchManager.hxx" + +#include + +class SALOME_NamingService; + +#if defined LAUNCHER_EXPORTS +#if defined WIN32 +#define LAUNCHER_EXPORT __declspec( dllexport ) +#else +#define LAUNCHER_EXPORT +#endif +#else +#if defined WNT +#define LAUNCHER_EXPORT __declspec( dllimport ) +#else +#define LAUNCHER_EXPORT +#endif +#endif + +class LAUNCHER_EXPORT SALOME_Launcher: + public POA_Engines::SalomeLauncher, + public PortableServer::RefCountServantBase +{ + +public: + SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa); + ~SALOME_Launcher(); + + CORBA::Long submitSalomeJob(const char * fileToExecute , + const Engines::FilesList& filesToExport , + const Engines::FilesList& filesToImport , + const CORBA::Long NumberOfProcessors , + const Engines::MachineParameters& params); + + char* querySalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params); + void deleteSalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params); + void getResultSalomeJob( const char * directory, const CORBA::Long jobId, const Engines::MachineParameters& params ); + + void Shutdown(); + + CORBA::Long getPID(); + + static const char *_LauncherNameInNS; + +protected: + BatchLight::BatchManager *FactoryBatchManager( const Engines::MachineParameters* params ) throw(SALOME_Exception); + + std::map _batchmap; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; + SALOME_ContainerManager *_ContManager; + SALOME_ResourcesManager *_ResManager; + SALOME_NamingService *_NS; +}; + +#endif diff --git a/src/Container/SALOME_ContainerManagerServer.cxx b/src/Launcher/SALOME_LauncherServer.cxx similarity index 58% rename from src/Container/SALOME_ContainerManagerServer.cxx rename to src/Launcher/SALOME_LauncherServer.cxx index d4a4399aa..5913d0ffb 100644 --- a/src/Container/SALOME_ContainerManagerServer.cxx +++ b/src/Launcher/SALOME_LauncherServer.cxx @@ -17,33 +17,78 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "SALOME_ContainerManager.hxx" +#include "SALOME_Launcher.hxx" #include "utilities.h" +#include +#include +#include +#include + +using namespace std; + +void AttachDebugger() +{ + if(getenv ("DEBUGGER")) + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } +} + +void terminateHandler(void) +{ + std::cerr << "Terminate: not managed exception !" << std::endl; + AttachDebugger(); +} + +void unexpectedHandler(void) +{ + std::cerr << "Unexpected: unexpected exception !" << std::endl; + AttachDebugger(); +} + int main(int argc, char* argv[]) { + if(getenv ("DEBUGGER")) + { +// setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + /* Init libxml + * To avoid memory leak, need to call xmlInitParser in the main thread + * and not call xmlCleanupParser later (cause implicit reinitialization in thread) + */ + xmlInitParser(); + PortableServer::POA_var root_poa; PortableServer::POAManager_var pman; CORBA::Object_var obj; - CORBA::ORB_ptr orb = CORBA::ORB_init( argc , argv ) ; + CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ; // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; BEGIN_OF(argv[0]); try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - root_poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(root_poa)) - pman = root_poa->the_POAManager(); - } + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + root_poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(root_poa)) + pman = root_poa->the_POAManager(); + } catch(CORBA::COMM_FAILURE&){ MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); } try{ - SALOME_ContainerManager *cmServ=new SALOME_ContainerManager(orb); + SALOME_Launcher *lServ=new SALOME_Launcher(orb,root_poa); pman->activate(); + lServ->_remove_ref(); orb->run(); + orb->destroy(); }catch(CORBA::SystemException&){ MESSAGE("Caught CORBA::SystemException."); }catch(PortableServer::POA::WrongPolicy&){ diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index 53f89d73d..df3eabdc7 100644 --- a/src/LifeCycleCORBA/Makefile.am +++ b/src/LifeCycleCORBA/Makefile.am @@ -55,10 +55,11 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMETraceCollector \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ + -I$(srcdir)/../Container \ -I$(srcdir)/../ResourcesManager \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -82,7 +83,7 @@ libSalomeLifeCycleCORBA_la_SOURCES = \ libSalomeLifeCycleCORBA_la_CPPFLAGS = \ $(COMMON_CPPFLAGS) \ @PYTHON_INCLUDES@ \ - @QT_INCLUDES@ \ + -I$(srcdir)/../Batch \ -I$(srcdir)/../Container \ -I$(srcdir)/../Notification @@ -97,7 +98,7 @@ libSalomeLifeCycleCORBA_la_LIBADD = $(COMMON_LIBS) # Executables targets # =============================================================== # -bin_PROGRAMS = Test_LifeCycleCORBA +bin_PROGRAMS = Test_LifeCycleCORBA TestContainerManager Test_LifeCycleCORBA_SOURCES = Test_LifeCycleCORBA.cxx Test_LifeCycleCORBA_CPPFLAGS =\ -I$(srcdir)/../Registry \ @@ -112,8 +113,18 @@ Test_LifeCycleCORBA_LDADD = \ $(COMMON_LIBS) \ @CORBA_LIBS@ -#CPPFLAGS += $(PYTHON_INCLUDES) $(QT_INCLUDES) +TestContainerManager_SOURCES = TestContainerManager.cxx +TestContainerManager_CPPFLAGS =\ + -I$(srcdir)/../Batch \ + -I$(srcdir)/../Registry \ + -I$(srcdir)/../Notification \ + $(COMMON_CPPFLAGS) + +TestContainerManager_LDADD = \ + libSalomeLifeCycleCORBA.la \ + ../Registry/libRegistry.la \ + ../Notification/libSalomeNotification.la \ + ../Container/libSalomeContainer.la \ + $(COMMON_LIBS) \ + @CORBA_LIBS@ -#LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager -#LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMEBasics -#LIBS += $(PYTHON_LIBS) diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx index ef4ff83dc..bb72d3f20 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -116,14 +116,16 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile) SALOME_LifeCycleCORBA LCC; Engines::ContainerManager_var contManager = LCC.getContainerManager(); + Engines::ResourcesManager_var resManager = LCC.getResourcesManager(); Engines::MachineParameters params; LCC.preSet(params); params.container_name = _containerName.c_str(); params.hostname = _refMachine.c_str(); + Engines::CompoList clist; Engines::MachineList_var listOfMachines = - contManager->GetFittingResources(params, ""); + resManager->GetFittingResources(params, clist); container = contManager->FindOrStartContainer(params, listOfMachines); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 10047091c..a18a09c8e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -94,6 +94,10 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS); ASSERT( !CORBA::is_nil(obj)); _ContManager=Engines::ContainerManager::_narrow(obj); + + obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS); + ASSERT( !CORBA::is_nil(obj)); + _ResManager=Engines::ResourcesManager::_narrow(obj); } //============================================================================= @@ -124,8 +128,11 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + Engines::CompoList clist; + clist.length(1); + clist[0] = componentName; Engines::MachineList_var listOfMachines = - _ContManager->GetFittingResources(params, componentName); + _ResManager->GetFittingResources(params, clist); Engines::Component_var compo = _FindComponent(params, componentName, @@ -155,8 +162,11 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + Engines::CompoList clist; + clist.length(1); + clist[0] = componentName; Engines::MachineList_var listOfMachines = - _ContManager->GetFittingResources(params, componentName); + _ResManager->GetFittingResources(params, clist); Engines::Component_var compo = _LoadComponent(params, componentName, @@ -188,8 +198,11 @@ FindOrLoad_Component(const Engines::MachineParameters& params, if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + Engines::CompoList clist; + clist.length(1); + clist[0] = componentName; Engines::MachineList_var listOfMachines = - _ContManager->GetFittingResources(params,componentName); + _ResManager->GetFittingResources(params,clist); Engines::Component_var compo = _FindComponent(params, componentName, @@ -221,6 +234,23 @@ Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, const char *componentName) { + char *valenv=getenv("SALOME_BATCH"); + if(valenv) + if (strcmp(valenv,"1")==0) + { + MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component BATCH " << containerName << " " << componentName ) ; + _NS->Change_Directory("/Containers"); + CORBA::Object_ptr obj=_NS->Resolve(containerName); + Engines::Container_var cont=Engines::Container::_narrow(obj); + bool isLoadable = cont->load_component_Library(componentName); + if (!isLoadable) return Engines::Component::_nil(); + + Engines::Component_ptr myInstance = + cont->create_component_instance(componentName, 0); + return myInstance; + } + MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component INTERACTIF " << containerName << " " << componentName ) ; + //#if 0 // --- Check if Component Name is known in ModuleCatalog if (! isKnownComponentClass(componentName)) @@ -257,7 +287,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, // SCRUTE(params->isMPI); free(stContainer); return FindOrLoad_Component(params,componentName); - + //#endif } //============================================================================= @@ -277,7 +307,7 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) SALOME_ModuleCatalog::ModuleCatalog_var Catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ; ASSERT(! CORBA::is_nil(Catalog)); - SALOME_ModuleCatalog::Acomponent_ptr compoInfo = + SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(componentName); if (CORBA::is_nil (compoInfo)) { @@ -340,6 +370,9 @@ void SALOME_LifeCycleCORBA::preSet( Engines::MachineParameters& params) params.nb_proc_per_node = 0; params.nb_node = 0; params.isMPI = false; + + params.parallelLib = ""; + params.nb_component_nodes = 0; } //============================================================================= @@ -375,6 +408,19 @@ Engines::ContainerManager_ptr SALOME_LifeCycleCORBA::getContainerManager() return contManager._retn(); } +//============================================================================= +/*! Public - + * \return the container Manager + */ +//============================================================================= + +Engines::ResourcesManager_ptr SALOME_LifeCycleCORBA::getResourcesManager() +{ + Engines::ResourcesManager_var resManager = + Engines::ResourcesManager::_duplicate(_ResManager); + return resManager._retn(); +} + //============================================================================= /*! Protected - @@ -425,7 +471,7 @@ _FindComponent(const Engines::MachineParameters& params, if(lghtOfmachinesOK != 0) { machinesOK->length(lghtOfmachinesOK); - CORBA::String_var bestMachine = _ContManager->FindFirst(machinesOK); + CORBA::String_var bestMachine = _ResManager->FindFirst(machinesOK); CORBA::Object_var obj = _NS->ResolveComponent(bestMachine, containerName, componentName, @@ -457,11 +503,8 @@ _LoadComponent(const Engines::MachineParameters& params, int studyId, const Engines::MachineList& listOfMachines) { - const char *containerName = params.container_name; - int nbproc = NbProc(params); - - MESSAGE("_LoadComponent, required " << containerName << - " " << componentName << " " << nbproc); + MESSAGE("_LoadComponent, required " << params.container_name << + " " << componentName << " " << NbProc(params)); Engines::Container_var cont = _ContManager->FindOrStartContainer(params, @@ -488,8 +531,11 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters& MESSAGE("Number of component nodes : " << params.nb_component_nodes); MESSAGE("Component Name : " << componentName);*/ + Engines::CompoList clist; + clist.length(1); + clist[0] = componentName; MESSAGE("Building a list of machines"); - Engines::MachineList_var listOfMachines = _ContManager->GetFittingResources(params, componentName); + Engines::MachineList_var listOfMachines = _ResManager->GetFittingResources(params, clist); if (listOfMachines->length() == 0) { INFOS("No matching machines founded !"); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index a8e0d5a88..ced93eb1e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -102,6 +102,7 @@ public: void preSet(Engines::MachineParameters& params); Engines::ContainerManager_ptr getContainerManager(); + Engines::ResourcesManager_ptr getResourcesManager(); protected: @@ -124,6 +125,7 @@ protected: SALOME_NamingService *_NS; Engines::ContainerManager_var _ContManager; + Engines::ResourcesManager_var _ResManager; } ; diff --git a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx index a1a582770..2c724e369 100644 --- a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx +++ b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx @@ -672,17 +672,20 @@ string LifeCycleCORBATest::GetRemoteHost() { SALOME_LifeCycleCORBA _LCC(&_NS); - CORBA::Object_var obj = _NS.Resolve("/ContainerManager"); + CORBA::Object_var obj = _NS.Resolve("/ResourcesManager"); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); - Engines::ContainerManager_var containerManager = - Engines::ContainerManager::_narrow(obj); - CPPUNIT_ASSERT(!CORBA::is_nil(containerManager)); + Engines::ResourcesManager_var resourcesManager = + Engines::ResourcesManager::_narrow(obj); + CPPUNIT_ASSERT(!CORBA::is_nil(resourcesManager)); Engines::MachineParameters params; _LCC.preSet(params); // empty params to get all the machines + Engines::CompoList clist; + clist.length(1); + clist[0] = "SalomeTestComponent"; Engines::MachineList_var hostList = - containerManager->GetFittingResources(params,"SalomeTestComponent"); + resourcesManager->GetFittingResources(params,clist); CPPUNIT_ASSERT(hostList->length() > 1); string localHost = GetHostname(); diff --git a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py index 3e3b974b3..d6d857b62 100644 --- a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py @@ -19,14 +19,15 @@ import sys, os,signal,string,commands import runSalome +import setenv import orbmodule import TestKiller import addToKillList # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # set environment for trace in logger # (with file, servers may be killed before the write to the file...) @@ -63,12 +64,12 @@ cataServer.setpath(modules_list,modules_root_dir) cataServer.run() clt.waitNS("/Kernel/ModulCatalog") -# launch container manager server +# launch launcher server -myCmServer = runSalome.ContainerManagerServer(args) +myCmServer = runSalome.LauncherServer(args) myCmServer.setpath(modules_list,modules_root_dir) myCmServer.run() -clt.waitNS("/ContainerManager") +clt.waitNS("/SalomeLauncher") # execute Unit Test @@ -78,8 +79,8 @@ ret = os.spawnvp(os.P_WAIT, command[0], command) # kill containers created by the Container Manager import Engines -containerManager = clt.waitNS("/ContainerManager",Engines.ContainerManager) -containerManager.Shutdown() +launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher) +launcher.Shutdown() # kill Test process diff --git a/src/Container/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx similarity index 76% rename from src/Container/TestContainerManager.cxx rename to src/LifeCycleCORBA/TestContainerManager.cxx index 3d991bbdd..b908e90f8 100644 --- a/src/Container/TestContainerManager.cxx +++ b/src/LifeCycleCORBA/TestContainerManager.cxx @@ -49,6 +49,7 @@ int main (int argc, char * argv[]) Engines::Component_ptr compo; bool error = false; bool bestImplemented; + int status; // Initializing omniORB ORB_INIT &init = *SINGLETON_::Instance() ; @@ -59,8 +60,15 @@ int main (int argc, char * argv[]) CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS); ASSERT( !CORBA::is_nil(obj)); Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj); + obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS); + ASSERT( !CORBA::is_nil(obj)); + Engines::ResourcesManager_var _ResManager=Engines::ResourcesManager::_narrow(obj); Engines::MachineParameters p; + Engines::CompoList clist; + clist.length(2); + clist[0] = "MED"; + clist[1] = "GEOM"; p.hostname = ""; p.OS = "LINUX"; @@ -74,26 +82,27 @@ int main (int argc, char * argv[]) for(int i=0;i<10;i++){ sprintf(st,"cycl_%d",i); p.container_name = CORBA::string_dup(st); - cont = _ContManager->StartContainer(p,Engines::P_CYCL); + cont = _ContManager->GiveContainer(p,Engines::P_CYCL,clist); if(CORBA::is_nil(cont)) error = true; } for(int i=0;i<10;i++){ sprintf(st,"first_%d",i); p.container_name = CORBA::string_dup(st); - cont = _ContManager->StartContainer(p,Engines::P_FIRST); + cont = _ContManager->GiveContainer(p,Engines::P_FIRST,clist); if(CORBA::is_nil(cont)) error = true; } p.container_name = CORBA::string_dup("best"); - cont = _ContManager->StartContainer(p,Engines::P_BEST); + cont = _ContManager->GiveContainer(p,Engines::P_BEST,clist); if(CORBA::is_nil(cont)) bestImplemented = false; else bestImplemented = true; SALOME_LifeCycleCORBA LCC(_NS); - compo = LCC.FindOrLoad_Component("FactoryServer","GEOM"); + p.container_name = CORBA::string_dup("FactoryServer"); + compo = LCC.FindOrLoad_Component(p,"SMESH"); if(CORBA::is_nil(compo)) error = true; - compo = LCC.FindOrLoad_Component("FactoryServer","GEOM"); + compo = LCC.FindOrLoad_Component(p,"SMESH"); if(CORBA::is_nil(compo)) error = true; _NS->Change_Directory("/Containers"); @@ -125,25 +134,33 @@ int main (int argc, char * argv[]) int cmax=0; int fmin=10; int fmax=0; + int nbpmax; for(map::iterator iter=cycle.begin();iter!=cycle.end();iter++){ if(strcmp((*iter).first.c_str(),"localhost")!=0){ - if(cycle[(*iter).first]cmax) cmax=cycle[(*iter).first]; - if(first[(*iter).first]fmax) fmax=first[(*iter).first]; + Engines::MachineParameters *p = _ResManager->GetMachineParameters((*iter).first.c_str()); + int nbproc = p->nb_node * p->nb_proc_per_node; + if(cycle[(*iter).first]/nbproccmax) cmax=cycle[(*iter).first]/nbproc; + if(first[(*iter).first]/nbprocfmax){ + fmax=first[(*iter).first]/nbproc; + nbpmax = nbproc; + } } } - if( ((cmax-cmin) <= 1) && (fmax == 10) && !error ){ - string msg; + string msg; + if( ((cmax-cmin) <= 2) && (fmax == 10/nbpmax) && !error ){ if(bestImplemented) msg = "TEST OK"; else msg = "TEST OK but FindBest not implemented!"; - MESSAGE(msg); - return 0; + status=0; } else{ - MESSAGE("TEST KO"); - return 1; + msg ="TEST KO"; + status=1; } + cout << msg << endl; + + return status; } diff --git a/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx index c9f1e44bc..2cd147634 100644 --- a/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx @@ -140,12 +140,6 @@ int main (int argc, char * argv[]) { INFOS("Caught system exception COMM_FAILURE -- unable to contact the object."); } -#ifndef WNT - catch(CORBA::SystemException&) - { - INFOS("Caught a CORBA::SystemException."); - } -#endif catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception."); diff --git a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py index 2157e8d38..8ffe63ee6 100644 --- a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py +++ b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py @@ -28,14 +28,15 @@ import sys, os,signal,string,commands import runSalome +import setenv import orbmodule import TestKiller import addToKillList # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # set environment for trace in logger # (with file, servers may be killed before the write to the file...) @@ -74,10 +75,10 @@ clt.waitNS("/Kernel/ModulCatalog") # launch container manager server -myCmServer = runSalome.ContainerManagerServer(args) +myCmServer = runSalome.LauncherServer(args) myCmServer.setpath(modules_list,modules_root_dir) myCmServer.run() -clt.waitNS("/ContainerManager") +clt.waitNS("/SalomeLauncher") # execute Unit Test @@ -91,8 +92,8 @@ unittest.TextTestRunner(verbosity=2).run(LifeCycleCORBA_SWIGTest.suite()) # kill containers created by the Container Manager import Engines -containerManager = clt.waitNS("/ContainerManager",Engines.ContainerManager) -containerManager.Shutdown() +launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher) +launcher.Shutdown() # kill Test process diff --git a/src/Makefile.am b/src/Makefile.am index 55eff87da..82efa8787 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,10 +27,10 @@ SUBDIR_BASE = \ Basics \ SALOMELocalTrace \ - CASCatch \ HDFPersist SUBDIR_CORBA = \ + DF \ Logger \ SALOMETraceCollector \ Utils \ @@ -43,6 +43,7 @@ SUBDIR_CORBA = \ NOTIFICATION_SWIG \ Container \ TestContainer \ + Launcher \ LifeCycleCORBA \ LifeCycleCORBA_SWIG \ SALOMEDSClient \ @@ -101,6 +102,10 @@ DIST_SUBDIRS = \ SUBDIRS = $(SUBDIR_BASE) +if WITH_BATCH + SUBDIRS += $(SUBDIR_BATCH) +endif + if CORBA_GEN SUBDIRS += $(SUBDIR_CORBA) endif @@ -109,10 +114,6 @@ endif # SUBDIRS += $(SUBDIR_MPI) #endif -if WITH_BATCH - SUBDIRS += $(SUBDIR_BATCH) -endif - if CPPUNIT_IS_OK if CORBA_GEN SUBDIRS += \ diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index dcfb7ded6..83f138d3d 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -62,8 +62,8 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Utils \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - @QT_INCLUDES@ + @LIBXML_INCLUDES@ \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -71,7 +71,8 @@ COMMON_LIBS =\ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ - $(top_builddir)/idl/libSalomeIDLKernel.la + $(top_builddir)/idl/libSalomeIDLKernel.la \ + @LIBXML_LIBS@ libSalomeCatalog_la_SOURCES =\ SALOME_ModuleCatalog_Handler.cxx \ @@ -85,8 +86,7 @@ libSalomeCatalog_la_CPPFLAGS =\ libSalomeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeCatalog_la_LIBADD =\ - $(COMMON_LIBS) \ - @QT_LIBS@ + $(COMMON_LIBS) # diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 7e4409a5a..2e9b3160d 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -50,7 +50,7 @@ static int MYDEBUG = 0; // and the pathes prefixes for all computers //---------------------------------------------------------------------- SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl -(SALOME_ModuleCatalog::Component &C) : _Component(C) +(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C) { if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl"); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index c7b580a17..943d5d02e 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -40,7 +40,7 @@ class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOM { public: //! standard constructor - SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::Component &C); + SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::ComponentDef &C); //! standard destructor virtual ~SALOME_ModuleCatalog_AcomponentImpl(); @@ -143,7 +143,7 @@ public: private : - SALOME_ModuleCatalog::Component _Component; + SALOME_ModuleCatalog::ComponentDef _Component; //! method to duplicate an interface /*! diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx index 5aa0ab5ab..02384368c 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx @@ -160,8 +160,6 @@ int main(int argc,char **argv) void PrintComponent(SALOME_ModuleCatalog::Acomponent_ptr C) { - const char *_name = C->componentname(); - MESSAGE("Name : " << C->componentname()); MESSAGE("Type : " << C->component_type() << " multistudy : " << C->multistudy()); MESSAGE("Constraint : " << C->constraint()); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 30cbaaa14..97c257ded 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -45,7 +45,12 @@ static int MYDEBUG = 0; // Function : SALOME_ModuleCatalog_Handler // Purpose : Constructor //---------------------------------------------------------------------- -SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() +SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList, + ParserComponents& moduleList, + ParserTypes& typeMap, + TypeList& typeList):_typeMap(typeMap),_typeList(typeList), + _pathList(pathList),_moduleList(moduleList) + { if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler"); @@ -53,7 +58,9 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() // Used in the function endElement test_path_prefix_name = "path-prefix-name"; test_computer_name = "computer-name" ; + test_computer_list = "computer-list" ; test_path_prefix = "path-prefix" ; + test_path_prefix_list = "path-prefix-list" ; test_component_name = "component-name"; test_component_username = "component-username"; @@ -99,6 +106,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() test_constraint = "constraint"; + test_component_list = "component-list"; test_component="component"; if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler"); @@ -114,11 +122,14 @@ SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler() if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()") } -//---------------------------------------------------------------------- -// Function : startDocument -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::startDocument() + +//============================================================================= +/*! + * Processes XML document and fills the list of modules + */ +//============================================================================= + +void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) { if(MYDEBUG) MESSAGE("Begin parse document"); // Empty the private elements @@ -131,465 +142,644 @@ bool SALOME_ModuleCatalog_Handler::startDocument() _outDataStreamParamList.resize(0); _inParamList.resize(0); _outParamList.resize(0); - return true; -} -//---------------------------------------------------------------------- -// Function : startElement -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::startElement(const QString&, - const QString &, - const QString& qName, - const QXmlAttributes& atts) -{ - _xml_pile.push(qName); - - return true; -} - -//---------------------------------------------------------------------- -// Function : endElement -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::endElement(const QString&, - const QString &, - const QString& qName) -{ - QString parent, grandparent; - _xml_pile.pop(); - if (!_xml_pile.empty()) { - parent = _xml_pile.top(); - _xml_pile.pop(); - if (!_xml_pile.empty()) grandparent = _xml_pile.top(); - _xml_pile.push(parent); - } - - // Path prefix - - // tag test_path_prefix_name - if((qName.compare(test_path_prefix_name)==0)) { - _pathPrefix.path = content; - return true; - } - - // tag test_computer_name - if((qName.compare(test_computer_name)==0)) { - _pathPrefix.listOfComputer.push_back(content); - return true; - } - - // tag test_path_prefix - if((qName.compare(test_path_prefix)==0)) { - _pathList.push_back(_pathPrefix); - _pathPrefix.listOfComputer.resize(0); - return true; - } - - // Component identification - - // tag test_component_name - if((qName.compare(test_component_name)==0)) { - _aModule.name = content ; - return true; - } - - // tag test_component_username - if((qName.compare(test_component_username)==0)) { - _aModule.username = content ; - return true; - } - - // tag test_component_type - if((qName.compare(test_component_type)==0)) - { - if ((content.compare("MESH") == 0) || - (content.compare("Mesh") == 0) || - (content.compare("mesh") == 0)) - _aModule.type = MESH ; - else if((content.compare("MED") == 0) || - (content.compare("Med") == 0) || - (content.compare("med") == 0)) - _aModule.type = Med ; - else if((content.compare("GEOM") == 0) || - (content.compare("Geom") == 0) || - (content.compare("geom") == 0)) - _aModule.type = GEOM ; - else if((content.compare("SOLVER") == 0) || - (content.compare("Solver") == 0) || - (content.compare("solver") == 0)) - _aModule.type = SOLVER ; - else if((content.compare("SUPERV") == 0) || - (content.compare("Superv") == 0) || - (content.compare("Supervision") == 0) || - (content.compare("superv") == 0)) - _aModule.type = SUPERV ; - else if((content.compare("DATA") == 0) || - (content.compare("Data") == 0) || - (content.compare("data") == 0)) - _aModule.type = DATA ; - else if((content.compare("VISU") == 0) || - (content.compare("Visu") == 0) || - (content.compare("visu") == 0)) - _aModule.type = VISU ; - else if((content.compare("OTHER") == 0) || - (content.compare("Other") == 0) || - (content.compare("other") == 0)) - _aModule.type = OTHER ; - else - // If it'not in all theses cases, the type is affected to OTHER - _aModule.type = OTHER ; - return true; - } - - // tag test_component_multistudy - if((qName.compare(test_component_multistudy)==0)) { - _aModule.multistudy = atoi(content.c_str()) ; - return true; - } - - // tag test_component_impltype - if((qName.compare(QString(test_component_impltype))==0)) - _aModule.implementationType = atoi(content.c_str()) ; - - // tag test_component_icon - if((qName.compare(test_component_icon)==0)) { - _aModule.icon = content ; - return true; - } - - // tag test_component_version - if((qName.compare(test_component_version)==0)) { - _aModule.version = content ; - return true; - } - - // tag test_component_comment - if((qName.compare(test_component_comment)==0)) { - _aModule.comment = content ; - return true; - } - - // interface identification - - // tag test_interface_name - if ((qName.compare(test_interface_name)==0)) { - _aInterface.name = content ; - return true; - } - - // Service identification - - // tag test_service_name - if ((qName.compare(test_service_name)==0)) { - _aService.name = content ; - return true; - } - - //tag test_defaultservice - if ((qName.compare(test_defaultservice)==0)) { - _aService.byDefault = atoi(content.c_str()) ; - return true; - } - - //tag test_typeofnode - if((qName.compare(QString(test_typeofnode))==0)) - _aService.typeOfNode = atoi(content.c_str()) ; - - // Parameter in - - // tag test_inDataStreamParameter_type - if ((qName.compare(test_inDataStreamParameter_type)==0)) { - if (grandparent.compare(test_inDataStreamParameter_list) == 0) - _inDataStreamParam.type = content ; - else - _inParam.type = content ; - return true; - } - - // tag test_inParameter_type - if ((qName.compare(test_inParameter_type)==0)) { - if (grandparent.compare(test_inDataStreamParameter_list) == 0) - _inDataStreamParam.type = content ; - else - _inParam.type = content ; - return true; - } - - //tag test_inDataStreamParameter_name - if ((qName.compare(test_inDataStreamParameter_name)==0)) { - if (grandparent.compare(test_inDataStreamParameter_list) == 0) - _inDataStreamParam.name = content ; - else - _inParam.name = content ; - return true; - } - - //tag test_inParameter_name - if ((qName.compare(test_inParameter_name)==0)) { - if(MYDEBUG) SCRUTE(parent.toLatin1().data()); - if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); - if (grandparent.compare(test_inDataStreamParameter_list) == 0) - _inDataStreamParam.name = content ; - else - _inParam.name = content ; - return true; - } - - //tag test_inDataStreamParameter_dependency - if ((qName.compare(test_inDataStreamParameter_dependency)==0)) { - _inDataStreamParam.dependency = content ; - return true; - } - - //tag test_inParameter - if ((qName.compare(test_inParameter)==0)) - { - if (parent.compare(test_inParameter_list)==0) { - - if(MYDEBUG) MESSAGE("add inParameter : " << _inParam.name); - _inParamList.push_back(_inParam) ; - - // Empty temporary structures - _inParam.type = ""; - _inParam.name = ""; - } - else if ((qName.compare(test_inDataStreamParameter)==0)) { - - if(MYDEBUG) MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name); - _inDataStreamParamList.push_back(_inDataStreamParam) ; - - // Empty temporary structures - _inDataStreamParam.type = ""; - _inDataStreamParam.name = ""; - _inDataStreamParam.dependency = ""; - } - return true; - } + // Get the document root node + xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc); + aCurNode = aCurNode->xmlChildrenNode; - //tag test_inParameter_list - if((qName.compare(test_inParameter_list)==0)) - { - if(MYDEBUG) SCRUTE(_inParamList.size()); - _aService.inParameters = _inParamList; - _inParamList.resize(0); - return true; - } - - //tag test_inDataStreamParameter_list - if((qName.compare(test_inDataStreamParameter_list)==0)) - { - if(MYDEBUG) SCRUTE(_inDataStreamParamList.size()); - _aService.inDataStreamParameters = _inDataStreamParamList; - _inDataStreamParamList.resize(0); - } - //tag test_outDataStreamParameter_list - if((qName.compare(test_outDataStreamParameter_list)==0)) - { - if(MYDEBUG) SCRUTE(_outDataStreamParamList.size()); - _aService.outDataStreamParameters = _outDataStreamParamList; - _outDataStreamParamList.resize(0); - return true; - } - - - - // Parameter out - if(MYDEBUG) SCRUTE(qName.toLatin1().data()); - - // tag test_outParameter_type - if ((qName.compare(test_outParameter_type)==0)) { - if (grandparent.compare(test_outDataStreamParameter_list) == 0) - _outDataStreamParam.type = content ; - else - _outParam.type = content ; - return true; - } - - // tag test_outDataStreamParameter_type - if ((qName.compare(test_outDataStreamParameter_type)==0)) { - if (grandparent.compare(test_outDataStreamParameter_list) == 0) - _outDataStreamParam.type = content ; - else - _outParam.type = content ; - return true; - } - - //tag test_outParameter_name - if ((qName.compare(test_outParameter_name)==0)) { - if (grandparent.compare(test_outDataStreamParameter_list) == 0) - _outDataStreamParam.name = content ; - else - _outParam.name = content ; - return true; - } - - //tag test_outDataStreamParameter_name - if ((qName.compare(test_outDataStreamParameter_name)==0)) { - if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); - if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list.toLatin1().data()); - if (grandparent.compare(test_outDataStreamParameter_list) == 0) - _outDataStreamParam.name = content ; - else - _outParam.name = content ; - return true; - } - - //tag test_outParameter_dependency - if ((qName.compare(test_outDataStreamParameter_dependency)==0)) { - _outDataStreamParam.dependency = content ; - return true; - } - - //tag test_outParameter - if ((qName.compare(test_outParameter)==0)) + // Processing the document nodes + while(aCurNode != NULL) + { + // Part 1: Process path prefix list (tag test_path_prefix_list) + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) ) { - if (parent.compare(test_outParameter_list)==0) { - - if(MYDEBUG) MESSAGE("add outParameter : " << _outParam.name); - _outParamList.push_back(_outParam) ; - - // Empty temporary structures - _outParam.type = ""; - _outParam.name = ""; - } - else if ((qName.compare(test_outDataStreamParameter)==0)) { - - if(MYDEBUG) MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name); - _outDataStreamParamList.push_back(_outDataStreamParam) ; - - // Empty temporary structures - _outDataStreamParam.type = ""; - _outDataStreamParam.name = ""; - _outDataStreamParam.dependency = ""; + xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode; + while(aCurSubNode != NULL) + { + // Forming a PathPrefix structure (tag test_path_prefix) + if ( xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_path_prefix) ) { + aCurSubNode = aCurSubNode->next; + continue; + } + + xmlNodePtr aCurSubSubNode = aCurSubNode->xmlChildrenNode; + while(aCurSubSubNode != NULL) + { + // Tag test_path_prefix_name + if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_path_prefix_name) ) { + xmlChar* aPath = xmlNodeGetContent(aCurSubSubNode); + if (aPath != NULL) { + _pathPrefix.path = (const char*)aPath; + xmlFree(aPath); + } + } + + // Tag test_computer_list + if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_computer_list) ) { + xmlNodePtr aComputerNode = aCurSubSubNode->xmlChildrenNode; + while (aComputerNode != NULL) { + // Tag test_computer_name + if ( !xmlStrcmp(aComputerNode->name, (const xmlChar*) test_computer_name) ) { + xmlChar* aCompName = xmlNodeGetContent(aComputerNode); + if (aCompName != NULL) { + _pathPrefix.listOfComputer.push_back((const char*)aCompName); + xmlFree(aCompName); + } + } + + aComputerNode = aComputerNode->next; + } + } + + aCurSubSubNode = aCurSubSubNode->next; + } + + _pathList.push_back(_pathPrefix); + _pathPrefix.listOfComputer.resize(0); + + aCurSubNode = aCurSubNode->next; } - return true; } - - //tag test_outParameter_list - if((qName.compare(test_outParameter_list)==0)) - { - if(MYDEBUG) SCRUTE(_outParamList.size()); - _aService.outParameters = _outParamList; - _outParamList.resize(0); - return true; - } - - // tag test_service - if((qName.compare(test_service)==0)) - { - _serviceList.push_back(_aService); - - // Empty temporary structures - _aService.name = ""; - _aService.typeOfNode = 1; - _aService.inParameters.resize(0); - _aService.outParameters.resize(0); - _aService.inDataStreamParameters.resize(0); - _aService.outDataStreamParameters.resize(0); - } - - // tag test_service_list - if((qName.compare(test_service_list)==0)) - { - _aInterface.services = _serviceList ; - - // Empty temporary structures - _serviceList.resize(0); - _interfaceList.push_back(_aInterface); - _aInterface.name =""; - _aInterface.services.resize(0); - - } - - //tag test_interface_list - if((qName.compare(test_interface_list)==0)) - { - _aModule.interfaces = _interfaceList ; - _interfaceList.resize(0); - } - - //tag test_constraint - if((qName.compare(test_constraint)==0)) - _aModule.constraint = content ; - - // tag test_component - if((qName.compare(test_component)==0)) - { - _moduleList.push_back(_aModule) ; - - // Empty temporary structures - _aModule.name = ""; - _aModule.constraint = ""; - _aModule.icon=""; - _aModule.interfaces.resize(0); - } - - return true; -} - -//---------------------------------------------------------------------- -// Function : characters -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::characters(const QString& chars) -{ - content = chars.toLatin1().data() ; - return true; -} -//---------------------------------------------------------------------- -// Function : endDocument -// Purpose : overload handler function -// Print all informations find in the catalog -// (only in DEBUG mode!!) -//---------------------------------------------------------------------- -#include -bool SALOME_ModuleCatalog_Handler::endDocument() -{ -// ofstream f("/tmp/logs/xxx.log", std::ofstream::app); -// f << "---------------------------------------------------------" << std::endl; - if(MYDEBUG) BEGIN_OF("endDocument"); - //_pathlist - for (unsigned int ind = 0; ind < _pathList.size(); ind++) + //Part 2: Process list of types + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)"type-list") ) + { + xmlNodePtr aTypeNode = aCurNode->xmlChildrenNode; + while (aTypeNode != NULL) + { + // match "type" + if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"type" )) + { + // Here is a basic type description + ParserType aType; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *kind=xmlGetProp(aTypeNode,(const xmlChar*)"kind"); + if(kind) + { + aType.kind = (const char*)kind; + xmlFree(kind); + } + if(aType.kind == "double" || + aType.kind == "int" || + aType.kind == "bool" || + aType.kind == "string") + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered basic type: " << aType.name << " " << aType.kind << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl; + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" )) + { + // Here is a sequence type description + ParserSequence aType; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *content=xmlGetProp(aTypeNode,(const xmlChar*)"content"); + if(content) + { + aType.content = (const char*)content; + xmlFree(content); + } + if ( _typeMap.find(aType.content) != _typeMap.end() ) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered sequence type: " << aType.name << " " << aType.content << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + else + { + std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl; + } + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" )) + { + // Here is an objref type description + ParserObjref aType; + int error=0; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id"); + if(id) + { + aType.id = (const char*)id; + xmlFree(id); + } + + xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode; + while (aTypeSubNode != NULL) + { + if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"base" )) + { + //a base type + xmlChar* content = xmlNodeGetContent(aTypeSubNode); + if(content) + { + std::string base=(const char*)content; + xmlFree(content); + if ( _typeMap.find(base) != _typeMap.end() && _typeMap[base].kind == "objref") + { + aType.bases.push_back(base); + } + else + { + std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl; + error=1; + break; + } + } + } + aTypeSubNode = aTypeSubNode->next; + } + if(!error) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered objref type: " << aType.name << " " << aType.id << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" )) + { + // Here is a struct type description + ParserStruct aType; + int error=0; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id"); + if(id) + { + aType.id = (const char*)id; + xmlFree(id); + } + + xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode; + while (aTypeSubNode != NULL) + { + if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"member" )) + { + std::pair member; + xmlChar * m_name=xmlGetProp(aTypeSubNode,(const xmlChar*)"name"); + if(m_name) + { + member.first=(const char*)m_name; + xmlFree(m_name); + } + xmlChar * m_type=xmlGetProp(aTypeSubNode,(const xmlChar*)"type"); + if(m_type) + { + member.second=(const char*)m_type; + xmlFree(m_type); + } + if ( _typeMap.find(member.second) != _typeMap.end() ) + { + aType.members.push_back(member); + } + else + { + std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl; + error=1; + break; + } + } + aTypeSubNode = aTypeSubNode->next; + } + if(!error) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered struct type: " << aType.name << " " << aType.id << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + } // end of struct + aTypeNode = aTypeNode->next; + } + } + + //Part 3: Process list of components (tag test_component_list) + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) ) { - if(MYDEBUG) MESSAGE("Path :"<<_pathList[ind].path); - for (unsigned int i = 0; i < _pathList[ind].listOfComputer.size(); i++) - if(MYDEBUG) MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i]); + xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode; + while (aComponentNode != NULL) + { + // Do not process tags differ from test_component here + if ( xmlStrcmp(aComponentNode->name, (const xmlChar*)test_component) ) { + aComponentNode = aComponentNode->next; + continue; + } + + // Component identification + + // Empty temporary structures + _aModule.name = ""; + _aModule.constraint = ""; + _aModule.icon=""; + _aModule.interfaces.resize(0); + + xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode; + while(aComponentSubNode != NULL) + { + xmlChar* aNodeContent = xmlNodeGetContent(aComponentSubNode); + + if (aNodeContent == NULL) { + aComponentSubNode = aComponentSubNode->next; + continue; + } + + std::string aContent = (const char*)aNodeContent; + + // Tag test_component_name + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_name) ) + _aModule.name = aContent; + + // Tag test_component_username + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_username) ) + _aModule.username = aContent; + + // Tag test_component_type + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_type) ) { + std::string aType = aContent; + + if ((aType.compare("MESH") == 0) || + (aType.compare("Mesh") == 0) || + (aType.compare("mesh") == 0)) + _aModule.type = MESH ; + else if((aType.compare("MED") == 0) || + (aType.compare("Med") == 0) || + (aType.compare("med") == 0)) + _aModule.type = Med ; + else if((aType.compare("GEOM") == 0) || + (aType.compare("Geom") == 0) || + (aType.compare("geom") == 0)) + _aModule.type = GEOM ; + else if((aType.compare("SOLVER") == 0) || + (aType.compare("Solver") == 0) || + (aType.compare("solver") == 0)) + _aModule.type = SOLVER ; + else if((aType.compare("SUPERV") == 0) || + (aType.compare("Superv") == 0) || + (aType.compare("Supervision") == 0) || + (aType.compare("superv") == 0)) + _aModule.type = SUPERV ; + else if((aType.compare("DATA") == 0) || + (aType.compare("Data") == 0) || + (aType.compare("data") == 0)) + _aModule.type = DATA ; + else if((aType.compare("VISU") == 0) || + (aType.compare("Visu") == 0) || + (aType.compare("visu") == 0)) + _aModule.type = VISU ; + else if((aType.compare("OTHER") == 0) || + (aType.compare("Other") == 0) || + (aType.compare("other") == 0)) + _aModule.type = OTHER ; + else + // If it'not in all theses cases, the type is affected to OTHER + _aModule.type = OTHER ; + } + + // Tag test_component_multistudy + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_multistudy) ) + _aModule.multistudy = atoi( aContent.c_str() ); + + // Tag test_component_impltype + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) ) + _aModule.implementationType = atoi(aContent.c_str()); + + // Tag test_component_icon + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) ) + _aModule.icon = aContent; + + // Tag test_component_version + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_version) ) + _aModule.version = aContent; + + // Tag test_component_comment + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_comment) ) + _aModule.comment = aContent; + + // Tag test_constraint + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_constraint) ) + _aModule.constraint = aContent; + + xmlFree(aNodeContent); + + // Process tag test_interface_list: + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_interface_list) ) { + + // Form an interface list for the component + xmlNodePtr aSubNode = aComponentSubNode->xmlChildrenNode; + while(aSubNode != NULL) { + // Tag test_interface_name + if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_interface_name) ) { + xmlChar* anInterfaceName = xmlNodeGetContent(aSubNode); + if (anInterfaceName != NULL) { + _aInterface.name = (const char*)anInterfaceName; + xmlFree(anInterfaceName); + } + } + + // Tag test_service_list + if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_service_list) ) { + // Form a service list for the interface + xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode; + while(aCompServiceNode != NULL) { + // Tag test_service + if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)"component-service") ) { + xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode; + while(aCompServiceSubNode != NULL) + { + xmlChar* aCompServiceData = xmlNodeGetContent(aCompServiceSubNode); + + if ( aCompServiceData != NULL) + { + // Tag test_service_name + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_service_name) ) + _aService.name = (const char*)aCompServiceData; + + // Tag test_defaultservice + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_defaultservice) ) + _aService.byDefault = (const char*)aCompServiceData; + + // Tag test_typeofnode + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_typeofnode) ) + _aService.typeOfNode = (const char*)aCompServiceData; + + xmlFree(aCompServiceData); + } + + // Tag test_inParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inParameter_list) ) { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_inParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* aParamData = xmlNodeGetContent(aParamItemNode); + + if (aParamData != NULL) + { + // Tag test_inParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_name) ) + _inParam.name = (const char*)aParamData; + + // Tag test_inParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_type) ) + _inParam.type = (const char*)aParamData; + + xmlFree(aParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _inParamList.push_back(_inParam) ; + + // Empty temporary structures + _inParam.type = ""; + _inParam.name = ""; + + aParamNode = aParamNode->next; + } + + _aService.inParameters = _inParamList; + _inParamList.resize(0); + } + + // Tag test_outParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outParameter_list) ) { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_outParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* anOutParamData = xmlNodeGetContent(aParamItemNode); + + if (anOutParamData != NULL) + { + // Tag test_outParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_name) ) + _outParam.name = (const char*)anOutParamData; + + // Tag test_outParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_type) ) + _outParam.type = (const char*)anOutParamData; + + xmlFree(anOutParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _outParamList.push_back(_outParam) ; + + // Empty temporary structures + _outParam.type = ""; + _outParam.name = ""; + + aParamNode = aParamNode->next; + } + + _aService.outParameters = _outParamList; + _outParamList.resize(0); + } + + //@ Tag test_inDataStreamParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inDataStreamParameter_list) ) + { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_inDataStreamParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inDataStreamParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* inDataStreamParamData = xmlNodeGetContent(aParamItemNode); + + if (inDataStreamParamData != NULL) + { + // Tag test_inDataStreamParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_name) ) + _inDataStreamParam.name = (const char*)inDataStreamParamData; + + // Tag test_inDataStreamParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_type) ) + _inDataStreamParam.type = (const char*)inDataStreamParamData; + + // Tag test_inDataStreamParameter_dependency + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_dependency) ) + _inDataStreamParam.dependency = (const char*)inDataStreamParamData; + + xmlFree(inDataStreamParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _inDataStreamParamList.push_back(_inDataStreamParam) ; + + // Empty temporary structures + _inDataStreamParam.type = ""; + _inDataStreamParam.name = ""; + _inDataStreamParam.dependency = ""; + + aParamNode = aParamNode->next; + } + + _aService.inDataStreamParameters = _inDataStreamParamList; + _inDataStreamParamList.resize(0); + } + + // Tag test_outDataStreamParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outDataStreamParameter_list) ) + { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_outDataStreamParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outDataStreamParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* outDataStreamParamData = xmlNodeGetContent(aParamItemNode); + + if (outDataStreamParamData != NULL) + { + // Tag test_outDataStreamParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_name) ) + _outDataStreamParam.name = (const char*)outDataStreamParamData; + + // Tag test_outDataStreamParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_type) ) + _outDataStreamParam.type = (const char*)outDataStreamParamData; + + // Tag test_outDataStreamParameter_dependency + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_dependency) ) + _outDataStreamParam.dependency = (const char*)outDataStreamParamData; + + xmlFree(outDataStreamParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _outDataStreamParamList.push_back(_outDataStreamParam) ; + + // Empty temporary structures + _outDataStreamParam.type = ""; + _outDataStreamParam.name = ""; + _outDataStreamParam.dependency = ""; + + aParamNode = aParamNode->next; + } + + _aService.outDataStreamParameters = _outDataStreamParamList; + _outDataStreamParamList.resize(0); + } + + aCompServiceSubNode = aCompServiceSubNode->next; + } + + // Put formed service into the list + _serviceList.push_back(_aService); + + // Empty temporary structures + _aService.name = ""; + _aService.typeOfNode = 1; + _aService.inParameters.resize(0); + _aService.outParameters.resize(0); + _aService.inDataStreamParameters.resize(0); + _aService.outDataStreamParameters.resize(0); + } + + aCompServiceNode = aCompServiceNode->next; + } + + _aInterface.services = _serviceList ; + + // Empty temporary structures + _serviceList.resize(0); + _interfaceList.push_back(_aInterface); + _aInterface.name =""; + _aInterface.services.resize(0); + } + + aSubNode = aSubNode->next; + } + + _aModule.interfaces = _interfaceList ; + _interfaceList.resize(0); + } + + aComponentSubNode = aComponentSubNode->next; + } + + _moduleList.push_back(_aModule); + + aComponentNode = aComponentNode->next; + } } - // _moduleList -// if(MYDEBUG) SCRUTE(_moduleList.size()); -// for (unsigned int ind = 0; ind < _moduleList.size(); ind++) -// { -// f << _moduleList[ind] << std::endl; -// } - - if(MYDEBUG) MESSAGE("Document parsed"); - if(MYDEBUG) END_OF("endDocument"); - return true; -} - -//---------------------------------------------------------------------- -// Function : errorProtocol -// Purpose : overload handler function -//---------------------------------------------------------------------- -QString SALOME_ModuleCatalog_Handler::errorProtocol() -{ - return errorProt ; -} - - -//---------------------------------------------------------------------- -// Function : fatalError -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::fatalError(const QXmlParseException& exception) -{ - errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" ) - .arg( exception.message() ) - .arg( exception.lineNumber() ) - .arg( exception.columnNumber() ); - - return QXmlDefaultHandler::fatalError( exception ); + aCurNode = aCurNode->next; + } } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index 01870cf85..22f7c416a 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -32,154 +32,108 @@ #include #include "SALOME_ModuleCatalog_Parser.hxx" -#include + #include #include #include -class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler +#include + +class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler { public: //! standard constructor - SALOME_ModuleCatalog_Handler(); + SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,ParserComponents& moduleList,ParserTypes& typeMap,TypeList& typeList); //! standard destructor virtual ~SALOME_ModuleCatalog_Handler(); - - //! method to overload handler function startDocument - /*! Is called before a xml file is parsed - \return true if no error was detected - */ - virtual bool startDocument(); - - - //! method to overload handler function startElement - /*! - \param QString argument by value - \param QString argument by value - \param QString argument by value - \param QXmlAttributes argument by value - \return true if no error was detected - */ - virtual bool startElement(const QString&, const QString &, - const QString& qName, const QXmlAttributes& atts); - - //! method to overload handler function endElement - /*! - \param QString argument by value - \param QString argument by value - \param QString argument by value - \return true if no error was detected - \sa _Find - */ - virtual bool endElement(const QString&, const QString &, - const QString& qName); - - - //! method to overload handler function characters - /*! - \param QString argument by value - \return true if no error was detected - */ - virtual bool characters(const QString& chars); - - //! method to overload handler function endDocument - /*! Is called at the end of the parsing - \return true if no error was detected - */ - virtual bool endDocument(); - - //! method to overload handler function errorProtocol - /*! - \return the error message - */ - virtual QString errorProtocol(); - - //! method to overload handler function fatalError - /*! - \param QXmlParseExecption argument by value - \return true if no error was detected - */ - virtual bool fatalError(const QXmlParseException& exception); + void ProcessXmlDocument(xmlDocPtr theDoc); private: - QString errorProt ; - - std::string content; - QString test_path_prefix_name ; - QString test_computer_name ; - QString test_path_prefix ; - - QString test_component_name; - QString test_component_username; - QString test_component_type ; - QString test_component_multistudy ; - QString test_component_icon ; - QString test_component_impltype; - QString test_component_version; - QString test_component_comment; - - QString test_interface_name; - - QString test_service_name; - QString test_defaultservice; - QString test_typeofnode; - - QString test_inParameter_type; - QString test_inParameter_name; - QString test_inParameter; - QString test_inParameter_list; - - QString test_outParameter_type; - QString test_outParameter_name; - QString test_outParameter; - QString test_outParameter_list; - - QString test_inDataStreamParameter_type; - QString test_inDataStreamParameter_name; - QString test_inDataStreamParameter_dependency; - QString test_inDataStreamParameter; - QString test_inDataStreamParameter_list; - - QString test_outDataStreamParameter_type; - QString test_outDataStreamParameter_name; - QString test_outDataStreamParameter_dependency; - QString test_outDataStreamParameter; - QString test_outDataStreamParameter_list; - - QString test_service; - QString test_service_list; - QString test_interface_list; - QString test_constraint; + const char *test_path_prefix_name ; + const char *test_computer_name ; + const char *test_computer_list ; + const char *test_path_prefix ; + const char *test_path_prefix_list; + + const char *test_component_name; + const char *test_component_username; + const char *test_component_type ; + const char *test_component_multistudy ; + const char *test_component_icon ; + const char *test_component_impltype; + const char *test_component_version; + const char *test_component_comment; + + const char *test_interface_name; + + const char *test_service_name; + const char *test_defaultservice; + const char *test_typeofnode; + + const char *test_inParameter_type; + const char *test_inParameter_name; + const char *test_inParameter; + const char *test_inParameter_list; + + const char *test_outParameter_type; + const char *test_outParameter_name; + const char *test_outParameter; + const char *test_outParameter_list; + + const char *test_inDataStreamParameter_type; + const char *test_inDataStreamParameter_name; + const char *test_inDataStreamParameter_dependency; + const char *test_inDataStreamParameter; + const char *test_inDataStreamParameter_list; + + const char *test_outDataStreamParameter_type; + const char *test_outDataStreamParameter_name; + const char *test_outDataStreamParameter_dependency; + const char *test_outDataStreamParameter; + const char *test_outDataStreamParameter_list; + + const char *test_service; + const char *test_service_list; + const char *test_interface_list; + const char *test_constraint; + + const char *test_component_list; + const char *test_component; - QString test_component; - ParserPathPrefix _pathPrefix; - + ParserComponent _aModule; - - + + ParserPathPrefixes& _pathList; + ParserComponents& _moduleList; + ParserInterfaces _interfaceList; ParserInterface _aInterface; - + ParserServices _serviceList; ParserService _aService; ParserParameters _inParamList; ParserParameter _inParam; - + ParserParameters _outParamList; ParserParameter _outParam; - + ParserDataStreamParameters _inDataStreamParamList; ParserDataStreamParameter _inDataStreamParam; - + ParserDataStreamParameters _outDataStreamParamList; ParserDataStreamParameter _outDataStreamParam; - std::stack _xml_pile; + ParserTypes& _typeMap; + TypeList& _typeList; + + ParserSequences _sequenceMap; + ParserObjrefs _objrefMap; + ParserStructs _structMap; }; #endif // SALOME_CATALOG_HANDLER_H diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx index 6d797172a..8369f9917 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx @@ -31,6 +31,7 @@ #include #include +#include // Type Definitions struct ParserPathPrefix @@ -102,16 +103,35 @@ struct ParserComponent typedef std::vector ParserComponents ; -#ifdef WRITE_CATA_COMPONENT -// contains all the paths and the computers defined in the catalog - ParserPathPrefixes _pathList; - -// contains all the modules defined in the catalog - ParserComponents _moduleList; -#else -extern ParserPathPrefixes _pathList; -extern ParserComponents _moduleList; -#endif +struct ParserType +{ + std::string name; + std::string kind; + std::string id; + std::string content; + std::vector bases; + std::vector< std::pair > members; +}; +typedef std::map ParserTypes ; +typedef std::map RefTypes ; +typedef std::vector TypeList ; + +struct ParserSequence:public ParserType +{ + ParserSequence(){kind="sequence";} +}; +typedef std::map ParserSequences ; +struct ParserObjref:public ParserType +{ + ParserObjref(){kind="objref";} +}; +typedef std::map ParserObjrefs ; + +struct ParserStruct:public ParserType +{ + ParserStruct(){kind="struct";} +}; +typedef std::map ParserStructs ; #endif // SALOME_CATALOG_PARSER_H diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index de5110a03..892b2fbb8 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -39,7 +39,7 @@ using namespace std; int main(int argc,char **argv) { // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { @@ -137,19 +137,19 @@ int main(int argc,char **argv) // Active catalog - SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb); - poa->activate_object (&Catalogue_i); + SALOME_ModuleCatalogImpl* Catalogue_i=new SALOME_ModuleCatalogImpl(argc, argv, orb); + PortableServer::ObjectId_var cataid = poa->activate_object (Catalogue_i); + //activate POA manager mgr->activate(); - - CORBA::Object_ptr myCata = Catalogue_i._this(); + CORBA::Object_var myCata = Catalogue_i->_this(); + Catalogue_i->_remove_ref(); // initialise Naming Service - SALOME_NamingService *_NS; - _NS = new SALOME_NamingService(orb); + SALOME_NamingService _NS(orb); // register Catalog in Naming Service - _NS->Register(myCata ,"/Kernel/ModulCatalog"); + _NS.Register(myCata ,"/Kernel/ModulCatalog"); MESSAGE("Running CatalogServer."); @@ -161,9 +161,11 @@ int main(int argc,char **argv) timer.ShowAbsolute(); #endif orb->run(); + std::cerr << "server returned from orb->run()" << std::endl; + orb->destroy(); - mgr->deactivate(true,true); - poa->destroy(1,1); +// mgr->deactivate(true,true); +// poa->destroy(1,1); } catch(CORBA::SystemException&) { @@ -173,6 +175,7 @@ int main(int argc,char **argv) INFOS("Caught CORBA::Exception.") } + END_OF( argv[0] ); // delete myThreadTrace; return 0; } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 7bdf7d559..e794b05a5 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -31,8 +31,6 @@ #include #include -#include -#include using namespace std; #include "utilities.h" @@ -46,6 +44,32 @@ static int MYDEBUG = 1; static const char* SEPARATOR = "::"; static const char* OLD_SEPARATOR = ":"; + +list splitStringToList(const string& theString, const string& theSeparator) +{ + list aList; + + int sepLen = theSeparator.length(); + int startPos = 0, sepPos = theString.find(theSeparator, startPos); + + while (1) + { + string anItem ; + if(sepPos != string::npos) + anItem = theString.substr(startPos, sepPos - startPos); + else + anItem = theString.substr(startPos); + if (anItem.length() > 0) + aList.push_back(anItem); + if(sepPos == string::npos) + break; + startPos = sepPos + sepLen; + sepPos = theString.find(theSeparator, startPos); + } + + return aList; +} + //---------------------------------------------------------------------- // Function : SALOME_ModuleCatalogImpl // Purpose : Constructor @@ -105,51 +129,62 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: if(MYDEBUG) MESSAGE( "Error while argument parsing" ); // Test existency of files - if (_general_path == NULL){ + if (_general_path == NULL) + { if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" ); - }else{ + } + else + { // Affect the _general_module_list and _general_path_list members // with the common catalog - - QStringList dirList; + + list dirList; + #ifdef WNT - dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries + dirList = splitStringToList(_general_path, SEPARATOR); #else //check for new format - if ( QString( _general_path ).contains(SEPARATOR) ) { + bool isNew = (std::string( _general_path ).find(SEPARATOR) != string::npos); + if ( isNew ) { //using new format - dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries + dirList = splitStringToList(_general_path, SEPARATOR); } else { //support old format - dirList = QString( _general_path ).split( OLD_SEPARATOR, QString::SkipEmptyParts ); // skip empty entries - } + dirList = splitStringToList(_general_path, OLD_SEPARATOR); + } #endif - - for ( int i = 0; i < dirList.count(); i++ ) { - //QFileInfo fileInfo( dirList[ i ] ); - QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename - if ( fileInfo.isFile() && fileInfo.exists() ) { - _parse_xml_file(fileInfo.filePath().toLatin1().data(), - _general_module_list, - _general_path_list); - } + + for (list::iterator iter = dirList.begin(); iter != dirList.end(); iter++) + { + string aPath = (*iter); + //remove inverted commas from filename + while (aPath.find('\"') != string::npos) + aPath.erase(aPath.find('\"'), 1); + + _parse_xml_file(aPath.c_str(), + _general_module_list, + _general_path_list, + _typeMap, + _typeList); } - + // Verification of _general_path_list content - if(!_verify_path_prefix(_general_path_list)){ + if (!_verify_path_prefix(_general_path_list)) { if(MYDEBUG) MESSAGE( "Error while parsing the general path list, " "differents paths are associated to the same computer," "the first one will be choosen"); - }else{ + } else { if(MYDEBUG) MESSAGE("General path list OK"); } - - if(_personal_path != NULL){ + + if (_personal_path != NULL) { // Initialize the _personal_module_list and // _personal_path_list members with the personal catalog files _parse_xml_file(_personal_path, _personal_module_list, - _personal_path_list); + _personal_path_list, + _typeMap, + _typeList); // Verification of _general_path_list content if(!_verify_path_prefix(_personal_path_list)){ @@ -175,6 +210,76 @@ SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl() } +//! Get the list of all types of the catalog +/*! + * \return the list of types + */ +SALOME_ModuleCatalog::ListOfTypeDefinition* SALOME_ModuleCatalogImpl::GetTypes() +{ + SALOME_ModuleCatalog::ListOfTypeDefinition_var type_list = new SALOME_ModuleCatalog::ListOfTypeDefinition(); + type_list->length(_typeList.size()); + + for (int ind = 0 ; ind < _typeList.size() ; ind++) + { + std::cerr << "name: " << _typeList[ind].name << std::endl; + //no real need to call string_dup, omniorb calls it on operator= (const char *) but it is safer + type_list[ind].name=CORBA::string_dup(_typeList[ind].name.c_str()); + type_list[ind].kind=SALOME_ModuleCatalog::NONE; + if(_typeList[ind].kind=="double") + type_list[ind].kind=SALOME_ModuleCatalog::Dble; + else if(_typeList[ind].kind=="int") + type_list[ind].kind=SALOME_ModuleCatalog::Int; + else if(_typeList[ind].kind=="bool") + type_list[ind].kind=SALOME_ModuleCatalog::Bool; + else if(_typeList[ind].kind=="string") + type_list[ind].kind=SALOME_ModuleCatalog::Str; + else if(_typeList[ind].kind=="objref") + { + type_list[ind].kind=SALOME_ModuleCatalog::Objref; + type_list[ind].id=CORBA::string_dup(_typeList[ind].id.c_str()); + //bases + type_list[ind].bases.length(_typeList[ind].bases.size()); + std::vector::const_iterator miter; + miter=_typeList[ind].bases.begin(); + int n_memb=0; + while(miter != _typeList[ind].bases.end()) + { + type_list[ind].bases[n_memb]=CORBA::string_dup(miter->c_str()); + miter++; + n_memb++; + } + } + else if(_typeList[ind].kind=="sequence") + { + type_list[ind].kind=SALOME_ModuleCatalog::Seq; + type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str()); + } + else if(_typeList[ind].kind=="array") + { + type_list[ind].kind=SALOME_ModuleCatalog::Array; + type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str()); + } + else if(_typeList[ind].kind=="struct") + { + type_list[ind].kind=SALOME_ModuleCatalog::Struc; + //members + type_list[ind].members.length(_typeList[ind].members.size()); + + std::vector< std::pair >::const_iterator miter; + miter=_typeList[ind].members.begin(); + int n_memb=0; + while(miter != _typeList[ind].members.end()) + { + type_list[ind].members[n_memb].name=CORBA::string_dup(miter->first.c_str()); + type_list[ind].members[n_memb].type=CORBA::string_dup(miter->second.c_str()); + n_memb++; + miter++; + } + } + } + return type_list._retn(); +} + //---------------------------------------------------------------------- // Function : GetComputerList // Purpose : get a computer list @@ -414,7 +519,7 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT if (_personal_module_list[ind].type == _temp_component_type) { _list_typed_component->length(_j + 1); - _list_typed_component[_j] = (_moduleList[ind].name).c_str(); + _list_typed_component[_j] = _personal_module_list[ind].name.c_str(); //if(MYDEBUG) SCRUTE(_list_typed_component[_j]); _j++; } @@ -480,7 +585,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) std::string s(name); ParserComponent *C_parser = NULL; - //ParserPathPrefixes *pp = NULL; // VSR : commented : unused variable + //ParserPathPrefixes *pp = NULL; SALOME_ModuleCatalog::Acomponent_ptr compo = SALOME_ModuleCatalog::Acomponent::_nil(); @@ -489,7 +594,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) // DebugParserComponent(*C_parser); - SALOME_ModuleCatalog::Component C_corba; + SALOME_ModuleCatalog::ComponentDef C_corba; duplicate(C_corba, *C_parser); @@ -508,7 +613,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) return compo; } -SALOME_ModuleCatalog::Component * +SALOME_ModuleCatalog::ComponentDef * SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) { std::string s(name); @@ -517,8 +622,8 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) if (C_parser) { - SALOME_ModuleCatalog::Component * C_corba - = new SALOME_ModuleCatalog::Component; + SALOME_ModuleCatalog::ComponentDef * C_corba + = new SALOME_ModuleCatalog::ComponentDef; duplicate(*C_corba, *C_parser); return C_corba; } @@ -526,6 +631,16 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) return NULL; } +CORBA::Long SALOME_ModuleCatalogImpl::getPID() +{ + return (CORBA::Long)getpid(); +} + +void SALOME_ModuleCatalogImpl::ShutdownWithExit() +{ + exit( EXIT_SUCCESS ); +} + ParserComponent * SALOME_ModuleCatalogImpl::findComponent(const string & name) { @@ -565,22 +680,39 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name) void SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, ParserComponents& modulelist, - ParserPathPrefixes& pathList) + ParserPathPrefixes& pathList, + ParserTypes& typeMap, + TypeList& typeList) { if(MYDEBUG) BEGIN_OF("_parse_xml_file"); if(MYDEBUG) SCRUTE(file); - SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(); - QFile xmlFile(file); + //Local path and module list for the file to parse + ParserPathPrefixes _pathList; + ParserComponents _moduleList; + + SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(_pathList,_moduleList,typeMap,typeList); - QXmlInputSource source(&xmlFile); - - QXmlSimpleReader reader; - reader.setContentHandler( handler ); - reader.setErrorHandler( handler ); - reader.parse( source ); - xmlFile.close(); + FILE* aFile = fopen(file, "r"); + if (aFile != NULL) + { + xmlDocPtr aDoc = xmlReadFile(file, NULL, 0); + + if (aDoc != NULL) + handler->ProcessXmlDocument(aDoc); + else + INFOS("ModuleCatalog: could not parse file "<shutdown(1); }; + void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }; private: //! method to parse one module catalog @@ -113,10 +121,13 @@ private: \param file const char* arguments \param modulelist ParserComponents arguments \param pathlist ParserPathPrefixes arguments + \param typeMap ParserTypes arguments */ virtual void _parse_xml_file(const char* file, ParserComponents & modulelist, - ParserPathPrefixes & pathlist); + ParserPathPrefixes & pathlist, + ParserTypes& typeMap, + TypeList& typeList); //! method to find component in the parser list /*! @@ -130,7 +141,7 @@ private: \param C_corba Component argument \param C_parser const ParserComponent argument */ - void duplicate(SALOME_ModuleCatalog::Component & C_corba, + void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba, const ParserComponent & C_parser); //! method to create a CORBA interface description from parser @@ -199,6 +210,8 @@ private: // These variables will contain the informations on the general common catalog ParserComponents _general_module_list ; ParserPathPrefixes _general_path_list ; + ParserTypes _typeMap; + TypeList _typeList; // These variables will contain the informations on the personal catalog ParserComponents _personal_module_list ; diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index 22fbc3c7d..eec18908d 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -132,10 +132,9 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef, // --- _current_context is replaced to the _root_context // if the Path begins whith '/' - if (Path[0] == '/') - { - _current_context = _root_context; - } + if (Path[0] == '/'){ + _current_context = _root_context; + } // --- the resolution of the directory path has to be done // to place the current_context to the correct node @@ -149,179 +148,158 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef, CORBA::Boolean not_exist = false; - if (dimension_resultat > 0) - { - // A directory is treated (not only an object name) - // test if the directory where ObjRef should be recorded already exists - // If not, create the new context - - try - { - CORBA::Object_var obj = _current_context->resolve(context_name); - _current_context = CosNaming::NamingContext::_narrow(obj); - } - - catch (CosNaming::NamingContext::NotFound &) - { - // --- failed to resolve, therefore assume cold start - not_exist = true; - } - - catch (CosNaming::NamingContext::InvalidName &) - { - INFOS("Register() : CosNaming::NamingContext::InvalidName"); - } - - catch (CosNaming::NamingContext::CannotProceed &) - { - INFOS("Register() : CosNaming::NamingContext::CannotProceed"); - } - - catch (CORBA::SystemException&) - { - INFOS("Register() : CORBA::SystemException: " - << "unable to contact the naming service"); - throw ServiceUnreachable(); - } - - if (not_exist) - { - try - { - context_name.length(1); - for (int i = 0 ; i < dimension_resultat ;i++) - { - context_name[0].id = - CORBA::string_dup(splitPath[i].c_str()); - context_name[0].kind = CORBA::string_dup("dir"); - // SCRUTE(_context_name[0].id); - // --- check if the path is created - try - { - // --- if the context is already created, nothing to do - CORBA::Object_var obj = - _current_context->resolve(context_name); - _current_context = - CosNaming::NamingContext::_narrow(obj); - } - - catch (CosNaming::NamingContext::NotFound &) - { - // --- the context must be created - CosNaming::NamingContext_var temp_context = - _current_context->bind_new_context(context_name); - _current_context = temp_context; - } - } - } - - catch (CosNaming::NamingContext::AlreadyBound&) - { - INFOS("Register() : CosNaming::NamingContext::AlreadyBound"); - } - - catch (CosNaming::NamingContext::NotFound& ex) - { - CosNaming::Name n = ex.rest_of_name; - - if (ex.why == CosNaming::NamingContext::missing_node) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind << ") not found"); + if (dimension_resultat > 0){ + // A directory is treated (not only an object name) + // test if the directory where ObjRef should be recorded already exists + // If not, create the new context + + try{ + CORBA::Object_var obj = _current_context->resolve(context_name); + _current_context = CosNaming::NamingContext::_narrow(obj); + } - if (ex.why == CosNaming::NamingContext::not_context) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind - << ") is not a context"); + catch (CosNaming::NamingContext::NotFound &){ + // --- failed to resolve, therefore assume cold start + not_exist = true; + } - if (ex.why == CosNaming::NamingContext::not_object) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind - << ") is not an object"); - } + catch (CosNaming::NamingContext::InvalidName &){ + INFOS("Register() : CosNaming::NamingContext::InvalidName"); + } - catch (CosNaming::NamingContext::CannotProceed&) - { - INFOS("Register(): CosNaming::NamingContext::CannotProceed"); - } + catch (CosNaming::NamingContext::CannotProceed &){ + INFOS("Register() : CosNaming::NamingContext::CannotProceed"); + } - catch (CosNaming::NamingContext::InvalidName&) - { - INFOS("Register(): CosNaming::NamingContext::InvalidName"); - } + catch (CORBA::SystemException&){ + INFOS("Register() : CORBA::SystemException: " + << "unable to contact the naming service"); + throw ServiceUnreachable(); + } - catch (CORBA::SystemException&) - { - INFOS("Register():CORBA::SystemException: " - << "unable to contact the naming service"); - throw ServiceUnreachable(); - } - } + if (not_exist){ + try{ + context_name.length(1); + for (int i = 0 ; i < dimension_resultat ;i++){ + context_name[0].id = CORBA::string_dup(splitPath[i].c_str()); + context_name[0].kind = CORBA::string_dup("dir"); + // SCRUTE(_context_name[0].id); + // --- check if the path is created + try{ + // --- if the context is already created, nothing to do + CORBA::Object_var obj = _current_context->resolve(context_name); + _current_context = CosNaming::NamingContext::_narrow(obj); + } + + catch (CosNaming::NamingContext::NotFound &){ + try{ + // --- the context must be created + CosNaming::NamingContext_var temp_context = + _current_context->bind_new_context(context_name); + _current_context = temp_context; + } + catch (CosNaming::NamingContext::AlreadyBound&){ + CORBA::Object_var obj = _current_context->resolve(context_name); + _current_context = CosNaming::NamingContext::_narrow(obj); + } + } + } + } + + catch (CosNaming::NamingContext::AlreadyBound&){ + INFOS("Register() : CosNaming::NamingContext::AlreadyBound"); + } + + catch (CosNaming::NamingContext::NotFound& ex){ + CosNaming::Name n = ex.rest_of_name; + + if (ex.why == CosNaming::NamingContext::missing_node) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind << ") not found"); + + if (ex.why == CosNaming::NamingContext::not_context) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind + << ") is not a context"); + + if (ex.why == CosNaming::NamingContext::not_object) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind + << ") is not an object"); + } + + catch (CosNaming::NamingContext::CannotProceed&){ + INFOS("Register(): CosNaming::NamingContext::CannotProceed"); + } + + catch (CosNaming::NamingContext::InvalidName&){ + INFOS("Register(): CosNaming::NamingContext::InvalidName"); + } + + catch (CORBA::SystemException&){ + INFOS("Register():CORBA::SystemException: " + << "unable to contact the naming service"); + throw ServiceUnreachable(); + } } + } // --- The current directory is now the directory where the object should // be recorded int sizePath = splitPath.size(); - if (sizePath > dimension_resultat) - { - ASSERT(sizePath == dimension_resultat+1); - context_name.length(1); + if (sizePath > dimension_resultat){ + ASSERT(sizePath == dimension_resultat+1); + context_name.length(1); - try - { - // --- the last element is an object and not a directory + try{ + // --- the last element is an object and not a directory - context_name[0].id = - CORBA::string_dup(splitPath[dimension_resultat].c_str()); - context_name[0].kind = CORBA::string_dup("object"); - //SCRUTE(context_name[0].id); + context_name[0].id = CORBA::string_dup(splitPath[dimension_resultat].c_str()); + context_name[0].kind = CORBA::string_dup("object"); + //SCRUTE(context_name[0].id); - _current_context->bind(context_name, ObjRef); - } + _current_context->bind(context_name, ObjRef); + } - catch (CosNaming::NamingContext::NotFound& ex) - { - CosNaming::Name n = ex.rest_of_name; + catch (CosNaming::NamingContext::NotFound& ex){ + CosNaming::Name n = ex.rest_of_name; - if (ex.why == CosNaming::NamingContext::missing_node) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind << ") not found"); + if (ex.why == CosNaming::NamingContext::missing_node) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind << ") not found"); - if (ex.why == CosNaming::NamingContext::not_context) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind - << ") is not a context"); + if (ex.why == CosNaming::NamingContext::not_context) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind + << ") is not a context"); - if (ex.why == CosNaming::NamingContext::not_object) - INFOS("Register() : " << (char *) n[0].id - << " (" << (char *) n[0].kind - << ") is not an object"); - } + if (ex.why == CosNaming::NamingContext::not_object) + INFOS("Register() : " << (char *) n[0].id + << " (" << (char *) n[0].kind + << ") is not an object"); + } - catch (CosNaming::NamingContext::CannotProceed&) - { - INFOS("Register(): CosNaming::NamingContext::CannotProceed"); - } + catch (CosNaming::NamingContext::CannotProceed&){ + INFOS("Register(): CosNaming::NamingContext::CannotProceed"); + } - catch (CosNaming::NamingContext::InvalidName&) - { - INFOS("Register(): CosNaming::NamingContext::InvalidName"); - } + catch (CosNaming::NamingContext::InvalidName&){ + INFOS("Register(): CosNaming::NamingContext::InvalidName"); + } - catch (CosNaming::NamingContext::AlreadyBound&) - { - INFOS("Register(): CosNaming::NamingContext::AlreadyBound, " - << "object will be rebind"); - _current_context->rebind(context_name, ObjRef); - } + catch (CosNaming::NamingContext::AlreadyBound&){ + INFOS("Register(): CosNaming::NamingContext::AlreadyBound, " + << "object will be rebind"); + _current_context->rebind(context_name, ObjRef); + } - catch (CORBA::SystemException&) - { - INFOS("!!!Register(): CORBA::SystemException: " - << "unable to contact the naming service"); - throw ServiceUnreachable(); - } + catch (CORBA::SystemException&){ + INFOS("!!!Register(): CORBA::SystemException: " + << "unable to contact the naming service"); + throw ServiceUnreachable(); } + } } // ============================================================================ @@ -1119,10 +1097,12 @@ throw(ServiceUnreachable) vector dirList ; - string currentDir = Current_Directory(); + char* currentDir = Current_Directory(); _list_directory_recurs(dirList, "", currentDir); + free(currentDir); + return dirList; } @@ -1708,7 +1688,8 @@ _current_directory(vector& splitPath, { // --- directory, search in it - splitPath.push_back(CORBA::string_dup(bindingName[0].id)); + const char* bindingNameid=bindingName[0].id; + splitPath.push_back(bindingNameid); lengthResult++; CORBA::Object_var obj = _current_context->resolve(bindingName); diff --git a/src/NamingService/SALOME_NamingServicePy.py b/src/NamingService/SALOME_NamingServicePy.py index c6aa57d95..e4a44d309 100644 --- a/src/NamingService/SALOME_NamingServicePy.py +++ b/src/NamingService/SALOME_NamingServicePy.py @@ -37,7 +37,7 @@ from string import * from SALOME_utilities import * #============================================================================= -class SALOME_NamingServicePy_i: +class SALOME_NamingServicePy_i(object): _orb = None _root_context=None _current_context=None @@ -71,8 +71,15 @@ class SALOME_NamingServicePy_i: if steps == 0 and self._root_context is None: MESSAGE ( "Name Service Reference is invalid" ) sys.exit(1) + #------------------------------------------------------------------------- + def Register(self,ObjRef, Path): + """ ns.Register(object,pathname ) + + register a CORBA object under a pathname + """ + MESSAGE ( "SALOME_NamingServicePy_i::Register" ) _not_exist = 0 path_list = list(Path) @@ -135,9 +142,13 @@ class SALOME_NamingServicePy_i: except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" ) - #------------------------------------------------------------------------- + def Resolve(self, Path): + """ ns.Resolve(pathname) -> object + + find a CORBA object (ior) by its pathname + """ #MESSAGE ( "SALOME_NamingServicePy_i::Resolve" ) path_list = list(Path) if path_list[0]=='/': @@ -167,8 +178,8 @@ class SALOME_NamingServicePy_i: return self._obj - #------------------------------------------------------------------------- + def Create_Directory(self,ObjRef, Path): MESSAGE ( "SALOME_NamingServicePy_i::Create_Directory" ) _not_exist = 0 diff --git a/src/NamingService/Test/TestNamingService.py b/src/NamingService/Test/TestNamingService.py index 2bc32efe9..f41e7689d 100644 --- a/src/NamingService/Test/TestNamingService.py +++ b/src/NamingService/Test/TestNamingService.py @@ -18,13 +18,14 @@ # import sys, os,signal,string,commands import runSalome +import setenv import orbmodule import TestKiller # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # set environment for trace in logger # (with file, servers may be killed before the write to the file...) diff --git a/src/ParallelContainer/Makefile.am b/src/ParallelContainer/Makefile.am index 0e04b8a16..1734d4f10 100644 --- a/src/ParallelContainer/Makefile.am +++ b/src/ParallelContainer/Makefile.am @@ -33,7 +33,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # # header files salomeinclude_HEADERS = SALOME_ParallelComponent_i.hxx \ - SALOME_ParallelContainer_i.hxx + SALOME_ParallelContainer_i.hxx \ + Parallel_Salome_file_i.hxx # # =============================================================== @@ -49,6 +50,7 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/NamingService \ -I$(top_srcdir)/src/Registry \ -I$(top_srcdir)/src/Utils \ + -I$(srcdir)/../HDFPersist \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ -I$(top_srcdir)/src/SALOMETraceCollector \ @@ -58,7 +60,9 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS = $(top_builddir)/src/Container/libSalomeContainer.la \ + $(top_builddir)/src/HDFPersist/libSalomeHDFPersist.la \ $(top_builddir)/idl/libSalomeParallelIDLKernel.la \ + $(top_builddir)/idl/libSalomeIDLKernel.la \ @CORBA_LIBS@ \ @PACO_LIBS@ @@ -70,7 +74,9 @@ COMMON_LIBS = $(top_builddir)/src/Container/libSalomeContainer.la \ lib_LTLIBRARIES = libSalomeParallelContainer.la libSalomeParallelContainer_la_SOURCES = SALOME_ParallelComponent_i.cxx \ - SALOME_ParallelContainer_i.cxx + SALOME_ParallelContainer_i.cxx \ + $(top_srcdir)/src/Container/Salome_file_i.cxx \ + Parallel_Salome_file_i.cxx libSalomeParallelContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS) @@ -96,22 +102,28 @@ bin_PROGRAMS = SALOME_ParallelContainerProxyDummy \ SALOME_ParallelContainerProxyDummy_SOURCES = SALOME_ParallelContainerProxyDummy.cxx SALOME_ParallelContainerProxyDummy_CXXFLAGS = $(COMMON_CPPFLAGS) SALOME_ParallelContainerProxyDummy_LDADD = libSalomeParallelContainer.la \ - -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread + -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread \ + $(COMMON_LIBS) SALOME_ParallelContainerNodeDummy_SOURCES = SALOME_ParallelContainerNodeDummy.cxx SALOME_ParallelContainerNodeDummy_CXXFLAGS = $(COMMON_CPPFLAGS) SALOME_ParallelContainerNodeDummy_LDADD = libSalomeParallelContainer.la \ - -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread + -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread \ + $(COMMON_LIBS) SALOME_ParallelContainerProxyMpi_SOURCES = SALOME_ParallelContainerProxyMpi.cxx SALOME_ParallelContainerProxyMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@ SALOME_ParallelContainerProxyMpi_LDADD = libSalomeParallelContainer.la \ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \ - @MPI_LIBS@ + @MPI_LIBS@ \ + $(COMMON_LIBS) + SALOME_ParallelContainerNodeMpi_SOURCES = SALOME_ParallelContainerNodeMpi.cxx SALOME_ParallelContainerNodeMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@ SALOME_ParallelContainerNodeMpi_LDADD = libSalomeParallelContainer.la \ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \ - @MPI_LIBS@ + @MPI_LIBS@\ + $(COMMON_LIBS) + diff --git a/src/ParallelContainer/Parallel_Salome_file_i.cxx b/src/ParallelContainer/Parallel_Salome_file_i.cxx new file mode 100644 index 000000000..ac06b5005 --- /dev/null +++ b/src/ParallelContainer/Parallel_Salome_file_i.cxx @@ -0,0 +1,358 @@ +// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : Parallel_Salome_file_i.cxx +// Author : André RIBES, EDF +// Module : SALOME +// $Header: + +#include "Parallel_Salome_file_i.hxx" +#include "utilities.h" + +Parallel_Salome_file_i::Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior) : + InterfaceParallel_impl(orb,ior), + Engines::Salome_file_serv(orb,ior), + Engines::fileTransfer_serv(orb,ior), + Engines::Parallel_Salome_file_serv(orb,ior) +{ + CORBA::Object_ptr obj = _orb->string_to_object(ior); + proxy = Engines::Parallel_Salome_file::_narrow(obj); + parallel_file = NULL; +} + +Parallel_Salome_file_i::~Parallel_Salome_file_i() {} + +void +Parallel_Salome_file_i::load(const char* hdf5_file) { + MESSAGE("Parallel_Salome_file_i::load : NOT YET IMPLEMENTED"); + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "Parallel_Salome_file_i::load : NOT YET IMPLEMENTED"; + throw SALOME::SALOME_Exception(es); +} + +void +Parallel_Salome_file_i::save(const char* hdf5_file) { + MESSAGE("Parallel_Salome_file_i::save : NOT YET IMPLEMENTED"); + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "Parallel_Salome_file_i::save : NOT YET IMPLEMENTED"; + throw SALOME::SALOME_Exception(es); +} + +void +Parallel_Salome_file_i::save_all(const char* hdf5_file) { + MESSAGE("Parallel_Salome_file_i::save_all : NOT YET IMPLEMENTED"); + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "Parallel_Salome_file_i::save_all : NOT YET IMPLEMENTED"; + throw SALOME::SALOME_Exception(es); +} + +void +Parallel_Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) { + // only one file managed case + Salome_file_i::connect(source_Salome_file); + + // Test if the file is managed in an another node + // If yes, node is updated + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) { + std::string file_name = begin->first; + if (_fileManaged[file_name].node > 0 && getMyRank() == 0) { + if (parallel_file == NULL) + parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb); + parallel_file->connect(source_Salome_file, _fileManaged[file_name].node); + } + } +} + +void +Parallel_Salome_file_i::connectDistributedFile(const char * file_name, + Engines::Salome_file_ptr source_Salome_file) { + Salome_file_i::connectDistributedFile(file_name, source_Salome_file); + + // Test if the file is managed in an another node + // If yes, node is updated + std::string fname(file_name); + if (_fileManaged[fname].node > 0 && getMyRank() == 0) { + if (parallel_file == NULL) + parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb); + parallel_file->connectDistributedFile(file_name, source_Salome_file, _fileManaged[fname].node); + } +} + +void +Parallel_Salome_file_i::setDistributedSourceFile(const char* file_name, + const char * source_file_name) { + Salome_file_i::setDistributedSourceFile(file_name, source_file_name); + // Test if the file is managed in an another node + // If yes, node is updated + std::string fname(file_name); + if (_fileManaged[fname].node > 0 && getMyRank() == 0) { + if (parallel_file == NULL) + parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb); + parallel_file->setDistributedSourceFile(file_name, source_file_name, _fileManaged[fname].node); + } +} + +void +Parallel_Salome_file_i::recvFiles() { + if (parallel_file == NULL) + parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb); + + std::string files_not_ok(""); + int total = getTotalNode(); + for (int i =0; irecvFiles_node(i); + } + catch (SALOME::SALOME_Exception & ex) { + files_not_ok = files_not_ok + std::string(ex.details.text.in()); + } + } + + if (files_not_ok != "") + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "files not ready : " + files_not_ok; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + else + { + // We change the state of the Salome_file + _state.files_ok = true; + } +} + +void +Parallel_Salome_file_i::recvFiles_node() { + + std::string files_not_ok(""); + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) + { + bool result = true; + Engines::file file_infos = begin->second; + if (file_infos.node == getMyRank()) { + // Test if the file is local or distributed + if (std::string(file_infos.type.in()) == "local") + { + if (std::string(file_infos.status.in()) == "not_ok") + result = checkLocalFile(file_infos.file_name.in()); + } + else + { + if (std::string(file_infos.status.in()) == "not_ok") { + // 2 cases : + // Source file is a Salome_file + // Source file is a Parallel_Salome_file + PaCO::ParallelKernel_var interface_manager = + PaCO::ParallelKernel::_narrow(_fileDistributedSource[file_infos.file_name.in()]); + if (CORBA::is_nil(interface_manager)) + result = getDistributedFile(file_infos.file_name.in()); + else + result = getParallelDistributedFile(file_infos.file_name.in()); + } + } + // if the result is false + // we add this file to files_not_ok + if (!result) + { + files_not_ok.append(" "); + files_not_ok.append(file_infos.file_name.in()); + } + } + } + if (files_not_ok != "") + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = files_not_ok; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } +} + +bool +Parallel_Salome_file_i::getParallelDistributedFile(std::string file_name) { + + bool result = true; + const char * source_file_name = _fileManaged[file_name].source_file_name.in(); + int fileId; + FILE* fp; + std::string comp_file_name(_fileManaged[file_name].path.in()); + comp_file_name.append("/"); + comp_file_name.append(_fileManaged[file_name].file_name.in()); + + // Test if the process can write on disk + if ((fp = fopen(comp_file_name.c_str(),"wb")) == NULL) + { + INFOS("file " << comp_file_name << " cannot be open for writing"); + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + result = false; + return result; + } + + Engines::PaCO_Parallel_Salome_file * parallel_source_file = + Engines::PaCO_Parallel_Salome_file::PaCO_narrow(_fileDistributedSource[file_name], _orb); + + int node = parallel_source_file->getFileNode(source_file_name); + + try + { + fileId = parallel_source_file->open(source_file_name, node); + } + catch (...) + { + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + fclose(fp); + result = false; + return result; + } + + if (fileId > 0) + { + Engines::fileBlock* aBlock; + int toFollow = 1; + int ctr=0; + MESSAGE("begin of transfer of " << comp_file_name); + while (toFollow) + { + ctr++; + aBlock = parallel_source_file->getBlock(fileId, node); + toFollow = aBlock->length(); + CORBA::Octet *buf = aBlock->get_buffer(); + int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); + ASSERT(nbWri == toFollow); + } + fclose(fp); + MESSAGE("end of transfer of " << comp_file_name); + parallel_source_file->close(fileId, node); + } + else + { + INFOS("open reference file for copy impossible"); + result = false; + fclose(fp); + _fileManaged[file_name].status = CORBA::string_dup("not_ok"); + return result; + } + + _fileManaged[file_name].status = CORBA::string_dup("ok"); + return result; +} + +void +Parallel_Salome_file_i::setContainer(Engines::Container_ptr container) { + _container = Engines::Container::_duplicate(container); + + // Update All the files managed by the node + _t_fileManaged::iterator begin = _fileManaged.begin(); + _t_fileManaged::iterator end = _fileManaged.end(); + for(;begin!=end;begin++) { + begin->second.container = Engines::Container::_duplicate(container); + } +} + +void +Parallel_Salome_file_i::setFileNode(const char* file_name, CORBA::Long node) { + + // Test if this file is managed + std::string fname(file_name); + _t_fileManaged::iterator it = _fileManaged.find(fname); + if (it == _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "file is not managed"; + throw SALOME::SALOME_Exception(es); + } + + // Update file infos into this node (node 0) + // and into the node that actually managed it + _fileManaged[fname].node = node; + + if (node > 0) { + if (parallel_file == NULL) + parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb); + + Engines::Container_ptr cont = parallel_file->updateFile(_fileManaged[fname], node); + parallel_file->connectDistributedFile(fname.c_str(), + _fileDistributedSource[fname], + node); + + // Update file infos with the new reference of the container + _fileManaged[fname].container = Engines::Container::_duplicate(cont); + } +} + +Engines::Container_ptr +Parallel_Salome_file_i::updateFile(const Engines::file& file) { + // Copy file + Engines::file new_file_infos(file); + + // Adding it to node list + new_file_infos.container = Engines::Container::_duplicate(_container); + std::string fname(new_file_infos.file_name.in()); + _fileManaged[fname] = new_file_infos; + + // Return the new reference of the container associated to the file + return Engines::Container::_duplicate(_container); +} + +CORBA::Long +Parallel_Salome_file_i::getFileNode(const char* file_name) { + + // Test if this file is managed + std::string fname(file_name); + if (fname == "") { + // We enter in the simple case where the user + // has not used setDistributedSourceFile. + // In this case we try to see if the Salome_file + if (_fileManaged.size() == 1) + { + // only one file managed + _t_fileManaged::iterator it = _fileManaged.begin(); + fname = it->first; + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "Error : there is more than one file that is managed"; + throw SALOME::SALOME_Exception(es); + } + } + _t_fileManaged::iterator it = _fileManaged.find(fname); + if (it == _fileManaged.end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "file is not managed"; + throw SALOME::SALOME_Exception(es); + } + + return _fileManaged[fname].node; +} diff --git a/src/ParallelContainer/Parallel_Salome_file_i.hxx b/src/ParallelContainer/Parallel_Salome_file_i.hxx new file mode 100644 index 000000000..c3814a5c4 --- /dev/null +++ b/src/ParallelContainer/Parallel_Salome_file_i.hxx @@ -0,0 +1,74 @@ +// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : Parallel_Salome_file_i.hxx +// Author : André RIBES, EDF +// Module : SALOME +// $Header: + +#ifndef _PARALLEL_SALOME_FILE_I_HXX_ +#define _PARALLEL_SALOME_FILE_I_HXX_ + +#include +#include +#include +#include + +#include "SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.h" +#include "Salome_file_i.hxx" + +class CONTAINER_EXPORT Parallel_Salome_file_i: + public virtual Salome_file_i, + public virtual Engines::Parallel_Salome_file_serv +{ + public: + Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior); + virtual ~Parallel_Salome_file_i(); + + virtual void setFileNode(const char* file_name, CORBA::Long node); + virtual CORBA::Long getFileNode(const char* file_name); + virtual Engines::Container_ptr updateFile(const Engines::file& file); + + // New implementation for these methods + // For the parallel cases + virtual void load(const char* hdf5_file); + virtual void save(const char* hdf5_file); + virtual void save_all(const char* hdf5_file); + virtual void connect(Engines::Salome_file_ptr source_Salome_file); + virtual void connectDistributedFile(const char * file_name, + Engines::Salome_file_ptr source_Salome_file); + virtual void setDistributedSourceFile(const char* file_name, + const char * source_file_name); + virtual void recvFiles(); + virtual void recvFiles_node(); + virtual void setContainer(Engines::Container_ptr container); + //virtual void removeFile(const char* file_name); + //virtual void removeFiles(); + + // Local C++ methods + virtual bool getParallelDistributedFile(std::string file_name); + + private : + Engines::Parallel_Salome_file_var proxy; + Engines::PaCO_Parallel_Salome_file * parallel_file; +}; + +#endif + diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx index ddcd47d80..db60ae5e4 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx @@ -43,6 +43,7 @@ int SIGUSR11 = 1000; #endif +#include using namespace std; @@ -59,7 +60,7 @@ bool Engines_Parallel_Component_i::_isMultiInstance = false; //============================================================================= Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior) : - InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior) + InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior), Engines::Parallel_Component_serv(orb,ior) { //ASSERT(0); INFOS("Default Constructor..."); @@ -84,7 +85,9 @@ Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, c const char *instanceName, const char *interfaceName, bool notif) : - InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior), + InterfaceParallel_impl(orb,ior), + Engines::Component_serv(orb,ior), + Engines::Parallel_Component_serv(orb,ior), _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), @@ -106,7 +109,11 @@ Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, c _instanceName.c_str()); _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); - //SCRUTE(pd_refCount); + + deploy_mutex = new pthread_mutex_t(); + pthread_mutex_init(deploy_mutex, NULL); + _proxy = NULL; + //SCRUTE(pd_refCount); } //============================================================================= @@ -121,6 +128,11 @@ Engines_Parallel_Component_i::~Engines_Parallel_Component_i() { MESSAGE("Component destructor"); Engines_Parallel_Container_i::decInstanceCnt(_interfaceName); + pthread_mutex_destroy(deploy_mutex); + delete deploy_mutex; + + if (_proxy) + delete _proxy; } //============================================================================= @@ -567,7 +579,8 @@ void Engines_Parallel_Component_i::beginService(const char *serviceName) (*it).second >>= value; // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC. #if defined __GNUC__ - int ret = setenv(cle.c_str(), value, overwrite); + //int ret = setenv(cle.c_str(), value, overwrite); + setenv(cle.c_str(), value, overwrite); #else //CCRT porting : setenv not defined in stdlib.h std::string s(cle); @@ -575,7 +588,8 @@ void Engines_Parallel_Component_i::beginService(const char *serviceName) s+=value; // char* cast because 1st arg of linux putenv function // is not a const char* ! - int ret=putenv((char *)s.c_str()); + //int ret=putenv((char *)s.c_str()); + putenv((char *)s.c_str()); //End of CCRT porting #endif MESSAGE("--- setenv: "<find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + + // We create a new PaCO++ object. + // He has the same configuration than + // his component + + // Firstly, we have to create the proxy object + // of the Salome_file and transmit his + // reference to the other nodes. + if (getMyRank() == 0) { + Engines::Parallel_Salome_file_proxy_impl * proxy = + new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb)); + PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context"); + // We initialize the object with the context of the Parallel component + PaCO_operation * compo_global_ptr = getContext("global_paco_context"); + //compo_global_ptr->init_context(proxy_global_ptr); + proxy_global_ptr->init_context(compo_global_ptr); + + paco_fabrique_manager* pfm = paco_getFabriqueManager(); + pfm->register_com("dummy", new paco_dummy_fabrique()); + proxy_global_ptr->setComFab(NULL); + proxy_global_ptr->setLibCom("dummy",NULL); + + proxy_global_ptr->setTypeClient(true); + PaCO::PacoTopology_t client_topo; + client_topo.total = 1; + proxy_global_ptr->setClientTopo(client_topo); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = getTotalNode(); + proxy->setTopo(serveur_topo); + + // We register the CORBA objet into the POA + CORBA::Object_ptr proxy_ref = proxy->_this(); + + // We send the reference to all the nodes... + CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str()); + Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy); + component_proxy->send_parallel_proxy_object(proxy_ref); + + // Adding proxy into the map + (*_proxy_map)[Salome_file_name] = proxy; + } + else { + this->wait_parallel_object_proxy(); + } + + proxy_ior = this->get_parallel_proxy_object(); + (*_IOR_proxy_map)[Salome_file_name] = proxy_ior; + + // We register each node of the parallel Salome_file object + // into the proxy. + for (int i = 0; i < getTotalNode(); i++) { + if (i == getMyRank()) { + Parallel_Salome_file_i * servant = + new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str()); + PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context"); + + // We initialize the object with the context of the Parallel component + PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); +// compo_global_ptr->init_context(servant_global_ptr); + servant_global_ptr->init_context(compo_global_ptr); + + // We register the CORBA objet into the POA + servant->POA_PaCO::InterfaceParallel::_this(); + + // Register the servant + servant->deploy(getMyRank()); + + // Adding servant to the map + (*_map)[Salome_file_name] = servant; + } + + PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); + compo_global_ptr->my_com->paco_barrier(); + } + + // Parallel_Salome_file is created and deployed + delete _proxy; + _proxy = NULL; + } + pthread_mutex_unlock(deploy_mutex); + proxy_ior = (*_IOR_proxy_map)[Salome_file_name]; + CORBA::Object_ptr proxy_ref = _orb->string_to_object(proxy_ior.c_str()); + return Engines::Salome_file::_narrow(proxy_ref); +} + +Engines::Salome_file_ptr +Engines_Parallel_Component_i::setOutputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we add it. + _Service_file_map_it = _Output_Service_file_map.find(service_name); + if (_Service_file_map_it == _Output_Service_file_map.end()) { + _t_Salome_file_map * _map = new _t_Salome_file_map(); + _Output_Service_file_map[service_name] = _map; + _t_Proxy_Salome_file_map * _proxy_map = new _t_Proxy_Salome_file_map(); + _Proxy_Output_Service_file_map[service_name] = _proxy_map; + _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = new _t_IOR_Proxy_Salome_file_map(); + _IOR_Proxy_Output_Service_file_map[service_name] = _IOR_proxy_map; + } + _t_Salome_file_map * _map = _Output_Service_file_map[service_name]; + _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Output_Service_file_map[service_name]; + _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Output_Service_file_map[service_name]; + + pthread_mutex_lock(deploy_mutex); + std::string proxy_ior; + + // Try to find the Salome_file ... + _Salome_file_map_it = _map->find(Salome_file_name); + if (_Salome_file_map_it == _map->end()) { + + // We create a new PaCO++ object. + // He has the same configuration than + // his component + + // Firstly, we have to create the proxy object + // of the Salome_file and transmit his + // reference to the other nodes. + if (getMyRank() == 0) { + Engines::Parallel_Salome_file_proxy_impl * proxy = + new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb)); + PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context"); + // We initialize the object with the context of the Parallel component + PaCO_operation * compo_global_ptr = getContext("global_paco_context"); + //compo_global_ptr->init_context(proxy_global_ptr); + proxy_global_ptr->init_context(compo_global_ptr); + + paco_fabrique_manager* pfm = paco_getFabriqueManager(); + pfm->register_com("dummy", new paco_dummy_fabrique()); + proxy_global_ptr->setComFab(NULL); + proxy_global_ptr->setLibCom("dummy",NULL); + + proxy_global_ptr->setTypeClient(true); + PaCO::PacoTopology_t client_topo; + client_topo.total = 1; + proxy_global_ptr->setClientTopo(client_topo); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = getTotalNode(); + proxy->setTopo(serveur_topo); + + // We register the CORBA objet into the POA + CORBA::Object_ptr proxy_ref = proxy->_this(); + + // We send the reference to all the nodes... + CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str()); + Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy); + component_proxy->send_parallel_proxy_object(proxy_ref); + + // Adding proxy into the map + (*_proxy_map)[Salome_file_name] = proxy; + } + else { + this->wait_parallel_object_proxy(); + } + + proxy_ior = this->get_parallel_proxy_object(); + (*_IOR_proxy_map)[Salome_file_name] = proxy_ior; + + // We register each node of the parallel Salome_file object + // into the proxy. + for (int i = 0; i < getTotalNode(); i++) { + if (i == getMyRank()) { + Parallel_Salome_file_i * servant = + new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str()); + PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context"); + + // We initialize the object with the context of the Parallel component + PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); +// compo_global_ptr->init_context(servant_global_ptr); + servant_global_ptr->init_context(compo_global_ptr); + + // We register the CORBA objet into the POA + servant->POA_PaCO::InterfaceParallel::_this(); + + // Register the servant + servant->deploy(getMyRank()); + + // Adding servant to the map + (*_map)[Salome_file_name] = servant; + } + + PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); + compo_global_ptr->my_com->paco_barrier(); + } + + // Parallel_Salome_file is created and deployed + delete _proxy; + _proxy = NULL; + } + pthread_mutex_unlock(deploy_mutex); + proxy_ior = (*_IOR_proxy_map)[Salome_file_name]; + CORBA::Object_ptr proxy_ref = _orb->string_to_object(proxy_ior.c_str()); + return Engines::Salome_file::_narrow(proxy_ref); +} + +Engines::Salome_file_ptr +Engines_Parallel_Component_i::getInputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we throw an exception. + _Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name); + if (_Proxy_Service_file_map_it == _Proxy_Input_Service_file_map.end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have salome files"; + throw SALOME::SALOME_Exception(es); + } + _t_Proxy_Salome_file_map * _map = _Proxy_Input_Service_file_map[service_name]; + + // Try to find the Salome_file ... + _Proxy_Salome_file_map_it = _map->find(Salome_file_name); + if (_Proxy_Salome_file_map_it == _map->end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have this Salome_file"; + throw SALOME::SALOME_Exception(es); + } + + // Client get the proxy object + Engines::Parallel_Salome_file_proxy_impl * Sfile = (*_map)[Salome_file_name]; + return Sfile->_this(); +} + +Engines::Salome_file_ptr +Engines_Parallel_Component_i::getOutputFileToService(const char* service_name, + const char* Salome_file_name) +{ + // Try to find the service, if it doesn't exist, we throw an exception. + _Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name); + if (_Proxy_Service_file_map_it == _Proxy_Output_Service_file_map.end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have salome files"; + throw SALOME::SALOME_Exception(es); + } + _t_Proxy_Salome_file_map * _map = _Proxy_Output_Service_file_map[service_name]; + + // Try to find the Salome_file ... + _Proxy_Salome_file_map_it = _map->find(Salome_file_name); + if (_Proxy_Salome_file_map_it == _map->end()) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "service doesn't have this Salome_file"; + throw SALOME::SALOME_Exception(es); + } + + // Client get the proxy object + Engines::Parallel_Salome_file_proxy_impl * Sfile = (*_map)[Salome_file_name]; + return Sfile->_this(); +} + + +void +Engines_Parallel_Component_i::checkInputFilesToService(const char* service_name) +{ + // Try to find the service, if it doesn't exist, nothing to do. + _Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name); + if (_Proxy_Service_file_map_it != _Proxy_Input_Service_file_map.end()) { + _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Input_Service_file_map[service_name]; + _t_Proxy_Salome_file_map::iterator begin = _proxy_map->begin(); + _t_Proxy_Salome_file_map::iterator end = _proxy_map->end(); + + for(;begin!=end;begin++) { + Engines::Parallel_Salome_file_proxy_impl * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); + file->recvFiles(); + } + } +} + +void +Engines_Parallel_Component_i::checkOutputFilesToService(const char* service_name) +{ + // Try to find the service, if it doesn't exist, nothing to do. + _Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name); + if (_Proxy_Service_file_map_it != _Proxy_Output_Service_file_map.end()) { + _t_Proxy_Salome_file_map * _map = _Proxy_Output_Service_file_map[service_name]; + _t_Proxy_Salome_file_map::iterator begin = _map->begin(); + _t_Proxy_Salome_file_map::iterator end = _map->end(); + + for(;begin!=end;begin++) { + Engines::Parallel_Salome_file_proxy_impl * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); + file->recvFiles(); + } + } + +} + +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= +void +Engines_Parallel_Component_i::send_parallel_proxy_object(CORBA::Object_ptr proxy_ref) { + _proxy = _orb->object_to_string(proxy_ref); +} + +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= +void +Engines_Parallel_Component_i::wait_parallel_object_proxy() { + char * proxy = NULL; + proxy = get_parallel_proxy_object(); + while(proxy == NULL) + { + sleep(1); + proxy = get_parallel_proxy_object(); + } +} + +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= +char * +Engines_Parallel_Component_i::get_parallel_proxy_object() { + return _proxy; +} + + +//============================================================================= +/*! + * C++ method: used to configure the Salome_file into the runtime. + * \param service_name name of the service that use this Salome_file + * \param file_port_name name of the Salome_file + * \param file Parallel Salome_file C++ object + */ +//============================================================================= +void +Engines_Parallel_Component_i::configureSalome_file(std::string service_name, + std::string file_port_name, + Engines::Parallel_Salome_file_proxy_impl * file) +{ + // By default this method does nothing +} + diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx index 07c3bb104..edadf93ce 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx @@ -37,10 +37,11 @@ #include #include -#include "SALOME_ComponentPaCO_Engines_Component_server.h" +#include "SALOME_ComponentPaCO_Engines_Parallel_Component_server.h" #include "NOTIFICATION.hxx" #include "RegistryConnexion.hxx" +#include "Parallel_Salome_file_i.hxx" class Engines_Parallel_Container_i; @@ -59,7 +60,7 @@ class Engines_Parallel_Container_i; #endif class CONTAINER_EXPORT Engines_Parallel_Component_i: - public virtual Engines::Component_serv, + public virtual Engines::Parallel_Component_serv, public virtual PortableServer::RefCountServantBase { public: @@ -98,6 +99,21 @@ public: CORBA::Boolean isPublished, CORBA::Boolean& isValidScript); + // CORBA operations for Salome_file + virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name, + const char* Salome_file_name); + virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name, + const char* Salome_file_name); + + virtual void checkInputFilesToService(const char* service_name); + virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name, + const char* Salome_file_name); + + virtual void checkOutputFilesToService(const char* service_name); + virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name, + const char* Salome_file_name); + + void send_parallel_proxy_object(CORBA::Object_ptr proxy_ref); // --- local C++ methods @@ -118,6 +134,13 @@ public: void SetCurCpu() ; long CpuUsed() ; + void wait_parallel_object_proxy(); + char * get_parallel_proxy_object(); + + virtual void configureSalome_file(std::string service_name, + std::string file_port_name, + Engines::Parallel_Salome_file_proxy_impl * file); + protected: int _studyId; // -1: not initialised; 0: multiStudy; >0: study static bool _isMultiStudy; @@ -135,10 +158,38 @@ protected: NOTIFICATION_Supplier* _notifSupplier; std::map_fieldsDict; + // Map Salome_file_name to Parallel_Salome_file* + typedef std::map _t_Salome_file_map; + typedef std::map _t_Proxy_Salome_file_map; + typedef std::map _t_IOR_Proxy_Salome_file_map; + + // Map Service_name to _Salome_file_map + typedef std::map _t_Service_file_map; + typedef std::map _t_Proxy_Service_file_map; + typedef std::map _t_IOR_Proxy_Service_file_map; + + _t_Service_file_map _Input_Service_file_map; + _t_Service_file_map _Output_Service_file_map; + _t_Service_file_map::iterator _Service_file_map_it; + _t_Salome_file_map::iterator _Salome_file_map_it; + + _t_Proxy_Service_file_map _Proxy_Input_Service_file_map; + _t_Proxy_Service_file_map _Proxy_Output_Service_file_map; + _t_Proxy_Service_file_map::iterator _Proxy_Service_file_map_it; + _t_Proxy_Salome_file_map::iterator _Proxy_Salome_file_map_it; + + _t_IOR_Proxy_Service_file_map _IOR_Proxy_Input_Service_file_map; + _t_IOR_Proxy_Service_file_map _IOR_Proxy_Output_Service_file_map; + _t_IOR_Proxy_Service_file_map::iterator _IOR_Proxy_Service_file_map_it; + _t_IOR_Proxy_Salome_file_map::iterator _IOR_Proxy_Salome_file_map_it; + std::string _serviceName ; std::string _graphName ; std::string _nodeName ; + pthread_mutex_t * deploy_mutex; + char * _proxy; + private: #ifndef WNT pthread_t _ThreadId ; diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx index f08a384c7..4f5d0d274 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx @@ -63,13 +63,63 @@ void handler(int t) { } #endif +typedef void (*sighandler_t)(int); +sighandler_t setsig(int sig, sighandler_t handler) +{ + struct sigaction context, ocontext; + context.sa_handler = handler; + sigemptyset(&context.sa_mask); + context.sa_flags = 0; + if (sigaction(sig, &context, &ocontext) == -1) + return SIG_ERR; + return ocontext.sa_handler; +} + +void AttachDebugger() +{ + if(getenv ("DEBUGGER")) + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_ParallelContainerNodeDummy " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } +} + +void Handler(int theSigId) +{ + std::cerr << "SIGSEGV: " << std::endl; + AttachDebugger(); + //to exit or not to exit + exit(1); +} + +void terminateHandler(void) +{ + std::cerr << "Terminate: not managed exception !" << std::endl; + AttachDebugger(); +} + +void unexpectedHandler(void) +{ + std::cerr << "Unexpected: unexpected exception !" << std::endl; + AttachDebugger(); +} + int main(int argc, char* argv[]) { INFOS("Launching a parallel container node"); #ifdef _DEBUG_ - signal(SIGSEGV, handler); +// signal(SIGSEGV, handler); #endif + if(getenv ("DEBUGGER")) + { + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } // Initialise the ORB. ORB_INIT &init = *SINGLETON_::Instance(); diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx index ce7b79f0f..4852bcafb 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx @@ -53,9 +53,18 @@ using namespace std; -#ifdef DEBUG_PARALLEL +#ifdef _DEBUG_ #include +void test(int sigval) { + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} +} + void handler(int t) { cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; @@ -66,19 +75,72 @@ void handler(int t) { } #endif +typedef void (*sighandler_t)(int); +sighandler_t setsig(int sig, sighandler_t handler) +{ + struct sigaction context, ocontext; + context.sa_handler = handler; + sigemptyset(&context.sa_mask); + context.sa_flags = 0; + if (sigaction(sig, &context, &ocontext) == -1) + return SIG_ERR; + return ocontext.sa_handler; +} + +void AttachDebugger() +{ + if(getenv ("DEBUGGER")) + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_ParallelContainerNodeMpi " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } +} + +void Handler(int theSigId) +{ + std::cerr << "SIGSEGV: " << std::endl; + AttachDebugger(); + //to exit or not to exit + exit(1); +} + +void terminateHandler(void) +{ + std::cerr << "Terminate: not managed exception !" << std::endl; + AttachDebugger(); +} + +void unexpectedHandler(void) +{ + std::cerr << "Unexpected: unexpected exception !" << std::endl; + AttachDebugger(); +} + int main(int argc, char* argv[]) { INFOS("Launching a parallel Mpi container node"); -#ifdef DEBUG_PARALLEL - signal(SIGSEGV, handler); +#ifdef _DEBUG_ +// struct sigaction action; +// action.sa_handler = &test; +// sigaction(SIGSEGV, &action, NULL); #endif // MPI Init int provided; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided); -#ifdef DEBUG_PARALLEL + if(getenv ("DEBUGGER")) + { + std::cerr << "Unexpected: unexpected exception !" << std::endl; + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } +#ifdef _DEBUG_ cerr << "Level MPI_THREAD_SINGLE : " << MPI_THREAD_SINGLE << endl; cerr << "Level MPI_THREAD_SERIALIZED : " << MPI_THREAD_SERIALIZED << endl; cerr << "Level MPI_THREAD_FUNNELED : " << MPI_THREAD_FUNNELED << endl; diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index f9f22e483..9fbf89e85 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -20,7 +20,7 @@ // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // File : SALOME_ParallelContainer_i.cxx -// Author : André RIBES, EDF +// Author : Andr� RIBES, EDF // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA #include @@ -704,7 +704,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, // in the nameing service. _numInstanceMutex.lock() ; // lock on the instance number _numInstance++ ; - int numInstance = _numInstance ; +// int numInstance = _numInstance ; _numInstanceMutex.unlock() ; } cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl; @@ -991,4 +991,33 @@ Engines_Parallel_Container_i::getFileTransfer() } +Engines::Salome_file_ptr +Engines_Parallel_Container_i::createSalome_file(const char* origFileName) +{ + string origName(origFileName); + if (CORBA::is_nil(_Salome_file_map[origName])) + { + Salome_file_i* aSalome_file = new Salome_file_i(); + try + { + aSalome_file->setLocalFile(origFileName); + aSalome_file->recvFiles(); + } + catch (const SALOME::SALOME_Exception& e) + { + return Engines::Salome_file::_nil(); + } + + Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil(); + theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) + _Salome_file_map[origName] = theSalome_file; + _numInstanceMutex.unlock() ; + } + + Engines::Salome_file_ptr theSalome_file = + Engines::Salome_file::_duplicate(_Salome_file_map[origName]); + ASSERT(!CORBA::is_nil(theSalome_file)); + return theSalome_file; +} diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 254d60740..962bc9a1d 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -129,6 +129,8 @@ public: Engines::fileRef_ptr createFileRef(const char* origFileName); Engines::fileTransfer_ptr getFileTransfer(); + + virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName); protected: static std::map _cntInstances_map; @@ -147,6 +149,7 @@ protected: int _numInstance ; std::map _listInstances_map; std::map _fileRef_map; + std::map _Salome_file_map; Engines::fileTransfer_var _fileTransfer; int _argc ; diff --git a/src/Registry/RegistryService.cxx b/src/Registry/RegistryService.cxx index 21524aa8d..52a3d1e9a 100644 --- a/src/Registry/RegistryService.cxx +++ b/src/Registry/RegistryService.cxx @@ -37,6 +37,8 @@ extern "C" #ifndef WNT #include +#else +#include #endif using namespace std; @@ -47,7 +49,7 @@ using namespace std; RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0) { MESSAGE("Passage dans RegistryService::RegistryService()") ; - + _orb = CORBA::ORB::_nil(); } @@ -257,5 +259,14 @@ void RegistryService::SessionName( const char *sessionName ) } void RegistryService::ping() { +#ifndef WNT MESSAGE(" RegistryService::ping() pid "<< getpid()); +#else + MESSAGE(" RegistryService::ping() pid "<< _getpid()); +#endif +} + +CORBA::Long RegistryService::getPID() +{ + return (CORBA::Long)getpid(); } diff --git a/src/Registry/RegistryService.hxx b/src/Registry/RegistryService.hxx index 21b31b6f5..9b26f41f8 100644 --- a/src/Registry/RegistryService.hxx +++ b/src/Registry/RegistryService.hxx @@ -72,6 +72,7 @@ public : virtual ~RegistryService(void); void ping(); + CORBA::Long getPID(); virtual CORBA::ULong add (const Registry::Infos & infos); virtual CORBA::ULong size ( void ); #ifndef WNT @@ -88,9 +89,13 @@ public : void SessionName( const char *sessionName ) ; + void SetOrb( CORBA::ORB_ptr orb ) { _orb = orb; return; } + + void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); } protected : + CORBA::ORB_var _orb; const char *_SessionName ; int _Compteur ; std::map _reg ; diff --git a/src/Registry/SALOME_Registry.hxx b/src/Registry/SALOME_Registry.hxx index 899bc5586..4ca01a2c7 100755 --- a/src/Registry/SALOME_Registry.hxx +++ b/src/Registry/SALOME_Registry.hxx @@ -44,4 +44,5 @@ #define REGISTRY_EXPORT #endif -#endif \ No newline at end of file +#endif + diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 7dc1b6817..50e608f31 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -168,6 +168,7 @@ int main( int argc , char **argv ) naming.init_orb( orb ) ; RegistryService *ptrRegistry = SINGLETON_::Instance() ; ptrRegistry->SessionName( ptrSessionName ) ; + ptrRegistry->SetOrb(orb); varComponents = ptrRegistry->_this() ; // The RegistryService must not already exist. @@ -186,15 +187,15 @@ int main( int argc , char **argv ) } string absoluteName = string("/") + registryName; naming.Register( varComponents , absoluteName.c_str() ) ; - MESSAGE("On attend les requetes des clients") ; + MESSAGE("Wait client requests") ; try { // Activation du POA - MESSAGE("Activation du POA") ; + MESSAGE("POA activation") ; manager->activate() ; // Lancement de l'ORB - MESSAGE("Lancement de l'ORB") ; + MESSAGE("ORB launching") ; #ifdef CHECKTIME Utils_Timer timer; timer.Start(); @@ -206,7 +207,7 @@ int main( int argc , char **argv ) } catch( const CORBA::Exception &ex ) { - MESSAGE("Erreur systeme") ; + MESSAGE("System error") ; return EXIT_FAILURE ; } diff --git a/src/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index 7770d4272..dbb5bb380 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -48,19 +48,22 @@ salomeinclude_HEADERS = \ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ + -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ + @LIBXML_INCLUDES@ \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../NamingService/libSalomeNS.la \ ../Utils/libOpUtil.la \ - $(top_builddir)/idl/libSalomeIDLKernel.la + $(top_builddir)/idl/libSalomeIDLKernel.la \ + @LIBXML_LIBS@ # # =============================================================== @@ -75,10 +78,9 @@ libSalomeResourcesManager_la_SOURCES =\ SALOME_ResourcesManager.cxx libSalomeResourcesManager_la_CPPFLAGS =\ - $(COMMON_CPPFLAGS) \ - @QT_INCLUDES@ + $(COMMON_CPPFLAGS) + libSalomeResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeResourcesManager_la_LIBADD =\ - $(COMMON_LIBS) \ - @QT_LIBS@ + $(COMMON_LIBS) diff --git a/src/ResourcesManager/SALOME_LoadRateManager.cxx b/src/ResourcesManager/SALOME_LoadRateManager.cxx index 527cade0a..f0df795cb 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.cxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.cxx @@ -34,7 +34,7 @@ string SALOME_LoadRateManager::FindFirst(const Engines::MachineList& hosts) return string(hosts[0]); } -string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns) +string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns) { MESSAGE("SALOME_LoadRateManager::FindNext " << hosts.length()); map machines; @@ -47,29 +47,43 @@ string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,SALOME ns->Change_Directory("/Containers"); vector vec = ns->list_directory_recurs(); - list lstCont; + Engines::Container_var cont; for(vector::iterator iter = vec.begin();iter!=vec.end();iter++){ - CORBA::Object_var obj=ns->Resolve((*iter).c_str()); - Engines::Container_var cont=Engines::Container::_narrow(obj); + try + { + CORBA::Object_var obj=ns->Resolve((*iter).c_str()); + cont=Engines::Container::_narrow(obj); + } + catch(CORBA::SystemException& ex) + { + MESSAGE("SALOME_LoadRateManager::FindNext CORBA::SystemException ignore it"); + continue; + } if(!CORBA::is_nil(cont)){ - lstCont.push_back((*iter)); - } - } - for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ - CORBA::Object_var obj=ns->Resolve((*iter).c_str()); - Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)){ - string mach = cont->getHostName(); - machines[mach]++; + try + { + CORBA::String_var hostname = cont->getHostName(); + std::string mach=(const char*)hostname; + machines[mach]++; + } + catch(CORBA::SystemException& ex) + { + MESSAGE("SALOME_LoadRateManager::FindNext CORBA::SystemException ignore it"); + continue; + } } } int imin = 0; - int min = machines[string(hosts[0])]; + ParserResourcesType resource = resList[string(hosts[0])]; + int nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes; + int min = machines[string(hosts[0])]/nbproc; for(int i=1;i #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) #include +#include "SALOME_ResourcesCatalog_Parser.hxx" #include "SALOME_NamingService.hxx" #if defined RESOURCESMANAGER_EXPORTS @@ -44,7 +45,7 @@ class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager public: std::string FindFirst(const Engines::MachineList& hosts); - std::string FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns); + std::string FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns); std::string FindBest(const Engines::MachineList& hosts) throw (SALOME_Exception); }; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index e6c68b858..58eb63d01 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -29,11 +29,16 @@ #include "SALOME_ResourcesCatalog_Handler.hxx" #include #include -#include #include "utilities.h" using namespace std; +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + //============================================================================= /*! * Constructor @@ -54,12 +59,12 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources): test_alias = "alias"; test_protocol = "protocol"; test_mode = "mode"; + test_batch = "batch"; + test_mpi = "mpi"; test_user_name = "userName"; test_appli_path = "appliPath"; test_modules = "modules"; test_module_name = "moduleName"; - test_module_path = "modulePath"; - test_pre_req_file_path = "preReqFilePath"; test_os = "OS"; test_mem_in_mb = "memInMB"; test_cpu_freq_mhz = "CPUFreqMHz"; @@ -86,331 +91,319 @@ SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler() const MapOfParserResourcesType& SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const - { - return _resources_list; - } - -//============================================================================= -/*! - * Overload handler function startDocument. - * Called before an xml file is parsed. - * Clears the list of resources. - * \return true (if no error detected...) - */ -//============================================================================= - -bool SALOME_ResourcesCatalog_Handler::startDocument() { - // MESSAGE("Begin parse document"); - - // --- Empty private elements - - _resources_list.clear(); - return true; + return _resources_list; } //============================================================================= /*! - * Overload handler function startElement. - * \param QString argument by reference (not used here ?) - * \param QString argument by reference (not used here ?) - * \param name (not used here ?) - * \param atts - * \return true if no error was detected + * Processes XML document and fills the list of resources */ //============================================================================= -bool -SALOME_ResourcesCatalog_Handler:: -startElement( const QString&, - const QString&, - const QString& name, - const QXmlAttributes& attrs ) +void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) { - for (int i = 0;i < attrs.count();i++) - { - QString qName(attrs.localName(i)); - std::string content(attrs.value(i).toLatin1().data()); + if (MYDEBUG) MESSAGE("Begin parse document"); - if ((qName.compare(QString(test_hostname)) == 0)) - _resource.DataForSort._hostName = content; + // Empty private elements + _resources_list.clear(); - if ((qName.compare(QString(test_alias)) == 0)) - _resource.Alias = content; + // Get the document root node + xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc); - if ((qName.compare(QString(test_protocol)) == 0)) - { - switch (content[0]) + aCurNode = aCurNode->xmlChildrenNode; + + // Processing the document nodes + while(aCurNode != NULL) + { + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine) ) + { + _resource.Clear(); + if (xmlHasProp(aCurNode, (const xmlChar*)test_hostname)) { - - case 'r': - _resource.Protocol = rsh; - break; - - case 's': - _resource.Protocol = ssh; - break; - - default: - // If it'not in all theses cases, the protocol is affected to rsh - _resource.Protocol = rsh; - break; + xmlChar* hostname = xmlGetProp(aCurNode, (const xmlChar*)test_hostname); + _resource.DataForSort._hostName = (const char*)hostname; + xmlFree(hostname); } - } + else + break; - if ((qName.compare(QString(test_mode)) == 0)) - { - switch (content[0]) + if (xmlHasProp(aCurNode, (const xmlChar*)test_alias)) + { + xmlChar* alias = xmlGetProp(aCurNode, (const xmlChar*)test_alias); + _resource.Alias = (const char*)alias; + xmlFree(alias); + } + else + _resource.Alias = ""; + + xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); + switch ( protocol[0]) + { + case 'r': + _resource.Protocol = rsh; + break; + case 's': + _resource.Protocol = ssh; + break; + default: + // If it'not in all theses cases, the protocol is affected to rsh + _resource.Protocol = rsh; + break; + } + xmlFree(protocol); + + xmlChar* mode=xmlGetProp(aCurNode, (const xmlChar*)test_mode); + switch ( mode[0] ) { - case 'i': _resource.Mode = interactive; break; - - case 'b': + case 'b': _resource.Mode = batch; break; - default: // If it'not in all theses cases, the mode is affected to interactive _resource.Mode = interactive; break; } - } + xmlFree(mode); - if ((qName.compare(QString(test_user_name)) == 0)) - _resource.UserName = content; - - if ((qName.compare(QString(test_appli_path)) == 0)) - _resource.AppliPath = content; - - if ((qName.compare(QString(test_module_name)) == 0)) - previous_module_name = content; - - if ((qName.compare(QString(test_module_path)) == 0)) - previous_module_path = content; - - if ((qName.compare(QString(test_pre_req_file_path)) == 0)) - _resource.PreReqFilePath = content; - - if ((qName.compare(QString(test_os)) == 0)) - _resource.OS = content; - - if ((qName.compare(QString(test_mem_in_mb)) == 0)) - _resource.DataForSort._memInMB = atoi(content.c_str()); - - if ((qName.compare(QString(test_cpu_freq_mhz)) == 0)) - _resource.DataForSort._CPUFreqMHz = atoi(content.c_str()); + if (xmlHasProp(aCurNode, (const xmlChar*)test_batch)) + { + xmlChar* batch = xmlGetProp(aCurNode, (const xmlChar*)test_batch); + std::string aBatch = (const char*)batch; + xmlFree(batch); + if (aBatch == "pbs") + _resource.Batch = pbs; + else if (aBatch == "lsf") + _resource.Batch = lsf; + else if (aBatch == "slurm") + _resource.Batch = slurm; + else + _resource.Batch = none; + } - if ((qName.compare(QString(test_nb_of_nodes)) == 0)) - _resource.DataForSort._nbOfNodes = atoi(content.c_str()); + if (xmlHasProp(aCurNode, (const xmlChar*)test_mpi)) + { + xmlChar* mpi = xmlGetProp(aCurNode, (const xmlChar*)test_mpi); + std::string anMpi = (const char*)mpi; + xmlFree(mpi); + if (anMpi == "lam") + _resource.mpi = lam; + else if (anMpi == "mpich1") + _resource.mpi = mpich1; + else if (anMpi == "mpich2") + _resource.mpi = mpich2; + else if (anMpi == "openmpi") + _resource.mpi = openmpi; + else + _resource.mpi = indif; + } - if ((qName.compare(QString(test_nb_of_proc_per_node)) == 0)) - _resource.DataForSort._nbOfProcPerNode = atoi(content.c_str()); + if (xmlHasProp(aCurNode, (const xmlChar*)test_user_name)) + { + xmlChar* user_name= xmlGetProp(aCurNode, (const xmlChar*)test_user_name); + _resource.UserName = (const char*)user_name; + xmlFree(user_name); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_appli_path)) + { + xmlChar* appli_path = xmlGetProp(aCurNode, (const xmlChar*)test_appli_path); + _resource.AppliPath = (const char*)appli_path; + xmlFree(appli_path); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_os)) + { + xmlChar* os = xmlGetProp(aCurNode, (const xmlChar*)test_os); + _resource.OS = (const char*)os; + xmlFree(os); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_mem_in_mb)) + { + xmlChar* mem_in_mb = xmlGetProp(aCurNode, (const xmlChar*)test_mem_in_mb); + _resource.DataForSort._memInMB = atoi((const char*)mem_in_mb); + xmlFree(mem_in_mb); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz)) + { + xmlChar* cpu_freq_mhz = xmlGetProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz); + _resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz); + xmlFree(cpu_freq_mhz); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_nodes)) + { + xmlChar* nb_of_nodes = xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_nodes); + _resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes); + xmlFree(nb_of_nodes); + } + + if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node)) + { + xmlChar* nb_of_proc_per_node = xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node); + _resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node); + xmlFree(nb_of_proc_per_node); + } + + // Process modules + xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode; + while(aCurSubNode != NULL) + { + if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) ) + { + if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name)) + { + xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name); + std::string aModuleName = (const char*)module_name; + _resource.ModulesList.push_back(aModuleName); + xmlFree(module_name); + } + } + aCurSubNode = aCurSubNode->next; + } + + int aNbNodes = _resource.DataForSort._nbOfNodes; + if( aNbNodes > 1 ){ + string clusterNode = _resource.DataForSort._hostName ; + for( int i=0; i < aNbNodes; i++ ){ + char inode[64]; + inode[0] = '\0' ; + sprintf(inode,"%s%d",clusterNode.c_str(),i+1); + std::string nodeName(inode); + _resource.DataForSort._hostName = nodeName ; + _resources_list[nodeName] = _resource; + } + } + else + _resources_list[_resource.DataForSort._hostName] = _resource; + } + + aCurNode = aCurNode->next; } - return true; -} - -//============================================================================= -/*! - * Overload handler function endElement. - * \param QString argument by reference (not used here ?) - * \param QString argument by reference (not used here ?) - * \param qName - * \return true (if no error detected ...) - */ -//============================================================================= - -bool SALOME_ResourcesCatalog_Handler:: -endElement(const QString&, - const QString&, - const QString& qName) -{ - if ((qName.compare(QString(test_modules)) == 0)) - _resource.ModulesPath[previous_module_name] = previous_module_path; - - if ((qName.compare(QString(test_machine)) == 0)){ - int nbnodes = _resource.DataForSort._nbOfNodes; - if( nbnodes > 1 ){ - string clusterNode = _resource.DataForSort._hostName ; - for(int i=0;i::const_iterator iter = + _resources_list.begin(); + iter != _resources_list.end(); + iter++) + { + SCRUTE((*iter).second.Alias); + SCRUTE((*iter).second.UserName); + SCRUTE((*iter).second.AppliPath); + SCRUTE((*iter).second.OS); + SCRUTE((*iter).second.Protocol); + SCRUTE((*iter).second.Mode); + } + + MESSAGE("This is the end of document"); } - else - _resources_list[_resource.DataForSort._hostName] = _resource; - } - - return true; -} - -//============================================================================= -/*! - * Overload handler function characters. - * fills the private attribute string 'content'. - * \param chars - * \return true (if no error detected ...) - */ -//============================================================================= - -bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars) -{ - content = chars.toLatin1().data() ; - return true; -} - -//============================================================================= -/*! - * Overload handler function endDocument. - * Called after the document has been parsed. - * \return true (if no error detected ...) - */ -//============================================================================= - -bool SALOME_ResourcesCatalog_Handler::endDocument() -{ -// for (map::const_iterator iter = -// _resources_list.begin(); -// iter != _resources_list.end(); -// iter++) -// { -// SCRUTE((*iter).second.Alias); -// SCRUTE((*iter).second.UserName); -// SCRUTE((*iter).second.AppliPath); -// SCRUTE((*iter).second.PreReqFilePath); -// SCRUTE((*iter).second.OS); -// SCRUTE((*iter).second.Protocol); -// SCRUTE((*iter).second.Mode); -// } - -// MESSAGE("This is the end of document"); - return true; -} - -//============================================================================= -/*! - * Overload handler function errorProtocol. - * \return the error message. - */ -//============================================================================= - -QString SALOME_ResourcesCatalog_Handler::errorProtocol() -{ - INFOS(" ------------- error protocol !"); - return errorProt; } -//============================================================================= -/*! - * Overload handler function fatalError. - * Fills the private string errorProt with details on error. - * \param exception from parser - * \return boolean (meaning ?) - */ -//============================================================================= - -bool -SALOME_ResourcesCatalog_Handler::fatalError -(const QXmlParseException& exception) -{ - INFOS(" ------------- fatal error !"); - errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" ) - .arg( exception.message() ) - .arg( exception.lineNumber() ) - .arg( exception.columnNumber() ); - INFOS("parser error: " << errorProt.toLatin1().data()); - - return QXmlDefaultHandler::fatalError( exception ); -} //============================================================================= /*! * Fill the document tree in xml file, used to write in an xml file. - * \param doc document to fill. + * \param theDoc document to fill. */ //============================================================================= -void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(QDomDocument& doc) +void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) { - QDomElement root = doc.createElement("resources"); - doc.appendChild(root); + // Node pointers + xmlNodePtr root_node = NULL, node = NULL, node1 = NULL; + char string_buf[80]; + root_node = xmlNewNode(NULL, BAD_CAST "resources"); + xmlDocSetRootElement(theDoc, root_node); + for (map::iterator iter = _resources_list.begin(); iter != _resources_list.end(); iter++) { - QDomElement eltRoot = doc.createElement(test_machine); - root.appendChild( eltRoot ); - eltRoot.setAttribute((char *)test_hostname, (*iter).first.c_str()); - eltRoot.setAttribute((char *)test_alias, (*iter).second.Alias.c_str()); - + node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL); + xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).first.c_str()); + xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str()); + switch ((*iter).second.Protocol) { - case rsh: - eltRoot.setAttribute((char *)test_protocol, "rsh"); + xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh"); break; - case ssh: - eltRoot.setAttribute((char *)test_protocol, "ssh"); - break; - + xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh"); + break; default: - eltRoot.setAttribute((char *)test_protocol, "rsh"); - } + xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh"); + } switch ((*iter).second.Mode) { - - case interactive: - eltRoot.setAttribute((char *)test_mode, "interactive"); + case interactive: + xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive"); break; - case batch: - eltRoot.setAttribute((char *)test_mode, "batch"); + xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch"); break; + default: + xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive"); + } + switch ((*iter).second.Batch) + { + case pbs: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs"); + break; + case lsf: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf"); + break; + case slurm: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm"); + break; + default: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST ""); + } + + switch ((*iter).second.mpi) + { + case lam: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam"); + break; + case mpich1: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1"); + break; + case mpich2: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2"); + break; + case openmpi: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi"); + break; default: - eltRoot.setAttribute((char *)test_mode, "interactive"); + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST ""); } - eltRoot.setAttribute((char *)test_user_name, - (*iter).second.UserName.c_str()); + xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str()); - for (map::const_iterator iter2 = - (*iter).second.ModulesPath.begin(); - iter2 != (*iter).second.ModulesPath.end(); + for (vector::const_iterator iter2 = + (*iter).second.ModulesList.begin(); + iter2 != (*iter).second.ModulesList.end(); iter2++) { - QDomElement rootForModulesPaths = doc.createElement(test_modules); - rootForModulesPaths.setAttribute(test_module_name, - (*iter2).first.c_str()); - rootForModulesPaths.setAttribute(test_module_path, - (*iter2).second.c_str()); - eltRoot.appendChild(rootForModulesPaths); + node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL); + xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str()); } - eltRoot.setAttribute(test_pre_req_file_path, - (*iter).second.PreReqFilePath.c_str()); - eltRoot.setAttribute(test_os, (*iter).second.OS.c_str()); - eltRoot.setAttribute(test_mem_in_mb, - (*iter).second.DataForSort._memInMB); - eltRoot.setAttribute(test_cpu_freq_mhz, - (*iter).second.DataForSort._CPUFreqMHz); - eltRoot.setAttribute(test_nb_of_nodes, - (*iter).second.DataForSort._nbOfNodes); - eltRoot.setAttribute(test_nb_of_proc_per_node, - (*iter).second.DataForSort._nbOfProcPerNode); + xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str()); + xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB)); + xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz)); + xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes)); + xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode)); } } diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx index 497f0dddf..d636ff22f 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx @@ -31,17 +31,14 @@ #include "SALOME_ResourcesCatalog_Parser.hxx" -#include #include #include -class QDomElement; - -class QDomDocument; - -class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler - { +#include +class SALOME_ResourcesCatalog_Handler +{ + public : SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources); @@ -49,29 +46,12 @@ class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler virtual ~SALOME_ResourcesCatalog_Handler(); - virtual bool startDocument(); - - virtual bool startElement(const QString& , const QString& , - const QString& name, - const QXmlAttributes& attrs); - - virtual bool endElement(const QString&, const QString&, - const QString& qName); - - virtual bool characters(const QString& chars); - - virtual bool endDocument(); - - virtual QString errorProtocol(); - virtual bool fatalError(const QXmlParseException& exception); - - void PrepareDocToXmlFile(QDomDocument& doc); + void ProcessXmlDocument(xmlDocPtr theDoc); + + void PrepareDocToXmlFile(xmlDocPtr theDoc); private : - QString errorProt; - std::string content; std::string previous_module_name; - std::string previous_module_path; ParserResourcesType _resource; MapOfParserResourcesType& _resources_list; @@ -83,12 +63,12 @@ class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler const char *test_alias; const char *test_protocol; const char *test_mode; + const char *test_batch; + const char *test_mpi; const char *test_user_name; const char *test_appli_path; const char *test_modules; const char *test_module_name; - const char *test_module_path; - const char *test_pre_req_file_path; const char *test_os; const char *test_mem_in_mb; const char *test_cpu_freq_mhz; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index 49e594e42..e20dbfc6a 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -112,26 +112,46 @@ void ResourceDataToSort::Print() const SCRUTE(_memInMB); } -void ParserResourcesType::Print() +void ParserResourcesType::Print() const { - MESSAGE("##############*****"); - MESSAGE("HostName : " << DataForSort._hostName); - MESSAGE("Alias : " << Alias); - MESSAGE("Protocol : " << Protocol); - MESSAGE("Mode : " << Mode); - MESSAGE("UserName : " << UserName); - MESSAGE("Modules : "); - int i = 1; - - for (std::map::iterator iter = ModulesPath.begin(); - iter != ModulesPath.end(); - iter++) - { - MESSAGE("Module " << i++ << " called : " << (*iter).first - << " with path : " << (*iter).second); - } - - MESSAGE("PreReqFilePath : " << PreReqFilePath); - MESSAGE("OS : " << OS); - DataForSort.Print(); + ostringstream oss; + oss << endl << + "HostName : " << DataForSort._hostName << endl << + "Alias : " << Alias << endl << + "NbOfNodes : " << DataForSort._nbOfNodes << endl << + "NbOfProcPerNode : " << DataForSort._nbOfProcPerNode << endl << + "CPUFreqMHz : " << DataForSort._CPUFreqMHz << endl << + "MemInMB : " << DataForSort._memInMB << endl << + "Protocol : " << Protocol << endl << + "Mode : " << Mode << endl << + "Batch : " << Batch << endl << + "mpi : " << mpi << endl << + "UserName : " << UserName << endl << + "AppliPath : " << AppliPath << endl << + "OS : " << OS << endl << + "Modules : " << endl; + + for(int i=0;i #include -typedef std::map MapOfModulesPath; - enum AccessProtocolType {rsh, ssh}; enum AccessModeType {interactive, batch}; +enum BatchType {none, pbs, lsf, slurm}; + +enum MpiImplType {indif, lam, mpich1, mpich2, openmpi}; + class ResourceDataToSort { @@ -74,13 +76,15 @@ struct ParserResourcesType std::string Alias; AccessProtocolType Protocol; AccessModeType Mode; + BatchType Batch; + MpiImplType mpi; std::string UserName; std::string AppliPath; - MapOfModulesPath ModulesPath; - std::string PreReqFilePath; + std::vector ModulesList; std::string OS; - void Print(); + void Print() const; + void Clear(); }; typedef std::map MapOfParserResourcesType; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index c99a37b7e..d693227a1 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -18,12 +18,10 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "SALOME_ResourcesManager.hxx" -//#include "SALOME_Container_i.hxx" #include "Utils_ExceptHandlers.hxx" +#include "Utils_CorbaException.hxx" #include "OpUtil.hxx" -#include - #include #ifndef WNT #include @@ -46,6 +44,8 @@ using namespace std; +const char *SALOME_ResourcesManager::_ResourcesManagerNameInNS = "/ResourcesManager"; + //============================================================================= /*! * just for test @@ -53,28 +53,50 @@ using namespace std; //============================================================================= SALOME_ResourcesManager:: -SALOME_ResourcesManager(CORBA::ORB_ptr orb, +SALOME_ResourcesManager(CORBA::ORB_ptr orb, + PortableServer::POA_var poa, + SALOME_NamingService *ns, const char *xmlFilePath) : _path_resources(xmlFilePath) { - _NS = new SALOME_NamingService(orb); + MESSAGE("constructor"); + _NS = ns; + _orb = CORBA::ORB::_duplicate(orb) ; + _poa = PortableServer::POA::_duplicate(poa) ; + PortableServer::ObjectId_var id = _poa->activate_object(this); + CORBA::Object_var obj = _poa->id_to_reference(id); + Engines::SalomeLauncher_var refContMan = + Engines::SalomeLauncher::_narrow(obj); + + _NS->Register(refContMan,_ResourcesManagerNameInNS); _MpiStarted = false; + MESSAGE("constructor end"); } //============================================================================= /*! * Standard constructor, parse resource file. * - if ${APPLI} exists in environment, - * look for ${HOME}/*{APPLI}/CatalogResources.xml + * look for ${HOME}/${APPLI}/CatalogResources.xml * - else look for default: * ${KERNEL_ROOT_DIR}/share/salome/resources/kernel/CatalogResources.xml * - parse XML resource file. */ //============================================================================= -SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb) +SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb, + PortableServer::POA_var poa, + SALOME_NamingService *ns) { - _NS = new SALOME_NamingService(orb); + MESSAGE("constructor"); + _NS = ns; + _orb = CORBA::ORB::_duplicate(orb) ; + _poa = PortableServer::POA::_duplicate(poa) ; + PortableServer::ObjectId_var id = _poa->activate_object(this); + CORBA::Object_var obj = _poa->id_to_reference(id); + Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj); + _NS->Register(refContMan,_ResourcesManagerNameInNS); + _isAppliSalomeDefined = (getenv("APPLI") != 0); _MpiStarted = false; @@ -93,6 +115,7 @@ SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb) } ParseXmlFile(); + MESSAGE("constructor end"); } //============================================================================= @@ -103,7 +126,23 @@ SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb) SALOME_ResourcesManager::~SALOME_ResourcesManager() { - delete _NS; + MESSAGE("destructor"); +} + + +//============================================================================= +/*! CORBA method: + * shutdown all the containers, then the ContainerManager servant + */ +//============================================================================= + +void SALOME_ResourcesManager::Shutdown() +{ + MESSAGE("Shutdown"); + _NS->Destroy_Name(_ResourcesManagerNameInNS); + PortableServer::ObjectId_var oid = _poa->servant_to_id(this); + _poa->deactivate_object(oid); + //_remove_ref(); } //============================================================================= @@ -120,101 +159,113 @@ SALOME_ResourcesManager::~SALOME_ResourcesManager() */ //============================================================================= -vector -SALOME_ResourcesManager:: -GetFittingResources(const Engines::MachineParameters& params, - const char *moduleName) -throw(SALOME_Exception) +Engines::MachineList * +SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params, + const Engines::CompoList& componentList) +//throw(SALOME_Exception) { // MESSAGE("ResourcesManager::GetFittingResources"); - vector ret; + vector vec; + Engines::MachineList *ret=new Engines::MachineList; + try{ + // --- To be sure that we search in a correct list. + ParseXmlFile(); - // --- To be sure that we search in a correct list. - ParseXmlFile(); - - const char *hostname = (const char *)params.hostname; - MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str()); + const char *hostname = (const char *)params.hostname; + MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str()); - if (hostname[0] != '\0') - { + if (hostname[0] != '\0') + { // MESSAGE("ResourcesManager::GetFittingResources : hostname specified" ); - if ( strcmp(hostname, "localhost") == 0 || - strcmp(hostname, GetHostname().c_str()) == 0 ) - { -// MESSAGE("ResourcesManager::GetFittingResources : localhost" ); - ret.push_back(GetHostname().c_str()); -// MESSAGE("ResourcesManager::GetFittingResources : " << ret.size()); - } - - else if (_resourcesList.find(hostname) != _resourcesList.end()) - { - // --- params.hostname is in the list of resources so return it. - ret.push_back(hostname); - } - - else - { -// Cas d'un cluster: nombre de noeuds > 1 - int cpt=0; - for (map::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){ - if( (*iter).second.DataForSort._nbOfNodes > 1 ){ - if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){ - ret.push_back((*iter).first.c_str()); - //cout << "SALOME_ResourcesManager::GetFittingResources vector[" - // << cpt << "] = " << (*iter).first.c_str() << endl ; - cpt++; - } - } - } - if(cpt==0){ - // --- user specified an unknown hostame so notify him. - MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception"); - throw SALOME_Exception("unknown host"); - } - } - } + if ( strcmp(hostname, "localhost") == 0 || + strcmp(hostname, GetHostname().c_str()) == 0 ) + { + // MESSAGE("ResourcesManager::GetFittingResources : localhost" ); + vec.push_back(GetHostname().c_str()); + // MESSAGE("ResourcesManager::GetFittingResources : " << vec.size()); + } + + else if (_resourcesList.find(hostname) != _resourcesList.end()) + { + // --- params.hostname is in the list of resources so return it. + vec.push_back(hostname); + } + + else + { + // Cas d'un cluster: nombre de noeuds > 1 + int cpt=0; + for (map::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){ + if( (*iter).second.DataForSort._nbOfNodes > 1 ){ + if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){ + vec.push_back((*iter).first.c_str()); + //cout << "SALOME_ResourcesManager::GetFittingResources vector[" + // << cpt << "] = " << (*iter).first.c_str() << endl ; + cpt++; + } + } + } + if(cpt==0){ + // --- user specified an unknown hostame so notify him. + MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception"); + throw SALOME_Exception("unknown host"); + } + } + } + + else + // --- Search for available resources sorted by priority + { + SelectOnlyResourcesWithOS(vec, params.OS); + + KeepOnlyResourcesWithModule(vec, componentList); + + if (vec.size() == 0) + SelectOnlyResourcesWithOS(vec, params.OS); + + // --- set wanted parameters + ResourceDataToSort::_nbOfNodesWanted = params.nb_node; + + ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node; + + ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock; + + ResourceDataToSort::_memInMBWanted = params.mem_mb; + + // --- end of set + + list li; + + for (vector::iterator iter = vec.begin(); + iter != vec.end(); + iter++) + li.push_back(_resourcesList[(*iter)].DataForSort); + + li.sort(); + + unsigned int i = 0; + + for (list::iterator iter2 = li.begin(); + iter2 != li.end(); + iter2++) + vec[i++] = (*iter2)._hostName; + } + + // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size()); + ret->length(vec.size()); + for(unsigned int i=0;i li; - - for (vector::iterator iter = ret.begin(); - iter != ret.end(); - iter++) - li.push_back(_resourcesList[(*iter)].DataForSort); - - li.sort(); - - unsigned int i = 0; - - for (list::iterator iter2 = li.begin(); - iter2 != li.end(); - iter2++) - ret[i++] = (*iter2)._hostName; - } - - // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size()); return ret; } @@ -228,16 +279,16 @@ throw(SALOME_Exception) int SALOME_ResourcesManager:: AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources, - const map& modulesOnNewResources, - const char *environPathOfPrerequired, + const vector& modulesOnNewResources, const char *alias, const char *userName, AccessModeType mode, AccessProtocolType prot) throw(SALOME_Exception) { - map::const_iterator iter = - modulesOnNewResources.find("KERNEL"); + vector::const_iterator iter = find(modulesOnNewResources.begin(), + modulesOnNewResources.end(), + "KERNEL"); if (iter != modulesOnNewResources.end()) { @@ -247,8 +298,7 @@ throw(SALOME_Exception) newElt.Protocol = prot; newElt.Mode = mode; newElt.UserName = userName; - newElt.ModulesPath = modulesOnNewResources; - newElt.PreReqFilePath = environPathOfPrerequired; + newElt.ModulesList = modulesOnNewResources; newElt.OS = paramsOfNewResources.OS; newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb; newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock; @@ -282,23 +332,34 @@ void SALOME_ResourcesManager::DeleteResourceInCatalog(const char *hostname) void SALOME_ResourcesManager::WriteInXmlFile() { - QDomDocument doc("ResourcesCatalog"); + const char* aFilePath = _path_resources.c_str(); + + FILE* aFile = fopen(aFilePath, "w"); + + if (aFile == NULL) + { + INFOS("Error opening file !"); + return; + } + + xmlDocPtr aDoc = xmlNewDoc(BAD_CAST "1.0"); + xmlNewDocComment(aDoc, BAD_CAST "ResourcesCatalog"); + SALOME_ResourcesCatalog_Handler* handler = new SALOME_ResourcesCatalog_Handler(_resourcesList); - handler->PrepareDocToXmlFile(doc); + handler->PrepareDocToXmlFile(aDoc); delete handler; - QFile file( _path_resources ); - - if ( !file.open( QIODevice::WriteOnly ) ) - INFOS("WRITING ERROR !"); - - QTextStream ts( &file ); - - ts << doc.toString(); - - file.close(); + int isOk = xmlSaveFile(aFilePath, aDoc); + + if (!isOk) + INFOS("Error while XML file saving."); + + // Free the document + xmlFreeDoc(aDoc); + fclose(aFile); + MESSAGE("WRITING DONE!"); } @@ -312,16 +373,29 @@ const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile() { SALOME_ResourcesCatalog_Handler* handler = new SALOME_ResourcesCatalog_Handler(_resourcesList); - QFile xmlFile(_path_resources); - QXmlInputSource source(&xmlFile); + const char* aFilePath = _path_resources.c_str(); + FILE* aFile = fopen(aFilePath, "r"); + + if (aFile != NULL) + { + xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0); + + if (aDoc != NULL) + handler->ProcessXmlDocument(aDoc); + else + INFOS("ResourcesManager: could not parse file "<& hosts, - const char *moduleName) const + const Engines::CompoList& componentList) const throw(SALOME_Exception) { for (vector::iterator iter = hosts.begin(); iter != hosts.end();) { MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter); - const map& mapOfModulesOfCurrentHost = - (((*it).second).ModulesPath); - - if (mapOfModulesOfCurrentHost.find(moduleName) == - mapOfModulesOfCurrentHost.end()) + const vector& mapOfModulesOfCurrentHost = (((*it).second).ModulesList); + + bool erasedHost = false; + if( mapOfModulesOfCurrentHost.size() > 0 ){ + for(int i=0;i::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(), + mapOfModulesOfCurrentHost.end(), + compoi); +// componentList[i]); + if (itt == mapOfModulesOfCurrentHost.end()){ + erasedHost = true; + break; + } + } + } + if(erasedHost) hosts.erase(iter); else iter++; @@ -743,6 +826,8 @@ void SALOME_ResourcesManager::AddOmninamesParams(string& command) const char *iorstr = _NS->getIORaddr(); command += "ORBInitRef NameService="; command += iorstr; + //It's in fact a CORBA::String allocated with new [] !!! + delete [] iorstr; } @@ -801,8 +886,10 @@ string SALOME_ResourcesManager::BuildTemporaryFileName() const string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer (const string& machine, - const Engines::MachineParameters& params) + const Engines::MachineParameters& params) throw(SALOME_Exception) { + int status; + _TmpFileName = BuildTemporaryFileName(); ofstream tempOutputFile; tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); @@ -811,27 +898,6 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer // --- set env vars - tempOutputFile << "source " << resInfo.PreReqFilePath << endl; - - for (map::const_iterator iter = resInfo.ModulesPath.begin(); - iter != resInfo.ModulesPath.end(); - iter++) - { - string curModulePath((*iter).second); - tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl; - tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl; - tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath - << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl; - tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:" - << curModulePath << "/lib/salome:" << curModulePath - << "/lib/python${PYTHON_VERSION}/site-packages/salome:"; - tempOutputFile << curModulePath - << "/lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules:${PYTHONPATH}" - << endl; - } - - tempOutputFile << "export LD_LIBRARY_PATH" << endl; - tempOutputFile << "export PYTHONPATH" << endl; tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace" //tempOutputFile << "source " << resInfo.PreReqFilePath << endl; @@ -859,8 +925,7 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer #endif } - tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second - << "/bin/salome/"; + tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/"; if (params.isMPI) { @@ -898,7 +963,7 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer commandRcp += machine; commandRcp += ":"; commandRcp += _TmpFileName; - system(commandRcp.c_str()); + status = system(commandRcp.c_str()); } else if (resInfo.Protocol == ssh) @@ -910,11 +975,14 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer commandRcp += machine; commandRcp += ":"; commandRcp += _TmpFileName; - system(commandRcp.c_str()); + status = system(commandRcp.c_str()); } else throw SALOME_Exception("Unknown protocol"); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + command += machine; _CommandForRemAccess = command; command += " "; @@ -993,7 +1061,9 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s if (par < 0) { // Nodes case + command = "mpiexec -np " + string(buffer) + " "; +// command += "gdb --args "; command += real_exe_name; command += " " + _NS->ContainerName(rtn); command += " " + parallelLib; @@ -1029,9 +1099,8 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s if (log == "xterm") { command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; " - + command + " \" &"; - //command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; " - // + command + "; cat \" &"; + + command + " \" &"; +// + command + "; echo $LD_LIBRARY_PATH; cat \" &"; } return command; @@ -1073,4 +1142,42 @@ void SALOME_ResourcesManager::startMPI() } } - +Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname) +{ + ParserResourcesType resource = _resourcesList[string(hostname)]; + Engines::MachineParameters *p_ptr = new Engines::MachineParameters; + p_ptr->container_name = CORBA::string_dup(""); + p_ptr->hostname = CORBA::string_dup("hostname"); + p_ptr->alias = CORBA::string_dup(resource.Alias.c_str()); + if( resource.Protocol == rsh ) + p_ptr->protocol = "rsh"; + else if( resource.Protocol == ssh ) + p_ptr->protocol = "ssh"; + p_ptr->username = CORBA::string_dup(resource.UserName.c_str()); + p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str()); + p_ptr->modList.length(resource.ModulesList.size()); + for(int i=0;imodList[i] = CORBA::string_dup(resource.ModulesList[i].c_str()); + p_ptr->OS = CORBA::string_dup(resource.OS.c_str()); + p_ptr->mem_mb = resource.DataForSort._memInMB; + p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz; + p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode; + p_ptr->nb_node = resource.DataForSort._nbOfNodes; + if( resource.mpi == indif ) + p_ptr->mpiImpl = "indif"; + else if( resource.mpi == lam ) + p_ptr->mpiImpl = "lam"; + else if( resource.mpi == mpich1 ) + p_ptr->mpiImpl = "mpich1"; + else if( resource.mpi == mpich2 ) + p_ptr->mpiImpl = "mpich2"; + else if( resource.mpi == openmpi ) + p_ptr->mpiImpl = "openmpi"; + if( resource.Batch == pbs ) + p_ptr->batch = "pbs"; + else if( resource.Batch == lsf ) + p_ptr->batch = "lsf"; + else if( resource.Batch == slurm ) + p_ptr->batch = "slurm"; + return p_ptr; +} diff --git a/src/ResourcesManager/SALOME_ResourcesManager.hxx b/src/ResourcesManager/SALOME_ResourcesManager.hxx index 42cc984cd..23c7bd647 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.hxx @@ -31,28 +31,44 @@ #include #include +#if defined RESOURCESMANAGER_EXPORTS +#if defined WIN32 +#define RESOURCESMANAGER_EXPORT __declspec( dllexport ) +#else +#define RESOURCESMANAGER_EXPORT +#endif +#else +#if defined WNT +#define RESOURCESMANAGER_EXPORT __declspec( dllimport ) +#else +#define RESOURCESMANAGER_EXPORT +#endif +#endif + // --- WARNING --- // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done // in a critical section to be sure to be clean. // Only one thread should use the SALOME_ResourcesManager class in a SALOME // session. -class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager +class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager: + public POA_Engines::ResourcesManager, + public PortableServer::RefCountServantBase { public: - SALOME_ResourcesManager(CORBA::ORB_ptr orb, const char *xmlFilePath); - SALOME_ResourcesManager(CORBA::ORB_ptr orb); + SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns, const char *xmlFilePath); + SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns); ~SALOME_ResourcesManager(); - std::vector + Engines::MachineList * GetFittingResources(const Engines::MachineParameters& params, - const char *moduleName) - throw(SALOME_Exception); + const Engines::CompoList& componentList); +// throw(SALOME_Exception); - std::string FindFirst(const Engines::MachineList& listOfMachines); + char* FindFirst(const Engines::MachineList& listOfMachines); std::string FindNext(const Engines::MachineList& listOfMachines); std::string FindBest(const Engines::MachineList& listOfMachines); @@ -70,8 +86,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager int AddResourceInCatalog (const Engines::MachineParameters& paramsOfNewResources, - const std::map& modulesOnNewResources, - const char *environPathOfPrerequired, + const std::vector& modulesOnNewResources, const char *alias, const char *userName, AccessModeType mode, @@ -90,6 +105,12 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager std::string BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name, const Engines::MachineParameters& params, const std::string& log = "default"); + Engines::MachineParameters* GetMachineParameters(const char *hostname); + + void Shutdown(); + + static const char *_ResourcesManagerNameInNS; + protected: // Parallel extension @@ -97,17 +118,19 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager bool _MpiStarted; SALOME_NamingService *_NS; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; std::string BuildTempFileToLaunchRemoteContainer (const std::string& machine, - const Engines::MachineParameters& params); + const Engines::MachineParameters& params) throw(SALOME_Exception); void SelectOnlyResourcesWithOS(std::vector& hosts, const char *OS) const throw(SALOME_Exception); void KeepOnlyResourcesWithModule(std::vector& hosts, - const char *moduleName) const + const Engines::CompoList& componentList) const throw(SALOME_Exception); void AddOmninamesParams(std::string& command) const; @@ -116,9 +139,8 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager std::string BuildTemporaryFileName() const; - //! will contain the path to the ressources catalog - QString _path_resources; + std::string _path_resources; //! attribute that contains current tmp files generated std::string _TmpFileName; diff --git a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx b/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx deleted file mode 100644 index ef5ec178e..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#define _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString); - -class Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) : public Handle(TCollection_MapNode) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)():Handle(TCollection_MapNode)() {} - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->() - { - return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess(); - } - - SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->() const - { - return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(); - - Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx b/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx deleted file mode 100644 index e2325adc8..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#define _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class SALOMEDS_DataMapNodeOfDataMapStringLabel; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel); - -class Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) : public Handle(TCollection_MapNode) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)():Handle(TCollection_MapNode)() {} - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->() - { - return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess(); - } - - SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->() const - { - return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(); - - Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx deleted file mode 100644 index 0a0cf4efe..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DrawableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile -#define _Handle_SALOMEDS_DrawableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_DrawableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DrawableAttribute); - -class Handle(SALOMEDS_DrawableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_DrawableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_DrawableAttribute)(const Handle(SALOMEDS_DrawableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_DrawableAttribute)(const SALOMEDS_DrawableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_DrawableAttribute)& operator=(const Handle(SALOMEDS_DrawableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DrawableAttribute)& operator=(const SALOMEDS_DrawableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DrawableAttribute* operator->() - { - return (SALOMEDS_DrawableAttribute *)ControlAccess(); - } - - SALOMEDS_DrawableAttribute* operator->() const - { - return (SALOMEDS_DrawableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DrawableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_DrawableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx deleted file mode 100644 index db9bc2183..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_ExpandableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile -#define _Handle_SALOMEDS_ExpandableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_ExpandableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExpandableAttribute); - -class Handle(SALOMEDS_ExpandableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_ExpandableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_ExpandableAttribute)(const Handle(SALOMEDS_ExpandableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_ExpandableAttribute)(const SALOMEDS_ExpandableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_ExpandableAttribute)& operator=(const Handle(SALOMEDS_ExpandableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_ExpandableAttribute)& operator=(const SALOMEDS_ExpandableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_ExpandableAttribute* operator->() - { - return (SALOMEDS_ExpandableAttribute *)ControlAccess(); - } - - SALOMEDS_ExpandableAttribute* operator->() const - { - return (SALOMEDS_ExpandableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_ExpandableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_ExpandableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx deleted file mode 100644 index 5fd18ab85..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx +++ /dev/null @@ -1,86 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile -#define _Handle_SALOMEDS_ExternalFileDef_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_ExternalFileDef; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExternalFileDef); - -class Handle(SALOMEDS_ExternalFileDef) : public Handle(TDataStd_Comment) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_ExternalFileDef)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_ExternalFileDef)(const Handle(SALOMEDS_ExternalFileDef)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_ExternalFileDef)(const SALOMEDS_ExternalFileDef* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_ExternalFileDef)& operator=(const Handle(SALOMEDS_ExternalFileDef)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_ExternalFileDef)& operator=(const SALOMEDS_ExternalFileDef* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_ExternalFileDef* operator->() - { - return (SALOMEDS_ExternalFileDef *)ControlAccess(); - } - - SALOMEDS_ExternalFileDef* operator->() const - { - return (SALOMEDS_ExternalFileDef *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_ExternalFileDef)(); - - Standard_EXPORT static const Handle(SALOMEDS_ExternalFileDef) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx b/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx deleted file mode 100644 index 17de5bebb..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _Handle_SALOMEDS_FileType_HeaderFile -#define _Handle_SALOMEDS_FileType_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_FileType; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_FileType); - -class Handle(SALOMEDS_FileType) : public Handle(TDataStd_Comment) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_FileType)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_FileType)(const Handle(SALOMEDS_FileType)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_FileType)(const SALOMEDS_FileType* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_FileType)& operator=(const Handle(SALOMEDS_FileType)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_FileType)& operator=(const SALOMEDS_FileType* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_FileType* operator->() - { - return (SALOMEDS_FileType *)ControlAccess(); - } - - SALOMEDS_FileType* operator->() const - { - return (SALOMEDS_FileType *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_FileType)(); - - Standard_EXPORT static const Handle(SALOMEDS_FileType) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx deleted file mode 100644 index c4c369d1b..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_IORAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile -#define _Handle_SALOMEDS_IORAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_IORAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_IORAttribute); - -class Handle(SALOMEDS_IORAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_IORAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_IORAttribute)(const Handle(SALOMEDS_IORAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_IORAttribute)(const SALOMEDS_IORAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_IORAttribute)& operator=(const Handle(SALOMEDS_IORAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_IORAttribute)& operator=(const SALOMEDS_IORAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_IORAttribute* operator->() - { - return (SALOMEDS_IORAttribute *)ControlAccess(); - } - - SALOMEDS_IORAttribute* operator->() const - { - return (SALOMEDS_IORAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_IORAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_IORAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx deleted file mode 100644 index 94205ab0a..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_LocalIDAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile -#define _Handle_SALOMEDS_LocalIDAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_LocalIDAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_LocalIDAttribute); - -class Handle(SALOMEDS_LocalIDAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_LocalIDAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_LocalIDAttribute)(const Handle(SALOMEDS_LocalIDAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_LocalIDAttribute)(const SALOMEDS_LocalIDAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_LocalIDAttribute)& operator=(const Handle(SALOMEDS_LocalIDAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_LocalIDAttribute)& operator=(const SALOMEDS_LocalIDAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_LocalIDAttribute* operator->() - { - return (SALOMEDS_LocalIDAttribute *)ControlAccess(); - } - - SALOMEDS_LocalIDAttribute* operator->() const - { - return (SALOMEDS_LocalIDAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_LocalIDAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_LocalIDAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx b/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx deleted file mode 100644 index ca0fe557a..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_OCAFApplication.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile -#define _Handle_SALOMEDS_OCAFApplication_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDocStd_Application_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDocStd_Application); -class SALOMEDS_OCAFApplication; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OCAFApplication); - -class Handle(SALOMEDS_OCAFApplication) : public Handle(TDocStd_Application) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_OCAFApplication)():Handle(TDocStd_Application)() {} - Handle(SALOMEDS_OCAFApplication)(const Handle(SALOMEDS_OCAFApplication)& aHandle) : Handle(TDocStd_Application)(aHandle) - { - } - - Handle(SALOMEDS_OCAFApplication)(const SALOMEDS_OCAFApplication* anItem) : Handle(TDocStd_Application)((TDocStd_Application *)anItem) - { - } - - Handle(SALOMEDS_OCAFApplication)& operator=(const Handle(SALOMEDS_OCAFApplication)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_OCAFApplication)& operator=(const SALOMEDS_OCAFApplication* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_OCAFApplication* operator->() - { - return (SALOMEDS_OCAFApplication *)ControlAccess(); - } - - SALOMEDS_OCAFApplication* operator->() const - { - return (SALOMEDS_OCAFApplication *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_OCAFApplication)(); - - Standard_EXPORT static const Handle(SALOMEDS_OCAFApplication) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx deleted file mode 100644 index 772557566..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_OpenedAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile -#define _Handle_SALOMEDS_OpenedAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_OpenedAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OpenedAttribute); - -class Handle(SALOMEDS_OpenedAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_OpenedAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_OpenedAttribute)(const Handle(SALOMEDS_OpenedAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_OpenedAttribute)(const SALOMEDS_OpenedAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_OpenedAttribute)& operator=(const Handle(SALOMEDS_OpenedAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_OpenedAttribute)& operator=(const SALOMEDS_OpenedAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_OpenedAttribute* operator->() - { - return (SALOMEDS_OpenedAttribute *)ControlAccess(); - } - - SALOMEDS_OpenedAttribute* operator->() const - { - return (SALOMEDS_OpenedAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_OpenedAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_OpenedAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx deleted file mode 100644 index 464943cec..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_PersRefAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile -#define _Handle_SALOMEDS_PersRefAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_PersRefAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PersRefAttribute); - -class Handle(SALOMEDS_PersRefAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PersRefAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_PersRefAttribute)(const Handle(SALOMEDS_PersRefAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_PersRefAttribute)(const SALOMEDS_PersRefAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_PersRefAttribute)& operator=(const Handle(SALOMEDS_PersRefAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PersRefAttribute)& operator=(const SALOMEDS_PersRefAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PersRefAttribute* operator->() - { - return (SALOMEDS_PersRefAttribute *)ControlAccess(); - } - - SALOMEDS_PersRefAttribute* operator->() const - { - return (SALOMEDS_PersRefAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PersRefAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PersRefAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx deleted file mode 100644 index 842a76425..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_PixMapAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile -#define _Handle_SALOMEDS_PixMapAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_PixMapAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PixMapAttribute); - -class Handle(SALOMEDS_PixMapAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PixMapAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_PixMapAttribute)(const Handle(SALOMEDS_PixMapAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_PixMapAttribute)(const SALOMEDS_PixMapAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_PixMapAttribute)& operator=(const Handle(SALOMEDS_PixMapAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PixMapAttribute)& operator=(const SALOMEDS_PixMapAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PixMapAttribute* operator->() - { - return (SALOMEDS_PixMapAttribute *)ControlAccess(); - } - - SALOMEDS_PixMapAttribute* operator->() const - { - return (SALOMEDS_PixMapAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PixMapAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PixMapAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx deleted file mode 100644 index 266d3e483..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_PythonObjectAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile -#define _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_PythonObjectAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PythonObjectAttribute); - -class Handle(SALOMEDS_PythonObjectAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PythonObjectAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_PythonObjectAttribute)(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_PythonObjectAttribute)(const SALOMEDS_PythonObjectAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_PythonObjectAttribute)& operator=(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PythonObjectAttribute)& operator=(const SALOMEDS_PythonObjectAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PythonObjectAttribute* operator->() - { - return (SALOMEDS_PythonObjectAttribute *)ControlAccess(); - } - - SALOMEDS_PythonObjectAttribute* operator->() const - { - return (SALOMEDS_PythonObjectAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PythonObjectAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PythonObjectAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx deleted file mode 100644 index e1972c4ab..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SelectableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile -#define _Handle_SALOMEDS_SelectableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_SelectableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SelectableAttribute); - -class Handle(SALOMEDS_SelectableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_SelectableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_SelectableAttribute)(const Handle(SALOMEDS_SelectableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_SelectableAttribute)(const SALOMEDS_SelectableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_SelectableAttribute)& operator=(const Handle(SALOMEDS_SelectableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SelectableAttribute)& operator=(const SALOMEDS_SelectableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SelectableAttribute* operator->() - { - return (SALOMEDS_SelectableAttribute *)ControlAccess(); - } - - SALOMEDS_SelectableAttribute* operator->() const - { - return (SALOMEDS_SelectableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SelectableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SelectableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx deleted file mode 100644 index 1db1747bf..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#define _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_SequenceOfIntegerAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute); - -class Handle(SALOMEDS_SequenceOfIntegerAttribute) : public Handle(TDF_Attribute) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_SequenceOfIntegerAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_SequenceOfIntegerAttribute)(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)(const SALOMEDS_SequenceOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const SALOMEDS_SequenceOfIntegerAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SequenceOfIntegerAttribute* operator->() - { - return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess(); - } - - SALOMEDS_SequenceOfIntegerAttribute* operator->() const - { - return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SequenceOfIntegerAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SequenceOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx deleted file mode 100644 index b9a9d4913..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SequenceOfRealAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile -#define _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_SequenceOfRealAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute); - -class Handle(SALOMEDS_SequenceOfRealAttribute) : public Handle(TDF_Attribute) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_SequenceOfRealAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_SequenceOfRealAttribute)(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_SequenceOfRealAttribute)(const SALOMEDS_SequenceOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const SALOMEDS_SequenceOfRealAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SequenceOfRealAttribute* operator->() - { - return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess(); - } - - SALOMEDS_SequenceOfRealAttribute* operator->() const - { - return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SequenceOfRealAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SequenceOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx deleted file mode 100644 index 14b12dd51..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_StudyPropertiesAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile -#define _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_StudyPropertiesAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute); - -class Handle(SALOMEDS_StudyPropertiesAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_StudyPropertiesAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_StudyPropertiesAttribute)(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_StudyPropertiesAttribute)(const SALOMEDS_StudyPropertiesAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const SALOMEDS_StudyPropertiesAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_StudyPropertiesAttribute* operator->() - { - return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess(); - } - - SALOMEDS_StudyPropertiesAttribute* operator->() const - { - return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_StudyPropertiesAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_StudyPropertiesAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx deleted file mode 100644 index 25986ce60..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfIntegerAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfIntegerAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute); - -class Handle(SALOMEDS_TableOfIntegerAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfIntegerAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfIntegerAttribute)(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfIntegerAttribute)(const SALOMEDS_TableOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const SALOMEDS_TableOfIntegerAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfIntegerAttribute* operator->() - { - return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfIntegerAttribute* operator->() const - { - return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfIntegerAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx deleted file mode 100644 index 000e8cf11..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfRealAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfRealAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfRealAttribute); - -class Handle(SALOMEDS_TableOfRealAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfRealAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfRealAttribute)(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfRealAttribute)(const SALOMEDS_TableOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfRealAttribute)& operator=(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfRealAttribute)& operator=(const SALOMEDS_TableOfRealAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfRealAttribute* operator->() - { - return (SALOMEDS_TableOfRealAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfRealAttribute* operator->() const - { - return (SALOMEDS_TableOfRealAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfRealAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx deleted file mode 100644 index 0125b9447..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx +++ /dev/null @@ -1,84 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfStringAttribute.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfStringAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfStringAttribute); - -class Handle(SALOMEDS_TableOfStringAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfStringAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfStringAttribute)(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfStringAttribute)(const SALOMEDS_TableOfStringAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfStringAttribute)& operator=(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfStringAttribute)& operator=(const SALOMEDS_TableOfStringAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfStringAttribute* operator->() - { - return (SALOMEDS_TableOfStringAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfStringAttribute* operator->() const - { - return (SALOMEDS_TableOfStringAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfStringAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfStringAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx deleted file mode 100644 index 68b6bbdda..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TargetAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile -#define _Handle_SALOMEDS_TargetAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_TargetAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TargetAttribute); - -class Handle(SALOMEDS_TargetAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TargetAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_TargetAttribute)(const Handle(SALOMEDS_TargetAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_TargetAttribute)(const SALOMEDS_TargetAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_TargetAttribute)& operator=(const Handle(SALOMEDS_TargetAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TargetAttribute)& operator=(const SALOMEDS_TargetAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TargetAttribute* operator->() - { - return (SALOMEDS_TargetAttribute *)ControlAccess(); - } - - SALOMEDS_TargetAttribute* operator->() const - { - return (SALOMEDS_TargetAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TargetAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TargetAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx deleted file mode 100644 index a16b6bc72..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TextColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile -#define _Handle_SALOMEDS_TextColorAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_RealArray_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_RealArray); -class SALOMEDS_TextColorAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextColorAttribute); - -class Handle(SALOMEDS_TextColorAttribute) : public Handle(TDataStd_RealArray) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TextColorAttribute)():Handle(TDataStd_RealArray)() {} - Handle(SALOMEDS_TextColorAttribute)(const Handle(SALOMEDS_TextColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle) - { - } - - Handle(SALOMEDS_TextColorAttribute)(const SALOMEDS_TextColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem) - { - } - - Handle(SALOMEDS_TextColorAttribute)& operator=(const Handle(SALOMEDS_TextColorAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TextColorAttribute)& operator=(const SALOMEDS_TextColorAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TextColorAttribute* operator->() - { - return (SALOMEDS_TextColorAttribute *)ControlAccess(); - } - - SALOMEDS_TextColorAttribute* operator->() const - { - return (SALOMEDS_TextColorAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TextColorAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TextColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx deleted file mode 100644 index d1a6d4649..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TextHighlightColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile -#define _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_RealArray_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_RealArray); -class SALOMEDS_TextHighlightColorAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute); - -class Handle(SALOMEDS_TextHighlightColorAttribute) : public Handle(TDataStd_RealArray) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TextHighlightColorAttribute)():Handle(TDataStd_RealArray)() {} - Handle(SALOMEDS_TextHighlightColorAttribute)(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle) - { - } - - Handle(SALOMEDS_TextHighlightColorAttribute)(const SALOMEDS_TextHighlightColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem) - { - } - - Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const SALOMEDS_TextHighlightColorAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TextHighlightColorAttribute* operator->() - { - return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess(); - } - - SALOMEDS_TextHighlightColorAttribute* operator->() const - { - return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TextHighlightColorAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TextHighlightColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index f844f79c6..0d9bac30a 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -55,13 +55,13 @@ dist_salomescript_DATA = SALOME_DriverPy.py # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @BOOST_CPPFLAGS@ \ -I$(srcdir)/../HDFPersist \ @HDF5_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ + -I$(srcdir)/../DF \ -I$(srcdir)/../SALOMEDSImpl \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../GenericObj \ @@ -82,11 +82,11 @@ COMMON_LIBS =\ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ + ../DF/libDF.la \ ../SALOMEDSImpl/libSalomeDSImpl.la \ ../GenericObj/libSalomeGenericObj.la \ ../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \ $(top_builddir)/idl/libSalomeIDLKernel.la\ - @CAS_KERNEL@ \ @HDF5_LIBS@ \ $(LDXMUFLAGS) @@ -184,30 +184,6 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeParameter.cxx \ SALOMEDS_AttributeString.cxx \ SALOMEDS_IParameters.cxx \ - \ - Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ - Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \ - Handle_SALOMEDS_DrawableAttribute.hxx \ - Handle_SALOMEDS_ExpandableAttribute.hxx \ - Handle_SALOMEDS_ExternalFileDef.hxx \ - Handle_SALOMEDS_FileType.hxx \ - Handle_SALOMEDS_IORAttribute.hxx \ - Handle_SALOMEDS_LocalIDAttribute.hxx \ - Handle_SALOMEDS_OCAFApplication.hxx \ - Handle_SALOMEDS_OpenedAttribute.hxx \ - Handle_SALOMEDS_PersRefAttribute.hxx \ - Handle_SALOMEDS_PixMapAttribute.hxx \ - Handle_SALOMEDS_PythonObjectAttribute.hxx \ - Handle_SALOMEDS_SelectableAttribute.hxx \ - Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx \ - Handle_SALOMEDS_SequenceOfRealAttribute.hxx \ - Handle_SALOMEDS_StudyPropertiesAttribute.hxx \ - Handle_SALOMEDS_TableOfIntegerAttribute.hxx \ - Handle_SALOMEDS_TableOfRealAttribute.hxx \ - Handle_SALOMEDS_TableOfStringAttribute.hxx \ - Handle_SALOMEDS_TargetAttribute.hxx \ - Handle_SALOMEDS_TextColorAttribute.hxx \ - Handle_SALOMEDS_TextHighlightColorAttribute.hxx \ SALOMEDS_AttLong_i.hxx \ SALOMEDS_AttReal_i.hxx \ SALOMEDS_AttributeComment.hxx \ @@ -273,37 +249,14 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_ChildIterator.hxx \ SALOMEDS_ChildIterator_i.hxx \ SALOMEDS_ClientAttributes.hxx \ - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx \ - SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx \ - SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ - SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \ - SALOMEDS_DataMapOfIntegerString.hxx \ - SALOMEDS_DataMapStringLabel.hxx \ - SALOMEDS_DrawableAttribute.hxx \ SALOMEDS_Driver_i.hxx \ - SALOMEDS_ExpandableAttribute.hxx \ - SALOMEDS_ExternalFileDef.hxx \ - SALOMEDS_FileType.hxx \ - SALOMEDS_FlagsAttribute.hxx \ SALOMEDS_GenericAttribute.hxx \ SALOMEDS_GenericAttribute_i.hxx \ - SALOMEDS_GraphicAttribute.hxx \ SALOMEDS.hxx \ - SALOMEDS_IORAttribute.hxx \ - SALOMEDS_LocalIDAttribute.hxx \ - SALOMEDS_OCAFApplication.hxx \ - SALOMEDS_OpenedAttribute.hxx \ - SALOMEDS_PersRefAttribute.hxx \ - SALOMEDS_PixMapAttribute.hxx \ - SALOMEDS_PythonObjectAttribute.hxx \ - SALOMEDS_SAttribute_i.hxx \ SALOMEDS_SComponent.hxx \ SALOMEDS_SComponent_i.hxx \ SALOMEDS_SComponentIterator.hxx \ SALOMEDS_SComponentIterator_i.hxx \ - SALOMEDS_SelectableAttribute.hxx \ - SALOMEDS_SequenceOfIntegerAttribute.hxx \ - SALOMEDS_SequenceOfRealAttribute.hxx \ SALOMEDS_SObject.hxx \ SALOMEDS_SObject_i.hxx \ SALOMEDS_StudyBuilder.hxx \ @@ -312,13 +265,6 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_Study_i.hxx \ SALOMEDS_StudyManager.hxx \ SALOMEDS_StudyManager_i.hxx \ - SALOMEDS_StudyPropertiesAttribute.hxx \ - SALOMEDS_TableOfIntegerAttribute.hxx \ - SALOMEDS_TableOfRealAttribute.hxx \ - SALOMEDS_TableOfStringAttribute.hxx \ - SALOMEDS_TargetAttribute.hxx \ - SALOMEDS_TextColorAttribute.hxx \ - SALOMEDS_TextHighlightColorAttribute.hxx \ SALOMEDS_UseCaseBuilder.hxx \ SALOMEDS_UseCaseBuilder_i.hxx \ SALOMEDS_UseCaseIterator.hxx \ @@ -342,17 +288,8 @@ bin_PROGRAMS = SALOMEDS_Server SALOMEDS_Client SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS) -SALOMEDS_Server_LDADD = \ - libSalomeDS.la $(COMMON_LIBS) \ - ../ResourcesManager/libSalomeResourcesManager.la \ - @CAS_OCAF@ \ - @CORBA_LIBS@ +SALOMEDS_Server_LDADD = libSalomeDS.la SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS) -SALOMEDS_Client_LDADD = \ - libSalomeDS.la $(COMMON_LIBS) \ - ../ResourcesManager/libSalomeResourcesManager.la \ - -lTKLCAF -lTKMath \ - @CORBA_LIBS@ - +SALOMEDS_Client_LDADD = libSalomeDS.la diff --git a/src/SALOMEDS/SALOMEDS.cdl b/src/SALOMEDS/SALOMEDS.cdl deleted file mode 100644 index 4e256f88b..000000000 --- a/src/SALOMEDS/SALOMEDS.cdl +++ /dev/null @@ -1,59 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS.cdl --- Author : Yves FRICAUD --- Module : SALOME - -package SALOMEDS - -uses TDocStd, - TDF, - TCollection, - TColStd, - TDataStd - - -is - - class OCAFApplication ; - class IORAttribute ; - class PersRefAttribute; - class SequenceOfRealAttribute; - class SequenceOfIntegerAttribute; - class DrawableAttribute; - class SelectableAttribute; - class ExpandableAttribute; - class OpenedAttribute; - class PixMapAttribute; - class TextColorAttribute; - class TextHighlightColorAttribute; - class LocalIDAttribute; - class UserIDAttribute; - class TableOfIntegerAttribute; - class TableOfRealAttribute; - class StudyPropertiesAttribute; - class PythonObjectAttribute; - - class DataMapStringLabel instantiates DataMap from TCollection - (ExtendedString from TColleciton, - Label from TDF, - ExtendedString from TCollection); - -end SALOMEDS; diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx index e4fed9600..b126fe493 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx @@ -28,8 +28,8 @@ #include "SALOMEDS_AttLong_i.hxx" #include "utilities.h" -#include #include +#include using namespace std; //============================================================================ @@ -40,7 +40,7 @@ using namespace std; void SALOMEDS_AttLong_i::Set(CORBA::Long i) { CheckLocked(); - TDataStd_Integer::Set (_Lab,i); + SALOMEDSImpl_AttributeInteger::Set (_Lab,i); } //============================================================================ @@ -50,9 +50,9 @@ void SALOMEDS_AttLong_i::Set(CORBA::Long i) //============================================================================ CORBA::Long SALOMEDS_AttLong_i::Get() { - Handle(TDataStd_Integer) Att; + SALOMEDSImpl_AttributeInteger* Att = NULL; CORBA::Long x; - if (_Lab.FindAttribute(TDataStd_Integer::GetID(),Att)) + if ((Att=(SALOMEDSImpl_AttributeInteger*)_Lab.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) x = Att->Get (); return x; } @@ -88,8 +88,7 @@ void SALOMEDS_AttLong_i::Load() //============================================================================ CORBA::Boolean SALOMEDS_AttLong_i::GetPtr(SALOMEDS::SObject_ptr anObject) { - Handle(TDataStd_Integer) Att; - return _Lab.FindAttribute(TDataStd_Integer::GetID(),Att); + return (_Lab.IsAttribute(SALOMEDSImpl_AttributeInteger::GetID())); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx index c0654deae..adb6acb0c 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx @@ -30,7 +30,6 @@ #define __SALOMEDS_ATTLONG_I_H__ // IDL headers -#include #include #include CORBA_SERVER_HEADER(SALOMEDS_AttLong) #include "SALOMEDS_BasicAttribute_i.hxx" diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx index ab3e6795a..30740a810 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx @@ -28,9 +28,9 @@ #include "SALOMEDS_AttReal_i.hxx" #include "utilities.h" -#include #include #include +#include using namespace std; //============================================================================ @@ -41,7 +41,7 @@ using namespace std; void SALOMEDS_AttReal_i::Set(CORBA::Double r) { CheckLocked(); - TDataStd_Real::Set (_Lab,r); + SALOMEDSImpl_AttributeReal::Set (_Lab,r); } //============================================================================ @@ -51,9 +51,9 @@ void SALOMEDS_AttReal_i::Set(CORBA::Double r) //============================================================================ CORBA::Double SALOMEDS_AttReal_i::Get() { - Handle(TDataStd_Real) Att; + SALOMEDSImpl_AttributeReal* Att; CORBA::Double x; - if (_Lab.FindAttribute(TDataStd_Real::GetID(),Att)) + if ((Att=(SALOMEDSImpl_AttributeReal*)_Lab.FindAttribute(TDataStd_Real::GetID()))) x = Att->Get (); return x; } @@ -89,8 +89,7 @@ void SALOMEDS_AttReal_i::Load() //============================================================================ CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject) { - Handle(TDataStd_Real) Att; - return _Lab.FindAttribute(TDataStd_Real::GetID(),Att); + return _Lab.IsAttribute(SALOMEDSImpl_AttributeReal::GetID()); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx index e03a26942..65fda690a 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx @@ -30,7 +30,6 @@ #define __SALOMEDS_ATTREAL_I_H__ // IDL headers -#include #include #include CORBA_SERVER_HEADER(SALOMEDS_AttReal) #include "SALOMEDS_BasicAttribute_i.hxx" diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx index 84dfa5945..7bb139c31 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr) +SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeComment::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeComment::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx index 978982444..117e87c02 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeComment: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeComment { public: - SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr); + SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr); SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr); ~SALOMEDS_AttributeComment(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx index bdc1d86e2..a7901b036 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeComment_i.hxx" -#include #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" @@ -35,7 +34,7 @@ char* SALOMEDS_AttributeComment_i::Value() SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -44,6 +43,7 @@ void SALOMEDS_AttributeComment_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); - TCollection_AsciiString aStr((char*)value); - Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); + CORBA::String_var Str = CORBA::string_dup(value); + string aValue((char*)Str.in()); + dynamic_cast(_impl)->SetValue(aValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx index e97589cce..f5c780706 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeComment_i: public virtual POA_SALOMEDS::AttributeComment public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeComment_i(const Handle(SALOMEDSImpl_AttributeComment)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeComment_i(SALOMEDSImpl_AttributeComment* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeComment_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx index 8f4ed701a..2c3c716e1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeDrawable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr) +SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeDrawable::IsDrawable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable(); + aValue = (bool)dynamic_cast(_local_impl)->IsDrawable(); } else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable(); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeDrawable::SetDrawable(bool value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value); + dynamic_cast(_local_impl)->SetDrawable((int)value); } else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx index 9236c4aa7..5e5a0cdee 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeDrawable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeDrawable { public: - SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr); + SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr); SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr); ~SALOMEDS_AttributeDrawable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx index 1fecbad88..babf93efa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx @@ -31,12 +31,12 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1); + return (dynamic_cast(_impl)->IsDrawable() == 1); } void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value); + dynamic_cast(_impl)->SetDrawable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx index f023c9e1b..f8a4bb386 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeDrawable_i: public virtual POA_SALOMEDS::AttributeDrawab { public: - SALOMEDS_AttributeDrawable_i(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeDrawable_i(SALOMEDSImpl_AttributeDrawable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeDrawable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx index 49ec9e140..399c81bd0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx @@ -24,11 +24,7 @@ #include "SALOMEDS_AttributeExpandable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable - (const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr) +SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +40,7 @@ bool SALOMEDS_AttributeExpandable::IsExpandable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable(); + aValue = (bool)dynamic_cast(_local_impl)->IsExpandable(); } else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable(); return aValue; @@ -55,7 +51,7 @@ void SALOMEDS_AttributeExpandable::SetExpandable(bool value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value); + dynamic_cast(_local_impl)->SetExpandable((int)value); } else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx index 68ebe8fd1..364d8dcb3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExpandable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExpandable { public: - SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr); + SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr); SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr); ~SALOMEDS_AttributeExpandable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx index 87a9694dd..a9ee7e17b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx @@ -30,12 +30,12 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1); + return (dynamic_cast(_impl)->IsExpandable() == 1); } void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value); + dynamic_cast(_impl)->SetExpandable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx index 160257fc3..477301ad0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeExpandable_i: public virtual POA_SALOMEDS::AttributeExpa { public: - SALOMEDS_AttributeExpandable_i(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeExpandable_i(SALOMEDSImpl_AttributeExpandable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeExpandable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx index e2bc4f33e..f3b382914 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx @@ -23,12 +23,9 @@ #include "SALOMEDS_AttributeExternalFileDef.hxx" #include "SALOMEDS.hxx" - #include -#include -#include -SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr) +SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +41,7 @@ std::string SALOMEDS_AttributeExternalFileDef::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +52,7 @@ void SALOMEDS_AttributeExternalFileDef::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx index 4c85cbd7c..f1bc56cde 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExternalFileDef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExternalFileDef { public: - SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr); + SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr); SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr); ~SALOMEDS_AttributeExternalFileDef(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx index 1d7339b80..8432b3dee 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeExternalFileDef_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ char* SALOMEDS_AttributeExternalFileDef_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,5 @@ void SALOMEDS_AttributeExternalFileDef_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx index 861d429f3..753024aa7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExternalFileDef_i: public virtual POA_SALOMEDS::Attribut { public: - SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeExternalFileDef_i(SALOMEDSImpl_AttributeExternalFileDef* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {} ~SALOMEDS_AttributeExternalFileDef_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx index 0ae6b9045..065535367 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr) +SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeFileType::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeFileType::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx index 82db6239e..cbc6a7af6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeFileType: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFileType { public: - SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr); + SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr); SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr); ~SALOMEDS_AttributeFileType(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx index 3fc7a683d..c445c2d9c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeFileType_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ char* SALOMEDS_AttributeFileType_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,6 @@ void SALOMEDS_AttributeFileType_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); + string aValue((char*)Str.in()); + dynamic_cast(_impl)->SetValue(aValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx index fac9b0f80..fa864b6b6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeFileType_i: public virtual POA_SALOMEDS::AttributeFileTy public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeFileType_i(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeFileType_i(SALOMEDSImpl_AttributeFileType* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeFileType_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx index 0367e538e..153134969 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeFlags.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr) +SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ int SALOMEDS_AttributeFlags::GetFlags() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get(); + aValue = dynamic_cast(_local_impl)->Get(); } else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeFlags::SetFlags(int theFlags) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags); + dynamic_cast(_local_impl)->Set(theFlags); } else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags); } @@ -67,7 +64,7 @@ void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl); + SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast(_local_impl); if (theValue) anAttr->Set(anAttr->Get() | theFlag); else diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx index e2a3cfcc6..14cf6f670 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeFlags: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFlags { public: - SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr); + SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr); SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr); ~SALOMEDS_AttributeFlags(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx index fe41264e5..3852207e6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx @@ -46,7 +46,7 @@ using namespace std; CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get(); + return dynamic_cast(_impl)->Get(); } //======================================================================= @@ -56,7 +56,7 @@ CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags ); + dynamic_cast(_impl)->Set( theFlags ); } //======================================================================= @@ -66,7 +66,7 @@ void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false; + return dynamic_cast(_impl)->Get() & theFlag ? true : false; } //======================================================================= @@ -76,7 +76,7 @@ CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue ) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl); + SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast(_impl); if ( theValue ) anAttr->Set( anAttr->Get() | theFlag ); else diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx index 265f1ff4f..20d5e3b9a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx @@ -49,7 +49,7 @@ class SALOMEDS_AttributeFlags_i: public virtual POA_SALOMEDS::AttributeFlags, { public: - SALOMEDS_AttributeFlags_i( const Handle(SALOMEDSImpl_AttributeFlags)& theAttr, CORBA::ORB_ptr orb ) + SALOMEDS_AttributeFlags_i( SALOMEDSImpl_AttributeFlags* theAttr, CORBA::ORB_ptr orb ) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeFlags_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx index 43fc2d7ef..14af9e948 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeGraphic.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr) +SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +41,7 @@ bool SALOMEDS_AttributeGraphic::GetVisibility(int theViewId) bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId); + aValue = (bool)dynamic_cast(_local_impl)->GetVisibility(theViewId); } else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeGraphic::SetVisibility(int theViewId, bool theValue) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue); + dynamic_cast(_local_impl)->SetVisibility(theViewId, theValue); } else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx index d5c0888e1..5faff2e96 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeGraphic: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeGraphic { public: - SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr); + SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr); SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr); ~SALOMEDS_AttributeGraphic(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx index 72d1a2d13..bec0d9c21 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx @@ -42,8 +42,8 @@ void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId, CORBA::Boolean theValue ) { SALOMEDS::Locker lock; - if ( !_impl.IsNull() ) - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->SetVisibility( theViewId, theValue ); + if ( _impl ) + dynamic_cast(_impl)->SetVisibility( theViewId, theValue ); } //======================================================================= @@ -53,7 +53,7 @@ void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId, CORBA::Boolean SALOMEDS_AttributeGraphic_i::GetVisibility( CORBA::Long theViewId ) { SALOMEDS::Locker lock; - return !_impl.IsNull() ? Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->GetVisibility( theViewId ) : false; + return ( _impl ) ? dynamic_cast(_impl)->GetVisibility( theViewId ) : false; } diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx index 8a9ec8c7c..ef47d51c2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx @@ -45,7 +45,7 @@ class SALOMEDS_AttributeGraphic_i: public virtual POA_SALOMEDS::AttributeGraphic { public: - SALOMEDS_AttributeGraphic_i( const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr, CORBA::ORB_ptr orb ) + SALOMEDS_AttributeGraphic_i( SALOMEDSImpl_AttributeGraphic* theAttr, CORBA::ORB_ptr orb ) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeGraphic_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx index 348e82436..b41bef603 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr) +SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeIOR::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeIOR::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx index 9099cd681..da9c54c51 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeIOR: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeIOR { public: - SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr); + SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr); SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr); ~SALOMEDS_AttributeIOR(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index e1d058fc0..b53fb5684 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeIOR_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ char* SALOMEDS_AttributeIOR_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,6 +40,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - TCollection_ExtendedString anExtStr((char *)Str.in()); - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(anExtStr); + string anExtStr((char *)Str.in()); + dynamic_cast(_impl)->SetValue(anExtStr); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index ceba370ea..72deae171 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -34,7 +34,7 @@ class SALOMEDS_AttributeIOR_i: public virtual POA_SALOMEDS::AttributeIOR, public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeIOR_i(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeIOR_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx index 1f5496ac3..481b17ad4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeInteger.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr) +SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -40,12 +37,14 @@ SALOMEDS_AttributeInteger::~SALOMEDS_AttributeInteger() int SALOMEDS_AttributeInteger::Value() { - int aValue; + int aValue = 0; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); + } + else { + aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value(); } - else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value(); return aValue; } @@ -54,7 +53,7 @@ void SALOMEDS_AttributeInteger::SetValue(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx index 03c3cb353..e29b864df 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeInteger { public: - SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr); + SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr); SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr); ~SALOMEDS_AttributeInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx index 6b2025b3a..d8f7d69af 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Long SALOMEDS_AttributeInteger_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx index 39b3c20fd..576b4f1dc 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeInteger_i: public virtual POA_SALOMEDS::AttributeInteger public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeInteger_i(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeInteger_i(SALOMEDSImpl_AttributeInteger* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx index 9fd941897..dc559ee8d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx @@ -24,10 +24,8 @@ #include "SALOMEDS_AttributeLocalID.hxx" #include "SALOMEDS.hxx" -#include -#include -SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr) +SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +41,7 @@ int SALOMEDS_AttributeLocalID::Value() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value(); return aValue; @@ -54,7 +52,7 @@ void SALOMEDS_AttributeLocalID::SetValue(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx index 582ac4b08..c695693d5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeLocalID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeLocalID { public: - SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr); + SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr); SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr); ~SALOMEDS_AttributeLocalID(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx index 45bd9f439..3163addec 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx @@ -30,13 +30,13 @@ using namespace std; CORBA::Long SALOMEDS_AttributeLocalID_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx index b68b32298..627a448a4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeLocalID_i: public virtual POA_SALOMEDS::AttributeLocalID { public: - SALOMEDS_AttributeLocalID_i(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeLocalID_i(SALOMEDSImpl_AttributeLocalID* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeLocalID_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx index 2a8d5ec21..943d549d4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeName::SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr) +SALOMEDS_AttributeName::SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeName::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeName::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.hxx b/src/SALOMEDS/SALOMEDS_AttributeName.hxx index 6b159959c..b3a26f92d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeName: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeName { public: - SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr); + SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr); SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr); ~SALOMEDS_AttributeName(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx index 4b5028828..7d534f795 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeName_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ char* SALOMEDS_AttributeName_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -40,5 +39,5 @@ void SALOMEDS_AttributeName_i::SetValue(const char* value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->SetValue(TCollection_ExtendedString((char*)value)); + dynamic_cast(_impl)->SetValue(string(value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx index 03a0178c3..337f4a43d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeName_i: public virtual POA_SALOMEDS::AttributeName, { public: - SALOMEDS_AttributeName_i(const Handle(SALOMEDSImpl_AttributeName)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeName_i(SALOMEDSImpl_AttributeName* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeName_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx index 2338147c0..433a0341c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeOpened.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr) +SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeOpened::IsOpened() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened(); + aValue = (bool)dynamic_cast(_local_impl)->IsOpened(); } else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeOpened::SetOpened(bool value) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value); + dynamic_cast(_local_impl)->SetOpened((int)value); } else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx index dc3e8ed49..2db9b99bb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeOpened: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeOpened { public: - SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr); + SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr); SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr); ~SALOMEDS_AttributeOpened(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx index 0ad4b7a60..0aa297d57 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->IsOpened() == 1); + return (dynamic_cast(_impl)->IsOpened() == 1); } void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) { SALOMEDS::Locker lock; - Standard_Integer val = 0; + int val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->SetOpened(val); + dynamic_cast(_impl)->SetOpened(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx index e5901db7e..dff3f3ac1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeOpened_i: public virtual POA_SALOMEDS::AttributeOpened, { public: - SALOMEDS_AttributeOpened_i(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeOpened_i(SALOMEDSImpl_AttributeOpened* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeOpened_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx index dd6c188f3..6f4262aed 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx @@ -25,7 +25,8 @@ #include "SALOMEDS.hxx" #include -#include + +using namespace std; //======================================================================= /*! @@ -33,7 +34,7 @@ * Purpose : Creates a new instance of SALOMEDS_AttributeParameter */ //======================================================================= -SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr) +SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -68,7 +69,7 @@ void SALOMEDS_AttributeParameter::SetInt(const string& theID, const int theValue if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetInt(theID, theValue); + dynamic_cast(_local_impl)->SetInt(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID.c_str(), theValue); @@ -85,7 +86,7 @@ int SALOMEDS_AttributeParameter::GetInt(const string& theID) int aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetInt(theID); + aValue = dynamic_cast(_local_impl)->GetInt(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID.c_str()); @@ -104,7 +105,7 @@ void SALOMEDS_AttributeParameter::SetReal(const string& theID, const double& the if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetReal(theID, theValue); + dynamic_cast(_local_impl)->SetReal(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID.c_str(), theValue); @@ -121,7 +122,7 @@ double SALOMEDS_AttributeParameter::GetReal(const string& theID) double aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetReal(theID); + aValue = dynamic_cast(_local_impl)->GetReal(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID.c_str()); @@ -140,7 +141,7 @@ void SALOMEDS_AttributeParameter::SetString(const string& theID, const string& t if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, theValue); + dynamic_cast(_local_impl)->SetString(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID.c_str(), theValue.c_str()); @@ -157,7 +158,7 @@ string SALOMEDS_AttributeParameter::GetString(const string& theID) string aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID); + aValue = dynamic_cast(_local_impl)->GetString(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID.c_str()); @@ -176,7 +177,7 @@ void SALOMEDS_AttributeParameter::SetBool(const string& theID, const bool& theVa if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetBool(theID, theValue); + dynamic_cast(_local_impl)->SetBool(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID.c_str(), theValue); @@ -192,7 +193,7 @@ bool SALOMEDS_AttributeParameter::GetBool(const string& theID) { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetBool(theID); + return dynamic_cast(_local_impl)->GetBool(theID); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID.c_str()); @@ -210,7 +211,7 @@ void SALOMEDS_AttributeParameter::SetRealArray(const string& theID, const vector if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetRealArray(theID, theArray); + dynamic_cast(_local_impl)->SetRealArray(theID, theArray); } else { SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq; @@ -234,7 +235,7 @@ vector SALOMEDS_AttributeParameter::GetRealArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetRealArray(theID); + return dynamic_cast(_local_impl)->GetRealArray(theID); } else { SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID.c_str()); @@ -259,7 +260,7 @@ void SALOMEDS_AttributeParameter::SetIntArray(const string& theID, const vector< if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetIntArray(theID, theArray); + dynamic_cast(_local_impl)->SetIntArray(theID, theArray); } else { SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq; @@ -283,7 +284,7 @@ vector SALOMEDS_AttributeParameter::GetIntArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetIntArray(theID); + return dynamic_cast(_local_impl)->GetIntArray(theID); } else { SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID.c_str()); @@ -308,7 +309,7 @@ void SALOMEDS_AttributeParameter::SetStrArray(const string& theID, const vector< if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetStrArray(theID, theArray); + dynamic_cast(_local_impl)->SetStrArray(theID, theArray); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq; @@ -332,7 +333,7 @@ vector SALOMEDS_AttributeParameter::GetStrArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetStrArray(theID); + return dynamic_cast(_local_impl)->GetStrArray(theID); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID.c_str()); @@ -357,7 +358,7 @@ bool SALOMEDS_AttributeParameter::IsSet(const string& theID, const int theType) { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsSet(theID, (Parameter_Types)theType); + return dynamic_cast(_local_impl)->IsSet(theID, (Parameter_Types)theType); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID.c_str(), theType); @@ -375,7 +376,7 @@ bool SALOMEDS_AttributeParameter::RemoveID(const string& theID, const int theTyp if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->RemoveID(theID, (Parameter_Types)theType); + return dynamic_cast(_local_impl)->RemoveID(theID, (Parameter_Types)theType); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID.c_str(), theType); @@ -392,8 +393,8 @@ _PTR(AttributeParameter) SALOMEDS_AttributeParameter::GetFather() SALOMEDSClient_AttributeParameter* AP = NULL; if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetFather(); - if(AP_impl.IsNull()) return _PTR(AttributeParameter)(AP); + SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast(_local_impl)->GetFather(); + if(!AP_impl) return _PTR(AttributeParameter)(AP); AP = new SALOMEDS_AttributeParameter(AP_impl); } else { @@ -415,7 +416,7 @@ bool SALOMEDS_AttributeParameter::HasFather() { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->HasFather(); + return dynamic_cast(_local_impl)->HasFather(); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->HasFather(); @@ -431,7 +432,7 @@ bool SALOMEDS_AttributeParameter::IsRoot() { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsRoot(); + return dynamic_cast(_local_impl)->IsRoot(); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsRoot(); @@ -447,7 +448,7 @@ void SALOMEDS_AttributeParameter::Clear() { if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->Clear(); + dynamic_cast(_local_impl)->Clear(); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->Clear(); @@ -464,7 +465,7 @@ vector SALOMEDS_AttributeParameter::GetIDs(const int theType) vector v; if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl); + SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast(_local_impl); return AP_impl->GetIDs((Parameter_Types)theType); } else { diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx index e2eaca613..065834e60 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeParameter: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeParameter { public: - SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr); + SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr); SALOMEDS_AttributeParameter(SALOMEDS::AttributeParameter_ptr theAttr); ~SALOMEDS_AttributeParameter(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx index e126d44a4..8fd549db3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeParameter_i.hxx" #include "SALOMEDS.hxx" -#include #include @@ -40,7 +39,7 @@ void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theVal { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetInt(theID, theValue); + dynamic_cast(_impl)->SetInt(theID, theValue); } //======================================================================= @@ -52,7 +51,7 @@ void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theVal CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetInt(theID); + return dynamic_cast(_impl)->GetInt(theID); } //======================================================================= @@ -65,7 +64,7 @@ void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double the { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetReal(theID, theValue); + dynamic_cast(_impl)->SetReal(theID, theValue); } //======================================================================= @@ -77,7 +76,7 @@ void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double the CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetReal(theID); + return dynamic_cast(_impl)->GetReal(theID); } //======================================================================= @@ -90,7 +89,7 @@ void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* the { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); impl->SetString(theID, theValue); } @@ -103,7 +102,7 @@ void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* the char* SALOMEDS_AttributeParameter_i::GetString(const char* theID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); CORBA::String_var c_s = CORBA::string_dup(impl->GetString(theID).c_str()); return c_s._retn(); } @@ -118,7 +117,7 @@ void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean th { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetBool(theID, theValue); + dynamic_cast(_impl)->SetBool(theID, theValue); } //======================================================================= @@ -130,7 +129,7 @@ void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean th CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetBool(theID); + return dynamic_cast(_impl)->GetBool(theID); } //======================================================================= @@ -149,7 +148,7 @@ void SALOMEDS_AttributeParameter_i::SetRealArray(const char* theID, const SALOME v.resize(length); for(int i = 0; iSetRealArray(theID, v); + dynamic_cast(_impl)->SetRealArray(theID, v); } //======================================================================= @@ -162,7 +161,7 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(const char* the { SALOMEDS::Locker lock; SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetRealArray(theID); + vector v = dynamic_cast(_impl)->GetRealArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -187,7 +186,7 @@ void SALOMEDS_AttributeParameter_i::SetIntArray(const char* theID, const SALOMED v.resize(length); for(int i = 0; iSetIntArray(theID, v); + dynamic_cast(_impl)->SetIntArray(theID, v); } //======================================================================= @@ -200,7 +199,7 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(const char* theID) { SALOMEDS::Locker lock; SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIntArray(theID); + vector v = dynamic_cast(_impl)->GetIntArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -225,7 +224,7 @@ void SALOMEDS_AttributeParameter_i::SetStrArray(const char* theID, const SALOMED v.resize(length); for(int i = 0; iSetStrArray(theID, v); + dynamic_cast(_impl)->SetStrArray(theID, v); } //======================================================================= @@ -238,7 +237,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theI { SALOMEDS::Locker lock; SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetStrArray(theID); + vector v = dynamic_cast(_impl)->GetStrArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -258,7 +257,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theI CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(const char* theID, CORBA::Long theType) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsSet(theID, (Parameter_Types)theType); + return dynamic_cast(_impl)->IsSet(theID, (Parameter_Types)theType); } //======================================================================= @@ -271,7 +270,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA: { SALOMEDS::Locker lock; CheckLocked(); - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->RemoveID(theID, (Parameter_Types)theType); + return dynamic_cast(_impl)->RemoveID(theID, (Parameter_Types)theType); } //======================================================================= @@ -283,7 +282,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA: SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); SALOMEDS_AttributeParameter_i* attr = new SALOMEDS_AttributeParameter_i(impl, _orb); return attr->AttributeParameter::_this(); } @@ -297,7 +296,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather() CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->HasFather(); + return dynamic_cast(_impl)->HasFather(); } //======================================================================= @@ -309,7 +308,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather() CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsRoot(); + return dynamic_cast(_impl)->IsRoot(); } //======================================================================= @@ -321,7 +320,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot() void SALOMEDS_AttributeParameter_i::Clear() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->Clear(); + dynamic_cast(_impl)->Clear(); } @@ -335,7 +334,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetIDs(CORBA::Long theType) { SALOMEDS::Locker lock; SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; - vector A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType); + vector A = dynamic_cast(_impl)->GetIDs((Parameter_Types)theType); if(A.size()) { int length = A.size(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx index 9cff082f2..4cd8304e4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx @@ -42,7 +42,7 @@ class SALOMEDS_AttributeParameter_i: public virtual POA_SALOMEDS::AttributeParam { public: - SALOMEDS_AttributeParameter_i(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeParameter_i(SALOMEDSImpl_AttributeParameter* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeParameter_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx index a4458ab79..da23c57e4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr) +SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributePersistentRef::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributePersistentRef::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx index a66387744..730994352 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePersistentRef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePersistentRef { public: - SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr); + SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr); SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr); ~SALOMEDS_AttributePersistentRef(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx index 13e1dd996..3b2994c75 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributePersistentRef_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ char* SALOMEDS_AttributePersistentRef_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,5 @@ void SALOMEDS_AttributePersistentRef_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx index 9d1244613..c5fa98e91 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx @@ -34,7 +34,7 @@ class SALOMEDS_AttributePersistentRef_i: public virtual POA_SALOMEDS::AttributeP public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributePersistentRef_i(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePersistentRef_i(SALOMEDSImpl_AttributePersistentRef* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePersistentRef_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx index 66561401d..752e2e482 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr) +SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +42,7 @@ bool SALOMEDS_AttributePixMap::HasPixMap() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap(); + ret = dynamic_cast(_local_impl)->HasPixMap(); } else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); return ret; @@ -55,8 +53,7 @@ std::string SALOMEDS_AttributePixMap::GetPixMap() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap):: - DownCast(_local_impl)->GetPixMap()).ToCString(); + aValue = dynamic_cast(_local_impl)->GetPixMap(); } else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); return aValue; @@ -67,7 +64,7 @@ void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str()); + dynamic_cast(_local_impl)->SetPixMap(value); } else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx index e81a4b764..44092f92f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePixMap: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePixMap { public: - SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr); + SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr); SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr); ~SALOMEDS_AttributePixMap(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx index 96cc1ea4e..d532e90f7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx @@ -25,22 +25,19 @@ #include "SALOMEDS_AttributePixMap_i.hxx" #include "SALOMEDS.hxx" -#include - using namespace std; CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap(); + return dynamic_cast(_impl)->HasPixMap(); } char* SALOMEDS_AttributePixMap_i::GetPixMap() { SALOMEDS::Locker lock; CORBA::String_var S = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap):: - DownCast(_impl)->GetPixMap()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->GetPixMap().c_str()); return S._retn(); } @@ -49,5 +46,5 @@ void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->SetPixMap(TCollection_ExtendedString(Str)); + dynamic_cast(_impl)->SetPixMap(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx index edf03f799..7ace31b1b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePixMap_i: public virtual POA_SALOMEDS::AttributePixMap, { public: - SALOMEDS_AttributePixMap_i(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePixMap_i(SALOMEDSImpl_AttributePixMap* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePixMap_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx index cb97c18fb..ce3e9607b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr) +SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +42,7 @@ bool SALOMEDS_AttributePythonObject::IsScript() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript(); + ret = dynamic_cast(_local_impl)->IsScript(); } else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript(); return ret; @@ -55,8 +53,7 @@ std::string SALOMEDS_AttributePythonObject::GetObject() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_local_impl)->GetObject()).ToCString(); + aValue = dynamic_cast(_local_impl)->GetObject().c_str(); } else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject(); return aValue; @@ -67,8 +64,7 @@ void SALOMEDS_AttributePythonObject::SetObject(const std::string& theSequence, b if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript); + dynamic_cast(_local_impl)->SetObject(theSequence, IsScript); } else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx index e26235ca7..24f07d42c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject { public: - SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr); + SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr); SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr); ~SALOMEDS_AttributePythonObject(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx index 316eb9142..77234207f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx @@ -24,8 +24,6 @@ #include "SALOMEDS_AttributePythonObject_i.hxx" #include "SALOMEDS.hxx" -#include -#include using namespace std; @@ -34,22 +32,21 @@ void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA: SALOMEDS::Locker lock; CheckLocked(); char *aSeq = CORBA::string_dup(theSequence); - Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript); + dynamic_cast(_impl)->SetObject(aSeq, IsScript); } char* SALOMEDS_AttributePythonObject_i::GetObject() { SALOMEDS::Locker lock; - TCollection_AsciiString aSeq(Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_impl)->GetObject().ToCString()); - CORBA::String_var aStr = CORBA::string_dup(aSeq.ToCString()); + string aSeq(dynamic_cast(_impl)->GetObject()); + CORBA::String_var aStr = CORBA::string_dup(aSeq.c_str()); return aStr._retn(); } CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript(); + return dynamic_cast(_impl)->IsScript(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx index d5629488d..8ee76137e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributePythonObject_i: public virtual POA_SALOMEDS::AttributePy public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributePythonObject_i(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePythonObject_i(SALOMEDSImpl_AttributePythonObject* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePythonObject_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx index c61481837..6d37fdfd7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeReal.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr) +SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ double SALOMEDS_AttributeReal::Value() double aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value(); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeReal::SetValue(double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx index d579571c3..063d954d3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeReal { public: - SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr); + SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr); SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr); ~SALOMEDS_AttributeReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx index 3016d83ef..92614b9b0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx @@ -31,13 +31,13 @@ using namespace std; CORBA::Double SALOMEDS_AttributeReal_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx index 76a1b906d..b564219c8 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeReal_i: public virtual POA_SALOMEDS::AttributeReal, public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeReal_i(const Handle(SALOMEDSImpl_AttributeReal)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeReal_i(SALOMEDSImpl_AttributeReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx index 872f25d00..4ba2407e0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeSelectable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr) +SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeSelectable::IsSelectable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable(); + aValue = (bool)dynamic_cast(_local_impl)->IsSelectable(); } else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeSelectable::SetSelectable(bool value) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value); + dynamic_cast(_local_impl)->SetSelectable((int)value); } else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx index 4cb716f25..41c642308 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeSelectable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSelectable { public: - SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr); + SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr); SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr); ~SALOMEDS_AttributeSelectable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx index b296ac785..038f23c8e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->IsSelectable() == 1); + return (dynamic_cast(_impl)->IsSelectable() == 1); } void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) { SALOMEDS::Locker lock; - Standard_Integer val = 0; + int val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->SetSelectable(val); + dynamic_cast(_impl)->SetSelectable(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx index 6d10fbad3..8fe3c51f5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeSelectable_i: public virtual POA_SALOMEDS::AttributeSele public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeSelectable_i(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeSelectable_i(SALOMEDSImpl_AttributeSelectable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSelectable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx index 16cc47d2b..3b06809a5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx @@ -24,12 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfInteger.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger - (const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr) + (SALOMEDSImpl_AttributeSequenceOfInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,9 +43,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector& other) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - for (i = 0; i < aLength; i++) aSeq->Append(other[i]); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq); + dynamic_cast(_local_impl)->Assign(other); } else { SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq(); @@ -65,8 +59,8 @@ std::vector SALOMEDS_AttributeSequenceOfInteger::CorbaSequence() int i, aLength; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr; - aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl); + SALOMEDSImpl_AttributeSequenceOfInteger* aSeqAttr; + aSeqAttr = dynamic_cast(_local_impl); aLength = aSeqAttr->Length(); for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); } @@ -84,7 +78,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Add(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value); + dynamic_cast(_local_impl)->Add(value); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value); } @@ -94,7 +88,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Remove(int index) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index); + dynamic_cast(_local_impl)->Remove(index); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index); } @@ -104,7 +98,7 @@ void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value); + dynamic_cast(_local_impl)->ChangeValue(index, value); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value); } @@ -114,7 +108,7 @@ int SALOMEDS_AttributeSequenceOfInteger::Value(int index) int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index); + aValue = dynamic_cast(_local_impl)->Value(index); } else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index); return aValue; @@ -125,7 +119,7 @@ int SALOMEDS_AttributeSequenceOfInteger::Length() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length(); + aValue = dynamic_cast(_local_impl)-> Length(); } else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length(); return aValue; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx index a747bc0af..103ad9827 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeSequenceOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfInteger { public: - SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr); + SALOMEDS_AttributeSequenceOfInteger(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr); SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr); ~SALOMEDS_AttributeSequenceOfInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx index 892646911..311b3a6fa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx @@ -24,7 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" #include "SALOMEDS.hxx" -#include +#include + using namespace std; @@ -33,22 +34,20 @@ void SALOMEDS_AttributeSequenceOfInteger_i::Assign(const SALOMEDS::LongSeq& othe { SALOMEDS::Locker lock; CheckLocked(); - Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger; - for (int i = 0; i < other.length(); i++) { - CasCadeSeq->Append(other[i]); - } - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Assign(CasCadeSeq); + vector aSeq; + for(int i = 0, len = other.length(); i(_impl)->Assign(aSeq); } SALOMEDS::LongSeq* SALOMEDS_AttributeSequenceOfInteger_i::CorbaSequence() { SALOMEDS::Locker lock; SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) CasCadeSeq; - CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl); - CorbaSeq->length(CasCadeSeq->Length()); - for (int i = 0; i < CasCadeSeq->Length(); i++) { - CorbaSeq[i] = CasCadeSeq->Value(i+1);; + const vector& CasCadeSeq = dynamic_cast(_impl)->Array(); + int len = CasCadeSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = CasCadeSeq[i]; } return CorbaSeq._retn(); } @@ -57,32 +56,32 @@ void SALOMEDS_AttributeSequenceOfInteger_i::Add(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Add(value); + dynamic_cast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfInteger_i::Remove(CORBA::Long index) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Remove(index); + dynamic_cast(_impl)->Remove(index); } void SALOMEDS_AttributeSequenceOfInteger_i::ChangeValue(CORBA::Long index, CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->ChangeValue(index, value); + dynamic_cast(_impl)->ChangeValue(index, value); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Value(CORBA::Short index) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Value(index); + return dynamic_cast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Length(); + return dynamic_cast(_impl)->Length(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx index 4ff9e2edf..d5fe4b5d2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeSequenceOfInteger_i: public virtual POA_SALOMEDS::Attrib { public: - SALOMEDS_AttributeSequenceOfInteger_i(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr,CORBA::ORB_ptr orb) + SALOMEDS_AttributeSequenceOfInteger_i(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr,CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSequenceOfInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx index ec1b6811b..18c844028 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx @@ -24,12 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfReal.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal - (const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr) + (SALOMEDSImpl_AttributeSequenceOfReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,9 +43,7 @@ void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector& other) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal; - for (i = 0; i < aLength; i++) aSeq->Append(other[i]); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq); + dynamic_cast(_local_impl)->Assign(other); } else { SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq(); @@ -65,8 +59,8 @@ std::vector SALOMEDS_AttributeSequenceOfReal::CorbaSequence() int i, aLength; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr; - aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl); + SALOMEDSImpl_AttributeSequenceOfReal* aSeqAttr = NULL; + aSeqAttr = dynamic_cast(_local_impl); aLength = aSeqAttr->Length(); for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); } @@ -83,7 +77,7 @@ void SALOMEDS_AttributeSequenceOfReal::Add(double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value); + dynamic_cast(_local_impl)->Add(value); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value); } @@ -93,7 +87,7 @@ void SALOMEDS_AttributeSequenceOfReal::Remove(int index) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index); + dynamic_cast(_local_impl)->Remove(index); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index); } @@ -103,7 +97,7 @@ void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value); + dynamic_cast(_local_impl)->ChangeValue(index, value); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value); } @@ -113,7 +107,7 @@ double SALOMEDS_AttributeSequenceOfReal::Value(int index) double aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index); + aValue = dynamic_cast(_local_impl)->Value(index); } else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index); return aValue; @@ -124,7 +118,7 @@ int SALOMEDS_AttributeSequenceOfReal::Length() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length(); + aValue = dynamic_cast(_local_impl)-> Length(); } else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length(); return aValue; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx index 7688880f6..473e28939 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeSequenceOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfReal { public: - SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr); + SALOMEDS_AttributeSequenceOfReal(SALOMEDSImpl_AttributeSequenceOfReal* theAttr); SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr); ~SALOMEDS_AttributeSequenceOfReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx index 090af5931..7dcaf5dea 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeSequenceOfReal_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,21 +32,22 @@ void SALOMEDS_AttributeSequenceOfReal_i::Assign(const SALOMEDS::DoubleSeq& other { SALOMEDS::Locker lock; CheckLocked(); - Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; + vector CasCadeSeq; for (int i = 0; i < other.length(); i++) { - CasCadeSeq->Append(other[i]); + CasCadeSeq.push_back(other[i]); } - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Assign(CasCadeSeq); + dynamic_cast(_impl)->Assign(CasCadeSeq); } SALOMEDS::DoubleSeq* SALOMEDS_AttributeSequenceOfReal_i::CorbaSequence() { SALOMEDS::Locker lock; SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; - Handle(SALOMEDSImpl_AttributeSequenceOfReal) CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl); - CorbaSeq->length(CasCadeSeq->Length()); - for (int i = 0; i < CasCadeSeq->Length(); i++) { - CorbaSeq[i] = CasCadeSeq->Value(i+1);; + const vector& CasCadeSeq = dynamic_cast(_impl)->Array(); + int len = CasCadeSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = CasCadeSeq[i]; } return CorbaSeq._retn(); } @@ -55,32 +56,32 @@ void SALOMEDS_AttributeSequenceOfReal_i::Add(CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Add(value); + dynamic_cast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfReal_i::Remove(CORBA::Long index) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Remove(index); + dynamic_cast(_impl)->Remove(index); } void SALOMEDS_AttributeSequenceOfReal_i::ChangeValue(CORBA::Long index, CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->ChangeValue(index, value); + dynamic_cast(_impl)->ChangeValue(index, value); } CORBA::Double SALOMEDS_AttributeSequenceOfReal_i::Value(CORBA::Short index) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Value(index); + return dynamic_cast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Length(); + return dynamic_cast(_impl)->Length(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx index 1a70f96ca..3fcbea33f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeSequenceOfReal_i: public virtual POA_SALOMEDS::Attribute public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeSequenceOfReal_i(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeSequenceOfReal_i(SALOMEDSImpl_AttributeSequenceOfReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSequenceOfReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.cxx b/src/SALOMEDS/SALOMEDS_AttributeString.cxx index dcf1f06fd..6feb94ba6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeString::SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr) +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeString::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeString::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeString)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.hxx b/src/SALOMEDS/SALOMEDS_AttributeString.hxx index 025ae7836..8f7942903 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString { public: - SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr); + SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr); SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr); ~SALOMEDS_AttributeString(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx index 62f9de652..468c9720d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeString_i.hxx" -#include #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" @@ -35,7 +34,7 @@ char* SALOMEDS_AttributeString_i::Value() SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -44,6 +43,5 @@ void SALOMEDS_AttributeString_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); - TCollection_AsciiString aStr((char*)value); - Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); + dynamic_cast(_impl)->SetValue(string(value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx index 1fa8e024f..b95b5eb8f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeString_i: public virtual POA_SALOMEDS::AttributeString, public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeString_i(const Handle(SALOMEDSImpl_AttributeString)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeString_i(SALOMEDSImpl_AttributeString* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeString_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index 3bc0afd3d..d3ca2e668 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -24,14 +24,10 @@ #include "SALOMEDS_AttributeStudyProperties.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include -#include +using namespace std; SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties - (const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr) + (SALOMEDSImpl_AttributeStudyProperties* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,9 +45,9 @@ void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); - anImpl->ChangeCreatorName((char*)theName.c_str()); + SALOMEDSImpl_AttributeStudyProperties* anImpl = + dynamic_cast(_local_impl); + anImpl->ChangeCreatorName(theName); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); } @@ -61,9 +57,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_ExtendedString S = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName(); - aName = TCollection_AsciiString(S).ToCString(); + aName = dynamic_cast(_local_impl)->GetCreatorName(); } #ifndef WNT else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); @@ -79,11 +73,11 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + SALOMEDSImpl_AttributeStudyProperties* anImpl = + dynamic_cast(_local_impl); int aTmp; if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; - TCollection_ExtendedString S; + string S; anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } else { SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, @@ -103,7 +97,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast + ret = dynamic_cast (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; @@ -127,11 +121,11 @@ void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMo CheckLocked(); SALOMEDS::Locker lock; if (theMode == "from scratch") - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1); + dynamic_cast(_local_impl)->SetCreationMode(1); else if (theMode == "copy from") - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2); + dynamic_cast(_local_impl)->SetCreationMode(2); else //Not defined - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0); + dynamic_cast(_local_impl)->SetCreationMode(0); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); } @@ -141,7 +135,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() std::string aMode; if (_isLocal) { SALOMEDS::Locker lock; - int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode(); + int mode = dynamic_cast(_local_impl)->GetCreationMode(); if (mode == 1) aMode = "from scratch"; if (mode == 2) aMode = "copy from"; } @@ -154,7 +148,7 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified); + dynamic_cast(_local_impl)->SetModified(theModified); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); @@ -165,7 +159,7 @@ bool SALOMEDS_AttributeStudyProperties::IsModified() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified(); + ret = dynamic_cast(_local_impl)->IsModified(); } else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); @@ -177,7 +171,7 @@ int SALOMEDS_AttributeStudyProperties::GetModified() int isModified; if (_isLocal) { SALOMEDS::Locker lock; - isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified(); + isModified = dynamic_cast(_local_impl)->GetModified(); } else isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); @@ -188,7 +182,7 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked); + dynamic_cast(_local_impl)->SetLocked(theLocked); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); @@ -199,7 +193,7 @@ bool SALOMEDS_AttributeStudyProperties::IsLocked() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked(); + ret = dynamic_cast(_local_impl)->IsLocked(); } else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); @@ -216,9 +210,8 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); - anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear); + SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); + anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), theMinute, @@ -240,20 +233,19 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; + SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - aLength = aNames->Length(); + aLength = aNames.size(); i = ((theWithCreator) ? 1 : 2); for (; i <= aLength; i++) { - theNames.push_back(TCollection_AsciiString(aNames->Value(i)).ToCString()); - theMinutes.push_back(aMinutes->Value(i)); - theHours.push_back(aHours->Value(i)); - theDays.push_back(aDays->Value(i)); - theMonths.push_back(aMonths->Value(i)); - theYears.push_back(aYears->Value(i)); + theNames.push_back(aNames[i-1]); + theMinutes.push_back(aMinutes[i-1]); + theHours.push_back(aHours[i-1]); + theDays.push_back(aDays[i-1]); + theMonths.push_back(aMonths[i-1]); + theYears.push_back(aYears[i-1]); } } else { SALOMEDS::StringSeq_var aNames; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx index 79f3b0684..96eaee418 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx @@ -24,13 +24,13 @@ #ifndef SALOMEDS_AttributeStudyProperties_HeaderFile #define SALOMEDS_AttributeStudyProperties_HeaderFile -#include -#include - #include "SALOMEDSClient_AttributeStudyProperties.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDSImpl_AttributeStudyProperties.hxx" +#include +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -44,7 +44,7 @@ class Standard_EXPORT SALOMEDS_AttributeStudyProperties: public SALOMEDS_Generic { public: - SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr); + SALOMEDS_AttributeStudyProperties(SALOMEDSImpl_AttributeStudyProperties* theAttr); SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr); ~SALOMEDS_AttributeStudyProperties(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx index 1160a058a..149fa2094 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx @@ -24,10 +24,6 @@ #include "SALOMEDS_AttributeStudyProperties_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - using namespace std; #define CREATION_MODE_NOTDEFINED 0 @@ -38,15 +34,14 @@ void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName); + dynamic_cast(_impl)->ChangeCreatorName((char*)theName); } char* SALOMEDS_AttributeStudyProperties_i::GetUserName() { SALOMEDS::Locker lock; - TCollection_ExtendedString S = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + string S = dynamic_cast(_impl)->GetCreatorName(); + CORBA::String_var c_s = CORBA::string_dup(S.c_str()); return c_s._retn(); } @@ -58,11 +53,10 @@ void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute, { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); int aTmp; if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; - TCollection_ExtendedString S; + string S; aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } @@ -73,29 +67,27 @@ CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& CORBA::Long& theYear) { SALOMEDS::Locker lock; - Standard_Integer aMinute; - Standard_Integer aHour; - Standard_Integer aDay; - Standard_Integer aMonth; - Standard_Integer aYear; - if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast - (_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) { + int aMinute; + int aHour; + int aDay; + int aMonth; + int aYear; + if (dynamic_cast(_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) { theMinute = aMinute; theHour = aHour; theDay = aDay; theMonth = aMonth; theYear = aYear; - return Standard_True; + return true; } - return Standard_False; + return false; } void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH); else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY); else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED); @@ -105,7 +97,7 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() { SALOMEDS::Locker lock; CORBA::String_var c_s; - switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) { + switch (dynamic_cast(_impl)->GetCreationMode()) { case CREATION_MODE_SCRATCH: c_s = "from scratch"; break; case CREATION_MODE_COPY: c_s = "copy from"; break; default: c_s = ""; @@ -116,31 +108,31 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified); + dynamic_cast(_impl)->SetModified(theModified); } CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified(); + return dynamic_cast(_impl)->IsModified(); } CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified(); + return dynamic_cast(_impl)->GetModified(); } void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked); + dynamic_cast(_impl)->SetLocked(theLocked); } CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked(); + return dynamic_cast(_impl)->IsLocked(); } void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, @@ -152,8 +144,7 @@ void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); aProp->SetModification((char*)theName, (int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear); } @@ -167,12 +158,11 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS CORBA::Boolean theWithCreator) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int aLength = aNames->Length(); + int aLength = aNames.size(); int aRetLength = aLength - ((theWithCreator) ? 0 : 1); theNames = new SALOMEDS::StringSeq; theMinutes = new SALOMEDS::LongSeq; @@ -188,11 +178,11 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS theYears->length(aRetLength); int a = 0, ind = ((theWithCreator) ? 1 : 2); for (; ind <= aLength; a++, ind++) { - (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(ind)).ToCString()); - (*theMinutes)[a] = aMinutes->Value(ind); - (*theHours)[a] = aHours->Value(ind); - (*theDays)[a] = aDays->Value(ind); - (*theMonths)[a] = aMonths->Value(ind); - (*theYears)[a] = aYears->Value(ind); + (*theNames)[a] = CORBA::string_dup(aNames[ind-1].c_str()); + (*theMinutes)[a] = aMinutes[ind-1]; + (*theHours)[a] = aHours[ind-1]; + (*theDays)[a] = aDays[ind-1]; + (*theMonths)[a] = aMonths[ind-1]; + (*theYears)[a] = aYears[ind-1]; } } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx index f08edbffc..c41e15abe 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeStudyProperties_i: public virtual POA_SALOMEDS::Attribut public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeStudyProperties_i(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeStudyProperties_i(SALOMEDSImpl_AttributeStudyProperties* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeStudyProperties_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx index 829dd0205..58042dfaa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -24,14 +24,10 @@ #include "SALOMEDS_AttributeTableOfInteger.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include - +using namespace std; SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger - (const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr) + (SALOMEDSImpl_AttributeTableOfInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,7 +45,7 @@ void SALOMEDS_AttributeTableOfInteger::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -59,8 +55,7 @@ std::string SALOMEDS_AttributeTableOfInteger::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -71,8 +66,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowTitle(int theIndex, const std::stri if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -83,9 +77,9 @@ void SALOMEDS_AttributeTableOfInteger::SetRowTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq); + vector aSeq; + for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]); + dynamic_cast(_local_impl)->SetRowTitles(aSeq); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +96,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowTitles(); - aLength = aSeq->Length(); - for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString((aSeq->Value(i))).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +111,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumnTitle(int theIndex, const std::s if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +122,9 @@ void SALOMEDS_AttributeTableOfInteger::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq); + vector aSeq; + for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]); + dynamic_cast(_local_impl)->SetColumnTitles(aSeq); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +140,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnTitles(); - aLength = aSeq->Length(); - for (i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +155,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnit(int theIndex, const std::strin if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +166,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vectorAppend((char*)theUnits[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,10 +182,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowUnits(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits(); @@ -216,7 +197,7 @@ int SALOMEDS_AttributeTableOfInteger::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +208,7 @@ int SALOMEDS_AttributeTableOfInteger::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -240,12 +221,9 @@ void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector& theData) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -265,12 +243,9 @@ void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -290,10 +265,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aRow; - aRow = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowData(theRow); - aLength = aRow->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i)); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow); @@ -310,12 +282,9 @@ void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector& theData if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; - for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -335,12 +304,9 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; - for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -360,10 +326,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aColumn; - aColumn = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnData(theColumn); - aLength = aColumn->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i)); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn); @@ -379,8 +342,7 @@ void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int th CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); @@ -396,7 +358,7 @@ bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -408,8 +370,7 @@ int SALOMEDS_AttributeTableOfInteger::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->GetValue(theRow, theColumn); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); @@ -427,10 +388,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aSet; - aSet = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetSetRowIndices(theRow); - aLength = aSet->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = @@ -445,7 +403,7 @@ void SALOMEDS_AttributeTableOfInteger::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx index 34e51b024..5405e049f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfInteger { public: - SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr); + SALOMEDS_AttributeTableOfInteger(SALOMEDSImpl_AttributeTableOfInteger* theAttr); SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr); ~SALOMEDS_AttributeTableOfInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx index 867219dc7..aab700b1b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx @@ -25,14 +25,12 @@ #include "SALOMEDS_AttributeTableOfInteger_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include #include "Utils_ExceptHandlers.hxx" #include #include #include +#include using namespace std; @@ -44,14 +42,14 @@ void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var aStr = CORBA::string_dup(theTitle); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->SetTitle(TCollection_ExtendedString(aStr)); + dynamic_cast(_impl)->SetTitle(string(aStr)); } char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -61,9 +59,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -72,7 +70,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { SetRowTitle(i + 1, theTitles[i]); @@ -82,11 +80,11 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); + aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -96,10 +94,10 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, co SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr)); + aTable->SetColumnTitle(theIndex, string(aStr)); } void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -108,7 +106,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringS SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in()); @@ -118,11 +116,11 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringS SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -133,9 +131,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string(theUnit)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -144,7 +142,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { aTable->SetRowUnit(i + 1, (char*)theUnits[i].in()); @@ -154,24 +152,24 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData) @@ -180,14 +178,14 @@ void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); try { aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -198,14 +196,14 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOME SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); try { aTable->SetRowData(theRow, aRow); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -215,14 +213,14 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(TColStd_HSequenceOfInteger) aRow = aTable->GetRowData(theRow); - CorbaSeq->length(aRow->Length()); - for (int i = 0; i < aRow->Length(); i++) { - CorbaSeq[i] = aRow->Value(i + 1); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = aRow[i]; } return CorbaSeq._retn(); } @@ -233,14 +231,14 @@ void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theD SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); try { aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -251,14 +249,14 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); - - Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); + + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); try { aTable->SetColumnData(theColumn, aColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -268,14 +266,14 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long the { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(TColStd_HSequenceOfInteger) aColumn = aTable->GetColumnData(theColumn); - CorbaSeq->length(aColumn->Length()); - for (int i = 0; i < aColumn->Length(); i++) { - CorbaSeq[i] = aColumn->Value(i + 1); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = aColumn[i]; } return CorbaSeq._retn(); } @@ -286,12 +284,12 @@ void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::L SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); try { aTable->PutValue(theValue, theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); } } @@ -299,7 +297,7 @@ void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::L CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -307,14 +305,14 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, COR { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); CORBA::Long aValue; try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); } return aValue; @@ -323,15 +321,15 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, COR SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow); - CorbaSeq->length(aSeq->Length()); - for (int i = 0; i < aSeq->Length(); i++) { - CorbaSeq[i] = aSeq->Value(i + 1); + vector aSeq = aTable->GetSetRowIndices(theRow); + CorbaSeq->length(aSeq.size()); + for (int i = 0; i < aSeq.size(); i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -340,29 +338,26 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::L void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); - - ostrstream ostr; - string aString; - aTable->ConvertToString(ostr); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - aString = ostr.rdbuf()->str(); + string aString = aTable->Save(); char* aBuffer = (char*)CORBA::string_dup(aString.c_str()); int aBufferSize = strlen((char*)aBuffer); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx index 93ec94149..47a2909b1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeTableOfInteger_i: public virtual POA_SALOMEDS::Attribute public: - SALOMEDS_AttributeTableOfInteger_i(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfInteger_i(SALOMEDSImpl_AttributeTableOfInteger* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx index f695ed2ad..8368f11c2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -24,15 +24,10 @@ #include "SALOMEDS_AttributeTableOfReal.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include -#include - +using namespace std; SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal - (const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr) + (SALOMEDSImpl_AttributeTableOfReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,7 +44,7 @@ void SALOMEDS_AttributeTableOfReal::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -59,8 +54,7 @@ std::string SALOMEDS_AttributeTableOfReal::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -71,8 +65,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitle(int theIndex, const std::string& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -84,9 +77,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitles(aSeq); + dynamic_cast(_local_impl)->SetRowTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +93,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +108,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumnTitle(int theIndex, const std::stri if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +119,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq); + dynamic_cast(_local_impl)->SetColumnTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +135,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +150,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowUnit(int theIndex, const std::string& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +161,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnits(aSeq); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,15 +177,12 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowUnits(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowUnits(); aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aSeq[i].in()).ToCString()); + for (i = 0; i < aLength; i++) aVector.push_back(string(aSeq[i].in())); } return aVector; } @@ -216,7 +192,7 @@ int SALOMEDS_AttributeTableOfReal::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +203,7 @@ int SALOMEDS_AttributeTableOfReal::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -239,12 +215,9 @@ void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector& theData) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -264,12 +237,9 @@ void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -289,10 +259,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfReal) aRow; - aRow = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowData(theRow); - aLength = aRow->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i)); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow); @@ -309,12 +276,9 @@ void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector& theData if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; - for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -334,12 +298,9 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorAppend(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -359,10 +320,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfReal) aColumn; - aColumn = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnData(theColumn); - aLength = aColumn->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i)); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn); @@ -378,8 +336,7 @@ void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int th CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); @@ -395,7 +352,7 @@ bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -407,7 +364,7 @@ double SALOMEDS_AttributeTableOfReal::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); @@ -425,10 +382,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aSet; - aSet = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetSetRowIndices(theRow); - aLength = aSet->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow); @@ -442,7 +396,7 @@ void SALOMEDS_AttributeTableOfReal::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx index 7846f13cd..e426fcba2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfReal { public: - SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr); + SALOMEDS_AttributeTableOfReal(SALOMEDSImpl_AttributeTableOfReal* theAttr); SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr); ~SALOMEDS_AttributeTableOfReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx index ad52deac5..eda6b3944 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx @@ -25,12 +25,9 @@ #include "SALOMEDS_AttributeTableOfReal_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - #include #include +#include using namespace std; @@ -42,16 +39,16 @@ void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetTitle(TCollection_ExtendedString(aStr)); + aTable->SetTitle(string(aStr)); } char* SALOMEDS_AttributeTableOfReal_i::GetTitle() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -61,9 +58,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const ch SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -72,7 +69,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& th SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { aTable->SetRowTitle(i + 1, (char*)theTitles[i].in()); @@ -82,11 +79,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& th SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); + aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -96,10 +93,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr)); + aTable->SetColumnTitle(theIndex, string(aStr)); } void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -108,7 +105,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in()); @@ -118,11 +115,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -133,9 +130,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const cha SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string(theUnit)); } void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -144,7 +141,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& the SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { aTable->SetRowUnit(i + 1, (char*)theUnits[i].in()); @@ -154,11 +151,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& the SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } @@ -166,13 +163,13 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) @@ -181,10 +178,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } @@ -194,10 +191,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS: SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); aTable->SetRowData(theRow, aRow); } @@ -206,14 +203,14 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow) { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; - Handle(TColStd_HSequenceOfReal) aRow = aTable->GetRowData(theRow); - CorbaSeq->length(aRow->Length()); - for (int i = 0; i < aRow->Length(); i++) { - CorbaSeq[i] = aRow->Value(i + 1); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = aRow[i]; } return CorbaSeq._retn(); } @@ -224,10 +221,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theDa SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } @@ -237,10 +234,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SAL SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); aTable->SetColumnData(theColumn, aColumn); } @@ -249,14 +246,14 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theC { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; - Handle(TColStd_HSequenceOfReal) aColumn = aTable->GetColumnData(theColumn); - CorbaSeq->length(aColumn->Length()); - for (int i = 0; i < aColumn->Length(); i++) { - CorbaSeq[i] = aColumn->Value(i + 1); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = aColumn[i]; } return CorbaSeq._retn(); } @@ -267,7 +264,7 @@ void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Lo SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); aTable->PutValue(theValue, theRow, theColumn); } @@ -275,7 +272,7 @@ void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Lo CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -283,7 +280,7 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); CORBA::Double aValue; @@ -291,7 +288,7 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); } @@ -302,15 +299,16 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow); - CorbaSeq->length(aSeq->Length()); - for (int i = 0; i < aSeq->Length(); i++) { - CorbaSeq[i] = aSeq->Value(i + 1); + vector aSeq = aTable->GetSetRowIndices(theRow); + int len = aSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -319,30 +317,26 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); - - ostrstream ostr; - string aString; - aTable->ConvertToString(ostr); - - aString = ostr.rdbuf()->str(); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); + string aString = aTable->Save(); char* aBuffer = (char*)CORBA::string_dup(aString.c_str()); int aBufferSize = strlen((char*)aBuffer); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx index 6f496a66a..52538c58e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTableOfReal_i: public virtual POA_SALOMEDS::AttributeTab public: - SALOMEDS_AttributeTableOfReal_i(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfReal_i(SALOMEDSImpl_AttributeTableOfReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx index b416e0691..0637130fa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -25,14 +25,11 @@ #include "SALOMEDS.hxx" #include -#include -#include -#include -#include -#include + +using namespace std; SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString - (const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr) + (SALOMEDSImpl_AttributeTableOfString* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -50,7 +47,7 @@ void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -60,8 +57,7 @@ std::string SALOMEDS_AttributeTableOfString::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -72,8 +68,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::strin if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -84,9 +79,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq); + dynamic_cast(_local_impl)->SetRowTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +95,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +110,7 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::st if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +121,7 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq); + dynamic_cast(_local_impl)->SetColumnTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +137,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +152,7 @@ void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +163,7 @@ void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,10 +179,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits(); @@ -216,7 +194,7 @@ int SALOMEDS_AttributeTableOfString::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +205,7 @@ int SALOMEDS_AttributeTableOfString::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -239,12 +217,9 @@ void SALOMEDS_AttributeTableOfString::AddRow(const std::vector& the if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -264,12 +239,9 @@ void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vectorAppend((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -289,10 +261,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aRow; - aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow); - aLength = aRow->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow); @@ -309,12 +278,9 @@ void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -334,12 +300,9 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -359,12 +322,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumn(int theColum int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aColumn; - aColumn = Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetColumnData(theColumn); - aLength = aColumn->Length(); - for (i = 1; i <= aLength; i++) - aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::StringSeq_var aColumn = @@ -381,8 +339,7 @@ void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->PutValue((char*)theValue.c_str(), theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); @@ -398,7 +355,7 @@ bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -410,8 +367,7 @@ std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetValue(theRow, theColumn)).ToCString(); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); @@ -429,10 +385,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aSet; - aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow); - aLength = aSet->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = @@ -447,7 +400,7 @@ void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx index 6f69a4284..614fc0f9e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfString { public: - SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr); + SALOMEDS_AttributeTableOfString(SALOMEDSImpl_AttributeTableOfString* theAttr); SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr); ~SALOMEDS_AttributeTableOfString(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx index b4d226e10..79ae23ecb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx @@ -22,18 +22,12 @@ // Module : SALOME -#include -#include - #include "SALOMEDS_AttributeTableOfString_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - #include #include +#include #include "Utils_ExceptHandlers.hxx" @@ -46,16 +40,16 @@ void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetTitle(TCollection_ExtendedString(aStr)); + aTable->SetTitle(string(aStr)); } char* SALOMEDS_AttributeTableOfString_i::GetTitle() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -65,10 +59,10 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -77,21 +71,21 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - aTable->SetRowTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in())); + aTable->SetRowTitle(i + 1, string((char*)theTitles[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] =CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); + aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -101,9 +95,9 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, con SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetColumnTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetColumnTitle(theIndex, string((char*)theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -112,21 +106,21 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSe SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - aTable->SetColumnTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in())); + aTable->SetColumnTitle(i + 1, string((char*)theTitles[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -137,9 +131,9 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const c SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string((char*)theUnit)); } void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -148,21 +142,21 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& t SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { - aTable->SetRowUnit(i + 1, TCollection_ExtendedString((char*)theUnits[i].in())); + aTable->SetRowUnit(i + 1, string((char*)theUnits[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } @@ -170,13 +164,13 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData) @@ -185,10 +179,10 @@ void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theDat SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } @@ -198,10 +192,10 @@ void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMED SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i].in()))); aTable->SetRowData(theRow, aRow); } @@ -210,14 +204,14 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRo { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; - Handle(TColStd_HSequenceOfExtendedString) aRow = aTable->GetRowData(theRow); - CorbaSeq->length(aRow->Length()); - for (int i = 0; i < aRow->Length(); i++) { - CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aRow->Value(i + 1))).ToCString()); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str()); } return CorbaSeq._retn(); } @@ -228,10 +222,10 @@ void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& the SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } @@ -241,10 +235,10 @@ void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const S SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetColumnData(theColumn, aColumn); } @@ -253,14 +247,14 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long th { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; - Handle(TColStd_HSequenceOfExtendedString) aColumn = aTable->GetColumnData(theColumn); - CorbaSeq->length(aColumn->Length()); - for (int i = 0; i < aColumn->Length(); i++) { - CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aColumn->Value(i + 1))).ToCString()); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str()); } return CorbaSeq._retn(); } @@ -271,7 +265,7 @@ void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Lo SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); char* aValue = CORBA::string_dup(theValue); aTable->PutValue(aValue, theRow, theColumn); @@ -280,7 +274,7 @@ void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Lo CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -288,34 +282,33 @@ char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Lon { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - TCollection_AsciiString aValue; - + string aValue; try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); } - return CORBA::string_dup(aValue.ToCString()); + return CORBA::string_dup(aValue.c_str()); } SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow); - CorbaSeq->length(aSeq->Length()); - for (int i = 0; i < aSeq->Length(); i++) { - CorbaSeq[i] = aSeq->Value(i + 1); + vector aSeq = aTable->GetSetRowIndices(theRow); + CorbaSeq->length(aSeq.size()); + for (int i = 0; i < aSeq.size(); i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -324,29 +317,33 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Lo void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); + + string aString = aTable->Save(); + char* aBuffer = (char*)CORBA::string_dup(aString.c_str()); + int aBufferSize = strlen((char*)aBuffer); + + CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; + + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1); - ostrstream ostr; - aTable->ConvertToString(ostr); - CORBA::Octet* anOctetBuf = (CORBA::Octet*)ostr.rdbuf()->str(); - unsigned long aSize = ostr.pcount(); - SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aSize, aSize, anOctetBuf, 1); return aStreamFile._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx index 340609304..b79de541f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTableOfString_i: public virtual POA_SALOMEDS::AttributeT public: - SALOMEDS_AttributeTableOfString_i(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfString_i(SALOMEDSImpl_AttributeTableOfString* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfString_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx index fff0cb6f0..0c8be5bbe 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx @@ -24,13 +24,12 @@ #include "SALOMEDS_AttributeTarget.hxx" #include "SALOMEDS.hxx" -#include - #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDS_SObject.hxx" +using namespace std; -SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr) +SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,7 +46,7 @@ void SALOMEDS_AttributeTarget::Add(const _PTR(SObject)& theObject) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl()); + dynamic_cast(_local_impl)->Add(*(aSO->GetLocalImpl())); } else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl()); } @@ -60,11 +59,10 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get() if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = - Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) { - aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i))); + vector aSeq = dynamic_cast(_local_impl)->Get(); + aLength = aSeq.size(); + for (i = 0; i < aLength; i++) { + aSO = new SALOMEDS_SObject(aSeq[i]); aVector.push_back(_PTR(SObject)(aSO)); } } @@ -86,7 +84,7 @@ void SALOMEDS_AttributeTarget::Remove(const _PTR(SObject)& theObject) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl()); + dynamic_cast(_local_impl)->Remove(*(aSO->GetLocalImpl())); } else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx index 2634c8b0b..de006541f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTarget: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTarget { public: - SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr); + SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr); SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr); ~SALOMEDS_AttributeTarget(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx index 42ced1f14..b4cc092ed 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx @@ -27,30 +27,30 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDS.hxx" +#include "DF_Label.hxx" -#include +#include using namespace std; void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject) { SALOMEDS::Locker lock; - TDF_Label aLabel; - TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1); - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Add(SALOMEDSImpl_Study::SObject(aLabel)); + DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1); + dynamic_cast(_impl)->Add(SALOMEDSImpl_Study::SObject(aLabel)); } SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Get(); + vector aSeq = dynamic_cast(_impl)->Get(); SALOMEDS::Study::ListOfSObject_var aSList = new SALOMEDS::Study::ListOfSObject; - int aLength = aSeq->Length(), i; + int aLength = aSeq.size(), i; if (aLength == 0) return aSList._retn(); aSList->length(aLength); - for(i=1; i <=aLength; i++) { - SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)), _orb); - aSList[i-1] = anSO; + for(i=0; i Label().Data(),anObject->GetID(),aLabel,1); - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(SALOMEDSImpl_Study::SObject(aLabel)); + DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1); + dynamic_cast(_impl)->Remove(SALOMEDSImpl_Study::SObject(aLabel)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx index cb66abe3c..285c7eea6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeTarget_i: public virtual POA_SALOMEDS::AttributeTarget, { public: - SALOMEDS_AttributeTarget_i(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTarget_i(SALOMEDSImpl_AttributeTarget* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTarget_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx index 9f9ebe762..e201c3eb4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx @@ -24,10 +24,11 @@ #include "SALOMEDS_AttributeTextColor.hxx" #include "SALOMEDS.hxx" -#include +#include -SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor - (const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr) +using namespace std; + +SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,11 +45,10 @@ STextColor SALOMEDS_AttributeTextColor::TextColor() STextColor aColor; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HArray1OfReal) aSeq = - Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor(); - aColor.R = aSeq->Value(1); - aColor.G = aSeq->Value(2); - aColor.B = aSeq->Value(3); + vector aSeq = dynamic_cast(_local_impl)->TextColor(); + aColor.R = aSeq[0]; + aColor.G = aSeq[1]; + aColor.B = aSeq[2]; } else { SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->TextColor(); @@ -64,11 +64,11 @@ void SALOMEDS_AttributeTextColor::SetTextColor(STextColor value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3); - aSeq->SetValue(1, value.R); - aSeq->SetValue(2, value.G); - aSeq->SetValue(3, value.B); - Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->ChangeArray(aSeq); + vector aSeq; + aSeq.push_back( value.R ); + aSeq.push_back( value.G ); + aSeq.push_back( value.B ); + dynamic_cast(_local_impl)->ChangeArray(aSeq); } else { SALOMEDS::Color aColor; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx index 492322c02..0ea103376 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx @@ -39,7 +39,7 @@ class SALOMEDS_AttributeTextColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextColor { public: - SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr); + SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr); SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr); ~SALOMEDS_AttributeTextColor(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx index f3ad1ce22..e8cab344c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeTextColor_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,16 +32,16 @@ SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor() { SALOMEDS::Locker lock; SALOMEDS::Color TextColor; - Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->TextColor(); - if (anArray.IsNull() || anArray->Length()!=3) { + vector anArray = dynamic_cast(_impl)->TextColor(); + if (anArray.size()!=3) { TextColor.R = 0; TextColor.G = 0; TextColor.B = 0; } else { - TextColor.R = anArray->Value(1); - TextColor.G = anArray->Value(2); - TextColor.B = anArray->Value(3); + TextColor.R = anArray[0]; + TextColor.G = anArray[1]; + TextColor.B = anArray[2]; } return TextColor; } @@ -50,10 +50,10 @@ void SALOMEDS_AttributeTextColor_i::SetTextColor(const SALOMEDS::Color& value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3); - anArray->SetValue(1, value.R); - anArray->SetValue(2, value.G); - anArray->SetValue(3, value.B); - Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->ChangeArray(anArray); + vector anArray; + anArray.push_back(value.R); + anArray.push_back(value.G); + anArray.push_back(value.B); + dynamic_cast(_impl)->ChangeArray(anArray); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx index 234f339c3..551e5b17d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeTextColor_i: public virtual POA_SALOMEDS::AttributeTextC { public: - SALOMEDS_AttributeTextColor_i(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTextColor_i(SALOMEDSImpl_AttributeTextColor* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTextColor_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx index 04973fd57..2f1b8c803 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx @@ -24,10 +24,12 @@ #include "SALOMEDS_AttributeTextHighlightColor.hxx" #include "SALOMEDS.hxx" -#include +#include + +using namespace std; SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor - (const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr) + (SALOMEDSImpl_AttributeTextHighlightColor* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -45,11 +47,10 @@ STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor() STextColor aColor; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HArray1OfReal) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->TextHighlightColor(); - aColor.R = aSeq->Value(1); - aColor.G = aSeq->Value(2); - aColor.B = aSeq->Value(3); + vector aSeq = dynamic_cast(_local_impl)->TextHighlightColor(); + aColor.R = aSeq[0]; + aColor.G = aSeq[1]; + aColor.B = aSeq[2]; } else { SALOMEDS::Color anImplColor = @@ -66,11 +67,11 @@ void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(STextColor valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3); - aSeq->SetValue(1, value.R); - aSeq->SetValue(2, value.G); - aSeq->SetValue(3, value.B); - Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->ChangeArray(aSeq); + vector aSeq; + aSeq.push_back(value.R); + aSeq.push_back(value.G); + aSeq.push_back(value.B); + dynamic_cast(_local_impl)->ChangeArray(aSeq); } else { SALOMEDS::Color aColor; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx index 59ad88007..74980b9b7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx @@ -39,7 +39,7 @@ class SALOMEDS_AttributeTextHighlightColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextHighlightColor { public: - SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr); + SALOMEDS_AttributeTextHighlightColor(SALOMEDSImpl_AttributeTextHighlightColor* theAttr); SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr); ~SALOMEDS_AttributeTextHighlightColor(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx index 55dca0ad2..8c72b38a6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeTextHighlightColor_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,16 +32,16 @@ SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor() { SALOMEDS::Locker lock; SALOMEDS::Color TextHighlightColor; - Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->TextHighlightColor(); - if (anArray.IsNull() || anArray->Length()!=3) { + vector anArray = dynamic_cast(_impl)->TextHighlightColor(); + if (anArray.size()!=3) { TextHighlightColor.R = 0; TextHighlightColor.G = 0; TextHighlightColor.B = 0; } else { - TextHighlightColor.R = anArray->Value(1); - TextHighlightColor.G = anArray->Value(2); - TextHighlightColor.B = anArray->Value(3); + TextHighlightColor.R = anArray[0]; + TextHighlightColor.G = anArray[1]; + TextHighlightColor.B = anArray[2]; } return TextHighlightColor; } @@ -50,9 +50,9 @@ void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMED { SALOMEDS::Locker lock; CheckLocked(); - Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3); - anArray->SetValue(1, value.R); - anArray->SetValue(2, value.G); - anArray->SetValue(3, value.B); - Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->ChangeArray(anArray); + vector anArray; + anArray.push_back(value.R); + anArray.push_back(value.G); + anArray.push_back(value.B); + dynamic_cast(_impl)->ChangeArray(anArray); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx index ec0aea995..9c7249f2b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTextHighlightColor_i: public virtual POA_SALOMEDS::Attri { public: - SALOMEDS_AttributeTextHighlightColor_i(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTextHighlightColor_i(SALOMEDSImpl_AttributeTextHighlightColor* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTextHighlightColor_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx index 8cac2063e..577e16811 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -27,16 +27,12 @@ #include #include -#include -#include -#include -#include -#include - #include "SALOMEDSImpl_AttributeTreeNode.hxx" #include "SALOMEDS_AttributeTreeNode.hxx" -SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr) +using namespace std; + +SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -53,9 +49,9 @@ void SALOMEDS_AttributeTreeNode::SetFather(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aFather; + aNode = dynamic_cast(_local_impl); + aFather = dynamic_cast(aTN->_local_impl); aNode->SetFather(aFather); } else { @@ -70,8 +66,7 @@ bool SALOMEDS_AttributeTreeNode::HasFather() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasFather(); } else { @@ -86,8 +81,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFather() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather()); } else { @@ -103,9 +97,9 @@ void SALOMEDS_AttributeTreeNode::SetPrevious(const _PTR(AttributeTreeNode)& valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aPrev; + aNode = dynamic_cast(_local_impl); + aPrev = dynamic_cast(aTN->_local_impl); aNode->SetPrevious(aPrev); } else { @@ -120,8 +114,7 @@ bool SALOMEDS_AttributeTreeNode::HasPrevious() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasPrevious(); } else { @@ -136,8 +129,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetPrevious() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious()); } else { @@ -153,9 +145,9 @@ void SALOMEDS_AttributeTreeNode::SetNext(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aNext; + aNode = dynamic_cast(_local_impl); + aNext = dynamic_cast(aTN->_local_impl); aNode->SetNext(aNext); } else { @@ -170,8 +162,7 @@ bool SALOMEDS_AttributeTreeNode::HasNext() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasNext(); } else { @@ -186,8 +177,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetNext() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext()); } else { @@ -203,9 +193,9 @@ void SALOMEDS_AttributeTreeNode::SetFirst(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aFirst; + aNode = dynamic_cast(_local_impl); + aFirst = dynamic_cast(aTN->_local_impl); aNode->SetFirst(aFirst); } else { @@ -220,8 +210,7 @@ bool SALOMEDS_AttributeTreeNode::HasFirst() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasFirst(); } else { @@ -236,8 +225,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst()); } else { @@ -249,14 +237,11 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) { - if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); - if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aNode->SetTreeID(Standard_GUID((char*)value.c_str())); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); + aNode->SetTreeID(value); } else { SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); @@ -266,21 +251,18 @@ void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) std::string SALOMEDS_AttributeTreeNode::GetTreeID() { - TCollection_AsciiString aGUID; + string aGUID; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - char guid[40]; - aNode->GetTreeID().ToCString(guid); - aGUID = TCollection_AsciiString(guid); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); + aGUID = aNode->GetTreeID(); } else { SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); - aGUID = TCollection_AsciiString(aNode->GetTreeID()); + aGUID = aNode->GetTreeID(); } - return std::string(aGUID.ToCString()); + return aGUID; } void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value) @@ -289,9 +271,9 @@ void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->Append(anOther); } else { @@ -307,9 +289,9 @@ void SALOMEDS_AttributeTreeNode::Prepend(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->Prepend(anOther); } else { @@ -325,9 +307,9 @@ void SALOMEDS_AttributeTreeNode::InsertBefore(const _PTR(AttributeTreeNode)& val if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->InsertBefore(anOther); } else { @@ -343,9 +325,9 @@ void SALOMEDS_AttributeTreeNode::InsertAfter(const _PTR(AttributeTreeNode)& valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->InsertAfter(anOther); } else { @@ -360,7 +342,7 @@ void SALOMEDS_AttributeTreeNode::Remove() if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove(); + dynamic_cast(_local_impl)->Remove(); } else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove(); } @@ -370,7 +352,7 @@ int SALOMEDS_AttributeTreeNode::Depth() int aDepth; if (_isLocal) { SALOMEDS::Locker lock; - aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth(); + aDepth = dynamic_cast(_local_impl)->Depth(); } else aDepth = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth(); return aDepth; @@ -381,7 +363,7 @@ bool SALOMEDS_AttributeTreeNode::IsRoot() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot(); + ret = dynamic_cast(_local_impl)->IsRoot(); } else ret = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot(); return ret; @@ -393,9 +375,9 @@ bool SALOMEDS_AttributeTreeNode::IsDescendant(const _PTR(AttributeTreeNode)& val SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsDescendant(anOther); } else { @@ -412,9 +394,9 @@ bool SALOMEDS_AttributeTreeNode::IsFather(const _PTR(AttributeTreeNode)& value) SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsFather(anOther); } else { @@ -431,9 +413,9 @@ bool SALOMEDS_AttributeTreeNode::IsChild(const _PTR(AttributeTreeNode)& value) SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsChild(anOther); } else { @@ -449,9 +431,7 @@ std::string SALOMEDS_AttributeTreeNode::Label() string aLabel; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_AsciiString anAsciiLabel; - TDF_Tool::Entry(_local_impl->Label(), anAsciiLabel); - aLabel = std::string(anAsciiLabel.ToCString()); + aLabel = _local_impl->Label().Entry(); } else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label(); return aLabel; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx index 8e67491e3..c6ded0967 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTreeNode: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTreeNode { public: - SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr); + SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr); SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr); ~SALOMEDS_AttributeTreeNode(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index 3574d218b..41e69b8a7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -25,26 +25,20 @@ #include "SALOMEDS_AttributeTreeNode_i.hxx" #include "utilities.h" #include "SALOMEDS.hxx" -#include -#include -#include -#include using namespace std; -static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, - const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode) +static SALOMEDSImpl_AttributeTreeNode* GetNode(SALOMEDS::AttributeTreeNode_ptr value, + SALOMEDSImpl_AttributeTreeNode* aNode) { - Handle(SALOMEDSImpl_AttributeTreeNode) aResult = new SALOMEDSImpl_AttributeTreeNode; - TCollection_AsciiString anEntry = value->Label(); - TDF_Label aLabel; - TDF_Tool::Label(aNode->Label().Data(), anEntry, aLabel); + SALOMEDSImpl_AttributeTreeNode* aResult = NULL; + DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label()); if (aLabel.IsNull()) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") return aResult; } - if (!aLabel.FindAttribute(aNode->ID(), aResult)) { + if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") } @@ -55,21 +49,21 @@ void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr val { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFather(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather(); + return dynamic_cast(_impl)->HasFather(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFather; - aFather = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFather(), _orb); + aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFather(), _orb); #ifndef WNT return aFather->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -81,21 +75,21 @@ void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetPrevious(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious(); + return dynamic_cast(_impl)->HasPrevious(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aPrevious; - aPrevious=new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetPrevious(), _orb); + aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetPrevious(), _orb); #ifndef WNT return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -107,21 +101,21 @@ void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetNext(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext(); + return dynamic_cast(_impl)->HasNext(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aNext; - aNext = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetNext(), _orb); + aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetNext(), _orb); #ifndef WNT return aNext->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -133,21 +127,21 @@ void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr valu { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFirst(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst(); + return dynamic_cast(_impl)->HasFirst(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFirst; - aFirst = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFirst(), _orb); + aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFirst(), _orb); #ifndef WNT return aFirst->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -159,24 +153,22 @@ void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); - aNode->SetTreeID(Standard_GUID((char*)value)); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + aNode->SetTreeID(value); } char* SALOMEDS_AttributeTreeNode_i::GetTreeID() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); - char aGUID[40]; - aNode->ID().ToCString(aGUID); - return CORBA::String_var(CORBA::string_dup(aGUID))._retn(); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + return CORBA::String_var(CORBA::string_dup(aNode->ID().c_str()))._retn(); } void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Append(GetNode(value, aNode)); } @@ -184,7 +176,7 @@ void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Prepend(GetNode(value, aNode)); } @@ -192,7 +184,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertBefore(GetNode(value, aNode)); } @@ -200,7 +192,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertAfter(GetNode(value, aNode)); } @@ -208,50 +200,48 @@ void SALOMEDS_AttributeTreeNode_i::Remove() { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Remove(); } CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->Depth(); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsRoot(); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsDescendant(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsFather(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsChild(GetNode(value, aNode)); } char* SALOMEDS_AttributeTreeNode_i::Label() { SALOMEDS::Locker lock; - TCollection_AsciiString aLabelName; - TDF_Tool::Entry(_impl->Label(),aLabelName); - return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn(); + return CORBA::String_var(CORBA::string_dup(_impl->Label().Entry().c_str()))._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx index e827dea01..e796d30f2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeTreeNode_i: public virtual POA_SALOMEDS::AttributeTreeNo public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeTreeNode_i(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTreeNode_i(SALOMEDSImpl_AttributeTreeNode* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTreeNode_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx index c20087a47..804f4b148 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -27,11 +27,7 @@ #include #include -#include -#include -#include - -SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr) +SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -48,8 +44,7 @@ std::string SALOMEDS_AttributeUserID::Value() if (_isLocal) { SALOMEDS::Locker lock; char guid[40]; - Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid); - aValue = std::string(guid); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value(); return aValue; @@ -57,13 +52,10 @@ std::string SALOMEDS_AttributeUserID::Value() void SALOMEDS_AttributeUserID::SetValue(const std::string& value) { - if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); - if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeUserID):: - DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str())); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx index 475d5918b..0dfaa9b68 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeUserID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeUserID { public: - SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr); + SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr); SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr); ~SALOMEDS_AttributeUserID(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx index be52901b6..2165d0e55 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx @@ -24,16 +24,13 @@ #include "SALOMEDS_AttributeUserID_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; char* SALOMEDS_AttributeUserID_i::Value() { SALOMEDS::Locker lock; - char aGUID[40]; - Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->ID().ToCString(aGUID); - CORBA::String_var c_s = CORBA::string_dup(aGUID); + CORBA::String_var c_s = CORBA::string_dup(dynamic_cast(_impl)->ID().c_str()); return c_s._retn(); } @@ -42,6 +39,6 @@ void SALOMEDS_AttributeUserID_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->SetValue(Standard_GUID(Standard_CString(Str))); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx index ee4b82bee..14e409e99 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeUserID_i: public virtual POA_SALOMEDS::AttributeUserID, public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeUserID_i(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeUserID_i(SALOMEDSImpl_AttributeUserID* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeUserID_i() {}; @@ -43,7 +43,7 @@ public: char* Value(); void SetValue(const char* value); - static const Standard_GUID& DefaultID() { + static const std::string& DefaultID() { return SALOMEDSImpl_AttributeUserID::DefaultID(); } diff --git a/src/SALOMEDS/SALOMEDS_Attributes.hxx b/src/SALOMEDS/SALOMEDS_Attributes.hxx index 4c9901729..7ccfc0243 100644 --- a/src/SALOMEDS/SALOMEDS_Attributes.hxx +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -90,7 +90,7 @@ #include "SALOMEDS_AttributeString_i.hxx" #define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ - Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \ + SALOMEDSImpl_##CORBA_Name* A = dynamic_cast(theAttr); \ SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(A, theOrb); \ attr_servant = Attr; \ anAttribute = Attr->CORBA_Name::_this(); \ diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx index f333e668b..74dd4e85d 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx @@ -34,7 +34,7 @@ using namespace std; * Purpose : */ //============================================================================ -void SALOMEDS_BasicAttribute_i::SetLabel(const TDF_Label Lab) +void SALOMEDS_BasicAttribute_i::SetLabel(const DF_Label& Lab) { _Lab = Lab; } diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx index 26455a9f3..b8902a902 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx @@ -32,12 +32,12 @@ // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -#include +#include class SALOMEDS_BasicAttribute_i: public POA_SALOMEDS::BasicAttribute, public PortableServer::ServantBase { protected: - TDF_Label _Lab; + DF_Label _Lab; public: SALOMEDS_BasicAttribute_i() {}; @@ -47,7 +47,7 @@ public: virtual char * Save() =0; virtual void Load () =0; CORBA::Boolean GetPtr(SALOMEDS::SObject so); - void SetLabel(const TDF_Label Lab); + void SetLabel(const DF_Label& Lab); virtual char* GetType() = 0; }; diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index 0f7bf02cc..954f83f5b 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -29,25 +29,25 @@ using namespace std; -SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator) +SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator) { SALOMEDS::Locker lock; _isLocal = true; - _local_impl = theIterator; + _local_impl = theIterator.GetPersistentCopy(); _corba_impl = SALOMEDS::ChildIterator::_nil(); } SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator) { _isLocal = false; - _local_impl = NULL; _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator); } SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator() { if(!_isLocal) _corba_impl->Destroy(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_ChildIterator::Init() @@ -70,7 +70,7 @@ void SALOMEDS_ChildIterator::InitEx(bool theAllLevels) bool SALOMEDS_ChildIterator::More() { - bool ret; + bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; ret = _local_impl->More(); diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx index 4c306e105..e2129d695 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx @@ -35,12 +35,12 @@ class SALOMEDS_ChildIterator: public SALOMEDSClient_ChildIterator { private: bool _isLocal; - Handle(SALOMEDSImpl_ChildIterator) _local_impl; + SALOMEDSImpl_ChildIterator* _local_impl; SALOMEDS::ChildIterator_var _corba_impl; public: - SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator); + SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator); SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator); ~SALOMEDS_ChildIterator(); diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx index 305b51110..7278ab8bd 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx @@ -36,9 +36,9 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)& theImpl, +SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator& theImpl, CORBA::ORB_ptr orb) - : _it(theImpl) + : _it(theImpl.GetPersistentCopy()) { SALOMEDS::Locker lock; _orb = CORBA::ORB::_duplicate(orb); @@ -51,6 +51,7 @@ SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_Chi //============================================================================ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i() { + if(_it) delete _it; } //============================================================================ @@ -107,7 +108,7 @@ void SALOMEDS_ChildIterator_i::Next() SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _it->Value(); + SALOMEDSImpl_SObject aSO = _it->Value(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index d2af3944d..be5906142 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -42,11 +42,11 @@ class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator, { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_ChildIterator) _it; + SALOMEDSImpl_ChildIterator* _it; public: //! standard constructor - SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)&, CORBA::ORB_ptr); + SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator&, CORBA::ORB_ptr); //! standard destructor ~SALOMEDS_ChildIterator_i(); diff --git a/src/SALOMEDS/SALOMEDS_Client.cxx b/src/SALOMEDS/SALOMEDS_Client.cxx index c100e8975..cc76b69e0 100644 --- a/src/SALOMEDS/SALOMEDS_Client.cxx +++ b/src/SALOMEDS/SALOMEDS_Client.cxx @@ -40,7 +40,7 @@ using namespace std; * Purpose : */ //============================================================================ -static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Standard_Integer offset) { +static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, int offset) { SALOMEDS::SObject_var RefSO; SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO); for (; it->More();it->Next()){ @@ -50,12 +50,12 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Sta { SALOMEDS::AttributeName_var Name = SALOMEDS::AttributeName::_narrow(anAttr); CORBA::String_var Val = Name->Value(); - for (Standard_Integer i = 1; i <= offset ; i++) + for (int i = 1; i <= offset ; i++) MESSAGE("--"); MESSAGE(">"<GetID()<ReferencedObject(RefSO)) { - for (Standard_Integer i = 1; i <= offset ; i++) + for (int i = 1; i <= offset ; i++) MESSAGE(" "); MESSAGE("*Reference"<GetID()); } @@ -71,9 +71,9 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Sta static void DumpStudy (SALOMEDS::Study_ptr Study) { MESSAGE("Explore Study and Write name of each object if it exists"); - Standard_CString name; + char* name; SALOMEDS::SComponentIterator_var itcomp = Study->NewComponentIterator(); - Standard_Integer offset = 1; + int offset = 1; for (; itcomp->More(); itcomp->Next()) { SALOMEDS::SComponent_var SC = itcomp->Value(); name = SC->ComponentDataType(); @@ -90,7 +90,7 @@ static void DumpStudy (SALOMEDS::Study_ptr Study) { static void Test(SALOMEDS::StudyManager_ptr myStudyMgr ) { try { - Standard_CString name; + char* name; MESSAGE("Create New Study Study1"); SALOMEDS::Study_var myStudy = myStudyMgr->NewStudy("Study1"); @@ -282,11 +282,9 @@ int main(int argc, char** argv) try { // Initialise the ORB. #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); - omniORB::MaxMessageSize(100 * 1024 * 1024); + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" ); #endif // Obtain a reference to the root POA. diff --git a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx index cb6786209..fd5307fa6 100644 --- a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -91,7 +91,7 @@ #include "SALOMEDS_AttributeString.hxx" #define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \ - Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \ + SALOMEDSImpl_##CORBA_Name* A = dynamic_cast(theGA); \ aGA = new SALOMEDS_##CORBA_Name(A); \ } diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx deleted file mode 100644 index 105af6e7a..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapOfIntegerString& aMap) ; -Standard_EXPORT const Standard_Real& Key() const; -Standard_EXPORT const TCollection_ExtendedString& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index 2cef58755..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx deleted file mode 100644 index 7e62aa311..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapStringLabel : public TCollection_BasicMapIterator { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(const SALOMEDS_DataMapStringLabel& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapStringLabel& aMap) ; -Standard_EXPORT const TCollection_ExtendedString& Key() const; -Standard_EXPORT const TDF_Label& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx deleted file mode 100644 index 4f69f1d72..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx deleted file mode 100644 index 1ab360dd7..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,132 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString : public TCollection_MapNode { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -SALOMEDS_DataMapNodeOfDataMapOfIntegerString(const Standard_Real& K,const TCollection_ExtendedString& I,const TCollection_MapNodePtr& n); - Standard_Real& Key() const; - TCollection_ExtendedString& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapOfIntegerString(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myKey; -TCollection_ExtendedString myValue; - - -}; - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index a48b6d9d7..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapOfIntegerString", - sizeof(SALOMEDS_DataMapNodeOfDataMapOfIntegerString), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)((Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapOfIntegerString::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapOfIntegerString::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx deleted file mode 100644 index a12d64706..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx +++ /dev/null @@ -1,154 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -class SALOMEDS_DataMapNodeOfDataMapStringLabel : public TCollection_MapNode { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT inline SALOMEDS_DataMapNodeOfDataMapStringLabel(const TCollection_ExtendedString& K,const TDF_Label& I,const TCollection_MapNodePtr& n); -Standard_EXPORT inline TCollection_ExtendedString& Key() const; -Standard_EXPORT inline TDF_Label& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapStringLabel(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TCollection_ExtendedString myKey; -TDF_Label myValue; - - -}; - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx deleted file mode 100644 index e0364db6b..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapStringLabel::~SALOMEDS_DataMapNodeOfDataMapStringLabel() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapStringLabel", - sizeof(SALOMEDS_DataMapNodeOfDataMapStringLabel), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)((Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapStringLabel::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapStringLabel::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel::~Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel() {} -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx deleted file mode 100644 index 8d04e8c82..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapOfIntegerString : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapOfIntegerString& Assign(const SALOMEDS_DataMapOfIntegerString& Other) ; - SALOMEDS_DataMapOfIntegerString& operator =(const SALOMEDS_DataMapOfIntegerString& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapOfIntegerString() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const Standard_Real& K,const TCollection_ExtendedString& I) ; -Standard_EXPORT Standard_Boolean IsBound(const Standard_Real& K) const; -Standard_EXPORT Standard_Boolean UnBind(const Standard_Real& K) ; -Standard_EXPORT const TCollection_ExtendedString& Find(const Standard_Real& K) const; - const TCollection_ExtendedString& operator()(const Standard_Real& K) const -{ - return Find(K); -} - -Standard_EXPORT TCollection_ExtendedString& ChangeFind(const Standard_Real& K) ; - TCollection_ExtendedString& operator()(const Standard_Real& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx deleted file mode 100644 index 829ebac7c..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif - using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx deleted file mode 100644 index ea00dc5f5..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx +++ /dev/null @@ -1,146 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapStringLabel : public TCollection_BasicMap { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapStringLabel& Assign(const SALOMEDS_DataMapStringLabel& Other) ; - SALOMEDS_DataMapStringLabel& operator =(const SALOMEDS_DataMapStringLabel& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapStringLabel() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const TCollection_ExtendedString& K,const TDF_Label& I) ; -Standard_EXPORT Standard_Boolean IsBound(const TCollection_ExtendedString& K) const; -Standard_EXPORT Standard_Boolean UnBind(const TCollection_ExtendedString& K) ; -Standard_EXPORT const TDF_Label& Find(const TCollection_ExtendedString& K) const; - const TDF_Label& operator()(const TCollection_ExtendedString& K) const -{ - return Find(K); -} - -Standard_EXPORT TDF_Label& ChangeFind(const TCollection_ExtendedString& K) ; - TDF_Label& operator()(const TCollection_ExtendedString& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const SALOMEDS_DataMapStringLabel& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx deleted file mode 100644 index b54d46130..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapStringLabel.hxx" - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl deleted file mode 100644 index 6cc4eda58..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_DrawableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class DrawableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns DrawableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable DrawableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end DrawableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx deleted file mode 100644 index 458c2e615..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_DrawableAttributeID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_DrawableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_DrawableAttribute) SALOMEDS_DrawableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_DrawableAttribute) A; - if (!L.FindAttribute(SALOMEDS_DrawableAttribute::GetID(),A)) { - A = new SALOMEDS_DrawableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_DrawableAttribute::SALOMEDS_DrawableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_DrawableAttribute::NewEmpty () const -{ - return new SALOMEDS_DrawableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx deleted file mode 100644 index 077626a87..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#define _SALOMEDS_DrawableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_DrawableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_DrawableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_DrawableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_DrawableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx deleted file mode 100644 index 26ede15f1..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_DrawableAttribute::~SALOMEDS_DrawableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DrawableAttribute", - sizeof(SALOMEDS_DrawableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DrawableAttribute) Handle(SALOMEDS_DrawableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DrawableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DrawableAttribute))) { - _anOtherObject = Handle(SALOMEDS_DrawableAttribute)((Handle(SALOMEDS_DrawableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DrawableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DrawableAttribute) ; -} -Standard_Boolean SALOMEDS_DrawableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DrawableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_DrawableAttribute::~Handle_SALOMEDS_DrawableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx deleted file mode 100644 index c7c9b6bf0..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#include "SALOMEDS_DrawableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index d03caa15f..5c1d2344c 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -34,48 +34,48 @@ SALOMEDS_Driver_i::~SALOMEDS_Driver_i() { } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::Save(const SALOMEDSImpl_SComponent& theComponent, + const string& theURL, + long& theStreamLength, + bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); SALOMEDS::unlock(); SALOMEDS::TMPFile_var aStream = _driver->Save(sco.in(), url, isMultiFile); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); SALOMEDS::lock(); return aTMPFile; } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const string& theURL, + long& theStreamLength, + bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); SALOMEDS::unlock(); SALOMEDS::TMPFile_var aStream = _driver->SaveASCII(sco.in(), url, isMultiFile); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); SALOMEDS::lock(); return aTMPFile; } -bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, +bool SALOMEDS_Driver_i::Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const string& theURL, bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; @@ -91,14 +91,14 @@ bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent return isOk; } -bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, +bool SALOMEDS_Driver_i::LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const string& theURL, bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; @@ -114,7 +114,7 @@ bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComp return isOk; } -void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) +void SALOMEDS_Driver_i::Close(const SALOMEDSImpl_SComponent& theComponent) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); @@ -125,36 +125,36 @@ void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponen -TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, - bool isMultiFile, - bool isASCII) +string SALOMEDS_Driver_i::IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const string& IORString, + bool isMultiFile, + bool isASCII) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb); - CORBA::String_var ior = CORBA::string_dup(IORString.ToCString()); + CORBA::String_var ior = CORBA::string_dup(IORString.c_str()); SALOMEDS::unlock(); CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII); SALOMEDS::lock(); - return TCollection_AsciiString(pers_string); + return string(pers_string); } -TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theObject, - const TCollection_AsciiString& aLocalPersistentID, - bool isMultiFile, - bool isASCII) +string SALOMEDS_Driver_i::LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theObject, + const string& aLocalPersistentID, + bool isMultiFile, + bool isASCII) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); - CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.ToCString()); + CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.c_str()); SALOMEDS::unlock(); CORBA::String_var IOR = _driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII); SALOMEDS::lock(); - return TCollection_AsciiString(IOR); + return string(IOR); } -bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); @@ -166,16 +166,16 @@ bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); SALOMEDS::unlock(); CORBA::Long anObjectID; SALOMEDS::TMPFile_var aStream = _driver->CopyFrom(so.in(), anObjectID); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); theObjectID = anObjectID; SALOMEDS::lock(); @@ -183,18 +183,18 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSIm return aTMPFile; } -bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) +bool SALOMEDS_Driver_i::CanPaste(const string& theComponentName, int theObjectID) { SALOMEDS::unlock(); - bool canPaste = _driver->CanPaste(theComponentName.ToCString(), theObjectID); + bool canPaste = _driver->CanPaste(theComponentName.c_str(), theObjectID); SALOMEDS::lock(); return canPaste; } -TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, - const long theStreamLength, - int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject) +string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const SALOMEDSImpl_SObject& theObject) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; @@ -209,13 +209,13 @@ TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStr SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in()); SALOMEDS::lock(); - return TCollection_AsciiString((char*)ret_so->GetID()); + return string(ret_so->GetID()); } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength) { SALOMEDS_Study_i * st_servant = new SALOMEDS_Study_i (theStudy, _orb); SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this()); @@ -224,7 +224,7 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDS SALOMEDS::unlock(); CORBA::Boolean aValidScript, aPublished = isPublished; Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new Engines_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); isValidScript = aValidScript; SALOMEDS::lock(); @@ -236,23 +236,20 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDS // SALOMEDS_DriverFactory //############################################################################################################### -SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType - (const TCollection_AsciiString& theComponentType) +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const string& theComponentType) { CORBA::Object_var obj; - TCollection_AsciiString aFactoryType; + string aFactoryType; if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer"; else aFactoryType = "FactoryServer"; SALOMEDS::unlock(); - obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component - (aFactoryType.ToCString(), theComponentType.ToCString()); + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.c_str(), theComponentType.c_str()); SALOMEDS::lock(); if (CORBA::is_nil(obj)) { - obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component - ("FactoryServerPy", theComponentType.ToCString()); + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.c_str()); } if (!CORBA::is_nil(obj)) { @@ -263,10 +260,10 @@ SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType return NULL; } -SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const TCollection_AsciiString& theIOR) +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const string& theIOR) { CORBA::Object_var obj; - obj = _orb->string_to_object(theIOR.ToCString()); + obj = _orb->string_to_object(theIOR.c_str()); if (!CORBA::is_nil(obj)) { SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx index 308206323..321b188cf 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -21,7 +21,6 @@ #define __SALOMEDS_DRIVER_I_H__ #include -#include #include "SALOMEDSImpl_Driver.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -46,70 +45,70 @@ public: ~SALOMEDS_Driver_i(); - virtual TCollection_AsciiString GetIOR() + virtual std::string GetIOR() { CORBA::String_var ior = _orb->object_to_string(_driver); - return TCollection_AsciiString(ior); + return std::string(ior); } - virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile); + virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile); - virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile); + virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile); - virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile); - virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile); - virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent); + virtual void Close(const SALOMEDSImpl_SComponent& theComponent); - virtual TCollection_AsciiString ComponentDataType() + virtual std::string ComponentDataType() { CORBA::String_var ior = _driver->ComponentDataType(); - return TCollection_AsciiString(ior); + return std::string(ior); } - virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, - bool isMultiFile, - bool isASCII); + virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const std::string& IORString, + bool isMultiFile, + bool isASCII); - virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& aLocalPersistentID, - bool isMultiFile, - bool isASCII); + virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject, + const std::string& aLocalPersistentID, + bool isMultiFile, + bool isASCII); - virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject); + virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject); - virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength); + virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength); - virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID); + virtual bool CanPaste(const std::string& theComponentName, int theObjectID); - virtual TCollection_AsciiString PasteInto(const unsigned char* theStream, - const long theStreamLength, - int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject); + virtual std::string PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const SALOMEDSImpl_SObject& theObject); - virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength); + virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength); }; #include "SALOME_NamingService.hxx" @@ -135,9 +134,9 @@ public: delete _name_service; } - virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType); + virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType); - virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR); + virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl deleted file mode 100644 index 42f14a496..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_ExpandableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class ExpandableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns ExpandableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable ExpandableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end ExpandableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx deleted file mode 100644 index bac353f3e..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_ExpandableAttributeID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_ExpandableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExpandableAttribute) SALOMEDS_ExpandableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_ExpandableAttribute) A; - if (!L.FindAttribute(SALOMEDS_ExpandableAttribute::GetID(),A)) { - A = new SALOMEDS_ExpandableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExpandableAttribute::SALOMEDS_ExpandableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExpandableAttribute::NewEmpty () const -{ - return new SALOMEDS_ExpandableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx deleted file mode 100644 index 182920994..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#define _SALOMEDS_ExpandableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExpandableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExpandableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_ExpandableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_ExpandableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx deleted file mode 100644 index 75767cdd1..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExpandableAttribute::~SALOMEDS_ExpandableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExpandableAttribute", - sizeof(SALOMEDS_ExpandableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExpandableAttribute) Handle(SALOMEDS_ExpandableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExpandableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExpandableAttribute))) { - _anOtherObject = Handle(SALOMEDS_ExpandableAttribute)((Handle(SALOMEDS_ExpandableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExpandableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExpandableAttribute) ; -} -Standard_Boolean SALOMEDS_ExpandableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExpandableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_ExpandableAttribute::~Handle_SALOMEDS_ExpandableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx deleted file mode 100644 index ea8080e89..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#include "SALOMEDS_ExpandableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl deleted file mode 100644 index 5fc59615a..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_ExternalFileDef.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class ExternalFileDef from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; - Name : ExtendedString from TCollection) - returns ExternalFileDef from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable ExternalFileDef from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end ExternalFileDef; diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx deleted file mode 100644 index d3b949319..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExternalFileDef.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExternalFileDef.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::GetID () -{ - static Standard_GUID SALOMEDS_ExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); - return SALOMEDS_ExternalFileDefID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExternalFileDef) SALOMEDS_ExternalFileDef::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_ExternalFileDef) A; - if (!L.FindAttribute(SALOMEDS_ExternalFileDef::GetID(),A)) { - A = new SALOMEDS_ExternalFileDef(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExternalFileDef::SALOMEDS_ExternalFileDef() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExternalFileDef::NewEmpty () const -{ - return new SALOMEDS_ExternalFileDef(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx deleted file mode 100644 index 4dd12b5ca..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#define _SALOMEDS_ExternalFileDef_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExternalFileDef : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExternalFileDef Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_ExternalFileDef(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_ExternalFileDef(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx deleted file mode 100644 index fbaa64cf9..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx +++ /dev/null @@ -1,75 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExternalFileDef::~SALOMEDS_ExternalFileDef() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExternalFileDef", - sizeof(SALOMEDS_ExternalFileDef), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExternalFileDef) Handle(SALOMEDS_ExternalFileDef)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExternalFileDef) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExternalFileDef))) { - _anOtherObject = Handle(SALOMEDS_ExternalFileDef)((Handle(SALOMEDS_ExternalFileDef)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExternalFileDef::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExternalFileDef) ; -} -Standard_Boolean SALOMEDS_ExternalFileDef::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExternalFileDef) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_ExternalFileDef::~Handle_SALOMEDS_ExternalFileDef() {} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.cdl b/src/SALOMEDS/SALOMEDS_FileType.cdl deleted file mode 100644 index b539acd5a..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_FileType.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class FileType from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; - Name : ExtendedString from TCollection) - returns FileType from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable FileType from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end FileType; diff --git a/src/SALOMEDS/SALOMEDS_FileType.cxx b/src/SALOMEDS/SALOMEDS_FileType.cxx deleted file mode 100644 index ef714eb16..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FileType.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_FileType.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::GetID () -{ - static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); - return SALOMEDS_FileTypeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_FileType) A; - if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) { - A = new SALOMEDS_FileType(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_FileType::SALOMEDS_FileType() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const -{ - return new SALOMEDS_FileType(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.hxx b/src/SALOMEDS/SALOMEDS_FileType.hxx deleted file mode 100644 index 476e04ace..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _SALOMEDS_FileType_HeaderFile -#define _SALOMEDS_FileType_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_FileType_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_FileType : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_FileType Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_FileType(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_FileType(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_FileType_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.ixx b/src/SALOMEDS/SALOMEDS_FileType.ixx deleted file mode 100644 index 49acdb530..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.ixx +++ /dev/null @@ -1,74 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_FileType::~SALOMEDS_FileType() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_FileType_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_FileType", - sizeof(SALOMEDS_FileType), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_FileType) Handle(SALOMEDS_FileType)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_FileType) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_FileType))) { - _anOtherObject = Handle(SALOMEDS_FileType)((Handle(SALOMEDS_FileType)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_FileType::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_FileType) ; -} -Standard_Boolean SALOMEDS_FileType::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_FileType) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_FileType::~Handle_SALOMEDS_FileType() {} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.jxx b/src/SALOMEDS/SALOMEDS_FileType.jxx deleted file mode 100644 index 81932deae..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.jxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_FileType_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx deleted file mode 100644 index 15fcb951b..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx +++ /dev/null @@ -1,162 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FlagsAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_FlagsAttribute.hxx" -#include -#include -#include - -using namespace std; - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::GetID () -{ - static Standard_GUID SALOMEDS_FlagsAttributeID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); - return SALOMEDS_FlagsAttributeID; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value of the attribute -//======================================================================= -Handle(SALOMEDS_FlagsAttribute) SALOMEDS_FlagsAttribute::Set( const TDF_Label& L, - const Standard_Integer value ) -{ - Handle(SALOMEDS_FlagsAttribute) A; - if ( !L.FindAttribute(SALOMEDS_FlagsAttribute::GetID(),A ) ) - { - A = new SALOMEDS_FlagsAttribute(); - L.AddAttribute( A ); - } - - ( Handle(TDataStd_Integer)::DownCast( A ) )->Set( value ); - return A; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute -//purpose : Constructor -//======================================================================= -SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute() -{ - TDataStd_Integer::Set( 0 ); -} - -SALOMEDS_FlagsAttribute::~SALOMEDS_FlagsAttribute() -{ -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::ID () const -{ - return GetID(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::NewEmpty -//purpose : Create new empty attribute -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FlagsAttribute::NewEmpty () const -{ - return new SALOMEDS_FlagsAttribute(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Restore -//purpose : Assign given value to the attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Restore( const Handle(TDF_Attribute)& with ) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast( with )->Get(); - TDataStd_Integer::Set( s ); - return; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Paste -//purpose : Assign internal value to the given attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const -{ - Handle(TDataStd_Integer)::DownCast( into )->Set( Get() ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value -//======================================================================= -void SALOMEDS_FlagsAttribute::Set( const Standard_Integer v ) -{ - TDataStd_Integer::Set( v ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Get -//purpose : GetValue -//======================================================================= -Standard_Integer SALOMEDS_FlagsAttribute::Get() const -{ - return TDataStd_Integer::Get(); -} - - - - - - - - - - - - - - - - - - - - diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx deleted file mode 100644 index ed69b5ff1..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx +++ /dev/null @@ -1,72 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FlagsAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_FlagsAttribute_HeaderFile -#define SALOMEDS_FlagsAttribute_HeaderFile - -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -class Standard_EXPORT SALOMEDS_FlagsAttribute : public TDataStd_Integer -{ -public: - -static const Standard_GUID& GetID() ; -static Handle(SALOMEDS_FlagsAttribute) Set( const TDF_Label&, - const Standard_Integer ); - - SALOMEDS_FlagsAttribute(); -virtual ~SALOMEDS_FlagsAttribute(); - -const Standard_GUID& ID() const; -void Restore( const Handle(TDF_Attribute)& with ); -Handle_TDF_Attribute NewEmpty() const; -void Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const; -void Set( const Standard_Integer ); -Standard_Integer Get() const; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_FlagsAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index dbbe153e0..b0666a4d2 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -24,7 +24,6 @@ #include -#include #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -43,7 +42,7 @@ using namespace std; -SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA) { _isLocal = true; _local_impl = theGA; @@ -97,7 +96,7 @@ std::string SALOMEDS_GenericAttribute::Type() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = _local_impl->Type().ToCString(); + aType = _local_impl->Type(); } else { aType = _corba_impl->Type(); @@ -110,7 +109,7 @@ std::string SALOMEDS_GenericAttribute::GetClassType() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = _local_impl->GetClassType().ToCString(); + aType = _local_impl->GetClassType(); } else { aType = _corba_impl->GetClassType(); @@ -133,21 +132,24 @@ _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject() } -SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute - (const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA) { SALOMEDS::Locker lock; SALOMEDS_GenericAttribute* aGA = NULL; - std::string aTypeOfAttribute = theGA->GetClassType().ToCString(); - __CreateGenericClientAttributeLocal + if(theGA) { + std::string aTypeOfAttribute = theGA->GetClassType(); + __CreateGenericClientAttributeLocal + } return aGA; } SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA) { SALOMEDS_GenericAttribute* aGA = NULL; - std::string aTypeOfAttribute = theGA->GetClassType(); - __CreateGenericClientAttributeCORBA + if(!CORBA::is_nil(theGA)) { + std::string aTypeOfAttribute = theGA->GetClassType(); + __CreateGenericClientAttributeCORBA + } return aGA; } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx index df3f27392..102304918 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx @@ -37,11 +37,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute: public virtual SALOMEDSClient_G { protected: bool _isLocal; - Handle(SALOMEDSImpl_GenericAttribute) _local_impl; + SALOMEDSImpl_GenericAttribute* _local_impl; SALOMEDS::GenericAttribute_var _corba_impl; public: - SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA); SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA); virtual ~SALOMEDS_GenericAttribute(); @@ -50,7 +50,7 @@ public: std::string GetClassType(); _PTR(SObject) GetSObject(); - static SALOMEDS_GenericAttribute* CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA); static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA); }; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index d5ce15664..6c25a767a 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -29,7 +29,6 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Study.hxx" #include "Utils_ExceptHandlers.hxx" -#include #include #ifdef WIN32 @@ -45,7 +44,7 @@ using namespace std; UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); -SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb) +SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb) { _orb = CORBA::ORB::_duplicate(theOrb); _impl = theImpl; @@ -56,7 +55,7 @@ void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribut SALOMEDS::Locker lock; Unexpect aCatch(GALockProtection); - if (!_impl.IsNull() && _impl->IsValid() && !CORBA::is_nil(_orb)) { + if (_impl && !CORBA::is_nil(_orb)) { try { SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(_impl); } @@ -69,8 +68,8 @@ void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribut SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() { SALOMEDS::Locker lock; - if (_impl.IsNull() || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil(); - Handle(SALOMEDSImpl_SObject) so_impl = SALOMEDSImpl_Study::SObject(_impl->Label()); + if (!_impl || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject so_impl = SALOMEDSImpl_Study::SObject(_impl->Label()); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (so_impl, _orb); return so._retn(); } @@ -79,7 +78,7 @@ SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() char* SALOMEDS_GenericAttribute_i::Type() { SALOMEDS::Locker lock; - if (!_impl.IsNull()) { + if (_impl) { return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl)); } @@ -89,7 +88,7 @@ char* SALOMEDS_GenericAttribute_i::Type() char* SALOMEDS_GenericAttribute_i::GetClassType() { SALOMEDS::Locker lock; - if (!_impl.IsNull()) { + if (_impl) { return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl)); } @@ -98,30 +97,13 @@ char* SALOMEDS_GenericAttribute_i::GetClassType() SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute - (const Handle(TDF_Attribute)& theAttr, - CORBA::ORB_ptr theOrb) + (DF_Attribute* theAttr, + CORBA::ORB_ptr theOrb) { SALOMEDS::Locker lock; -/* - static std::map _mapOfAttrib; - SALOMEDS::GenericAttribute_var anAttribute; - SALOMEDS_GenericAttribute_i* attr_servant = NULL; - - if(_mapOfAttrib.find(theAttr.operator->()) != _mapOfAttrib.end()) { - attr_servant = _mapOfAttrib[theAttr.operator->()]; - anAttribute = SALOMEDS::GenericAttribute::_narrow(attr_servant->_this()); - } - else { - char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString(); - __CreateGenericCORBAAttribute - _mapOfAttrib[theAttr.operator->()] = attr_servant; - } -*/ - // mpv: now servants Destroyed by common algos of CORBA - TCollection_AsciiString aClassType = Handle(SALOMEDSImpl_GenericAttribute):: - DownCast(theAttr)->GetClassType(); - char* aTypeOfAttribute = aClassType.ToCString(); + string aClassType = dynamic_cast(theAttr)->GetClassType(); + char* aTypeOfAttribute = (char*)aClassType.c_str(); SALOMEDS::GenericAttribute_var anAttribute; SALOMEDS_GenericAttribute_i* attr_servant = NULL; __CreateGenericCORBAAttribute @@ -140,6 +122,5 @@ CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostnam long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - TDF_Attribute* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 093ed285a..08252579d 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -28,7 +28,7 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include -#include +#include "DF_Attribute.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" @@ -38,11 +38,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS:: { protected: - Handle(TDF_Attribute) _impl; - CORBA::ORB_ptr _orb; + DF_Attribute* _impl; + CORBA::ORB_ptr _orb; public: - SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb); + SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb); virtual ~SALOMEDS_GenericAttribute_i() {}; void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); @@ -53,9 +53,9 @@ public: SALOMEDS::SObject_ptr GetSObject(); - virtual Handle(TDF_Attribute) GetImpl() { return _impl; } + virtual DF_Attribute* GetImpl() { return _impl; } - static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); + static SALOMEDS::GenericAttribute_ptr CreateAttribute(DF_Attribute* theAttr, CORBA::ORB_ptr theOrb); virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx deleted file mode 100644 index ba9bd493c..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx +++ /dev/null @@ -1,185 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_GraphicAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_GraphicAttribute.hxx" -#include -#include -#include -#include - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -//======================================================================= -//function : GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::GetID() -{ - static Standard_GUID SALOMEDS_GraphicAttributeID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); - return SALOMEDS_GraphicAttributeID; -} - -//======================================================================= -//function : SALOMEDS_GraphicAttribute -//purpose : Empty Constructor -//======================================================================= -SALOMEDS_GraphicAttribute::SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : ~SALOMEDS_GraphicAttribute -//purpose : Destructor -//======================================================================= -SALOMEDS_GraphicAttribute::~SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in given view -//======================================================================= -void SALOMEDS_GraphicAttribute::SetVisibility( const Standard_Integer theViewId, - const Standard_Boolean theValue ) -{ - if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue ) - return; - - Backup(); - if ( myVisibility.IsBound( theViewId ) ) - myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0; - else - myVisibility.Bind( theViewId, theValue ? 1 : 0 ); -} - - -//======================================================================= -//function : Get -//purpose : Get visibility of object in given view -//======================================================================= -Standard_Boolean SALOMEDS_GraphicAttribute::GetVisibility( - const Standard_Integer theViewId ) const -{ - return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false; -} - - -//======================================================================= -//function : ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::ID () const -{ - return GetID(); -} - - -//======================================================================= -//function : NewEmpty -//purpose : Create new empty attribute -//======================================================================= -Handle(TDF_Attribute) SALOMEDS_GraphicAttribute::NewEmpty () const -{ - return new SALOMEDS_GraphicAttribute (); -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in all views -//======================================================================= -void SALOMEDS_GraphicAttribute::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap ) -{ - myVisibility = theMap; -} - -//======================================================================= -//function : SetVisibility -//purpose : Get visibility of object in all views -//======================================================================= -const TColStd_DataMapOfIntegerInteger& SALOMEDS_GraphicAttribute::GetVisibility() -{ - return myVisibility; -} - -//======================================================================= -//function : Restore -//purpose : Restore value of attribute with value of theWith one -//======================================================================= -void SALOMEDS_GraphicAttribute::Restore( const Handle(TDF_Attribute)& theWith ) -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theWith ); - - if ( !anAttr.IsNull() ) - SetVisibility( anAttr->GetVisibility() ); -} - -//======================================================================= -//function : Paste -//purpose : Paste value of current attribute to the value of entry one -//======================================================================= -void SALOMEDS_GraphicAttribute::Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theInto ); - - if ( !anAttr.IsNull() ) - anAttr->SetVisibility( myVisibility ); -} - -//======================================================================= -//function : Dump -//purpose : Dump -//======================================================================= -Standard_OStream& SALOMEDS_GraphicAttribute::Dump( Standard_OStream& anOS ) const -{ - anOS << "Visibility of object:" << endl; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility ); - for ( ; anIter.More(); anIter.Next() ) - { - char str[ 100 ]; - - if ( GetVisibility( anIter.Key() ) ) - sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() ); - else - sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() ); - - anOS << str; - } - - anOS << "Integer"; - return anOS; -} - diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx deleted file mode 100644 index 554d10c4d..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_GraphicAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_GraphicAttribute_HeaderFile -#define SALOMEDS_GraphicAttribute_HeaderFile - -#include -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -class Standard_EXPORT SALOMEDS_GraphicAttribute : public TDF_Attribute -{ - -public: - SALOMEDS_GraphicAttribute(); - ~SALOMEDS_GraphicAttribute(); - - static const Standard_GUID& GetID() ; - - void SetVisibility( const Standard_Integer, - const Standard_Boolean ); - Standard_Boolean GetVisibility( const Standard_Integer ) const; - const Standard_GUID& ID() const; - void Restore( const Handle(TDF_Attribute)& theWith ); - Handle(TDF_Attribute) NewEmpty() const; - void Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const; - virtual Standard_OStream& Dump( Standard_OStream& anOS ) const; - - void SetVisibility( const TColStd_DataMapOfIntegerInteger& ); - - const TColStd_DataMapOfIntegerInteger& GetVisibility(); - -private: - TColStd_DataMapOfIntegerInteger myVisibility; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_GraphicAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl b/src/SALOMEDS/SALOMEDS_IORAttribute.cdl deleted file mode 100644 index d1f63c83e..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_IORAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class IORAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns IORAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable IORAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end IORAttribute; diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx b/src/SALOMEDS/SALOMEDS_IORAttribute.cxx deleted file mode 100644 index 04dd74d25..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -#include - -#include "SALOMEDS_IORAttribute.ixx" -#include "SALOMEDS_Study_i.hxx" - -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::GetID () -{ - static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_IORAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S, - SALOMEDS_Study_i* theStudy) -{ - Handle(SALOMEDS_IORAttribute) A; - if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) { - A = new SALOMEDS_IORAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - theStudy->IORUpdated(A); - return A; -} - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_IORAttribute::SALOMEDS_IORAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const -{ - return new SALOMEDS_IORAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx b/src/SALOMEDS/SALOMEDS_IORAttribute.hxx deleted file mode 100644 index 0979aee7b..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx +++ /dev/null @@ -1,131 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#define _SALOMEDS_IORAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile -#include "Handle_SALOMEDS_IORAttribute.hxx" -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif - -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; -class SALOMEDS_Study_i; - -class SALOMEDS_IORAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label, - const TCollection_ExtendedString& string, - SALOMEDS_Study_i* theStudy) ; -Standard_EXPORT SALOMEDS_IORAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_IORAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_IORAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx b/src/SALOMEDS/SALOMEDS_IORAttribute.ixx deleted file mode 100644 index 59ef72dfb..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_IORAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_IORAttribute::~SALOMEDS_IORAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_IORAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_IORAttribute", - sizeof(SALOMEDS_IORAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_IORAttribute) Handle(SALOMEDS_IORAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_IORAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_IORAttribute))) { - _anOtherObject = Handle(SALOMEDS_IORAttribute)((Handle(SALOMEDS_IORAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_IORAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_IORAttribute) ; -} -Standard_Boolean SALOMEDS_IORAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_IORAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_IORAttribute::~Handle_SALOMEDS_IORAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx b/src/SALOMEDS/SALOMEDS_IORAttribute.jxx deleted file mode 100644 index 415f1006f..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#include "SALOMEDS_IORAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_IParameters.cxx b/src/SALOMEDS/SALOMEDS_IParameters.cxx index 78d4ff8a1..93466d8fb 100644 --- a/src/SALOMEDS/SALOMEDS_IParameters.cxx +++ b/src/SALOMEDS/SALOMEDS_IParameters.cxx @@ -19,8 +19,6 @@ #include "SALOMEDS_IParameters.hxx" #include -#include - using namespace std; #define PT_INTEGER 0 @@ -199,22 +197,22 @@ vector SALOMEDS_IParameters::getProperties() vector SALOMEDS_IParameters::parseValue(const string& value, const char separator, bool fromEnd) { - TCollection_AsciiString val((char*)value.c_str()); + string val(value); vector v; int pos; - if(fromEnd) pos = val.SearchFromEnd(separator); - else pos = val.Search(separator); + if(fromEnd) pos = val.rfind(separator); + else pos = val.find(separator); if(pos < 0) { v.push_back(value); return v; } - TCollection_AsciiString part1, part2; - part1 = val.SubString(1, pos-1); - part2 = val.SubString(pos+1, val.Length()); - v.push_back(part1.ToCString()); - v.push_back(part2.ToCString()); + string part1, part2; + part1 = val.substr(0, pos); + part2 = val.substr(pos+1, val.size()); + v.push_back(part1); + v.push_back(part2); return v; } diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl deleted file mode 100644 index ba3615d2e..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_LocalIDAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class LocalIDAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - returns OpenedAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable OpenedAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end LocalIDAttribute; diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx deleted file mode 100644 index c6d705bc7..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_LocalIDAttribute) SALOMEDS_LocalIDAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_LocalIDAttribute) A; - if (!L.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(),A)) { - A = new SALOMEDS_LocalIDAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_LocalIDAttribute::SALOMEDS_LocalIDAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_LocalIDAttribute::NewEmpty () const -{ - return new SALOMEDS_LocalIDAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx deleted file mode 100644 index 6eb8e580f..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#define _SALOMEDS_LocalIDAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_LocalIDAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_LocalIDAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_LocalIDAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_LocalIDAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx deleted file mode 100644 index c0d1166bc..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_LocalIDAttribute::~SALOMEDS_LocalIDAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_LocalIDAttribute", - sizeof(SALOMEDS_LocalIDAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_LocalIDAttribute) Handle(SALOMEDS_LocalIDAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_LocalIDAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_LocalIDAttribute))) { - _anOtherObject = Handle(SALOMEDS_LocalIDAttribute)((Handle(SALOMEDS_LocalIDAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_LocalIDAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_LocalIDAttribute) ; -} -Standard_Boolean SALOMEDS_LocalIDAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_LocalIDAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_LocalIDAttribute::~Handle_SALOMEDS_LocalIDAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx deleted file mode 100644 index 91665a49e..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#include "SALOMEDS_LocalIDAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl b/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl deleted file mode 100644 index 6e771b87f..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl +++ /dev/null @@ -1,45 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_OCAFApplication.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class OCAFApplication from SALOMEDS inherits Application from TDocStd - - ---Purpose: - -uses - Label from TDF, - SequenceOfExtendedString from TColStd, - CString from Standard, - Document from TDocStd - - -is - - Create - returns mutable OCAFApplication from SALOMEDS; - - Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd) - is redefined; - - ResourcesName (me: mutable) returns CString from Standard; - -end OCAFApplication; diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx deleted file mode 100644 index 2cef1f64b..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.ixx" -using namespace std; - -//======================================================================= -//function : SALOMEDS_OCAFApplication -//purpose : -//======================================================================= - -SALOMEDS_OCAFApplication::SALOMEDS_OCAFApplication() -{ -} - - -//======================================================================= -//function : Formats -//purpose : -//======================================================================= - -void SALOMEDS_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats) -{ - Formats.Append(TCollection_ExtendedString ("SALOME_STUDY")); -} - - -//======================================================================= -//function : ResourcesName -//purpose : -//======================================================================= - -Standard_CString SALOMEDS_OCAFApplication::ResourcesName() -{ - return Standard_CString ("SALOMEDS_Resources"); -} - - - - - diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx deleted file mode 100644 index 9b871ffa5..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#define _SALOMEDS_OCAFApplication_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile -#include "Handle_SALOMEDS_OCAFApplication.hxx" -#endif - -#ifndef _TDocStd_Application_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -class TColStd_SequenceOfExtendedString; - - -class SALOMEDS_OCAFApplication : public TDocStd_Application { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_OCAFApplication(); -Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; -Standard_EXPORT Standard_CString ResourcesName() ; -Standard_EXPORT ~SALOMEDS_OCAFApplication(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx b/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx deleted file mode 100644 index 869b19a32..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OCAFApplication::~SALOMEDS_OCAFApplication() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application); - static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application); - static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OCAFApplication", - sizeof(SALOMEDS_OCAFApplication), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OCAFApplication) Handle(SALOMEDS_OCAFApplication)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OCAFApplication) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OCAFApplication))) { - _anOtherObject = Handle(SALOMEDS_OCAFApplication)((Handle(SALOMEDS_OCAFApplication)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OCAFApplication::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OCAFApplication) ; -} -Standard_Boolean SALOMEDS_OCAFApplication::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OCAFApplication) == AType || TDocStd_Application::IsKind(AType)); -} -Handle_SALOMEDS_OCAFApplication::~Handle_SALOMEDS_OCAFApplication() {} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl deleted file mode 100644 index 1e04ceacf..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl +++ /dev/null @@ -1,74 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_OpenedAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class OpenedAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns OpenedAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable OpenedAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end OpenedAttribute; diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx deleted file mode 100644 index 11b447e03..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_OpenedAttribute) SALOMEDS_OpenedAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_OpenedAttribute) A; - if (!L.FindAttribute(SALOMEDS_OpenedAttribute::GetID(),A)) { - A = new SALOMEDS_OpenedAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_OpenedAttribute::SALOMEDS_OpenedAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_OpenedAttribute::NewEmpty () const -{ - return new SALOMEDS_OpenedAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx deleted file mode 100644 index 9a66dbd5a..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#define _SALOMEDS_OpenedAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_OpenedAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_OpenedAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_OpenedAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_OpenedAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx deleted file mode 100644 index 7f53d48e6..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OpenedAttribute::~SALOMEDS_OpenedAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OpenedAttribute", - sizeof(SALOMEDS_OpenedAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OpenedAttribute) Handle(SALOMEDS_OpenedAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OpenedAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OpenedAttribute))) { - _anOtherObject = Handle(SALOMEDS_OpenedAttribute)((Handle(SALOMEDS_OpenedAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OpenedAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OpenedAttribute) ; -} -Standard_Boolean SALOMEDS_OpenedAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OpenedAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_OpenedAttribute::~Handle_SALOMEDS_OpenedAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx deleted file mode 100644 index 7a429f75b..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#include "SALOMEDS_OpenedAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl deleted file mode 100644 index aba57838e..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_PersRefAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class PersRefAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns PersRefAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable PersRefAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end PersRefAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx deleted file mode 100644 index 8de157a31..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_PersRefAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PersRefAttribute) A; - if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) { - A = new SALOMEDS_PersRefAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const -{ - return new SALOMEDS_PersRefAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx deleted file mode 100644 index 97942b753..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#define _SALOMEDS_PersRefAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PersRefAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PersRefAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PersRefAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PersRefAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx deleted file mode 100644 index 44e9e9338..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PersRefAttribute::~SALOMEDS_PersRefAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PersRefAttribute", - sizeof(SALOMEDS_PersRefAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PersRefAttribute) Handle(SALOMEDS_PersRefAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PersRefAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PersRefAttribute))) { - _anOtherObject = Handle(SALOMEDS_PersRefAttribute)((Handle(SALOMEDS_PersRefAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PersRefAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PersRefAttribute) ; -} -Standard_Boolean SALOMEDS_PersRefAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PersRefAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PersRefAttribute::~Handle_SALOMEDS_PersRefAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx deleted file mode 100644 index 13aecf8d1..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#include "SALOMEDS_PersRefAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl deleted file mode 100644 index 7e0b16f1f..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_PixMapAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class PixMapAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns PixMapAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable PixMapAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end PixMapAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx deleted file mode 100644 index 828b5de89..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PixMapAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PixMapAttribute) A; - if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) { - A = new SALOMEDS_PixMapAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute() -{TDataStd_Comment::Set("None");} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const -{ - return new SALOMEDS_PixMapAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx deleted file mode 100644 index 1ba561edb..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#define _SALOMEDS_PixMapAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PixMapAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PixMapAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PixMapAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PixMapAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx deleted file mode 100644 index c28bd26a8..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PixMapAttribute::~SALOMEDS_PixMapAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PixMapAttribute", - sizeof(SALOMEDS_PixMapAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PixMapAttribute) Handle(SALOMEDS_PixMapAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PixMapAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PixMapAttribute))) { - _anOtherObject = Handle(SALOMEDS_PixMapAttribute)((Handle(SALOMEDS_PixMapAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PixMapAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PixMapAttribute) ; -} -Standard_Boolean SALOMEDS_PixMapAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PixMapAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PixMapAttribute::~Handle_SALOMEDS_PixMapAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx deleted file mode 100644 index a087c9366..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#include "SALOMEDS_PixMapAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl deleted file mode 100644 index 83438a2fa..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl +++ /dev/null @@ -1,83 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- --- File : SALOMEDS_PythonObjectAttribute.cdl --- Author : Michael Ponikarov --- Module : SALOME - -class PythonObjectAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - DataSet from TDF, - RelocationTable from TDF, - Data from TDF, - HArray1OfCharacter from TColStd - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - returns PythonObjectAttribute from SALOMEDS; - - ---Purpose: Common methods - -- ============ - - Create - returns mutable PythonObjectAttribute from SALOMEDS; - - SetObject(me: mutable; theSequence : CString from Standard; theScript : Boolean from Standard); - - GetObject(me) returns CString from Standard; - - IsScript(me) returns Boolean from Standard; - - GetLength(me) returns Integer from Standard; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - mySequence : CString from Standard; - myIsScript : Boolean from Standard; - -end PythonObjectAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx deleted file mode 100644 index 109cec756..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.ixx" -#include -using namespace std; - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID() -{ - static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PythonObjectAttributeID; -} - -Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_PythonObjectAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_PythonObjectAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute() -{ -} - -void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence, - const Standard_Boolean theScript) -{ - Backup(); - if(mySequence != NULL) delete mySequence; - if (theSequence == NULL) { - mySequence = NULL; - } else { - mySequence = new char[strlen(theSequence)+1]; - strcpy(mySequence, theSequence); - } - - myIsScript = theScript; -} - -Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const -{ - return mySequence; -} - -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const -{ - return myIsScript; -} - -Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const -{ - if (mySequence == NULL) return 0; - return (strlen(mySequence)+1); -} - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with); - SetObject(anObj->GetObject(),anObj->IsScript()); -} - -Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const -{ - return new SALOMEDS_PythonObjectAttribute(); -} - -void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into); - anObj->SetObject(GetObject(),IsScript()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx deleted file mode 100644 index aa872aff8..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx +++ /dev/null @@ -1,126 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#define _SALOMEDS_PythonObjectAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HArray1OfCharacter; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PythonObjectAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PythonObjectAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_PythonObjectAttribute(); -Standard_EXPORT void SetObject(const Standard_CString theSequence,const Standard_Boolean theScript) ; -Standard_EXPORT Standard_CString GetObject() const; -Standard_EXPORT Standard_Boolean IsScript() const; -Standard_EXPORT Standard_Integer GetLength() const; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PythonObjectAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_CString mySequence; -Standard_Boolean myIsScript; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx deleted file mode 100644 index cc0894389..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PythonObjectAttribute::~SALOMEDS_PythonObjectAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PythonObjectAttribute", - sizeof(SALOMEDS_PythonObjectAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PythonObjectAttribute) Handle(SALOMEDS_PythonObjectAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PythonObjectAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PythonObjectAttribute))) { - _anOtherObject = Handle(SALOMEDS_PythonObjectAttribute)((Handle(SALOMEDS_PythonObjectAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PythonObjectAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) ; -} -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_PythonObjectAttribute::~Handle_SALOMEDS_PythonObjectAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx deleted file mode 100644 index d05105e38..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#include "SALOMEDS_PythonObjectAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx deleted file mode 100644 index 0b1106ff0..000000000 --- a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SAttribute_i.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef __SALOMEDS_SATTRIBUTE_I_H__ -#define __SALOMEDS_SATTRIBUTE_I_H__ - -// std C++ headers -#include - -// IDL headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - - - -// Cascade headers -#include -#include - -class SALOMEDS_SAttribute_i: public POA_IStudy::SAttribute, - public PortableServer::ServantBase { -private: - CORBA::ORB_ptr _orb; - char* _Type; - char -public: - - SALOMEDS_SAttribute_i(const Handle(TDocStd_Document), CORBA::ORB_ptr); - - ~SALOMEDS_SAttribute_i(); - - virtual char* GetID() ; - virtual SObject_ptr GetOwner(); - virtual char* GetType(); - virtual char* GetValue(); - -}; -#endif diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx index 65fdc2eaa..07ae3028f 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -29,7 +29,6 @@ #include "SALOMEDS_SComponent_i.hxx" #include -#include using namespace std; @@ -37,7 +36,7 @@ SALOMEDS_SComponent::SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent) :SALOMEDS_SObject(theSComponent) {} -SALOMEDS_SComponent::SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent) +SALOMEDS_SComponent::SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent) :SALOMEDS_SObject(theSComponent) {} @@ -49,7 +48,7 @@ std::string SALOMEDS_SComponent::ComponentDataType() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType().ToCString(); + aType = (dynamic_cast(GetLocalImpl()))->ComponentDataType(); } else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType(); @@ -61,9 +60,7 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_AsciiString anIOR; - ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR); - theID = anIOR.ToCString(); + ret = (dynamic_cast(GetLocalImpl()))->ComponentIOR(theID); } else { CORBA::String_var anIOR; @@ -78,7 +75,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent() { if(_isLocal) { if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); - SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb); + SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast(GetLocalImpl())), _orb); _corba_impl = SALOMEDS::SComponent::_duplicate(aSCO); return aSCO._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponent.hxx b/src/SALOMEDS/SALOMEDS_SComponent.hxx index 56fc38025..129a81d8c 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.hxx @@ -36,7 +36,7 @@ class Standard_EXPORT SALOMEDS_SComponent: public SALOMEDS_SObject, public SALOM { public: - SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent); + SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent); SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent); ~SALOMEDS_SComponent(); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 3736c5e7f..28c1248d6 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -28,7 +28,7 @@ #include "SALOMEDSImpl_SComponent.hxx" SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator) -:_local_impl(theIterator) +:_local_impl(theIterator.GetPersistentCopy()) { _isLocal = true; _corba_impl = SALOMEDS::SComponentIterator::_nil(); @@ -43,13 +43,14 @@ SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIte SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator() { if(!_isLocal) _corba_impl->Destroy(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_SComponentIterator::Init() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl.Init(); + _local_impl->Init(); } else _corba_impl->Init(); } @@ -59,7 +60,7 @@ bool SALOMEDS_SComponentIterator::More() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl.More(); + ret = _local_impl->More(); } else ret = _corba_impl->More(); return ret; @@ -69,7 +70,7 @@ void SALOMEDS_SComponentIterator::Next() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl.Next(); + _local_impl->Next(); } else _corba_impl->Next(); } @@ -79,7 +80,7 @@ _PTR(SComponent) SALOMEDS_SComponentIterator::Value() SALOMEDSClient_SComponent* aSCO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSCO = new SALOMEDS_SComponent(_local_impl.Value()); + aSCO = new SALOMEDS_SComponent(_local_impl->Value()); } else aSCO = new SALOMEDS_SComponent(_corba_impl->Value()); return _PTR(SComponent)(aSCO); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx index 3e5419a2e..1dbecadcf 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx @@ -40,7 +40,7 @@ public: private: bool _isLocal; - SALOMEDSImpl_SComponentIterator _local_impl; + SALOMEDSImpl_SComponentIterator* _local_impl; SALOMEDS::SComponentIterator_var _corba_impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx index 197ce8c2b..4f4151c66 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx @@ -36,9 +36,9 @@ using namespace std; SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, CORBA::ORB_ptr orb) -:_impl(theImpl) { _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl.GetPersistentCopy(); } //============================================================================ @@ -48,6 +48,7 @@ SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_ //============================================================================ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() { + if(_impl) delete _impl; } //============================================================================ @@ -58,7 +59,7 @@ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() void SALOMEDS_SComponentIterator_i::Init() { SALOMEDS::Locker lock; - _impl.Init(); + _impl->Init(); } //============================================================================ @@ -69,7 +70,7 @@ void SALOMEDS_SComponentIterator_i::Init() CORBA::Boolean SALOMEDS_SComponentIterator_i::More() { SALOMEDS::Locker lock; - return _impl.More(); + return _impl->More(); } //============================================================================ @@ -79,7 +80,7 @@ CORBA::Boolean SALOMEDS_SComponentIterator_i::More() void SALOMEDS_SComponentIterator_i::Next() { SALOMEDS::Locker lock; - _impl.Next(); + _impl->Next(); } @@ -91,7 +92,7 @@ void SALOMEDS_SComponentIterator_i::Next() SALOMEDS::SComponent_ptr SALOMEDS_SComponentIterator_i::Value() { SALOMEDS::Locker lock; - SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl.Value(), _orb); + SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl->Value(), _orb); return sco._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index 3335a1a28..0f0759e2b 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -43,8 +43,8 @@ class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentItera private: - CORBA::ORB_ptr _orb; - SALOMEDSImpl_SComponentIterator _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_SComponentIterator* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx index e18d9e8c8..8fc689ff7 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx @@ -29,23 +29,8 @@ using namespace std; -SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB) +SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB) { -/* - static std::map _mapOfSCO; - SALOMEDS::SComponent_var sco; - SALOMEDS_SComponent_i* sco_servant = NULL; - - if(_mapOfSCO.find(theImpl.operator->()) != _mapOfSCO.end()) { - sco_servant = _mapOfSCO[theImpl.operator->()]; - } - else { - sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB); - _mapOfSCO[theImpl.operator->()] = sco_servant; - } - - sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); -*/ SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB); SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); @@ -57,7 +42,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SC * Purpose : */ //============================================================================ -SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb) +SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr orb) :SALOMEDS_SObject_i(theImpl, orb) {} @@ -77,8 +62,8 @@ SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i() char* SALOMEDS_SComponent_i::ComponentDataType() { SALOMEDS::Locker lock; - TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType(); - return CORBA::string_dup(aType.ToCString()); + string aType = dynamic_cast(_impl)->ComponentDataType(); + return CORBA::string_dup(aType.c_str()); } @@ -90,11 +75,11 @@ char* SALOMEDS_SComponent_i::ComponentDataType() CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR) { SALOMEDS::Locker lock; - TCollection_AsciiString ior; - if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) { + string ior; + if(!dynamic_cast(_impl)->ComponentIOR(ior)) { IOR = CORBA::string_dup(""); return false; } - IOR = CORBA::string_dup(ior.ToCString()); + IOR = CORBA::string_dup(ior.c_str()); return true; } diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx index 9fe9644a2..4a6d2d5cf 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx @@ -43,9 +43,9 @@ class Standard_EXPORT SALOMEDS_SComponent_i: public POA_SALOMEDS::SComponent, public: - static SALOMEDS::SComponent_ptr New(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr); + static SALOMEDS::SComponent_ptr New(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr); - SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr); + SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr); virtual ~SALOMEDS_SComponent_i(); diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 3888f4002..b7b6e7410 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -22,8 +22,6 @@ // Module : SALOME #include -#include -#include #include "SALOMEDS_SObject.hxx" @@ -76,11 +74,18 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) init_orb(); } -SALOMEDS_SObject::SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject) +SALOMEDS_SObject::SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject) :_isLocal(true) { _corba_impl = SALOMEDS::SObject::_nil(); - _local_impl = theSObject; + + if(theSObject.IsComponent()) { + SALOMEDSImpl_SComponent sco = theSObject; + _local_impl = sco.GetPersistentCopy(); + } + else { + _local_impl = theSObject.GetPersistentCopy(); + } init_orb(); } @@ -90,6 +95,9 @@ SALOMEDS_SObject::~SALOMEDS_SObject() if (!_isLocal) { _corba_impl->Destroy(); } + else { + if(_local_impl) delete _local_impl; + } } std::string SALOMEDS_SObject::GetID() @@ -97,7 +105,7 @@ std::string SALOMEDS_SObject::GetID() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = _local_impl->GetID().ToCString(); + aValue = _local_impl->GetID(); } else aValue = _corba_impl->GetID(); return aValue; @@ -107,9 +115,7 @@ _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent() { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO = - Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent()); - return _PTR(SComponent)(new SALOMEDS_SComponent(aSCO)); + return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent())); } return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent())); } @@ -129,9 +135,12 @@ bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) anAttr; - ret = _local_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute.c_str()); - if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr)); + DF_Attribute* anAttr = NULL; + ret = _local_impl->FindAttribute(anAttr, aTypeOfAttribute); + if(ret) { + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(anAttr); + anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(ga)); + } } else { SALOMEDS::GenericAttribute_var anAttr; @@ -147,7 +156,7 @@ bool SALOMEDS_SObject::ReferencedObject(_PTR(SObject)& theObject) bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; ret = _local_impl->ReferencedObject(aSO); if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO)); } @@ -166,7 +175,7 @@ bool SALOMEDS_SObject::FindSubObject(int theTag, _PTR(SObject)& theObject) bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; ret = _local_impl->FindSubObject(theTag, aSO); if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO)); } @@ -193,7 +202,7 @@ std::string SALOMEDS_SObject::Name() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->Name().ToCString(); + aName = _local_impl->Name(); } else aName = _corba_impl->Name(); @@ -204,7 +213,7 @@ void SALOMEDS_SObject::Name(const std::string& theName) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Name((char*)theName.c_str()); + _local_impl->Name(theName); } else _corba_impl->Name(theName.c_str()); } @@ -217,11 +226,10 @@ vector<_PTR(GenericAttribute)> SALOMEDS_SObject::GetAllAttributes() if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetAllAttributes(); - aLength = aSeq->Length(); - for (int i = 1; i <= aLength; i++) { - anAttr = SALOMEDS_GenericAttribute::CreateAttribute - (Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))); + vector aSeq = _local_impl->GetAllAttributes(); + aLength = aSeq.size(); + for (int i = 0; i < aLength; i++) { + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(dynamic_cast(aSeq[i])); aVector.push_back(_PTR(GenericAttribute)(anAttr)); } } @@ -242,7 +250,7 @@ std::string SALOMEDS_SObject::GetName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->GetName().ToCString(); + aName = _local_impl->GetName(); } else aName = _corba_impl->GetName(); @@ -254,7 +262,7 @@ std::string SALOMEDS_SObject::GetComment() std::string aComment; if (_isLocal) { SALOMEDS::Locker lock; - aComment = _local_impl->GetComment().ToCString(); + aComment = _local_impl->GetComment(); } else aComment = _corba_impl->GetComment(); @@ -266,7 +274,7 @@ std::string SALOMEDS_SObject::GetIOR() std::string anIOR; if (_isLocal) { SALOMEDS::Locker lock; - anIOR = _local_impl->GetIOR().ToCString(); + anIOR = _local_impl->GetIOR(); } else anIOR = _corba_impl->GetIOR(); @@ -313,7 +321,7 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject::GetSObject() { if(_isLocal) { if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SObject::_duplicate(_corba_impl); - SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(_local_impl, _orb); + SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(*_local_impl, _orb); _corba_impl = SALOMEDS::SObject::_duplicate(aSO); return aSO._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index efc13e827..90ea579cb 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -40,14 +40,14 @@ class Standard_EXPORT SALOMEDS_SObject: public virtual SALOMEDSClient_SObject protected: bool _isLocal; - Handle(SALOMEDSImpl_SObject) _local_impl; + SALOMEDSImpl_SObject* _local_impl; SALOMEDS::SObject_var _corba_impl; CORBA::ORB_var _orb; public: SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject); - SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject); + SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject); virtual ~SALOMEDS_SObject(); virtual std::string GetID(); @@ -59,7 +59,7 @@ public: virtual _PTR(Study) GetStudy(); virtual std::string Name(); virtual void Name(const std::string& theName); - virtual vector<_PTR(GenericAttribute)> GetAllAttributes(); + virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes(); virtual std::string GetName(); virtual std::string GetComment(); virtual std::string GetIOR(); @@ -70,7 +70,7 @@ public: SALOMEDS::SObject_ptr GetSObject(); SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } - Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; } + SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; } private: void init_orb(); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 59b0e30a0..9af322638 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -34,10 +34,6 @@ #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" -// OCC Headers -#include -#include -#include #include #ifdef WIN32 @@ -51,7 +47,7 @@ using namespace std; -SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB) +SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB) { SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB); SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); @@ -65,9 +61,17 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject) * Purpose : */ //============================================================================ -SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb) - : _impl(impl) +SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) { + if(!impl.IsNull()) { + if(impl.IsComponent()) { + SALOMEDSImpl_SComponent sco = impl; + _impl = sco.GetPersistentCopy(); + } + else { + _impl = impl.GetPersistentCopy(); + } + } _orb = CORBA::ORB::_duplicate(orb); //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy()); } @@ -79,7 +83,9 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, */ //============================================================================ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() -{} +{ + if(_impl) delete _impl; +} //============================================================================ @@ -90,7 +96,7 @@ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() char* SALOMEDS_SObject_i::GetID() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetID().ToCString()); + return CORBA::string_dup(_impl->GetID().c_str()); } //============================================================================ @@ -125,14 +131,14 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy = _impl->GetStudy(); - if(aStudy.IsNull()) { + SALOMEDSImpl_Study* aStudy = _impl->GetStudy(); + if(!aStudy) { MESSAGE("Problem GetStudy"); return SALOMEDS::Study::_nil(); } - TCollection_AsciiString IOR = aStudy->GetTransientReference(); - CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString()); + string IOR = aStudy->GetTransientReference(); + CORBA::Object_var obj = _orb->string_to_object(IOR.c_str()); SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ; ASSERT(!CORBA::is_nil(Study)); return SALOMEDS::Study::_duplicate(Study); @@ -147,13 +153,13 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out const char* aTypeOfAttribute) { SALOMEDS::Locker lock; - Handle(TDF_Attribute) anAttr; + DF_Attribute* anAttr = NULL; if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) { anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); - return Standard_True; + return true; } - return Standard_False; + return false; } //============================================================================ @@ -165,19 +171,19 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllAttributes(); + vector aSeq = _impl->GetAllAttributes(); SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes; - Standard_Integer length = aSeq->Length(); + int length = aSeq.size(); SeqOfAttr->length(length); if (length != 0) { - for(int i = 1; i<= length; i++) { - Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)); + for(int i = 0; i < length; i++) { + SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast(aSeq[i]); SALOMEDS::GenericAttribute_var anAttribute; anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); if (!CORBA::is_nil(anAttribute)) { - SeqOfAttr[i - 1] = anAttribute; + SeqOfAttr[i] = anAttribute; } } } @@ -193,7 +199,7 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aRefObj; + SALOMEDSImpl_SObject aRefObj; if(!_impl->ReferencedObject(aRefObj)) return false; obj = SALOMEDS_SObject_i::New (aRefObj, _orb); @@ -208,7 +214,7 @@ CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long atag, SALOMEDS::SObject_out obj) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSubObj; + SALOMEDSImpl_SObject aSubObj; if(!_impl->FindSubObject(atag, aSubObj)) return false; obj = SALOMEDS_SObject_i::New (aSubObj, _orb); @@ -224,7 +230,7 @@ CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long atag, SALOMEDS::SOb char* SALOMEDS_SObject_i::Name() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->Name().ToCString()); + return CORBA::string_dup(_impl->Name().c_str()); } //============================================================================ @@ -235,7 +241,7 @@ char* SALOMEDS_SObject_i::Name() void SALOMEDS_SObject_i::Name(const char* name) { SALOMEDS::Locker lock; - TCollection_AsciiString aName((char*)name); + string aName((char*)name); _impl->Name(aName); } @@ -271,8 +277,8 @@ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() SALOMEDS::Locker lock; CORBA::Object_ptr obj = CORBA::Object::_nil(); try { - TCollection_AsciiString IOR = _impl->GetIOR(); - char* c_ior = CORBA::string_dup(IOR.ToCString()); + string IOR = _impl->GetIOR(); + char* c_ior = CORBA::string_dup(IOR.c_str()); obj = _orb->string_to_object(c_ior); CORBA::string_free(c_ior); } catch(...) {} @@ -287,7 +293,7 @@ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() char* SALOMEDS_SObject_i::GetName() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().c_str()); return aStr._retn(); } @@ -299,7 +305,7 @@ char* SALOMEDS_SObject_i::GetName() char* SALOMEDS_SObject_i::GetComment() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().c_str()); return aStr._retn(); } @@ -311,7 +317,7 @@ char* SALOMEDS_SObject_i::GetComment() char* SALOMEDS_SObject_i::GetIOR() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().c_str()); return aStr._retn(); } @@ -326,6 +332,5 @@ CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA: long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_SObject* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)(void*)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index b836a2bee..dfab13cba 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -40,14 +40,14 @@ class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, public virtual SALOME::GenericObj_i { protected: - CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_SObject) _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_SObject* _impl; public: - static SALOMEDS::SObject_ptr New(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr); + static SALOMEDS::SObject_ptr New(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr); - SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr); + SALOMEDS_SObject_i(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr); virtual ~SALOMEDS_SObject_i(); diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl deleted file mode 100644 index 34e2734ce..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl +++ /dev/null @@ -1,74 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_SelectableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SelectableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SelectableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SelectableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end SelectableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx deleted file mode 100644 index d11bc86c5..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SelectableAttributeID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SelectableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SelectableAttribute) SALOMEDS_SelectableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_SelectableAttribute) A; - if (!L.FindAttribute(SALOMEDS_SelectableAttribute::GetID(),A)) { - A = new SALOMEDS_SelectableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SelectableAttribute::SALOMEDS_SelectableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SelectableAttribute::NewEmpty () const -{ - return new SALOMEDS_SelectableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx deleted file mode 100644 index ed7f98067..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#define _SALOMEDS_SelectableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SelectableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SelectableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_SelectableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SelectableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx deleted file mode 100644 index b9a76ce19..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SelectableAttribute::~SALOMEDS_SelectableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SelectableAttribute", - sizeof(SALOMEDS_SelectableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SelectableAttribute) Handle(SALOMEDS_SelectableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SelectableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SelectableAttribute))) { - _anOtherObject = Handle(SALOMEDS_SelectableAttribute)((Handle(SALOMEDS_SelectableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SelectableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SelectableAttribute) ; -} -Standard_Boolean SALOMEDS_SelectableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SelectableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_SelectableAttribute::~Handle_SALOMEDS_SelectableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx deleted file mode 100644 index 5538e42ab..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#include "SALOMEDS_SelectableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl deleted file mode 100644 index 7f7a703d9..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl +++ /dev/null @@ -1,101 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_SequenceOfIntegerAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SequenceOfIntegerAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - HSequenceOfInteger from TColStd, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SequenceOfIntegerAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SequenceOfIntegerAttribute from SALOMEDS; - - ---Category: IntegerArray methods - -- =============== - - Assign(me : mutable; other : HSequenceOfInteger from TColStd); - ---Purpose: Initialize the inner sequence by other one - - ChangeValue (me : mutable; Index, Value : Integer from Standard); - ---Purpose: Sets the th element of the sequence to - - Add (me : mutable; value : Integer from Standard); - ---Purpose: Add new value - - Value (me : mutable; Index : Integer from Standard) returns Integer; - ---Purpose: Value of index - - Remove (me : mutable; Index : Integer from Standard); - ---Purpose: Remove element on index - - Length (me : mutable) returns Integer; - ---Purpose: Returns length of sequence - - - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myValue : HSequenceOfInteger from TColStd; - -end SequenceOfIntegerAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx deleted file mode 100644 index ceb6a42d9..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfIntegerAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfIntegerAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute() -{myValue = new TColStd_HSequenceOfInteger();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfIntegerAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfInteger(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length() -{ - return myValue->Length(); -} -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx deleted file mode 100644 index 9092ad439..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#define _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfIntegerAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfIntegerAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfIntegerAttribute(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ; -Standard_EXPORT void Add(const Standard_Integer value) ; -Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SequenceOfIntegerAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfInteger myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx deleted file mode 100644 index 6c17e84e8..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfIntegerAttribute::~SALOMEDS_SequenceOfIntegerAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfIntegerAttribute", - sizeof(SALOMEDS_SequenceOfIntegerAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfIntegerAttribute) Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfIntegerAttribute)((Handle(SALOMEDS_SequenceOfIntegerAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfIntegerAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfIntegerAttribute::~Handle_SALOMEDS_SequenceOfIntegerAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx deleted file mode 100644 index 6056e3645..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include "SALOMEDS_SequenceOfIntegerAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl deleted file mode 100644 index f0a84c32d..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl +++ /dev/null @@ -1,100 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_SequenceOfRealAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SequenceOfRealAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - HSequenceOfReal from TColStd, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SequenceOfRealAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SequenceOfRealAttribute from SALOMEDS; - - ---Category: IntegerArray methods - -- =============== - - Assign(me : mutable; other : HSequenceOfReal from TColStd); - ---Purpose: Initialize the inner sequence by other one - - ChangeValue (me : mutable; Index : Integer from Standard; Value : Real); - ---Purpose: Sets the th element of the sequence to - - Add (me : mutable; Value : Real from Standard); - ---Purpose: Add new value - - Value (me : mutable; Index : Integer from Standard) returns Real; - ---Purpose: Value of index - - Remove (me : mutable; Index : Integer from Standard); - ---Purpose: Remove element on index - - Length (me : mutable) returns Integer; - ---Purpose: Returns length of sequence - - - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myValue : HSequenceOfReal from TColStd; - -end SequenceOfRealAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx deleted file mode 100644 index c3c4bcf21..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfRealAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfRealAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute() -{myValue = new TColStd_HSequenceOfReal();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfRealAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfReal(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length() -{ - return myValue->Length(); -} - -Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx deleted file mode 100644 index b296f628e..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx +++ /dev/null @@ -1,137 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#define _SALOMEDS_SequenceOfRealAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfReal; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfRealAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfRealAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfRealAttribute(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ; -Standard_EXPORT void Add(const Standard_Real Value) ; -Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SequenceOfRealAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfReal myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx deleted file mode 100644 index 28af33323..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfRealAttribute::~SALOMEDS_SequenceOfRealAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfRealAttribute", - sizeof(SALOMEDS_SequenceOfRealAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfRealAttribute) Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfRealAttribute)((Handle(SALOMEDS_SequenceOfRealAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfRealAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfRealAttribute::~Handle_SALOMEDS_SequenceOfRealAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx deleted file mode 100644 index 07670a1d7..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include "SALOMEDS_SequenceOfRealAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 397f39772..b2d2dd913 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -56,11 +56,9 @@ int main(int argc, char** argv) { // Initialise the ORB. #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); - omniORB::MaxMessageSize(100 * 1024 * 1024); + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" ); #endif // Obtain a reference to the root POA. long TIMESleep = 500000000; diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 207684032..0aa3a240d 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -49,10 +49,6 @@ #include "SALOMEDS_Driver_i.hxx" #include "SALOMEDS_Study_i.hxx" -#include -#include -#include - #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" @@ -67,7 +63,7 @@ using namespace std; -SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy) +SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy) { _isLocal = true; _local_impl = theStudy; @@ -105,7 +101,7 @@ std::string SALOMEDS_Study::GetPersistentReference() std::string aRef; if (_isLocal) { SALOMEDS::Locker lock; - aRef = _local_impl->GetPersistentReference().ToCString(); + aRef = _local_impl->GetPersistentReference(); } else aRef = _corba_impl->GetPersistentReference(); return aRef; @@ -116,7 +112,7 @@ std::string SALOMEDS_Study::GetTransientReference() std::string aRef; if (_isLocal) { SALOMEDS::Locker lock; - aRef = _local_impl->GetTransientReference().ToCString(); + aRef = _local_impl->GetTransientReference(); } else aRef = _corba_impl->GetTransientReference(); return aRef; @@ -139,9 +135,8 @@ _PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentNam if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - _local_impl->FindComponent((char*)aComponentName.c_str()); - if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponent(aComponentName); + if (!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -158,9 +153,8 @@ _PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - _local_impl->FindComponentID((char*)aComponentID.c_str()); - if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponentID(aComponentID); + if (!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -178,10 +172,12 @@ _PTR(SObject) SALOMEDS_Study::FindObject(const std::string& anObjectName) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObject((char*)anObjectName.c_str()); - if (aSO_impl.IsNull()) return _PTR(SObject)(aSO); - Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO_impl); - if (!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl)); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObject(anObjectName); + if (!aSO_impl) return _PTR(SObject)(aSO); + if(aSO_impl.IsComponent()) { + SALOMEDSImpl_SComponent aSCO_impl = aSO_impl; + return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl)); + } aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -204,12 +200,10 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindObjectByName(const std::string& a if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = - _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str()); - aLength = aSeq->Length(); - for (i = 1; i<= aLength; i++) - aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject - (Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i))))); + vector aSeq = _local_impl->FindObjectByName(anObjectName, aComponentName); + aLength = aSeq.size(); + for (i = 0; i< aLength; i++) + aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i]))); } else { SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(), @@ -227,8 +221,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectID(anObjectID); + if(!aSO_impl) return _PTR(SObject)(aSO); return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl)); } else { @@ -244,8 +238,8 @@ _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID) SALOMEDSClient_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->CreateObjectID((char*)anObjectID.c_str()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->CreateObjectID(anObjectID); + if(!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -262,8 +256,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str()); - if (aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectIOR(anObjectIOR); + if (!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -280,8 +274,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str()); - if (aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectByPath(thePath); + if (!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -299,7 +293,7 @@ std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO) std::string aPath; if (_isLocal) { SALOMEDS::Locker lock; - aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString(); + aPath = _local_impl->GetObjectPath(*(aSO->GetLocalImpl())); } else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl()); return aPath; @@ -309,7 +303,7 @@ void SALOMEDS_Study::SetContext(const std::string& thePath) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->SetContext((char*)thePath.c_str()); + _local_impl->SetContext(thePath); } else _corba_impl->SetContext((char*)thePath.c_str()); } @@ -319,7 +313,7 @@ std::string SALOMEDS_Study::GetContext() std::string aPath; if (_isLocal) { SALOMEDS::Locker lock; - aPath = _local_impl->GetContext().ToCString(); + aPath = _local_impl->GetContext(); } else aPath = _corba_impl->GetContext(); return aPath; @@ -331,10 +325,7 @@ std::vector SALOMEDS_Study::GetObjectNames(const std::string& theCo int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames((char*)theContext.c_str()); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetObjectNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str()); @@ -350,11 +341,7 @@ std::vector SALOMEDS_Study::GetDirectoryNames(const std::string& th int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _local_impl->GetDirectoryNames((char*)theContext.c_str()); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetDirectoryNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str()); @@ -370,10 +357,7 @@ std::vector SALOMEDS_Study::GetFileNames(const std::string& theCont int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames((char*)theContext.c_str()); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetFileNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str()); @@ -390,10 +374,7 @@ std::vector SALOMEDS_Study::GetComponentNames(const std::string& th int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames((char*)theContext.c_str()); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetComponentNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str()); @@ -409,8 +390,7 @@ _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO) SALOMEDSClient_ChildIterator* aCI = NULL; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl()); + SALOMEDSImpl_ChildIterator aCIimpl = _local_impl->NewChildIterator(*(aSO->GetLocalImpl())); aCI = new SALOMEDS_ChildIterator(aCIimpl); } else { @@ -444,7 +424,7 @@ _PTR(StudyBuilder) SALOMEDS_Study::NewBuilder() if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder(); + SALOMEDSImpl_StudyBuilder* aSBimpl = _local_impl->NewBuilder(); aSB = new SALOMEDS_StudyBuilder(aSBimpl); } else { @@ -460,7 +440,7 @@ std::string SALOMEDS_Study::Name() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->Name().ToCString(); + aName = _local_impl->Name(); } else aName = _corba_impl->Name(); return aName; @@ -470,7 +450,7 @@ void SALOMEDS_Study::Name(const std::string& theName) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Name((char*)theName.c_str()); + _local_impl->Name(theName); } else _corba_impl->Name((char*)theName.c_str()); } @@ -505,13 +485,23 @@ bool SALOMEDS_Study::IsModified() else isModified = _corba_impl->IsModified(); return isModified; } + +void SALOMEDS_Study::Modified() +{ + if (_isLocal) { + SALOMEDS::Locker lock; + _local_impl->Modify(); + } + else _corba_impl->Modified(); +} + std::string SALOMEDS_Study::URL() { std::string aURL; if (_isLocal) { SALOMEDS::Locker lock; - aURL = _local_impl->URL().ToCString(); + aURL = _local_impl->URL(); } else aURL = _corba_impl->URL(); return aURL; @@ -521,7 +511,7 @@ void SALOMEDS_Study::URL(const std::string& url) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->URL((char*)url.c_str()); + _local_impl->URL(url); } else _corba_impl->URL((char*)url.c_str()); } @@ -554,12 +544,11 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)& if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl()); - if (!aSeq.IsNull()) { - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) - aVector.push_back(_PTR(SObject)( - new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i))))); + vector aSeq = _local_impl->FindDependances(*(aSO->GetLocalImpl())); + if (aSeq.size()) { + aLength = aSeq.size(); + for (i = 0; i < aLength; i++) + aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i]))); } } else { @@ -586,7 +575,7 @@ std::string SALOMEDS_Study::GetLastModificationDate() std::string aDate; if (_isLocal) { SALOMEDS::Locker lock; - aDate = _local_impl->GetLastModificationDate().ToCString(); + aDate = _local_impl->GetLastModificationDate(); } else aDate = _corba_impl->GetLastModificationDate(); return aDate; @@ -598,10 +587,7 @@ std::vector SALOMEDS_Study::GetModificationsDate() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetModificationsDate(); } else { SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate(); @@ -617,7 +603,7 @@ _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder() if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder(); + SALOMEDSImpl_UseCaseBuilder* aUBimpl = _local_impl->GetUseCaseBuilder(); aUB = new SALOMEDS_UseCaseBuilder(aUBimpl); } else { @@ -655,7 +641,7 @@ void SALOMEDS_Study::SetStudyLock(const string& theLockerID) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->SetStudyLock((char*)theLockerID.c_str()); + _local_impl->SetStudyLock(theLockerID.c_str()); } else _corba_impl->SetStudyLock((char*)theLockerID.c_str()); } @@ -673,7 +659,7 @@ bool SALOMEDS_Study::IsStudyLocked() void SALOMEDS_Study::UnLockStudy(const string& theLockerID) { - if(_isLocal) _local_impl->UnLockStudy((char*)theLockerID.c_str()); + if(_isLocal) _local_impl->UnLockStudy(theLockerID.c_str()); else _corba_impl->UnLockStudy((char*)theLockerID.c_str()); } @@ -683,10 +669,7 @@ vector SALOMEDS_Study::GetLockerID() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetLockerID(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetLockerID(); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID(); @@ -719,7 +702,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() SALOMEDS::Locker lock; if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::Study::_duplicate(_corba_impl); - std::string anIOR = _local_impl->GetTransientReference().ToCString(); + std::string anIOR = _local_impl->GetTransientReference(); SALOMEDS::Study_var aStudy; if (!_local_impl->IsError() && anIOR != "") { aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str())); diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx index 8babf0b6e..e893ce684 100644 --- a/src/SALOMEDS/SALOMEDS_Study.hxx +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -39,13 +39,13 @@ class Standard_EXPORT SALOMEDS_Study: public SALOMEDSClient_Study private: bool _isLocal; - Handle(SALOMEDSImpl_Study) _local_impl; + SALOMEDSImpl_Study* _local_impl; SALOMEDS::Study_var _corba_impl; CORBA::ORB_var _orb; public: - SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy); + SALOMEDS_Study(SALOMEDSImpl_Study* theStudy); SALOMEDS_Study(SALOMEDS::Study_ptr theStudy); ~SALOMEDS_Study(); @@ -75,6 +75,7 @@ public: virtual bool IsSaved(); virtual void IsSaved(bool save); virtual bool IsModified(); + virtual void Modified(); virtual std::string URL(); virtual void URL(const std::string& url); virtual int StudyId(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index 2d5a3901c..4b6da1939 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -43,8 +43,7 @@ #include #include -#include -#include +#include "DF_Attribute.hxx" #include "Utils_CorbaException.hxx" #include "Utils_ORB_INIT.hxx" @@ -52,7 +51,7 @@ using namespace std; -SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder) +SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder) { _isLocal = true; _local_impl = theBuilder; @@ -82,8 +81,8 @@ _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& Componen CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->NewComponent((char*)ComponentDataType.c_str()); - if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl =_local_impl->NewComponent(ComponentDataType); + if(!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -105,8 +104,8 @@ void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& the CheckLocked(); SALOMEDS::Locker lock; - _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()), - (char*)ComponentIOR.c_str()); + _local_impl->DefineComponentInstance(*(dynamic_cast(aSCO->GetLocalImpl())), + ComponentIOR); } else { CORBA::Object_var obj = _orb->string_to_object(ComponentIOR.c_str()); @@ -122,7 +121,7 @@ void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + _local_impl->RemoveComponent(*(dynamic_cast(aSCO->GetLocalImpl()))); } else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); } @@ -137,8 +136,8 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObject(const _PTR(SObject)& theFatherObj if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObject(father->GetLocalImpl()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObject(*(father->GetLocalImpl())); + if(!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -160,7 +159,7 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFath if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObjectToTag(father->GetLocalImpl(), theTag); + SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObjectToTag(*(father->GetLocalImpl()), theTag); if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } @@ -181,7 +180,7 @@ void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath) _local_impl->AddDirectory((char*)thePath.c_str()); if (_local_impl->IsError()) { - std::string anErrorCode = _local_impl->GetErrorCode().ToCString(); + std::string anErrorCode = _local_impl->GetErrorCode(); if (anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); if (anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); if (anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); @@ -202,12 +201,11 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std:: SALOMEDS::Locker lock; SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb); - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()); + SALOMEDSImpl_SComponent aSCO_impl = *(dynamic_cast(aSCO->GetLocalImpl())); bool isDone = _local_impl->LoadWith(aSCO_impl, drv); delete drv; if(!isDone && _local_impl->IsError()) - THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM); } else { _corba_impl->LoadWith(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), aDriver); @@ -217,7 +215,7 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std:: void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO) { SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); - if (_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + if (_isLocal) _local_impl->Load(*(dynamic_cast(aSCO->GetLocalImpl()))); else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); } @@ -230,7 +228,7 @@ void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObject(aSO->GetLocalImpl()); + _local_impl->RemoveObject(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObject(aSO->GetCORBAImpl()); } @@ -244,7 +242,7 @@ void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl()); + _local_impl->RemoveObjectWithChildren(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl()); } @@ -258,10 +256,10 @@ _PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(S if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) aGA; + SALOMEDSImpl_GenericAttribute* aGA; try { - aGA = Handle(SALOMEDSImpl_GenericAttribute)::DownCast - (_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str())); + aGA = dynamic_cast + (_local_impl->FindOrCreateAttribute(*(aSO->GetLocalImpl()), aTypeOfAttribute)); } catch (...) { throw SALOMEDS::StudyBuilder::LockProtection(); @@ -289,9 +287,12 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) aGA; - ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, (char*)aTypeOfAttribute.c_str()); - if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA)); + DF_Attribute* anAttr = NULL; + ret = _local_impl->FindAttribute(*(aSO->GetLocalImpl()), anAttr, aTypeOfAttribute); + if(ret) { + SALOMEDSImpl_GenericAttribute* aGA = dynamic_cast(anAttr); + anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA)); + } } else { SALOMEDS::GenericAttribute_var aGA; @@ -311,14 +312,16 @@ void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const st CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str()); + _local_impl->RemoveAttribute(*(aSO->GetLocalImpl()), (char*)aTypeOfAttribute.c_str()); } else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str()); } void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject) { - if(!me || !thereferencedObject) return; + if(!me || !thereferencedObject) { + throw DFexception("Invalid arguments"); + } SALOMEDS_SObject* aSO = dynamic_cast(me.get()); SALOMEDS_SObject* aRefSO = dynamic_cast(thereferencedObject.get()); @@ -326,7 +329,7 @@ void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SOb CheckLocked(); SALOMEDS::Locker lock; - _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl()); + _local_impl->Addreference(*(aSO->GetLocalImpl()), *(aRefSO->GetLocalImpl())); } else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl()); } @@ -339,7 +342,7 @@ void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveReference(aSO->GetLocalImpl()); + _local_impl->RemoveReference(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveReference(aSO->GetCORBAImpl()); } @@ -347,28 +350,25 @@ void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { if(!theSO) return; - if(!Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) throw invalid_argument("Invalid GUID"); SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str()); + _local_impl->SetGUID(*(aSO->GetLocalImpl()), theGUID); } else _corba_impl->SetGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str()); } bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { - if(!theSO || !Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) return false; - SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str()); + ret = _local_impl->IsGUID(*(aSO->GetLocalImpl()), (char*)theGUID.c_str()); } else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str()); @@ -513,7 +513,7 @@ void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::strin CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetName(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetName(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } @@ -527,7 +527,7 @@ void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::st CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetComment(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetComment(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } @@ -541,7 +541,7 @@ void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetIOR(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx index 9ad50d1bf..a05408ae4 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -37,13 +37,13 @@ class SALOMEDS_EXPORT SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder { private: bool _isLocal; - Handle(SALOMEDSImpl_StudyBuilder) _local_impl; + SALOMEDSImpl_StudyBuilder* _local_impl; SALOMEDS::StudyBuilder_var _corba_impl; CORBA::ORB_var _orb; public: - SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder); + SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder); SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder); ~SALOMEDS_StudyBuilder(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 6306b9858..5c5e0046b 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -38,7 +38,8 @@ #include "Utils_CorbaException.hxx" #include "Utils_ExceptHandlers.hxx" -#include +#include +#include #include using namespace std; @@ -51,7 +52,7 @@ UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection); * Purpose : */ //============================================================================ -SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder) theImpl, +SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -76,7 +77,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_StudyBuilder_i::NewComponent(const char* DataT SALOMEDS::Locker lock; CheckLocked(); //char* aDataType = CORBA::string_dup(DataType); - Handle(SALOMEDSImpl_SComponent) aSCO = _impl->NewComponent(TCollection_AsciiString((char*)DataType)); + SALOMEDSImpl_SComponent aSCO = _impl->NewComponent(string(DataType)); //CORBA::free_string(aDataType); if(aSCO.IsNull()) return SALOMEDS::SComponent::_nil(); @@ -94,8 +95,7 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); CORBA::String_var iorstr = _orb->object_to_string(IOR); _impl->DefineComponentInstance(aSCO, (char*)iorstr.in()); @@ -111,8 +111,7 @@ void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponen SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(aComponent)); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); _impl->RemoveComponent(aSCO); } @@ -126,8 +125,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr t SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aFO, aSO; - aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + SALOMEDSImpl_SObject aFO, aSO; + aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); aSO = _impl->NewObject(aFO); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb); @@ -145,8 +144,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aFO, aSO; - aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + SALOMEDSImpl_SObject aFO, aSO; + aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); aSO = _impl->NewObjectToTag(aFO, atag); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -162,8 +161,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); _impl->RemoveObject(aSO); } @@ -176,8 +174,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); _impl->RemoveObjectWithChildren(aSO); } @@ -192,14 +189,13 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, SALOMEDS::Locker lock; Unexpect aCatch(SBSalomeException); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)anSCO->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID()); SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb); - bool isDone = _impl->LoadWith(aSCO, driver); + bool isDone = _impl->LoadWith(aSCO, driver); delete driver; if(!isDone && _impl->IsError()) { - THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM); } } @@ -224,26 +220,27 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA const char* aTypeOfAttribute) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO; CORBA::String_var anID = anObject->GetID(); - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject(anID.inout()); - Handle(TDF_Attribute) anAttr; + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.inout()); + DF_Attribute* anAttr; try { - anAttr = _impl->FindOrCreateAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute)); + anAttr = _impl->FindOrCreateAttribute(aSO, string(aTypeOfAttribute)); } catch (...) { throw SALOMEDS::StudyBuilder::LockProtection(); } SALOMEDS::GenericAttribute_var anAttribute; - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + + if(anAttr) + anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); return anAttribute._retn(); } //============================================================================ /*! Function : FindAttribute - * Purpose : Find attribute of given type assigned SObject, returns Standard_True if it is found + * Purpose : Find attribute of given type assigned SObject, returns true if it is found */ //============================================================================ @@ -253,11 +250,10 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); - Handle(TDF_Attribute) anAttr; + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + DF_Attribute* anAttr; - if(!_impl->FindAttribute(aSO, anAttr, TCollection_AsciiString((char*)aTypeOfAttribute))) return false; + if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false; anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); return true; @@ -275,9 +271,8 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); - _impl->RemoveAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + _impl->RemoveAttribute(aSO, string(aTypeOfAttribute)); } //============================================================================ @@ -293,9 +288,9 @@ void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, ASSERT(!CORBA::is_nil(me)); ASSERT(!CORBA::is_nil(theReferencedObject)); - Handle(SALOMEDSImpl_SObject) aSO, aRefSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID()); - aRefSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theReferencedObject->GetID()); + SALOMEDSImpl_SObject aSO, aRefSO; + aSO = _impl->GetOwner()->GetSObject(me->GetID()); + aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID()); _impl->Addreference(aSO, aRefSO); } @@ -309,8 +304,7 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me) SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(me)); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID()); _impl->RemoveReference(aSO); } @@ -325,8 +319,8 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath) SALOMEDS::Locker lock; CheckLocked(); if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory(); - if(!_impl->AddDirectory(TCollection_AsciiString((char*)thePath))) { - TCollection_AsciiString anErrorCode = _impl->GetErrorCode(); + if(!_impl->AddDirectory(string(thePath))) { + string anErrorCode = _impl->GetErrorCode(); if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); @@ -344,9 +338,8 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); - _impl->SetGUID(aSO, TCollection_AsciiString((char*)theGUID)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + _impl->SetGUID(aSO, string(theGUID)); } //============================================================================ @@ -358,9 +351,8 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); - return _impl->IsGUID(aSO, TCollection_AsciiString((char*)theGUID)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + return _impl->IsGUID(aSO, string(theGUID)); } @@ -525,9 +517,8 @@ void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* t Unexpect aCatch(SBLockProtection); CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); - _impl->SetName(aSO, TCollection_AsciiString((char*)theValue)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetName(aSO, string(theValue)); } //============================================================================ @@ -542,9 +533,8 @@ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char Unexpect aCatch(SBLockProtection); CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); - _impl->SetComment(aSO, TCollection_AsciiString((char*)theValue)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetComment(aSO, string(theValue)); } //============================================================================ @@ -559,7 +549,6 @@ void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* th Unexpect aCatch(SBLockProtection); CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); - _impl->SetIOR(aSO, TCollection_AsciiString((char*)theValue)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetIOR(aSO, string(theValue)); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 40d5fd18d..6d1db089d 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -34,17 +34,14 @@ #include "SALOMEDSImpl_StudyBuilder.hxx" -// Cascade header -#include - class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_StudyBuilder) _impl; // OCAF Document + SALOMEDSImpl_StudyBuilder* _impl; public: - SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder), CORBA::ORB_ptr); + SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder*, CORBA::ORB_ptr); ~SALOMEDS_StudyBuilder_i(); @@ -130,7 +127,7 @@ public: virtual void SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); virtual void SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); - Handle(SALOMEDSImpl_StudyBuilder) GetImpl() { return _impl; } + SALOMEDSImpl_StudyBuilder* GetImpl() { return _impl; } }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index 335123165..1dae939cc 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -42,15 +42,11 @@ #include #endif -#include -#include -#include - #include "OpUtil.hxx" using namespace std; -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb); +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb); SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager) { @@ -172,10 +168,10 @@ std::vector SALOMEDS_StudyManager::GetOpenStudies() if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetOpenStudies(); - aLength = aSeq->Length(); - for(i = 1; i <= aLength; i++) - aVector.push_back(Handle(SALOMEDSImpl_Study)::DownCast(aSeq->Value(i))->Name().ToCString()); + vector aSeq = _local_impl->GetOpenStudies(); + aLength = aSeq.size(); + for(i = 0; i < aLength; i++) + aVector.push_back(aSeq[i]->Name()); } else { SALOMEDS::ListOfOpenStudies_var aSeq = _corba_impl->GetOpenStudies(); @@ -192,8 +188,8 @@ _PTR(Study) SALOMEDS_StudyManager::GetStudyByName(const std::string& theStudyNam if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByName((char*)theStudyName.c_str()); - if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy); + SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByName(theStudyName); + if(!aStudy_impl) return _PTR(Study)(aStudy); aStudy = new SALOMEDS_Study(aStudy_impl); } else { @@ -210,8 +206,8 @@ _PTR(Study) SALOMEDS_StudyManager::GetStudyByID(int theStudyID) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByID(theStudyID); - if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy); + SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByID(theStudyID); + if(!aStudy_impl) return _PTR(Study)(aStudy); aStudy = new SALOMEDS_Study(aStudy_impl); } else { @@ -230,7 +226,7 @@ bool SALOMEDS_StudyManager::CanCopy(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->CanCopy(aSO_impl, aDriver); delete aDriver; @@ -249,7 +245,7 @@ bool SALOMEDS_StudyManager::Copy(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->Copy(aSO_impl, aDriver); delete aDriver; @@ -268,7 +264,7 @@ bool SALOMEDS_StudyManager::CanPaste(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->CanPaste(aSO_impl, aDriver); delete aDriver; @@ -288,9 +284,9 @@ _PTR(SObject) SALOMEDS_StudyManager::Paste(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); - Handle(SALOMEDSImpl_SObject) aNewSO = _local_impl->Paste(aSO_impl, aDriver); + SALOMEDSImpl_SObject aNewSO = _local_impl->Paste(aSO_impl, aDriver); delete aDriver; if(aNewSO.IsNull()) return _PTR(SObject)(aResult); aResult = new SALOMEDS_SObject(aNewSO); @@ -312,15 +308,15 @@ void SALOMEDS_StudyManager::init_orb() _orb = init(0 , 0 ); } -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb) { SALOMEDS_Driver_i* driver = NULL; - Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); + SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent(); if(!aSCO.IsNull()) { - TCollection_AsciiString IOREngine = aSCO->GetIOR(); - if(!IOREngine.IsEmpty()) { - CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString()); + string IOREngine = aSCO.GetIOR(); + if(!IOREngine.empty()) { + CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.hxx b/src/SALOMEDS/SALOMEDS_StudyManager.hxx index c270ba1a4..96601d3dd 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.hxx @@ -39,7 +39,7 @@ class Standard_EXPORT SALOMEDS_StudyManager: public SALOMEDSClient_StudyManager { private: bool _isLocal; - Handle(SALOMEDSImpl_StudyManager) _local_impl; + SALOMEDSImpl_StudyManager* _local_impl; SALOMEDS::StudyManager_var _corba_impl; CORBA::ORB_var _orb; diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 4d612ccfd..f06c882ba 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -34,13 +34,10 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" -#include -#include -#include - #include "Utils_CorbaException.hxx" #include +#include #include using namespace std; @@ -60,7 +57,7 @@ using namespace std; UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception); UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection); -static SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb); +static SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb); static std::map _mapOfPOA; @@ -91,6 +88,7 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() // Destroy directory to register open studies _name_service->Destroy_Directory("/Study"); delete _factory; + delete _impl; } //============================================================================ @@ -115,8 +113,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->NewStudy(TCollection_AsciiString((char*)study_name)); - if(aStudyImpl.IsNull()) { + SALOMEDSImpl_Study* aStudyImpl = _impl->NewStudy(study_name); + if(!aStudyImpl) { MESSAGE("NewStudy : Error : " << _impl->GetErrorCode()); return SALOMEDS::Study::_nil(); } @@ -156,7 +154,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) Unexpect aCatch(SalomeException); MESSAGE("Begin of SALOMEDS_StudyManager_i::Open"); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->Open(TCollection_AsciiString((char*)aUrl)); + SALOMEDSImpl_Study* aStudyImpl = _impl->Open(string(aUrl)); MESSAGE("Open : Creating the CORBA servant holding it... "); @@ -171,7 +169,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // Register study in the naming service // Path to acces the study if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" ) - else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().ToCString())); + else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str())); return Study; } @@ -216,7 +214,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA:: return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); return _impl->Save(aStudyImpl, _factory, theMultiFile); } @@ -229,7 +227,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CO return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); return _impl->SaveASCII(aStudyImpl, _factory, theMultiFile); } @@ -247,8 +245,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - return _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + return _impl->SaveAs(string(aUrl), aStudyImpl, _factory, theMultiFile); } CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) @@ -260,8 +258,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS:: return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - return _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + return _impl->SaveAsASCII(string(aUrl), aStudyImpl, _factory, theMultiFile); } //============================================================================ @@ -273,8 +271,8 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies(); - int aLength = anOpened->Length(); + vector anOpened = _impl->GetOpenStudies(); + int aLength = anOpened.size(); SALOMEDS::ListOfOpenStudies_var _list_open_studies = new SALOMEDS::ListOfOpenStudies; _list_open_studies->length(aLength); @@ -285,11 +283,10 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() } else { - for (unsigned int ind=1; ind <= aLength; ind++) + for (unsigned int ind=0; ind < aLength; ind++) { - Handle(SALOMEDSImpl_Study) aStudy = Handle(SALOMEDSImpl_Study)::DownCast(anOpened->Value(ind)); - _list_open_studies[ind-1] = CORBA::string_dup(aStudy->Name().ToCString()); - SCRUTE(_list_open_studies[ind-1]) ; + _list_open_studies[ind] = CORBA::string_dup(anOpened[ind]->Name().c_str()); + SCRUTE(_list_open_studies[ind]) ; } } return _list_open_studies._retn(); @@ -304,12 +301,11 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyNa { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudyImpl = - _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName)); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByName(string(aStudyName)); - if (aStudyImpl.IsNull()) + if (!aStudyImpl) { - MESSAGE(_impl->GetErrorCode().ToCString()); + MESSAGE(_impl->GetErrorCode().c_str()); return SALOMEDS::Study::_nil(); } @@ -328,11 +324,11 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudyID); - if (aStudyImpl.IsNull()) + if (!aStudyImpl) { - MESSAGE(_impl->GetErrorCode().ToCString()); + MESSAGE(_impl->GetErrorCode().c_str()); return SALOMEDS::Study::_nil(); } @@ -354,8 +350,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Locker lock; SALOMEDS::Study_var aStudy = theObject->GetStudy(); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanCopy(anObject, aDriver); @@ -373,8 +369,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Locker lock; SALOMEDS::Study_var aStudy = theObject->GetStudy(); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->Copy(anObject, aDriver); @@ -392,8 +388,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject SALOMEDS::Locker lock; SALOMEDS::Study_var aStudy = theObject->GetStudy(); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanPaste(anObject, aDriver); @@ -414,9 +410,9 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb Unexpect aCatch(LockProtection); SALOMEDS::Study_var aStudy = theObject->GetStudy(); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); - Handle(SALOMEDSImpl_SObject) aNewSO; + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + SALOMEDSImpl_SObject aNewSO; try { SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); @@ -432,15 +428,15 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb } -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb) { SALOMEDS_Driver_i* driver = NULL; - Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); + SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent(); if(!aSCO.IsNull()) { - TCollection_AsciiString IOREngine = aSCO->GetIOR(); - if(!IOREngine.IsEmpty()) { - CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString()); + string IOREngine = aSCO.GetIOR(); + if(!IOREngine.empty()) { + CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } @@ -454,6 +450,20 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt return PortableServer::POA::_nil(); } +CORBA::Long SALOMEDS_StudyManager_i::getPID() +{ +#ifdef WIN32 + return (CORBA::Long)_getpid(); +#else + return (CORBA::Long)getpid(); +#endif +} + +void SALOMEDS_StudyManager_i::ShutdownWithExit() +{ + exit( EXIT_SUCCESS ); +} + //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== @@ -465,27 +475,12 @@ CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, C long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); - return ((CORBA::LongLong)aManager); + return ((CORBA::LongLong)(void*)_impl); } //=========================================================================== namespace SALOMEDS { -/* - CORBA::Object_var - GetObject(const TDF_Label& theLabel, CORBA::ORB_ptr theORB) - { - try { - Handle(SALOMEDS_IORAttribute) anAttr; - if(theLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)) - return theORB->string_to_object(TCollection_AsciiString(anAttr->Get()).ToCString()); - }catch(...){ - } - return CORBA::Object::_nil(); - } -*/ - PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA) { diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index 9ef1801bb..41118c5db 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -27,6 +27,10 @@ // std C++ headers #include +#ifndef WNT +#include +#endif + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -36,16 +40,11 @@ #include -//Standard not implemented -#include #include "SALOMEDS_Driver_i.hxx" #include "SALOMEDSImpl_StudyManager.hxx" namespace SALOMEDS{ - // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object - /* CORBA::Object_var GetObject(const TDF_Label&, CORBA::ORB_ptr); */ - // To convert CORBA::Object to PortableServer::ServantBase PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr); @@ -57,7 +56,7 @@ private: CORBA::ORB_ptr _orb; PortableServer::POA_var _poa; - Handle(SALOMEDSImpl_StudyManager) _impl; + SALOMEDSImpl_StudyManager* _impl; SALOME_NamingService* _name_service; SALOMEDS_DriverFactory_i* _factory; @@ -141,10 +140,14 @@ public: virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); }; void ping(){}; + CORBA::Long getPID(); + void ShutdownWithExit(); virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy); + + void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); } }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl deleted file mode 100644 index 84dbf1b27..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_StudyPropertiesAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class StudyPropertiesAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - DataSet from TDF, - RelocationTable from TDF, - Data from TDF, - ExtendedString from TCollection, - HSequenceOfExtendedString from TColStd, - HSequenceOfInteger from TColStd - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - returns StudyPropertiesAttribute from SALOMEDS; - - ---Purpose: Common methods - -- ============ - - Create - returns mutable StudyPropertiesAttribute from SALOMEDS; - - Init(me: mutable); - - SetUserName(me: mutable; theName : ExtendedString from TCollection); - GetCreatorName(me) returns ExtendedString from TCollection; - GetUserNames(me) returns HSequenceOfExtendedString from TColStd; - SetFirstName(me: mutable; theName : ExtendedString from TCollection); - - SetModificationDate(me: mutable; theMinute, theHour, theDay, theMonth, theYear : Integer from Standard); - GetCreationDate(me; theMinute, theHour, theDay, theMonth, theYear : out Integer from Standard) - returns Boolean from Standard; - GetModificationDates(me; theMinutes, theHours, theDays, theMonths, theYears : out HSequenceOfInteger from TColStd); - - SetCreationMode(me: mutable; theMode : Integer from Standard); - GetCreationMode(me) returns Integer from Standard; - - SetModified(me: mutable; theModified : Integer from Standard); - IsModified(me) returns Boolean from Standard; - GetModified(me) returns Integer from Standard; - - SetLocked(me: mutable; theLocked : Boolean from Standard); - IsLocked(me) returns Boolean from Standard; - IsLockChanged(me: mutable; theErase : Boolean from Standard) returns Boolean from Standard; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myUserName : HSequenceOfExtendedString from TColStd; - myMinute : HSequenceOfInteger from TColStd; - myHour : HSequenceOfInteger from TColStd; - myDay : HSequenceOfInteger from TColStd; - myMonth : HSequenceOfInteger from TColStd; - myYear : HSequenceOfInteger from TColStd; - myMode : Integer from Standard; - myModified : Integer from Standard; - myLocked : Boolean from Standard; - myLockChanged : Boolean from Standard; - -end StudyPropertiesAttribute; diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx deleted file mode 100644 index 44724c5f3..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx +++ /dev/null @@ -1,217 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -using namespace std; - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::GetID() -{ - static Standard_GUID SALOMEDS_StudyPropertiesAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_StudyPropertiesAttributeID; -} - -Handle(SALOMEDS_StudyPropertiesAttribute) SALOMEDS_StudyPropertiesAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_StudyPropertiesAttribute::SALOMEDS_StudyPropertiesAttribute() -{ - myLocked = Standard_False; - myLockChanged = Standard_False; - Init(); -} - -void SALOMEDS_StudyPropertiesAttribute::Init() -{ - myUserName = new TColStd_HSequenceOfExtendedString(); - myMinute = new TColStd_HSequenceOfInteger(); - myHour = new TColStd_HSequenceOfInteger(); - myDay = new TColStd_HSequenceOfInteger(); - myMonth = new TColStd_HSequenceOfInteger(); - myYear = new TColStd_HSequenceOfInteger(); -// myModified = 0; - myMode = 0; // none -} - -void SALOMEDS_StudyPropertiesAttribute::SetUserName(const TCollection_ExtendedString& theName) -{ - Backup(); - myUserName->Append(theName); -} - -void SALOMEDS_StudyPropertiesAttribute::SetFirstName(const TCollection_ExtendedString& theName) -{ - Backup(); - if (myUserName->Length() == 0) myUserName->Append(theName); - else myUserName->SetValue(1, theName); -} - -TCollection_ExtendedString SALOMEDS_StudyPropertiesAttribute::GetCreatorName() const -{ - if (myUserName->Length() == 0) return TCollection_ExtendedString(""); - return myUserName->Value(1); -} - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_StudyPropertiesAttribute::GetUserNames() const -{ - return myUserName; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModificationDate(const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) -{ - Backup(); - if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) - return; - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::GetCreationDate(Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const -{ - if (myMinute->Length() != 0) { - theMinute = myMinute->Value(1); - theHour = myHour->Value(1); - theDay = myDay->Value(1); - theMonth = myMonth->Value(1); - theYear = myYear->Value(1); - return Standard_True; - } - return Standard_False; -} - -void SALOMEDS_StudyPropertiesAttribute::GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const -{ - theMinutes = myMinute; - theHours = myHour; - theDays = myDay; - theMonths = myMonth; - theYears = myYear; -} - -void SALOMEDS_StudyPropertiesAttribute::SetCreationMode(const Standard_Integer theMode) -{ - Backup(); - myMode = theMode; -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetCreationMode() const -{ - return myMode; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModified(const Standard_Integer theModified) -{ - myModified = theModified; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsModified() const -{ - return (myModified != 0); -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetModified() const -{ - return myModified; -} - -void SALOMEDS_StudyPropertiesAttribute::SetLocked(const Standard_Boolean theLocked) -{ -// Backup(); - if (myLocked != theLocked) { - myLockChanged = Standard_True; - myLocked = theLocked; - } -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLocked() const -{ - return myLocked; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLockChanged(const Standard_Boolean theErase) { - if (!myLockChanged) return Standard_False; - if (theErase) myLockChanged = Standard_False; - return Standard_True; -} - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_StudyPropertiesAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(with); - Init(); - Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames = aProp->GetUserNames(); - for(i = aNames->Length(); i > 0; i--) { - myUserName->Prepend(aNames->Value(i)); - } - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - for(i = aMinutes->Length(); i > 0; i--) { - myMinute->Prepend(aMinutes->Value(i)); - myHour->Prepend(aHours->Value(i)); - myDay->Prepend(aDays->Value(i)); - myMonth->Prepend(aMonths->Value(i)); - myYear->Prepend(aYears->Value(i)); - } - myMode = aProp->GetCreationMode(); -// myModified = aProp->GetModified(); -// myLocked = aProp->IsLocked(); -} - -Handle(TDF_Attribute) SALOMEDS_StudyPropertiesAttribute::NewEmpty() const -{ - return new SALOMEDS_StudyPropertiesAttribute(); -} - -void SALOMEDS_StudyPropertiesAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(into); - aProp->Init(); - - Standard_Integer i; - for(i = 1; i <= myUserName->Length(); i++) { - aProp->SetUserName(myUserName->Value(i)); - } - for(i = 1; i <= myMinute->Length(); i++) { - aProp->SetModificationDate(myMinute->Value(i), myHour->Value(i), myDay->Value(i), myMonth->Value(i), myYear->Value(i)); - } - - aProp->SetCreationMode(myMode); -// aProp->SetModified(myModified); -// aProp->SetLocked(myLocked); -} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx deleted file mode 100644 index 276786515..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx +++ /dev/null @@ -1,148 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#define _SALOMEDS_StudyPropertiesAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_StudyPropertiesAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_StudyPropertiesAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_StudyPropertiesAttribute(); -Standard_EXPORT void Init() ; -Standard_EXPORT void SetUserName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT void SetFirstName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT TCollection_ExtendedString GetCreatorName() const; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetUserNames() const; -Standard_EXPORT void SetModificationDate(const Standard_Integer theMinute,const Standard_Integer theHour,const Standard_Integer theDay,const Standard_Integer theMonth,const Standard_Integer theYear) ; -Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,Standard_Integer& theHour,Standard_Integer& theDay,Standard_Integer& theMonth,Standard_Integer& theYear) const; -Standard_EXPORT void GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes,Handle(TColStd_HSequenceOfInteger)& theHours,Handle(TColStd_HSequenceOfInteger)& theDays,Handle(TColStd_HSequenceOfInteger)& theMonths,Handle(TColStd_HSequenceOfInteger)& theYears) const; -Standard_EXPORT void SetCreationMode(const Standard_Integer theMode) ; -Standard_EXPORT Standard_Integer GetCreationMode() const; -Standard_EXPORT void SetModified(const Standard_Integer theModified) ; -Standard_EXPORT Standard_Boolean IsModified() const; -Standard_EXPORT Standard_Integer GetModified() const; -Standard_EXPORT void SetLocked(const Standard_Boolean theLocked) ; -Standard_EXPORT Standard_Boolean IsLocked() const; -Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_StudyPropertiesAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfExtendedString myUserName; -Handle_TColStd_HSequenceOfInteger myMinute; -Handle_TColStd_HSequenceOfInteger myHour; -Handle_TColStd_HSequenceOfInteger myDay; -Handle_TColStd_HSequenceOfInteger myMonth; -Handle_TColStd_HSequenceOfInteger myYear; -Standard_Integer myMode; -Standard_Integer myModified; -Standard_Boolean myLocked; -Standard_Boolean myLockChanged; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx deleted file mode 100644 index 6fb0417b3..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_StudyPropertiesAttribute::~SALOMEDS_StudyPropertiesAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_StudyPropertiesAttribute", - sizeof(SALOMEDS_StudyPropertiesAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_StudyPropertiesAttribute) Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute))) { - _anOtherObject = Handle(SALOMEDS_StudyPropertiesAttribute)((Handle(SALOMEDS_StudyPropertiesAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_StudyPropertiesAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) ; -} -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_StudyPropertiesAttribute::~Handle_SALOMEDS_StudyPropertiesAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx deleted file mode 100644 index 419ea7b87..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 1bac30de6..137c34bd5 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -40,14 +40,8 @@ #include "SALOMEDSImpl_ChildIterator.hxx" #include "SALOMEDSImpl_IParameters.hxx" -#include -#include -#include -#include -#include - -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" #ifdef WIN32 #include @@ -65,7 +59,7 @@ using namespace std; * Purpose : SALOMEDS_Study_i constructor */ //============================================================================ -SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl, +SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDSImpl_Study* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -91,7 +85,7 @@ SALOMEDS_Study_i::~SALOMEDS_Study_i() char* SALOMEDS_Study_i::GetPersistentReference() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetPersistentReference().ToCString()); + return CORBA::string_dup(_impl->GetPersistentReference().c_str()); } //============================================================================ /*! Function : GetTransientReference @@ -101,7 +95,7 @@ char* SALOMEDS_Study_i::GetPersistentReference() char* SALOMEDS_Study_i::GetTransientReference() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetTransientReference().ToCString()); + return CORBA::string_dup(_impl->GetTransientReference().c_str()); } //============================================================================ @@ -124,7 +118,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponent (const char* aComponent { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName)); + SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponent(string(aComponentName)); if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb); @@ -140,7 +134,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponen { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID)); + SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponentID(string((char*)aComponentID)); if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb); @@ -156,11 +150,11 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* anObjectName) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName)); + SALOMEDSImpl_SObject aSO = _impl->FindObject(string((char*)anObjectName)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); - if(aSO->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_SComponent)) { - Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO); + if(aSO.IsComponent()) { + SALOMEDSImpl_SComponent aSCO = aSO; SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO, _orb); return sco._retn(); } @@ -179,7 +173,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectID(string((char*)anObjectID)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); @@ -196,7 +190,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) if(!anObjectID || strlen(anObjectID) == 0) return SALOMEDS::SObject::_nil(); - Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID); + SALOMEDSImpl_SObject aSO = _impl->CreateObjectID((char*)anObjectID); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -214,15 +208,14 @@ SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindObjectByName( const char* { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName), - TCollection_AsciiString((char*)aComponentName)); - int aLength = aSeq->Length(); + vector aSeq = _impl->FindObjectByName(string((char*)anObjectName), + string((char*)aComponentName)); + int aLength = aSeq.size(); SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ; listSO->length(aLength); - for(int i = 1; i<=aLength; i++) { - Handle(SALOMEDSImpl_SObject) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)); - SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); - listSO[i-1] = so ; + for(int i = 0; iFindObjectIOR(TCollection_AsciiString((char*)anObjectIOR)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectIOR(string((char*)anObjectIOR)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -252,7 +245,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectByPath(string((char*)thePath)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -268,9 +261,9 @@ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject) { SALOMEDS::Locker lock; - TCollection_AsciiString aPath(""); - if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.ToCString()); - Handle(SALOMEDSImpl_SObject) aSO; + string aPath(""); + if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.c_str()); + SALOMEDSImpl_SObject aSO; SALOMEDS::SObject_var aSObj = SALOMEDS::SObject::_narrow(theObject); if(!CORBA::is_nil(aSObj)) { @@ -280,10 +273,10 @@ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject) aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject)); } - if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString()); + if(aSO.IsNull()) return CORBA::string_dup(aPath.c_str()); aPath = _impl->GetObjectPath(aSO); - return CORBA::string_dup(aPath.ToCString()); + return CORBA::string_dup(aPath.c_str()); } @@ -296,7 +289,7 @@ void SALOMEDS_Study_i::SetContext(const char* thePath) { SALOMEDS::Locker lock; - _impl->SetContext(TCollection_AsciiString((char*)thePath)); + _impl->SetContext(string((char*)thePath)); if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); } @@ -309,9 +302,9 @@ void SALOMEDS_Study_i::SetContext(const char* thePath) char* SALOMEDS_Study_i::GetContext() { SALOMEDS::Locker lock; - + if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - return CORBA::string_dup(_impl->GetContext().ToCString()); + return CORBA::string_dup(_impl->GetContext().c_str()); } //============================================================================ @@ -328,15 +321,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetObjectNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetObjectNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -356,15 +348,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theCont if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetDirectoryNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -384,15 +375,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetFileNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetFileNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -410,13 +400,12 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetComponentNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetComponentNames(string((char*)theContext)); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for(int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -431,8 +420,8 @@ SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID()); - Handle(SALOMEDSImpl_ChildIterator) anItr = new SALOMEDSImpl_ChildIterator(aSO); + SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID()); + SALOMEDSImpl_ChildIterator anItr(aSO); //Create iterator SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb); @@ -475,7 +464,7 @@ SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder() char* SALOMEDS_Study_i::Name() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->Name().ToCString()); + return CORBA::string_dup(_impl->Name().c_str()); } //============================================================================ @@ -486,7 +475,7 @@ char* SALOMEDS_Study_i::Name() void SALOMEDS_Study_i::Name(const char* name) { SALOMEDS::Locker lock; - _impl->Name(TCollection_AsciiString((char*)name)); + _impl->Name(string((char*)name)); } //============================================================================ @@ -522,6 +511,18 @@ CORBA::Boolean SALOMEDS_Study_i::IsModified() return _impl->IsModified(); } +//============================================================================ +/*! Function : Modified + * Purpose : Sets a Modified flag of a Study to True + */ +//============================================================================ +void SALOMEDS_Study_i::Modified() +{ + SALOMEDS::Locker lock; + return _impl->Modify(); +} + + //============================================================================ /*! Function : URL * Purpose : get URL of the study (persistent reference of the study) @@ -530,7 +531,7 @@ CORBA::Boolean SALOMEDS_Study_i::IsModified() char* SALOMEDS_Study_i::URL() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->URL().ToCString()); + return CORBA::string_dup(_impl->URL().c_str()); } //============================================================================ @@ -541,7 +542,7 @@ char* SALOMEDS_Study_i::URL() void SALOMEDS_Study_i::URL(const char* url) { SALOMEDS::Locker lock; - _impl->URL(TCollection_AsciiString((char*)url)); + _impl->URL(string((char*)url)); } @@ -560,16 +561,16 @@ void SALOMEDS_Study_i::StudyId(CORBA::Short id) void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry) { SALOMEDS::Locker lock; - _impl->UpdateIORLabelMap(TCollection_AsciiString((char*)anIOR), TCollection_AsciiString((char*)anEntry)); + _impl->UpdateIORLabelMap(string((char*)anIOR), string((char*)anEntry)); } -SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb) +SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeIOR) Att; - if (theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)){ - char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Value()).ToCString()); + SALOMEDSImpl_AttributeIOR* Att = NULL; + if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){ + char* IOR = CORBA::string_dup(Att->Value().c_str()); CORBA::Object_var obj = orb->string_to_object(IOR); SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ; ASSERT(!CORBA::is_nil(aStudy)); @@ -580,7 +581,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA:: return SALOMEDS::Study::_nil(); } -void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute) +void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute) { SALOMEDS::Locker lock; SALOMEDSImpl_Study::IORUpdated(theAttribute); @@ -604,7 +605,7 @@ SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* anAttr = _impl->GetProperties(); SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb); return SP->AttributeStudyProperties::_this(); } @@ -612,20 +613,20 @@ SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() char* SALOMEDS_Study_i::GetLastModificationDate() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetLastModificationDate().ToCString()); + return CORBA::string_dup(_impl->GetLastModificationDate().c_str()); } SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate(); - int aLength = aSeq->Length(); + vector aSeq = _impl->GetModificationsDate(); + int aLength = aSeq.size(); SALOMEDS::ListOfDates_var aDates = new SALOMEDS::ListOfDates; aDates->length(aLength); - for(int anIndex = 1; anIndex <= aLength; anIndex++) { - aDates[anIndex-1] = CORBA::string_dup(aSeq->Value(anIndex).ToCString()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aDates[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aDates._retn(); } @@ -653,14 +654,12 @@ SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder() void SALOMEDS_Study_i::Close() { SALOMEDS::Locker lock; - + RemovePostponed(-1); SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator(); - for (; itcomponent->More(); itcomponent->Next()) { SALOMEDS::SComponent_var sco = itcomponent->Value(); - MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType()); // if there is an associated Engine call its method for closing CORBA::String_var IOREngine; @@ -679,6 +678,7 @@ void SALOMEDS_Study_i::Close() } } } + _impl->Close(); } @@ -690,23 +690,13 @@ void SALOMEDS_Study_i::Close() void SALOMEDS_Study_i::AddPostponed(const char* theIOR) { SALOMEDS::Locker lock; - - CORBA::Object_var obj = _orb->string_to_object(theIOR); - if (!CORBA::is_nil(obj)) { - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; - if (!CORBA::is_nil(aGeneric)) _impl->AddPostponed((char*)theIOR); - } + //Not implemented } void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) { SALOMEDS::Locker lock; - - CORBA::Object_var obj = _orb->string_to_object(theIOR); - if (!CORBA::is_nil(obj)) { - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; - if (!CORBA::is_nil(aGeneric)) _impl->AddCreatedPostponed((char*)theIOR); - } + //Not implemented } //============================================================================ @@ -715,37 +705,25 @@ void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) */ //============================================================================ #ifndef WNT -void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) +void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/) #else -void SALOMEDS_Study_i::RemovePostponed(CORBA::Long theUndoLimit) +void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/) #endif { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->RemovePostponed(theUndoLimit); - int aLegth = aSeq->Length(); - for(int i = 1; i <= aLegth; i++) { - TCollection_AsciiString anIOR = aSeq->Value(i); - //mkr : fix for bug IPAL9408 : check the length of anIOR - // before take value from it - if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'c') { - CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString()); - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); - if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); - } - else if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'd') { - CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString()); + vector anIORs = _impl->GetIORs(); + int i, aSize = (int)anIORs.size(); + + for(i = 0; i < aSize; i++) { + try { + CORBA::Object_var obj = _orb->string_to_object(anIORs[i].c_str()); SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); - } - else { - try { - CORBA::Object_var obj = _orb->string_to_object(anIOR.ToCString()); - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); - if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); - } catch (...) {} - } + } catch (...) {} } + + //Not implemented } //============================================================================ @@ -760,8 +738,7 @@ void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay) #endif { SALOMEDS::Locker lock; - - _impl->UndoPostponed(theWay); + //Not implemented } @@ -776,7 +753,7 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, { SALOMEDS::Locker lock; - TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName); + string aPath((char*)thePath), aBaseName((char*)theBaseName); SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb); CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory); delete factory; @@ -792,7 +769,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const cha { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetCommonParameters(theID, theSavePoint); + SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetCommonParameters(theID, theSavePoint); SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); return SP->AttributeParameter::_this(); } @@ -808,7 +785,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const cha { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint); + SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint); SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); return SP->AttributeParameter::_this(); } @@ -857,12 +834,12 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID() SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetLockerID(); + vector aSeq = _impl->GetLockerID(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for(int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); } @@ -888,8 +865,8 @@ char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); - Handle(SALOMEDSImpl_StudyBuilder) builder = _builder->GetImpl(); - if(!builder.IsNull()) { + SALOMEDSImpl_StudyBuilder* builder = _builder->GetImpl(); + if(builder) { if(isEnabled) { builder->SetOnAddSObject(_impl->GetCallback()); builder->SetOnRemoveSObject(_impl->GetCallback()); @@ -912,6 +889,5 @@ CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::L long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_Study* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index 137eca872..efb31e66e 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -47,13 +47,13 @@ class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_Study) _impl; + SALOMEDSImpl_Study* _impl; SALOMEDS_StudyBuilder_i* _builder; public: //! standard constructor - SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr); + SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr); //! standard destructor virtual ~SALOMEDS_Study_i(); @@ -223,6 +223,9 @@ public: */ virtual CORBA::Boolean IsModified(); + //! method to set Modified flag of a Study to True + virtual void Modified(); + //! method to get URL of the study (idem GetPersistentReference) /*! \return char* arguments, the study URL @@ -238,9 +241,9 @@ public: virtual CORBA::Short StudyId(); virtual void StudyId(CORBA::Short id); - static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb); + static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb); - static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute); + static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute); virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel); @@ -295,7 +298,7 @@ public: virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); - virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } + virtual SALOMEDSImpl_Study* GetImpl() { return _impl; } virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx index b3d5c5028..a2c96cef1 100644 --- a/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx +++ b/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx @@ -25,15 +25,8 @@ #include "SALOMEDS_TMPFile_i.hxx" -#include -#include - #include - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ) - SALOMEDS_TMPFile_i ::SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream): myStream(theStream) @@ -64,9 +57,6 @@ SALOMEDS_TMPFile_i //----------------------------------------------------------------------------- -IMPLEMENT_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ) -IMPLEMENT_STANDARD_RTTIEXT( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ) - Engines_TMPFile_i ::Engines_TMPFile_i(Engines::TMPFile* theStream): myStream(theStream) diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx index 1885341b6..0b5c96e34 100644 --- a/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx +++ b/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx @@ -30,7 +30,6 @@ //----------------------------------------------------------------------------- -DEFINE_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ); class SALOMEDS_TMPFile_i : public SALOMEDSImpl_TMPFile { @@ -41,15 +40,12 @@ public: virtual TOctet& Get(size_t); - DEFINE_STANDARD_RTTI( SALOMEDS_TMPFile_i ); - protected: SALOMEDS::TMPFile_var myStream; }; //----------------------------------------------------------------------------- -DEFINE_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ); class Engines_TMPFile_i : public SALOMEDSImpl_TMPFile { @@ -60,8 +56,6 @@ public: virtual TOctet& Get(size_t); - DEFINE_STANDARD_RTTI( Engines_TMPFile_i ); - protected: Engines::TMPFile_var myStream; }; diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx deleted file mode 100644 index ec7dd3292..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx +++ /dev/null @@ -1,399 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include -#include -#include - -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfIntegerAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfIntegerAttributeID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfIntegerAttributeID; -} - -Handle(SALOMEDS_TableOfIntegerAttribute) SALOMEDS_TableOfIntegerAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfIntegerAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfIntegerAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfIntegerAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfIntegerAttribute::SALOMEDS_TableOfIntegerAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfIntegerAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - Backup(); - - TColStd_DataMapOfIntegerInteger aMap; - aMap = myTable; - myTable.Clear(); - - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); - if(aCol == 0) { aCol = myNbColumns; aRow--; } - if(aCol > theNbColumns) continue; - int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); - } - - myNbColumns = theNbColumns; - - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); - } -} - -void SALOMEDS_TableOfIntegerAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfIntegerAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfInteger)& theData) -{ - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); - - Backup(); - - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); - } - - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); - } - - if(theRow > myNbRows) myNbRows = theRow; -} - -Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::GetRowData(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); - else - aSeq->Append(0); - } - - return aSeq; -} - -void SALOMEDS_TableOfIntegerAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfIntegerAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfInteger)& theData) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Backup(); - - Standard_Integer i, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); - } - - if(aLength > myNbRows) { - myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - } -} - - -Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::GetColumnData(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); - else - aSeq->Append(0); - } - - return aSeq; -} - -void SALOMEDS_TableOfIntegerAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfIntegerAttribute::PutValue(const Standard_Integer theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); - - if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - myNbRows = theRow; - } -} - -Standard_Boolean SALOMEDS_TableOfIntegerAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); - - Standard_Failure::Raise("Invalid cell index"); - return 0; -} - -const Standard_GUID& SALOMEDS_TableOfIntegerAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(with); - - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); - - myTable = aTable->myTable; - myNbRows = aTable->myNbRows; - myNbColumns = aTable->myNbColumns; - myTitle = aTable->myTitle; - - for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); - - for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); -} - -Handle(TDF_Attribute) SALOMEDS_TableOfIntegerAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfIntegerAttribute(); -} - -void SALOMEDS_TableOfIntegerAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(into); - - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); - - aTable->myTable = myTable; - aTable->myTitle = myTitle; - aTable->myNbRows = myNbRows; - aTable->myNbColumns = myNbColumns; - - for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); - for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); -} - - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfIntegerAttribute::GetSetRowIndices(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, aShift = myNbColumns*(theRow-1); - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); - } - - return aSeq; -} - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfIntegerAttribute::GetSetColumnIndices(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); - } - - return aSeq; -} - - -void SALOMEDS_TableOfIntegerAttribute::ConvertToString(ostrstream& theStream) -{ - int i, j, l; - - theStream.precision(64); - - //Title - l = myTitle.Length(); - theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; - - //Nb rows - theStream << myNbRows << "\n"; - - //Rows titles - for(i=1; i<=myNbRows; i++) { - l = myRows->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myRows->Value(i).Value(j) << "\n"; - } - - //Nb columns - theStream << myNbColumns << "\n"; - - //Columns titles - for(i=1; i<=myNbColumns; i++) { - l = myCols->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myCols->Value(i).Value(j) << "\n"; - } - - //Store the table values - l = myTable.Extent(); - theStream << l << "\n"; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(myTable); - for(; anIterator.More(); anIterator.Next()) { - theStream << anIterator.Key() << "\n"; - theStream << anIterator.Value() << "\n"; - } - - return; -} - -bool SALOMEDS_TableOfIntegerAttribute::RestoreFromString(istrstream& theStream) -{ - Backup(); - - int i, j, l; - - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; - - //Title - theStream >> l; - - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { - theStream >> anExtChar; - myTitle.SetValue(i, anExtChar); - } - - //Nb rows - theStream >> myNbRows; - - //Rows titles - myRows->Clear(); - for(i=1; i<=myNbRows; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myRows->Append(aStr); - } - - //Nb columns - theStream >> myNbColumns; - - //Columns titles - myCols->Clear(); - for(i=1; i<=myNbColumns; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myCols->Append(aStr); - } - - //Restore the table values - theStream >> l; - myTable.Clear(); - for(i=1; i<=l; i++) { - int aKey, aValue; - theStream >> aKey; - theStream >> aValue; - myTable.Bind(aKey, aValue); - } - - return true; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx deleted file mode 100644 index 6d888b3d9..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx +++ /dev/null @@ -1,163 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile -#define _SALOMEDS_TableOfIntegerAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfInteger; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfIntegerAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfIntegerAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfIntegerAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfIntegerAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TColStd_DataMapOfIntegerInteger myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx deleted file mode 100644 index 79a6c9823..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfIntegerAttribute::~SALOMEDS_TableOfIntegerAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfIntegerAttribute", - sizeof(SALOMEDS_TableOfIntegerAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfIntegerAttribute) Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfIntegerAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfIntegerAttribute)((Handle(SALOMEDS_TableOfIntegerAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfIntegerAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfIntegerAttribute::~Handle_SALOMEDS_TableOfIntegerAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx deleted file mode 100644 index 9636d150f..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx deleted file mode 100644 index d0096d9c8..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx +++ /dev/null @@ -1,405 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include -#include -#include - -#include -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfRealAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfRealAttributeID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfRealAttributeID; -} - -Handle(SALOMEDS_TableOfRealAttribute) SALOMEDS_TableOfRealAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfRealAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfRealAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfRealAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfRealAttribute::SALOMEDS_TableOfRealAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfRealAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - Backup(); - - TColStd_DataMapOfIntegerReal aMap; - aMap = myTable; - myTable.Clear(); - - TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); - if(aCol == 0) { aCol = myNbColumns; aRow--; } - if(aCol > theNbColumns) continue; - int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); - } - - myNbColumns = theNbColumns; - - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); - } -} - -void SALOMEDS_TableOfRealAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfRealAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfReal)& theData) -{ - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); - - Backup(); - - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); - } - - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); - } - - if(theRow > myNbRows) myNbRows = theRow; -} - -Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::GetRowData(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); - else - aSeq->Append(0.); - } - - return aSeq; -} - -void SALOMEDS_TableOfRealAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfRealAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfReal)& theData) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Backup(); - - Standard_Integer i, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); - } - - if(aLength > myNbRows) { - myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - } -} - - -Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::GetColumnData(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); - else - aSeq->Append(0.); - } - - return aSeq; -} - -void SALOMEDS_TableOfRealAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfRealAttribute::PutValue(const Standard_Real theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); - - if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - myNbRows = theRow; - } -} - -Standard_Boolean SALOMEDS_TableOfRealAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -Standard_Real SALOMEDS_TableOfRealAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); - - Standard_Failure::Raise("Invalid cell index"); - return 0.; -} - -const Standard_GUID& SALOMEDS_TableOfRealAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(with); - - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); - - myTable = aTable->myTable; - myNbRows = aTable->myNbRows; - myNbColumns = aTable->myNbColumns; - myTitle = aTable->myTitle; - - for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); - - for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); -} - -Handle(TDF_Attribute) SALOMEDS_TableOfRealAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfRealAttribute(); -} - -void SALOMEDS_TableOfRealAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(into); - - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); - - aTable->myTable = myTable; - aTable->myTitle = myTitle; - aTable->myNbRows = myNbRows; - aTable->myNbColumns = myNbColumns; - - for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); - for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); -} - - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfRealAttribute::GetSetRowIndices(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, aShift = myNbColumns*(theRow-1); - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); - } - - return aSeq; -} - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfRealAttribute::GetSetColumnIndices(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); - } - - return aSeq; -} - - - -void SALOMEDS_TableOfRealAttribute::ConvertToString(ostrstream& theStream) -{ - int i, j, l; - - - //Title - l = myTitle.Length(); - theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; - - //Nb rows - theStream << myNbRows << "\n"; - - //Rows titles - for(i=1; i<=myNbRows; i++) { - l = myRows->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myRows->Value(i).Value(j) << "\n"; - } - - //Nb columns - theStream << myNbColumns << "\n"; - - //Columns titles - for(i=1; i<=myNbColumns; i++) { - l = myCols->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myCols->Value(i).Value(j) << "\n"; - } - - //Store the table values - l = myTable.Extent(); - theStream << l << "\n"; - char *aBuffer = new char[128]; - TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(myTable); - for(; anIterator.More(); anIterator.Next()) { - theStream << anIterator.Key() << "\n"; - sprintf(aBuffer, "%.64e", anIterator.Value()); - theStream << aBuffer << "\n"; - } - - delete []aBuffer; - - return; -} - -bool SALOMEDS_TableOfRealAttribute::RestoreFromString(istrstream& theStream) -{ - Backup(); - - int i, j, l; - - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; - - //Title - theStream >> l; - - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { - theStream >> anExtChar; - myTitle.SetValue(i, anExtChar); - } - - //Nb rows - theStream >> myNbRows; - - //Rows titles - myRows->Clear(); - for(i=1; i<=myNbRows; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myRows->Append(aStr); - } - - //Nb columns - theStream >> myNbColumns; - - //Columns titles - myCols->Clear(); - for(i=1; i<=myNbColumns; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myCols->Append(aStr); - } - - //Restore the table values - theStream >> l; - myTable.Clear(); - for(i=1; i<=l; i++) { - Standard_Integer aKey; - Standard_Real aValue; - theStream >> aKey; - theStream >> aValue; - myTable.Bind(aKey, aValue); - } - - return true; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx deleted file mode 100644 index cac9dd3b0..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx +++ /dev/null @@ -1,171 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile -#define _SALOMEDS_TableOfRealAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _TColStd_DataMapOfIntegerReal_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfReal; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfRealAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfRealAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfRealAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfRealAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TColStd_DataMapOfIntegerReal myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx deleted file mode 100644 index c8bfe73d0..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfRealAttribute::~SALOMEDS_TableOfRealAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfRealAttribute", - sizeof(SALOMEDS_TableOfRealAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfRealAttribute) Handle(SALOMEDS_TableOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfRealAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfRealAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfRealAttribute)((Handle(SALOMEDS_TableOfRealAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfRealAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfRealAttribute::~Handle_SALOMEDS_TableOfRealAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx deleted file mode 100644 index a2343b1ec..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx deleted file mode 100644 index fa4b21785..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx +++ /dev/null @@ -1,423 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include -#include -#include - -#include -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfStringAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfStringAttributeID; -} - -Handle(SALOMEDS_TableOfStringAttribute) SALOMEDS_TableOfStringAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfStringAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfStringAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfStringAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfStringAttribute::SALOMEDS_TableOfStringAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfStringAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - Backup(); - - SALOMEDS_DataMapOfIntegerString aMap; - aMap = myTable; - myTable.Clear(); - - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); - if(aCol == 0) { aCol = myNbColumns; aRow--; } - if(aCol > theNbColumns) continue; - int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); - } - - myNbColumns = theNbColumns; - - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); - } -} - -void SALOMEDS_TableOfStringAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfStringAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfExtendedString)& theData) -{ - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); - - Backup(); - - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); - } - - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); - } - - if(theRow > myNbRows) myNbRows = theRow; -} - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::GetRowData(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); - else - aSeq->Append(0.); - } - - return aSeq; -} - -void SALOMEDS_TableOfStringAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfStringAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfExtendedString)& theData) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Backup(); - - Standard_Integer i, aLength = theData->Length(); - for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); - } - - if(aLength > myNbRows) { - myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - } -} - - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::GetColumnData(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); - else - aSeq->Append(0.); - } - - return aSeq; -} - -void SALOMEDS_TableOfStringAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfStringAttribute::PutValue(const TCollection_ExtendedString& theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - if(theColumn > myNbColumns) SetNbColumns(theColumn); - - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); - - if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); - } - myNbRows = theRow; - } -} - -Standard_Boolean SALOMEDS_TableOfStringAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); - - Standard_Failure::Raise("Invalid cell index"); - return 0.; -} - -const Standard_GUID& SALOMEDS_TableOfStringAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfStringAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(with); - - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); - - myTable = aTable->myTable; - myNbRows = aTable->myNbRows; - myNbColumns = aTable->myNbColumns; - myTitle = aTable->myTitle; - - for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); - - for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); -} - -Handle(TDF_Attribute) SALOMEDS_TableOfStringAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfStringAttribute(); -} - -void SALOMEDS_TableOfStringAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(into); - - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); - - aTable->myTable = myTable; - aTable->myTitle = myTitle; - aTable->myNbRows = myNbRows; - aTable->myNbColumns = myNbColumns; - - for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); - for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); -} - - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfStringAttribute::GetSetRowIndices(const Standard_Integer theRow) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, aShift = myNbColumns*(theRow-1); - for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); - } - - return aSeq; -} - -Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfStringAttribute::GetSetColumnIndices(const Standard_Integer theColumn) -{ - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; - for(i = 1; i <= myNbRows; i++) { - anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); - } - - return aSeq; -} - - - -void SALOMEDS_TableOfStringAttribute::ConvertToString(ostrstream& theStream) -{ - int i, j, l; - - //Title - l = myTitle.Length(); - theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; - - //Nb rows - theStream << myNbRows << "\n"; - - //Rows titles - for(i=1; i<=myNbRows; i++) { - l = myRows->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myRows->Value(i).Value(j) << "\n"; - } - - //Nb columns - theStream << myNbColumns << "\n"; - - //Columns titles - for(i=1; i<=myNbColumns; i++) { - l = myCols->Value(i).Length(); - theStream << l << "\n"; - for(j=1; j<=l; j++) - theStream << myCols->Value(i).Value(j) << "\n"; - } - - //Store the table values - l = myTable.Extent(); - theStream << l << "\n"; - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString anIterator(myTable); - for(; anIterator.More(); anIterator.Next()) { - if (anIterator.Value().Length()) { // check empty string in the value table - theStream << anIterator.Key() << "\n"; - unsigned long aValueSize = anIterator.Value().Length(); - theStream<> l; - - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { - theStream >> anExtChar; - myTitle.SetValue(i, anExtChar); - } - - //Nb rows - theStream >> myNbRows; - - //Rows titles - myRows->Clear(); - for(i=1; i<=myNbRows; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myRows->Append(aStr); - } - - //Nb columns - theStream >> myNbColumns; - - //Columns titles - myCols->Clear(); - for(i=1; i<=myNbColumns; i++) { - theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { - theStream >> anExtChar; - aStr.SetValue(j, anExtChar); - } - myCols->Append(aStr); - } - - //Restore the table values - TCollection_AsciiString aValue; - theStream >> l; - myTable.Clear(); - theStream.getline(aValueString,aSize,'\n'); - for(i=1; i<=l; i++) { - Standard_Integer aKey; - - theStream.getline(aValueString,aSize,'\n'); - aValue = aValueString; - aKey = aValue.IntegerValue(); - if (aValue.Value(1) == '0') - aValue = ""; - else { - unsigned long aValueSize; - theStream >> aValueSize; - theStream.read(aValueString, 1); // an '\n' omitting - theStream.read(aValueString, aValueSize); - theStream.read(aValueString, 1); // an '\n' omitting - aValue = aValueString; - } - myTable.Bind(aKey, aValue); - } - delete(aValueString); - return true; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx deleted file mode 100644 index 230d486f4..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx +++ /dev/null @@ -1,170 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile -#define _SALOMEDS_TableOfStringAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfStringAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfStringAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfStringAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfStringAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -SALOMEDS_DataMapOfIntegerString myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx deleted file mode 100644 index aa0392411..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx +++ /dev/null @@ -1,67 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.ixx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfStringAttribute::~SALOMEDS_TableOfStringAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfStringAttribute", - sizeof(SALOMEDS_TableOfStringAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfStringAttribute) Handle(SALOMEDS_TableOfStringAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfStringAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfStringAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfStringAttribute)((Handle(SALOMEDS_TableOfStringAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfStringAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfStringAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfStringAttribute::~Handle_SALOMEDS_TableOfStringAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx deleted file mode 100644 index 23c515f83..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx +++ /dev/null @@ -1,34 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.jxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl b/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl deleted file mode 100644 index 75b1190a0..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl +++ /dev/null @@ -1,70 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - --- File : SALOMEDS_TargetAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class TargetAttribute from SALOMEDS inherits Relation from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - RelocationTable from TDF, - LabelList from TDF - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - returns TargetAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable TargetAttribute from SALOMEDS; - - Append(me: mutable; theReferencedObject : mutable Label form TDF); - Get(me; theReferencedObjects : mutable : LabelList from TDF); - Remove(me: mutable; theReferencedObject : mutable Label form TDF); - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end TargetAttribute; diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx deleted file mode 100644 index 455c745fa..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TargetAttribute.ixx" -#include -#include -#include "utilities.h" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TargetAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TargetAttributeID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TargetAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_TargetAttribute) SALOMEDS_TargetAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_TargetAttribute) A; - if (!L.FindAttribute(SALOMEDS_TargetAttribute::GetID(),A)) { - A = new SALOMEDS_TargetAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TargetAttribute::SALOMEDS_TargetAttribute() -{} - -//======================================================================= -//function : Append -//purpose : -//======================================================================= - -void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) { - Backup(); - Handle(TDF_Reference) aReference; - if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) { - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192 - GetVariables().Append(aReference); - } else { - MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object"); - } -} - -//======================================================================= -//function : Get -//purpose : -//======================================================================= -void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) { - theReferencedObjects.Clear(); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - theReferencedObjects.Append(anIter.Value()->Label()); - } -} - -//======================================================================= -//function : Remove -//purpose : -//======================================================================= -void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) { - Backup(); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - if (anIter.Value()->Label() == theReferencedObject) { - GetVariables().Remove(anIter); - return; - } - } - MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove"); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); } - diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx deleted file mode 100644 index 89c9e487c..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TargetAttribute_HeaderFile -#define _SALOMEDS_TargetAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile -#include -#endif - -#include -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _TDF_LabelList_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Reference_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TargetAttribute : public TDataStd_Relation { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TargetAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TargetAttribute(); -Standard_EXPORT void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject); -Standard_EXPORT void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects); -Standard_EXPORT void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject); -Standard_EXPORT const Standard_GUID& ID() const; - -// Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -// Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -// Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT ~SALOMEDS_TargetAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx b/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx deleted file mode 100644 index c6d2ed299..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TargetAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TargetAttribute::~SALOMEDS_TargetAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Relation); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Relation); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TargetAttribute", - sizeof(SALOMEDS_TargetAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TargetAttribute) Handle(SALOMEDS_TargetAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TargetAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TargetAttribute))) { - _anOtherObject = Handle(SALOMEDS_TargetAttribute)((Handle(SALOMEDS_TargetAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TargetAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TargetAttribute) ; -} -Standard_Boolean SALOMEDS_TargetAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TargetAttribute) == AType || TDataStd_Relation::IsKind(AType)); -} -Handle_SALOMEDS_TargetAttribute::~Handle_SALOMEDS_TargetAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx deleted file mode 100644 index 514c1372a..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TargetAttribute_HeaderFile -#include "SALOMEDS_TargetAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl b/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl deleted file mode 100644 index 5719628e8..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl +++ /dev/null @@ -1,69 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_TextColorAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class TextColorAttribute from SALOMEDS inherits RealArray from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable TextColorAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end TextColorAttribute; diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx deleted file mode 100644 index d2f1f321a..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx +++ /dev/null @@ -1,93 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextColorAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextColorAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TextColorAttributeID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TextColorAttributeID; -} - - - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TextColorAttribute::SALOMEDS_TextColorAttribute() -{Init(1,3);} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextColorAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_TextColorAttribute::NewEmpty () const -{ - return new SALOMEDS_TextColorAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_TextColorAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array (); - TDataStd_RealArray::ChangeArray(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_TextColorAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array()); -} - diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx deleted file mode 100644 index 94c2c8e46..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TextColorAttribute_HeaderFile -#define _SALOMEDS_TextColorAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_RealArray_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TextColorAttribute : public TDataStd_RealArray { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT SALOMEDS_TextColorAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_TextColorAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx deleted file mode 100644 index c2a12b9da..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextColorAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TextColorAttribute::~SALOMEDS_TextColorAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextColorAttribute", - sizeof(SALOMEDS_TextColorAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TextColorAttribute) Handle(SALOMEDS_TextColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TextColorAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextColorAttribute))) { - _anOtherObject = Handle(SALOMEDS_TextColorAttribute)((Handle(SALOMEDS_TextColorAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TextColorAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TextColorAttribute) ; -} -Standard_Boolean SALOMEDS_TextColorAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TextColorAttribute) == AType || TDataStd_RealArray::IsKind(AType)); -} -Handle_SALOMEDS_TextColorAttribute::~Handle_SALOMEDS_TextColorAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl deleted file mode 100644 index f3616de1e..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_TextHighlightColorAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class TextHighlightColorAttribute from SALOMEDS inherits RealArray from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable TextHighlightColorAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end TextHighlightColorAttribute; diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx deleted file mode 100644 index a34648996..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextHighlightColorAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TextHighlightColorAttributeID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TextHighlightColorAttributeID; -} - - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TextHighlightColorAttribute::SALOMEDS_TextHighlightColorAttribute() -{Init(1,3);} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_TextHighlightColorAttribute::NewEmpty () const -{ - return new SALOMEDS_TextHighlightColorAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_TextHighlightColorAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array (); - TDataStd_RealArray::ChangeArray(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_TextHighlightColorAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array()); -} - diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx deleted file mode 100644 index a39113617..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile -#define _SALOMEDS_TextHighlightColorAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_RealArray_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TextHighlightColorAttribute : public TDataStd_RealArray { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT SALOMEDS_TextHighlightColorAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_TextHighlightColorAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx deleted file mode 100644 index 186f0ab00..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextHighlightColorAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TextHighlightColorAttribute::~SALOMEDS_TextHighlightColorAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextHighlightColorAttribute", - sizeof(SALOMEDS_TextHighlightColorAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TextHighlightColorAttribute) Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TextHighlightColorAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute))) { - _anOtherObject = Handle(SALOMEDS_TextHighlightColorAttribute)((Handle(SALOMEDS_TextHighlightColorAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TextHighlightColorAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) ; -} -Standard_Boolean SALOMEDS_TextHighlightColorAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) == AType || TDataStd_RealArray::IsKind(AType)); -} -Handle_SALOMEDS_TextHighlightColorAttribute::~Handle_SALOMEDS_TextHighlightColorAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx deleted file mode 100644 index 1320ad1d9..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx +++ /dev/null @@ -1,40 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile -#include "SALOMEDS_TextHighlightColorAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index c89cb6ff3..7080df22f 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -32,12 +32,11 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_UseCaseIterator.hxx" -#include #include using namespace std; -SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder) +SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder) { _isLocal = true; _local_impl = theBuilder; @@ -62,7 +61,7 @@ bool SALOMEDS_UseCaseBuilder::Append(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->Append(obj->GetLocalImpl()); + ret = _local_impl->Append(*(obj->GetLocalImpl())); } else ret = _corba_impl->Append(obj->GetCORBAImpl()); return ret; @@ -74,7 +73,7 @@ bool SALOMEDS_UseCaseBuilder::Remove(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->Remove(obj->GetLocalImpl()); + ret = _local_impl->Remove(*(obj->GetLocalImpl())); } else ret = _corba_impl->Remove(obj->GetCORBAImpl()); return ret; @@ -87,7 +86,7 @@ bool SALOMEDS_UseCaseBuilder::AppendTo(const _PTR(SObject)& theFather, _PTR(SObj SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl()); + ret = _local_impl->AppendTo(*(father->GetLocalImpl()), *(obj->GetLocalImpl())); } else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl()); return ret; @@ -100,7 +99,7 @@ bool SALOMEDS_UseCaseBuilder::InsertBefore(const _PTR(SObject)& theFirst, _PTR(S SALOMEDS_SObject* next = dynamic_cast(theNext.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl()); + ret = _local_impl->InsertBefore(*(first->GetLocalImpl()), *(next->GetLocalImpl())); } else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl()); return ret; @@ -112,7 +111,7 @@ bool SALOMEDS_UseCaseBuilder::SetCurrentObject(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->SetCurrentObject(obj->GetLocalImpl()); + ret = _local_impl->SetCurrentObject(*(obj->GetLocalImpl())); } else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl()); return ret; @@ -135,7 +134,7 @@ bool SALOMEDS_UseCaseBuilder::HasChildren(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->HasChildren(obj->GetLocalImpl()); + ret = _local_impl->HasChildren(*(obj->GetLocalImpl())); } else ret = _corba_impl->HasChildren(obj->GetCORBAImpl()); return ret; @@ -147,7 +146,7 @@ bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->IsUseCase(obj->GetLocalImpl()); + ret = _local_impl->IsUseCase(*(obj->GetLocalImpl())); } else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl()); return ret; @@ -158,7 +157,7 @@ bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->SetName((char*)theName.c_str()); + ret = _local_impl->SetName(theName); } else ret = _corba_impl->SetName((char*)theName.c_str()); return ret; @@ -180,7 +179,7 @@ std::string SALOMEDS_UseCaseBuilder::GetName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->GetName().ToCString(); + aName = _local_impl->GetName(); } else aName = _corba_impl->GetName(); return aName; @@ -191,7 +190,7 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName) SALOMEDS_SObject* obj = NULL; if (_isLocal) { SALOMEDS::Locker lock; - obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str())); + obj = new SALOMEDS_SObject(_local_impl->AddUseCase(theName)); } else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase((char*)theName.c_str())); return _PTR(SObject)(obj); @@ -204,9 +203,9 @@ _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SOb if (_isLocal) { SALOMEDS::Locker lock; if(obj) - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); - else - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(NULL)); + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(*(obj->GetLocalImpl()))); + else + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(SALOMEDSImpl_SObject())); } else { if(obj) diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx index 2dd2fc657..d39db68bc 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx @@ -36,12 +36,12 @@ class SALOMEDS_UseCaseBuilder: public SALOMEDSClient_UseCaseBuilder private: bool _isLocal; - Handle(SALOMEDSImpl_UseCaseBuilder) _local_impl; - SALOMEDS::UseCaseBuilder_var _corba_impl; + SALOMEDSImpl_UseCaseBuilder* _local_impl; + SALOMEDS::UseCaseBuilder_var _corba_impl; public: - SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder); + SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder); SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder); ~SALOMEDS_UseCaseBuilder(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index 6997908eb..39b5061cc 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -36,7 +36,7 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theImpl, +SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -61,7 +61,7 @@ SALOMEDS_UseCaseBuilder_i::~SALOMEDS_UseCaseBuilder_i() CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->Append(_impl->GetSObject(theObject->GetID())); } @@ -73,7 +73,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->Remove(_impl->GetSObject(theObject->GetID())); } @@ -87,7 +87,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFath SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0; + if(!_impl || theFather->_is_nil() || theObject->_is_nil()) return 0; return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID())); } @@ -100,7 +100,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the SALOMEDS::SObject_ptr theNext) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0; + if(!_impl || theFirst->_is_nil() || theNext->_is_nil()) return 0; return _impl->InsertBefore(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); } @@ -113,7 +113,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID())); } @@ -125,7 +125,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->SetRootCurrent(); } @@ -137,7 +137,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->HasChildren(_impl->GetSObject(theObject->GetID())); } @@ -149,7 +149,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theO CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->SetName((char*)theName); } @@ -163,8 +163,8 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() { SALOMEDS::Locker lock; - if(_impl.IsNull()) return NULL; - Handle(SALOMEDSImpl_SObject) aSO = _impl->GetCurrentObject(); + if(!_impl) return NULL; + SALOMEDSImpl_SObject aSO = _impl->GetCurrentObject(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } @@ -177,7 +177,7 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() char* SALOMEDS_UseCaseBuilder_i::GetName() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetName().ToCString()); + return CORBA::string_dup(_impl->GetName().c_str()); } //============================================================================ @@ -189,7 +189,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObj { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return false; + if(!_impl || theObject->_is_nil()) return false; return _impl->IsUseCase(_impl->GetSObject(theObject->GetID())); } @@ -202,8 +202,8 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::AddUseCase(const char* theName) { SALOMEDS::Locker lock; - if(_impl.IsNull()) return SALOMEDS::SObject::_nil(); - Handle(SALOMEDSImpl_SObject) aSO = _impl->AddUseCase((char*)theName); + if(!_impl) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject aSO = _impl->AddUseCase((char*)theName); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } @@ -217,10 +217,10 @@ SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALO { SALOMEDS::Locker lock; - if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil(); - Handle(SALOMEDSImpl_UseCaseIterator) anItr; + if(!_impl) return SALOMEDS::UseCaseIterator::_nil(); + SALOMEDSImpl_UseCaseIterator anItr; if(!CORBA::is_nil(theObject)) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); - else anItr = _impl->GetUseCaseIterator(NULL); + else anItr = _impl->GetUseCaseIterator(SALOMEDSImpl_SObject()); SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb); SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this()); return anIterator._retn(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index 895d1c027..e5a433178 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -33,8 +33,6 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include -// Cascade headers -#include #include #include "SALOMEDSImpl_UseCaseIterator.hxx" @@ -46,13 +44,13 @@ class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder, { private: - CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_UseCaseBuilder) _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_UseCaseBuilder* _impl; public: //! standard constructor - SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theDocument, + SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theDocument, CORBA::ORB_ptr); //! standard destructor diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx index 9fc21d122..5717c654b 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx @@ -30,40 +30,40 @@ using namespace std; -SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator) +SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator) { _isLocal = true; - _local_impl = theIterator; + _local_impl = theIterator.GetPersistentCopy(); _corba_impl = SALOMEDS::UseCaseIterator::_nil(); } SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator) { _isLocal = false; - _local_impl = NULL; _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator); } SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator() { if(!_isLocal) _corba_impl->Destroy(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_UseCaseIterator::Init(bool theAllLevels) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Init(theAllLevels); + if(_local_impl) _local_impl->Init(theAllLevels); } else _corba_impl->Init(theAllLevels); } bool SALOMEDS_UseCaseIterator::More() { - bool ret; + bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->More(); + if(_local_impl) ret = _local_impl->More(); } else ret = _corba_impl->More(); return ret; @@ -73,17 +73,17 @@ void SALOMEDS_UseCaseIterator::Next() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Next(); + if(_local_impl) _local_impl->Next(); } else _corba_impl->Next(); } _PTR(SObject) SALOMEDS_UseCaseIterator::Value() { - SALOMEDS_SObject* aSO; + SALOMEDS_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSO = new SALOMEDS_SObject(_local_impl->Value()); + if(_local_impl) aSO = new SALOMEDS_SObject(_local_impl->Value()); } else aSO = new SALOMEDS_SObject(_corba_impl->Value()); return _PTR(SObject)(aSO); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx index fa82213a4..29f5d24a8 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx @@ -36,12 +36,12 @@ class SALOMEDS_UseCaseIterator: public SALOMEDSClient_UseCaseIterator { private: bool _isLocal; - Handle(SALOMEDSImpl_UseCaseIterator) _local_impl; - SALOMEDS::UseCaseIterator_var _corba_impl; + SALOMEDSImpl_UseCaseIterator* _local_impl; + SALOMEDS::UseCaseIterator_var _corba_impl; public: - SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator); + SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator); SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator); ~SALOMEDS_UseCaseIterator(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx index db1624eb4..1037dbcce 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx @@ -36,11 +36,11 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, +SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); - _impl = theImpl; + _impl = theImpl.GetPersistentCopy(); } //============================================================================ @@ -50,6 +50,7 @@ SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl //============================================================================ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() { + if(_impl) delete _impl; } //============================================================================ @@ -60,7 +61,7 @@ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) { SALOMEDS::Locker lock; - _impl->Init(allLevels); + if(_impl) _impl->Init(allLevels); } //============================================================================ @@ -71,6 +72,7 @@ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() { SALOMEDS::Locker lock; + if(!_impl) return false; return _impl->More(); } @@ -82,7 +84,7 @@ CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() void SALOMEDS_UseCaseIterator_i::Next() { SALOMEDS::Locker lock; - _impl->Next(); + if(_impl) _impl->Next(); } @@ -94,7 +96,8 @@ void SALOMEDS_UseCaseIterator_i::Next() SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->Value(); + if(!_impl) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject aSO = _impl->Value(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index 0f4262039..b1e58a30d 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -40,12 +40,12 @@ class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator, { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_UseCaseIterator) _impl; + SALOMEDSImpl_UseCaseIterator* _impl; public: //! standard constructor - SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, + SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, CORBA::ORB_ptr); //! standard destructor diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py index 8346a3979..9e8f5264a 100644 --- a/src/SALOMEDS/SALOME_DriverPy.py +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -38,7 +38,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): return self._ComponentDataType def Save(self, theComponent, theURL, isMultiFile): - return NULL + return "" def SaveASCII(self, theComponent, theURL, isMultiFile): return self.Save(theComponent, theURL, isMultiFile) @@ -56,7 +56,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): return 1 def PublishInStudy(self, theStudy, theSObject, theObject, theName): - return NULL + return None def CanCopy(self, theObject): return 0 diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 7c0008c99..79200aafc 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -59,11 +59,11 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(srcdir)/$(RPATH)/SALOMEDS \ -I$(srcdir)/$(RPATH)/SALOMEDSClient \ - -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ + -I$(srcdir)/$(RPATH)/DF \ + -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -80,6 +80,7 @@ COMMON_LIBS =\ $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \ $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \ $(RPATH)/SALOMEDSImpl/Test/libSALOMEDSImplTest.la \ + $(RPATH)/DF/libDF.la \ $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \ $(RPATH)/SALOMEDSClient/libSalomeDSClient.la \ $(RPATH)/SALOMEDS/libSalomeDS.la \ @@ -143,7 +144,4 @@ EXTRA_DIST = \ bin_PROGRAMS = TestSALOMEDS dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS) -TestSALOMEDS_LDADD = \ - libSALOMEDSTest.la ../libSalomeDS.la \ - $(RPATH)/NamingService/Test/libNamingServiceTest.la \ - $(COMMON_LIBS) +TestSALOMEDS_LDADD = libSALOMEDSTest.la diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx index 0b728667b..68de91733 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.cxx @@ -40,9 +40,6 @@ #include "SALOMEDS_SObject.hxx" -#include -#include - using namespace std; // ============================================================================ @@ -53,8 +50,8 @@ using namespace std; void SALOMEDSTest::setUp() { - int argc = 1; - char* argv[] = {""}; + int argc = 1; + char* argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); @@ -130,8 +127,8 @@ void SALOMEDSTest::tearDown() void SALOMEDSTest_Embedded::setUp() { - int argc = 1; - char* argv[] = {""}; + int argc = 1; + char* argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index 6dcaed5e5..64165bbb1 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -31,7 +31,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE( SALOMEDSTest ); //Attributes' tests - + CPPUNIT_TEST( testAttributeComment ); CPPUNIT_TEST( testAttributeDrawable ); CPPUNIT_TEST( testAttributeExpandable ); @@ -44,7 +44,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testAttributeLocalID ); CPPUNIT_TEST( testAttributeName ); CPPUNIT_TEST( testAttributeOpened ); - CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributeParameter ); CPPUNIT_TEST( testAttributePersistentRef ); CPPUNIT_TEST( testAttributePixMap ); CPPUNIT_TEST( testAttributePythonObject ); @@ -53,8 +53,8 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testAttributeSequenceOfInteger ); CPPUNIT_TEST( testAttributeSequenceOfReal ); CPPUNIT_TEST( testAttributeStudyProperties ); - CPPUNIT_TEST( testAttributeTableOfInteger ); - CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); CPPUNIT_TEST( testAttributeTableOfString ); CPPUNIT_TEST( testAttributeTarget ); CPPUNIT_TEST( testAttributeTextColor ); @@ -65,7 +65,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testSComponent ); CPPUNIT_TEST( testSComponentIterator ); CPPUNIT_TEST( testSObject ); - CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudy ); CPPUNIT_TEST( testStudyBuilder ); CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); @@ -133,7 +133,7 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded ); //Attributes' tests - + CPPUNIT_TEST( testAttributeComment ); CPPUNIT_TEST( testAttributeDrawable ); CPPUNIT_TEST( testAttributeExpandable ); @@ -149,13 +149,13 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST( testAttributeParameter ); CPPUNIT_TEST( testAttributePersistentRef ); CPPUNIT_TEST( testAttributePixMap ); - CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributePythonObject ); CPPUNIT_TEST( testAttributeReal ); CPPUNIT_TEST( testAttributeSelectable ); CPPUNIT_TEST( testAttributeSequenceOfInteger ); CPPUNIT_TEST( testAttributeSequenceOfReal ); CPPUNIT_TEST( testAttributeStudyProperties ); - CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfInteger ); CPPUNIT_TEST( testAttributeTableOfReal ); CPPUNIT_TEST( testAttributeTableOfString ); CPPUNIT_TEST( testAttributeTarget ); @@ -164,15 +164,15 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST( testAttributeTreeNode ); CPPUNIT_TEST( testAttributeUserID ); CPPUNIT_TEST( testChildIterator ); - CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponent ); CPPUNIT_TEST( testSComponentIterator ); CPPUNIT_TEST( testSObject ); CPPUNIT_TEST( testStudy ); - CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testChildIterator ); CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); - - + CPPUNIT_TEST_SUITE_END(); public: diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx index 7d799d957..6fc220a12 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx @@ -53,17 +53,17 @@ void SALOMEDSTest::testAttributeExpandable() //Check method IsExpandable bool isExpandable = _attr->IsExpandable(); - CPPUNIT_ASSERT(!isExpandable); + CPPUNIT_ASSERT(isExpandable); //Check method SetExpandable - _attr->SetExpandable(true); - - CPPUNIT_ASSERT(_attr->IsExpandable()); - _attr->SetExpandable(false); CPPUNIT_ASSERT(!_attr->IsExpandable()); + _attr->SetExpandable(true); + + CPPUNIT_ASSERT(_attr->IsExpandable()); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx index 67aaea942..3c02ae622 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx @@ -53,17 +53,17 @@ void SALOMEDSTest::testAttributeSelectable() //Check method IsSelectable bool isSelectable = _attr->IsSelectable(); - CPPUNIT_ASSERT(!isSelectable); + CPPUNIT_ASSERT(isSelectable); //Check method SetSelectable - _attr->SetSelectable(true); - - CPPUNIT_ASSERT(_attr->IsSelectable()); - _attr->SetSelectable(false); CPPUNIT_ASSERT(!_attr->IsSelectable()); + _attr->SetSelectable(true); + + CPPUNIT_ASSERT(_attr->IsSelectable()); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx index 27371c474..b90507041 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx @@ -81,6 +81,7 @@ void SALOMEDSTest::testAttributeSequenceOfInteger() vector v = _attr->CorbaSequence(); CPPUNIT_ASSERT(v.size() == 3); + for(int i = 0; iSetTitle("Table_1"); @@ -86,17 +86,17 @@ void SALOMEDSTest::testAttributeTableOfInteger() vector rs = _attr->GetRowSetIndices(1); CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); -*/ + _attr->PutValue(32, 2,2); CPPUNIT_ASSERT(_attr->HasValue(2, 2)); -/* + vector rowTitles; rowTitles.push_back("title1"); rowTitles.push_back("title2"); //Check method SetRowTitles _attr->SetRowTitles(rowTitles); - + //Check method SetRowTitle _attr->SetRowTitle(1, "new_title"); @@ -118,9 +118,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() //Check method GetColumnTitles vector ct = _attr->GetColumnTitles(); - CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2"); -*/ vector rowUnits; rowUnits.push_back("unit1"); @@ -129,8 +127,6 @@ void SALOMEDSTest::testAttributeTableOfInteger() //Check method SetRowUnits _attr->SetRowUnits(rowUnits); -/* - //Check method SetRowUnit _attr->SetRowUnit(1, "new_unit"); @@ -171,6 +167,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() _attr->AddColumn(data); + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); //Check method GetColumn @@ -185,7 +182,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() data2 = _attr->GetColumn(3); CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33); -*/ + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx index 75d1b2e40..e86d3ef58 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx @@ -105,7 +105,6 @@ void SALOMEDSTest::testAttributeTableOfReal() CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); - vector colTitles; colTitles.push_back("title1"); colTitles.push_back("title2"); diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx index c99bf75c6..de2f21099 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx @@ -67,7 +67,7 @@ void SALOMEDSTest::testAttributeTextColor() CPPUNIT_ASSERT(color.B == color2.B); - sm->Close(study); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx index 23a7b9471..270ba559b 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx @@ -93,7 +93,7 @@ void SALOMEDSTest::testAttributeTreeNode() CPPUNIT_ASSERT(isRaised); _attr->Append(_attr2); - + //Check method HasNext CPPUNIT_ASSERT(_attr1->HasNext()); @@ -107,7 +107,7 @@ void SALOMEDSTest::testAttributeTreeNode() CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label()); //Check method Depth - CPPUNIT_ASSERT(_attr->Depth() == 0 && _attr1->Depth() == 1); + CPPUNIT_ASSERT(_attr->Depth() == 1 && _attr1->Depth() == 2); //Check method IsRoot CPPUNIT_ASSERT(_attr->IsRoot()); @@ -125,6 +125,7 @@ void SALOMEDSTest::testAttributeTreeNode() //Check method Prepend _attr->Prepend(_attr2); + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); //Check possibility to Prepend to itself @@ -184,19 +185,9 @@ void SALOMEDSTest::testAttributeTreeNode() //Try to create the attribute with given TreeID string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648"; - _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"+value); + _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value); CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value); - - //Try to set invalid GUID - isRaised = false; - try { - _attr->SetTreeID("invalid guid"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); - + sm->Close(study); } #undef SALOMEDS_ALL_TESTS diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx index 064b77de5..1af8beeba 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx @@ -62,18 +62,7 @@ void SALOMEDSTest::testAttributeUserID() value = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; _PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value); CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value); - - //Try to set invalid GUID - bool isRaised = false; - try { - _attr->SetValue("invalid guid"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); - - + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx index bed9e9276..ac3f02690 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx @@ -71,7 +71,7 @@ void SALOMEDSTest::testChildIterator() //Check that there are two SObject under so CPPUNIT_ASSERT(count == 2); - + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx index 5b4d221fe..c79274f8b 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx @@ -99,6 +99,7 @@ void SALOMEDSTest::testSObject() //Check method GetAllAttributes vector< _PTR(GenericAttribute) > v = so->GetAllAttributes(); + CPPUNIT_ASSERT(v.size() == 5); //+AttributeTarget +AttributeTreeNode //Check method GetName diff --git a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx index aef1f9c2a..1a34ea293 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx @@ -42,6 +42,7 @@ void SALOMEDSTest::testStudy() //Check method NewComponentIterator _PTR(SComponentIterator) componentIterator = study->NewComponentIterator(); + CPPUNIT_ASSERT(componentIterator); //Check method GetTransientReference @@ -342,7 +343,6 @@ void SALOMEDSTest::testStudy() isException = true; } CPPUNIT_ASSERT(!isException); - } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx index 4ce06a578..109ac0e2d 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx @@ -80,24 +80,16 @@ void SALOMEDSTest::testStudyBuilder() _PTR(AttributeName) an3 = studyBuilder->FindOrCreateAttribute(so3, "AttributeName"); CPPUNIT_ASSERT(an3); - cout << endl << "########## 1" << endl; - //Try to create attribute with invalid type CPPUNIT_ASSERT(!studyBuilder->FindOrCreateAttribute(so3, "invalid type")); - cout << endl << "########## 2" << endl; - //Check method FindAttribute _PTR(GenericAttribute) ga; CPPUNIT_ASSERT(studyBuilder->FindAttribute(so3, ga, "AttributeName")); - cout << endl << "########## 3" << endl; - //Try to find attribute with invalid type CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "invalid type")); - cout << endl << "########## 4" << endl; - //Check method RemoveObject studyBuilder->RemoveObject(so3); CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "AttributeName")); @@ -138,46 +130,14 @@ void SALOMEDSTest::testStudyBuilder() //Check method SetGUID and IsGUID string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; studyBuilder->SetGUID(so1, value); - CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); - //Try to set invalid GUID - isRaised = false; - try { - studyBuilder->SetGUID(so1, "invalid GUID"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); + CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); +/* Not implemented //Check method UndoLimit (set/get) studyBuilder->UndoLimit(10); CPPUNIT_ASSERT(studyBuilder->UndoLimit() == 10); - - //Check transactions methods: NewCommand, CommitCommand, AbortCommand, - //HasOpenedCommand, Undo, Redo, GetAvailableUndos, GetAvailableRedos - _PTR(SObject) so4 = studyBuilder->NewObject(sco3); - CPPUNIT_ASSERT(so4); - studyBuilder->NewCommand(); - CPPUNIT_ASSERT(studyBuilder->HasOpenCommand()); - _PTR(AttributeName) an4 = studyBuilder->FindOrCreateAttribute(so4, "AttributeName"); - CPPUNIT_ASSERT(an4); - an4->SetValue("command1"); - studyBuilder->CommitCommand(); - CPPUNIT_ASSERT(!studyBuilder->HasOpenCommand()); - studyBuilder->NewCommand(); - an4->SetValue("command2"); - studyBuilder->AbortCommand(); - CPPUNIT_ASSERT(an4->Value() == "command1"); - studyBuilder->NewCommand(); - an4->SetValue("command2"); - studyBuilder->CommitCommand(); - studyBuilder->Undo(); - CPPUNIT_ASSERT(an4->Value() == "command1"); - CPPUNIT_ASSERT(studyBuilder->GetAvailableRedos()); - studyBuilder->Redo(); - CPPUNIT_ASSERT(an4->Value() == "command2"); - CPPUNIT_ASSERT(studyBuilder->GetAvailableUndos()); +*/ //Check method SetName studyBuilder->SetName(so1, "new name"); @@ -207,17 +167,19 @@ void SALOMEDSTest::testStudyBuilder() //Check method LoadWith _PTR(Study) study2 = sm->NewStudy("Study2"); - + SALOME_NamingService NS(_orb); - CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH"); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); - MESSAGE("Created a new GEOM component"); + MESSAGE("Created a new SMESH component"); SALOMEDS::Driver_var drv = SALOMEDS::Driver::_narrow(obj); CPPUNIT_ASSERT(!CORBA::is_nil(drv)); + _PTR(StudyBuilder) sb2 = study2->NewBuilder(); - _PTR(SComponent) sco = sb2->NewComponent("SUPERV"); + _PTR(SComponent) sco = sb2->NewComponent("SMESH"); + ior = _orb->object_to_string(drv); sb2->DefineComponentInstance(sco, ior); @@ -226,22 +188,24 @@ void SALOMEDSTest::testStudyBuilder() _PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf"); _PTR(StudyBuilder) sb3 = study3->NewBuilder(); - _PTR(SComponent) aComp = study3->FindComponent("SUPERV"); + _PTR(SComponent) aComp = study3->FindComponent("SMESH"); CPPUNIT_ASSERT(aComp); - CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH"); CPPUNIT_ASSERT(!CORBA::is_nil(obj2)); SALOMEDS::Driver_var drv2 = SALOMEDS::Driver::_narrow(obj2); ior = _orb->object_to_string(drv2); isRaised = false; try { + //getchar(); sb3->LoadWith(aComp, ior); } catch(...) { isRaised = true; } + CPPUNIT_ASSERT(!isRaised); ior = ""; @@ -261,6 +225,7 @@ void SALOMEDSTest::testStudyBuilder() isRaised = true; } + CPPUNIT_ASSERT(!isRaised); _PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1"); CPPUNIT_ASSERT(so5); @@ -281,5 +246,5 @@ void SALOMEDSTest::testStudyBuilder() } CPPUNIT_ASSERT(isRaised); - sm->Close(study3); + sm->Close(study3); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx index f20d68208..4f2f7369d 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx @@ -79,7 +79,6 @@ void SALOMEDSTest::testStudyManager() CPPUNIT_ASSERT(sm->Copy(so1)); - CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR _PTR(SObject) so1_2 = sb1->NewObject(sco1); @@ -90,7 +89,6 @@ void SALOMEDSTest::testStudyManager() CPPUNIT_ASSERT(na2 && na2->Value() == "Some name"); - //Check method SaveAs sm->SaveAs("srn_UnitTest_Save.hdf", study1, false); string url = study1->URL(); @@ -112,25 +110,31 @@ void SALOMEDSTest::testStudyManager() string soID = so3->GetID(); _PTR(AttributeName) na3 = sb3->FindOrCreateAttribute(so3, "AttributeName"); CPPUNIT_ASSERT(na3); + na3->SetValue("Saved study"); + // Save and close the study sm->Save(study1_opened, false); + sm->Close(study1_opened); // Open saved study and find the created SObject with AttributeName, then compare the stored string _PTR(Study) study2_opened = sm->Open("srn_UnitTest_Save.hdf"); + system("rm -f srn_UnitTest_Save.hdf"); + CPPUNIT_ASSERT(study2_opened); + _PTR(SObject) so4 = study2_opened->CreateObjectID(soID); _PTR(StudyBuilder) sb4 = study2_opened->NewBuilder(); _PTR(AttributeName) na4 = sb4->FindOrCreateAttribute(so4, "AttributeName"); CPPUNIT_ASSERT(na4 && na4->Value() == "Saved study"); //Compare the value of restored attribute with string that has to be saved. - //Check method SaveAsASCII sm->SaveAsASCII("srn_UnitTest_SaveASCII.hdf", study2_opened, false); url = study2_opened->URL(); sm->Close(study2_opened); + _PTR(Study) study3_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); //Contains Test component system("rm -f srn_UnitTest_SaveASCII.hdf"); CPPUNIT_ASSERT(study3_opened); diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 59f32e47d..2d02b2829 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -24,8 +24,6 @@ #include "SALOMEDSImplTest.hxx" #include "SALOMEDSTest.hxx" -#include - // --- Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest ); @@ -108,8 +106,6 @@ int main(int argc, char* argv[]) string kernel_root = getenv("KERNEL_ROOT_DIR"); CPPUNIT_ASSERT(!kernel_root.empty()); kernel_root+="/share/salome/resources/kernel"; - setenv("CSF_PluginDefaults", kernel_root.c_str(), 1); - setenv("CSF_SALOMEDS_ResourcesDefaults", kernel_root.c_str(), 1); CORBA::Object_var poaObj = orb->resolve_initial_references("RootPOA"); if(!CORBA::is_nil(poaObj)) { diff --git a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx index 136bafd35..33182f673 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx @@ -69,6 +69,7 @@ public: virtual bool IsSaved() = 0; virtual void IsSaved(bool save) = 0; virtual bool IsModified() = 0; + virtual void Modified() = 0; virtual std::string URL() = 0; virtual void URL(const std::string& url) = 0; virtual int StudyId() = 0; diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index a228cac57..f1b3c72db 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -73,7 +73,6 @@ salomeinclude_HEADERS= \ SALOMEDSImpl_StudyBuilder.hxx \ SALOMEDSImpl_Study.hxx \ SALOMEDSImpl_StudyManager.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_IParameters.hxx \ SALOMEDSImpl_TMPFile.hxx @@ -86,11 +85,12 @@ salomeinclude_HEADERS= \ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../HDFPersist \ - @HDF5_INCLUDES@ + -I$(srcdir)/../DF \ + @HDF5_INCLUDES@ \ + @BOOST_CPPFLAGS@ # This flag is used to resolve the dependencies of OCC libraries. LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu @@ -98,7 +98,7 @@ LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ - @CAS_OCAF@ \ + ../DF/libDF.la \ @HDF5_LIBS@ \ $(LDXMUFLAGS) @@ -117,7 +117,6 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_SObject.cxx \ SALOMEDSImpl_SComponent.cxx \ SALOMEDSImpl_ChildIterator.cxx \ - SALOMEDSImpl_OCAFApplication.cxx \ SALOMEDSImpl_AttributeIOR.cxx \ SALOMEDSImpl_AttributeExternalFileDef.cxx \ SALOMEDSImpl_AttributeFileType.cxx \ @@ -196,7 +195,6 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_Driver.hxx \ SALOMEDSImpl_GenericAttribute.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_SComponent.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ SALOMEDSImpl_SObject.hxx \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx index cbfa29b17..e76570dd1 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx @@ -27,24 +27,21 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID () +const std::string& SALOMEDSImpl_AttributeComment::GetID () { - static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9"); + static std::string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9"); return CommentID; } -Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeComment* SALOMEDSImpl_AttributeComment::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeComment) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) { + SALOMEDSImpl_AttributeComment* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeComment*)L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { A = new SALOMEDSImpl_AttributeComment(); L.AddAttribute(A); } @@ -58,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeComment::SetValue (const string& S) { CheckLocked(); @@ -76,13 +73,13 @@ void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeComment::NewEmpty () const { return new SALOMEDSImpl_AttributeComment(); } @@ -91,9 +88,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeComment::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -101,8 +98,7 @@ void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeComment::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx index a7ad7221a..8f6e361b5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx @@ -24,47 +24,38 @@ #ifndef _SALOMEDSImpl_AttributeComment_HeaderFile #define _SALOMEDSImpl_AttributeComment_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) +#include class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeComment) Set(const TDF_Label& L, const TCollection_ExtendedString& Val); -Standard_EXPORT void SetValue (const TCollection_ExtendedString& S); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } +Standard_EXPORT static SALOMEDSImpl_AttributeComment* Set(const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue (const std::string& S); +Standard_EXPORT std::string Value() const { return myString; } -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeComment() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeComment ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx index a47756deb..70a954f43 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx @@ -27,16 +27,13 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID () +const std::string& SALOMEDSImpl_AttributeDrawable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeDrawableID; } @@ -46,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeDrawable) SALOMEDSImpl_AttributeDrawable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeDrawable* SALOMEDSImpl_AttributeDrawable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeDrawable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID(),A)) { + SALOMEDSImpl_AttributeDrawable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeDrawable*)L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID()))) { A = new SALOMEDSImpl_AttributeDrawable(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeDrawable::SALOMEDSImpl_AttributeDrawable() //function : SetDrawable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeDrawable::SetDrawable(const int theValue) { CheckLocked(); @@ -89,7 +86,7 @@ void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); } //======================================================================= @@ -97,7 +94,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID( //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeDrawable::NewEmpty () const { return new SALOMEDSImpl_AttributeDrawable(); } @@ -107,9 +104,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeDrawable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (with)->IsDrawable (); + myValue = dynamic_cast(with)->IsDrawable (); } //======================================================================= @@ -117,9 +114,8 @@ void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeDrawable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (into)->SetDrawable (myValue); + dynamic_cast(into)->SetDrawable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx index 9e852a900..9fa1122e7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile #define _SALOMEDSImpl_AttributeDrawable_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute ) - - class SALOMEDSImpl_AttributeDrawable : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; } +Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeDrawable Set(const TDF_Label& label,const Standard_Integer value) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeDrawable* Set(const DF_Label& label,const int value) ; -Standard_EXPORT void SetDrawable(const Standard_Integer theValue); -Standard_EXPORT Standard_Integer IsDrawable() const { return myValue; } +Standard_EXPORT void SetDrawable(const int theValue); +Standard_EXPORT int IsDrawable() const { return myValue; } Standard_EXPORT SALOMEDSImpl_AttributeDrawable(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeDrawable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx index d0a2df1b2..a77d1e8c4 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx @@ -27,16 +27,13 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID () +const std::string& SALOMEDSImpl_AttributeExpandable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeExpandableID; } @@ -46,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID () //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeExpandable* SALOMEDSImpl_AttributeExpandable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeExpandable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID(),A)) { + SALOMEDSImpl_AttributeExpandable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeExpandable*)L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID()))) { A = new SALOMEDSImpl_AttributeExpandable(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeExpandable::SALOMEDSImpl_AttributeExpandable() //function : SetExpandable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeExpandable::SetExpandable(const int theValue) { CheckLocked(); @@ -88,7 +85,7 @@ void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theV //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); } //======================================================================= @@ -96,7 +93,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetI //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeExpandable::NewEmpty () const { return new SALOMEDSImpl_AttributeExpandable(); } @@ -106,9 +103,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeExpandable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (with)->IsExpandable (); + myValue = dynamic_cast(with)->IsExpandable (); } //======================================================================= @@ -116,9 +113,8 @@ void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeExpandable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (into)->SetExpandable (myValue); + dynamic_cast(into)->SetExpandable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx index 48e7afd67..8b80e3b39 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx @@ -24,43 +24,33 @@ #ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile #define _SALOMEDSImpl_AttributeExpandable_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeExpandable : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; } +Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExpandable Set(const TDF_Label& label,const Standard_Integer value) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeExpandable* Set(const DF_Label& label,const int value) ; Standard_EXPORT SALOMEDSImpl_AttributeExpandable(); -Standard_EXPORT void SetExpandable(const Standard_Integer value); +Standard_EXPORT void SetExpandable(const int value); Standard_EXPORT int IsExpandable() const { return myValue; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeExpandable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExpandable ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx index f64099472..6bb5a1281 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx @@ -25,16 +25,13 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID () +const std::string& SALOMEDSImpl_AttributeExternalFileDef::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); + static std::string SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); return SALOMEDSImpl_AttributeExternalFileDefID; } @@ -42,12 +39,12 @@ const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID () //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeExternalFileDef) -SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeExternalFileDef* +SALOMEDSImpl_AttributeExternalFileDef::Set (const DF_Label& L, const std::string& S) { - Handle(SALOMEDSImpl_AttributeExternalFileDef) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) { + SALOMEDSImpl_AttributeExternalFileDef* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeExternalFileDef*)L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID()))) { A = new SALOMEDSImpl_AttributeExternalFileDef(); L.AddAttribute(A); } @@ -70,7 +67,7 @@ SALOMEDSImpl_AttributeExternalFileDef::SALOMEDSImpl_AttributeExternalFileDef() //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const std::string& S) { CheckLocked(); @@ -89,14 +86,14 @@ void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_Extended //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const { return new SALOMEDSImpl_AttributeExternalFileDef(); } @@ -105,19 +102,18 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeExternalFileDef::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeExternalFileDef::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into); + SALOMEDSImpl_AttributeExternalFileDef* anAttr = dynamic_cast(into); anAttr->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx index cec772be3..2222717bd 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx @@ -21,43 +21,33 @@ #ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile #define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeExternalFileDef : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExternalFileDef Set(const TDF_Label& label, - const TCollection_ExtendedString& Name); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeExternalFileDef* Set(const DF_Label& label, + const std::string& Name); Standard_EXPORT SALOMEDSImpl_AttributeExternalFileDef(); -Standard_EXPORT void SetValue(const TCollection_ExtendedString& value); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeExternalFileDef() {} -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExternalFileDef ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx index 19661cbab..2b7a32ada 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx @@ -25,17 +25,14 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID () +const std::string& SALOMEDSImpl_AttributeFileType::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); + static std::string SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); return SALOMEDSImpl_AttributeFileTypeID; } @@ -46,12 +43,12 @@ const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeFileType) SALOMEDSImpl_AttributeFileType::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeFileType* SALOMEDSImpl_AttributeFileType::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributeFileType) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID(),A)) { + SALOMEDSImpl_AttributeFileType* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeFileType*)L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID()))) { A = new SALOMEDSImpl_AttributeFileType(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeFileType::SALOMEDSImpl_AttributeFileType() //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeFileType::SetValue (const std::string& S) { CheckLocked(); @@ -92,7 +89,7 @@ void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); } //======================================================================= @@ -100,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID( //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeFileType::NewEmpty () const { return new SALOMEDSImpl_AttributeFileType(); } @@ -110,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeFileType::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeFileType)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -120,9 +117,8 @@ void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeFileType::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeFileType)::DownCast (into)->SetValue (myString); + dynamic_cast(into)->SetValue (myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx index 54412c9cc..a4d61fe96 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx @@ -21,43 +21,33 @@ #ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile #define _SALOMEDSImpl_AttributeFileType_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeFileType : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeFileType Set(const TDF_Label& label, - const TCollection_ExtendedString& Name) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeFileType* Set(const DF_Label& label, + const std::string& Name) ; Standard_EXPORT SALOMEDSImpl_AttributeFileType(); -Standard_EXPORT void SetValue(const TCollection_ExtendedString& value); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeFileType() {} -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFileType ) }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx index 4a9395e66..d0828013d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx @@ -22,7 +22,6 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeFlags.hxx" -#include using namespace std; @@ -33,16 +32,13 @@ using namespace std; have only two states (0 and 1). */ -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : SALOMEDSImpl_AttributeFlags::GetID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID () +const std::string& SALOMEDSImpl_AttributeFlags::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); + static std::string SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); return SALOMEDSImpl_AttributeFlagsID; } @@ -50,11 +46,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID () //function : SALOMEDSImpl_AttributeFlags::Set //purpose : Set value of the attribute //======================================================================= -Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L, - const Standard_Integer value ) +SALOMEDSImpl_AttributeFlags* SALOMEDSImpl_AttributeFlags::Set(const DF_Label& L, + const int value ) { - Handle(SALOMEDSImpl_AttributeFlags) A; - if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) ) + SALOMEDSImpl_AttributeFlags* A = NULL; + if ( !(A=(SALOMEDSImpl_AttributeFlags*)L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID())) ) { A = new SALOMEDSImpl_AttributeFlags(); L.AddAttribute( A ); @@ -82,7 +78,7 @@ SALOMEDSImpl_AttributeFlags::~SALOMEDSImpl_AttributeFlags() //function : SALOMEDSImpl_AttributeFlags::ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const +const std::string& SALOMEDSImpl_AttributeFlags::ID () const { return GetID(); } @@ -92,7 +88,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeFlags::NewEmpty () const { return new SALOMEDSImpl_AttributeFlags(); } @@ -101,9 +97,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const //function : SALOMEDSImpl_AttributeFlags::Restore //purpose : Assign given value to the attribute //======================================================================= -void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with ) +void SALOMEDSImpl_AttributeFlags::Restore( DF_Attribute* with ) { - myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get(); + myValue = dynamic_cast( with )->Get(); return; } @@ -111,17 +107,16 @@ void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with ) //function : SALOMEDSImpl_AttributeFlags::Paste //purpose : Assign internal value to the given attribute //======================================================================= -void SALOMEDSImpl_AttributeFlags::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const +void SALOMEDSImpl_AttributeFlags::Paste( DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue ); + dynamic_cast( into )->Set( myValue ); } //======================================================================= //function : SALOMEDSImpl_AttributeFlags::Set //purpose : Set value //======================================================================= -void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v ) +void SALOMEDSImpl_AttributeFlags::Set( const int v ) { Backup(); myValue=v; @@ -131,7 +126,7 @@ void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v ) //function : SALOMEDSImpl_AttributeFlags::Get //purpose : GetValue //======================================================================= -Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const +int SALOMEDSImpl_AttributeFlags::Get() const { return myValue; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx index c28d1c694..773df8891 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx @@ -24,24 +24,16 @@ #ifndef SALOMEDSImpl_AttributeFlags_HeaderFile #define SALOMEDSImpl_AttributeFlags_HeaderFile -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - /* Class : SALOMEDSImpl_AttributeFlags Description : This class is intended for storing different object attributes that have only two states (0 and 1). */ -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute ) - #ifndef WNT class Standard_EXPORT SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute #else @@ -49,25 +41,22 @@ class SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute #endif { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeFlags) Set(const TDF_Label&, const Standard_Integer ); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeFlags* Set(const DF_Label&, const int theValue ); SALOMEDSImpl_AttributeFlags(); -Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags(); +Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore( const Handle(TDF_Attribute)& with ); -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const; -Standard_EXPORT void Set( const Standard_Integer ); -Standard_EXPORT Standard_Integer Get() const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* with ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* into); +Standard_EXPORT void Set( const int ); +Standard_EXPORT int Get() const; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFlags ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx index ca0dc338f..b5f8c7c8d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx @@ -22,9 +22,9 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeGraphic.hxx" -#include -#include -#include +#include "DF_Attribute.hxx" + +using namespace std; /* Class : SALOMEDSImpl_AttributeGraphic @@ -32,16 +32,13 @@ graphic representation of objects in dirrent views */ -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeGraphic::GetID() +const std::string& SALOMEDSImpl_AttributeGraphic::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); + static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); return SALOMEDSImpl_AttributeGraphicID; } @@ -66,17 +63,14 @@ SALOMEDSImpl_AttributeGraphic::~SALOMEDSImpl_AttributeGraphic() //function : SetVisibility //purpose : Set visibility of object in given view //======================================================================= -void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theViewId, - const Standard_Boolean theValue ) +void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId, + const bool theValue ) { - if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue ) + if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue ) return; Backup(); - if ( myVisibility.IsBound( theViewId ) ) - myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0; - else - myVisibility.Bind( theViewId, theValue ? 1 : 0 ); + myVisibility[ theViewId ] = theValue ? 1 : 0; } @@ -84,9 +78,15 @@ void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theView //function : Get //purpose : Get visibility of object in given view //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Integer theViewId ) const +bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId ) { - return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false; + bool isVisible = false; + if(myVisibility.find( theViewId )!=myVisibility.end()) + isVisible = (bool)myVisibility[theViewId]; + else + isVisible = false; + + return isVisible; } @@ -94,7 +94,7 @@ Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Int //function : ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const +const std::string& SALOMEDSImpl_AttributeGraphic::ID () const { return GetID(); } @@ -104,7 +104,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const //function : NewEmpty //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const { return new SALOMEDSImpl_AttributeGraphic (); } @@ -113,7 +113,7 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const //function : SetVisibility //purpose : Set visibility of object in all views //======================================================================= -void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap ) +void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map& theMap ) { myVisibility = theMap; } @@ -122,7 +122,7 @@ void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntege //function : SetVisibility //purpose : Get visibility of object in all views //======================================================================= -const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibility() +const map& SALOMEDSImpl_AttributeGraphic::GetVisibility() { return myVisibility; } @@ -131,12 +131,12 @@ const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibil //function : Restore //purpose : Restore value of attribute with value of theWith one //======================================================================= -void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWith ) +void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith ) { - Handle(SALOMEDSImpl_AttributeGraphic) anAttr = - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theWith ); + SALOMEDSImpl_AttributeGraphic* anAttr = + dynamic_cast( theWith ); - if ( !anAttr.IsNull() ) + if ( anAttr ) SetVisibility( anAttr->GetVisibility() ); } @@ -144,37 +144,12 @@ void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWit //function : Paste //purpose : Paste value of current attribute to the value of entry one //======================================================================= -void SALOMEDSImpl_AttributeGraphic::Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto) { - Handle(SALOMEDSImpl_AttributeGraphic) anAttr = - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theInto ); + SALOMEDSImpl_AttributeGraphic* anAttr = + dynamic_cast( theInto ); - if ( !anAttr.IsNull() ) + if ( anAttr ) anAttr->SetVisibility( myVisibility ); } -//======================================================================= -//function : Dump -//purpose : Dump -//======================================================================= -Standard_OStream& SALOMEDSImpl_AttributeGraphic::Dump( Standard_OStream& anOS ) const -{ - anOS << "Visibility of object:" << endl; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility ); - for ( ; anIter.More(); anIter.Next() ) - { - char str[ 100 ]; - - if ( GetVisibility( anIter.Key() ) ) - sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() ); - else - sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() ); - - anOS << str; - } - - anOS << "Integer"; - return anOS; -} - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx index 8d5c2e96d..69801875a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx @@ -24,15 +24,11 @@ #ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile #define SALOMEDSImpl_AttributeGraphic_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include /* Class : SALOMEDSImpl_AttributeGraphic @@ -40,10 +36,6 @@ class Handle(TDF_RelocationTable); graphic representation of objects in dirrent views */ -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute) - - - #ifndef WNT class Standard_EXPORT SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute #else @@ -55,27 +47,22 @@ public: Standard_EXPORT SALOMEDSImpl_AttributeGraphic(); Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic(); -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; -Standard_EXPORT void SetVisibility( const Standard_Integer, - const Standard_Boolean ); -Standard_EXPORT Standard_Boolean GetVisibility( const Standard_Integer ) const; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith ); -Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const; -Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const; -Standard_EXPORT virtual Standard_OStream& Dump( Standard_OStream& anOS ) const; +Standard_EXPORT void SetVisibility( const int, const bool ); +Standard_EXPORT bool GetVisibility( const int ); +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* theWith ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* theInto); -Standard_EXPORT void SetVisibility( const TColStd_DataMapOfIntegerInteger& ); +Standard_EXPORT void SetVisibility( const std::map& ); -Standard_EXPORT const TColStd_DataMapOfIntegerInteger& GetVisibility(); +Standard_EXPORT const std::map& GetVisibility(); private: - TColStd_DataMapOfIntegerInteger myVisibility; + std::map myVisibility; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeGraphic ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index c77587f5d..b8c88df49 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -22,26 +22,20 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeIOR.hxx" -#include #include "SALOMEDSImpl_Study.hxx" -#include #ifndef WNT using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute ) - - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () +const std::string& SALOMEDSImpl_AttributeIOR::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03"); + static std::string SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03"); return SALOMEDSImpl_AttributeIORID; } @@ -52,11 +46,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributeIOR) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) { + SALOMEDSImpl_AttributeIOR* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { A = new SALOMEDSImpl_AttributeIOR(); L.AddAttribute(A); } @@ -70,27 +64,23 @@ Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Labe //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue) +void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) { CheckLocked(); - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label()); - aStudy->AddCreatedPostponed(theValue); - aStudy->AddPostponed(theValue); + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(Label()); Backup(); myString = theValue; SALOMEDSImpl_Study::IORUpdated(this); - - //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } //======================================================================= //function : Value //purpose : //======================================================================= -TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const +std::string SALOMEDSImpl_AttributeIOR::Value() const { return myString; } @@ -109,7 +99,7 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } //======================================================================= @@ -117,7 +107,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeIOR::NewEmpty () const { return new SALOMEDSImpl_AttributeIOR(); } @@ -127,9 +117,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeIOR::Restore( DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value(); + myString = dynamic_cast(with)->Value(); return; } @@ -138,9 +128,8 @@ void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeIOR::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx index 1681775cf..eb0be83c5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile #define _SALOMEDSImpl_AttributeIOR_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeIOR : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeIOR Set(const TDF_Label& label, - const TCollection_ExtendedString& string); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeIOR* Set(const DF_Label& label, + const std::string& IOR); Standard_EXPORT SALOMEDSImpl_AttributeIOR(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void SetValue(const TCollection_ExtendedString& theValue); -Standard_EXPORT TCollection_ExtendedString Value() const ; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void SetValue(const std::string& theValue); +Standard_EXPORT std::string Value() const ; +Standard_EXPORT void Restore(DF_Attribute* with); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeIOR() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeIOR ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx index c95a4d3cb..ea1058ff9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx @@ -27,24 +27,22 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute ) - +#include //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID () +const std::string& SALOMEDSImpl_AttributeInteger::GetID () { - static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018"); + static std::string IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018"); return IntegerID; } -Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val) +SALOMEDSImpl_AttributeInteger* SALOMEDSImpl_AttributeInteger::Set (const DF_Label& L, int Val) { - Handle(SALOMEDSImpl_AttributeInteger) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) { + SALOMEDSImpl_AttributeInteger* A = NULL; + if (!(A = (SALOMEDSImpl_AttributeInteger*)L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { A = new SALOMEDSImpl_AttributeInteger(); L.AddAttribute(A); } @@ -53,11 +51,20 @@ Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const return A; } +//======================================================================= +//function : Value +//purpose : +//======================================================================= +int SALOMEDSImpl_AttributeInteger::Value() const +{ + return myValue; +} + //======================================================================= //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v) +void SALOMEDSImpl_AttributeInteger::SetValue(const int v) { if(myValue == v) return; @@ -71,14 +78,14 @@ void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeInteger::NewEmpty () const { return new SALOMEDSImpl_AttributeInteger(); } @@ -87,17 +94,36 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeInteger::Restore(DF_Attribute* With) { - myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value(); + myValue = dynamic_cast(With)->Value(); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeInteger::Paste (DF_Attribute* Into) { - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue); + dynamic_cast(Into)->SetValue(myValue); } + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeInteger::Save() +{ + char buffer[128]; + sprintf(buffer, "%d", myValue); + return string(buffer); +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeInteger::Load(const string& theValue) +{ + myValue = atoi(theValue.c_str()); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx index bcc84fadd..94751adfa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile #define _SALOMEDSImpl_AttributeInteger_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute ) - - class SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeInteger) Set (const TDF_Label& L, Standard_Integer Val); -Standard_EXPORT void SetValue(const Standard_Integer theVal); -Standard_EXPORT Standard_Integer Value() const { return myValue; } -Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); } - -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT static SALOMEDSImpl_AttributeInteger* Set (const DF_Label& L, int Val); +Standard_EXPORT void SetValue(const int theVal); +Standard_EXPORT int Value() const; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeInteger() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeInteger ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx index 15d80e4c9..7ee3b2302 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeLocalID.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID () +const std::string& SALOMEDSImpl_AttributeLocalID::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeLocalID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeLocalID* SALOMEDSImpl_AttributeLocalID::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeLocalID) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) { + SALOMEDSImpl_AttributeLocalID* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeLocalID*)L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { A = new SALOMEDSImpl_AttributeLocalID(); L.AddAttribute(A); } @@ -76,7 +72,7 @@ SALOMEDSImpl_AttributeLocalID::SALOMEDSImpl_AttributeLocalID() //function : Set //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeLocalID::SetValue(const int theValue) { CheckLocked(); @@ -93,7 +89,7 @@ void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue) //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); } //======================================================================= @@ -101,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID() //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeLocalID::NewEmpty () const { return new SALOMEDSImpl_AttributeLocalID(); } @@ -111,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeLocalID::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value(); + myValue = dynamic_cast(with)->Value(); } //======================================================================= @@ -121,9 +117,27 @@ void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeLocalID::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue); + dynamic_cast(into)->SetValue(myValue); +} + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeLocalID::Save() +{ + char buffer[128]; + sprintf(buffer, "%d", myValue); + return string(buffer); } +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeLocalID::Load(const string& theValue) +{ + myValue = atoi(theValue.c_str()); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx index 7d1dca361..2654146b4 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile #define _SALOMEDSImpl_AttributeLocalID_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute ) - - - class SALOMEDSImpl_AttributeLocalID : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); } +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeLocalID Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT void SetValue(const Standard_Integer value); -Standard_EXPORT Standard_Integer Value() const { return myValue; } +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeLocalID* Set(const DF_Label& label,const int value) ; +Standard_EXPORT void SetValue(const int value); +Standard_EXPORT int Value() const { return myValue; } Standard_EXPORT SALOMEDSImpl_AttributeLocalID(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute*); Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeLocalID ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx index e8b949a65..cd3546a01 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx @@ -26,24 +26,21 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeName::GetID () +const std::string& SALOMEDSImpl_AttributeName::GetID () { - static Standard_GUID NameID ("8650000D-63A0-4651-B621-CC95C9308598"); + static std::string NameID ("8650000D-63A0-4651-B621-CC95C9308598"); return NameID; } -Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeName* SALOMEDSImpl_AttributeName::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeName) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), A)) { + SALOMEDSImpl_AttributeName* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeName*)L.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { A = new SALOMEDSImpl_AttributeName(); L.AddAttribute(A); } @@ -56,7 +53,7 @@ Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_La //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeName::SetValue (const std::string& S) { CheckLocked(); @@ -74,13 +71,13 @@ void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeName::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeName::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeName::NewEmpty () const { return new SALOMEDSImpl_AttributeName(); } @@ -89,9 +86,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeName::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeName)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -99,8 +96,7 @@ void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeName::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeName)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx index 8d767cc6a..2bb858a68 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx @@ -24,48 +24,36 @@ #ifndef _SALOMEDSImpl_AttributeName_HeaderFile #define _SALOMEDSImpl_AttributeName_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute ) - - class SALOMEDSImpl_AttributeName : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeName) Set (const TDF_Label& L, const TCollection_ExtendedString& Val); -Standard_EXPORT void SetValue(const TCollection_ExtendedString& theVal); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } +Standard_EXPORT static SALOMEDSImpl_AttributeName* Set (const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue(const std::string& theVal); +Standard_EXPORT std::string Value() const { return myString; } -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeName() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeName ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx index 8c0722eac..de77ffac9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeOpened.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID () +const std::string& SALOMEDSImpl_AttributeOpened::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeOpenedID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeOpened) SALOMEDSImpl_AttributeOpened::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeOpened* SALOMEDSImpl_AttributeOpened::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeOpened) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID(),A)) { + SALOMEDSImpl_AttributeOpened* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeOpened*)L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID()))) { A = new SALOMEDSImpl_AttributeOpened(); L.AddAttribute(A); } @@ -76,7 +72,7 @@ SALOMEDSImpl_AttributeOpened::SALOMEDSImpl_AttributeOpened() //function : SetOpened //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeOpened::SetOpened(const int theValue) { Backup(); @@ -88,7 +84,7 @@ void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue) //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); } //======================================================================= @@ -96,7 +92,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeOpened::NewEmpty () const { return new SALOMEDSImpl_AttributeOpened(); } @@ -106,9 +102,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeOpened::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeOpened)::DownCast (with)->IsOpened (); + myValue = dynamic_cast(with)->IsOpened (); } //======================================================================= @@ -116,9 +112,8 @@ void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeOpened::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeOpened)::DownCast (into)->SetOpened (myValue); + dynamic_cast(into)->SetOpened (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx index b684e4310..8efd33901 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx @@ -24,42 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile #define _SALOMEDSImpl_AttributeOpened_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeOpened : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; } +Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeOpened Set(const TDF_Label& label,const Standard_Integer value) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeOpened* Set(const DF_Label& label,const int value) ; Standard_EXPORT SALOMEDSImpl_AttributeOpened(); -Standard_EXPORT void SetOpened(const Standard_Integer value); +Standard_EXPORT void SetOpened(const int value); Standard_EXPORT int IsOpened() const { return myValue; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeOpened() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeOpened ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx index 820643d35..121edf8af 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx @@ -23,7 +23,6 @@ #include "SALOMEDSImpl_AttributeParameter.hxx" -#include #include #include @@ -33,10 +32,6 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) - - // Purpose: Each character in the string is replaced by 3 characters: '%' and hex number // of the character (2 characters) string convertString(const string& S) @@ -86,9 +81,9 @@ string restoreString(const string& S) * Purpose : Returns GUID of the attribute */ //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID () +const std::string& SALOMEDSImpl_AttributeParameter::GetID () { - static Standard_GUID ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C"); + static std::string ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C"); return ParemeterID; } @@ -98,10 +93,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID () * Purpose : Adds an attribute to the label */ //======================================================================= -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeParameter) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), A)) { + SALOMEDSImpl_AttributeParameter* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) { A = new SALOMEDSImpl_AttributeParameter(); L.AddAttribute(A); } @@ -136,7 +131,7 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& the //======================================================================= int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID) { - if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_INTEGER)) throw DFexception("Invalid ID"); return _ints[theID]; } @@ -167,7 +162,7 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& //======================================================================= double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID) { - if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_REAL)) throw DFexception("Invalid ID"); return _reals[theID]; } @@ -198,7 +193,7 @@ void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const strin //======================================================================= string SALOMEDSImpl_AttributeParameter::GetString(const string& theID) { - if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_STRING)) throw DFexception("Invalid ID"); return _strings[theID]; } @@ -229,7 +224,7 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& t //======================================================================= bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID) { - if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_BOOLEAN)) throw DFexception("Invalid ID"); return _bools[theID]; } @@ -260,7 +255,7 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const ve //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID) { - if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_REALARRAY)) throw DFexception("Invalid ID"); return _realarrays[theID]; } @@ -292,7 +287,7 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vec //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID) { - if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_INTARRAY)) throw DFexception("Invalid ID"); return _intarrays[theID]; } @@ -324,7 +319,7 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vec //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID) { - if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_STRARRAY)) throw DFexception("Invalid ID"); return _strarrays[theID]; } @@ -427,15 +422,15 @@ bool SALOMEDSImpl_AttributeParameter::RemoveID(const string& theID, const Parame * Purpose : Returns a father attribute for this attribute */ //======================================================================= -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFather() +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::GetFather() { - Handle(SALOMEDSImpl_AttributeParameter) aFather; - TDF_Label L = Label(); + SALOMEDSImpl_AttributeParameter* aFather; + DF_Label L = Label(); if(L.IsRoot()) return aFather; while(!L.IsRoot()) { L = L.Father(); - if(L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), aFather)) break; + if((aFather=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) break; } return aFather; @@ -449,7 +444,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFath //======================================================================= bool SALOMEDSImpl_AttributeParameter::HasFather() { - TDF_Label L = Label(); + DF_Label L = Label(); if(L.IsRoot()) return false; while(!L.IsRoot()) { L = L.Father(); @@ -572,10 +567,10 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types the * Purpose : Rteurns an GUID of the attribute */ //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeParameter::NewEmpty () const { return new SALOMEDSImpl_AttributeParameter(); } @@ -586,9 +581,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const * Purpose : Restors the content of the attribute from another */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeParameter::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeParameter) A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast (with); + SALOMEDSImpl_AttributeParameter* A = dynamic_cast(with); _ints.clear(); _reals.clear(); _bools.clear(); @@ -619,8 +614,7 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) * Purpose : Pastes the content of attribute to another */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeParameter::Paste (DF_Attribute* into) { into->Restore(this); } @@ -631,7 +625,7 @@ void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into, * Purpose : Saves a content of the attribute as a string */ //======================================================================= -TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() +string SALOMEDSImpl_AttributeParameter::Save() { ostrstream buffer; char *tmpBuffer = new char[255]; @@ -692,7 +686,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() delete tmpBuffer; - TCollection_AsciiString AS((char*)buffer.rdbuf()->str()); + string AS((char*)buffer.rdbuf()->str()); return AS; } @@ -703,7 +697,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() * Purpose : Restores the attribute from the string */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theValue) +void SALOMEDSImpl_AttributeParameter::Load(const string& theValue) { Backup(); @@ -714,7 +708,7 @@ void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theVal _realarrays.clear(); _intarrays.clear(); - istrstream buffer(theValue.ToCString(), strlen(theValue.ToCString())); + istrstream buffer(theValue.c_str(), theValue.size()); int size, val, ival; double val2; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx index 8ac7116fc..ecbc14ec2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx @@ -24,24 +24,14 @@ #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile #define _SALOMEDSImpl_AttributeParameter_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" #include #include #include -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) - enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY}; /*! @@ -54,19 +44,19 @@ class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute private: - std::map _ints; - std::map _reals; - std::map _strings; - std::map _bools; - std::map< std::string, vector > _realarrays; - std::map< std::string, vector > _intarrays; - std::map< std::string, vector > _strarrays; + std::map _ints; + std::map _reals; + std::map _strings; + std::map _bools; + std::map< std::string, std::vector > _realarrays; + std::map< std::string, std::vector > _intarrays; + std::map< std::string, std::vector > _strarrays; public: - Standard_EXPORT static const Standard_GUID& GetID() ; + Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {} - Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L); + Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L); Standard_EXPORT void SetInt(const std::string& theID, const int& theValue); @@ -94,7 +84,7 @@ public: Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather(); + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather(); Standard_EXPORT bool HasFather(); Standard_EXPORT bool IsRoot(); @@ -102,18 +92,16 @@ public: Standard_EXPORT void Clear(); - Standard_EXPORT virtual TCollection_AsciiString Save(); - Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue); + Standard_EXPORT virtual std::string Save(); + Standard_EXPORT virtual void Load(const std::string& theValue); - Standard_EXPORT const Standard_GUID& ID() const; - Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; - Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; - Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; + Standard_EXPORT const std::string& ID() const; + Standard_EXPORT void Restore(DF_Attribute* with) ; + Standard_EXPORT DF_Attribute* NewEmpty() const; + Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx index 5ea1ce748..e60d05d22 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributePersistentRef.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID () +const std::string& SALOMEDSImpl_AttributePersistentRef::GetID () { - static Standard_GUID SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03"); + static std::string SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03"); return SALOMEDSImpl_AttributePersistentRefID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributePersistentRef) SALOMEDSImpl_AttributePersistentRef::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributePersistentRef* SALOMEDSImpl_AttributePersistentRef::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributePersistentRef) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),A)) { + SALOMEDSImpl_AttributePersistentRef* A = NULL; + if (!(A=(SALOMEDSImpl_AttributePersistentRef*)L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { A = new SALOMEDSImpl_AttributePersistentRef(); L.AddAttribute(A); } @@ -76,14 +72,14 @@ SALOMEDSImpl_AttributePersistentRef::SALOMEDSImpl_AttributePersistentRef() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); } //======================================================================= //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributePersistentRef::SetValue (const std::string& S) { CheckLocked(); @@ -101,7 +97,7 @@ void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedSt //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributePersistentRef::NewEmpty () const { return new SALOMEDSImpl_AttributePersistentRef(); } @@ -111,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePersistentRef::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -121,9 +117,8 @@ void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& w //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributePersistentRef::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx index 9a20377d8..fa95a619f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx @@ -24,44 +24,34 @@ #ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile #define _SALOMEDSImpl_AttributePersistentRef_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributePersistentRef : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributePersistentRef Set(const TDF_Label& label, - const TCollection_ExtendedString& string) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePersistentRef* Set(const DF_Label& label, + const std::string& value) ; Standard_EXPORT SALOMEDSImpl_AttributePersistentRef(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void SetValue(const TCollection_ExtendedString& value); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePersistentRef() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePersistentRef ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx index 665983445..300bd6bd5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx @@ -22,22 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributePixMap.hxx" -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID () +const std::string& SALOMEDSImpl_AttributePixMap::GetID () { - static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributePixMapID; } @@ -48,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributePixMap* SALOMEDSImpl_AttributePixMap::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributePixMap) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) { + SALOMEDSImpl_AttributePixMap* A = NULL; + if (!(A=(SALOMEDSImpl_AttributePixMap*)L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID()))) { A = new SALOMEDSImpl_AttributePixMap(); L.AddAttribute(A); } @@ -76,7 +71,7 @@ SALOMEDSImpl_AttributePixMap::SALOMEDSImpl_AttributePixMap() //function : SetPixMap //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributePixMap::SetPixMap (const std::string& S) { CheckLocked(); @@ -94,7 +89,7 @@ void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); } //======================================================================= @@ -102,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributePixMap::NewEmpty () const { return new SALOMEDSImpl_AttributePixMap(); } @@ -112,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePixMap::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap (); + myString = dynamic_cast(with)->GetPixMap (); } //======================================================================= @@ -122,9 +117,8 @@ void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributePixMap::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString); + dynamic_cast(into)->SetPixMap (myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx index f4b38c9ef..ac0fcbd33 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx @@ -24,47 +24,34 @@ #ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile #define _SALOMEDSImpl_AttributePixMap_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute ) - - - class SALOMEDSImpl_AttributePixMap : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributePixMap Set(const TDF_Label& label, - const TCollection_ExtendedString& string) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePixMap* Set(const DF_Label& label, + const std::string& string) ; Standard_EXPORT SALOMEDSImpl_AttributePixMap(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void SetPixMap(const TCollection_ExtendedString& value); -Standard_EXPORT TCollection_ExtendedString GetPixMap() const { return myString; } -Standard_EXPORT Standard_Boolean HasPixMap() const { return (myString != "None"); } -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void SetPixMap(const std::string& value); +Standard_EXPORT std::string GetPixMap() const { return myString; } +Standard_EXPORT bool HasPixMap() const { return (myString != "None"); } +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePixMap() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePixMap ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx index 7267b3dfa..cfd38f459 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx @@ -22,36 +22,32 @@ // Module : SALOME #include "SALOMEDSImpl_AttributePythonObject.hxx" -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute ) - -const Standard_GUID& SALOMEDSImpl_AttributePythonObject::GetID() +const std::string& SALOMEDSImpl_AttributePythonObject::GetID() { - static Standard_GUID SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributePythonObjectID; } -Handle(SALOMEDSImpl_AttributePythonObject) SALOMEDSImpl_AttributePythonObject::Set(const TDF_Label& label) +SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributePythonObject) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributePythonObject(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributePythonObject* A = NULL; + if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) { + A = new SALOMEDSImpl_AttributePythonObject(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject() :SALOMEDSImpl_GenericAttribute("AttributePythonObject") { + myIsScript = false; } -void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence, +void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence, const bool theScript) { CheckLocked(); @@ -62,7 +58,7 @@ void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::GetObject() const +string SALOMEDSImpl_AttributePythonObject::GetObject() const { return mySequence; } @@ -74,44 +70,43 @@ bool SALOMEDSImpl_AttributePythonObject::IsScript() const int SALOMEDSImpl_AttributePythonObject::GetLength() const { - return mySequence.Length(); + return mySequence.size(); } -const Standard_GUID& SALOMEDSImpl_AttributePythonObject::ID() const +const std::string& SALOMEDSImpl_AttributePythonObject::ID() const { return GetID(); } -void SALOMEDSImpl_AttributePythonObject::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(with); + SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast(with); SetObject(anObj->GetObject(),anObj->IsScript()); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributePythonObject::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const { return new SALOMEDSImpl_AttributePythonObject(); } -void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(into); + SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast(into); anObj->SetObject(GetObject(),IsScript()); } -TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save() +string SALOMEDSImpl_AttributePythonObject::Save() { - TCollection_AsciiString aString = GetObject(); - TCollection_AsciiString aResult = IsScript()?'s':'n'; + string aString = GetObject(); + string aResult = IsScript()?"s":"n"; aResult += aString; return aResult; } -void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributePythonObject::Load(const string& value) { - char* aString = value.ToCString(); + char* aString = (char*)value.c_str(); SetObject(aString + 1, aString[0]=='s'); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx index 84810f8f3..bda55e4fa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx @@ -24,20 +24,11 @@ #ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile #define _SALOMEDSImpl_AttributePythonObject_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute ) - #ifdef GetObject #undef GetObject #endif @@ -46,30 +37,27 @@ class SALOMEDSImpl_AttributePythonObject : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributePythonObject Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePythonObject* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributePythonObject(); -Standard_EXPORT void SetObject(const TCollection_AsciiString& theSequence, const bool theScript) ; -Standard_EXPORT TCollection_AsciiString GetObject() const; +Standard_EXPORT void SetObject(const std::string& theSequence, const bool theScript) ; +Standard_EXPORT std::string GetObject() const; Standard_EXPORT bool IsScript() const; Standard_EXPORT int GetLength() const; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePythonObject() {} private: -TCollection_AsciiString mySequence; +std::string mySequence; bool myIsScript; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePythonObject ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx index d8bef6b58..644ee77b9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx @@ -25,23 +25,23 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute ) +#include + //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID () +const std::string& SALOMEDSImpl_AttributeReal::GetID () { - static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB"); + static std::string realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB"); return realID; } -Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val) +SALOMEDSImpl_AttributeReal* SALOMEDSImpl_AttributeReal::Set (const DF_Label& L, const double& Val) { - Handle(SALOMEDSImpl_AttributeReal) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) { + SALOMEDSImpl_AttributeReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeReal*)L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID()))) { A = new SALOMEDSImpl_AttributeReal(); L.AddAttribute(A); } @@ -54,7 +54,7 @@ Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_La //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v) +void SALOMEDSImpl_AttributeReal::SetValue(const double& v) { CheckLocked(); @@ -70,7 +70,7 @@ void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const +const std::string& SALOMEDSImpl_AttributeReal::ID () const { return GetID(); } @@ -79,7 +79,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeReal::NewEmpty () const { return new SALOMEDSImpl_AttributeReal(); } @@ -88,17 +88,36 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeReal::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value (); + myValue = dynamic_cast(with)->Value (); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeReal::Paste (DF_Attribute* into) +{ + dynamic_cast(into)->SetValue(myValue); +} + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeReal::Save() +{ + char buffer[255]; + sprintf(buffer, "%.64e", myValue); + return string(buffer); +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeReal::Load(const string& theValue) { - Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue); + myValue = atof(theValue.c_str()); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx index 2a3d51a06..488f3bfe8 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeReal_HeaderFile #define _SALOMEDSImpl_AttributeReal_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute ) - - class SALOMEDSImpl_AttributeReal : public SALOMEDSImpl_GenericAttribute { private: - Standard_Real myValue; + double myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReal) Set (const TDF_Label& L, const Standard_Real Val); -Standard_EXPORT void SetValue(const Standard_Real theVal); -Standard_EXPORT Standard_Real Value() const { return myValue; } -Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.RealValue(); } - -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT static SALOMEDSImpl_AttributeReal* Set (const DF_Label& L, const double& Val); +Standard_EXPORT void SetValue(const double& theVal); +Standard_EXPORT double Value() const { return myValue; } +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeReal() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReal ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx index 54c8fe536..f267e0b93 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx @@ -22,31 +22,24 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeReference.hxx" -#include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute ) - - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReference::GetID () +const std::string& SALOMEDSImpl_AttributeReference::GetID () { - static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86"); + static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86"); return refID; } -Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel, - const TDF_Label& theRefLabel) +SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel, + const DF_Label& theRefLabel) { - Handle(SALOMEDSImpl_AttributeReference) A; - if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) { + SALOMEDSImpl_AttributeReference* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { A = new SALOMEDSImpl_AttributeReference(); theLabel.AddAttribute(A); } @@ -59,7 +52,7 @@ Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(con //function : Set //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin) +void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin) { CheckLocked(); @@ -75,28 +68,24 @@ void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); } -TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save() +string SALOMEDSImpl_AttributeReference::Save() { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(myLabel, anEntry); - return anEntry; + return myLabel.Entry(); } -void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeReference::Load(const string& value) { - TDF_Label aLabel; - TDF_Tool::Label(Label().Data(), value, aLabel); - myLabel = aLabel; + myLabel = DF_Label::Label(Label(), value, true); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const { return new SALOMEDSImpl_AttributeReference(); } @@ -106,9 +95,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With) { - myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get (); + myLabel = dynamic_cast(With)->Get (); } //======================================================================= @@ -116,12 +105,7 @@ void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into) { - TDF_Label tLab; - if (!myLabel.IsNull()) { - if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel; - } - Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab); + dynamic_cast(Into)->Set(myLabel); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx index 892fea708..4c69dee7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx @@ -24,46 +24,33 @@ #ifndef _SALOMEDSImpl_AttributeReference_HeaderFile #define _SALOMEDSImpl_AttributeReference_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute ) - - - class SALOMEDSImpl_AttributeReference : public SALOMEDSImpl_GenericAttribute { private: - TDF_Label myLabel; + DF_Label myLabel; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReference) Set(const TDF_Label& theLabel, const TDF_Label& theRefLabel); -Standard_EXPORT void Set(const TDF_Label& theLabel); -Standard_EXPORT TDF_Label Get() const { return myLabel; } -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue); +Standard_EXPORT static SALOMEDSImpl_AttributeReference* Set(const DF_Label& theLabel, const DF_Label& theRefLabel); +Standard_EXPORT void Set(const DF_Label& theLabel); +Standard_EXPORT DF_Label Get() const { return myLabel; } +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeReference() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReference ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx index 4e1bbc768..3b2e36ebe 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx @@ -22,21 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSelectable.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID () +const std::string& SALOMEDSImpl_AttributeSelectable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSelectableID; } @@ -47,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeSelectable* SALOMEDSImpl_AttributeSelectable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeSelectable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID(),A)) { + SALOMEDSImpl_AttributeSelectable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeSelectable*)L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID()))) { A = new SALOMEDSImpl_AttributeSelectable(); L.AddAttribute(A); } @@ -75,7 +71,7 @@ SALOMEDSImpl_AttributeSelectable::SALOMEDSImpl_AttributeSelectable() //function : SetSelectable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeSelectable::SetSelectable(const int theValue) { Backup(); @@ -87,7 +83,7 @@ void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theV //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); } //======================================================================= @@ -95,7 +91,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetI //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSelectable::NewEmpty () const { return new SALOMEDSImpl_AttributeSelectable(); } @@ -105,9 +101,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSelectable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (with)->IsSelectable (); + myValue = dynamic_cast(with)->IsSelectable (); } //======================================================================= @@ -115,9 +111,8 @@ void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeSelectable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (into)->SetSelectable (myValue); + dynamic_cast(into)->SetSelectable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx index 28fa2a2cb..dfdc71871 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx @@ -24,45 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile #define _SALOMEDSImpl_AttributeSelectable_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute ) - - - class SALOMEDSImpl_AttributeSelectable : public SALOMEDSImpl_GenericAttribute { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; } +Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; } -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSelectable Set(const TDF_Label& label,const Standard_Integer value) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSelectable* Set(const DF_Label& label,const int value) ; Standard_EXPORT SALOMEDSImpl_AttributeSelectable(); -Standard_EXPORT void SetSelectable(const Standard_Integer value); -Standard_EXPORT Standard_Integer IsSelectable() const { return myValue; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void SetSelectable(const int value); +Standard_EXPORT int IsSelectable() const { return myValue; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSelectable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx index 8519394a9..8a697a3da 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx @@ -22,22 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute ) - - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID () +const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSequenceOfIntegerID; } @@ -48,10 +43,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOfInteger::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeSequenceOfInteger* SALOMEDSImpl_AttributeSequenceOfInteger::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID(),A)) { + SALOMEDSImpl_AttributeSequenceOfInteger* A = NULL; + if (!(A = (SALOMEDSImpl_AttributeSequenceOfInteger*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID()))) { A = new SALOMEDSImpl_AttributeSequenceOfInteger(); L.AddAttribute(A); } @@ -65,16 +60,14 @@ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOf //======================================================================= SALOMEDSImpl_AttributeSequenceOfInteger::SALOMEDSImpl_AttributeSequenceOfInteger() :SALOMEDSImpl_GenericAttribute("AttributeSequenceOfInteger") -{ - myValue = new TColStd_HSequenceOfInteger(); -} +{} //======================================================================= //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); } //======================================================================= @@ -82,7 +75,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { retu //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const { return new SALOMEDSImpl_AttributeSequenceOfInteger(); } @@ -92,18 +85,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(DF_Attribute* with) { - Standard_Integer i; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfInteger(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); - return; + SALOMEDSImpl_AttributeSequenceOfInteger* anSeq = dynamic_cast(with); + myValue.clear(); + for(int i = 0, len = anSeq->Length(); imyValue[i]); } //======================================================================= @@ -111,96 +98,97 @@ void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (DF_Attribute* into) { - if(!myValue.IsNull()) { - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast (into)->Assign(myValue); - } + dynamic_cast(into)->Assign(myValue); } -void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const Handle(TColStd_HSequenceOfInteger)& other) +void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const vector& other) { CheckLocked(); Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger; - myValue->ChangeSequence() = other->Sequence(); + myValue = other; + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const Standard_Integer Index,const Standard_Integer Value) +void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const int Index,const int Value) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->SetValue(Index, Value); + myValue[Index-1] = Value; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const Standard_Integer Value) +void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const int Value) { CheckLocked(); Backup(); - myValue->Append(Value); + myValue.push_back(Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Index) +void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const int Index) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + + typedef vector::iterator VI; + int i = 1; + for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) { + if(i == Index) { + myValue.erase(p); + break; + } + } - myValue->Remove(Index); - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length() +int SALOMEDSImpl_AttributeSequenceOfInteger::Length() { - return myValue->Length(); + return myValue.size(); } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index) +int SALOMEDSImpl_AttributeSequenceOfInteger::Value(const int Index) { - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - return myValue->Value(Index); + return myValue[Index-1]; } -TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfInteger::Save() +string SALOMEDSImpl_AttributeSequenceOfInteger::Save() { - Standard_Integer aLength = Length(); + int aLength = Length(); char* aResult = new char[aLength * 25]; aResult[0] = 0; - Standard_Integer aPosition = 0; + int aPosition = 0; for (int i = 1; i <= aLength; i++) { sprintf(aResult + aPosition , "%d ", Value(i)); aPosition += strlen(aResult + aPosition); } - TCollection_AsciiString ret(aResult); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const string& value) { - Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger; - - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); while (adr) { int l = atol(adr); - CasCadeSeq->Append(l); + Add(l); adr = strtok(NULL, " "); } - Assign(CasCadeSeq); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx index 574df6871..f1f935b4d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx @@ -24,50 +24,38 @@ #ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile #define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeSequenceOfInteger : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfInteger Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfInteger* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfInteger(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ; -Standard_EXPORT void Add(const Standard_Integer value) ; -Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void Assign(const std::vector& other) ; +Standard_EXPORT void ChangeValue(const int Index,const int Value) ; +Standard_EXPORT void Add(const int value) ; +Standard_EXPORT int Value(const int Index) ; +Standard_EXPORT void Remove(const int Index) ; +Standard_EXPORT int Length() ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfInteger() {} +Standard_EXPORT const std::vector& Array() { return myValue; } private: - -Handle_TColStd_HSequenceOfInteger myValue; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfInteger ) - +std::vector myValue; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx index 3d78ec633..8b034c995 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx @@ -22,21 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSequenceOfReal.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID () +const std::string& SALOMEDSImpl_AttributeSequenceOfReal::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSequenceOfRealID; } @@ -47,10 +43,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfReal::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeSequenceOfReal* SALOMEDSImpl_AttributeSequenceOfReal::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeSequenceOfReal) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID(),A)) { + SALOMEDSImpl_AttributeSequenceOfReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeSequenceOfReal*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID()))) { A = new SALOMEDSImpl_AttributeSequenceOfReal(); L.AddAttribute(A); } @@ -65,7 +61,7 @@ Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfRea SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal() :SALOMEDSImpl_GenericAttribute("AttributeSequenceOfReal") { - myValue = new TColStd_HSequenceOfReal(); + myValue.clear(); } //======================================================================= @@ -73,7 +69,7 @@ SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); } //======================================================================= @@ -81,7 +77,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const { return new SALOMEDSImpl_AttributeSequenceOfReal(); } @@ -91,17 +87,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSequenceOfReal::Restore(DF_Attribute* with) { - Standard_Integer i; - Handle(SALOMEDSImpl_AttributeSequenceOfReal) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfReal(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); + SALOMEDSImpl_AttributeSequenceOfReal* anSeq = dynamic_cast(with); + myValue.clear(); + for(int i = 0, len = anSeq->Length(); imyValue[i]); return; } @@ -110,96 +101,97 @@ void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfReal::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeSequenceOfReal::Paste (DF_Attribute* into) { - if(!myValue.IsNull()) { - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast (into)->Assign(myValue); - } + dynamic_cast(into)->Assign(myValue); } -void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const Handle(TColStd_HSequenceOfReal)& other) +void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const vector& other) { CheckLocked(); Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal; - myValue->ChangeSequence() = other->Sequence(); + myValue = other; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const Standard_Integer Index,const Standard_Real Value) +void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const int Index,const double& Value) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->SetValue(Index, Value); + myValue[Index-1] = Value; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfReal::Add(const Standard_Real Value) +void SALOMEDSImpl_AttributeSequenceOfReal::Add(const double& Value) { CheckLocked(); Backup(); - myValue->Append(Value); + myValue.push_back(Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index) +void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const int Index) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->Remove(Index); - - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved + typedef vector::iterator VI; + int i = 1; + for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) { + if(i == Index) { + myValue.erase(p); + break; + } + } + + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length() +int SALOMEDSImpl_AttributeSequenceOfReal::Length() { - return myValue->Length(); + return myValue.size(); } -Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index) +double SALOMEDSImpl_AttributeSequenceOfReal::Value(const int Index) { - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); - return myValue->Value(Index); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + return myValue[Index-1]; } -TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfReal::Save() +string SALOMEDSImpl_AttributeSequenceOfReal::Save() { - Standard_Integer aLength = Length(); - char* aResult = new char[aLength * 25]; + int aLength = Length(); + char* aResult = new char[aLength * 127]; aResult[0] = 0; - Standard_Integer aPosition = 0; + int aPosition = 0; for (int i = 1; i <= aLength; i++) { - sprintf(aResult + aPosition , "%f ", Value(i)); + sprintf(aResult + aPosition , "%.64e ", Value(i)); aPosition += strlen(aResult + aPosition); } - TCollection_AsciiString ret(aResult); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeSequenceOfReal::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeSequenceOfReal::Load(const string& value) { - Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); char *err = NULL; while (adr) { - Standard_Real r = strtod(adr, &err); - CasCadeSeq->Append(r); + double r = strtod(adr, &err); + Add(r); adr = strtok(NULL, " "); } - Assign(CasCadeSeq); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx index 273b67b26..10ebdf846 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx @@ -24,48 +24,39 @@ #ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile #define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeSequenceOfReal : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfReal Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfReal* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfReal(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ; -Standard_EXPORT void Add(const Standard_Real Value) ; -Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void Assign(const std::vector& other) ; +Standard_EXPORT void ChangeValue(const int Index,const double& Value) ; +Standard_EXPORT void Add(const double& Value) ; +Standard_EXPORT double Value(const int Index) ; +Standard_EXPORT void Remove(const int Index) ; +Standard_EXPORT int Length() ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfReal() {} +Standard_EXPORT const std::vector& Array() { return myValue; } private: -Handle_TColStd_HSequenceOfReal myValue; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfReal ) +std::vector myValue; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx index 7a7ee76a9..9bdc26b23 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -27,24 +27,21 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeString::GetID () +const std::string& SALOMEDSImpl_AttributeString::GetID () { - static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); + static std::string CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); return CommentID; } -Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeString* SALOMEDSImpl_AttributeString::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeString) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) { + SALOMEDSImpl_AttributeString* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeString*)L.FindAttribute(SALOMEDSImpl_AttributeString::GetID()))) { A = new SALOMEDSImpl_AttributeString(); L.AddAttribute(A); } @@ -58,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TD //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeString::SetValue (const std::string& S) { CheckLocked(); @@ -76,13 +73,13 @@ void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeString::NewEmpty () const { return new SALOMEDSImpl_AttributeString(); } @@ -91,9 +88,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeString::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -101,8 +98,7 @@ void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeString::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx index ec0711106..2f7bb8587 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx @@ -24,47 +24,37 @@ #ifndef _SALOMEDSImpl_AttributeString_HeaderFile #define _SALOMEDSImpl_AttributeString_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) Set(const TDF_Label& L, const TCollection_ExtendedString& Val); -Standard_EXPORT void SetValue (const TCollection_ExtendedString& S); -Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } - -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT static SALOMEDSImpl_AttributeString* Set(const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue (const std::string& S); +Standard_EXPORT std::string Value() const { return myString; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeString() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx index b25d2fa02..a70e8a413 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx @@ -22,56 +22,51 @@ // Module : SALOME #include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) -const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID() +const std::string& SALOMEDSImpl_AttributeStudyProperties::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeStudyPropertiesID; } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_AttributeStudyProperties::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeStudyProperties* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeStudyProperties*)label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID()))) { + A = new SALOMEDSImpl_AttributeStudyProperties(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties() :SALOMEDSImpl_GenericAttribute("AttributeStudyProperties") { - myLocked = Standard_False; - myLockChanged = Standard_False; + myLocked = false; + myLockChanged = false; Init(); } void SALOMEDSImpl_AttributeStudyProperties::Init() { - myUserName = new TColStd_HSequenceOfExtendedString(); - myMinute = new TColStd_HSequenceOfInteger(); - myHour = new TColStd_HSequenceOfInteger(); - myDay = new TColStd_HSequenceOfInteger(); - myMonth = new TColStd_HSequenceOfInteger(); - myYear = new TColStd_HSequenceOfInteger(); -// myModified = 0; + myUserName.clear(); + myMinute.clear(); + myHour.clear(); + myDay.clear(); + myMonth.clear(); + myYear.clear(); myMode = 0; // none } -void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_ExtendedString& theUserName, - const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) +void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName, + const int theMinute, + const int theHour, + const int theDay, + const int theMonth, + const int theYear) { if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) @@ -80,21 +75,21 @@ void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_Ex CheckLocked(); Backup(); - myUserName->Append(theUserName); - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); + myUserName.push_back(theUserName); + myMinute.push_back(theMinute); + myHour.push_back(theHour); + myDay.push_back(theDay); + myMonth.push_back(theMonth); + myYear.push_back(theYear); } void SALOMEDSImpl_AttributeStudyProperties::GetModifications - (Handle(TColStd_HSequenceOfExtendedString)& theUserNames, - Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const + (vector& theUserNames, + vector& theMinutes, + vector& theHours, + vector& theDays, + vector& theMonths, + vector& theYears) const { theUserNames = myUserName; theMinutes = myMinute; @@ -104,131 +99,130 @@ void SALOMEDSImpl_AttributeStudyProperties::GetModifications theYears = myYear; } -TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const +std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const { - if (myUserName->Length() == 0) - return TCollection_ExtendedString(""); - return myUserName->Value(1); + if (myUserName.size() == 0) + return std::string(""); + return myUserName[0]; } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate - (Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const +bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate + (int& theMinute, + int& theHour, + int& theDay, + int& theMonth, + int& theYear) const { - if (myMinute->Length() != 0) { - theMinute = myMinute->Value(1); - theHour = myHour->Value(1); - theDay = myDay->Value(1); - theMonth = myMonth->Value(1); - theYear = myYear->Value(1); - return Standard_True; + if (myMinute.size() != 0) { + theMinute = myMinute[0]; + theHour = myHour[0]; + theDay = myDay[0]; + theMonth = myMonth[0]; + theYear = myYear[0]; + return true; } - return Standard_False; + return false; } -void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName) +void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const std::string& theName) { - if (myUserName->Length() > 0) { + if (myUserName.size() > 0) { CheckLocked(); Backup(); - myUserName->SetValue(1, theName); + myUserName[0] = theName; } } -void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode) +void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode) { CheckLocked(); Backup(); myMode = theMode; } -Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const +int SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const { return myMode; } -void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified) +void SALOMEDSImpl_AttributeStudyProperties::SetModified(const int theModified) { myModified = theModified; } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsModified() const +bool SALOMEDSImpl_AttributeStudyProperties::IsModified() const { return (myModified != 0); } -Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const +int SALOMEDSImpl_AttributeStudyProperties::GetModified() const { return myModified; } -void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked) +void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const bool theLocked) { // Backup(); if (myLocked != theLocked) { - myLockChanged = Standard_True; + myLockChanged = true; myLocked = theLocked; } } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLocked() const +bool SALOMEDSImpl_AttributeStudyProperties::IsLocked() const { return myLocked; } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const Standard_Boolean theErase) { - if (!myLockChanged) return Standard_False; - if (theErase) myLockChanged = Standard_False; - return Standard_True; +bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) { + if (!myLockChanged) return false; + if (theErase) myLockChanged = false; + return true; } -const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const +const std::string& SALOMEDSImpl_AttributeStudyProperties::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with); + SALOMEDSImpl_AttributeStudyProperties* aProp = + dynamic_cast(with); + Init(); - Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - for (i = aNames->Length(); i > 0; i--) { - myUserName->Prepend(aNames->Value(i)); - myMinute->Prepend(aMinutes->Value(i)); - myHour->Prepend(aHours->Value(i)); - myDay->Prepend(aDays->Value(i)); - myMonth->Prepend(aMonths->Value(i)); - myYear->Prepend(aYears->Value(i)); + for (int i = 0, len = aNames.size(); i < len; i++) { + myUserName.push_back(aNames[i]); + myMinute.push_back(aMinutes[i]); + myHour.push_back(aHours[i]); + myDay.push_back(aDays[i]); + myMonth.push_back(aMonths[i]); + myYear.push_back(aYears[i]); } myMode = aProp->GetCreationMode(); // myModified = aProp->GetModified(); // myLocked = aProp->IsLocked(); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const { return new SALOMEDSImpl_AttributeStudyProperties(); } -void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeStudyProperties::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into); + SALOMEDSImpl_AttributeStudyProperties* aProp = + dynamic_cast(into); aProp->Init(); - Standard_Integer i; - for(i = 1; i <= myUserName->Length(); i++) { - aProp->SetModification(myUserName->Value(i), - myMinute->Value(i), myHour->Value(i), - myDay->Value(i), myMonth->Value(i), myYear->Value(i)); + int i; + for(i = 0; i < myUserName.size(); i++) { + aProp->SetModification(myUserName[i], + myMinute[i], myHour[i], + myDay[i], myMonth[i], myYear[i]); } aProp->SetCreationMode(myMode); @@ -237,53 +231,53 @@ void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& i } -TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() +string SALOMEDSImpl_AttributeStudyProperties::Save() { - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); int aLength, anIndex; - for (aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--) - aLength += aNames->Value(anIndex).Length() + 1; + for (aLength = 0, anIndex = aNames.size()-1; anIndex >= 0; anIndex--) + aLength += aNames[anIndex].size() + 1; - char* aProperty = new char[3 + aLength + 12 * aNames->Length()]; + char* aProperty = new char[3 + aLength + 12 * aNames.size()]; char crMode = (char)GetCreationMode(); sprintf(aProperty,"%c%c", crMode, IsLocked()?'l':'u'); - aLength = aNames->Length(); + aLength = aNames.size(); int a = 2; - for (anIndex = 1; anIndex <= aLength; anIndex++) { + for (anIndex = 0; anIndex < aLength; anIndex++) { sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s", - (int)(aMinutes->Value(anIndex)), - (int)(aHours->Value(anIndex)), - (int)(aDays->Value(anIndex)), - (int)(aMonths->Value(anIndex)), - (int)(aYears->Value(anIndex)), - (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString())); + (int)(aMinutes[anIndex]), + (int)(aHours[anIndex]), + (int)(aDays[anIndex]), + (int)(aMonths[anIndex]), + (int)(aYears[anIndex]), + (char*)(aNames[anIndex].c_str())); a = strlen(aProperty); aProperty[a++] = 1; } aProperty[a] = 0; - TCollection_AsciiString prop(aProperty); + string prop(aProperty); delete aProperty; return prop; } -void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeStudyProperties::Load(const string& value) { - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); int crMode = (int)aCopy[0]; SetCreationMode(crMode); int anIndex; - for (anIndex = 2; anIndex + 2 < value.Length() ;) { + for (anIndex = 2; anIndex + 2 < value.size() ;) { char str[10]; - Standard_Integer aMinute, aHour, aDay, aMonth, aYear; + int aMinute, aHour, aDay, aMonth, aYear; str[0] = aCopy[anIndex++]; str[1] = aCopy[anIndex++]; str[2] = 0; @@ -314,7 +308,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& anIndex += aNameSize + 1; } if (aCopy[1] == 'l') { - SetLocked(Standard_True); + SetLocked(true); } SetModified(0); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx index 4d0dbc450..c520bce61 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx @@ -24,92 +24,77 @@ #ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile #define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) - -#include -#include - class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute { public: Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties(); Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {} -Standard_EXPORT static const Standard_GUID& GetID(); -Standard_EXPORT const Standard_GUID& ID() const; +Standard_EXPORT static const std::string& GetID(); +Standard_EXPORT const std::string& ID() const; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_Label& label); +Standard_EXPORT static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_Label& label); Standard_EXPORT void Init(); -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); - -Standard_EXPORT void SetModification(const TCollection_ExtendedString& theUserName, - const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear); -Standard_EXPORT void GetModifications(Handle(TColStd_HSequenceOfExtendedString)& theUserNames, - Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const; - -Standard_EXPORT TCollection_ExtendedString GetCreatorName() const; -Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const; - -Standard_EXPORT void ChangeCreatorName(const TCollection_ExtendedString& theUserName); - -Standard_EXPORT void SetCreationMode(const Standard_Integer theMode); -Standard_EXPORT Standard_Integer GetCreationMode() const; - -Standard_EXPORT void SetModified(const Standard_Integer theModified); -Standard_EXPORT Standard_Boolean IsModified() const; -Standard_EXPORT Standard_Integer GetModified() const; - -Standard_EXPORT void SetLocked(const Standard_Boolean theLocked); -Standard_EXPORT Standard_Boolean IsLocked() const; -Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase); - -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with); -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); + +Standard_EXPORT void SetModification(const std::string& theUserName, + const int theMinute, + const int theHour, + const int theDay, + const int theMonth, + const int theYear); +Standard_EXPORT void GetModifications(std::vector& theUserNames, + std::vector& theMinutes, + std::vector& theHours, + std::vector& theDays, + std::vector& theMonths, + std::vector& theYears) const; + +Standard_EXPORT std::string GetCreatorName() const; +Standard_EXPORT bool GetCreationDate(int& theMinute, + int& theHour, + int& theDay, + int& theMonth, + int& theYear) const; + +Standard_EXPORT void ChangeCreatorName(const std::string& theUserName); + +Standard_EXPORT void SetCreationMode(const int theMode); +Standard_EXPORT int GetCreationMode() const; + +Standard_EXPORT void SetModified(const int theModified); +Standard_EXPORT bool IsModified() const; +Standard_EXPORT int GetModified() const; + +Standard_EXPORT void SetLocked(const bool theLocked); +Standard_EXPORT bool IsLocked() const; +Standard_EXPORT bool IsLockChanged(const bool theErase); + +Standard_EXPORT void Restore(DF_Attribute* with); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); private: -Handle_TColStd_HSequenceOfExtendedString myUserName; -Handle_TColStd_HSequenceOfInteger myMinute; -Handle_TColStd_HSequenceOfInteger myHour; -Handle_TColStd_HSequenceOfInteger myDay; -Handle_TColStd_HSequenceOfInteger myMonth; -Handle_TColStd_HSequenceOfInteger myYear; -Standard_Integer myMode; -Standard_Integer myModified; -Standard_Boolean myLocked; -Standard_Boolean myLockChanged; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeStudyProperties ) +std::vector myUserName; +std::vector myMinute; +std::vector myHour; +std::vector myDay; +std::vector myMonth; +std::vector myYear; +int myMode; +int myModified; +bool myLocked; +bool myLockChanged; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx index 955a6fe1a..0539b5e81 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx @@ -21,92 +21,84 @@ // Author : Michael Ponikarov // Module : SALOME -#include -#include -#include -#include -#include +#include "SALOMEDSImpl_AttributeTableOfInteger.hxx" +#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) - #define SEPARATOR '\1' +typedef map::const_iterator MI; -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + if(aPos == 0) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfIntegerID; } -Handle(SALOMEDSImpl_AttributeTableOfInteger) SALOMEDSImpl_AttributeTableOfInteger::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfInteger* SALOMEDSImpl_AttributeTableOfInteger::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfInteger) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfInteger(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfInteger* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfInteger*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfInteger(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributeTableOfInteger::SALOMEDSImpl_AttributeTableOfInteger() :SALOMEDSImpl_GenericAttribute("AttributeTableOfInteger") { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); myNbRows = 0; myNbColumns = 0; } -void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const Standard_Integer theNbColumns) +void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - TColStd_DataMapOfIntegerInteger aMap; + map aMap; aMap = myTable; - myTable.Clear(); + myTable.clear(); - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); + + for(MI p = aMap.begin(); p != aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(std::string("")); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -115,26 +107,26 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedSt SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const { return myTitle; } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfInteger)& theData) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -142,113 +134,113 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer the SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0); + aSeq.push_back(0); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const Standard_Integer theRow, - const TCollection_ExtendedString& theUnit) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const vector& theUnits) { - if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theUnits->Length(), i; - for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits() +vector SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& theTitles) { - if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles() +vector SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfInteger)& theData) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(std::string("")); } } @@ -256,80 +248,79 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer } -Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; + vector aSeq; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0); + aSeq.push_back(0); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const vector& theTitles) { - if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles() +vector SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myCols->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,41 +328,42 @@ void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const Standard_Integer theVa SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Boolean SALOMEDSImpl_AttributeTableOfInteger::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +bool SALOMEDSImpl_AttributeTableOfInteger::HasValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) return Standard_False; - if(theColumn > myNbColumns || theColumn < 1) return Standard_False; - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +int SALOMEDSImpl_AttributeTableOfInteger::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); + throw DFexception("Invalid cell index"); return 0; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfInteger::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfInteger::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(with); + if(!aTable) throw DFexception("Can't Restore from a null attribute"); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -379,26 +371,26 @@ void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfInteger(); } -void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfInteger::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(into); + if(!aTable) throw DFexception("Can't Paste into a null attribute"); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -406,156 +398,141 @@ void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& in aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfInteger::Save() { + ostrstream theStream; int i, j, l; theStream.precision(64); //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jfirst << "\n"; + theStream << p->second << "\n"; } - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfInteger::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfInteger::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); int i, j, l; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); + myRows.clear(); for(i=1; i<=myNbRows; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); + myCols.clear(); for(i=1; i<=myNbColumns; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values theStream >> l; - myTable.Clear(); + myTable.clear(); for(i=1; i<=l; i++) { int aKey, aValue; theStream >> aKey; theStream >> aValue; - myTable.Bind(aKey, aValue); + myTable[aKey] = aValue; } - - return true; -} - - -TCollection_AsciiString SALOMEDSImpl_AttributeTableOfInteger::Save() -{ - ostrstream ostr; - ConvertToString(ostr); - TCollection_AsciiString aString((char*)ostr.rdbuf()->str()); - return aString; -} - -void SALOMEDSImpl_AttributeTableOfInteger::Load(const TCollection_AsciiString& value) -{ - istrstream aStream(value.ToCString(), strlen(value.ToCString())); - RestoreFromString(aStream); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx index 4a44d76b8..84434df7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx @@ -11,84 +11,68 @@ #ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile #define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeTableOfInteger : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfInteger Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfInteger(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); +Standard_EXPORT void PutValue(const int theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT int GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfInteger() {} private: -TColStd_DataMapOfIntegerInteger myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfInteger ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx index 7b4b259a6..64c5f03a6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx @@ -21,92 +21,84 @@ // Author : Michael Ponikarov // Module : SALOME -#include -#include -#include -#include +#include "SALOMEDSImpl_AttributeTableOfReal.hxx" #include -#include +#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute ) - #define SEPARATOR '\1' -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) +typedef map::const_iterator MI; + +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos < 0) return aString; + if(aPos == 0) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfReal::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfRealID; } -Handle(SALOMEDSImpl_AttributeTableOfReal) SALOMEDSImpl_AttributeTableOfReal::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfReal* SALOMEDSImpl_AttributeTableOfReal::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfReal) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfReal(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfReal*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfReal(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributeTableOfReal::SALOMEDSImpl_AttributeTableOfReal() :SALOMEDSImpl_GenericAttribute("AttributeTableOfReal") { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); myNbRows = 0; myNbColumns = 0; } -void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const Standard_Integer theNbColumns) +void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - TColStd_DataMapOfIntegerReal aMap; + map aMap; aMap = myTable; - myTable.Clear(); + myTable.clear(); - TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); + for(MI p = aMap.begin(); p != aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(string("")); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -115,26 +107,26 @@ void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedStrin SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfReal::GetTitle() const { return myTitle; } -void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfReal)& theData) +void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -142,113 +134,113 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfReal::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0.); + aSeq.push_back(0.); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + std::string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const Standard_Integer theRow, - const TCollection_ExtendedString& theUnit) +void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - - myRows->SetValue(theRow, aTitle); + + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const vector& theUnits) { - if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theUnits->Length(), i; - for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowUnits() +vector SALOMEDSImpl_AttributeTableOfReal::GetRowUnits() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& theTitles) { - if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowTitles() +vector SALOMEDSImpl_AttributeTableOfReal::GetRowTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfReal)& theData) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(string("")); } } @@ -256,80 +248,80 @@ void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer the } -Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0.); + aSeq.push_back(0.); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); - + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const vector& theTitles) { - if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles() +vector SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myCols->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,41 +329,42 @@ void SALOMEDSImpl_AttributeTableOfReal::PutValue(const Standard_Real theValue, SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Boolean SALOMEDSImpl_AttributeTableOfReal::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +bool SALOMEDSImpl_AttributeTableOfReal::HasValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) return Standard_False; - if(theColumn > myNbColumns || theColumn < 1) return Standard_False; - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -Standard_Real SALOMEDSImpl_AttributeTableOfReal::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +double SALOMEDSImpl_AttributeTableOfReal::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); + throw DFexception("Invalid cell index"); return 0.; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfReal::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfReal::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(with); + if(!aTable) throw DFexception("Can't Restore from a null attribute"); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -379,26 +372,26 @@ void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& wit myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfReal(); } -void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfReal::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(into); + if(!aTable) throw DFexception("Can't Paste into a null attribute"); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -406,160 +399,143 @@ void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into, aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; } - - -void SALOMEDSImpl_AttributeTableOfReal::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfReal::Save() { + ostrstream theStream; int i, j, l; - //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jfirst << "\n"; + sprintf(aBuffer, "%.64e", p->second); theStream << aBuffer << "\n"; } delete []aBuffer; - - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfReal::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfReal::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); int i, j, l; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); + myRows.clear(); for(i=1; i<=myNbRows; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); + myCols.clear(); for(i=1; i<=myNbColumns; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values theStream >> l; - myTable.Clear(); + myTable.clear(); for(i=1; i<=l; i++) { - Standard_Integer aKey; - Standard_Real aValue; + int aKey; + double aValue; theStream >> aKey; theStream >> aValue; - myTable.Bind(aKey, aValue); + myTable[aKey] = aValue; } - return true; -} - -TCollection_AsciiString SALOMEDSImpl_AttributeTableOfReal::Save() -{ - ostrstream ostr; - ConvertToString(ostr); - TCollection_AsciiString aString((char*)ostr.rdbuf()->str()); - return aString; -} - -void SALOMEDSImpl_AttributeTableOfReal::Load(const TCollection_AsciiString& value) -{ - istrstream aStream(value.ToCString(), strlen(value.ToCString())); - RestoreFromString(aStream); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx index 6c1b7b28a..3dea7567d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx @@ -11,86 +11,65 @@ #ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile #define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute ) - -#include -#include -#include -#include -#include -#include - -#include -#include +#include +#include +#include class SALOMEDSImpl_AttributeTableOfReal : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfReal Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfReal(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT void SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; + +Standard_EXPORT void PutValue(const double& theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT double GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); + +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfReal() {} private: -TColStd_DataMapOfIntegerReal myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfReal ) +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx index e6b74e048..245de358c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx @@ -22,179 +22,171 @@ // Module : SALOME #include -#include -#include #include -#include +#include +#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) - -typedef NCollection_DataMap::Iterator DataMapIterator; - #define SEPARATOR '\1' -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) +typedef map::const_iterator MI; + +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + if(aPos == 0) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfString::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfStringID; } -Handle(SALOMEDSImpl_AttributeTableOfString) SALOMEDSImpl_AttributeTableOfString::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfString* SALOMEDSImpl_AttributeTableOfString::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfString) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfString(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfString* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfString*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfString(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributeTableOfString::SALOMEDSImpl_AttributeTableOfString() :SALOMEDSImpl_GenericAttribute("AttributeTableOfString") { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); myNbRows = 0; myNbColumns = 0; } -void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const Standard_Integer theNbColumns) +void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - DataMapOfIntegerString aMap; + map aMap; aMap = myTable; - myTable.Clear(); + myTable.clear(); - DataMapIterator anIterator(aMap); - for(; anIterator.More(); anIterator.Next()) { - int aRow = (int)(anIterator.Key()/myNbColumns) + 1; - int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1)); + for(MI p = aMap.begin(); p!=aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(std::string("")); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + std::string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const Standard_Integer theRow, - const TCollection_ExtendedString& theUnit) +void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const vector& theUnits) { - if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theUnits->Length(), i; - for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowUnits() +vector SALOMEDSImpl_AttributeTableOfString::GetRowUnits() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& theTitles) { - if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowTitles() +vector SALOMEDSImpl_AttributeTableOfString::GetRowTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myRows->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfExtendedString)& theData) +void SALOMEDSImpl_AttributeTableOfString::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -202,7 +194,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theR SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfString::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -211,42 +203,42 @@ void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedStr SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfString::GetTitle() const { return myTitle; } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfString::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0.); + aSeq.push_back(""); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfExtendedString)& theData) +void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(std::string("")); } } @@ -254,82 +246,82 @@ void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer t } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfString::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0.); + aSeq.push_back(""); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const vector& theTitles) { - if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns"); - int aLength = theTitles->Length(), i; - for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnTitles() +vector SALOMEDSImpl_AttributeTableOfString::GetColumnTitles() { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - int aLength = myCols->Length(), i; - for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,42 +329,42 @@ void SALOMEDSImpl_AttributeTableOfString::PutValue(const TCollection_ExtendedStr SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Boolean SALOMEDSImpl_AttributeTableOfString::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +bool SALOMEDSImpl_AttributeTableOfString::HasValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) return Standard_False; - if(theColumn > myNbColumns || theColumn < 1) return Standard_False; + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +std::string SALOMEDSImpl_AttributeTableOfString::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); - return 0.; + throw DFexception("Invalid cell index"); + return ""; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfString::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfString::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(with); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -380,26 +372,25 @@ void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& w myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfString::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfString::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfString(); } -void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfString::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(into); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -407,32 +398,32 @@ void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& int aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; @@ -440,58 +431,60 @@ Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetCol -void SALOMEDSImpl_AttributeTableOfString::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfString::Save() { + ostrstream theStream; int i, j, l; //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jsecond.size()) { // check empty string in the value table + theStream << p->first << "\n"; + unsigned long aValueSize = p->second.size(); theStream<second.c_str(),aValueSize); theStream<<"\n"; } else { // write index only of kind: "0key"; "05", for an example - theStream << "0" << anIterator.Key() << "\n"; + theStream << "0" << p->first << "\n"; } } - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfString::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); theStream.seekg(0, ios::end); @@ -501,60 +494,60 @@ bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStrea int i, j, l; char *aValueString = new char[aSize]; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); - for(i=1; i<=myNbRows; i++) { + myRows.clear(); + for(i=0; i> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); - for(i=1; i<=myNbColumns; i++) { + myCols.clear(); + for(i=0; i> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values - TCollection_AsciiString aValue; + string aValue; theStream >> l; - myTable.Clear(); + myTable.clear(); theStream.getline(aValueString,aSize,'\n'); for(i=1; i<=l; i++) { - Standard_Integer aKey; + int aKey; theStream.getline(aValueString,aSize,'\n'); aValue = aValueString; - aKey = aValue.IntegerValue(); - if (aValue.Value(1) == '0') + aKey = atoi(aValue.c_str()); + if (aValue[0] == '0') aValue = ""; else { unsigned long aValueSize; @@ -564,22 +557,7 @@ bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStrea theStream.read(aValueString, 1); // an '\n' omitting aValue = aValueString; } - myTable.Bind(aKey, aValue); + myTable[aKey] = aValue; } delete(aValueString); - return true; -} - -TCollection_AsciiString SALOMEDSImpl_AttributeTableOfString::Save() -{ - ostrstream ostr; - ConvertToString(ostr); - TCollection_AsciiString aString((char*)ostr.rdbuf()->str()); - return aString; -} - -void SALOMEDSImpl_AttributeTableOfString::Load(const TCollection_AsciiString& value) -{ - istrstream aStream(value.ToCString(), strlen(value.ToCString())); - RestoreFromString(aStream); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx index 68725ed3a..0a4da3185 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx @@ -11,87 +11,66 @@ #ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile #define _SALOMEDSImpl_AttributeTableOfString_HeaderFile -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) - -#include -#include -#include -#include -#include -#include -#include - -typedef NCollection_DataMap DataMapOfIntegerString; +#include +#include +#include class SALOMEDSImpl_AttributeTableOfString : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfString Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfString(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; - -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT void SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; + +Standard_EXPORT void PutValue(const std::string& theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT std::string GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); + +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfString() {} private: -DataMapOfIntegerString myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfString ) +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx index 20e86c4c9..8b0938bde 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx @@ -25,24 +25,18 @@ #include "SALOMEDSImpl_AttributeTarget.hxx" #include "SALOMEDSImpl_AttributeReference.hxx" #include "SALOMEDSImpl_Study.hxx" -#include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID () +const std::string& SALOMEDSImpl_AttributeTarget::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTargetID; } @@ -52,10 +46,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeTarget) SALOMEDSImpl_AttributeTarget::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeTarget* SALOMEDSImpl_AttributeTarget::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeTarget) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),A)) { + SALOMEDSImpl_AttributeTarget* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTarget*)L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { A = new SALOMEDSImpl_AttributeTarget(); L.AddAttribute(A); } @@ -72,7 +66,7 @@ SALOMEDSImpl_AttributeTarget::SALOMEDSImpl_AttributeTarget() { } -void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& theRelation) +void SALOMEDSImpl_AttributeTarget::SetRelation(const std::string& theRelation) { CheckLocked(); if(myRelation == theRelation) return; @@ -87,15 +81,14 @@ void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& //function : Add //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO) +void SALOMEDSImpl_AttributeTarget::Add(const SALOMEDSImpl_SObject& theSO) { Backup(); - TDF_Label aRefLabel = theSO->GetLabel(); - Handle(SALOMEDSImpl_AttributeReference) aReference; - if (aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),aReference)) { - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == aRefLabel) return; //BugID: PAL6192 - GetVariables().Append(aReference); + DF_Label aRefLabel = theSO.GetLabel(); + SALOMEDSImpl_AttributeReference* aReference; + if ((aReference=(SALOMEDSImpl_AttributeReference*)aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + for(int i = 0, len = myVariables.size(); iLabel() == aRefLabel) return; //BugID: PAL6192 + myVariables.push_back(aReference); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -105,15 +98,13 @@ void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO //function : Get //purpose : //======================================================================= -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get() +vector SALOMEDSImpl_AttributeTarget::Get() { - Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + vector aSeq; + + for(int i = 0, len = myVariables.size(); iLabel())); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - const TDF_Label& aLabel = anIter.Value()->Label(); - aSeq->Append( SALOMEDSImpl_Study::SObject(aLabel)); - } return aSeq; } @@ -121,17 +112,20 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get() //function : Remove //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO) +void SALOMEDSImpl_AttributeTarget::Remove(const SALOMEDSImpl_SObject& theSO) { Backup(); - TDF_Label aRefLabel = theSO->GetLabel(); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - if (anIter.Value()->Label() == aRefLabel) { - GetVariables().Remove(anIter); - return; - } - } + DF_Label aRefLabel = theSO.GetLabel(); + + vector va; + for(int i = 0, len = myVariables.size(); iLabel(); + if(myVariables[i]->Label() == aRefLabel) continue; + va.push_back(myVariables[i]); + } + + myVariables.clear(); + myVariables = va; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -140,21 +134,19 @@ void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& th //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); } //======================================================================= //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeTarget::Restore(DF_Attribute* With) { - Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (With); + SALOMEDSImpl_AttributeTarget* REL = dynamic_cast(With); myRelation = REL->GetRelation(); - Handle(SALOMEDSImpl_AttributeReference) V; - myVariables.Clear(); - for (TDF_ListIteratorOfAttributeList it (REL->GetVariables()); it.More(); it.Next()) { - V = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value()); - myVariables.Append(V); + myVariables.clear(); + for (int i = 0, len = REL->myVariables.size(); imyVariables[i]); } } @@ -162,7 +154,7 @@ void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With) //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTarget::NewEmpty() const { return new SALOMEDSImpl_AttributeTarget(); } @@ -171,15 +163,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Paste(const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTarget::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (Into); + SALOMEDSImpl_AttributeTarget* REL = dynamic_cast(into); REL->SetRelation(myRelation); - Handle(SALOMEDSImpl_AttributeReference) V1,V2; - for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) { - V1 = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value()); - RT->HasRelocation (V1,V2); - REL->GetVariables().Append(V2); - } + REL->myVariables.clear(); + for (int i = 0, len = myVariables.size(); imyVariables.push_back(myVariables[i]); + } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx index 1ae8c0b0d..5c4bb4f71 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx @@ -24,49 +24,34 @@ #ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile #define _SALOMEDSImpl_AttributeTarget_HeaderFile -#include -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" #include "SALOMEDSImpl_SObject.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute ) - - class SALOMEDSImpl_AttributeTarget : public SALOMEDSImpl_GenericAttribute { private: -TCollection_ExtendedString myRelation; -TDF_AttributeList myVariables; +std::string myRelation; +std::vector myVariables; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTarget* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTarget(); -Standard_EXPORT void Add(const Handle(SALOMEDSImpl_SObject)& theSO); -Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Get(); -Standard_EXPORT void Remove(const Handle(SALOMEDSImpl_SObject)& theSO); -Standard_EXPORT TCollection_ExtendedString GetRelation() { return myRelation; } -Standard_EXPORT void SetRelation(const TCollection_ExtendedString& theRelation); -Standard_EXPORT TDF_AttributeList& GetVariables() { return myVariables; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void Add(const SALOMEDSImpl_SObject& theSO); +Standard_EXPORT std::vector Get(); +Standard_EXPORT void Remove(const SALOMEDSImpl_SObject& theSO); +Standard_EXPORT std::string GetRelation() { return myRelation; } +Standard_EXPORT void SetRelation(const std::string& theRelation); +Standard_EXPORT std::vector& GetVariables() { return myVariables; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTarget() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTarget ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx index 8250ff194..cf53370db 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeTextColor.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID () +const std::string& SALOMEDSImpl_AttributeTextColor::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTextColorID; } @@ -49,22 +45,25 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID () SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor() :SALOMEDSImpl_GenericAttribute("AttributeTextColor") { - myValue = new TColStd_HArray1OfReal(1, 3, 0.); + myValue.clear(); + myValue.push_back(0.); + myValue.push_back(0.); + myValue.push_back(0.); } //======================================================================= //function : SetTextColor //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B) +void SALOMEDSImpl_AttributeTextColor::SetTextColor(const double& R, const double& G, const double& B) { CheckLocked(); - if(myValue.IsNull()) return; + Backup(); - myValue->SetValue(1, R); - myValue->SetValue(2, G); - myValue->SetValue(3, B); + myValue[0] = R; + myValue[1] = G; + myValue[2] = B; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -73,7 +72,7 @@ void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const //function : TextColor //purpose : //======================================================================= -Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor() +vector SALOMEDSImpl_AttributeTextColor::TextColor() { return myValue; } @@ -82,12 +81,12 @@ Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor() //function : ChangeArray //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray) +void SALOMEDSImpl_AttributeTextColor::ChangeArray(const vector& newArray) { Backup(); - for(int i = 1; i <= 3; i++) - myValue->SetValue(i, newArray->Value(i)); + for(int i = 0; i < 3; i++) + myValue[i] = newArray[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -97,7 +96,7 @@ void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1Of //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); } //======================================================================= @@ -105,7 +104,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeTextColor::NewEmpty () const { return new SALOMEDSImpl_AttributeTextColor(); } @@ -115,10 +114,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTextColor::Restore(DF_Attribute* with) { - Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (with)->TextColor (); - ChangeArray(s); + ChangeArray( dynamic_cast(with)->TextColor ()); return; } @@ -127,30 +125,29 @@ void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTextColor::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (into)->ChangeArray (myValue); + dynamic_cast(into)->ChangeArray (myValue); } -TCollection_AsciiString SALOMEDSImpl_AttributeTextColor::Save() +string SALOMEDSImpl_AttributeTextColor::Save() { char *Val = new char[75]; - sprintf(Val, "%f %f %f", (float)myValue->Value(1), - (float)myValue->Value(2), - (float)myValue->Value(3)); - TCollection_AsciiString ret(Val); + sprintf(Val, "%f %f %f", (float)myValue[0], + (float)myValue[1], + (float)myValue[2]); + string ret(Val); delete Val; return ret; } -void SALOMEDSImpl_AttributeTextColor::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTextColor::Load(const string& value) { float r, g, b; - sscanf(value.ToCString(), "%f %f %f", &r, &g, &b); - myValue->SetValue(1, r); - myValue->SetValue(2, g); - myValue->SetValue(3, b); + sscanf(value.c_str(), "%f %f %f", &r, &g, &b); + myValue[0] = r; + myValue[1] = g; + myValue[2] = b; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx index 21efa7e8b..a0e9f50d7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile #define _SALOMEDSImpl_AttributeTextColor_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeTextColor : public SALOMEDSImpl_GenericAttribute { private: - Handle(TColStd_HArray1OfReal) myValue; + std::vector myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeTextColor(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B); -Standard_EXPORT Handle(TColStd_HArray1OfReal) TextColor(); -Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray); -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void SetTextColor(const double& R, const double& G, const double& B); +Standard_EXPORT std::vector TextColor(); +Standard_EXPORT void ChangeArray(const std::vector& newArray); +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTextColor() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextColor ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx index cf9449d09..1661a6cc5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx" -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID () +const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTextHighlightColorID; } @@ -50,7 +46,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID () SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor() :SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor") { - myValue = new TColStd_HArray1OfReal(1, 3, 0.); + myValue.clear(); + myValue.push_back(0.0); + myValue.push_back(0.0); + myValue.push_back(0.0); } //======================================================================= @@ -58,24 +57,23 @@ SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightCol //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); } //======================================================================= //function : SetTextHighlightColor //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Standard_Real R, - const Standard_Real G, - const Standard_Real B) +void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R, + const double& G, + const double& B) { CheckLocked(); - if(myValue.IsNull()) return; Backup(); - myValue->SetValue(1, R); - myValue->SetValue(2, G); - myValue->SetValue(3, B); + myValue[0] = R; + myValue[1] = G; + myValue[2] = B; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -84,7 +82,7 @@ void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Stand //function : TextHighlightColor //purpose : //======================================================================= -Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor() +vector SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor() { return myValue; } @@ -93,12 +91,12 @@ Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHigh //function : ChangeArray //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray) +void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const vector& newArray) { Backup(); - for(int i = 1; i <= 3; i++) - myValue->SetValue(i, newArray->Value(i)); + for(int i = 0; i < 3; i++) + myValue[i] = newArray[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -108,7 +106,7 @@ void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_ //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const { return new SALOMEDSImpl_AttributeTextHighlightColor(); } @@ -118,10 +116,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () cons //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with) { - Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (with)->TextHighlightColor (); - ChangeArray(s); + ChangeArray(dynamic_cast(with)->TextHighlightColor());; return; } @@ -130,29 +127,28 @@ void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribut //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (into)->ChangeArray (myValue); + dynamic_cast(into)->ChangeArray (myValue); } -TCollection_AsciiString SALOMEDSImpl_AttributeTextHighlightColor::Save() +string SALOMEDSImpl_AttributeTextHighlightColor::Save() { char *Val = new char[75]; - sprintf(Val, "%f %f %f", (float)myValue->Value(1), - (float)myValue->Value(2), - (float)myValue->Value(3)); - TCollection_AsciiString ret(Val); + sprintf(Val, "%f %f %f", (float)myValue[0], + (float)myValue[1], + (float)myValue[2]); + string ret(Val); delete Val; return ret; } -void SALOMEDSImpl_AttributeTextHighlightColor::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTextHighlightColor::Load(const string& value) { float r, g, b; - sscanf(value.ToCString(), "%f %f %f", &r, &g, &b); - myValue->SetValue(1, r); - myValue->SetValue(2, g); - myValue->SetValue(3, b); + sscanf(value.c_str(), "%f %f %f", &r, &g, &b); + myValue[0] = r; + myValue[1] = g; + myValue[2] = b; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx index ed54f4b12..d17e7f29c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile #define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeTextHighlightColor : public SALOMEDSImpl_GenericAttribute { private: - Handle(TColStd_HArray1OfReal) myValue; + std::vector myValue; public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeTextHighlightColor(); -Standard_EXPORT void SetTextHighlightColor(const Standard_Real R, const Standard_Real G, const Standard_Real B); -Standard_EXPORT Handle(TColStd_HArray1OfReal) TextHighlightColor(); -Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT void SetTextHighlightColor(const double& R, const double& G, const double& B); +Standard_EXPORT std::vector TextHighlightColor(); +Standard_EXPORT void ChangeArray(const std::vector& newArray); +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTextHighlightColor() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextHighlightColor ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx index 8bc31e415..3880fe7ad 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx @@ -23,28 +23,12 @@ #include "SALOMEDSImpl_AttributeTreeNode.hxx" -#include -#include -#include -#include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute ) - -static char* Entry(const TDF_Label& theLabel) +const std::string& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID() { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel, anEntry); - return anEntry.ToCString(); -} - -const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID() -{ - static Standard_GUID TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648"); + static std::string TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648"); return TreeNodeID; } @@ -54,11 +38,11 @@ SALOMEDSImpl_AttributeTreeNode::SALOMEDSImpl_AttributeTreeNode() {} -Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (const TDF_Label& L, const Standard_GUID& ID) +SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Set (const DF_Label& L, const std::string& ID) { - Handle(SALOMEDSImpl_AttributeTreeNode) TN; + SALOMEDSImpl_AttributeTreeNode* TN = NULL; - if (!L.FindAttribute(ID,TN)) { + if (!(TN=(SALOMEDSImpl_AttributeTreeNode*)L.FindAttribute(ID))) { TN = new SALOMEDSImpl_AttributeTreeNode (); TN->SetTreeID(ID); L.AddAttribute(TN); @@ -71,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (cons //TreeNode : ID //purpose : Returns GUID of the TreeNode //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const +const std::string& SALOMEDSImpl_AttributeTreeNode::ID() const { return myTreeID; } @@ -80,27 +64,24 @@ const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const //function : Append //purpose : Add as last child of me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::Append (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID"); + if (!(TN->ID() == myTreeID)) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - Handle(SALOMEDSImpl_AttributeTreeNode) bid; - TN->SetNext(bid); // Deconnects from next. + TN->SetNext(NULL); // Deconnects from next. // Find the last if (!HasFirst()) { SetFirst(TN); - TN->SetPrevious(bid); // Deconnects from previous. + TN->SetPrevious(NULL); // Deconnects from previous. } else { - Handle(SALOMEDSImpl_AttributeTreeNode) Last = GetFirst(); - while (Last->HasNext()) { + SALOMEDSImpl_AttributeTreeNode* Last = GetFirst(); + while (Last && Last->HasNext()) { Last = Last->GetNext(); } Last->SetNext(TN); @@ -111,38 +92,35 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSIm SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : Prepend //purpose : Add as first child of me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::Prepend (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - Handle(SALOMEDSImpl_AttributeTreeNode) bid; - TN->SetPrevious(bid); + TN->SetPrevious(NULL); if (HasFirst()) { TN->SetNext(GetFirst()); GetFirst()->SetPrevious(TN); } else { - TN->SetNext(bid); + TN->SetNext(NULL); } TN->SetFather(this); SetFirst(TN); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } @@ -150,15 +128,13 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSI //function : InsertBefore //purpose : Inserts the TreeNode before me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::InsertBefore (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); TN->SetFather(GetFather()); TN->SetPrevious(GetPrevious()); @@ -173,22 +149,20 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALO SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : InsertAfter //purpose : Inserts the TreeNode after me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::InsertAfter (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); TN->SetFather(GetFather()); TN->SetPrevious(this); @@ -200,20 +174,19 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOM SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : Remove //purpose : Removees the function from the function tree //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove () +bool SALOMEDSImpl_AttributeTreeNode::Remove () { CheckLocked(); - if (IsRoot()) return Standard_True; + if (IsRoot()) return true; - Handle(SALOMEDSImpl_AttributeTreeNode) bid; if (!HasPrevious()) GetFather()->SetFirst(GetNext()); else @@ -221,39 +194,39 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove () if (HasNext()) { if (HasPrevious()) GetNext()->SetPrevious(GetPrevious()); - else GetNext()->SetPrevious(bid); + else GetNext()->SetPrevious(NULL); } else { - if (HasPrevious()) GetPrevious()->SetNext(bid); + if (HasPrevious()) GetPrevious()->SetNext(NULL); } if (GetFather()->HasFirst()) { - if (Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(this) == GetFather()->GetFirst()) { + if (this == GetFather()->GetFirst()) { if (HasNext()) { GetFather()->SetFirst(GetNext()); } - else GetFather()->SetFirst(bid); + else GetFather()->SetFirst(NULL); } } - SetFather(bid); - SetNext(bid); - SetPrevious(bid); + SetFather(NULL); + SetNext(NULL); + SetPrevious(NULL); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return Standard_True; + return true; } //======================================================================= //function : Depth //purpose : //======================================================================= -Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const +int SALOMEDSImpl_AttributeTreeNode::Depth () const { - Standard_Integer depth = 0; - Handle(SALOMEDSImpl_AttributeTreeNode) current = this; - while (current->HasFather()) { + int depth = 0; + SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this; + while (current) { depth++; current = current->GetFather(); } @@ -265,7 +238,7 @@ Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const //purpose : Finds or creates a TreeNode attribute with explicit ID // : a driver for it //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID) +void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const std::string& explicitID) { myTreeID = explicitID; @@ -277,7 +250,7 @@ void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID) //function : IsAscendant //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return ofTN->IsDescendant(this); } @@ -287,14 +260,14 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOM //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsDescendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { - Handle(SALOMEDSImpl_AttributeTreeNode) current = this; - while (current->HasFather()) { - if (current->GetFather() == ofTN) return Standard_True; + SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this; + while (current) { + if (current->GetFather() == ofTN) return true; current = current->GetFather(); } - return Standard_False; + return false; } //======================================================================= @@ -302,7 +275,7 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALO //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsFather (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return (ofTN->GetFather() == this); } @@ -313,7 +286,7 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDS //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsChild (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return (myFather == ofTN); } @@ -323,23 +296,21 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSI //purpose : Returns Standard_True if the TreeNode is not attached to a // TreeNode tree or hasn't an Father. //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsRoot() const +bool SALOMEDSImpl_AttributeTreeNode::IsRoot() const { - if (myFather.IsNull() && - myPrevious.IsNull() && - myNext.IsNull()) - return Standard_True; - return Standard_False; + if (!myFather && !myPrevious && !myNext) + return true; + return false; } //======================================================================= //TreeNode : Root //purpose : Returns the TreeNode which has no Father //======================================================================= -Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() const +SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Root() const { - Handle(SALOMEDSImpl_AttributeTreeNode) O = this; - while (O->HasFather()) + SALOMEDSImpl_AttributeTreeNode* O = (SALOMEDSImpl_AttributeTreeNode*)this; + while (O && O->HasFather()) O = O->GetFather(); return O; } @@ -348,11 +319,11 @@ Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() co //TreeNode : SetFather //purpose : Sets the TreeNode F as Father of me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetFather(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myFather = F; + myFather = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -361,11 +332,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_Attribu //TreeNode : SetNext //purpose : Sets the TreeNode F next to me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetNext(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myNext = F; + myNext = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -375,11 +346,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_Attribute //TreeNode : SetPrevious //purpose : Sets the TreeNode F previous to me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myPrevious = F; + myPrevious = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -388,11 +359,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_Attri //TreeNode : SetFirst //purpose : Sets the TreeNode F as first in the TreeNode tree //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetFirst(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myFirst = F; + myFirst = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -400,73 +371,37 @@ void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_Attribut //======================================================================= //TreeNode : AfterAddition //purpose : Connects the TreeNode to the tree. -// Backuped attribute must stay disconnected //======================================================================= void SALOMEDSImpl_AttributeTreeNode::AfterAddition() { - if (!IsBackuped()) { - if (!myPrevious.IsNull()) { - myPrevious->SetNext(this); - } - else if (!myFather.IsNull()) { - myFather->SetFirst(this); - } - if (!myNext.IsNull()) - myNext->SetPrevious(this); + if (myPrevious) { + myPrevious->SetNext(this); + } + else if (myFather) { + myFather->SetFirst(this); + } + if (myNext) { + myNext->SetPrevious(this); } } //======================================================================= //TreeNode : BeforeForget //purpose : Disconnect the TreeNode from the tree. -// Backuped attribute is normaly not concerned by such an operation //======================================================================= void SALOMEDSImpl_AttributeTreeNode::BeforeForget() { - if (!IsBackuped()) { Remove(); while (HasFirst()) GetFirst()->Remove(); - } -} - -//======================================================================= -//TreeNode : AfterResume -//purpose : Connects the TreeNode to the tree -//======================================================================= -void SALOMEDSImpl_AttributeTreeNode::AfterResume() -{ - AfterAddition(); -} - -//======================================================================= -//TreeNode : BeforeUndo -//purpose : Disconnect the TreeNode from the tree. -//======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta, - const Standard_Boolean forceIt) -{ - if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) BeforeForget(); // Disconnect. - return Standard_True; -} - -//======================================================================= -//TreeNode : AfterUndo -//purpose : Connect the TreeNode from the tree. -//======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta, - const Standard_Boolean forceIt) -{ - if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) AfterAddition(); // Reconnect. - return Standard_True; } //======================================================================= //TreeNode : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other) +void SALOMEDSImpl_AttributeTreeNode::Restore(DF_Attribute* other) { - Handle(SALOMEDSImpl_AttributeTreeNode) F = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(other); + SALOMEDSImpl_AttributeTreeNode* F = dynamic_cast(other); myFather = F->myFather; myPrevious = F->myPrevious; myNext = F->myNext; @@ -479,28 +414,13 @@ void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other) //purpose : Method for Copy mechanism //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTreeNode::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTreeNode) intof = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(into); - Handle(SALOMEDSImpl_AttributeTreeNode) func; - if (!RT->HasRelocation(myFather, func) && RT->AfterRelocate()) { - func.Nullify(); - } - intof->SetFather(func); - if (!RT->HasRelocation(myNext, func) && RT->AfterRelocate()) { - func.Nullify(); - } - intof->SetNext(func); - if (!RT->HasRelocation(myPrevious, func) && RT->AfterRelocate()) { - func.Nullify(); - } - intof->SetPrevious(func); - if (!RT->HasRelocation(myFirst, func) && RT->AfterRelocate()) { - func.Nullify(); - } - - intof->SetFirst(func); + SALOMEDSImpl_AttributeTreeNode* intof = dynamic_cast(into); + intof->SetFather(myFather); + intof->SetNext(myNext); + intof->SetPrevious(myPrevious); + intof->SetFirst(myFirst); intof->SetTreeID(myTreeID); } @@ -509,69 +429,52 @@ void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into, //purpose : Returns new empty TreeNode attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTreeNode::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTreeNode::NewEmpty() const { - Handle(SALOMEDSImpl_AttributeTreeNode) T = new SALOMEDSImpl_AttributeTreeNode(); + SALOMEDSImpl_AttributeTreeNode* T = new SALOMEDSImpl_AttributeTreeNode(); T->SetTreeID(myTreeID); return T; } -//======================================================================= -//TreeNode : References -//purpose : Collects the references -//======================================================================= -void SALOMEDSImpl_AttributeTreeNode::References(const Handle(TDF_DataSet)& aDataSet) const -{ - Handle(SALOMEDSImpl_AttributeTreeNode) fct = myFirst; - while (!fct.IsNull()) { - aDataSet->AddAttribute(fct); - fct = fct->myNext; - } -} - -TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Type() +string SALOMEDSImpl_AttributeTreeNode::Type() { - char* aNodeName = new char[60]; - char aGUID[40]; - ID().ToCString(aGUID); - sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID); - TCollection_AsciiString ret(aNodeName); + char* aNodeName = new char[127]; + sprintf(aNodeName, "AttributeTreeNodeGUID%s", ID().c_str()); + string ret(aNodeName); delete aNodeName; return ret; } -TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Save() +string SALOMEDSImpl_AttributeTreeNode::Save() { - TCollection_AsciiString aFather, aPrevious, aNext, aFirst; + string aFather, aPrevious, aNext, aFirst; - if (HasFather()) aFather = Entry(GetFather()->Label()); else aFather = "!"; - if (HasPrevious()) aPrevious = Entry(GetPrevious()->Label()); else aPrevious = "!"; - if (HasNext()) aNext = Entry(GetNext()->Label()); else aNext = "!"; - if (HasFirst()) aFirst = Entry(GetFirst()->Label()); else aFirst = "!"; + if (HasFather()) aFather = GetFather()->Label().Entry(); else aFather = "!"; + if (HasPrevious()) aPrevious = GetPrevious()->Label().Entry(); else aPrevious = "!"; + if (HasNext()) aNext = GetNext()->Label().Entry(); else aNext = "!"; + if (HasFirst()) aFirst = GetFirst()->Label().Entry(); else aFirst = "!"; int aLength = 4; - aLength += aFather.Length() + aPrevious.Length() + aNext.Length() + aFirst.Length(); + aLength += aFather.size() + aPrevious.size() + aNext.size() + aFirst.size(); char* aResult = new char[aLength]; - sprintf(aResult, "%s %s %s %s", aFather.ToCString(), aPrevious.ToCString(), aNext.ToCString(), aFirst.ToCString()); - TCollection_AsciiString ret(aResult); + sprintf(aResult, "%s %s %s %s", aFather.c_str(), aPrevious.c_str(), aNext.c_str(), aFirst.c_str()); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTreeNode::Load(const string& value) { - Handle(TDF_Data) DF = Label().Data(); - - char* aCopy = (char*)value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); - TDF_Label aLabel; - Handle(SALOMEDSImpl_AttributeTreeNode) aDepNode; + DF_Label aLabel; + SALOMEDSImpl_AttributeTreeNode* aDepNode = NULL; if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetFather(aDepNode); @@ -579,24 +482,24 @@ void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value) adr = strtok(NULL, " "); if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetPrevious(aDepNode); } adr = strtok(NULL, " "); if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetNext(aDepNode); } adr = strtok(NULL, " "); if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetFirst(aDepNode); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx index 509a3d529..88d6a6b0d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx @@ -24,87 +24,69 @@ #ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile #define _SALOMEDSImpl_AttributeTreeNode_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle_TDF_DataSet; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); -class SALOMEDSImpl_ChildNodeIterator; - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute ) - class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT const static Standard_GUID& GetDefaultTreeID(); -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTreeNode Set(const TDF_Label& L, const Standard_GUID& ID); +Standard_EXPORT const static std::string& GetDefaultTreeID(); +Standard_EXPORT static SALOMEDSImpl_AttributeTreeNode* Set(const DF_Label& L, const std::string& ID); Standard_EXPORT SALOMEDSImpl_AttributeTreeNode(); -Standard_EXPORT void SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT void SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT void SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT void SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT void SetTreeID(const Standard_GUID& value); - -Standard_EXPORT Standard_Boolean Append(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT Standard_Boolean Prepend(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT Standard_Boolean Remove(); -Standard_EXPORT Standard_Boolean InsertBefore(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); -Standard_EXPORT Standard_Boolean InsertAfter(const Handle(SALOMEDSImpl_AttributeTreeNode)& value); - -Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFather() { return myFather; } -Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetPrevious() { return myPrevious; } -Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetNext() { return myNext; } -Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFirst() { return myFirst; } - -Standard_EXPORT Standard_Boolean HasFather() { return (!myFather.IsNull()); } -Standard_EXPORT Standard_Boolean HasPrevious() { return (!myPrevious.IsNull()); } -Standard_EXPORT Standard_Boolean HasNext() {return (!myNext.IsNull()); } -Standard_EXPORT Standard_Boolean HasFirst() { return (!myFirst.IsNull()); } -Standard_EXPORT const Standard_GUID& GetTreeID() { return ID(); } -Standard_EXPORT Standard_Integer Depth() const; -Standard_EXPORT Standard_Boolean IsRoot() const ; -Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) Root() const; -Standard_EXPORT Standard_Boolean IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const; -Standard_EXPORT Standard_Boolean IsDescendant(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const; -Standard_EXPORT Standard_Boolean IsFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const; -Standard_EXPORT Standard_Boolean IsChild(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const; - -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); -Standard_EXPORT virtual TCollection_AsciiString Type(); - -Standard_EXPORT virtual void AfterAddition() ; -Standard_EXPORT virtual void BeforeForget() ; -Standard_EXPORT virtual void AfterResume() ; -Standard_EXPORT virtual Standard_Boolean BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta, - const Standard_Boolean forceIt = Standard_False) ; -Standard_EXPORT virtual Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta, - const Standard_Boolean forceIt = Standard_False) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const; -Standard_EXPORT void References(const Handle(TDF_DataSet)& aDataSet) const; -Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTreeNode ) +Standard_EXPORT void SetFather(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetPrevious(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetNext(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetFirst(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetTreeID(const std::string& value); + +Standard_EXPORT bool Append(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool Prepend(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool Remove(); +Standard_EXPORT bool InsertBefore(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool InsertAfter(SALOMEDSImpl_AttributeTreeNode* value); + +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFather() const { return myFather; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetPrevious() const { return myPrevious; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetNext() const { return myNext; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFirst() const { return myFirst; } + +Standard_EXPORT bool HasFather() { return (myFather); } +Standard_EXPORT bool HasPrevious() { return (myPrevious); } +Standard_EXPORT bool HasNext() {return (myNext); } +Standard_EXPORT bool HasFirst() { return (myFirst); } +Standard_EXPORT const std::string& GetTreeID() { return ID(); } +Standard_EXPORT int Depth() const; +Standard_EXPORT bool IsRoot() const ; +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Root() const; +Standard_EXPORT bool IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const; +Standard_EXPORT bool IsDescendant(const SALOMEDSImpl_AttributeTreeNode* value) const; +Standard_EXPORT bool IsFather(const SALOMEDSImpl_AttributeTreeNode* value) const; +Standard_EXPORT bool IsChild(const SALOMEDSImpl_AttributeTreeNode* value) const; + +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT virtual std::string Type(); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT void Paste(DF_Attribute* into); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {;} + +Standard_EXPORT virtual void AfterAddition(); +Standard_EXPORT virtual void BeforeForget(); private: -Standard_GUID myTreeID; -Handle(SALOMEDSImpl_AttributeTreeNode) myFather; -Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious; -Handle(SALOMEDSImpl_AttributeTreeNode) myNext; -Handle(SALOMEDSImpl_AttributeTreeNode) myFirst; +std::string myTreeID; +SALOMEDSImpl_AttributeTreeNode* myFather; +SALOMEDSImpl_AttributeTreeNode* myPrevious; +SALOMEDSImpl_AttributeTreeNode* myNext; +SALOMEDSImpl_AttributeTreeNode* myFirst; friend class SALOMEDSImpl_ChildNodeIterator; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx index 62a420b0b..00c7e4038 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx @@ -26,13 +26,10 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute ) - -Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TDF_Label& L, const Standard_GUID& ID) +SALOMEDSImpl_AttributeUserID* SALOMEDSImpl_AttributeUserID::Set (const DF_Label& L, const std::string& ID) { - Handle(SALOMEDSImpl_AttributeUserID) A; - if (!L.FindAttribute(ID, A)) { + SALOMEDSImpl_AttributeUserID* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeUserID*)L.FindAttribute(ID))) { A = new SALOMEDSImpl_AttributeUserID(); A->SetValue(ID); L.AddAttribute(A); @@ -44,7 +41,7 @@ Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TD //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const +const std::string& SALOMEDSImpl_AttributeUserID::ID() const { return myID; } @@ -52,7 +49,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid) +void SALOMEDSImpl_AttributeUserID::SetValue( const std::string& guid) { CheckLocked(); if(myID == guid) return; @@ -67,9 +64,9 @@ void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid) //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeUserID::NewEmpty () const { - Handle(SALOMEDSImpl_AttributeUserID) A = new SALOMEDSImpl_AttributeUserID(); + SALOMEDSImpl_AttributeUserID* A = new SALOMEDSImpl_AttributeUserID(); A->SetValue(myID); return A; } @@ -78,9 +75,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeUserID::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(with); + SALOMEDSImpl_AttributeUserID* A = dynamic_cast(with); SetValue( A->ID() ); } @@ -88,22 +85,19 @@ void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with) //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeUserID::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(into); + SALOMEDSImpl_AttributeUserID* A = dynamic_cast(into); A->SetValue( myID ); } -TCollection_AsciiString SALOMEDSImpl_AttributeUserID::Type() +string SALOMEDSImpl_AttributeUserID::Type() { - char* aUAttrName = new char[60]; - char aGUID[40]; - ID().ToCString(aGUID); - sprintf(aUAttrName, "AttributeUserID_%s",aGUID); + char* aUAttrName = new char[127]; + sprintf(aUAttrName, "AttributeUserID_%s",ID().c_str()); - TCollection_AsciiString ret(aUAttrName); + string ret(aUAttrName); delete aUAttrName; return ret; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx index ec1acdfc9..8d3ab95ac 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx @@ -24,47 +24,37 @@ #ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile #define _SALOMEDSImpl_AttributeUserID_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeUserID : public SALOMEDSImpl_GenericAttribute { private: -Standard_GUID myID; +std::string myID; public: SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {} -static Handle(SALOMEDSImpl_AttributeUserID) Set (const TDF_Label& L, const Standard_GUID& ID); -static const Standard_GUID& DefaultID() +static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID); +static const std::string& DefaultID() { - static Standard_GUID SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); + static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); return SALOMEDSImpl_DefaultUserAttributeID; } -Standard_EXPORT const Standard_GUID& Value() const { return ID(); } -Standard_EXPORT void SetValue(const Standard_GUID& value); +Standard_EXPORT const std::string& Value() const { return ID(); } +Standard_EXPORT void SetValue(const std::string& value); -Standard_EXPORT virtual TCollection_AsciiString Type(); +Standard_EXPORT virtual std::string Type(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeUserID() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeUserID ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx index 1488961bf..ff366e786 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx @@ -100,7 +100,7 @@ public : if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \ if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \ if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \ - if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \ + if(theType == "AttributeUserID") return std::string("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \ if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \ if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \ if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \ @@ -110,9 +110,9 @@ public : if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID(); -#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ - Handle(SALOMEDSImpl_##ClassName) anAttr; \ - if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \ +#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \ + SALOMEDSImpl_##ClassName* anAttr; \ + if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \ CheckLocked(); \ anAttr = new SALOMEDSImpl_##ClassName; \ Lab.AddAttribute(anAttr); \ @@ -120,9 +120,9 @@ public : return anAttr; \ } -#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ - Handle(SALOMEDSImpl_##ClassName) anAttr; \ - if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \ +#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \ + SALOMEDSImpl_##ClassName* anAttr; \ + if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \ anAttr = new SALOMEDSImpl_##ClassName; \ Lab.AddAttribute(anAttr); \ } \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx index 6530d0bd7..834b82701 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx @@ -23,6 +23,4 @@ #include "SALOMEDSImpl_Callback.hxx" -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Callback, MMgt_TShared ) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx index 285938254..313d1d305 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx @@ -24,38 +24,31 @@ #ifndef __SALOMEDSIMPL_CALLBACK_H__ #define __SALOMEDSIMPL_CALLBACK_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared ) #include "SALOMEDSImpl_UseCaseBuilder.hxx" -class SALOMEDSImpl_Callback : public MMgt_TShared +class SALOMEDSImpl_Callback { private: - Handle(SALOMEDSImpl_UseCaseBuilder) _builder; + SALOMEDSImpl_UseCaseBuilder* _builder; public: - SALOMEDSImpl_Callback(const Handle(SALOMEDSImpl_UseCaseBuilder)& builder) + SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder) { _builder = builder; } - virtual void OnAddSObject(Handle(SALOMEDSImpl_SObject) theObject) + virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject) { - if(_builder != NULL && theObject != NULL) _builder->Append(theObject); + if(_builder != NULL && theObject) _builder->Append(theObject); } - virtual void OnRemoveSObject(Handle(SALOMEDSImpl_SObject) theObject) + virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject) { - if(_builder != NULL && theObject != NULL) _builder->Remove(theObject); + if(_builder != NULL && theObject) _builder->Remove(theObject); } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_Callback ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx index 99184a8b3..e4a44457e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx @@ -21,43 +21,39 @@ // Author : Sergey RUIN // Module : SALOME - #include "SALOMEDSImpl_ChildIterator.hxx" #include "SALOMEDSImpl_Study.hxx" -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_ChildIterator, MMgt_TShared ) - -SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO) +SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO) { _so = theSO; - _it = TDF_ChildIterator(_so->GetLabel()); + _it = DF_ChildIterator(_so.GetLabel()); } -SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel) +SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const DF_Label& theLabel) { _so = SALOMEDSImpl_Study::SObject(theLabel); - _it = TDF_ChildIterator(theLabel); + _it = DF_ChildIterator(theLabel); } void SALOMEDSImpl_ChildIterator::Init() { - _it.Initialize(_so->GetLabel(), Standard_False); + if(_so) _it.Init(_so.GetLabel(), false); } -void SALOMEDSImpl_ChildIterator::Init(const TDF_Label& theLabel) +void SALOMEDSImpl_ChildIterator::Init(const DF_Label& theLabel) { - _it.Initialize(theLabel, Standard_False); + _it.Init(theLabel, false); } void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels) { - _it.Initialize(_so->GetLabel(), theAllLevels); + if(_so) _it.Init(_so.GetLabel(), theAllLevels); } -void SALOMEDSImpl_ChildIterator::InitEx(const TDF_Label& theLabel, bool theAllLevels) +void SALOMEDSImpl_ChildIterator::InitEx(const DF_Label& theLabel, bool theAllLevels) { - _it.Initialize(theLabel, theAllLevels); + _it.Init(theLabel, theAllLevels); } bool SALOMEDSImpl_ChildIterator::More() @@ -70,12 +66,22 @@ void SALOMEDSImpl_ChildIterator::Next() _it.Next(); } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_ChildIterator::Value() +SALOMEDSImpl_SObject SALOMEDSImpl_ChildIterator::Value() { + if(!_so) return SALOMEDSImpl_SObject(); return SALOMEDSImpl_Study::SObject(_it.Value()); } -TDF_Label SALOMEDSImpl_ChildIterator::Label() +DF_Label SALOMEDSImpl_ChildIterator::Label() { return _it.Value(); } + +SALOMEDSImpl_ChildIterator* SALOMEDSImpl_ChildIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_ChildIterator* itr = new SALOMEDSImpl_ChildIterator(); + itr->_it = _it; + itr->_so = _so; + return itr; +} + diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx index 64f261d39..e3c50b9b0 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx @@ -24,37 +24,33 @@ #ifndef __SALOMEDSImpl_CHILDITERATOR_H__ #define __SALOMEDSImpl_CHILDITERATOR_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared ) #include "SALOMEDSImpl_SObject.hxx" -#include "TDF_ChildIterator.hxx" -#include "TDF_Label.hxx" +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" -class SALOMEDSImpl_ChildIterator: public MMgt_TShared +class SALOMEDSImpl_ChildIterator { private: - TDF_ChildIterator _it; - Handle(SALOMEDSImpl_SObject) _so; + DF_ChildIterator _it; + SALOMEDSImpl_SObject _so; public: - Standard_EXPORT SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO); - Standard_EXPORT SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel); + Standard_EXPORT SALOMEDSImpl_ChildIterator() {} + Standard_EXPORT SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO); + Standard_EXPORT SALOMEDSImpl_ChildIterator(const DF_Label& theLabel); Standard_EXPORT ~SALOMEDSImpl_ChildIterator() {}; Standard_EXPORT virtual void Init(); - Standard_EXPORT virtual void Init(const TDF_Label& theLabel); + Standard_EXPORT virtual void Init(const DF_Label& theLabel); Standard_EXPORT virtual void InitEx(bool theAllLevels); - Standard_EXPORT virtual void InitEx(const TDF_Label& theLabel, bool theAllLevels); + Standard_EXPORT virtual void InitEx(const DF_Label& theLabel, bool theAllLevels); Standard_EXPORT virtual bool More(); Standard_EXPORT virtual void Next(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Value(); - Standard_EXPORT virtual TDF_Label Label(); + Standard_EXPORT virtual SALOMEDSImpl_SObject Value(); + Standard_EXPORT virtual DF_Label Label(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject ) + Standard_EXPORT SALOMEDSImpl_ChildIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx index 602ab83d7..b1cc1ffd6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx @@ -27,9 +27,9 @@ #define ChildNodeIterator_UpToBrother \ { \ - while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \ + while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \ myNode = myNode->myFather; \ - if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \ + if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \ myNode = myNode->myNext; \ else \ myNode = NULL; \ @@ -48,8 +48,8 @@ SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator() //purpose : //======================================================================= -SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode, - const Standard_Boolean allLevels) +SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode, + const bool allLevels) : myNode(aNode->myFirst), myFirstLevel(allLevels ? aNode->Depth() : -1) {} @@ -59,8 +59,8 @@ SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SAL //purpose : //======================================================================= -void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode, - const Standard_Boolean allLevels) +void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode, + const bool allLevels) { myNode = aNode->myFirst; myFirstLevel = allLevels ? aNode->Depth() : -1; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx index 56e2b7a57..21651a4e7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx @@ -21,42 +21,27 @@ #ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile #define _SALOMEDSImpl_ChildNodeIterator_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif - #include "SALOMEDSImpl_AttributeTreeNode.hxx" - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - class SALOMEDSImpl_ChildNodeIterator { public: Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(); -Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode, - const Standard_Boolean allLevels = Standard_False); -Standard_EXPORT void Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode, - const Standard_Boolean allLevels = Standard_False) ; -Standard_EXPORT Standard_Boolean More() const { return !myNode.IsNull(); } +Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const SALOMEDSImpl_AttributeTreeNode* aTreeNode, + const bool allLevels = false); +Standard_EXPORT void Initialize(const SALOMEDSImpl_AttributeTreeNode* aTreeNode, + const bool allLevels = false) ; +Standard_EXPORT bool More() const { return (myNode); } Standard_EXPORT void Next() ; Standard_EXPORT void NextBrother() ; -Standard_EXPORT Handle_SALOMEDSImpl_AttributeTreeNode Value() const { return myNode; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; } private: -Handle_SALOMEDSImpl_AttributeTreeNode myNode; -Standard_Integer myFirstLevel; +SALOMEDSImpl_AttributeTreeNode* myNode; +int myFirstLevel; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx index d2e49d842..88fac75f5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx @@ -20,7 +20,7 @@ #ifndef __SALOMEDSIMPL_DRIVER_H__ #define __SALOMEDSIMPL_DRIVER_H__ -#include +#include #include #include #include @@ -30,71 +30,71 @@ class SALOMEDSImpl_Driver { public: - virtual TCollection_AsciiString GetIOR() = 0; + virtual std::string GetIOR() = 0; - virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) = 0; + virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) = 0; + virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile) = 0; - virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile) = 0; - virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile) = 0; - virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) = 0; + virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0; - virtual TCollection_AsciiString ComponentDataType() = 0; + virtual std::string ComponentDataType() = 0; - virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, + virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const std::string& IORString, bool isMultiFile, bool isASCII) = 0; - virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& aLocalPersistentID, + virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject, + const std::string& aLocalPersistentID, bool isMultiFile, bool isASCII) = 0; - virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0; + virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength) = 0; + virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength) = 0; - virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0; + virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0; - virtual TCollection_AsciiString PasteInto(const unsigned char* theStream, + virtual std::string PasteInto(const unsigned char* theStream, const long theStreamLength, int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject) = 0; + const SALOMEDSImpl_SObject& theObject) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength) = 0; + virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength) = 0; }; class SALOMEDSImpl_DriverFactory { public: - virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType) = 0; + virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType) = 0; - virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR) = 0; + virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx index 346eff45b..168645bb0 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx @@ -28,28 +28,25 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_GenericAttribute, TDF_Attribute ) - -char* SALOMEDSImpl_GenericAttribute::Impl_GetType(const Handle(TDF_Attribute)& theAttr) +char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); - return ga->Type().ToCString(); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); + return (char*)ga->Type().c_str(); } -char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr) +char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); - return ga->GetClassType().ToCString(); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); + return (char*)ga->GetClassType().c_str(); } -void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr) +void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); ga->CheckLocked(); } -TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type() +string SALOMEDSImpl_GenericAttribute::Type() { return _type; } @@ -57,30 +54,31 @@ TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type() void SALOMEDSImpl_GenericAttribute::CheckLocked() { - TDF_Label aLabel = Label(); + DF_Label aLabel = Label(); if(aLabel.IsNull()) return; - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); - if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return; + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); + if(!aStudy) return; if(aStudy->IsLocked()) { aStudy->_errorCode = "LockProtection"; throw LockProtection("LockProtection"); } } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject() +SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject() { - TDF_Label aLabel = Label(); - if(aLabel.IsNull()) return NULL; + SALOMEDSImpl_SObject so; + DF_Label aLabel = Label(); + if(aLabel.IsNull()) return so; return SALOMEDSImpl_Study::SObject(aLabel); } void SALOMEDSImpl_GenericAttribute::SetModifyFlag() { - TDF_Label aLabel = Label(); + DF_Label aLabel = Label(); if(aLabel.IsNull()) return; - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); - if(!aStudy.IsNull()) aStudy->Modify(); + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); + if(aStudy) aStudy->Modify(); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx index bf5cc8709..345e0fd64 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx @@ -24,46 +24,33 @@ #ifndef _GENERICIMPL_ATTRIBUTE_HXX_ #define _GENERICIMPL_ATTRIBUTE_HXX_ -#include -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" +#include #include "SALOMEDSImpl_SObject.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute ) - -class SALOMEDSImpl_GenericAttribute: public TDF_Attribute +class SALOMEDSImpl_GenericAttribute: public DF_Attribute { protected: - TCollection_AsciiString _type; //This field must be filled in each attribute that inherits from this class. + std::string _type; //This field must be filled in each attribute that inherits from this class. public: -Standard_EXPORT SALOMEDSImpl_GenericAttribute(const TCollection_AsciiString& theType) +Standard_EXPORT SALOMEDSImpl_GenericAttribute(const std::string& theType) :_type(theType) {} -Standard_EXPORT virtual TCollection_AsciiString Save() { return ""; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString&) {} -Standard_EXPORT virtual TCollection_AsciiString Type(); +Standard_EXPORT virtual std::string Type(); Standard_EXPORT virtual void CheckLocked(); -Standard_EXPORT TCollection_AsciiString GetClassType() { return _type; } -Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(); +Standard_EXPORT std::string GetClassType() { return _type; } +Standard_EXPORT SALOMEDSImpl_SObject GetSObject(); Standard_EXPORT void SetModifyFlag(); -Standard_EXPORT static char* Impl_GetType(const Handle(TDF_Attribute)& theAttr); -Standard_EXPORT static char* Impl_GetClassType(const Handle(TDF_Attribute)& theAttr); -Standard_EXPORT static void Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr); - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_GenericAttribute ) +Standard_EXPORT static char* Impl_GetType(DF_Attribute* theAttr); +Standard_EXPORT static char* Impl_GetClassType(DF_Attribute* theAttr); +Standard_EXPORT static void Impl_CheckLocked(DF_Attribute* theAttr); }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx index b6324819b..876bcf344 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx @@ -19,8 +19,6 @@ #include "SALOMEDSImpl_IParameters.hxx" #include -#include - #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_ChildIterator.hxx" @@ -34,12 +32,12 @@ using namespace std; /*! Constructor */ -SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap) +SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap) { - if(ap.IsNull()) return; + if(!ap) return; _ap = ap; - Handle(SALOMEDSImpl_SObject) so = _ap->GetSObject(); - _study = so->GetStudy(); + SALOMEDSImpl_SObject so = _ap->GetSObject(); + _study = so.GetStudy(); } SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters() @@ -49,7 +47,7 @@ SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters() int SALOMEDSImpl_IParameters::append(const string& listName, const string& value) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; vector v; if(!_ap->IsSet(listName, PT_STRARRAY)) { if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v); @@ -67,7 +65,7 @@ int SALOMEDSImpl_IParameters::append(const string& listName, const string& value int SALOMEDSImpl_IParameters::nbValues(const string& listName) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; if(!_ap->IsSet(listName, PT_STRARRAY)) return 0; vector v = _ap->GetStrArray(listName); return v.size(); @@ -76,7 +74,7 @@ int SALOMEDSImpl_IParameters::nbValues(const string& listName) vector SALOMEDSImpl_IParameters::getValues(const string& listName) { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(listName, PT_STRARRAY)) return v; return _ap->GetStrArray(listName); } @@ -84,7 +82,7 @@ vector SALOMEDSImpl_IParameters::getValues(const string& listName) string SALOMEDSImpl_IParameters::getValue(const string& listName, int index) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(listName, PT_STRARRAY)) return ""; vector v = _ap->GetStrArray(listName); if(index >= v.size()) return ""; @@ -100,7 +98,7 @@ vector SALOMEDSImpl_IParameters::getLists() void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& parameterName, const string& value) { - if(_ap.IsNull()) return; + if(!_ap) return; vector v; if(!_ap->IsSet(entry, PT_STRARRAY)) { append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries @@ -115,7 +113,7 @@ void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& p string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& parameterName) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(entry, PT_STRARRAY)) return ""; vector v = _ap->GetStrArray(entry); int length = v.size(); @@ -129,7 +127,7 @@ string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& vector SALOMEDSImpl_IParameters::getAllParameterNames(const string& entry) { vector v, names; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(entry, PT_STRARRAY)) return v; v = _ap->GetStrArray(entry); int length = v.size(); @@ -142,7 +140,7 @@ vector SALOMEDSImpl_IParameters::getAllParameterNames(const string& entr vector SALOMEDSImpl_IParameters::getAllParameterValues(const string& entry) { vector v, values; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(entry, PT_STRARRAY)) return v; v = _ap->GetStrArray(entry); int length = v.size(); @@ -154,7 +152,7 @@ vector SALOMEDSImpl_IParameters::getAllParameterValues(const string& ent int SALOMEDSImpl_IParameters::getNbParameters(const string& entry) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; if(!_ap->IsSet(entry, PT_STRARRAY)) return -1; return _ap->GetStrArray(entry).size()/2; } @@ -162,14 +160,14 @@ int SALOMEDSImpl_IParameters::getNbParameters(const string& entry) vector SALOMEDSImpl_IParameters::getEntries() { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v; return _ap->GetStrArray(_AP_ENTRIES_LIST_); } void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string& value) { - if(_ap.IsNull()) return; + if(!_ap) return; if(!_ap->IsSet(name, PT_STRING)) { append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties } @@ -178,7 +176,7 @@ void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string string SALOMEDSImpl_IParameters::getProperty(const string& name) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(name, PT_STRING)) return ""; return _ap->GetString(name); } @@ -186,7 +184,7 @@ string SALOMEDSImpl_IParameters::getProperty(const string& name) vector SALOMEDSImpl_IParameters::getProperties() { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v; return _ap->GetStrArray(_AP_PROPERTIES_LIST_); } @@ -195,14 +193,14 @@ string SALOMEDSImpl_IParameters::decodeEntry(const string& entry) { if(!_study) return entry; int pos = entry.rfind("_"); - if(pos < 0 || pos >= entry.length()) return entry; + if(pos < 0 || pos >= entry.size()) return entry; string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1); if(_compNames.find(compName) == _compNames.end()) { - Handle(SALOMEDSImpl_SObject) so = _study->FindComponent((char*)compName.c_str()); - if(so.IsNull()) return entry; - compID = so->GetID().ToCString(); + SALOMEDSImpl_SObject so = _study->FindComponent(compName); + if(!so) return entry; + compID = so.GetID(); _compNames[compName] = compID; } else compID = _compNames[compName]; @@ -214,37 +212,37 @@ string SALOMEDSImpl_IParameters::decodeEntry(const string& entry) } -bool SALOMEDSImpl_IParameters::isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID) +bool SALOMEDSImpl_IParameters::isDumpPython(SALOMEDSImpl_Study* study, const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), 0); - if(ap.IsNull()) return false; + SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), 0); + if(!ap) return false; if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false; return (bool)ap->GetBool(_AP_DUMP_PYTHON_); } -int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const string& theID) +int SALOMEDSImpl_IParameters::getLastSavePoint(SALOMEDSImpl_Study* study, const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_SObject) so = study->FindComponent((char*)anID.c_str()); - if(so.IsNull()) return -1; + SALOMEDSImpl_SObject so = study->FindComponent(anID); + if(!so) return -1; - Handle(SALOMEDSImpl_StudyBuilder) builder = study->NewBuilder(); - Handle(SALOMEDSImpl_ChildIterator) anIter ( study->NewChildIterator( so ) ); + SALOMEDSImpl_StudyBuilder* builder = study->NewBuilder(); + SALOMEDSImpl_ChildIterator anIter = study->NewChildIterator( so ); int tag = -1; - for(; anIter->More(); anIter->Next()) + for(; anIter.More(); anIter.Next()) { - Handle(SALOMEDSImpl_SObject) val( anIter->Value() ); - Handle(SALOMEDSImpl_GenericAttribute) genAttr; - if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val->Tag(); + SALOMEDSImpl_SObject val( anIter.Value() ); + DF_Attribute* genAttr; + if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val.Tag(); } return tag; @@ -252,13 +250,13 @@ int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& -string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID) +string SALOMEDSImpl_IParameters::getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), savePoint); + SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), savePoint); SALOMEDSImpl_IParameters ip(ap); string dump(""); @@ -290,10 +288,10 @@ string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study) return dump; } -string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, - const string& moduleName, - const string& shift, - const string& theID) +string SALOMEDSImpl_IParameters::getDefaultScript(SALOMEDSImpl_Study* study, + const string& moduleName, + const string& shift, + const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); @@ -306,7 +304,7 @@ string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Stud SALOMEDSImpl_IParameters ip = SALOMEDSImpl_IParameters(study->GetCommonParameters(anID.c_str(), savePoint)); if(!isDumpPython(study)) return dump; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint); + SALOMEDSImpl_AttributeParameter* ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint); ip = SALOMEDSImpl_IParameters(ap); @@ -340,9 +338,9 @@ string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Stud vector names = ip.getAllParameterNames(v[i]); vector values = ip.getAllParameterValues(v[i]); string decodedEntry = ip.decodeEntry(v[i]); - Handle(SALOMEDSImpl_SObject) so = study->FindObjectID((char*)decodedEntry.c_str()); + SALOMEDSImpl_SObject so = study->FindObjectID(decodedEntry); string so_name(""); - if(!so.IsNull()) so_name = so->GetName().ToCString(); + if(so) so_name = so.GetName(); dump += shift + "# set up entry " + v[i] +" ("+so_name+")" + " parameters" + "\n"; for(int j = 0; j < names.size() && j < values.size(); j++) dump += shift + "ipar.setParameter(\"" + v[i] + "\", \"" + names[j] + "\", \"" + values[j] + "\")\n"; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx index 756df15c8..a197b28ef 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx @@ -32,7 +32,7 @@ class Standard_EXPORT SALOMEDSImpl_IParameters { public: - SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); + SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap); virtual ~SALOMEDSImpl_IParameters(); @@ -117,23 +117,23 @@ public: /*! Returns whether there is the dumping visual parameters */ - static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = ""); + static bool isDumpPython(SALOMEDSImpl_Study* study, const std::string& theID = ""); /*! Returns an ID of the last save point */ - static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = ""); + static int getLastSavePoint(SALOMEDSImpl_Study* study, const std::string& theID = ""); /*! Returns a Python script for the study, which sets up visual parameters */ - static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = ""); + static std::string getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID = ""); /*! Returns a default Python script that set ups visual parameters for the given module shift is a string that contain spaces to make valid Python script indentaion */ - static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, + static std::string getDefaultScript(SALOMEDSImpl_Study* study, const std::string& moduleName, const std::string& shift, const std::string& theID = ""); @@ -144,8 +144,8 @@ public: static std::string getDefaultVisualComponent(); private: - Handle(SALOMEDSImpl_AttributeParameter) _ap; - Handle(SALOMEDSImpl_Study) _study; + SALOMEDSImpl_AttributeParameter* _ap; + SALOMEDSImpl_Study* _study; std::map _compNames; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx deleted file mode 100644 index d1c76693e..000000000 --- a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDSImpl_OCAFApplication.cxx -// Author : Sergey RUIN -// Module : SALOME - -#include "SALOMEDSImpl_OCAFApplication.hxx" - -using namespace std; - -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_OCAFApplication, TDocStd_Application ) - -//======================================================================= -//function : SALOMEDSImpl_OCAFApplication -//purpose : -//======================================================================= - -SALOMEDSImpl_OCAFApplication::SALOMEDSImpl_OCAFApplication() -{ -} - - -//======================================================================= -//function : Formats -//purpose : -//======================================================================= - -void SALOMEDSImpl_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats) -{ - Formats.Append(TCollection_ExtendedString ("SALOME_STUDY")); -} - - -//======================================================================= -//function : ResourcesName -//purpose : -//======================================================================= - -Standard_CString SALOMEDSImpl_OCAFApplication::ResourcesName() -{ - return Standard_CString ("SALOMEDSImpl_Resources"); -} - - - - - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx deleted file mode 100644 index 3f39b21e7..000000000 --- a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDSImpl_OCAFApplication.hxx -// Author : Sergey RUIN -// Module : SALOME - -#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile -#define _SALOMEDSImpl_OCAFApplication_HeaderFile - - -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application) - -#include -#include - - -class SALOMEDSImpl_OCAFApplication : public TDocStd_Application { - -public: - -Standard_EXPORT SALOMEDSImpl_OCAFApplication(); -Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; -Standard_EXPORT Standard_CString ResourcesName() ; -Standard_EXPORT ~SALOMEDSImpl_OCAFApplication() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_OCAFApplication ) - -}; - -#endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx index 640ce8468..ba28d3744 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx @@ -28,15 +28,34 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) +//============================================================================ +/*! Function : Empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent() +{ +} + +//============================================================================ +/*! Function : Copy constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO) +{ + _lab = theSCO._lab; + _value = theSCO._value; + _type = theSCO._type; + _name = theSCO._name; +} //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const DF_Label& theLabel) :SALOMEDSImpl_SObject(theLabel) { } @@ -47,7 +66,8 @@ SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel) */ //============================================================================ SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent() -{} +{ +} //============================================================================ @@ -55,11 +75,11 @@ SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType() +string SALOMEDSImpl_SComponent::ComponentDataType() { - TCollection_AsciiString res = ""; - Handle(SALOMEDSImpl_AttributeComment) type; - if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) { + string res = ""; + SALOMEDSImpl_AttributeComment* type; + if ( (type = (SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())) ) { res = type->Value(); } @@ -72,22 +92,22 @@ TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR) +bool SALOMEDSImpl_SComponent::ComponentIOR(string& IOR) { - Handle(SALOMEDSImpl_AttributeIOR) ior; - if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) ) + SALOMEDSImpl_AttributeIOR* ior; + if (!(ior = (SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())) ) return false; IOR = ior->Value(); return true; } - + //============================================================================ /*! Function : IsA * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel) +bool SALOMEDSImpl_SComponent::IsA(const DF_Label& theLabel) { // scomponent must contain comment and belong to the 2th depth label if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) { @@ -95,3 +115,18 @@ bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel) } return false; } + +//============================================================================ +/*! Function : GetPersistentCopy + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent* SALOMEDSImpl_SComponent::GetPersistentCopy() const +{ + SALOMEDSImpl_SComponent* sco = new SALOMEDSImpl_SComponent; + sco->_lab = _lab; + sco->_name = _name; + sco->_type = _type; + sco->_value = _value; + return sco; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx index 0def77820..1803e537a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx @@ -27,34 +27,31 @@ //SALOMEDSImpl headers #include "SALOMEDSImpl_SObject.hxx" -//Handle definition -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) - // std C++ headers #include +#include // Cascade headers -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "SALOMEDSImpl_SObject.hxx" #include -class SALOMEDSImpl_SComponent : public SALOMEDSImpl_SObject +class SALOMEDSImpl_SComponent : public virtual SALOMEDSImpl_SObject { public: - SALOMEDSImpl_SComponent(const TDF_Label& lab); + Standard_EXPORT SALOMEDSImpl_SComponent(); + Standard_EXPORT SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO); + Standard_EXPORT SALOMEDSImpl_SComponent(const DF_Label& lab); - ~SALOMEDSImpl_SComponent(); + Standard_EXPORT ~SALOMEDSImpl_SComponent(); - virtual TCollection_AsciiString ComponentDataType(); - virtual bool ComponentIOR(TCollection_AsciiString& theID); - static bool IsA(const TDF_Label& theLabel); + Standard_EXPORT virtual std::string ComponentDataType(); + Standard_EXPORT virtual bool ComponentIOR(std::string& theID); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SComponent ) + Standard_EXPORT static bool IsA(const DF_Label& theLabel); + + Standard_EXPORT SALOMEDSImpl_SComponent* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx index feddbb503..bcad98c11 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx @@ -33,10 +33,10 @@ using namespace std; */ //============================================================================ -SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument) +SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(DF_Document* theDocument) { _lab = theDocument->Main(); - _it.Initialize (_lab); + _it.Init (_lab); } //============================================================================ @@ -46,7 +46,7 @@ SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TD //============================================================================ void SALOMEDSImpl_SComponentIterator::Init() { - _it.Initialize (_lab); + _it.Init (_lab); } //============================================================================ @@ -58,14 +58,11 @@ bool SALOMEDSImpl_SComponentIterator::More() { if (!_it.More()) return false; - TDF_Label L = _it.Value(); - if (SALOMEDSImpl_SComponent::IsA(L)) - return true; - - return _it.More(); + DF_Label L = _it.Value(); + return SALOMEDSImpl_SComponent::IsA(L); } - //============================================================================ +//============================================================================ /*! Function : Next */ //============================================================================ @@ -80,8 +77,20 @@ void SALOMEDSImpl_SComponentIterator::Next() * */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value() +SALOMEDSImpl_SComponent SALOMEDSImpl_SComponentIterator::Value() { return SALOMEDSImpl_Study::SComponent(_it.Value()); } +//============================================================================ +/*! Function : GetPersistentCopy + */ +//============================================================================ +SALOMEDSImpl_SComponentIterator* SALOMEDSImpl_SComponentIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_SComponentIterator* itr = new SALOMEDSImpl_SComponentIterator(); + itr->_lab = _lab; + itr->_it = _it; + + return itr; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx index 0c076ea31..1194fc191 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx @@ -29,17 +29,17 @@ #include "SALOMEDSImpl_SComponent.hxx" // Cascade headers -#include -#include -#include +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" #include class Standard_EXPORT SALOMEDSImpl_SComponentIterator { private: - TDF_ChildIterator _it; - TDF_Label _lab; + DF_ChildIterator _it; + DF_Label _lab; public: @@ -51,13 +51,15 @@ public: SALOMEDSImpl_SComponentIterator() {}; - SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument); + SALOMEDSImpl_SComponentIterator(DF_Document* theDocument); ~SALOMEDSImpl_SComponentIterator() {}; virtual void Init(); virtual bool More(); virtual void Next(); - virtual Handle(SALOMEDSImpl_SComponent) Value(); + virtual SALOMEDSImpl_SComponent Value(); + + SALOMEDSImpl_SComponentIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx index bf4ff3bee..b385b7baa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx @@ -31,18 +31,38 @@ using namespace std; -#include #include -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SObject, MMgt_TShared ) +//============================================================================ +/*! Function : empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject() +{ +} + +//============================================================================ +/*! Function : copy constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject) +{ + _lab = theSObject._lab; + _value = theSObject._value; + _type = theSObject._type; + _name = theSObject._name; + +} + //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const DF_Label& theLabel) :_lab(theLabel) { _value = ""; @@ -56,18 +76,17 @@ SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel) */ //============================================================================ SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject() -{} +{ +} //============================================================================ /*! Function : GetID * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetID() +string SALOMEDSImpl_SObject::GetID() const { - TCollection_AsciiString anEntry; - TDF_Tool::Entry (_lab,anEntry); - return anEntry; + return _lab.Entry(); } //============================================================================ @@ -75,14 +94,15 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetID() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent() +SALOMEDSImpl_SComponent SALOMEDSImpl_SObject::GetFatherComponent() const { - TDF_Label LF = _lab; + SALOMEDSImpl_SComponent sco; + DF_Label LF = _lab; while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) { LF = LF.Father(); } - if(LF.IsRoot()) return NULL; + if(LF.IsRoot()) return sco; return GetStudy()->GetSComponent(LF); } @@ -92,7 +112,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather() +SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const { return GetStudy()->GetSObject(_lab.Father()); } @@ -103,7 +123,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy() +SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const { return SALOMEDSImpl_Study::GetStudy(_lab); } @@ -113,13 +133,13 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy() * Purpose : Find attribute of given type on this SObject */ //============================================================================ -bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute, - const TCollection_AsciiString& theTypeOfAttribute) +bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute, + const string& theTypeOfAttribute) const { - if(_lab.IsNull()) return Standard_False; - Standard_GUID aGUID = GetGUID(theTypeOfAttribute); - if (_lab.FindAttribute(aGUID, theAttribute)) return Standard_True; - return Standard_False; + if(_lab.IsNull()) return false; + std::string aGUID = GetGUID(theTypeOfAttribute); + if ((theAttribute = _lab.FindAttribute(aGUID))) return true; + return false; } @@ -129,19 +149,16 @@ bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute, * Purpose : Returns list of all attributes for this sobject */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes() +vector SALOMEDSImpl_SObject::GetAllAttributes() const { - Standard_Integer NumAttr = _lab.NbAttributes(); - Handle(TColStd_HSequenceOfTransient) SeqOfAttr = new TColStd_HSequenceOfTransient(); - Handle(SALOMEDSImpl_GenericAttribute) anAttr; - if (NumAttr != 0) { - for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) { - anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(iter.Value()); - if(!anAttr.IsNull() && anAttr->Type() != "AttributeReference") - SeqOfAttr->Append(anAttr); - } + vector va1, va = _lab.GetAttributes(); + for(int i = 0, len = va.size(); i(va[i]); + if(ga && ga->Type() != string("AttributeReference")) + va1.push_back(va[i]); } - return SeqOfAttr; + + return va1; } @@ -150,10 +167,10 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_SObject::ReferencedObject(SALOMEDSImpl_SObject& theObject) const { - Handle(SALOMEDSImpl_AttributeReference) Ref; - if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref)) + SALOMEDSImpl_AttributeReference* Ref; + if (!(Ref=(SALOMEDSImpl_AttributeReference*)_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) return false; theObject = GetStudy()->GetSObject(Ref->Get()); @@ -165,9 +182,9 @@ bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObj * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_SObject::FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject) { - TDF_Label L = _lab.FindChild(theTag, false); + DF_Label L = _lab.FindChild(theTag, false); if (L.IsNull()) return false; theObject = GetStudy()->GetSObject(L); @@ -181,12 +198,12 @@ bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetName() +string SALOMEDSImpl_SObject::GetName() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeName) aName; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) { - aStr = aName->Value(); + string aStr = ""; + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aStr =aName->Value(); } return aStr; } @@ -196,11 +213,11 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetName() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetComment() +string SALOMEDSImpl_SObject::GetComment() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeComment) aComment; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComment)) { + string aStr = ""; + SALOMEDSImpl_AttributeComment* aComment; + if ((aComment=(SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { aStr = aComment->Value(); } return aStr; @@ -211,30 +228,64 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetComment() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetIOR() +string SALOMEDSImpl_SObject::GetIOR() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeIOR) anIOR; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anIOR)) { - aStr = anIOR->Value(); + string aStr = ""; + SALOMEDSImpl_AttributeIOR* anIOR; + if ((anIOR=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + aStr = dynamic_cast(anIOR)->Value(); } return aStr; } -Standard_GUID SALOMEDSImpl_SObject::GetGUID(const TCollection_AsciiString& theType) +std::string SALOMEDSImpl_SObject::GetGUID(const string& theType) { __AttributeTypeToGUIDForSObject - if (strncmp(theType.ToCString(), "AttributeTreeNodeGUID",21) == 0) { - const char* aCType = theType.ToCString(); - char* aGUIDString = new char[40]; - sprintf(aGUIDString, &(aCType[21])); - Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name - delete(aGUIDString); - return aGUID; + if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) { + return theType.substr(21, theType.size()); } - return Standard_GUID(); + return ""; } +//============================================================================ +/*! Function : SALOMEDSImpl_SComponent + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::operator SALOMEDSImpl_SComponent() const +{ + SALOMEDSImpl_SComponent sco; + sco._lab = _lab; + sco._name = _name; + sco._type = _type; + sco._value = _value; + return sco; +} + +//============================================================================ +/*! Function : GetPersistentCopy + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject* SALOMEDSImpl_SObject::GetPersistentCopy() const +{ + SALOMEDSImpl_SObject* so = new SALOMEDSImpl_SObject; + so->_lab = _lab; + so->_name = _name; + so->_type = _type; + so->_value = _value; + return so; +} + +//============================================================================ +/*! Function : IsComponent + * Purpose : + */ +//============================================================================ +bool SALOMEDSImpl_SObject::IsComponent() const +{ + return SALOMEDSImpl_SComponent::IsA(_lab); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx index c0cced62b..80d797e41 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx @@ -24,62 +24,62 @@ #ifndef __SALOMEDSIMPL_SOBJECT_H__ #define __SALOMEDSIMPL_SOBJECT_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared ) +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" +#include +#include class SALOMEDSImpl_SComponent; -class Handle_SALOMEDSImpl_SComponent; class SALOMEDSImpl_Study; -class Handle_SALOMEDSImpl_Study; -// Cascade headers -#include -#include -#include -#include -#include -#include -#include - -class SALOMEDSImpl_SObject : public MMgt_TShared +class SALOMEDSImpl_SObject { protected: - TDF_Label _lab; - TCollection_AsciiString _name; - TCollection_AsciiString _value; - TCollection_AsciiString _type; + DF_Label _lab; + std::string _name; + std::string _value; + std::string _type; public: - Standard_EXPORT SALOMEDSImpl_SObject(const TDF_Label& theLabel); - Standard_EXPORT ~SALOMEDSImpl_SObject(); + Standard_EXPORT SALOMEDSImpl_SObject(); + Standard_EXPORT SALOMEDSImpl_SObject(const DF_Label& theLabel); + Standard_EXPORT SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject); + Standard_EXPORT virtual ~SALOMEDSImpl_SObject(); - Standard_EXPORT virtual TCollection_AsciiString GetID(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetFatherComponent(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetFather() ; - Standard_EXPORT virtual bool FindAttribute(Handle(TDF_Attribute)& theAttribute, const TCollection_AsciiString& theTypeOfAttribute); - Standard_EXPORT virtual bool ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) ; - Standard_EXPORT virtual bool FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual std::string GetID() const; + Standard_EXPORT virtual SALOMEDSImpl_SComponent GetFatherComponent() const; + Standard_EXPORT virtual SALOMEDSImpl_SObject GetFather() const ; + Standard_EXPORT virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const; + Standard_EXPORT virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ; + Standard_EXPORT virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudy() ; - Standard_EXPORT virtual TCollection_AsciiString Name() { return _name; } - Standard_EXPORT virtual void Name(const TCollection_AsciiString& theName) { _name = theName; } - Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetAllAttributes(); + Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudy() const; + Standard_EXPORT virtual std::string Name() const { return _name; } + Standard_EXPORT virtual void Name(const std::string& theName) { _name = theName; } + Standard_EXPORT virtual std::vector GetAllAttributes() const; - Standard_EXPORT virtual TCollection_AsciiString GetName(); - Standard_EXPORT virtual TCollection_AsciiString GetComment(); - Standard_EXPORT virtual TCollection_AsciiString GetIOR(); + Standard_EXPORT virtual std::string GetName() const ; + Standard_EXPORT virtual std::string GetComment() const; + Standard_EXPORT virtual std::string GetIOR() const; - Standard_EXPORT virtual int Tag() { return _lab.Tag(); } - Standard_EXPORT virtual int Depth() { return _lab.Depth(); } + Standard_EXPORT virtual int Tag() const { return _lab.Tag(); } + Standard_EXPORT virtual int Depth() const { return _lab.Depth(); } - Standard_EXPORT virtual TDF_Label GetLabel() { return _lab; } + Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; } - Standard_EXPORT static Standard_GUID GetGUID(const TCollection_AsciiString& theTypeOfAttribute); + Standard_EXPORT bool IsNull() const { return _lab.IsNull(); } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject ) + Standard_EXPORT bool IsComponent() const; + + Standard_EXPORT operator SALOMEDSImpl_SComponent() const; + + Standard_EXPORT operator bool () const { return !IsNull(); } + + Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const; + + Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute); + + }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 7c9225a3f..34ee8ed7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -26,19 +26,8 @@ using namespace std; -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_Application.hxx" +#include "DF_ChildIterator.hxx" #include "SALOMEDSImpl_ChildNodeIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" @@ -48,38 +37,34 @@ using namespace std; #include "SALOMEDSImpl_Tool.hxx" #include "SALOMEDSImpl_IParameters.hxx" -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared ) +#include #define DIRECTORYID 16661 #define FILELOCALID 26662 #define FILEID "FILE: " + //============================================================================ /*! Function : SALOMEDSImpl_Study * Purpose : SALOMEDSImpl_Study constructor */ //============================================================================ -SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc, - const TCollection_AsciiString& study_name) +SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, + const string& study_name) { - doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work _name = study_name; - _doc = doc; + _doc = (DF_Document*)doc; _Saved = false ; _URL = ""; _StudyId = -1; - _autoFill = true; - myNbPostponed.Append(0); - myNbUndos = 0; + _autoFill = false; _errorCode = ""; _useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc); _builder = new SALOMEDSImpl_StudyBuilder(this); _cb = new SALOMEDSImpl_Callback(_useCaseBuilder); //Put on the root label a StudyHandle attribute to store the address of this object - //It will be used to retrieve the study object by TDF_Label that belongs to the study + //It will be used to retrieve the study object by DF_Label that belongs to the study SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this); - _lockers = new TColStd_HSequenceOfAsciiString(); } @@ -96,24 +81,24 @@ SALOMEDSImpl_Study::~SALOMEDSImpl_Study() * Purpose : Get persistent reference of study (idem URL()) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference() +string SALOMEDSImpl_Study::GetPersistentReference() { _errorCode = ""; return URL(); } //============================================================================ /*! Function : GetTransientReference - * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root) + * Purpose : Get IOR of the Study (registred in Document in doc->Root) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference() +string SALOMEDSImpl_Study::GetTransientReference() { _errorCode = ""; - TCollection_AsciiString IOR = ""; + string IOR = ""; - Handle(SALOMEDSImpl_AttributeIOR) Att; - TDF_Label _lab = _doc->GetData()->Root(); - if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) { + SALOMEDSImpl_AttributeIOR* Att; + DF_Label _lab = _doc->Root(); + if ((Att=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { IOR = Att->Value(); } else { @@ -123,18 +108,18 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference() return IOR; } -void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR) +void SALOMEDSImpl_Study::SetTransientReference(const string& theIOR) { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); int aLocked = aProp->IsLocked(); - if (aLocked) aProp->SetLocked(Standard_False); + if (aLocked) aProp->SetLocked(false); // Assign the value of the IOR in the study->root SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR); - if (aLocked) aProp->SetLocked(Standard_True); + if (aLocked) aProp->SetLocked(true); } //============================================================================ @@ -145,7 +130,7 @@ void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& th bool SALOMEDSImpl_Study::IsEmpty() { _errorCode = ""; - if (_doc.IsNull()) return true; + if (!_doc) return true; return _doc->IsEmpty(); } @@ -154,17 +139,17 @@ bool SALOMEDSImpl_Study::IsEmpty() * Purpose : Find a Component with ComponentDataType = aComponentName */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponent (const string& aComponentName) { _errorCode = ""; bool _find = false; - TCollection_AsciiString name; + string name; SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator(); - Handle(SALOMEDSImpl_SComponent) compo; + SALOMEDSImpl_SComponent compo; for (; itcomp.More(); itcomp.Next()) { - Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); - name = SC->ComponentDataType(); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + name = SC.ComponentDataType(); if(aComponentName == name) { _find = true; return SC; @@ -174,7 +159,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec if(!_find) { _errorCode = "No component was found"; - return NULL; + return compo; } return compo; } @@ -184,20 +169,20 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec * Purpose : Find a Component from it's ID */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& aComponentID) { _errorCode = ""; // Iterate on each components defined in the study // Get the component ID and compare with aComponentID bool _find = false; - TCollection_AsciiString ID; - Handle(SALOMEDSImpl_SComponent) compo; + string ID; + SALOMEDSImpl_SComponent compo; SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator(); for (; itcomp.More(); itcomp.Next()) { - Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); - ID = SC->GetID(); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + ID = SC.GetID(); if(aComponentID == ID) { // ComponentID found @@ -208,7 +193,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle if(!_find) { _errorCode = "No component was found"; - compo = NULL; + compo = compo; } return compo; @@ -219,7 +204,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName) { _errorCode = ""; @@ -227,14 +212,14 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As // After testing the component name, iterate in all objects defined under // components (function _FindObject) bool _find = false; - Handle(SALOMEDSImpl_SObject) RefSO = NULL; + SALOMEDSImpl_SObject RefSO; SALOMEDSImpl_SComponentIterator it = NewComponentIterator(); for (; it.More();it.Next()){ if(!_find) { - Handle(SALOMEDSImpl_SComponent) SC = it.Value(); - if (SC->GetName() == anObjectName) + SALOMEDSImpl_SComponent SC = it.Value(); + if (SC.GetName() == anObjectName) { _find = true; RefSO = SC; @@ -243,7 +228,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As if (!_find) RefSO = _FindObject(SC, anObjectName, _find); } } - if(RefSO.IsNull()) _errorCode = "No object was found"; + if(!RefSO) _errorCode = "No object was found"; return RefSO; } @@ -252,17 +237,17 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As * Purpose : Find an Object with ID = anObjectID */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectID(const string& anObjectID) { _errorCode = ""; - - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab); + SALOMEDSImpl_SObject so; + + // Convert aSO->GetID in DF_Label. + DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, false); if (Lab.IsNull()) { _errorCode = "No label was found by ID"; - return NULL; + return so; } return GetSObject(Lab); @@ -273,17 +258,17 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_ * Purpose : Creates an Object with ID = anObjectID */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID) { _errorCode = ""; + SALOMEDSImpl_SObject so; - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True); + // Convert aSO->GetID in DF_Label. + DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, true); if (Lab.IsNull()) { _errorCode = "Can not create a label"; - return NULL; + return so; } return GetSObject(Lab); @@ -295,38 +280,38 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollectio * : with ComponentDataType = aComponentName */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName, - const TCollection_AsciiString& aComponentName) +vector SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName, + const string& aComponentName) { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient(); + vector listSO; - Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ; - if ( compo.IsNull() ) { + SALOMEDSImpl_SComponent compo = FindComponent(aComponentName) ; + if ( !compo ) { _errorCode = "Can not find the component"; return listSO; } // Iterate on each object and subobject of the component // If objectName is found add it to the list of SObjects - TCollection_AsciiString childName ; + string childName ; - TCollection_AsciiString compoId = compo->GetID(); - Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo); - for ( ; it->More(); it->Next() ) { + string compoId = compo.GetID(); + SALOMEDSImpl_ChildIterator it = NewChildIterator(compo); + for ( ; it.More(); it.Next() ) { - Handle(SALOMEDSImpl_SObject) CSO = it->Value(); - if ( CSO->GetName() == anObjectName ) { + SALOMEDSImpl_SObject CSO = it.Value(); + if ( CSO.GetName() == anObjectName ) { /* add to list */ - listSO->Append(CSO) ; + listSO.push_back(CSO) ; } /* looks also for eventual children */ bool found = false ; CSO = _FindObject( CSO, anObjectName, found ) ; if( found) { - listSO->Append(CSO) ; + listSO.push_back(CSO) ; } } @@ -340,21 +325,23 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const * Purpose : Find an Object with IOR = anObjectIOR */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectIOR(const string& anObjectIOR) { _errorCode = ""; - Handle(SALOMEDSImpl_SObject) aResult = NULL; + SALOMEDSImpl_SObject aResult ; // searching in the datamap for optimization - if (myIORLabels.IsBound(anObjectIOR)) { - aResult = GetSObject(myIORLabels.Find(anObjectIOR)); + if (myIORLabels.find(anObjectIOR) != myIORLabels.end()) { + aResult = GetSObject(myIORLabels[anObjectIOR]); // 11 oct 2002: forbidden attributes must be checked here - if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) - myIORLabels.UnBind(anObjectIOR); + if (!aResult.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { + myIORLabels.erase(anObjectIOR); + aResult = SALOMEDSImpl_SObject(); + } } - if(aResult.IsNull()) _errorCode = "No object was found"; + if(!aResult) _errorCode = "No object was found"; return aResult; } @@ -363,61 +350,60 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection * Purpose : Find an Object by its path = thePath */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath) { _errorCode = ""; - TCollection_AsciiString aPath(thePath), aToken; - Handle(SALOMEDSImpl_SObject) aSO = NULL; - int i = 1, aLength = aPath.Length(); + string aPath(thePath), aToken; + SALOMEDSImpl_SObject aSO; + int aLength = aPath.size(); bool isRelative = false; if(aLength == 0) { //Empty path - return the current context return GetSObject(_current); } - if(aPath.Value(1) != '/') //Relative path + if(aPath[0] != '/') //Relative path isRelative = true; - TDF_ChildIterator anIterator; - TDF_Label aLabel; - Handle(SALOMEDSImpl_AttributeName) anAttr; + DF_ChildIterator anIterator; + DF_Label aLabel; + SALOMEDSImpl_AttributeName* anAttr; if(isRelative) { - if(_current.IsNull()) return NULL; - anIterator.Initialize(_current, Standard_False); + if(_current.IsNull()) return aSO; + anIterator.Init(_current, false); } else { - if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root + if(aPath.size() == 1 && aPath[0] == '/') { //Root return GetSObject(_doc->Main()); } - anIterator.Initialize(_doc->Main(), Standard_False); + anIterator.Init(_doc->Main(), false); } - while(i <= aLength) { + vector vs = SALOMEDSImpl_Tool::splitString(aPath, '/'); + for(int i = 0, len = vs.size(); iValue() == aToken) { - aToken = aPath.Token("/", i+1); //Check if it was the last part of the path - if(aToken.Length() == 0) { //The searched label is found (no part of the path is left) + if(i == (len-1)) { //The searched label is found (no part of the path is left) return GetSObject(aLabel); } - anIterator.Initialize(aLabel, Standard_False); + anIterator.Init(aLabel, false); break; } } } - i++; } - if(aSO.IsNull()) _errorCode = "No object was found"; + if(!aSO) _errorCode = "No object was found"; return aSO; } @@ -426,27 +412,27 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollect * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject) +string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject) { _errorCode = ""; - TCollection_AsciiString aPath(""); - if(theObject.IsNull()) { + string aPath(""); + if(!theObject) { _errorCode = "Null object"; - return aPath.ToCString(); + return aPath; } - TCollection_AsciiString aName = theObject->GetName(); - if(!aName.IsEmpty() && aName != "" ) { - TCollection_AsciiString aValue((char*)aName.ToCString()); - aValue.Prepend("/"); + string aName = theObject.GetName(); + if(!aName.empty() && aName != "" ) { + string aValue("/"); + aValue+=aName; aValue += aPath; aPath = aValue; - Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather(); - if(!aFather.IsNull()) { - aName = aFather->GetName(); - if(!aName.IsEmpty() && aName != "") { - aValue = (char*)GetObjectPath(aFather).ToCString(); + SALOMEDSImpl_SObject aFather = theObject.GetFather(); + if(aFather) { + aName = aFather.GetName(); + if(!aName.empty() && aName != "") { + aValue = GetObjectPath(aFather); aPath = aValue + aPath; } } @@ -461,13 +447,13 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSI * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR) +string SALOMEDSImpl_Study::GetObjectPathByIOR(const string& theIOR) { _errorCode = ""; - TCollection_AsciiString aPath; - Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR); - if(so.IsNull()) { + string aPath; + SALOMEDSImpl_SObject so = FindObjectIOR(theIOR); + if(!so) { _errorCode = "No SObject was found by IOR"; return aPath; } @@ -481,19 +467,19 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection * Purpose : Sets the current context */ //============================================================================ -bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) +bool SALOMEDSImpl_Study::SetContext(const string& thePath) { _errorCode = ""; - if(thePath.IsEmpty()) { + if(thePath.empty()) { _errorCode = "InvalidPath"; return false; } - TCollection_AsciiString aPath(thePath), aContext(""); + string aPath(thePath), aContext(""); bool isInvalid = false; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; - if(aPath.Value(1) != '/') { //Relative path + if(aPath[0] != '/') { //Relative path aContext = GetContext(); aContext += '/'; aContext += aPath; @@ -502,18 +488,18 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) aContext = aPath; try { - aSO = FindObjectByPath(aContext.ToCString()); + aSO = FindObjectByPath(aContext); } catch( ... ) { isInvalid = true; } - if(isInvalid || aSO.IsNull()) { + if(isInvalid || !aSO) { _errorCode = "InvalidContext"; return false; } - TDF_Label aLabel = aSO->GetLabel(); + DF_Label aLabel = aSO.GetLabel(); if(aLabel.IsNull()) { _errorCode = "InvalidContext"; return false; @@ -529,7 +515,7 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) * Purpose : Gets the current context */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetContext() +string SALOMEDSImpl_Study::GetContext() { _errorCode = ""; @@ -537,7 +523,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() _errorCode = "InvaidContext"; return ""; } - Handle(SALOMEDSImpl_SObject) so = GetSObject(_current); + SALOMEDSImpl_SObject so = GetSObject(_current); return GetObjectPath(so); } @@ -546,16 +532,16 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext) +vector SALOMEDSImpl_Study::GetObjectNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -565,11 +551,12 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels + DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDSImpl_AttributeName) aName; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value()); + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + aResultSeq.push_back(aName->Value()); } return aResultSeq; @@ -580,16 +567,16 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext) +vector SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -599,15 +586,15 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels + DF_ChildIterator anIter (aLabel, true); // iterate first-level children at all sublevels for (; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDSImpl_AttributeLocalID) anID; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) { + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeLocalID* anID; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == DIRECTORYID) { - Handle(SALOMEDSImpl_AttributeName) aName; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) { - aResultSeq->Append(aName->Value()); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aResultSeq.push_back(aName->Value()); } } } @@ -621,16 +608,16 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext) +vector SALOMEDSImpl_Study::GetFileNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -640,17 +627,17 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels + DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDSImpl_AttributeLocalID) anID; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) { + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeLocalID* anID; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == FILELOCALID) { - Handle(SALOMEDSImpl_AttributePersistentRef) aName; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) { - TCollection_ExtendedString aFileName = aName->Value(); - if (aFileName.Length() > 0) - aResultSeq->Append(aFileName.Split(strlen(FILEID))); + SALOMEDSImpl_AttributePersistentRef* aName; + if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + std::string aFileName = aName->Value(); + if (aFileName.size() > 0) + aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size())); } } } @@ -664,16 +651,17 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC * Purpose : method to get all components names */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext) +vector SALOMEDSImpl_Study::GetComponentNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level + vector aResultSeq; + DF_ChildIterator anIter(_doc->Main(), false); // iterate all subchildren at first level for(; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDSImpl_AttributeName) aName; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value()); + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + aResultSeq.push_back(aName->Value()); } return aResultSeq; @@ -684,10 +672,10 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(con * Purpose : Create a ChildIterator from an SObject */ //============================================================================ -Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO) +SALOMEDSImpl_ChildIterator SALOMEDSImpl_Study::NewChildIterator(const SALOMEDSImpl_SObject& aSO) { _errorCode = ""; - return new SALOMEDSImpl_ChildIterator(aSO); + return SALOMEDSImpl_ChildIterator(aSO); } @@ -708,7 +696,7 @@ SALOMEDSImpl_SComponentIterator SALOMEDSImpl_Study::NewComponentIterator() * Purpose : Create a StudyBuilder */ //============================================================================ -Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder() +SALOMEDSImpl_StudyBuilder* SALOMEDSImpl_Study::NewBuilder() { _errorCode = ""; if(_autoFill) { @@ -724,7 +712,7 @@ Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder() * Purpose : get study name */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::Name() +string SALOMEDSImpl_Study::Name() { _errorCode = ""; return _name; @@ -735,7 +723,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::Name() * Purpose : set study name */ //============================================================================ -void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name) +void SALOMEDSImpl_Study::Name(const string& name) { _errorCode = ""; _name = name; @@ -761,7 +749,7 @@ void SALOMEDSImpl_Study::IsSaved(bool save) { _errorCode = ""; _Saved = save; - if(save) _doc->UnModify(); + if(save) _doc->SetModified(false); } //============================================================================ @@ -784,7 +772,7 @@ bool SALOMEDSImpl_Study::IsModified() * Purpose : get URL of the study (persistent reference of the study) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::URL() +string SALOMEDSImpl_Study::URL() { _errorCode = ""; return _URL; @@ -795,13 +783,13 @@ TCollection_AsciiString SALOMEDSImpl_Study::URL() * Purpose : set URL of the study (persistent reference of the study) */ //============================================================================ -void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) +void SALOMEDSImpl_Study::URL(const string& url) { _errorCode = ""; _URL = url; /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study - TCollection_AsciiString tmp(_URL); + string tmp(_URL); char *aName = (char*)tmp.ToCString(); char *adr = strtok(aName, "/"); @@ -820,25 +808,25 @@ void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectName, +SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO, + const string& theObjectName, bool& _find) { - if(SO.IsNull()) return NULL; + SALOMEDSImpl_SObject RefSO; + if(!SO) return RefSO; // Iterate on each objects and subobjects of the component // If objectName find, stop the loop and get the object reference - Handle(SALOMEDSImpl_SObject) RefSO; - Handle(SALOMEDSImpl_AttributeName) anAttr; + SALOMEDSImpl_AttributeName* anAttr; - TCollection_AsciiString soid = SO->GetID(); - TDF_ChildIterator it(SO->GetLabel()); + string soid = SO.GetID(); + DF_ChildIterator it(SO.GetLabel()); for (; it.More(); it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) + if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - TCollection_AsciiString Val(anAttr->Value()); + string Val(anAttr->Value()); if (Val == theObjectName) { RefSO = GetSObject(it.Value()); @@ -856,25 +844,25 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOME * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR */ //============================================================================ -Handle(SALOMEDSImpl_SObject) -SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectIOR, +SALOMEDSImpl_SObject +SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, + const string& theObjectIOR, bool& _find) { - if(SO.IsNull()) return NULL; + SALOMEDSImpl_SObject RefSO, aSO; + if(!SO) return RefSO; // Iterate on each objects and subobjects of the component // If objectName find, stop the loop and get the object reference - Handle(SALOMEDSImpl_SObject) RefSO, aSO; - Handle(SALOMEDSImpl_AttributeIOR) anAttr; + SALOMEDSImpl_AttributeIOR* anAttr; - TDF_ChildIterator it(SO->GetLabel()); + DF_ChildIterator it(SO.GetLabel()); for (; it.More();it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { - TCollection_AsciiString Val(anAttr->Value()); + string Val(anAttr->Value()); if (Val == theObjectIOR) { RefSO = GetSObject(it.Value()); @@ -906,51 +894,47 @@ void SALOMEDSImpl_Study::StudyId(int id) _StudyId = id; } -void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry) +void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& anEntry) { _errorCode = ""; - TDF_Label aLabel; - char* anEn = (char*)anEntry.ToCString(); - char* IOR = (char*)anIOR.ToCString(); - TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True); - if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR)); - myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel); + DF_Label aLabel = DF_Label::Label(_doc->Main(), anEntry, true); + if (myIORLabels.find(anIOR) != myIORLabels.end()) myIORLabels.erase(anIOR); + myIORLabels[anIOR] = aLabel; } -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel) +SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel) { - Handle(SALOMEDSImpl_StudyHandle) Att; - if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) { - return Att->GetHandle(); + SALOMEDSImpl_StudyHandle* Att; + if ((Att=(SALOMEDSImpl_StudyHandle*)theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID()))) { + return Att->Get(); } return NULL; } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::SObject(const DF_Label& theLabel) { return GetStudy(theLabel)->GetSObject(theLabel); } -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::SComponent(const DF_Label& theLabel) { return GetStudy(theLabel)->GetSComponent(theLabel); } -void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute) +void SALOMEDSImpl_Study::IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute) { - TCollection_AsciiString aString; - TDF_Tool::Entry(theAttribute->Label(), aString); + string aString = theAttribute->Label().Entry(); GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString); } -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject) +vector SALOMEDSImpl_Study::FindDependances(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) aSeq; + vector aSeq; - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) { + SALOMEDSImpl_AttributeTarget* aTarget; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)anObject.GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { return aTarget->Get(); } @@ -958,48 +942,48 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const H } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties() +SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_Study::GetProperties() { _errorCode = ""; return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main()); } -TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate() +string SALOMEDSImpl_Study::GetLastModificationDate() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int aLastIndex = aNames->Length(); + int aLastIndex = aNames.size()-1; char aResult[20]; sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", - (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)), - (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex))); - TCollection_AsciiString aResStr (aResult); + (int)(aDays[aLastIndex]),(int)(aMonths[aLastIndex]), (int)(aYears[aLastIndex]), + (int)(aHours[aLastIndex]), (int)(aMinutes[aLastIndex])); + string aResStr (aResult); return aResStr; } -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate() +vector SALOMEDSImpl_Study::GetModificationsDate() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int anIndex, aLength = aNames->Length(); - Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString; + int anIndex, aLength = aNames.size(); + vector aDates; - for (anIndex = 2; anIndex <= aLength; anIndex++) { + for (anIndex = 1; anIndex < aLength; anIndex++) { char aDate[20]; sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", - (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)), - (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex))); - aDates->Append(aDate); + (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]), + (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); + aDates.push_back(aDate); } return aDates; } @@ -1011,7 +995,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate( * Purpose : Returns a UseCase builder */ //============================================================================ -Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() +SALOMEDSImpl_UseCaseBuilder* SALOMEDSImpl_Study::GetUseCaseBuilder() { _errorCode = ""; return _useCaseBuilder; @@ -1026,117 +1010,10 @@ Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() void SALOMEDSImpl_Study::Close() { _errorCode = ""; - Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application()); - if(!anApp.IsNull()) anApp->Close(_doc); - _doc.Nullify(); - _mapOfSO.Clear(); - _mapOfSCO.Clear(); -} - -//============================================================================ -/*! Function : AddPostponed - * Purpose : - */ - //============================================================================ -void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR) -{ - _errorCode = ""; - if (!NewBuilder()->HasOpenCommand()) return; - TCollection_AsciiString anIOR(theIOR); - anIOR.Prepend("d"); - myPostponedIORs.Append(anIOR); // add prefix: deleted - myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); -} - -//============================================================================ -/*! Function : AddCreatedPostponed - * Purpose : - */ - //============================================================================ -void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR) -{ - _errorCode = ""; - if (!NewBuilder()->HasOpenCommand()) return; - TCollection_AsciiString anIOR(theIOR); - anIOR.Prepend("c"); - myPostponedIORs.Append(anIOR); // add prefix: created - myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); -} - -//============================================================================ -/*! Function : RemovePostponed - * Purpose : - */ -//============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit) -{ - _errorCode = ""; - - int anIndex; - int anOld; - - int aUndoLimit = theUndoLimit; - if (theUndoLimit < 0) aUndoLimit = 0; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString; - - if (myNbUndos > 0) { // remove undone - anOld = 0; - for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++) - anOld += myNbPostponed(anIndex); - int aNew = myPostponedIORs.Length() - myNbPostponed.Last(); - - for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) { - TCollection_AsciiString anIOR = myPostponedIORs(anIndex); - if (anIOR.Value(1) == 'c') { - aSeq->Append(anIOR.Split(1).ToCString()); - } - } - if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew); - if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1); - - myNbUndos = 0; - } - - if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone - anOld = 0; - for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--) - anOld += myNbPostponed(anIndex); - for(anIndex = 1; anIndex <= anOld; anIndex++) { - TCollection_AsciiString anIOR = myPostponedIORs(anIndex); - if (anIOR.Value(1) == 'd') { - aSeq->Append(anIOR.Split(1).ToCString()); - } - } - if (anOld > 0) myPostponedIORs.Remove(1, anOld); - myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit); - } - - if (theUndoLimit == -1) { // remove all IORs from the study on the study close - TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True); - for(; anIter.More(); anIter.Next()) { - Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value()); - aSeq->Append(anAttr->Value()); - } - } else myNbPostponed.Append(0); - - return aSeq; -} - -//============================================================================ -/*! Function : UndoPostponed - * Purpose : - */ -//============================================================================ -void SALOMEDSImpl_Study::UndoPostponed(const int theWay) -{ - _errorCode = ""; - - myNbUndos += theWay; - // remove current postponed - if (myNbPostponed.Last() > 0) - myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length()); - myNbPostponed(myNbPostponed.Length()) = 0; + _doc->GetApplication()->Close(_doc); + _doc = NULL; + _mapOfSO.clear(); + _mapOfSCO.clear(); } @@ -1145,16 +1022,15 @@ void SALOMEDSImpl_Study::UndoPostponed(const int theWay) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const string& theEntry) { - Handle(SALOMEDSImpl_SComponent) aSCO; - if(_mapOfSCO.IsBound(theEntry)) - aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry)); + SALOMEDSImpl_SComponent aSCO; + if(_mapOfSCO.find(theEntry) != _mapOfSCO.end()) + aSCO = _mapOfSCO[theEntry]; else { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - aSCO = new SALOMEDSImpl_SComponent(aLabel); - _mapOfSCO.Bind(theEntry, aSCO); + DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry); + aSCO = SALOMEDSImpl_SComponent(aLabel); + _mapOfSCO[theEntry] = aSCO; } return aSCO; @@ -1165,11 +1041,9 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollect * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const DF_Label& theLabel) { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel, anEntry); - return GetSComponent(anEntry); + return SALOMEDSImpl_SComponent(theLabel); } //============================================================================ @@ -1177,16 +1051,15 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Labe * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const string& theEntry) { - Handle(SALOMEDSImpl_SObject) aSO; - if(_mapOfSO.IsBound(theEntry)) - aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry)); + SALOMEDSImpl_SObject aSO; + if(_mapOfSO.find(theEntry) != _mapOfSO.end()) + aSO = _mapOfSO[theEntry]; else { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - aSO = new SALOMEDSImpl_SObject(aLabel); - _mapOfSO.Bind(theEntry, aSO); + DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry); + aSO = SALOMEDSImpl_SObject(aLabel); + _mapOfSO[theEntry] = aSO; } return aSO; @@ -1197,11 +1070,9 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_As * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel) { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel, anEntry); - return GetSObject(anEntry); + return SALOMEDSImpl_SObject(theLabel); } //============================================================================ @@ -1209,12 +1080,12 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& the * Purpose : */ //============================================================================ -Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry, - const TCollection_AsciiString& theType) +DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, + const string& theType) { - Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry); - Handle(TDF_Attribute) anAttr; - aSO->FindAttribute(anAttr, theType); + SALOMEDSImpl_SObject aSO = GetSObject(theEntry); + DF_Attribute* anAttr; + aSO.FindAttribute(anAttr, theType); return anAttr; } @@ -1223,8 +1094,8 @@ Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiSt * Purpose : */ //============================================================================ -bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, - const TCollection_AsciiString& theBaseName, +bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, + const string& theBaseName, bool isPublished, SALOMEDSImpl_DriverFactory* theFactory) { @@ -1235,33 +1106,33 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, return false; } - TColStd_SequenceOfExtendedString aSeq; - TCollection_AsciiString aCompType, aFactoryType; + vector aSeq; + string aCompType, aFactoryType; //Build a list of all components in the Study SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator(); for (; itcomponent.More(); itcomponent.Next()) { - Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); - aCompType = sco->ComponentDataType(); + SALOMEDSImpl_SComponent sco = itcomponent.Value(); + aCompType = sco.ComponentDataType(); //GEOM and MED are independent components if (aCompType == "GEOM" || aCompType == "MED") - aSeq.Prepend(TCollection_ExtendedString(aCompType)); + aSeq.insert(aSeq.begin(), aCompType); else - aSeq.Append(TCollection_ExtendedString(aCompType)); + aSeq.push_back(aCompType); } #ifdef WIN32 - TCollection_AsciiString aFileName = - thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py"); + string aFileName = + thePath + string("\\") + theBaseName + string(".py"); #else - TCollection_AsciiString aFileName = - thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py"); + string aFileName = + thePath + string("/") + theBaseName + string(".py"); #endif //Create a file that will contain a main Study script fstream fp; - fp.open(aFileName.ToCString(), ios::out); + fp.open(aFileName.c_str(), ios::out); #ifdef WIN32 bool isOpened = fp.is_open(); @@ -1270,15 +1141,15 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; + _errorCode = string("Can't create a file ")+aFileName; return false; } - TCollection_AsciiString aBatchModeScript = "salome"; + string aBatchModeScript = "salome"; //Output to the main Study script required Python modules import, //set sys.path and add a creation of the study. - fp << GetDumpStudyComment().ToCString() << endl << endl; + fp << GetDumpStudyComment() << endl << endl; fp << "import sys" << endl; fp << "import " << aBatchModeScript << endl << endl; @@ -1298,26 +1169,26 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, } - Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString; + vector aSeqOfFileNames; //Iterate all components and create the componponents specific scripts. bool isOk = true; - int aLength = aSeq.Length(); + int aLength = aSeq.size(); for(int i = 1; i <= aLength; i++) { - aCompType = aSeq.Value(i); - Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType); + aCompType = aSeq[i-1]; + SALOMEDSImpl_SComponent sco = FindComponent(aCompType); SALOMEDSImpl_Driver* aDriver = NULL; // if there is an associated Engine call its method for saving - TCollection_AsciiString IOREngine; + string IOREngine; try { - if (!sco->ComponentIOR(IOREngine)) { - if (!aCompType.IsEmpty()) { + if (!sco.ComponentIOR(IOREngine)) { + if (!aCompType.empty()) { aDriver = theFactory->GetDriverByType(aCompType); if (aDriver != NULL) { - Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder(); + SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); if(!SB->LoadWith(sco, aDriver)) { _errorCode = SB->GetErrorCode(); return false; @@ -1338,26 +1209,26 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, bool isValidScript; long aStreamLength = 0; - Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength); + SALOMEDSImpl_TMPFile* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength); if ( !isValidScript ) isOk = false; //Create a file that will contain the component specific script fstream fp2; #ifdef WIN32 - aFileName=thePath+TCollection_AsciiString("\\"); + aFileName=thePath+string("\\"); #else - aFileName=thePath+TCollection_AsciiString("/"); + aFileName=thePath+string("/"); #endif - TCollection_AsciiString aScriptName; + string aScriptName; aScriptName += theBaseName; aScriptName += "_"; aScriptName += aCompType; - aFileName += aScriptName+ TCollection_AsciiString(".py"); - aSeqOfFileNames->Append(aFileName); + aFileName += aScriptName+ string(".py"); + aSeqOfFileNames.push_back(aFileName); - fp2.open(aFileName.ToCString(), ios::out); + fp2.open(aFileName.c_str(), ios::out); #ifdef WIN32 isOpened = fp2.is_open(); @@ -1366,7 +1237,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; + _errorCode = string("Can't create a file ")+aFileName; SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false); return false; } @@ -1375,6 +1246,8 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, fp2 << aStream->Data(); fp2.close(); + if(aStream) delete aStream; + //Add to the main script a call to RebuildData of the generated by the component the Python script fp << "import " << aScriptName << endl; fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl; @@ -1398,29 +1271,30 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, //purpose : return a header comment for a DumpStudy script //======================================================================= -TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) +string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) { - TCollection_AsciiString txt + string txt ("### This file is generated by SALOME automatically by dump python functionality"); if ( theComponentName ) - txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component"; + txt += string(" of ") + (char*) theComponentName + " component"; return txt; } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, +void dumpSO(const SALOMEDSImpl_SObject& theSO, fstream& fp, - const TCollection_AsciiString& Tab, - const Handle(SALOMEDSImpl_Study) theStudy); + const string& Tab, + SALOMEDSImpl_Study* theStudy); + //============================================================================ /*! Function : dump * Purpose : */ //============================================================================ -void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) +void SALOMEDSImpl_Study::dump(const string& theFileName) { //Create a file that will contain a main Study script fstream fp; - fp.open(theFileName.ToCString(), ios::out); + fp.open(theFileName.c_str(), ios::out); #ifdef WIN32 bool isOpened = fp.is_open(); @@ -1429,65 +1303,64 @@ void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName; + _errorCode = string("Can't create a file ")+theFileName; cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl; return; } - Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1"); + SALOMEDSImpl_SObject aSO = FindObjectID("0:1"); fp << "0:1" << endl; - Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO); - TCollection_AsciiString aTab(" "); - for(; Itr->More(); Itr->Next()) { - dumpSO(Itr->Value(), fp, aTab, this); + SALOMEDSImpl_ChildIterator Itr = NewChildIterator(aSO); + string aTab(" "); + for(; Itr.More(); Itr.Next()) { + dumpSO(Itr.Value(), fp, aTab, this); } fp.close(); } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, +void dumpSO(const SALOMEDSImpl_SObject& theSO, fstream& fp, - const TCollection_AsciiString& Tab, - const Handle(SALOMEDSImpl_Study) theStudy) + const string& Tab, + SALOMEDSImpl_Study* theStudy) { - TCollection_AsciiString aTab(Tab), anID(theSO->GetID()); + string aTab(Tab), anID(theSO.GetID()); fp << aTab << anID << endl; - TDF_AttributeIterator anItr(theSO->GetLabel()); - for(; anItr.More(); anItr.Next()) { - Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value()); + vector attribs = theSO.GetLabel().GetAttributes(); + for(int i = 0; i(attribs[i]); - if(anAttr.IsNull()) { - fp << Tab << " -- " << anItr.Value()->DynamicType(); + if(!anAttr) { continue; } - TCollection_AsciiString aType = anAttr->GetClassType(); + string aType = anAttr->GetClassType(); fp << Tab << " -- " << aType; - if(aType == "AttributeReal") { - fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value(); + if(aType == string("AttributeReal")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeInteger") { - fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeInteger")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeName") { - fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeName")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeComment") { - fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeComment")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeReference") { - fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save(); + else if(aType == string("AttributeReference")) { + fp << " : " << dynamic_cast(anAttr)->Save(); } fp << endl; } - Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO); - TCollection_AsciiString aNewTab(" "); + SALOMEDSImpl_ChildIterator Itr = theStudy->NewChildIterator(theSO); + string aNewTab(" "); aNewTab+=aTab; - for(; Itr->More(); Itr->Next()) { - dumpSO(Itr->Value(), fp, aNewTab, theStudy); + for(; Itr.More(); Itr.Next()) { + dumpSO(Itr.Value(), fp, aNewTab, theStudy); } return; @@ -1496,7 +1369,7 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, void SALOMEDSImpl_Study::Modify() { _errorCode = ""; - _doc->Modify(); + _doc->SetModified(true); } //============================================================================ @@ -1504,28 +1377,29 @@ void SALOMEDSImpl_Study::Modify() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) { if (theSavePoint < 0) return NULL; - Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); - Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID); - if (so.IsNull()) so = builder->NewComponent((char*)theID); - Handle(SALOMEDSImpl_AttributeParameter) attParam; + SALOMEDSImpl_StudyBuilder* builder = NewBuilder(); + SALOMEDSImpl_SObject so = FindComponent((char*)theID); + if (!so) so = builder->NewComponent((char*)theID); + SALOMEDSImpl_AttributeParameter* attParam = NULL; if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ... - TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 ); + DF_Label savePointLabel = so.GetLabel().FindChild( theSavePoint, /*create=*/0 ); if ( !savePointLabel.IsNull() ) so = GetSObject( savePointLabel ); else // ... if it does not exist - create a new one so = builder->NewObjectToTag( so, theSavePoint ); } - if (!so.IsNull()) { - builder->FindAttribute(so, attParam, "AttributeParameter"); - if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component - Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter"); - attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att ); + DF_Attribute* A; + if (so) { + builder->FindAttribute(so, A, "AttributeParameter"); + if ( !A ) { // first call of GetCommonParameters on "Interface Applicative" component + A = builder->FindOrCreateAttribute(so, "AttributeParameter"); } + attParam = dynamic_cast( A ); } return attParam; } @@ -1535,30 +1409,28 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters( * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID, - const char* theModuleName, - int theSavePoint) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID, + const char* theModuleName, + int theSavePoint) { if(theSavePoint <= 0) return NULL; - Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint); - Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject(); - Handle(SALOMEDSImpl_AttributeParameter) par; + SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint); + SALOMEDSImpl_SObject main_so = main_ap->GetSObject(); + SALOMEDSImpl_AttributeParameter* par = NULL; - Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so); + SALOMEDSImpl_ChildIterator it = NewChildIterator(main_so); string moduleName(theModuleName); - for(; it->More(); it->Next()) { - Handle(SALOMEDSImpl_SObject) so(it->Value()); - Handle(SALOMEDSImpl_GenericAttribute) ga; - if(so->FindAttribute(ga, "AttributeParameter")) { - par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga); + for(; it.More(); it.Next()) { + SALOMEDSImpl_SObject so(it.Value()); + if((par=(SALOMEDSImpl_AttributeParameter*)so.GetLabel().FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) { if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING if(par->GetString("AP_MODULE_NAME") == moduleName) return par; } } - Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); - Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so); - par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter")); + SALOMEDSImpl_StudyBuilder* builder = NewBuilder(); + SALOMEDSImpl_SObject so = builder->NewObject(main_so); + par = dynamic_cast(builder->FindOrCreateAttribute(so, "AttributeParameter")); par->SetString("AP_MODULE_NAME", moduleName); return par; } @@ -1570,7 +1442,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters( //============================================================================ void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID) { - _lockers->Append(TCollection_AsciiString((char*)theLockerID)); + _lockers.push_back(theLockerID); } //============================================================================ @@ -1580,7 +1452,7 @@ void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID) //============================================================================ bool SALOMEDSImpl_Study::IsStudyLocked() { - return (_lockers->Length() > 0); + return (_lockers.size() > 0); } //============================================================================ @@ -1590,15 +1462,17 @@ bool SALOMEDSImpl_Study::IsStudyLocked() //============================================================================ void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID) { - int length = _lockers->Length(), pos = -1; - TCollection_AsciiString id((char*)theLockerID); - for(int i = 1; i<=length; i++) { - if(id == _lockers->Value(i)) { - pos = i; + vector::iterator vsI = _lockers.begin(); + int length = _lockers.size(); + bool isFound = false; + string id(theLockerID); + for(int i = 0; i 0) _lockers->Remove(pos); + if(isFound) _lockers.erase(vsI); } //============================================================================ @@ -1606,7 +1480,7 @@ void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID) * Purpose : */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID() +vector SALOMEDSImpl_Study::GetLockerID() { return _lockers; } @@ -1628,3 +1502,18 @@ void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled) _builder->SetOnRemoveSObject(NULL); } } + +//============================================================================ +/*! Function : GetIORs + * Purpose : + */ +//============================================================================ +vector SALOMEDSImpl_Study::GetIORs() +{ + vector anIORs; + map::const_iterator MI; + for(MI = myIORLabels.begin(); MI!=myIORLabels.end(); MI++) + anIORs.push_back(MI->first); + + return anIORs; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 449bd5a12..cfddeb627 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -24,26 +24,16 @@ #ifndef __SALOMEDSIMPL_STUDY_I_H__ #define __SALOMEDSIMPL_STUDY_I_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) - // std C++ headers #include +#include +#include +#include // Cascade headers -#include -#include -#include -#include +#include "DF_Document.hxx" +#include "DF_Label.hxx" #include -#include -#include -#include -#include -#include -#include //SALOMEDSImpl headers #include "SALOMEDSImpl_SComponentIterator.hxx" @@ -60,130 +50,123 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) class SALOMEDSImpl_StudyManager; class SALOMEDSImpl_GenericAttribute; -typedef NCollection_DataMap DataMapOfAsciiStringTransient; -typedef NCollection_DataMap DataMapAsciiStringLabel; -class SALOMEDSImpl_Study : public MMgt_TShared +class SALOMEDSImpl_Study { private: - TCollection_AsciiString _name; - Handle(TDocStd_Document) _doc; // OCAF Document + std::string _name; + DF_Document* _doc; // Document bool _Saved; // True if the Study is saved - TCollection_AsciiString _URL; //URL of the persistent reference of the study + std::string _URL; //URL of the persistent reference of the study int _StudyId; - TDF_Label _current; + DF_Label _current; bool _autoFill; - TCollection_AsciiString _errorCode; - Handle(TColStd_HSequenceOfAsciiString) _lockers; - Handle(SALOMEDSImpl_Callback) _cb; - Handle(SALOMEDSImpl_StudyBuilder) _builder; - Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder; - - DataMapOfAsciiStringTransient _mapOfSO; - DataMapOfAsciiStringTransient _mapOfSCO; - - // data structures for postponed destroying of object functionality - TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs - TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction - int myNbUndos; // number of current Undos, made by user - DataMapAsciiStringLabel myIORLabels; + std::string _errorCode; + std::vector _lockers; + SALOMEDSImpl_Callback* _cb; + SALOMEDSImpl_StudyBuilder* _builder; + SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder; + + std::map _mapOfSO; + std::map _mapOfSCO; + std::map myIORLabels; - Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& anObjectName, - bool& _find); + SALOMEDSImpl_SObject _FindObject(const SALOMEDSImpl_SObject& SO, + const std::string& anObjectName, + bool& _find); - Handle(SALOMEDSImpl_SObject) _FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& anObjectIOR, - bool& _find); + SALOMEDSImpl_SObject _FindObjectIOR(const SALOMEDSImpl_SObject& SO, + const std::string& anObjectIOR, + bool& _find); public: - Standard_EXPORT static Handle(SALOMEDSImpl_Study) GetStudy(const TDF_Label& theLabel); - Standard_EXPORT static Handle(SALOMEDSImpl_SObject) SObject(const TDF_Label& theLabel); - Standard_EXPORT static Handle(SALOMEDSImpl_SComponent) SComponent(const TDF_Label& theLabel); - Standard_EXPORT static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute); + Standard_EXPORT static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel); + Standard_EXPORT static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel); + Standard_EXPORT static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel); + Standard_EXPORT static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute); //! standard constructor - Standard_EXPORT SALOMEDSImpl_Study(const Handle(TDocStd_Document)&, const TCollection_AsciiString& study_name); + Standard_EXPORT SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name); //! standard destructor Standard_EXPORT virtual ~SALOMEDSImpl_Study(); //! method to Get persistent reference of study (idem URL()) - Standard_EXPORT virtual TCollection_AsciiString GetPersistentReference(); + Standard_EXPORT virtual std::string GetPersistentReference(); //! method to Get transient reference of study - Standard_EXPORT virtual TCollection_AsciiString GetTransientReference(); + Standard_EXPORT virtual std::string GetTransientReference(); - Standard_EXPORT virtual void SetTransientReference(const TCollection_AsciiString& theIOR); + Standard_EXPORT virtual void SetTransientReference(const std::string& theIOR); //! method to detect if a study is empty Standard_EXPORT virtual bool IsEmpty(); //! method to Find a Component with ComponentDataType = aComponentName - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponent (const TCollection_AsciiString& aComponentName); + Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName); //! method to Find a Component Find a Component from it's ID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponentID(const TCollection_AsciiString& aComponentID); + Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID); //! method to Find an Object with SALOMEDSImpl::Name = anObjectName - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObject(const TCollection_AsciiString& anObjectName); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObject(const std::string& anObjectName); //! method to Find Object(s) with SALOMEDSImpl::Name=anObjectName in a component with ComponentDataType = aComponentName - Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindObjectByName( const TCollection_AsciiString& anObjectName, - const TCollection_AsciiString& aComponentName ) ; + Standard_EXPORT virtual std::vector FindObjectByName( const std::string& anObjectName, + const std::string& aComponentName ) ; //! method to Find an Object with ID = anObjectID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectID(const TCollection_AsciiString& anObjectID); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID); //! method to Create an Object with ID = anObjectID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) CreateObjectID(const TCollection_AsciiString& anObjectID); + Standard_EXPORT virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID); //! method to Find an Object with ID = anObjectIOR - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectIOR(const TCollection_AsciiString& anObjectIOR); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR); //! method to Find an Object by its path - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectByPath(const TCollection_AsciiString& thePath); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath); //! method to get a path of SObject - Standard_EXPORT virtual TCollection_AsciiString GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT TCollection_AsciiString GetObjectPathByIOR(const TCollection_AsciiString& theIOR); + Standard_EXPORT std::string GetObjectPathByIOR(const std::string& theIOR); //! method to set a context: root ('/') is UserData component - Standard_EXPORT virtual bool SetContext(const TCollection_AsciiString& thePath); + Standard_EXPORT virtual bool SetContext(const std::string& thePath); //! method to get a context - Standard_EXPORT virtual TCollection_AsciiString GetContext(); + Standard_EXPORT virtual std::string GetContext(); //! method to get all object names in the given context (or in the current context, if 'theContext' is empty) - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetObjectNames(const TCollection_AsciiString& theContext); + Standard_EXPORT virtual std::vector GetObjectNames(const std::string& theContext); //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty) - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetDirectoryNames(const TCollection_AsciiString& theContext); + Standard_EXPORT virtual std::vector GetDirectoryNames(const std::string& theContext); //! method to get all file names in the given context (or in the current context, if 'theContext' is empty) - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetFileNames(const TCollection_AsciiString& theContext); + Standard_EXPORT virtual std::vector GetFileNames(const std::string& theContext); //! method to get all components names - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetComponentNames(const TCollection_AsciiString& theContext); + Standard_EXPORT virtual std::vector GetComponentNames(const std::string& theContext); //! method to Create a ChildIterator from an SObject - Standard_EXPORT virtual Handle(SALOMEDSImpl_ChildIterator) NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO); + Standard_EXPORT virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO); //! method to Create a SComponentIterator Standard_EXPORT virtual SALOMEDSImpl_SComponentIterator NewComponentIterator(); //! method to Create a StudyBuilder - Standard_EXPORT virtual Handle(SALOMEDSImpl_StudyBuilder) NewBuilder(); + Standard_EXPORT virtual SALOMEDSImpl_StudyBuilder* NewBuilder(); //! method to get study name - Standard_EXPORT virtual TCollection_AsciiString Name(); + Standard_EXPORT virtual std::string Name(); //! method to set study name - Standard_EXPORT virtual void Name(const TCollection_AsciiString& name); + Standard_EXPORT virtual void Name(const std::string& name); //! method to get if study has been saved Standard_EXPORT virtual bool IsSaved(); @@ -195,10 +178,10 @@ public: Standard_EXPORT virtual bool IsModified(); //! method to get URL of the study (idem GetPersistentReference) - Standard_EXPORT virtual TCollection_AsciiString URL(); + Standard_EXPORT virtual std::string URL(); //! method to set URL of the study - Standard_EXPORT virtual void URL(const TCollection_AsciiString& url); + Standard_EXPORT virtual void URL(const std::string& url); Standard_EXPORT virtual bool IsLocked(); @@ -206,64 +189,52 @@ public: Standard_EXPORT virtual void StudyId(int id); - Standard_EXPORT virtual void UpdateIORLabelMap(const TCollection_AsciiString& anIOR, const TCollection_AsciiString& aLabel); + Standard_EXPORT virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel); - Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject); + Standard_EXPORT virtual std::vector FindDependances(const SALOMEDSImpl_SObject& anObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties(); + Standard_EXPORT virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties(); - Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate(); + Standard_EXPORT virtual std::string GetLastModificationDate(); - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetModificationsDate(); + Standard_EXPORT virtual std::vector GetModificationsDate(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseBuilder) GetUseCaseBuilder(); + Standard_EXPORT virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder(); Standard_EXPORT virtual void Close(); Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled); - // postponed destroying of object functionality - Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR); - - Standard_EXPORT virtual void AddCreatedPostponed(const TCollection_AsciiString& theIOR); - - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) RemovePostponed(const int theUndoLimit); - // removes postponed IORs of old transaction - // if theUndoLimit==0, removes all - Standard_EXPORT virtual void UndoPostponed(const int theWay); // theWay = 1: resurrect objects, - // theWay = -1: get back to the list of postponed - - - Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; } + Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; } Standard_EXPORT virtual bool IsError() { return _errorCode != ""; } - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TCollection_AsciiString& theEntry); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TDF_Label& theLabel); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TDF_Label& theEntryLabel); - Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute(const TCollection_AsciiString& theEntry, - const TCollection_AsciiString& theType); + Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const std::string& theEntry); + Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const DF_Label& theLabel); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel); + Standard_EXPORT virtual DF_Attribute* GetAttribute(const std::string& theEntry, + const std::string& theType); Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); } - Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath, - const TCollection_AsciiString& theBaseName, + Standard_EXPORT virtual bool DumpStudy(const std::string& thePath, + const std::string& theBaseName, bool isPublished, SALOMEDSImpl_DriverFactory* theFactory); - Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0); + Standard_EXPORT static std::string GetDumpStudyComment(const char* theComponentName = 0); - Standard_EXPORT virtual Handle(TDocStd_Document) GetDocument() { return _doc; } + Standard_EXPORT virtual DF_Document* GetDocument() { return _doc; } //The method dump creates a txt file that contain a dump of the study, for debug use - Standard_EXPORT void dump(const TCollection_AsciiString& theFileName); + Standard_EXPORT void dump(const std::string& theFileName); //This method marks the study as being modified Standard_EXPORT void Modify(); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint); + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID, + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID, const char* theModuleName, int theSavePoint); @@ -277,14 +248,14 @@ public: Standard_EXPORT void UnLockStudy(const char* theLockerID); //Returns an ID of the study locker - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID(); + Standard_EXPORT std::vector GetLockerID(); //Returns a callback - Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; } + Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; } + //Returns a list of IOR's stored in the study + Standard_EXPORT std::vector GetIORs(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) friend class SALOMEDSImpl_StudyManager; friend class SALOMEDSImpl_GenericAttribute; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 423052a77..6dcb7bdd6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -24,47 +24,39 @@ #include "SALOMEDSImpl_Attributes.hxx" - -using namespace std; - #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_StudyBuilder.hxx" #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_Tool.hxx" +#include "SALOMEDSImpl_ChildNodeIterator.hxx" -#include - -#include -#include -#include -#include -#include - -#include +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" #include #include -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) +using namespace std; #define USE_CASE_LABEL_TAG 2 #define DIRECTORYID 16661 #define FILELOCALID 26662 -static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII); +static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII); //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner) +SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner) { _errorCode = ""; - _study = theOwner; - _doc = Handle(SALOMEDSImpl_Study)::DownCast(theOwner)->GetDocument(); + _callbackOnAdd=NULL; + _callbackOnRemove = NULL; + _study = (SALOMEDSImpl_Study*)theOwner; + _doc = _study->GetDocument(); } //============================================================================ @@ -80,31 +72,27 @@ SALOMEDSImpl_StudyBuilder::~SALOMEDSImpl_StudyBuilder() * Purpose : Create a new component (Scomponent) */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TCollection_AsciiString& DataType) +SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& DataType) { _errorCode = ""; CheckLocked(); - if(DataType.Length() == 0) return 0; + SALOMEDSImpl_SComponent sco; + + if(DataType.size() == 0) return sco; //Always create component under main label. - TDF_Label L = _doc->Main(); + DF_Label L = _doc->Main(); - int imax = 0; - for (TDF_ChildIterator it(L); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - TDF_Label NL = L.FindChild(imax); + DF_Label NL = L.NewChild(); SALOMEDSImpl_AttributeComment::Set(NL, DataType); - Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL); + SALOMEDSImpl_SComponent so = _study->GetSComponent (NL); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -114,20 +102,18 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TC * Purpose : Add IOR attribute of a Scomponent */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImpl_SComponent)& aComponent, - const TCollection_AsciiString& IOR) +bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const SALOMEDSImpl_SComponent& aComponent, + const string& IOR) { _errorCode = ""; CheckLocked(); - if(aComponent.IsNull() || IOR.IsEmpty()) { + if(!aComponent || IOR.empty()) { _errorCode = "Invalid arguments"; return false; } //add IOR definition - SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR); - - //_doc->Modify(); + SALOMEDSImpl_AttributeIOR::Set(aComponent.GetLabel(), IOR); return true; } @@ -137,7 +123,7 @@ bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImp * Purpose : Delete a Scomponent */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent) +bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const SALOMEDSImpl_SComponent& aComponent) { _errorCode = ""; CheckLocked(); @@ -149,27 +135,21 @@ bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SCompo * Purpose : Create a new SObject */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SObject& theFatherObject) { - _errorCode = ""; + _errorCode = ""; CheckLocked(); //Find label of father - TDF_Label Lab = theFatherObject->GetLabel(); + DF_Label Lab = theFatherObject.GetLabel(); //Create a new label - int imax = 0; - for (TDF_ChildIterator it(Lab); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - TDF_Label NewLab = Lab.FindChild(imax); + DF_Label NewLab = Lab.NewChild(); - Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -178,22 +158,22 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(S * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject, - const int theTag) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, + const int theTag) { _errorCode = ""; CheckLocked(); //Find label of father - TDF_Label Lab = theFatherObject->GetLabel(); + DF_Label Lab = theFatherObject.GetLabel(); //Create or find label - TDF_Label NewLab = Lab.FindChild(theTag, 1); + DF_Label NewLab = Lab.FindChild(theTag, 1); - Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab); + SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -202,33 +182,33 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Han * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject) +bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Null object"; return false; } - if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject); + if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); - TDF_Label Lab = anObject->GetLabel(); + DF_Label Lab = anObject.GetLabel(); - Handle(SALOMEDSImpl_AttributeReference) aReference; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) { - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget)) + SALOMEDSImpl_AttributeReference* aReference = NULL; + if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab)); } - Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects - if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) - SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } Lab.ForgetAllAttributes(); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -238,45 +218,45 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject) +bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Null object"; return false; } - if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject); + if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); - TDF_Label Lab = anObject->GetLabel(); + DF_Label Lab = anObject.GetLabel(); - Handle(SALOMEDSImpl_AttributeReference) aReference; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) { - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget)) + SALOMEDSImpl_AttributeReference* aReference = NULL; + if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab)); } - Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects - if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) - SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } - TDF_ChildIterator it(Lab, Standard_True); + DF_ChildIterator it(Lab, true); for(;it.More();it.Next()) { - TDF_Label aLabel = it.Value(); - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) { - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget)) + DF_Label aLabel = it.Value(); + if ((aReference=(SALOMEDSImpl_AttributeReference*)aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) aTarget->Remove(SALOMEDSImpl_Study::SObject(aLabel)); } - Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) - SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } } - Lab.ForgetAllAttributes(Standard_True); + Lab.ForgetAllAttributes(true); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -286,25 +266,25 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSIm * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO, +bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO, SALOMEDSImpl_Driver* aDriver) { _errorCode = ""; - TDF_Label Lab = anSCO->GetLabel(); - Handle(SALOMEDSImpl_AttributePersistentRef) Att; + DF_Label Lab = anSCO.GetLabel(); + SALOMEDSImpl_AttributePersistentRef* Att = NULL; //Find the current Url of the study - if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) { - int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked(); - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false); + if ((Att=(SALOMEDSImpl_AttributePersistentRef*)_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + int aLocked = _study->GetProperties()->IsLocked(); + if (aLocked) _study->GetProperties()->SetLocked(false); - TCollection_ExtendedString Res(Att->Value()); - TCollection_AsciiString aHDFPath(Res); + std::string Res(Att->Value()); + string aHDFPath(Res); - Handle(SALOMEDSImpl_AttributeComment) type; - TCollection_ExtendedString DataType; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type)) + SALOMEDSImpl_AttributeComment* type = NULL; + std::string DataType; + if ((type=(SALOMEDSImpl_AttributeComment*)Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) DataType = type->Value(); // associate the driver to the SComponent @@ -314,35 +294,35 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& } // mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again - Handle(SALOMEDSImpl_AttributeIOR) attrIOR; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), attrIOR)) { - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true); + SALOMEDSImpl_AttributeIOR* attrIOR = NULL; + if ((attrIOR=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + if (aLocked) _study->GetProperties()->SetLocked(true); return true; } DefineComponentInstance (anSCO, aDriver->GetIOR()); - TCollection_AsciiString aHDFUrl; + string aHDFUrl; bool isASCII = false; - if (HDFascii::isASCII(aHDFPath.ToCString())) { + if (HDFascii::isASCII(aHDFPath.c_str())) { isASCII = true; - aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString()); + aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.c_str()); aHDFUrl += "hdf_from_ascii.hdf"; } else { aHDFUrl = aHDFPath; } //Open the Study HDF file - HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString()); + HDFfile *hdf_file = new HDFfile((char*)aHDFUrl.c_str()); char aMultifileState[2]; char ASCIIfileState[2]; try { - TCollection_AsciiString scoid = anSCO->GetID(); + string scoid = anSCO.GetID(); hdf_file->OpenOnDisk(HDF_RDONLY); HDFgroup *hdf_group = new HDFgroup("DATACOMPONENT",hdf_file); hdf_group->OpenOnDisk(); - HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group); + HDFgroup *hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group); hdf_sco_group->OpenOnDisk(); unsigned char* aStreamFile = NULL; @@ -368,21 +348,11 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& ascii_hdf_dataset->OpenOnDisk(); ascii_hdf_dataset->ReadFromDisk(ASCIIfileState); - // set path without file name from URL - //int aFileNameSize = Res.Length(); - //char* aDir = new char[aFileNameSize]; - //memcpy(aDir, TCollection_AsciiString(Res).ToCString(), aFileNameSize); - //for(int aCounter = aFileNameSize-1; aCounter>=0; aCounter--) - //if (aDir[aCounter] == '/') { - // aDir[aCounter+1] = 0; - // break; - //} - // Above code was working wrong for paths without '/' inside. - TCollection_AsciiString aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); + string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); bool aResult = (ASCIIfileState[0]=='A')? - aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'): - aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'); + aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'): + aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'); if(aStreamFile != NULL) delete []aStreamFile; @@ -408,8 +378,8 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& delete hdf_file; if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append("hdf_from_ascii.hdf"); + vector aFilesToRemove; + aFilesToRemove.push_back("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } @@ -418,12 +388,12 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& delete hdf_file; if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append(aHDFUrl); + vector aFilesToRemove; + aFilesToRemove.push_back(aHDFUrl); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true); + if (aLocked) _study->GetProperties()->SetLocked(true); _errorCode = "No persistent file"; return false; } @@ -435,7 +405,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& return false; } - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true); + if (aLocked) _study->GetProperties()->SetLocked(true); } else { _errorCode = "No persistent file"; } @@ -449,7 +419,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco) +bool SALOMEDSImpl_StudyBuilder::Load(const SALOMEDSImpl_SObject& sco) { _errorCode = "Not implemented"; return false; @@ -461,69 +431,53 @@ bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco) * existing one */ //============================================================================ -Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& aTypeOfAttribute) +DF_Attribute* SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, + const string& aTypeOfAttribute) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return NULL; } - TDF_Label Lab = anObject->GetLabel(); + DF_Label Lab = anObject.GetLabel(); if(Lab.IsNull()) { _errorCode = "Null label"; return NULL; } - _doc->Modify(); + _doc->SetModified(true); //The macro adds all necessary checks for standardly behaiving attributes __FindOrCreateAttributeForBuilder //Add checks for TreeNode and UserID attributes - if (strncmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode",17) == 0 ) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeTreeNode",17) == 0 ) { - Standard_GUID aTreeNodeGUID; - if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) { + string aTreeNodeGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeTreeNode") == 0) { aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID(); } else { - char* aGUIDString = new char[41]; - char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[17])); - if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { - delete(aGUIDString); - return NULL; - } - aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name - delete(aGUIDString); + aTreeNodeGUID = aTypeOfAttribute.substr(21, aTypeOfAttribute.size()); // create tree node GUID by name } - Handle(SALOMEDSImpl_AttributeTreeNode) anAttr; - if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) { + SALOMEDSImpl_AttributeTreeNode* anAttr = NULL; + if (!(anAttr=(SALOMEDSImpl_AttributeTreeNode*)Lab.FindAttribute(aTreeNodeGUID))) { CheckLocked(); anAttr = SALOMEDSImpl_AttributeTreeNode::Set(Lab, aTreeNodeGUID); } return anAttr; } - if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) { - Standard_GUID aUserGUID; - if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeUserID",15) == 0 ) { + std::string aUserGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeUserID") == 0) { aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID(); } else { - char* aGUIDString = new char[41]; - char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[15])); - if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { - delete(aGUIDString); - return NULL; - } - aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name - delete(aGUIDString); + aUserGUID = aTypeOfAttribute.substr(15, aTypeOfAttribute.size()); // create tree node GUID by name } - Handle(SALOMEDSImpl_AttributeUserID) anAttr; - if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) { + SALOMEDSImpl_AttributeUserID* anAttr = NULL; + if (!(anAttr=(SALOMEDSImpl_AttributeUserID*)Lab.FindAttribute(aUserGUID))) { CheckLocked(); anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID); } @@ -540,22 +494,22 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - Handle(TDF_Attribute)& anAttribute, - const TCollection_AsciiString& aTypeOfAttribute) +bool SALOMEDSImpl_StudyBuilder::FindAttribute(const SALOMEDSImpl_SObject& anObject, + DF_Attribute*& anAttribute, + const string& aTypeOfAttribute) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label Lab = anObject->GetLabel(); - if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) { + DF_Label Lab = anObject.GetLabel(); + if ((anAttribute=Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)))) { // commented out because NO MODIFICATION is done to attributes when calling FindAttribute() // _doc->Modify(); - return Standard_True; + return true; } - return Standard_False; + return false; } //============================================================================ @@ -564,26 +518,26 @@ bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject) */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& aTypeOfAttribute) +bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anObject, + const string& aTypeOfAttribute) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label Lab = anObject->GetLabel(); + DF_Label Lab = anObject.GetLabel(); - if (aTypeOfAttribute == "AttributeIOR") { // postponed removing of CORBA objects - Handle(SALOMEDSImpl_AttributeIOR) anAttr; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) - SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(anAttr->Value()); + if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map + SALOMEDSImpl_AttributeIOR* anAttr = NULL; + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } } Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -593,22 +547,22 @@ bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObjec * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& me, - const Handle(SALOMEDSImpl_SObject)& theReferencedObject) +bool SALOMEDSImpl_StudyBuilder::Addreference(const SALOMEDSImpl_SObject& me, + const SALOMEDSImpl_SObject& theReferencedObject) { _errorCode = ""; - if(me.IsNull() || theReferencedObject.IsNull()) { + if(!me || !theReferencedObject) { _errorCode = "Invalid arguments"; return false; } CheckLocked(); - TDF_Label Lab = me->GetLabel(); - TDF_Label RefLab = theReferencedObject->GetLabel(); + DF_Label Lab = me.GetLabel(); + DF_Label RefLab = theReferencedObject.GetLabel(); SALOMEDSImpl_AttributeReference::Set(Lab,RefLab); SALOMEDSImpl_AttributeTarget::Set(RefLab)->Add(SALOMEDSImpl_Study::SObject(Lab)); - if(!_callbackOnRemove.IsNull() && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me); + if(_callbackOnRemove && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me); return true; } @@ -618,26 +572,28 @@ bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObject)& me) +bool SALOMEDSImpl_StudyBuilder::RemoveReference(const SALOMEDSImpl_SObject& me) { _errorCode = ""; - Handle(SALOMEDSImpl_SObject) theReferencedObject; - if(!me->ReferencedObject(theReferencedObject)) return false; //No reference is found - + SALOMEDSImpl_SObject theReferencedObject; + + if(!me.ReferencedObject(theReferencedObject)) return false; //No reference is found + CheckLocked(); - TDF_Label Lab = me->GetLabel(); - - Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID()); + DF_Label Lab = me.GetLabel(); //SRN: 30 Aug, 2004 : fix from Ecole l'ete version - TDF_Label RefLab = theReferencedObject->GetLabel(); + DF_Label RefLab = theReferencedObject.GetLabel(); - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if(RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if((aTarget=(SALOMEDSImpl_AttributeTarget*)RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab)); + } + + Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID()); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -649,70 +605,66 @@ bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObjec * Purpose : adds a new directory with a path = thePath */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& thePath) +bool SALOMEDSImpl_StudyBuilder::AddDirectory(const string& thePath) { _errorCode = ""; CheckLocked(); - if(thePath.IsEmpty() || thePath == "") { + if(thePath.empty()) { _errorCode = "Invalid path"; return false; } - TCollection_AsciiString aPath(thePath), aContext(""), aFatherPath; - TDF_Label aLabel; - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(_doc->Main()); - Handle(SALOMEDSImpl_SObject) anObject; + string aPath(thePath), aContext(""), aFatherPath; + DF_Label aLabel; + SALOMEDSImpl_SObject anObject; try { - anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists + anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists } catch(...) { } - if(!anObject.IsNull()) { + if(anObject) { _errorCode = "StudyNameAlreadyUsed"; return false; } - if(aPath.Value(1) != '/') { //Relative path - aPath.Prepend('/'); - aPath = aStudy->GetContext() + aPath; + if(aPath[0] != '/') { //Relative path + aPath.insert(aPath.begin(), '/'); + aPath = _study->GetContext() + aPath; } - TCollection_AsciiString aToken = aPath.Token("/", 1); - if(aToken.Length() == 0) aFatherPath = "/"; - - int i = 1; - while(aToken.Length() != 0) { - if(aPath.Token("/", i+1).Length() > 0) { + vector vs = SALOMEDSImpl_Tool::splitString(aPath, '/'); + if(vs.size() == 1) + aFatherPath = "/"; + else { + for(int i = 0, len = vs.size()-1; iFindObjectByPath(aFatherPath); //Check if the father directory exists + anObject = _study->FindObjectByPath(aFatherPath); //Check if the father directory exists } catch(...) { ; } - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "StudyInvalidDirectory"; return false; } - Handle(SALOMEDSImpl_SObject) aNewObject = NewObject(anObject); - aLabel = aNewObject->GetLabel(); + SALOMEDSImpl_SObject aNewObject = NewObject(anObject); + aLabel = aNewObject.GetLabel(); if(aLabel.IsNull()) { _errorCode = "StudyInvalidComponent"; return false; } - SALOMEDSImpl_AttributeName::Set(aLabel, aPath.Token("/", i-1)); + SALOMEDSImpl_AttributeName::Set(aLabel, vs.back()); //Set LocalID attribute to identify the directory object - Handle(SALOMEDSImpl_AttributeLocalID) aLocalID = SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID); + SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -723,20 +675,20 @@ bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& theP * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& theGUID) +bool SALOMEDSImpl_StudyBuilder::SetGUID(const SALOMEDSImpl_SObject& anObject, + const string& theGUID) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label aLabel = anObject->GetLabel(); - SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID.ToCString()); + DF_Label aLabel = anObject.GetLabel(); + SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -746,16 +698,16 @@ bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anOb * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& theGUID) +bool SALOMEDSImpl_StudyBuilder::IsGUID(const SALOMEDSImpl_SObject& anObject, + const string& theGUID) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label aLabel = anObject->GetLabel(); - return aLabel.IsAttribute(theGUID.ToCString()); + DF_Label aLabel = anObject.GetLabel(); + return aLabel.IsAttribute(theGUID); } @@ -767,15 +719,11 @@ bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObj void SALOMEDSImpl_StudyBuilder::NewCommand() { _errorCode = ""; + // mpv: for SAL2114 - unset "lock changed" flag at the operation start - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } - anAttr->IsLockChanged(true); - - _doc->NewCommand(); + _study->GetProperties()->IsLockChanged(true); + + //Not implemented } //============================================================================ @@ -786,25 +734,19 @@ void SALOMEDSImpl_StudyBuilder::NewCommand() void SALOMEDSImpl_StudyBuilder::CommitCommand() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) { - AbortCommand(); _errorCode = "LockProtection"; throw LockProtection("LockProtection"); } else { - SALOMEDSImpl_Study::GetStudy(_doc->Main())->RemovePostponed(_doc->GetUndoLimit()); - int aModif = anAttr->GetModified(); if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero anAttr->SetModified(aModif+1); - _doc->CommitCommand(); } - _doc->Modify(); + + //Not implemented + _doc->SetModified(true); } //============================================================================ @@ -815,7 +757,9 @@ void SALOMEDSImpl_StudyBuilder::CommitCommand() bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() { _errorCode = ""; - return _doc->HasOpenCommand(); + + //Not implememnted + return false; } //============================================================================ @@ -826,9 +770,7 @@ bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() void SALOMEDSImpl_StudyBuilder::AbortCommand() { _errorCode = ""; - SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0); - - _doc->AbortCommand(); + //Not implemented } //============================================================================ @@ -838,22 +780,17 @@ void SALOMEDSImpl_StudyBuilder::AbortCommand() //============================================================================ void SALOMEDSImpl_StudyBuilder::Undo() { + //Not implemented _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); if (anAttr->IsLocked()) { _errorCode = "LockProtection"; throw LockProtection("LockProtection"); } else { - SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(1); - _doc->Undo(); anAttr->SetModified(anAttr->GetModified()-1); } - _doc->Modify(); + _doc->SetModified(true); } //============================================================================ @@ -864,22 +801,17 @@ void SALOMEDSImpl_StudyBuilder::Undo() void SALOMEDSImpl_StudyBuilder::Redo() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } - + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); if (anAttr->IsLocked()) { _errorCode = "LockProtection"; throw LockProtection("LockProtection"); } else { - _doc->Redo(); - SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(-1); anAttr->SetModified(anAttr->GetModified()+1); } - - _doc->Modify(); + + //Not implemented + + _doc->SetModified(true); } //============================================================================ @@ -890,7 +822,7 @@ void SALOMEDSImpl_StudyBuilder::Redo() bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() { _errorCode = ""; - return _doc->GetAvailableUndos(); + return false; } //============================================================================ @@ -901,7 +833,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() { _errorCode = ""; - return _doc->GetAvailableRedos(); + return false; } //============================================================================ @@ -912,7 +844,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() int SALOMEDSImpl_StudyBuilder::UndoLimit() { _errorCode = ""; - return _doc->GetUndoLimit(); + return 1; } //============================================================================ @@ -924,7 +856,7 @@ void SALOMEDSImpl_StudyBuilder::UndoLimit(int n) { _errorCode = ""; CheckLocked(); - _doc->SetUndoLimit (n); + //Not implemented } //============================================================================ @@ -932,12 +864,12 @@ void SALOMEDSImpl_StudyBuilder::UndoLimit(int n) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Callback) -SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback) +SALOMEDSImpl_Callback* +SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback) { _errorCode = ""; - Handle(SALOMEDSImpl_Callback) aRet = _callbackOnAdd; - _callbackOnAdd = theCallback; + SALOMEDSImpl_Callback* aRet = _callbackOnAdd; + _callbackOnAdd = (SALOMEDSImpl_Callback*)theCallback; return aRet; } @@ -946,12 +878,12 @@ SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Callback) -SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback) +SALOMEDSImpl_Callback* +SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback) { _errorCode = ""; - Handle(SALOMEDSImpl_Callback) aRet = _callbackOnRemove; - _callbackOnRemove = theCallback; + SALOMEDSImpl_Callback* aRet = _callbackOnRemove; + _callbackOnRemove = (SALOMEDSImpl_Callback*)theCallback; return aRet; } @@ -963,12 +895,8 @@ SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback void SALOMEDSImpl_StudyBuilder::CheckLocked() { _errorCode = ""; - if (_doc->HasOpenCommand()) return; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } + if (HasOpenCommand()) return; + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); if (anAttr->IsLocked()) { _errorCode = "LockProtection"; throw LockProtection("LockProtection"); @@ -980,18 +908,18 @@ void SALOMEDSImpl_StudyBuilder::CheckLocked() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetName(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeName::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeName::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1001,18 +929,18 @@ bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theS * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetComment(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeComment::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeComment::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1022,18 +950,18 @@ bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& t * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetIOR(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeIOR::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeIOR::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1044,26 +972,26 @@ bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO * Purpose : */ //============================================================================ -static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII) +static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII) { if(driver == NULL) return; - TDF_ChildIterator itchild (Lab); + DF_ChildIterator itchild (Lab); for (; itchild.More(); itchild.Next()) { - TDF_Label current = itchild.Value(); - Handle(SALOMEDSImpl_AttributePersistentRef) Att; - if (current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) { - - Handle(SALOMEDSImpl_AttributeLocalID) anID; - if (current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) - if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it - - TCollection_AsciiString persist_ref(Att->Value()); - Handle(SALOMEDSImpl_SObject) so = SALOMEDSImpl_Study::SObject(current); - TCollection_AsciiString ior_string = driver->LocalPersistentIDToIOR(so, - persist_ref, - isMultiFile, - isASCII); + DF_Label current = itchild.Value(); + SALOMEDSImpl_AttributePersistentRef* Att = NULL; + if ((Att=(SALOMEDSImpl_AttributePersistentRef*)current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + + SALOMEDSImpl_AttributeLocalID* anID = NULL; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) + if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it + + string persist_ref = Att->Value(); + SALOMEDSImpl_SObject so = SALOMEDSImpl_Study::SObject(current); + string ior_string = driver->LocalPersistentIDToIOR(so, + persist_ref, + isMultiFile, + isASCII); SALOMEDSImpl_AttributeIOR::Set (current, ior_string); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx index d83edd6ea..781103cb6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx @@ -24,71 +24,66 @@ #ifndef __SALOMEDSImpl_STUDYBUILDER_H__ #define __SALOMEDSImpl_STUDYBUILDER_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) - // std C++ headers #include - -// Cascade header -#include -#include +#include +#include #include "SALOMEDSImpl_Callback.hxx" #include "SALOMEDSImpl_Driver.hxx" -class SALOMEDSImpl_StudyBuilder : public MMgt_TShared +class SALOMEDSImpl_Study; + +class SALOMEDSImpl_StudyBuilder { private: - Handle(TDocStd_Document) _doc; - Handle(Standard_Transient) _study; - Handle(SALOMEDSImpl_Callback) _callbackOnAdd; - Handle(SALOMEDSImpl_Callback) _callbackOnRemove; - TCollection_AsciiString _errorCode; + DF_Document* _doc; + SALOMEDSImpl_Study* _study; + SALOMEDSImpl_Callback* _callbackOnAdd; + SALOMEDSImpl_Callback* _callbackOnRemove; + std::string _errorCode; public: - Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner); + Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner); Standard_EXPORT ~SALOMEDSImpl_StudyBuilder(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType); + Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType); - Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR); + Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR); - Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent); + Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject); + Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject, - const int theTag); + Standard_EXPORT virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, + const int theTag); //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used) - Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath); + Standard_EXPORT virtual bool AddDirectory(const std::string& thePath); - Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine); - Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco); + Standard_EXPORT virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool Load(const SALOMEDSImpl_SObject& sco); - Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject); - Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject); + Standard_EXPORT virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject); + Standard_EXPORT virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject); - Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& aTypeOfAttribute); - Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - Handle(TDF_Attribute)& anAttribute, - const TCollection_AsciiString& aTypeOfAttribute); + Standard_EXPORT virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, + const std::string& aTypeOfAttribute); + Standard_EXPORT virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject, + DF_Attribute*& anAttribute, + const std::string& aTypeOfAttribute); - Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute); + Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute); - Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me, - const Handle(SALOMEDSImpl_SObject)& thereferencedObject); + Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me, + const SALOMEDSImpl_SObject& thereferencedObject); - Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me); + Standard_EXPORT virtual bool RemoveReference(const SALOMEDSImpl_SObject& me); - Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID); - Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID); + Standard_EXPORT virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID); + Standard_EXPORT virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID); Standard_EXPORT virtual void NewCommand(); Standard_EXPORT virtual void CommitCommand(); @@ -105,21 +100,18 @@ public: Standard_EXPORT void CheckLocked(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback); - Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback); + Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback); + Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback); - Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; } + Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; } Standard_EXPORT virtual bool IsError() { return _errorCode != ""; } - Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; } - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder ) + Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; } }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx index 2952d045d..7f0c1b261 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx @@ -22,8 +22,6 @@ // Module : SALOME #include "SALOMEDSImpl_StudyHandle.hxx" -#include -#include /* Class : SALOMEDSImpl_StudyHandle @@ -31,16 +29,14 @@ graphic representation of objects in dirrent views */ -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute ) //======================================================================= //function : GetID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID() +const std::string& SALOMEDSImpl_StudyHandle::GetID() { - static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" ); + static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" ); return SALOMEDSImpl_StudyHandleID; } @@ -50,23 +46,23 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID() //======================================================================= SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle() { - myHandle.Nullify(); + myHandle = NULL; } //======================================================================= //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel, - const Handle(SALOMEDSImpl_Study)& theStudy) +SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel, + SALOMEDSImpl_Study* theStudy) { - Handle(SALOMEDSImpl_StudyHandle) A; - if (!theLabel.FindAttribute(GetID(), A)) { - A = new SALOMEDSImpl_StudyHandle(); + SALOMEDSImpl_StudyHandle* A = NULL; + if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) { + A = new SALOMEDSImpl_StudyHandle; theLabel.AddAttribute(A); } - A->SetHandle(theStudy); + A->Set(theStudy); return A; } @@ -75,7 +71,7 @@ Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& //function : ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const +const std::string& SALOMEDSImpl_StudyHandle::ID () const { return GetID(); } @@ -85,7 +81,7 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const //function : NewEmpty //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const +DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const { return new SALOMEDSImpl_StudyHandle (); } @@ -95,20 +91,19 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const //function : Restore //purpose : Restore value of attribute with value of theWith one //======================================================================= -void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith ) +void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith ) { - Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith ); - if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() ); + SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast( theWith ); + if ( anAttr ) Set ( anAttr->Get() ); } //======================================================================= //function : Paste //purpose : Paste value of current attribute to the value of entry one //======================================================================= -void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto) { - Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto ); - if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle ); + SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast( theInto ); + if ( anAttr ) anAttr->Set ( myHandle ); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx index e74cac414..5d8cff6a2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx @@ -24,50 +24,40 @@ #ifndef SALOMEDSImpl_StudyHandle_HeaderFile #define SALOMEDSImpl_StudyHandle_HeaderFile -#include -#include -#include - -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" /* Class : SALOMEDSImpl_StudyHandle Description : PRIVATE: This class is intended for storing of the study handle */ -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute ) - #include "SALOMEDSImpl_Study.hxx" #ifndef WNT -class Standard_EXPORT SALOMEDSImpl_StudyHandle : public TDF_Attribute +class Standard_EXPORT SALOMEDSImpl_StudyHandle : public DF_Attribute #else -class SALOMEDSImpl_StudyHandle : public TDF_Attribute +class SALOMEDSImpl_StudyHandle : public DF_Attribute #endif { public: Standard_EXPORT SALOMEDSImpl_StudyHandle(); -Standard_EXPORT ~SALOMEDSImpl_StudyHandle() { myHandle.Nullify(); } +Standard_EXPORT ~SALOMEDSImpl_StudyHandle() {; } -Standard_EXPORT static Handle(SALOMEDSImpl_StudyHandle) Set(const TDF_Label& theLabel, const Handle(SALOMEDSImpl_Study)& theStudy); -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy); +Standard_EXPORT static const std::string& GetID() ; -Standard_EXPORT void SetHandle(const Handle(SALOMEDSImpl_Study)& theStudy) { myHandle = theStudy; } -Standard_EXPORT Handle(SALOMEDSImpl_Study) GetHandle() { return myHandle; } -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith ); -Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const; -Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const; +Standard_EXPORT void Set(SALOMEDSImpl_Study* theStudy) { myHandle = theStudy; } +Standard_EXPORT SALOMEDSImpl_Study* Get() { return myHandle; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* theWith ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* theInto); private: - Handle(SALOMEDSImpl_Study) myHandle; + SALOMEDSImpl_Study* myHandle; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyHandle ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index e1059aeab..428c5b636 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -23,27 +23,13 @@ #include "SALOMEDSImpl_StudyManager.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_ChildIterator.hxx" #include "HDFexplorer.hxx" #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_Tool.hxx" #include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" #include #include "HDFOI.hxx" @@ -52,15 +38,12 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared ) - #define USE_CASE_LABEL_ID "0:2" -static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject); -static void ReadAttributes(const Handle(SALOMEDSImpl_Study)&, const Handle(SALOMEDSImpl_SObject)&, HDFdataset* ); -static void BuildTree (const Handle(SALOMEDSImpl_Study)&, HDFgroup*); -static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&, +static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject); +static void ReadAttributes(SALOMEDSImpl_Study*, const SALOMEDSImpl_SObject&, HDFdataset* ); +static void BuildTree (SALOMEDSImpl_Study*, HDFgroup*); +static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject&, SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII); //============================================================================ @@ -71,9 +54,9 @@ static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&, SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() { _errorCode = ""; - _OCAFApp = new SALOMEDSImpl_OCAFApplication(); + _appli = new DF_Application(); _IDcounter = 0; - _OCAFApp->NewDocument("SALOME_STUDY", _clipboard); + _clipboard = _appli->NewDocument("SALOME_STUDY"); } //============================================================================ @@ -83,8 +66,8 @@ SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() //============================================================================ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() { - // Destroy OCAF application - _OCAFApp.Nullify(); + // Destroy application + delete _appli; } @@ -93,24 +76,24 @@ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() * Purpose : Create a New Study of name study_name */ //==================================================T========================== -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::NewStudy(const string& study_name) { _errorCode = ""; - Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + DF_Document* Doc = _appli->NewDocument("SALOME_STUDY"); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name); + SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, study_name); _IDcounter++; Study->StudyId( _IDcounter ); // set Study properties - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Study->GetProperties(); - OSD_Process aProcess; - Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetModification(aProcess.UserName().ToCString(), - aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); + SALOMEDSImpl_AttributeStudyProperties* aProp = Study->GetProperties(); + + int month=0,day=0,year=0,hh=0,mn=0,ss=0; + SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss); + aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(), + mn, hh, day, month, year); aProp->SetCreationMode(1); //"from scratch" return Study; @@ -121,7 +104,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection * Purpose : Open a Study from it's persistent reference */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_AsciiString& aUrl) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl) { _errorCode = ""; @@ -130,11 +113,11 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc HDFgroup *hdf_group_study_structure =0; char* aC_HDFUrl; - TCollection_AsciiString aHDFUrl; + string aHDFUrl; bool isASCII = false; - if (HDFascii::isASCII(aUrl.ToCString())) { + if (HDFascii::isASCII(aUrl.c_str())) { isASCII = true; - char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.ToCString()); + char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str()); aC_HDFUrl = new char[strlen(aResultPath) + 19]; sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath); delete(aResultPath); @@ -144,7 +127,8 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc aHDFUrl = aUrl; } - hdf_file = new HDFfile((char*)aHDFUrl.ToCString()); + + hdf_file = new HDFfile((char*)aHDFUrl.c_str()); try { hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too } @@ -154,21 +138,20 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc // char eStr[strlen(aUrl.ToCString())+17]; //#else char *eStr; - eStr = new char[strlen(aUrl.ToCString())+17]; + eStr = new char[strlen(aUrl.c_str())+17]; //#endif - sprintf(eStr,"Can't open file %s",aUrl.ToCString()); + sprintf(eStr,"Can't open file %s",aUrl.c_str()); //#ifdef WNT delete [] eStr; //#endif - _errorCode = TCollection_AsciiString(eStr); + _errorCode = string(eStr); return NULL; } // Temporary aStudyUrl in place of study name - Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + DF_Document* Doc = _appli->NewDocument("SALOME_STUDY"); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl); + SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, aUrl); _IDcounter++; Study->StudyId( _IDcounter ); @@ -183,10 +166,9 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc return Study; } - //Create the Structure of the OCAF Document + //Create the Structure of the Document hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file); - Handle(TDF_Data) DF = Doc->GetData(); try { BuildTree (Study, hdf_group_study_structure); } @@ -195,18 +177,18 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc //#ifndef WNT // char eStr[strlen(aUrl.ToCString())+17]; //#else - char *eStr = new char [strlen(aUrl.ToCString())+17]; + char *eStr = new char [strlen(aUrl.c_str())+17]; //#endif - sprintf(eStr,"Can't open file %s", aUrl.ToCString()); - _errorCode = TCollection_AsciiString(eStr); + sprintf(eStr,"Can't open file %s", aUrl.c_str()); + _errorCode = string(eStr); return NULL; } hdf_file->CloseOnDisk(); if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append("hdf_from_ascii.hdf"); + vector aFilesToRemove; + aFilesToRemove.push_back("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } @@ -225,11 +207,11 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc */ //============================================================================ -void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) +void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy) { _errorCode = ""; - if(aStudy.IsNull()) { + if(!aStudy) { _errorCode = "Study is null"; return; } @@ -242,14 +224,14 @@ void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) * Purpose : Save a Study to it's persistent reference */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { _errorCode = ""; - TCollection_AsciiString url = aStudy->URL(); - if (url.IsEmpty()) { + string url = aStudy->URL(); + if (url.empty()) { _errorCode = "No path specified to save the study. Nothing done"; return false; } @@ -260,14 +242,14 @@ bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, return false; } -bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveASCII(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { _errorCode = ""; - TCollection_AsciiString url = aStudy->URL(); - if (url.IsEmpty()) { + string url = aStudy->URL(); + if (url.empty()) { _errorCode = "No path specified to save the study. Nothing done"; return false; } @@ -283,8 +265,8 @@ bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStu * Purpose : Save a study to the persistent reference aUrl */ //============================================================================ -bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveAs(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -292,8 +274,8 @@ bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl, return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, false); } -bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveAsASCII(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -306,27 +288,26 @@ bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl, * Purpose : Get name list of open studies in the session */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() +vector SALOMEDSImpl_StudyManager::GetOpenStudies() { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient; + vector aList; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->NbDocuments(); if(nbDocs == 0) { _errorCode = "No active study in this session"; return aList; } else { - Handle(SALOMEDSImpl_Study) aStudy; - Handle(CDF_Session) S = CDF_Session::CurrentSession(); - CDF_DirectoryIterator it (S->Directory()); - for (;it.MoreDocument();it.NextDocument()) { - Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document()); + SALOMEDSImpl_Study* aStudy; + vector ids = _appli->GetDocumentIDs(); + for (int i = 0, len = ids.size(); iGetDocument(ids[i]); if(D == _clipboard) continue; aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if(aStudy.IsNull()) continue; - aList->Append(aStudy); + if(!aStudy) continue; + aList.push_back(aStudy); } } @@ -338,30 +319,24 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() * Purpose : Get a study from its name */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName - (const TCollection_AsciiString& aStudyName) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByName + (const string& aStudyName) { _errorCode = ""; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->NbDocuments(); if (nbDocs == 0) { _errorCode = "No active study in this session"; return NULL; } else { - Handle(SALOMEDSImpl_Study) aStudy; - Handle(CDF_Session) S = CDF_Session::CurrentSession(); - CDF_DirectoryIterator it (S->Directory()); - for (; it.MoreDocument(); it.NextDocument()) { - Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document()); - if (D == _clipboard) continue; - aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if (aStudy.IsNull()) continue; - if (aStudy->Name() == aStudyName) return aStudy; + vector studies = GetOpenStudies(); + for (int i = 0, len = studies.size(); iName() == aStudyName) return studies[i]; } } - _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName; + _errorCode = string("Found no study with the name ") + aStudyName; return NULL; } @@ -370,25 +345,19 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName * Purpose : Get a study from its ID */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) { _errorCode = ""; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->NbDocuments(); if (nbDocs == 0) { _errorCode = "No active study in this session"; return NULL; } else { - Handle(SALOMEDSImpl_Study) aStudy; - Handle(CDF_Session) S = CDF_Session::CurrentSession(); - CDF_DirectoryIterator it (S->Directory()); - for (; it.MoreDocument(); it.NextDocument()) { - Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document()); - if (D == _clipboard) continue; - aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if (aStudy.IsNull()) continue; - if (aStudy->StudyId() == aStudyID) return aStudy; + vector studies = GetOpenStudies(); + for (int i = 0, len = studies.size(); iStudyId() == aStudyID) return studies[i]; } } @@ -401,7 +370,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) * Purpose : save the study properties in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group) { _errorCode = ""; @@ -411,43 +380,42 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St hdf_int32 name_len; // add modifications list (user and date of save) - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = aStudy->GetProperties(); - Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder(); + SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties(); int aLocked = aProp->IsLocked(); - if (aLocked) aProp->SetLocked(Standard_False); + if (aLocked) aProp->SetLocked(false); - OSD_Process aProcess; - Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetModification(aProcess.UserName().ToCString(), - aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); + int month=0,day=0,year=0,hh=0,mn=0,ss=0; + SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss); + aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(), + mn, hh, day, month, year); - if (aLocked) aProp->SetLocked(Standard_True); + if (aLocked) aProp->SetLocked(true); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); int aLength = 0, anIndex, i; - for(i=1; i<=aNames->Length(); i++) - aLength += aNames->Value(i).Length() + 1; + for(i=1; i<=aNames.size(); i++) + aLength += aNames[i-1].size() + 1; //string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, "zero" byte - char* aProperty = new char[3 + aLength + 12 * aNames->Length()]; + char* aProperty = new char[3 + aLength + 12 * aNames.size()]; sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u'); - aLength = aNames->Length(); + aLength = aNames.size(); int a = 2; - for(anIndex = 1; anIndex <= aLength; anIndex++) { + for(anIndex = 0; anIndexValue(anIndex)), - (int)(aHours->Value(anIndex)), - (int)(aDays->Value(anIndex)), - (int)(aMonths->Value(anIndex)), - (int)(aYears->Value(anIndex)), - TCollection_AsciiString(aNames->Value(anIndex)).ToCString()); + (int)(aMinutes[anIndex]), + (int)(aHours[anIndex]), + (int)(aDays[anIndex]), + (int)(aMonths[anIndex]), + (int)(aYears[anIndex]), + aNames[anIndex].c_str()); a = strlen(aProperty); aProperty[a++] = 1; } @@ -471,8 +439,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St * Purpose : save the study in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile, bool theASCII) @@ -480,7 +448,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, // HDF File will be composed of differents part : // * For each ComponentDataType, all data created by the component // Informations in data group hdf_group_datacomponent - // * Study Structure -> Exactly what is contained in OCAF document + // * Study Structure -> Exactly what is contained in Document // Informations in data group hdf_group_study_structure _errorCode = ""; @@ -496,34 +464,33 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_int32 name_len = 0; char *component_name = 0; + if(!aStudy) { + _errorCode = "Study is null"; + return false; + } + int aLocked = aStudy->GetProperties()->IsLocked(); if (aLocked) aStudy->GetProperties()->SetLocked(false); - Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder(); + SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder(); map aMapTypeDriver; - if(aStudy.IsNull()) { - _errorCode = "Study is null"; - return false; - } - try { // mpv 15.12.2003: for saving components we have to load all data from all modules SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator(); for (; itcomponent1.More(); itcomponent1.Next()) { - Handle(SALOMEDSImpl_SComponent) sco = itcomponent1.Value(); - + SALOMEDSImpl_SComponent sco = itcomponent1.Value(); // if there is an associated Engine call its method for saving - TCollection_AsciiString IOREngine; + string IOREngine; try { - if (!sco->ComponentIOR(IOREngine)) { - TCollection_AsciiString aCompType = sco->GetComment(); - if (!aCompType.IsEmpty()) { + if (!sco.ComponentIOR(IOREngine)) { + string aCompType = sco.GetComment(); + if (!aCompType.empty()) { SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType); - aMapTypeDriver[aCompType.ToCString()] = aDriver; + aMapTypeDriver[aCompType] = aDriver; if (aDriver != NULL) { if(!SB->LoadWith(sco, aDriver)) { @@ -539,12 +506,12 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, } } - TCollection_AsciiString anOldName = aStudy->Name(); + string anOldName = aStudy->Name(); aStudy->URL(aUrl); // To change for Save // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything?? - hdf_file = new HDFfile(aUrl.ToCString()); + hdf_file = new HDFfile((char*)aUrl.c_str()); hdf_file->CreateOnDisk(); //----------------------------------------------------------------------- @@ -557,20 +524,20 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, for (; itcomponent.More(); itcomponent.Next()) { - Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); + SALOMEDSImpl_SComponent sco = itcomponent.Value(); - TCollection_AsciiString scoid = sco->GetID(); - hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent); + string scoid = sco.GetID(); + hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group_datacomponent); hdf_sco_group->CreateOnDisk(); - TCollection_AsciiString componentDataType = sco->ComponentDataType(); - TCollection_AsciiString IOREngine; - if (sco->ComponentIOR(IOREngine)) + string componentDataType = sco.ComponentDataType(); + string IOREngine; + if (sco.ComponentIOR(IOREngine)) { SALOMEDSImpl_Driver* Engine = NULL; - if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) { + if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) { // we have found the associated engine to write the data - Engine = aMapTypeDriver[componentDataType.ToCString()]; + Engine = aMapTypeDriver[componentDataType]; } else { Engine = aFactory->GetDriverByIOR(IOREngine); @@ -578,8 +545,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, if (Engine != NULL) { - Handle(SALOMEDSImpl_TMPFile) aStream; - long length; + SALOMEDSImpl_TMPFile* aStream = NULL; + long length = 0; if (theASCII) aStream = Engine->SaveASCII(sco, SALOMEDSImpl_Tool::GetDirFromPath(aUrl), @@ -590,7 +557,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, length, theMultiFile); HDFdataset *hdf_dataset; - hdf_size aHDFSize[1]; + hdf_size aHDFSize[1]; if(length > 0) { //The component saved some auxiliary files, then put them into HDF file aHDFSize[0] = length; @@ -601,6 +568,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_dataset->CloseOnDisk(); } + if(aStream) delete aStream; + // store multifile state aHDFSize[0] = 2; hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); @@ -634,13 +603,13 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator(); for (; itcomp.More(); itcomp.Next()) { - Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); - TCollection_AsciiString scid = SC->GetID(); - hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + string scid = SC.GetID(); + hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure); hdf_sco_group2->CreateOnDisk(); SaveAttributes(SC, hdf_sco_group2); // ComponentDataType treatment - component_name = SC->ComponentDataType().ToCString(); + component_name = (char*)SC.ComponentDataType().c_str(); name_len = (hdf_int32)strlen(component_name); size[0] = name_len +1 ; hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1); @@ -652,12 +621,11 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_sco_group2->CloseOnDisk(); hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor } - //----------------------------------------------------------------------- //4 - Write the Study UseCases Structure //----------------------------------------------------------------------- - Handle(SALOMEDSImpl_SObject) aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID); - if (!aSO.IsNull()) { + SALOMEDSImpl_SObject aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID); + if (aSO) { HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure); hdf_soo_group->CreateOnDisk(); SaveAttributes(aSO, hdf_soo_group); @@ -670,17 +638,16 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, //----------------------------------------------------------------------- //5 - Write the Study Properties //----------------------------------------------------------------------- - name_len = (hdf_int32) aStudy->Name().Length(); + name_len = (hdf_int32) aStudy->Name().size(); size[0] = name_len +1 ; hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1); hdf_dataset->CreateOnDisk(); - char* studid = aStudy->Name().ToCString(); + char* studid = (char*)aStudy->Name().c_str(); hdf_dataset->WriteOnDisk(studid); hdf_dataset->CloseOnDisk(); hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor Impl_SaveProperties(aStudy, hdf_group_study_structure); - hdf_group_study_structure->CloseOnDisk(); hdf_file->CloseOnDisk(); @@ -704,7 +671,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, return false; } if (theASCII) { // save file in ASCII format - HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true); + HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true); } return true; @@ -715,7 +682,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, +bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype) { _errorCode = ""; @@ -725,29 +692,32 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObjec HDFgroup *hdf_group_sobject = 0; - TDF_ChildIterator itchild(SC->GetLabel()); + DF_ChildIterator itchild(SC.GetLabel()); for (; itchild.More(); itchild.Next()) { // mpv: don't save empty labels - TDF_AttributeIterator AI1(itchild.Value()); - if (!AI1.More()) { //No attributes on the label - TDF_ChildIterator subchild(SC->GetLabel()); + vector attr = itchild.Value().GetAttributes(); + if (attr.size() == 0) { //No attributes on the label + DF_ChildIterator subchild(itchild.Value()); if (!subchild.More()) { continue; } - subchild.Initialize(SC->GetLabel(), true); + subchild.Init(itchild.Value(), true); bool anEmpty = true; for (; subchild.More() && anEmpty; subchild.Next()) { - TDF_AttributeIterator AI2(subchild.Value()); - if (AI2.More()) anEmpty = false; //There are attributes on the child label + vector attr2 = subchild.Value().GetAttributes(); + if (attr2.size()) { + anEmpty = false; //There are attributes on the child label + break; + } } if (anEmpty) continue; } - Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::SObject(itchild.Value()); + SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value()); - char* scoid = (char*) SO->GetID().ToCString(); + char* scoid = (char*) SO.GetID().c_str(); hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype); hdf_group_sobject->CreateOnDisk(); SaveAttributes(SO, hdf_group_sobject); @@ -764,14 +734,13 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObjec * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TCollection_AsciiString& aUrl) +string SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const string& aUrl) { _errorCode = ""; - TCollection_ExtendedString theUrl(aUrl); - Standard_ExtCharacter val1 = ToExtCharacter('/'); - Standard_ExtCharacter val2 = ToExtCharacter(':'); - theUrl.ChangeAll(val1,val2); + std::string theUrl(aUrl); + for(int i = 0; i_doc; @@ -791,15 +760,15 @@ Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Han * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; - Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); - if (aComponent.IsNull()) return false; - if (aComponent->GetLabel() == theObject->GetLabel()) return false; - TCollection_AsciiString IOREngine; - if (!aComponent->ComponentIOR(IOREngine)) return false; + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); + if (!aComponent) return false; + if (aComponent.GetLabel() == theObject.GetLabel()) return false; + string IOREngine; + if (!aComponent.ComponentIOR(IOREngine)) return false; if (theEngine == NULL) return false; return theEngine->CanCopy(theObject); } @@ -809,63 +778,64 @@ bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theO * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy, +bool SALOMEDSImpl_StudyManager::CopyLabel(SALOMEDSImpl_Study* theSourceStudy, SALOMEDSImpl_Driver* theEngine, - const Standard_Integer theSourceStartDepth, - const TDF_Label& theSource, - const TDF_Label& theDestinationMain) + const int theSourceStartDepth, + const DF_Label& theSource, + const DF_Label& theDestinationMain) { _errorCode = ""; int a; - TDF_Label aTargetLabel = theDestinationMain; - TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2); + DF_Label aTargetLabel = theDestinationMain; + DF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2); for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; + DF_Label aSourceLabel = theSource; for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father(); aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag()); aAuxTargetLabel = aAuxTargetLabel.FindChild(aSourceLabel.Tag()); } // iterate attributes - TDF_AttributeIterator anAttrIterator(theSource); - Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable(); - for(; anAttrIterator.More(); anAttrIterator.Next()) { - Handle(TDF_Attribute) anAttr = anAttrIterator.Value(); - if (!Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(anAttr).IsNull()) continue; // never copy tree node attribute - if (!Handle(SALOMEDSImpl_AttributeTarget)::DownCast(anAttr).IsNull()) continue; // and target attribute - - if (!Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr).IsNull()) { // reference copied as Comment in aux tree - TDF_Label aReferenced = Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Get(); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aReferenced, anEntry); + vector attrList = theSource.GetAttributes(); + for(int i = 0, len = attrList.size(); i(anAttr)->Get(); + string anEntry = aReferenced.Entry(); // store the value of name attribute of referenced label - Handle(SALOMEDSImpl_AttributeName) aNameAttribute; - if (aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) { + SALOMEDSImpl_AttributeName* aNameAttribute; + if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { anEntry += " "; anEntry += aNameAttribute->Value(); } - SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry)); + SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, anEntry); continue; } - if (!Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theSource, anEntry); - Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString()); + if (type == string("AttributeIOR")) { // IOR => ID and TMPFile of Engine + string anEntry = theSource.Entry(); + SALOMEDSImpl_SObject aSO = theSourceStudy->FindObjectID(anEntry); int anObjID; long aLen; - Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen); - TCollection_ExtendedString aResStr(""); + SALOMEDSImpl_TMPFile* aStream = theEngine->CopyFrom(aSO, anObjID, aLen); + string aResStr(""); for(a = 0; a < aLen; a++) { - aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a)))); + aResStr += (char)(aStream->Get(a)); } + + if(aStream) delete aStream; + SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID); SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr); continue; } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); + DF_Attribute* aNewAttribute = anAttr->NewEmpty(); aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); + anAttr->Paste(aNewAttribute); } return true; @@ -876,48 +846,46 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; // adoptation for alliances datamodel copy: without IOR attributes !!! bool aStructureOnly; // copy only SObjects and attributes without component help - aStructureOnly = !theObject->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID()); + aStructureOnly = !theObject.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID()); // get component-engine - Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy(); + SALOMEDSImpl_Study* aStudy = theObject.GetStudy(); // CAF document of current study usage - Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy); - if (aDocument.IsNull()) { - _errorCode = "OCAF document is null"; + DF_Document* aDocument = GetDocumentOfStudy(aStudy); + if (!aDocument) { + _errorCode = "Document is null"; return false; } //Clear the clipboard - _clipboard->Main().Root().ForgetAllAttributes(Standard_True); - _OCAFApp->Close(_clipboard); - Handle(TDocStd_Document) aDoc; - _OCAFApp->NewDocument("SALOME_STUDY", aDoc); - _clipboard = aDoc; + _clipboard->Main().Root().ForgetAllAttributes(true); + _appli->Close(_clipboard); + _clipboard = _appli->NewDocument("SALOME_STUDY"); // set component data type to the name attribute of root label if (!aStructureOnly) { SALOMEDSImpl_AttributeComment::Set(_clipboard->Main().Root(), - TCollection_ExtendedString(theEngine->ComponentDataType())); + theEngine->ComponentDataType()); } // set to the Root label integer attribute: study id SALOMEDSImpl_AttributeInteger::Set(_clipboard->Main().Root(), aStudy->StudyId()); // iterate all theObject's label children - TDF_Label aStartLabel = theObject->GetLabel(); - Standard_Integer aSourceStartDepth = aStartLabel.Depth(); + DF_Label aStartLabel = theObject.GetLabel(); + int aSourceStartDepth = aStartLabel.Depth(); // copy main source label CopyLabel(aStudy, theEngine, aSourceStartDepth, aStartLabel, _clipboard->Main()); // copy all subchildren of the main source label (all levels) - TDF_ChildIterator anIterator(aStartLabel, Standard_True); + DF_ChildIterator anIterator(aStartLabel, true); for(; anIterator.More(); anIterator.Next()) { CopyLabel(aStudy, theEngine, aSourceStartDepth, anIterator.Value(), _clipboard->Main()); } @@ -929,34 +897,34 @@ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObje * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; - if (_clipboard.IsNull()) { + if (!_clipboard) { _errorCode = "Clipboard is null"; return false; } - Handle(SALOMEDSImpl_AttributeComment) aCompName; - if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCompName)) { + SALOMEDSImpl_AttributeComment* aCompName = NULL; + if (!(aCompName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { _errorCode = "Clipboard has no component type"; return false; } - Handle(SALOMEDSImpl_AttributeInteger) anObjID; - if (!_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID)) { + SALOMEDSImpl_AttributeInteger* anObjID; + if (!(anObjID=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { _errorCode = "Clipboard has no object id"; return false; } - Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); - if (aComponent.IsNull()) { + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); + if (!aComponent) { _errorCode = "Object doesn't belong to component"; return false; } - TCollection_AsciiString IOREngine; - if (!aComponent->ComponentIOR(IOREngine)) { + string IOREngine; + if (!aComponent.ComponentIOR(IOREngine)) { _errorCode = "component has no IOR"; return false; } @@ -968,23 +936,23 @@ bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& the * Purpose : */ //============================================================================ -TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy, - SALOMEDSImpl_Driver* theEngine, - const TDF_Label& theSource, - const TDF_Label& theDestinationStart, - const int theCopiedStudyID, - const bool isFirstElement) +DF_Label SALOMEDSImpl_StudyManager::PasteLabel(SALOMEDSImpl_Study* theDestinationStudy, + SALOMEDSImpl_Driver* theEngine, + const DF_Label& theSource, + const DF_Label& theDestinationStart, + const int theCopiedStudyID, + const bool isFirstElement) { _errorCode = ""; // get corresponding source, target and auxiliary labels - TDF_Label aTargetLabel = theDestinationStart; + DF_Label aTargetLabel = theDestinationStart; - TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2); + DF_Label aAuxSourceLabel = theSource.Root().FindChild(2); int a; if (!isFirstElement) { for(a = theSource.Depth() - 1; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; + DF_Label aSourceLabel = theSource; for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father(); aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag()); aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag()); @@ -992,36 +960,32 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) } // check auxiliary label for TMPFile => IOR - Handle(SALOMEDSImpl_AttributeName) aNameAttribute; - if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) { - Handle(SALOMEDSImpl_AttributeInteger) anObjID; - - aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID); - Handle(SALOMEDSImpl_AttributeComment) aComponentName; - theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName); - TCollection_AsciiString aCompName = aComponentName->Value(); + SALOMEDSImpl_AttributeName* aNameAttribute = NULL; + if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + SALOMEDSImpl_AttributeInteger* anObjID = (SALOMEDSImpl_AttributeInteger*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()); + SALOMEDSImpl_AttributeComment* aComponentName = (SALOMEDSImpl_AttributeComment*)theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()); + string aCompName = aComponentName->Value(); if (theEngine->CanPaste(aCompName, anObjID->Value())) { - TCollection_ExtendedString aTMPStr = aNameAttribute->Value(); - int aLen = aTMPStr.Length(); + std::string aTMPStr = aNameAttribute->Value(); + int aLen = aTMPStr.size(); unsigned char* aStream = NULL; if(aLen > 0) { aStream = new unsigned char[aLen+10]; for(a = 0; a < aLen; a++) { - aStream[a] = ToCharacter(aTMPStr.Value(a+1)); + aStream[a] = aTMPStr[a]; } } - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aTargetLabel, anEntry); - Handle(SALOMEDSImpl_SObject) aPastedSO = theDestinationStudy->FindObjectID(anEntry); + string anEntry = aTargetLabel.Entry(); + SALOMEDSImpl_SObject aPastedSO = theDestinationStudy->FindObjectID(anEntry); if (isFirstElement) { - TCollection_AsciiString aDestEntry = theEngine->PasteInto(aStream, - aLen, - anObjID->Value(), - aPastedSO->GetFatherComponent()); - TDF_Tool::Label(theDestinationStart.Data(), aDestEntry, aTargetLabel); + string aDestEntry = theEngine->PasteInto(aStream, + aLen, + anObjID->Value(), + aPastedSO.GetFatherComponent()); + aTargetLabel = DF_Label::Label(theDestinationStart, aDestEntry); } else theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO); @@ -1030,38 +994,35 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) } // iterate attributes - TDF_AttributeIterator anAttrIterator(theSource); - Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable(); - for(; anAttrIterator.More(); anAttrIterator.Next()) { - Handle(TDF_Attribute) anAttr = anAttrIterator.Value(); - if (aTargetLabel.FindAttribute(anAttr->ID(), anAttr)) { + vector attrList = theSource.GetAttributes(); + for(int i = 0, len = attrList.size(); iID())) { aTargetLabel.ForgetAttribute(anAttr->ID()); - anAttr = anAttrIterator.Value(); } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); + DF_Attribute* aNewAttribute = anAttr->NewEmpty(); aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); + anAttr->Paste(aNewAttribute); } // check auxiliary label for Comment => reference or name attribute of the referenced object - Handle(SALOMEDSImpl_AttributeComment) aCommentAttribute; - if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCommentAttribute)) { - char * anEntry = new char[aCommentAttribute->Value().Length() + 1]; - strcpy(anEntry, TCollection_AsciiString(aCommentAttribute->Value()).ToCString()); + SALOMEDSImpl_AttributeComment* aCommentAttribute = NULL; + if ((aCommentAttribute=(SALOMEDSImpl_AttributeComment*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { + char * anEntry = new char[aCommentAttribute->Value().size() + 1]; + strcpy(anEntry, string(aCommentAttribute->Value()).c_str()); char* aNameStart = strchr(anEntry, ' '); if (aNameStart) { *aNameStart = '\0'; aNameStart++; } if (theCopiedStudyID == theDestinationStudy->StudyId()) { // if copy to the same study, reanimate reference - TDF_Label aRefLabel; - TDF_Tool::Label(aTargetLabel.Data(), anEntry, aRefLabel); + DF_Label aRefLabel = DF_Label::Label(aTargetLabel, anEntry); SALOMEDSImpl_AttributeReference::Set(aTargetLabel, aRefLabel); // target attributes structure support SALOMEDSImpl_AttributeTarget::Set(aRefLabel)->Add(SALOMEDSImpl_Study::SObject(aTargetLabel)); } else { if (aNameStart) SALOMEDSImpl_AttributeName::Set(aTargetLabel, aNameStart); - else SALOMEDSImpl_AttributeName::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry); + else SALOMEDSImpl_AttributeName::Set(aTargetLabel, std::string("Reference to:")+anEntry); } delete [] anEntry; } @@ -1074,12 +1035,13 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOMEDSImpl_SObject)& theObject, - SALOMEDSImpl_Driver* theEngine) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyManager::Paste(const SALOMEDSImpl_SObject& theObject, + SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; - Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy(); + SALOMEDSImpl_SObject so; + SALOMEDSImpl_Study* aStudy = theObject.GetStudy(); // if study is locked, then paste can't be done if (aStudy->GetProperties()->IsLocked()) { @@ -1088,40 +1050,38 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM } // if there is no component name, then paste only SObjects and attributes: without component help - Handle(SALOMEDSImpl_AttributeComment) aComponentName; - bool aStructureOnly = !_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName); + SALOMEDSImpl_AttributeComment* aComponentName = NULL; + bool aStructureOnly = !(aComponentName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID())); // get copied study ID - Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute; - if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) { + SALOMEDSImpl_AttributeInteger* aStudyIDAttribute = NULL; + if (!(aStudyIDAttribute=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { _errorCode = "No study ID was found"; - return NULL; + return so; } int aCStudyID = aStudyIDAttribute->Value(); // CAF document of current study usage - Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy); - if (aDocument.IsNull()) { - _errorCode = "OCAF document is null"; - return NULL; + DF_Document* aDocument = GetDocumentOfStudy(aStudy); + if (!aDocument) { + _errorCode = "Document is null"; + return so; } - Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); // fill root inserted SObject - TDF_Label aStartLabel; + DF_Label aStartLabel; if (aStructureOnly) { - TDF_Label anObjectLabel; - TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel); + DF_Label anObjectLabel = DF_Label::Label(aDocument->Main(), theObject.GetID()); aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false); } else { - TDF_Label aComponentLabel; - TDF_Tool::Label(aDocument->GetData(), aComponent->GetID(), aComponentLabel); + DF_Label aComponentLabel = DF_Label::Label(aDocument->Main(), aComponent.GetID()); aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), aComponentLabel, aCStudyID, true); } // paste all sublebels - TDF_ChildIterator anIterator(_clipboard->Main(), Standard_True); + DF_ChildIterator anIterator(_clipboard->Main(), true); for(; anIterator.More(); anIterator.Next()) { PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false); } @@ -1138,22 +1098,22 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM * Purpose : Save attributes for object */ //============================================================================ -static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject) +static void SaveAttributes(const SALOMEDSImpl_SObject& aSO, HDFgroup *hdf_group_sobject) { hdf_size size[1]; - TDF_AttributeIterator Itr(aSO->GetLabel()); - Handle(TDF_Attribute) anAttr; - for(; Itr.More(); Itr.Next()) { - anAttr = Itr.Value(); + vector attrList = aSO.GetLabel().GetAttributes(); + DF_Attribute* anAttr = NULL; + for(int i = 0, len = attrList.size(); iDynamicType() == STANDARD_TYPE(SALOMEDSImpl_AttributeIOR)) continue; //IOR attribute is not saved - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr); - TCollection_AsciiString aSaveStr = ga->Save(); - //cout << "Saving: " << aSO->GetID() << " "<< ga->Type() << " value: " << aSaveStr << endl; - size[0] = (hdf_int32) strlen(aSaveStr.ToCString()) + 1; - HDFdataset *hdf_dataset = new HDFdataset((char*)ga->Type().ToCString(), hdf_group_sobject,HDF_STRING,size,1); + string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr); + if(type == string("AttributeIOR")) continue; //IOR attribute is not saved + string aSaveStr =anAttr->Save(); + //cout << "Saving: " << aSO.GetID() << " type: "<< type<<"|" << endl; + size[0] = (hdf_int32) strlen(aSaveStr.c_str()) + 1; + HDFdataset *hdf_dataset = new HDFdataset((char*)type.c_str(), hdf_group_sobject, HDF_STRING,size, 1); hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((char*)aSaveStr.ToCString()); + hdf_dataset->WriteOnDisk((char*)aSaveStr.c_str()); hdf_dataset->CloseOnDisk(); hdf_dataset=0; //will be deleted by hdf_sco_group destructor } @@ -1162,17 +1122,16 @@ static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group //=========================================================================== //Function : ReadAttributes //=========================================================================== -static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, - const Handle(SALOMEDSImpl_SObject)& aSO, +static void ReadAttributes(SALOMEDSImpl_Study* theStudy, + const SALOMEDSImpl_SObject& aSO, HDFdataset* hdf_dataset) { hdf_dataset->OpenOnDisk(); - Handle(TDF_Attribute) anAttr; - + DF_Attribute* anAttr = NULL; char* current_string = new char[hdf_dataset->GetSize()+1]; hdf_dataset->ReadFromDisk(current_string); - + //cout << "Reading attr type = " << hdf_dataset->GetName() << " SO = " << aSO.GetID() << endl; if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) { anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment"); } else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") || @@ -1185,11 +1144,8 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName()); } - if (!anAttr.IsNull()) { - - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr); - ga->Load(current_string); - //cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl; + if (anAttr) { + anAttr->Load(current_string); } delete(current_string); @@ -1199,10 +1155,10 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, //============================================================================ //Function : BuildlTree //============================================================================ -static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf_current_group) +static void BuildTree (SALOMEDSImpl_Study* theStudy, HDFgroup* hdf_current_group) { hdf_current_group->OpenOnDisk(); - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; char* Entry = hdf_current_group->GetName(); if (strcmp(Entry,"STUDY_STRUCTURE") == 0) { aSO = theStudy->CreateObjectID("0:1"); @@ -1212,8 +1168,8 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf } char name[HDF_NAME_MAX_LEN+1]; - Standard_Integer nbsons = hdf_current_group->nInternalObjects(); - for (Standard_Integer i=0; inInternalObjects(); + for (int i=0; iInternalObjectIndentify(i,name); if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; hdf_object_type type = hdf_current_group->InternalObjectType(name); @@ -1237,23 +1193,24 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf //============================================================================ //Function : Translate_IOR_to_persistentID //============================================================================ -static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& so, +static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject& so, SALOMEDSImpl_Driver* engine, bool isMultiFile, bool isASCII) { - TDF_ChildIterator itchild(so->GetLabel()); - TCollection_AsciiString ior_string, persistent_string, curid; + DF_ChildIterator itchild(so.GetLabel()); + string ior_string, persistent_string, curid; for (; itchild.More(); itchild.Next()) { - Handle(SALOMEDSImpl_SObject) current = SALOMEDSImpl_Study::SObject(itchild.Value()); - Handle(SALOMEDSImpl_AttributeIOR) IOR; - if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) { + SALOMEDSImpl_SObject current = SALOMEDSImpl_Study::SObject(itchild.Value()); + SALOMEDSImpl_AttributeIOR* IOR = NULL; + if ((IOR=(SALOMEDSImpl_AttributeIOR*)current.GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { ior_string = IOR->Value(); persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII); - SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string); + SALOMEDSImpl_AttributePersistentRef::Set(current.GetLabel(), persistent_string); } Translate_IOR_to_persistentID (current, engine, isMultiFile, isASCII); } } + diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx index 2009b0dfb..190317bbc 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx @@ -24,36 +24,30 @@ #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__ #define __SALOMEDSImpl_STUDYMANAGER_I_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared ) - // std C++ headers #include +#include +#include -// Cascade headers -#include "SALOMEDSImpl_OCAFApplication.hxx" +#include "DF_Application.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Driver.hxx" -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" class HDFgroup; -class SALOMEDSImpl_StudyManager : public MMgt_TShared +class SALOMEDSImpl_StudyManager { private: - Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp; - int _IDcounter; - Handle(TDocStd_Document) _clipboard; - TCollection_AsciiString _errorCode; + DF_Application* _appli; + int _IDcounter; + DF_Document* _clipboard; + std::string _errorCode; public: @@ -64,85 +58,82 @@ public: Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager(); //! method to Create a New Study of name study_name - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name); + Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name); //! method to Open a Study from it's persistent reference - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl); + Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl); //! method to close a Study - Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy); + Standard_EXPORT virtual void Close(SALOMEDSImpl_Study* aStudy); //! method to save a Study - Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile); + Standard_EXPORT virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile); - Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, - SALOMEDSImpl_DriverFactory* aFactory, - bool theMultiFile); + Standard_EXPORT virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy, + SALOMEDSImpl_DriverFactory* aFactory, + bool theMultiFile); //! method to save a Study to the persistent reference aUrl - Standard_EXPORT virtual bool SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, - SALOMEDSImpl_DriverFactory* aFactory, - bool theMultiFile); + Standard_EXPORT virtual bool SaveAs(const std::string& aUrl, + SALOMEDSImpl_Study* aStudy, + SALOMEDSImpl_DriverFactory* aFactory, + bool theMultiFile); - Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, - SALOMEDSImpl_DriverFactory* aFactory, - bool theMultiFile); + Standard_EXPORT virtual bool SaveAsASCII(const std::string& aUrl, + SALOMEDSImpl_Study* aStudy, + SALOMEDSImpl_DriverFactory* aFactory, + bool theMultiFile); //! method to Get name list of open studies in the session - Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies(); + Standard_EXPORT virtual std::vector GetOpenStudies(); //! method to get a Study from it's name - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ; + Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ; //! method to get a Study from it's ID - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ; + Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ; - Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy); + Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy); - Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; } + Standard_EXPORT DF_Document* GetClipboard() { return _clipboard; } - Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy, - SALOMEDSImpl_Driver* theEngine, - const int theSourceStartDepth, - const TDF_Label& theSource, - const TDF_Label& theDestinationMain); - - Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy, - SALOMEDSImpl_Driver* theEngine, - const TDF_Label& theSource, - const TDF_Label& theDestinationStart, - const int theCopiedStudyID, - const bool isFirstElement); + Standard_EXPORT bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy, + SALOMEDSImpl_Driver* theEngine, + const int theSourceStartDepth, + const DF_Label& theSource, + const DF_Label& theDestinationMain); + + Standard_EXPORT DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy, + SALOMEDSImpl_Driver* theEngine, + const DF_Label& theSource, + const DF_Label& theDestinationStart, + const int theCopiedStudyID, + const bool isFirstElement); - Standard_EXPORT virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine); - Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine); - Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); // _SaveAs private function called by Save and SaveAs - Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, - SALOMEDSImpl_DriverFactory* aFactory, - bool theMultiFile, - bool theASCII); + Standard_EXPORT virtual bool Impl_SaveAs(const std::string& aUrl, + SALOMEDSImpl_Study* aStudy, + SALOMEDSImpl_DriverFactory* aFactory, + bool theMultiFile, + bool theASCII); // _SaveObject private function called by _SaveAs - Standard_EXPORT virtual bool Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype); + Standard_EXPORT virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype); // _SubstituteSlash function called by Open and GetStudyByName - Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl); + Standard_EXPORT virtual std::string Impl_SubstituteSlash(const std::string& aUrl); - Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group); + Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group); - Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; } + Standard_EXPORT std::string GetErrorCode() { return _errorCode; } Standard_EXPORT virtual bool IsError() { return _errorCode != ""; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx index 7b0c2e2f3..04a20312a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx @@ -25,13 +25,6 @@ #include "SALOMEDSImpl_TMPFile.hxx" -#include -#include - - -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_TMPFile, MMgt_TShared ) - SALOMEDSImpl_TMPFile::TOctet* SALOMEDSImpl_TMPFile ::Data() diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx index 651673e9c..3d63b66cd 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx @@ -21,26 +21,19 @@ #ifndef __SALOMEDSIMPL_TMPFILE_H__ #define __SALOMEDSIMPL_TMPFILE_H__ -//Handle definition -#include -#include -#include +#include "DF_definitions.hxx" -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared ); - - -struct SALOMEDSImpl_TMPFile : public MMgt_TShared +struct SALOMEDSImpl_TMPFile { typedef unsigned char TOctet; + //typedef unsigned int size_t; Standard_EXPORT virtual size_t Size() = 0; Standard_EXPORT virtual TOctet* Data(); Standard_EXPORT virtual TOctet& Get(size_t) = 0; - - DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile ); }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index 4755e3c07..7d817c961 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -29,111 +29,135 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include + #ifndef WNT #include +#include +#include +#include +#include #else #include +#include #endif + #include using namespace std; + +bool Exists(const string thePath) +{ +#ifdef WNT + if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { + if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + return false; + } + } +#else + int status = access ( thePath.c_str() , F_OK ); + if (status != 0) return false; +#endif + return true; +} + + + + //============================================================================ // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Tool::GetTmpDir() +string SALOMEDSImpl_Tool::GetTmpDir() { //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; + string aTmpDir; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { - aTmpDir = TCollection_AsciiString(Tmp_dir); + aTmpDir = string(Tmp_dir); #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif } else { #ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); + aTmpDir = string("C:\\"); #else - aTmpDir = TCollection_AsciiString("/tmp/"); + aTmpDir = string("/tmp/"); #endif } srand((unsigned int)time(NULL)); int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - TCollection_AsciiString aSubDir(aRND); - if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory + string aDir = aTmpDir; + + if(Exists(aDir)) { + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name + } + } + #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aDir[aTmpDir.size()-1] != '\\') aDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aDir[aTmpDir.size()-1] != '/') aDir+='/'; #endif - OSD_Path aPath(aTmpDir); - OSD_Directory aDir(aPath); - - for(aRND = 0; aDir.Exists(); aRND++) { - aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aPath = OSD_Path(aTmpDir); - aDir = OSD_Directory(aPath); - } - OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); - aDir.Build(aProtection); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return aTmpDir; + return aDir; } //============================================================================ // function : RemoveTemporaryFiles // purpose : Removes files listed in theFileList //============================================================================ -void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory, - const Handle(TColStd_HSequenceOfAsciiString)& theFiles, +void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory, + const vector& theFiles, const bool IsDirDeleted) { - TCollection_AsciiString aDirName = theDirectory; + string aDirName = theDirectory; - int i, aLength = theFiles->Length(); + int i, aLength = theFiles.size(); for(i=1; i<=aLength; i++) { - TCollection_AsciiString aFile(aDirName); - aFile += theFiles->Value(i); - OSD_Path anOSDPath(aFile); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; - - OSD_Protection aProtection = anOSDFile.Protection(); - aProtection.SetUser(OSD_RW); - anOSDFile.SetProtection(aProtection); - - anOSDFile.Remove(); + string aFile(aDirName); + aFile += theFiles[i-1]; + if(!Exists(aFile)) continue; + +#ifdef WNT + DeleteFile(aFile.c_str()); +#else + unlink(aFile.c_str()); +#endif } if(IsDirDeleted) { - OSD_Path aPath(aDirName); - OSD_Directory aDir(aPath); - OSD_FileIterator anIterator(aPath, '*'); - - if(aDir.Exists() && !anIterator.More()) aDir.Remove(); + if(Exists(aDirName)) { +#ifdef WNT + RemoveDirectory(aDireName.c_str()); +#else + rmdir(aDirName.c_str()); +#endif + } } } @@ -142,34 +166,125 @@ void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theD // function : GetNameFromPath // purpose : Returns the name by the path //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Tool::GetNameFromPath(const TCollection_AsciiString& thePath) { - if (thePath.IsEmpty()) return ""; - OSD_Path aPath = OSD_Path(thePath); - TCollection_AsciiString aNameString(aPath.Name()); - return aNameString; +string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) { + if (thePath.empty()) return ""; + int pos = thePath.rfind('/'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + pos = thePath.rfind('\\'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + pos = thePath.rfind('|'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + return thePath; } //============================================================================ // function : GetDirFromPath // purpose : Returns the dir by the path //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Tool::GetDirFromPath(const TCollection_AsciiString& thePath) { - if (thePath.IsEmpty()) return ""; - OSD_Path aPath = OSD_Path(thePath); - TCollection_AsciiString aDirString; - /*Unix platform don't use assignment in string - but we must to add it for WNT case*/ - TCollection_AsciiString disk = aPath.Disk(); - if(disk.Length()) aDirString.AssignCat(disk); - aDirString.AssignCat(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return aDirString; +string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) { + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); i SALOMEDSImpl_Tool::splitString(const string& theValue, char separator) +{ + vector vs; + if(theValue[0] == separator && theValue.size() == 1) return vs; + int pos = theValue.find(separator); + if(pos < 0) { + vs.push_back(theValue); + return vs; + } + + string s = theValue; + if(s[0] == separator) s = s.substr(1, s.size()); + while((pos = s.find(separator)) >= 0) { + vs.push_back(s.substr(0, pos)); + s = s.substr(pos+1, s.size()); + } + + if(!s.empty() && s[0] != separator) vs.push_back(s); + return vs; } +void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds) +{ +#ifdef WNT + SYSTEMTIME st; + GetLocalTime ( &st ); + month = st.wMonth; + day = st.wDay; + year = st.wYear; + hours = st.wHour; + minutes = st.wMinute; + seconds = st.wSecond; +#else + struct tm transfert; + struct timeval tval; + struct timezone tzone; + int status; + + status = gettimeofday( &tval, &tzone ); + memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm)); + + month = transfert.tm_mon + 1; + day = transfert.tm_mday; + year = transfert.tm_year + 1900; + hours = transfert.tm_hour; + minutes = transfert.tm_min ; + seconds = transfert.tm_sec ; +#endif +} +string SALOMEDSImpl_Tool::GetUserName() +{ +#ifdef WNT + char* pBuff = new char[UNLEN + 1]; + DWORD dwSize = UNLEN + 1; + string retVal; + GetUserName ( pBuff, &dwSize ); + string theTmpUserName(pBuff,(int)dwSize -1 ); + retVal = theTmpUserName; + delete [] pBuff; + return retVal; +#else + struct passwd *infos; + infos = getpwuid(getuid()); + return string(infos->pw_name); +#endif +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx index 37131a277..36ca6874f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx @@ -28,9 +28,9 @@ #ifndef __SALOMEDSIMPL_TOOL_H__ #define __SALOMEDSIMPL_TOOL_H__ -#include -#include -#include +#include +#include +#include "DF_Label.hxx" class SALOMEDSImpl_Tool { @@ -39,22 +39,31 @@ public: // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set // otherwise return /tmp/something/ for Unix or c:\something\ for WNT - static TCollection_AsciiString GetTmpDir(); + static std::string GetTmpDir(); // Removes files which are in , the files for deletion are listed in // if is true is also deleted if it is empty - static void RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory, - const Handle(TColStd_HSequenceOfAsciiString)& theFiles, + static void RemoveTemporaryFiles(const std::string& theDirectory, + const std::vector& theFiles, const bool IsDirDeleted); // Returns the name by the path // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1" - static TCollection_AsciiString GetNameFromPath(const TCollection_AsciiString& thePath); + static std::string GetNameFromPath(const std::string& thePath); // Returns the directory by the path // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa" - static TCollection_AsciiString GetDirFromPath(const TCollection_AsciiString& thePath); + static std::string GetDirFromPath(const std::string& thePath); + + //The functions returns a list of substring of initial string divided by given separator + static std::vector splitString(const std::string& theValue, char separator); + + //Returns a system date + static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds); + + //Returns a name of the user + static std::string GetUserName(); }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx index 3f6f339ce..a28228981 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx @@ -28,20 +28,10 @@ #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_Attributes.hxx" -#include -#include -#include -#include -#include -#include -#include +#include "DF_ChildIterator.hxx" using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) - - #define USE_CASE_LABEL_TAG 2 #define USE_CASE_GUID "AA43BB12-D9CD-11d6-945D-0050DA506788" @@ -51,24 +41,23 @@ IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) * Purpose : */ //============================================================================ -SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument) +SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument) :_doc(theDocument) { - if(_doc.IsNull()) return; + if(!_doc) return; - TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases - if(!aLabel.FindAttribute(Standard_GUID(USE_CASE_GUID), _root)) { - _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, Standard_GUID(USE_CASE_GUID)); + DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases + if(!(_root = (SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(std::string(USE_CASE_GUID)))) { + _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, std::string(USE_CASE_GUID)); } - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - Handle(SALOMEDSImpl_AttributeName) aNameAttr; - if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttr)) { - aNameAttr = SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases"); + if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())) { + SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases"); } } @@ -87,24 +76,25 @@ SALOMEDSImpl_UseCaseBuilder::~SALOMEDSImpl_UseCaseBuilder() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::Append(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); + DF_Label aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aCurrentNode; + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + SALOMEDSImpl_AttributeTreeNode* aCurrentNode = NULL; aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID()); aNode->Remove(); - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode)) + DF_Label aCurrent = aRef->Get(); + if(aCurrent.IsNull() || !(aCurrentNode=(SALOMEDSImpl_AttributeTreeNode*)aCurrent.FindAttribute(_root->ID()))) aCurrentNode = _root; aCurrentNode->Append(aNode); @@ -117,37 +107,37 @@ bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& the * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::Remove(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); + DF_Label aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; aNode->Remove(); - TDF_AttributeList aList; - aList.Append(aNode); + vector aList; + aList.push_back(aNode); - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, Standard_True); + DF_Label aCurrent = aRef->Get(); + + SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, true); for(; aChildItr.More(); aChildItr.Next()) - aList.Append(aChildItr.Value()); + aList.push_back(aChildItr.Value()); - TDF_ListIteratorOfAttributeList anIterator(aList); - for(; anIterator.More(); anIterator.Next()) { - if(anIterator.Value()->Label() == aCurrent) { //The current node is removed + for(int i = 0, len = aList.size(); iLabel() == aCurrent) { //The current node is removed aRef->Set(_root->Label()); //Reset the current node to the root } - anIterator.Value()->Label().ForgetAttribute(_root->ID()); + aList[i]->Label().ForgetAttribute(_root->ID()); } return true; @@ -159,21 +149,21 @@ bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& the * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, - const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const SALOMEDSImpl_SObject& theFather, + const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false; + if(!_root || !theFather || !theObject) return false; - TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel(); + DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel(); if(aFatherLabel == aLabel) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode; + SALOMEDSImpl_AttributeTreeNode *aFather = false, *aNode = false; if(aFatherLabel.IsNull()) return false; - if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return false; + if(!(aFather=(SALOMEDSImpl_AttributeTreeNode*)aFatherLabel.FindAttribute(_root->ID()))) return false; if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) { + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) { aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID()); } @@ -187,18 +177,18 @@ bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& t * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, - const Handle(SALOMEDSImpl_SObject)& theNext) +bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const SALOMEDSImpl_SObject& theFirst, + const SALOMEDSImpl_SObject& theNext) { - if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false; + if(!_root || !theFirst || !theNext) return false; - TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel(); + DF_Label aFirstLabel = theFirst.GetLabel(), aLabel= theNext.GetLabel(); if(aFirstLabel == aLabel) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode; + SALOMEDSImpl_AttributeTreeNode *aFirstNode = NULL, *aNode = NULL; if(aFirstLabel.IsNull()) return false; - if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) { + if((aFirstNode=(SALOMEDSImpl_AttributeTreeNode*)aFirstLabel.FindAttribute(_root->ID()))) { aFirstNode->Remove(); aFirstLabel.ForgetAttribute(aFirstNode->ID()); } @@ -206,7 +196,7 @@ bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject aFirstNode = SALOMEDSImpl_AttributeTreeNode::Set(aFirstLabel, _root->ID()); if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; aFirstNode->Remove(); @@ -219,18 +209,17 @@ bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; + DF_Label aLabel = theObject.GetLabel(); + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; - + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), aNode->Label()); } @@ -246,10 +235,10 @@ bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SOb //============================================================================ bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent() { - if(_root.IsNull()) return false; + if(!_root) return false; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); aRef->Set(_root->Label()); @@ -261,20 +250,20 @@ bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull()) return false; + if(!_root) return false; - TDF_Label aLabel; - if (theObject.IsNull()) aLabel = _root->Label(); + DF_Label aLabel; + if (!theObject) aLabel = _root->Label(); else - aLabel = theObject->GetLabel(); + aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; - - return !(aNode->GetFirst().IsNull()); + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; + + return (aNode->GetFirst()); } //============================================================================ @@ -282,15 +271,15 @@ bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject) * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName) { - if(_root.IsNull()) return false; +bool SALOMEDSImpl_UseCaseBuilder::SetName(const string& theName) { + if(!_root) return false; - Handle(SALOMEDSImpl_AttributeName) aNameAttrib; + SALOMEDSImpl_AttributeName* aNameAttrib = NULL; - if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttrib)) + if (!(aNameAttrib=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) aNameAttrib = SALOMEDSImpl_AttributeName::Set(_root->Label(), theName); - else - aNameAttrib->SetValue(theName); + + aNameAttrib->SetValue(theName); return true; } @@ -301,16 +290,18 @@ bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() { - if(_root.IsNull()) return NULL; + SALOMEDSImpl_SObject so; + if(!_root) return so; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - if(aCurrent.IsNull()) return NULL; + + DF_Label aCurrent = aRef->Get(); + if(aCurrent.IsNull()) return so; return SALOMEDSImpl_Study::SObject(aCurrent); } @@ -320,15 +311,14 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName() +string SALOMEDSImpl_UseCaseBuilder::GetName() { - TCollection_AsciiString aString; - if(_root.IsNull()) return aString; + string aString; + if(!_root) return aString; - Handle(SALOMEDSImpl_AttributeName) aName; - if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString; - aString = TCollection_AsciiString(aName->Value()); - return aString; + SALOMEDSImpl_AttributeName* aName = NULL; + if (!(aName=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) return aString; + return aName->Value(); } //============================================================================ @@ -336,10 +326,10 @@ TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const SALOMEDSImpl_SObject& theObject) { - if(theObject.IsNull()) return false; - TDF_Label aFather, aLabel = theObject->GetLabel(); + if(!theObject) return false; + DF_Label aFather, aLabel = theObject.GetLabel(); aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); if(aLabel.Father() == aFather) return true; return false; @@ -350,33 +340,33 @@ bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TCollection_AsciiString& theName) +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::AddUseCase(const string& theName) { - Standard_GUID aBasicGUID(USE_CASE_GUID); + string aBasicGUID(USE_CASE_GUID); //Create a use cases structure if it not exists - Handle(SALOMEDSImpl_AttributeTreeNode) aFatherNode, aNode; - Handle(SALOMEDSImpl_AttributeInteger) anInteger; - Handle(SALOMEDSImpl_AttributeReference) aRef; + SALOMEDSImpl_AttributeTreeNode *aFatherNode = NULL, *aNode = NULL; + SALOMEDSImpl_AttributeInteger* anInteger = NULL; + SALOMEDSImpl_AttributeReference* aRef = NULL; - TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); + DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(aLabel, aLabel); } - if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) { + if(!(aFatherNode=(SALOMEDSImpl_AttributeTreeNode*)aRef->Get().FindAttribute(aBasicGUID))) { aFatherNode = SALOMEDSImpl_AttributeTreeNode::Set(aRef->Get(), aBasicGUID); } - if(!_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) { + if(!(anInteger=(SALOMEDSImpl_AttributeInteger*)_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { anInteger = SALOMEDSImpl_AttributeInteger::Set(aLabel, 0); - } + } //Create a new use case anInteger->SetValue(anInteger->Value()+1); - TDF_Label aChild = aLabel.FindChild(anInteger->Value()); + DF_Label aChild = aLabel.FindChild(anInteger->Value()); aNode = SALOMEDSImpl_AttributeTreeNode::Set(aChild, aBasicGUID); aNode->Remove(); aFatherNode->Append(aNode); @@ -390,25 +380,24 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TColl * Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated */ //============================================================================ -Handle(SALOMEDSImpl_UseCaseIterator) -SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& theObject) +SALOMEDSImpl_UseCaseIterator +SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const SALOMEDSImpl_SObject& theObject) { - TDF_Label aLabel; + DF_Label aLabel; - if(!theObject.IsNull()) { - aLabel = theObject->GetLabel(); //Iterate only sub tree in the use case + if(theObject) { + aLabel = theObject.GetLabel(); //Iterate only sub tree in the use case } else { aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases } - return new SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false); + return SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false); } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetSObject(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetSObject(const string& theEntry) { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - return SALOMEDSImpl_Study::SObject(aLabel); + DF_Label L = DF_Label::Label(_root->Label(), theEntry); + return SALOMEDSImpl_Study::SObject(L); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx index ba4a55264..c54a5dd93 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx @@ -24,63 +24,55 @@ #ifndef __SALOMEDSIMPL_USECaseBuilder_H__ #define __SALOMEDSIMPL_USECaseBuilder_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) - -// Cascade headers -#include -#include -#include -#include +#include +#include "DF_Document.hxx" +#include "DF_Label.hxx" +#include "SALOMEDSImpl_AttributeTreeNode.hxx" #include "SALOMEDSImpl_UseCaseIterator.hxx" -class SALOMEDSImpl_UseCaseBuilder : public MMgt_TShared +class SALOMEDSImpl_UseCaseBuilder { private: - Handle(SALOMEDSImpl_AttributeTreeNode) _root; - Handle(TDocStd_Document) _doc; + SALOMEDSImpl_AttributeTreeNode* _root; + DF_Document* _doc; public: //! standard constructor - Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument); + Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument); //! standard destructor Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder(); - Standard_EXPORT virtual bool Append(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool Append(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool Remove(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool Remove(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, const Handle(SALOMEDSImpl_SObject)& theNext); + Standard_EXPORT virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext); - Standard_EXPORT virtual bool SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject); Standard_EXPORT virtual bool SetRootCurrent(); - Standard_EXPORT virtual bool HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool SetName(const TCollection_AsciiString& theName); + Standard_EXPORT virtual bool SetName(const std::string& theName); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetCurrentObject(); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetCurrentObject(); - Standard_EXPORT virtual TCollection_AsciiString GetName(); + Standard_EXPORT virtual std::string GetName(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) AddUseCase(const TCollection_AsciiString& theName); + Standard_EXPORT virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName); - Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseIterator) GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& anObject); + Standard_EXPORT virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject); - Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry); + Standard_EXPORT SALOMEDSImpl_SObject GetSObject(const std::string& theEntry); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseBuilder ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx index 24cc9e6e9..b6013a643 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx @@ -27,20 +27,28 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) +//============================================================================ +/*! Function : empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator() +{ + _node = NULL; +} + //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel, - const Standard_GUID& theGUID, +SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel, + const string& theGUID, const bool allLevels) :_guid(theGUID), _levels(allLevels) { - if(theLabel.FindAttribute(_guid, _node)) { + if((_node = (SALOMEDSImpl_AttributeTreeNode*)theLabel.FindAttribute(_guid))) { _it.Initialize (_node, _levels); } } @@ -74,7 +82,7 @@ bool SALOMEDSImpl_UseCaseIterator::More() return _it.More(); } - //============================================================================ +//============================================================================ /*! Function : Next * */ @@ -91,9 +99,24 @@ void SALOMEDSImpl_UseCaseIterator::Next() */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value() +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseIterator::Value() { - TDF_Label L = _it.Value()->Label(); + DF_Label L = _it.Value()->Label(); return SALOMEDSImpl_Study::SObject(L); } +//============================================================================ +/*! Function : GetPersistentCopy + * + */ +//============================================================================ +SALOMEDSImpl_UseCaseIterator* SALOMEDSImpl_UseCaseIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_UseCaseIterator* itr = new SALOMEDSImpl_UseCaseIterator(); + itr->_it = _it; + itr->_node = _node; + itr->_guid = _guid; + itr->_levels = _levels; + + return itr; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx index d979ae263..a01cb1040 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx @@ -24,32 +24,28 @@ #ifndef __SALOMEDSIMPL_USECASEITERATOR_H__ #define __SALOMEDSIMPL_USECASEITERATOR_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) - #include "SALOMEDSImpl_SObject.hxx" +#include "DF_ChildIterator.hxx" +#include "SALOMEDSImpl_ChildNodeIterator.hxx" -// Cascade headers -#include -#include -#include +#include -class SALOMEDSImpl_UseCaseIterator : public MMgt_TShared +class Standard_EXPORT SALOMEDSImpl_UseCaseIterator { private: - Standard_GUID _guid; + std::string _guid; bool _levels; - Handle(SALOMEDSImpl_AttributeTreeNode) _node; + SALOMEDSImpl_AttributeTreeNode* _node; SALOMEDSImpl_ChildNodeIterator _it; public: + SALOMEDSImpl_UseCaseIterator(); + //! standard constructor - SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel, - const Standard_GUID& theGUID, + SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel, + const std::string& theGUID, const bool allLevels); //! standard destructor @@ -58,9 +54,8 @@ public: virtual void Init(bool); virtual bool More(); virtual void Next(); - virtual Handle(SALOMEDSImpl_SObject) Value(); + virtual SALOMEDSImpl_SObject Value(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseIterator ) + SALOMEDSImpl_UseCaseIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am index 014064ccd..e0c170eda 100644 --- a/src/SALOMEDSImpl/Test/Makefile.am +++ b/src/SALOMEDSImpl/Test/Makefile.am @@ -57,10 +57,10 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ + -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. @@ -77,6 +77,7 @@ COMMON_LIBS =\ $(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \ $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \ $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \ + $(RPATH)/DF/libDF.la \ $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \ $(top_builddir)/idl/libSalomeIDLKernel.la diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx index 30029799d..d1dff067a 100644 --- a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx +++ b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx @@ -33,8 +33,6 @@ #include "SALOMEDSImpl_StudyBuilder.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -#include - using namespace std; // ============================================================================ @@ -45,11 +43,6 @@ using namespace std; void SALOMEDSImplTest::setUp() { - TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR")); - TCollection_AsciiString subPath("/share/salome/resources/kernel"); - TCollection_AsciiString csf_var = (kernel+subPath); - setenv("CSF_PluginDefaults", csf_var.ToCString(), 0); - setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0); } // ============================================================================ @@ -70,11 +63,11 @@ SALOMEDSImplTest::tearDown() // ============================================================================ void SALOMEDSImplTest::testAttributeParameter() { - Handle(SALOMEDSImpl_StudyManager) sm = new SALOMEDSImpl_StudyManager(); - Handle(SALOMEDSImpl_Study) study = sm->NewStudy("Test"); - Handle(SALOMEDSImpl_AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0); + SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager(); + SALOMEDSImpl_Study* study = sm->NewStudy("Test"); + SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0); - CPPUNIT_ASSERT(!_ap.IsNull()); + CPPUNIT_ASSERT(_ap); _ap->SetInt("IntValue", 1); CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER)); diff --git a/src/SALOMEDSImpl/testDS.cxx b/src/SALOMEDSImpl/testDS.cxx index c256306e7..48a119b09 100644 --- a/src/SALOMEDSImpl/testDS.cxx +++ b/src/SALOMEDSImpl/testDS.cxx @@ -23,14 +23,12 @@ #include #include #include +#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_ChildIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_StudyManager.hxx" @@ -39,77 +37,110 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" +#include "SALOMEDSImpl_UseCaseIterator.hxx" //#include "SALOMEDSImpl_.hxx" +using namespace std; + int main (int argc, char * argv[]) { cout << "Test started " << endl; - Handle(SALOMEDSImpl_StudyManager) aSM = new SALOMEDSImpl_StudyManager(); + SALOMEDSImpl_StudyManager* aSM = new SALOMEDSImpl_StudyManager(); cout << "Manager is created " << endl; - Handle(SALOMEDSImpl_Study) aStudy = aSM->NewStudy("SRN"); + SALOMEDSImpl_Study* aStudy = aSM->NewStudy("SRN"); cout << "Study with id = " << aStudy->StudyId() << " is created " << endl; cout << "Check the study lock, locking" << endl; aStudy->SetStudyLock("SRN"); cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; - cout << "Get study locker : " << aStudy->GetLockerID() << endl; + vector ids = aStudy->GetLockerID(); + for(int i = 0; iUnLockStudy("SRN"); cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; - Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder(); + SALOMEDSImpl_StudyBuilder* aBuilder = aStudy->NewBuilder(); cout << "StudyBuilder is created " << endl; - Handle(SALOMEDSImpl_SComponent) aSC = aBuilder->NewComponent("TEST"); - cout << "New component with type " << aSC->ComponentDataType() << " is created " << endl; - Handle(SALOMEDSImpl_SObject) aSO = aBuilder->NewObject(aSC); - cout << "New SObject with ID = " << aSO->GetID() << " is created" << endl; - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aSO->GetLabel(), anEntry); - cout << "An entry of newly created SO is " << anEntry << endl; - Handle(SALOMEDSImpl_AttributeIOR) aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO->GetLabel(), "ior1234"); - cout << "New AttributeIOR is created, it contains " << aIORA->Value() << endl; - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aIORA); - cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl; + SALOMEDSImpl_SComponent aSC = aBuilder->NewComponent("TEST"); + cout << "New component with type " << aSC.ComponentDataType() << " is created " << endl; + SALOMEDSImpl_SObject aSO = aBuilder->NewObject(aSC); + cout << "New SObject with ID = " << aSO.GetID() << " is created" << endl; + cout << "An entry of newly created SO is " << aSO.GetLabel().Entry() << endl; + SALOMEDSImpl_AttributeIOR* aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO.GetLabel(), "ior1234"); + cout << "New AttributeIOR is created, it contains " << dynamic_cast(aIORA)->Value() << endl; + cout << "Attribute has type: " << aIORA->Type() << " and value: " << aIORA->Save() << endl; cout << "Just another way to create an attribute: official one :) " << endl; - Handle(TDF_Attribute) aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName"); - Handle(SALOMEDSImpl_AttributeName) aRN = Handle(SALOMEDSImpl_AttributeName)::DownCast(aTDFAttr); + cout << "Is SO null : " << aSO.IsNull()<< endl; + DF_Attribute* aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName"); + SALOMEDSImpl_AttributeName* aRN = dynamic_cast(aTDFAttr); aRN->SetValue("name_attribute"); cout << " The type = " << aRN->Type() << endl; - ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aRN); - cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl; + cout << "Attribute has type: " << aRN->Type() << " and value: " << aRN->Save() << endl; cout << "Check GetObjectPath: " << aStudy->GetObjectPath(aSO) << endl; - Handle(SALOMEDSImpl_SObject) aSubSO = aBuilder->NewObject(aSO); + SALOMEDSImpl_SObject aSubSO = aBuilder->NewObject(aSO); aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeIOR"); - Handle(SALOMEDSImpl_AttributeIOR) aIOR2 = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(aTDFAttr); + SALOMEDSImpl_AttributeIOR* aIOR2 = dynamic_cast(aTDFAttr); aIOR2->SetValue("some ior"); aBuilder->Addreference(aSubSO, aSO); - Handle(SALOMEDSImpl_SObject) aRefObject; - aSubSO->ReferencedObject(aRefObject); - cout << "Check reference : ReferencedObject is " << aRefObject->GetID() << endl; + SALOMEDSImpl_SObject aRefObject; + aSubSO.ReferencedObject(aRefObject); + cout << "Check reference : ReferencedObject is " << aRefObject.GetID() << endl; cout << "Check : Remove object: " << endl; aBuilder->RemoveObject(aSubSO); cout << "Remove: done" << endl; + cout << "Try invalid attribute creation" << endl; + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "invalid type"); + cout << "Address of created attribute : " << aTDFAttr << endl; + + cout << "Check AttributeUserID" << endl; + + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"); + if(aTDFAttr) { + cout << "Attribute UserID was created succesfully : id = " << dynamic_cast(aTDFAttr)->Value() << endl; + } + else cout << "Can't create AttributeUserID" << endl; + + string id = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + dynamic_cast(aTDFAttr)->SetValue(id); + cout << "SetValue id = " << dynamic_cast(aTDFAttr)->Value() << endl; + + string id2 = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"+id2); + if(aTDFAttr) { + cout << "Attribute UserID was created succesfully : id = " << dynamic_cast(aTDFAttr)->Value() << endl; + } + else cout << "Can't create AttributeUserID" << endl; + cout << "Check AttributeTreeNode " << endl; aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode"); - cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl; + cout << dynamic_cast(aTDFAttr)->Type() << endl; cout << "Check AttributeTreeNode : done " << endl; aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeParameter"); - cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl; + cout << dynamic_cast(aTDFAttr)->Type() << endl; cout << "Check the attributes on SObject" << endl; - Handle(TColStd_HSequenceOfTransient) aSeq = aSO->GetAllAttributes(); - for(int i = 1; i <= aSeq->Length(); i++) - cout << "Found: " << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))->Type() << endl; + vector aSeq = aSO.GetAllAttributes(); + for(int i = 0; i < aSeq.size(); i++) + cout << "Found: " << dynamic_cast(aSeq[i])->Type() << endl; + cout << "Check UseCase" << endl; + SALOMEDSImpl_UseCaseBuilder* ucb = aStudy->GetUseCaseBuilder(); + ucb->AddUseCase("use_case1"); + ucb->AddUseCase("use_case2"); + SALOMEDSImpl_UseCaseIterator ucitr = ucb->GetUseCaseIterator(SALOMEDSImpl_SObject()); + ucitr.Init(false); + cout << "More? : " << ucitr.More() << endl; cout << "Check AttributeParameter " << endl; - Handle(SALOMEDSImpl_AttributeParameter) AP = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(aTDFAttr); + SALOMEDSImpl_AttributeParameter* AP = dynamic_cast(aTDFAttr); cout << "AttributeParameter with type : " << AP->Type() << endl; @@ -125,7 +156,7 @@ int main (int argc, char * argv[]) cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl; /* for(int i = 2; i < 5; i++) { - TCollection_AsciiString s((double)(1.0/i)); + string s((double)(1.0/i)); cout << "Setting for " << i << " value : " << s << endl; AP->SetString(i, s); } @@ -162,7 +193,7 @@ int main (int argc, char * argv[]) vs.push_back("world!"); AP->SetStrArray("3", vs); - TCollection_AsciiString as = AP->Save(); + string as = AP->Save(); cout << "AS = " << as << endl; AP->Load(as); @@ -193,6 +224,23 @@ int main (int argc, char * argv[]) cout << "Check AttributeParameter : done" << endl; + + SALOMEDSImpl_SComponent tst = aBuilder->NewComponent("TEST2"); + aSO = aBuilder->NewObject(tst); + SALOMEDSImpl_SObject ss = aBuilder->NewObjectToTag(aSO, 3); + aBuilder->NewObjectToTag(ss, 1); + aBuilder->NewObjectToTag(ss, 3); + SALOMEDSImpl_SObject ss2 = aBuilder->NewObjectToTag(aSO, 2); + aBuilder->NewObjectToTag(ss, 2); + + SALOMEDSImpl_ChildIterator ci=aStudy->NewChildIterator(tst); + for(ci.InitEx(true); ci.More(); ci.Next()) + cout << "######## " << ci.Value().GetID() << endl; + + DF_ChildIterator dci(tst.GetLabel(), true); + for(; dci.More(); dci.Next()) + cout << "###### DF: " << dci.Value().Entry() << endl; + cout << "Test finished " << endl; return 0; } diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.hxx b/src/SALOMELocalTrace/LocalTraceBufferPool.hxx index b439cc54a..bd55a1dc2 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.hxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.hxx @@ -28,7 +28,7 @@ #define TRACE_BUFFER_SIZE 256 // number of entries in circular buffer // must be power of 2 -#define MAX_TRACE_LENGTH 256 // messages are truncated at this size +#define MAX_TRACE_LENGTH 1024 // messages are truncated at this size #include #include diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index 6cbaed7b5..f34170657 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -148,6 +148,7 @@ LocalTraceCollector:: ~LocalTraceCollector() int ret = pthread_join(*_threadId, NULL); if (ret) cerr << "error close LocalTraceCollector : "<< ret << endl; else DEVTRACE("LocalTraceCollector destruction OK"); + delete _threadId; _threadId = 0; _threadToClose = 0; } diff --git a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py index 2c6ea82a1..dadd6002a 100644 --- a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py +++ b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py @@ -19,12 +19,13 @@ import sys, os,signal,string,commands import runSalome +import setenv # get SALOME environment : # here we need KERNEL_ROOT_DIR, PATH, LD_LIBRARY_PATH -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # execute Unit Test diff --git a/src/SALOMELocalTrace/utilities.h b/src/SALOMELocalTrace/utilities.h index 0c8b3d696..c20c835a0 100644 --- a/src/SALOMELocalTrace/utilities.h +++ b/src/SALOMELocalTrace/utilities.h @@ -92,7 +92,7 @@ #error INFOS_COMPILATION already defined #endif -#ifdef _DEBUG_ +#if defined(_DEBUG_) || defined(_DEBUG) // --- the following MACROS are useful at debug time diff --git a/src/TOOLSDS/Makefile.am b/src/TOOLSDS/Makefile.am index e015ae928..a041e283f 100644 --- a/src/TOOLSDS/Makefile.am +++ b/src/TOOLSDS/Makefile.am @@ -40,15 +40,13 @@ COMMON_CPPFLAGS=\ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @HDF5_INCLUDES@ \ @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../Utils/libOpUtil.la \ - $(top_builddir)/idl/libSalomeIDLKernel.la\ - @CAS_KERNEL@ + $(top_builddir)/idl/libSalomeIDLKernel.la # # =============================================================== diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index e67c96a5e..fcf2be69d 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -28,24 +28,19 @@ #include "utilities.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #ifndef WNT -#include +#include +#include +#include #include #include -#include +#include +#include #else +#include +#include #endif + #include #include @@ -53,6 +48,22 @@ using namespace std; +bool Exists(const string thePath) +{ +#ifdef WNT + if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { + if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + return false; + } + } +#else + int status = access ( thePath.c_str() , F_OK ); + if (status != 0) return false; +#endif + return true; +} + + //============================================================================ // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" @@ -61,54 +72,57 @@ std::string SALOMEDS_Tool::GetTmpDir() { //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; + string aTmpDir = ""; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { - aTmpDir = TCollection_AsciiString(Tmp_dir); + aTmpDir = string(Tmp_dir); #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif } else { #ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); + aTmpDir = string("C:\\"); #else - aTmpDir = TCollection_AsciiString("/tmp/"); + aTmpDir = string("/tmp/"); #endif } srand((unsigned int)time(NULL)); int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - TCollection_AsciiString aSubDir(aRND); - if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory + string aDir = aTmpDir; + + if(Exists(aDir)) { + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name + } + } + #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aDir[aDir.size()-1] != '\\') aDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aDir[aTmpDir.size()-1] != '/') aDir+='/'; #endif - OSD_Path aPath(aTmpDir); - OSD_Directory aDir(aPath); - - for(aRND = 0; aDir.Exists(); aRND++) { - aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aPath = OSD_Path(aTmpDir); - aDir = OSD_Directory(aPath); - } - MESSAGE("#### TMP" << aTmpDir.ToCString()); - - //OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); - OSD_Protection aProtection(OSD_RWXD, OSD_RWX, OSD_RX, OSD_RX ); - aDir.Build(aProtection); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return aTmpDir.ToCString(); + return aDir; } //============================================================================ @@ -119,35 +133,29 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, const SALOMEDS::ListOfFileNames& theFiles, const bool IsDirDeleted) { - TCollection_AsciiString aDirName(const_cast(theDirectory.c_str())); + string aDirName = theDirectory; int i, aLength = theFiles.length(); - for(i=0; iMore()) - { - delete anIterator; - aDir.Remove(); - } + if(Exists(aDirName)) { +#ifdef WNT + RemoveDirectory(aDireName.c_str()); +#else + rmdir(aDirName.c_str()); +#endif + } } } @@ -169,7 +177,7 @@ namespace return (new SALOMEDS::TMPFile); //Get a temporary directory for saved a file - TCollection_AsciiString aTmpDir(const_cast(theFromDirectory.c_str())); + string aTmpDir = theFromDirectory; long aBufferSize = 0; long aCurrentPos; @@ -185,14 +193,12 @@ namespace //Check if the file exists if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero - TCollection_AsciiString aFullPath = aTmpDir + const_cast(theFiles[i].in()); - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; + string aFullPath = aTmpDir + const_cast(theFiles[i].in()); + if(!Exists(aFullPath)) continue; #ifdef WNT - ifstream aFile(aFullPath.ToCString(), ios::binary); + ifstream aFile(aFullPath.c_str(), ios::binary); #else - ifstream aFile(aFullPath.ToCString()); + ifstream aFile(aFullPath.c_str()); #endif aFile.seekg(0, ios::end); aFileSize[i] = aFile.tellg(); @@ -221,14 +227,12 @@ namespace for(i=0; i(theFiles[i].in()); - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; + string aFullPath = aTmpDir + const_cast(theFiles[i].in()); + if(!Exists(aFullPath)) continue; #ifdef WNT - aFile = new ifstream(aFullPath.ToCString(), ios::binary); + aFile = new ifstream(aFullPath.c_str(), ios::binary); #else - aFile = new ifstream(aFullPath.ToCString()); + aFile = new ifstream(aFullPath.c_str()); #endif } //Initialize 4 bytes of the buffer by 0 @@ -300,7 +304,7 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, return aFiles; //Get a temporary directory for saving a file - TCollection_AsciiString aTmpDir(const_cast(theToDirectory.c_str())); + string aTmpDir = theToDirectory; unsigned char *aBuffer = (unsigned char*)theStream.NP_data(); @@ -331,11 +335,11 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); aCurrentPos += 8; - TCollection_AsciiString aFullPath = aTmpDir + aFileName; + string aFullPath = aTmpDir + aFileName; #ifdef WNT - ofstream aFile(aFullPath.ToCString(), ios::binary); + ofstream aFile(aFullPath.c_str(), ios::binary); #else - ofstream aFile(aFullPath.ToCString()); + ofstream aFile(aFullPath.c_str()); #endif aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); aFile.close(); @@ -353,11 +357,30 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, // purpose : Returns the name by the path //============================================================================ std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) { - if(thePath == "") - return ""; - OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast(thePath.c_str()))); - TCollection_AsciiString aNameString(aPath.Name()); - return aNameString.ToCString(); + if (thePath.empty()) return ""; + string aPath = thePath; + bool isFound = false; + int pos = aPath.rfind('/'); + if(pos > 0) { + aPath = aPath.substr(pos+1, aPath.size()); + isFound = true; + } + if(!isFound) { + pos = aPath.rfind('\\'); + if(pos > 0) { + aPath = aPath.substr(pos+1, aPath.size()); + isFound = true; + } + } + if(!isFound) { + pos = aPath.rfind('|'); + if(pos > 0) aPath = aPath.substr(pos+1, aPath.size()); + } + + pos = aPath.rfind('.'); + if(pos > 0) aPath = aPath.substr(0, pos); //Remove extension + + return aPath; } //============================================================================ @@ -365,12 +388,32 @@ std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) { // purpose : Returns the dir by the path //============================================================================ std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) { - if(thePath == "") - return ""; - OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast(thePath.c_str()))); - TCollection_AsciiString aDirString(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return aDirString.ToCString(); + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); idestroy()" << std::endl; - _orb->destroy() ; + try { + _orb->destroy() ; + } + catch(...) { + MESSAGE("Caught CORBA::Exception."); + } //std::cerr << "retour _orb->destroy()" << std::endl; } } @@ -55,13 +60,9 @@ CORBA::ORB_var &ORB_INIT::operator() ( int argc , char **argv ) throw( CommExcep try { #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + _orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - _orb = CORBA::ORB_init( argc , argv ) ; - //set GIOP message size equal to 50Mb for transferring brep shapes as - //sequence of bytes using C++ streams - omniORB::MaxMessageSize(100*1024*1024); + _orb = CORBA::ORB_init( argc, argv, "omniORB3" ) ; #endif } catch( const CORBA::Exception &ex ) -- 2.39.2